1. 24 10月, 2012 1 次提交
    • D
      drm/i915: Don't try to use SPR_SCALE when we don't have a sprite scaler · 2d354c34
      Damien Lespiau 提交于
      Haswell does not have a scaler in the sprite pipeline anymore, so let's
      ensure:
        1/ We bail out of update_plate() when someone is trying to ask to
           display a scaled framebuffer,
        2/ We never write to the nonexistent SPR_SCALE register
      
      v2: Smash in the fixup from Damien in the disable_plane function.
      
      Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> (for v1)
      Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> (for v1)
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2d354c34
  2. 23 10月, 2012 4 次提交
  3. 19 10月, 2012 2 次提交
  4. 18 10月, 2012 2 次提交
  5. 10 10月, 2012 4 次提交
  6. 03 10月, 2012 2 次提交
  7. 26 9月, 2012 1 次提交
  8. 20 9月, 2012 1 次提交
    • D
      drm/i915: add encoder->pre_enable/post_disable · bf49ec8c
      Daniel Vetter 提交于
      The cpu eDP encoder has some horrible hacks to set up the DP pll at
      the right time. To be able to move them to the right place, add some
      more encoder callbacks so that this can happen at the right time.
      
      LVDS has some similar funky hacks, but that would require more work
      (we need to move around the pll setup a bit). Hence for now only
      wire these new callbacks up for ilk+ - we only have cpu eDP on these
      platforms.
      
      v2: Bikeshed the vtable ordering, requested by Chris Wilson.
      Reviewed-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bf49ec8c
  9. 06 9月, 2012 22 次提交
    • D
      drm/i915: improve modeset state checking after dpms calls · b980514c
      Daniel Vetter 提交于
      Now that we have solid modeset state tracking and checking code in
      place, we can do the Full Monty also after dpms calls.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b980514c
    • D
      drm/i915: disable all crtcs at suspend time · a261b246
      Daniel Vetter 提交于
      We need this to avoid confusing the hw state readout code with the cpt
      pch plls at resume time: We'd read the new pipe state (which is
      disabled), but still believe that we have a life pll connected to that
      pipe (from before the suspend). Hence properly disable pipes to clear
      out all the residual state.
      
      This has the neat side-effect that we don't enable ports prematurely
      by restoring bogus state from the saved register values.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a261b246
    • D
      drm/i915: push commit_output_state past the crtc/encoder preparing · ea9d758d
      Daniel Vetter 提交于
      With this change we can (finally!) rip out a few of the temporary hacks
      and clean up a few other things:
      - Kill intel_crtc_prepare_encoders, now unused.
      - Kill the hacks in the crtc_disable/enable functions to always call the
        encoder callbacks, we now always call the crtc functions with the right
        encoder -> crtc links.
      - Also push down the crtc->enable, encoder and connector dpms state
        updates. Unfortunately we can't add a WARN in the crtc_disable
        callbacks to ensure that the crtc is always still enabled when
        disabling an output pipe - the crtc sanitizer of the hw readout path
        can hit this when it needs to disable an active pipe without any
        enabled outputs.
      - Only call crtc->disable if the pipe is already enabled - again avoids
        running afoul of the new WARN.
      
      v2: Copy&paste our own version of crtc_in_use, too.
      
      v3: We need to update the dpms an encoder->connectors_active states,
      too.
      
      v4: I've forgotten to kill the unconditional encoder->disable calls in
      the crtc_disable functions.
      
      v5: Rip out leftover debug printk.
      
      v6: Properly clear intel_encoder->connectors_active. This wasn't
      properly cleared when disabling an encoder because it was no longer on
      the new connector list, but the crtc was still enabled (i.e. switching
      the encoder of an active crtc). Reported by Jani Nikula.
      
      v7: Don't clobber the encoder->connectors_active state of untouched
      encoders. Since X likes to first disable all outputs with dpms off
      before setting a new framebuffer, this hit a few warnings. Reported by
      Paulo Zanoni.
      
      v8: Kill the now stale comment warning that intel_crtc->active is not
      always updated at the right times.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ea9d758d
    • D
      drm/i915: s/intel_encoder_disable/intel_encoder_noop · 1f703855
      Daniel Vetter 提交于
      Because that's what it is. Unfortunately we can't rip this out because
      the fb helper has an incetious relationship with the crtc helper - it
      likes to call disable_unused_functions, among other things.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1f703855
    • D
      drm/i915: use staged outuput config in tv->mode_fixup · 6ed0f796
      Daniel Vetter 提交于
      The "is this encoder cloned" check will be reused by the lvds encoder,
      hence exract it.
      
      v2: Be a bit more careful about that we need to check the new, staged
      ouput configuration in the check_non_cloned helper ...
      
      v3: Kill the double negation with s/!non_cloned/is_cloned/, suggested
      by Jesse Barnes.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6ed0f796
    • D
      drm/i915: push crtc->fb update into pipe_set_base · 94352cf9
      Daniel Vetter 提交于
      Passing in the old fb, having overwritten the current fb, leads to
      some neatly convoluted code. It's much simpler if we defer the
      crtc->fb update to the place that updates the hw, in pipe_set_base.
      This way we also don't need to restore anything in case something
      fails - we only update crtc->fb once things have succeeded.
      
      The real reason for this change is that now we keep the old fb
      assigned to crtc->fb, which allows us to finally move the crtc disable
      case into the common low-level set_mode function in the next patch.
      
      Also don't clobber crtc->x and crtc->y, we neatly pass these down the
      callchain already. Unfortunately we can't do the same with crtc->mode,
      because that one is being used in the mode_set callbacks.
      
      v2: Don't restore the drm_crtc object any more on failed modesets,
      since we've lose an fb reference otherwise. Also (and this is the
      reason this has been found), this totally confused the modeset state
      tracking, since it clobbers crtc->enabled. Issue reported by Paulo
      Zanoni.
      
      v3: Rip out the entire crtc saving into struct intel_set_config, not
      just the restoring part.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      94352cf9
    • D
      drm/i915: stage modeset output changes · 9a935856
      Daniel Vetter 提交于
      This is the core of the new modeset logic.
      
      The current code which is based upon the crtc helper code first
      updates all the link of the new display pipeline and then calls the
      lower-level set_mode function to execute the required callbacks to get
      there. The issue with this approach is that for disabling we need to
      know the _current_ display pipe state, not the new one.
      
      Hence we need to stage the new state of the display pipe and only
      update it once we have disabled the current configuration and before we
      start to update the hw registers with the new configuration.
      
      This patch here just prepares the ground by switching the new output
      state computation to these staging pointers. To make it clearer,
      rename the old update_output_state function to stage_output_state.
      
      A few peculiarities:
      - We're also calling the set_mode function at various places to update
        properties. Hence after a successfule modeset we need to stage the
        current configuration (for otherwise we might fall back again). This
        happens automatically because as part of the (successful) modeset we
        need to copy the staged state to the real one. But for the hw
        readout code we need to make sure that this happens, too.
      - Teach the new staged output state computation code the required
        smarts to handle the disabling of outputs. The current code handles
        this in a special case, but to better handle global modeset changes
        covering more than one crtc, we want to do this all in the same
        low-level modeset code.
      - The actual modeset code is still a bit ugly and wants to know the new
        crtc->enabled state a bit early. Follow-on patches will clean that
        up, for now we have to apply the staged output configuration early,
        outside of the set_mode functions.
      - Improve/add comments in stage_output_state.
      
      Essentially all that is left to do now is move the disabling code into
      set_mode and then move the staged state update code also into
      set_mode, at the right place between disabling things and calling the
      mode_set callbacks for the new configuration.
      
      v2: Disabling a crtc works by passing in a NULL mode or fb, userspace
      doesn't hand in the list of connectors. We therefore need to detect
      this case manually and tear down all the output links.
      
      v3: Properly update the output staging pointers after having read out
      the hw state.
      
      v4: Simplify the code, add more DRM_DEBUG_KMS output and check a few
      assumptions with WARN_ON. Essentially all things that I've noticed
      while debugging issues in other places of the code.
      
      v4: Correctly disable the old set of connectors when enabling an
      already enabled crtc on a new set of crtc. Reported by Paulo Zanoni.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9a935856
    • D
      drm/i915: don't save all the encoder/crtc state in set_config · 1aa4b628
      Daniel Vetter 提交于
      We actually only touch the connector -> encoder and encoder -> crtc
      linking. So it's enough to just save/restore that.
      
      While at it, also switch to kcalloc to allocate these arrays (omission
      in the commit message spotted by Jesse Barnes).
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1aa4b628
    • D
      drm/i915: extract intel_set_config_compute_mode_changes · 5e2b584e
      Daniel Vetter 提交于
      This computes what exactly changed in the modeset configuration, i.e.
      whether a full modeset is required or only an update of the
      framebuffer base address or no change at all.
      
      In the future we might add more checks for e.g. when only the output
      mode changed, so that we could do a minimal modeset for outputs that
      support this. Like the lvds/eDP panels where we only need to update
      the panel fitter.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5e2b584e
    • D
      drm/i915: introduce struct intel_set_config · d9e55608
      Daniel Vetter 提交于
      intel_crtc_set_config is an unwidly beast and is in serious need of
      some function extraction. To facilitate that, introduce a struct to
      keep track of all the state involved. Atm it doesn't do much more than
      keep track of all the allocated memory.
      
      v2: Apply some bikeshed to intel_set_config_free, as suggested by
      Jesse Barnes.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d9e55608
    • D
      drm/i915: rip out intel_dp->dpms_mode · 24e804ba
      Daniel Vetter 提交于
      We now track the connector state in encoder->connectors_active, and
      because the DP output can't be cloned, that is sufficient to track the
      link state. Hence use this instead of adding yet another modeset state
      variable with dubious semantics at driver load and resume time.
      
      Also, connectors_active should only ever be set when the encoder is
      linked to a crtc, hence convert that crtc test into a WARN.
      
      v2: Rebase on top of struct intel_dp moving.
      
      v3: The rebase accidentally killed the newly-introduced intel_dp->port
      Noticed by Paulo Zanoni.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      24e804ba
    • D
      drm/i915: rip out intel_crtc->dpms_mode · 84bb65bd
      Daniel Vetter 提交于
      Afaict this has been used for two things:
      - To prevent the crtc enable code from being run twice. We have now
        intel_crtc->active to track this in a more precise way.
      - To ensure the code copes correctly with the unknown hw state after
        boot and resume. Thanks to the hw state readout and sanitize code we
        have now a better way to handle this.
      
      The only thing it still does is complicate our modeset state space.
      
      Having outlived its usefullness, let it just die.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      84bb65bd
    • D
      drm/i915: check connector hw/sw state · 0a91ca29
      Daniel Vetter 提交于
      Atm we can only check the connector state after a dpms call - while
      doing modeset with the copy&pasted crtc helper code things are too
      ill-defined for proper checking. But the idea is very much to call
      this check from the modeset code, too.
      
      v2: Fix dpms check and don't presume that if the hw isn't on that it
      must not be linked up with an encoder (it could simply be switched off
      with the dpms state).
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0a91ca29
    • D
      85234cdc
    • D
      drm/i915: Add interfaces to read out encoder/connector hw state · f0947c37
      Daniel Vetter 提交于
      It is all glorious if we try really hard to only enable/disable an
      entire display pipe to ensure that everyting happens in the right
      order. But if we don't know the output configuration when the driver
      takes over, this will all be for vain because we'll make the hw angry
      right on the first modeset - we don't know what outputs/ports are
      enabled and hence have to disable everything in a rather ad-hoc way.
      
      Hence we need to be able to read out the current hw state, so that we
      can properly tear down the current hw state on the first modeset.
      Obviously this is also a nice preparation for the fastboot work, where
      we try to avoid the modeset on driver load if it matches what the hw
      is currently using.
      
      Furthermore we'll be using these functions to cross-check the actual
      hw state with what we think it should be, to ensure that the modeset
      state machine actually works as advertised.
      
      This patch only contains the interface definitions and a little helper
      for the simple case where we have a 1:1 encoder to connector mapping.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f0947c37
    • D
      drm/i915: WARN when trying to enabled an unused crtc · 08a48469
      Daniel Vetter 提交于
      This is the first tiny step towards cross-checking the entire modeset
      state machine with WARNs. A crtc can only be enabled when it's
      actually in use, i.e. crtc->active imlies crtc->enabled.
      
      Unfortunately we can't (yet) check this when disabling the crtc,
      because the crtc helpers are a bit slopy with updating state and
      unconditionally update crtc->enabled before changing the hw state.
      
      Fixing that requires quite some more work.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      08a48469
    • D
      drm/i915: rip out encoder->prepare/commit · c9deac97
      Daniel Vetter 提交于
      With the new infrastructure we're doing this when enabling/disabling
      the entire display pipe.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c9deac97
    • D
      drm/i915: copy&paste drm_crtc_helper_set_mode · a6778b3c
      Daniel Vetter 提交于
      Together with the static helper functions drm_crtc_prepare_encoders
      and drm_encoder_disable (which will be simplified in the next patch,
      but for now are 1:1 copies). Again, no changes beside new names for
      these functions.
      
      Also call our new set_mode instead of the crtc helper one now in all
      the places we've done so far.
      
      v2: Call the function just intel_set_mode to better differentia it
      from intel_crtc_mode_set which really only does the ->mode_set step of
      the entire modeset sequence on one crtc. Whereas this function does
      the global change.
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a6778b3c
    • D
      drm/i915: clean up encoder_prepare/commit · 61b77ddd
      Daniel Vetter 提交于
      We no longer need them. And now that all encoders are converted, we
      can finally move the cpt modeset check to the right place - at the end
      of the crtc_enable function.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      61b77ddd
    • D
      drm/i915: convert dpms functions of dvo/sdvo/crt · b2cabb0e
      Daniel Vetter 提交于
      Yeah, big patch but I couldn't come up with a neat idea of how to
      split it up further, that wouldn't break dpms on cloned configs
      somehow. But the changes in dvo/sdvo/crt are all pretty much
      orthonogal, so it's not too bad a patch.
      
      These are the only encoders that support cloning, which requires a few
      special changes compared to the previous patches.
      - Compute the desired state of the display pipe by walking all
        connected encoders and checking whether any has active connectors.
        To make this clearer, drop the old mode parameter to the crtc dpms
        function and rename it to intel_crtc_update_dpms.
      - There's the curious case of intel_crtc->dpms_mode. With the previous
        patches to remove the overlay pipe A code and to rework the load
        detect pipe code, the big users are gone. We still keep it to avoid
        enabling the pipe twice, but we duplicate this logic with
        crtc->active, too. Still, leave this for now and just push a fake
        dpms mode into it that reflects the state of the display pipe.
      
      Changes in the encoder dpms functions:
      - We clamp the dpms state to the supported range right away. This is
        escpecially important for the VGA outputs, where only older hw
        supports the intermediate states. This (and the crt->adpa_reg patch)
        allows us to unify the crt dpms code again between all variants
        (gmch, vlv and pch).
      - We only enable/disable the output for dvo/sdvo and leave the encoder
        running. The encoder will be disabled/enabled when we switch the
        state of the entire output pipeline (which will happen right away
        for non-cloned setups). This way the duplication is reduced and
        strange interaction when disabling output ports at the wrong time
        avoided.
      
      The dpms code for all three types of connectors contains a bit of
      duplicated logic, but I think keeping these special cases separate is
      simpler: CRT is the only one that hanldes intermediate dpms state
      (which requires extra logic to enable/disable things in the right
      order), and introducing some abstraction just to share the code
      between dvo and sdvo smells like overkill. We can do that once someone
      bothers to implement cloning for the more modern outputs. But I doubt
      that this will ever happen.
      
      v2: s/crtc/crt/_set_dpms, noticed by Paulo Zanoni.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b2cabb0e
    • D
      drm/i915/hdmi: convert to encoder->disable/enable · 5ab432ef
      Daniel Vetter 提交于
      I've picked hdmi as the first encoder to convert because it's rather
      simple:
      - no cloning possible
      - no differences between prepare/commit and dpms off/on switching.
      
      A few changes are required to do so:
      - Split up the dpms code into an enable/disable function and wire it
        up with the intel encoder.
      - Noop out the existing encoder prepare/commit functions used by the
        crtc helper - our crtc enable/disable code now calls back into the
        encoder enable/disable code at the right spot.
      - Create new helper functions to handle dpms changes.
      - Add intel_encoder->connectors_active to better track dpms state. Atm
        this is unused, but it will be useful to correctly disable the
        entire display pipe for cloned configurations. Also note that for
        now this is only useful in the dpms code - thanks to the crtc
        helper's dpms confusion across a modeset operation we can't (yet)
        rely on this having a sensible value in all circumstances.
      - Rip out the encoder helper dpms callback, if this is still getting
        called somewhere we have a bug. The slight issue with that is that
        the crtc helper abuses dpms off to disable unused functions. Hence
        we also need to implement a default encoder disable function to do
        just that with the new encoder->disable callback.
      - Note that we drop the cpt modeset verification in the commit
        callback, too. The right place to do this would be in the crtc's
        enable function, _after_ all the encoders are set up. But because
        not all encoders are converted yet, we can't do that. Hence disable
        this check temporarily as a minor concession to bisectability.
      
      v2: Squash the dpms mode to only the supported values -
      connector->dpms is for internal tracking only, we can hence avoid
      needless state-changes a bit whithout causing harm.
      
      v3: Apply bikeshed to disable|enable_ddi, suggested by Paulo Zanoni.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5ab432ef
    • D
      drm/i915: add direct encoder disable/enable infrastructure · ef9c3aee
      Daniel Vetter 提交于
      Just prep work, not yet put to some use.
      
      Note that because we're still using the crtc helper to switch modes
      (and their complicated way to do partial modesets), we need to call
      the encoder's disable function unconditionally.
      
      But once this is cleaned up we shouldn't call the encoder's disable
      function unconditionally any more, because then we know that we'll
      only call it if the encoder is actually enabled. Also note that we
      then need to be careful about which crtc we're filtering the encoder
      list on: We want to filter on the crtc of the _current_ mode, not the
      one we're about to set up.
      
      For the enabling side we need to do the same trick. And again, we
      should be able to simplify this quite a bit when things have settled
      into place.
      
      Also note that this simply does not take cloning into account, so dpms
      needs to be handled specially for the few outputs where we even bother
      with it.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ef9c3aee
  10. 03 9月, 2012 1 次提交