1. 06 9月, 2012 28 次提交
    • 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: convert pointless error checks in set_config to BUGs · 8d3e375e
      Daniel Vetter 提交于
      Because they all are, the ioctl command never calls us with any of
      these violated. Also drop a equally pointless empty debug message (and
      also in set_cursor, while we're at it).
      
      With all these changes, intel_crtc_set_config is neatly condensed down
      to it's essence, the actual modeset code (or fb update calling code)
      
      v2: The fb helper code is actually stretching ->set_config semantics a bit,
      it calls it with set->mode == NULL but set->fb != NULL.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8d3e375e
    • D
      drm/i915: don't update the fb base if there is no fb · 835c5873
      Daniel Vetter 提交于
      Otherwise we'll set_fb complains pretty loudly if we the crtc is off
      and userspace moves the NULL fb around a bit. Yeah, this actually
      happens in the wild ...
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      835c5873
    • D
      drm/i915: implement crtc helper semantics relied upon by the fb helper · 431e50f7
      Daniel Vetter 提交于
      Yikes!
      
      But yeah, we have to do this until someone volunteers to clean up the
      fb helper and rid it of its incetious relationship with the crtc
      helper code.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      431e50f7
    • D
      drm/i915: extract intel_set_config_update_output_state · 2e431051
      Daniel Vetter 提交于
      Note that this function already clobbers the mode config state,
      so we have to clean things up if something fails.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2e431051
    • 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: extract modeset config save/restore code · 85f9eb71
      Daniel Vetter 提交于
      At the end this won't be of much use to us, but meanwhile just extract
      it to get a better overview of what exactly set_config does.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      85f9eb71
    • 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: ensure the force pipe A quirk is actually followed · 7fad798e
      Daniel Vetter 提交于
      Many BIOSen forget to turn on the pipe A after resume (because they
      actually don't turn on anything), so we have to do that ourselves when
      sanitizing the hw state.
      
      I've discovered this due to the recent addition of a pipe WARN that
      takes the force quirk into account.
      
      v2: Actually try to enable the pipe with a proper configuration instead
      of simpyl switching it on with whatever random state the bios left it
      in after resume.
      
      v3: Fixup rebase conflict - the load_detect functions have lost their
      encoder argument.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7fad798e
    • 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
      drm/i915: read out the modeset hw state at load and resume time · 24929352
      Daniel Vetter 提交于
      ... instead of resetting a few things and hoping that this will work
      out.
      
      To properly disable the output pipelines at the initial modeset after
      resume or boot up we need to have an accurate picture of which outputs
      are enabled and connected to which crtcs. Otherwise we risk disabling
      things at the wrong time, which can lead to hangs (or at least royally
      confused panels), both requiring a walk to the reset button to fix.
      
      Hence read out the hw state with the freshly introduce get_hw_state
      functions and then sanitize it afterwards.
      
      For a full modeset readout (which would allow us to avoid the initial
      modeset at boot up) a few things are still missing:
      - Reading out the mode from the pipe, especially the dotclock
        computation is quite some fun.
      - Reading out the parameters for the stolen memory framebuffer and
        wrapping it up.
      - Reading out the pch pll connections - luckily the disable code
        simply bails out if the crtc doesn't have a pch pll attached (even
        for configurations that would need one).
      
      This patch here turned up tons of smelly stuff around resume: We
      restore tons of register in seemingly random way (well, not quite, but
      we're not too careful either), which leaves the hw in a rather
      ill-defined state: E.g. the port registers are sometimes
      unconditionally restore (lvds, crt), leaving us with an active
      encoder/connector but no active pipe connected to it. Luckily the hw
      state sanitizer detects this madness and fixes things up a bit.
      
      v2: When checking whether an encoder with active connectors has a crtc
      wire up to it, check for both the crtc _and_ it's active state.
      
      v3:
      - Extract intel_sanitize_encoder.
      - Manually disable active encoders without an active pipe.
      
      v4: Correclty fix up the pipe<->plane mapping on machines where we
      switch pipes/planes. Noticed by Chris Wilson, who also provided the
      fixup.
      
      v5: Spelling fix in a comment, noticed by Paulo Zanoni
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      24929352
    • 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: call crtc functions directly · dbf2b54e
      Daniel Vetter 提交于
      Instead of going through the crtc helper function tables.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      dbf2b54e
    • 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: simplify intel_crtc_prepare_encoders · 821112aa
      Daniel Vetter 提交于
      - We don't have the ->get_crtc callback.
      - Call intel_encoder->disable directly.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      821112aa
    • 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: inline intel_best_encoder · 6d832d18
      Daniel Vetter 提交于
      Also kill the error-path, we have a fixed connector->encoder mapping.
      
      Unfortunately we can't rip out all the ->best_encoder callbacks, these
      are all still used by the fb_helper. Neat helper layering violation there.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6d832d18
    • D
      drm/i915: call set_base directly · 4f660f49
      Daniel Vetter 提交于
      And drop the check, we always have it.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4f660f49
    • D
      drm/i915: copy&paste drm_crtc_helper_set_config · 50f56119
      Daniel Vetter 提交于
      And the following static functions required by it:
      drm_encoder_crtc_ok, drm_crtc_helper_disable
      
      No changes safe for the s/drm/intel prefix change.
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      50f56119
    • 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: rip out encoder->disable/enable checks · fa5c73b1
      Daniel Vetter 提交于
      All encoders are now converted so there's no need for these checks any
      more.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fa5c73b1
    • 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
    • D
      drm/i915: rip out crtc prepare/commit indirection · eae307a5
      Daniel Vetter 提交于
      Just impendance matching with the the crtc helper stuff.
      
      ... and somehow the design of this all ended up in this commit here,
      too ;-)
      
      The big plan is that this new set of crtc display_funcs take full
      responsibility of modeset operations for the entire display output
      pipeline (by calling down into object-specific callbacks and
      functions). The platform-specific callbacks simply know best what the
      proper order is.
      
      This has the drawback that we can't do minimal change-overs any more
      if a modeset just disables one encoder in a cloned configuration
      (because we will only expose a disable/enable action that takes
      down/sets up the entire crtc including all encoders). Imo that's the
      only sane way to do it though:
      - The use-case for this is pretty minimal, even when presenting (at
        least sane people) should use a dual-screen output so that you can
        see your notes on your panel. Clone mode is imo BS.
      - With all the clone mode constrains, shared resources, and special
        ordering requirements (which differ even on the same platform
        sometimes for different outputs) there's no way we'd get this right
        for all cases. Especially since this is a under-used feature.
      - And to top it off: On haswell even dp link re-training requires us
        to take down the entire display pipe - otherwise the chip dies.
      
      So the only sane way is to do a full modeset on every crtc where the
      output config changes in any way.
      
      To support global modeset (i.e. set the configuration for all crtcs at
      once) we'd then add one more function to allocate global and shared
      objects in the best ways (e.g. fdi links, pch plls, ...). The crtc
      functions would then simply use the pre-allocated stuff (and shouldn't
      be able to fail, ever). We could even do all the object pinning in
      there (and maybe try to defragment the global gtt if we fail)!
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      eae307a5
    • D
      drm/i915: add crtc->enable/disable vfuncs insted of dpms · 76e5a89c
      Daniel Vetter 提交于
      Because that's what we're essentially calling. This is the first step
      in untangling the crtc_helper induced dpms handling mess we have - at
      the crtc level we only have 2 states and the magic is just in
      selecting which one (and atm there isn't even much magic, but on
      recent platforms where not even the crt output has more than 2 states
      we could do better).
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      76e5a89c
  2. 17 8月, 2012 9 次提交
  3. 12 8月, 2012 1 次提交
    • D
      drm/i915: ignore eDP bpc settings from vbt · 4344b813
      Daniel Vetter 提交于
      This has originally been introduced to not oversubscribe the dp links
      in
      
      commit 885a5fb5
      Author: Zhenyu Wang <zhenyuw@linux.intel.com>
      Date:   Tue Jan 12 05:38:31 2010 +0800
      
          drm/i915: fix pixel color depth setting on eDP
      
      Since then we've fixed up the dp link bandwidth calculation code and
      should now automatically fall back to 6bpc dithering. So this is
      unnecessary.
      
      Furthermore it seems to break the new MacbookPro with retina display,
      hence let's just rip this out.
      Reported-by: NBenoit Gschwind <gschwind@gnu-log.net>
      Cc: Benoit Gschwind <gschwind@gnu-log.net>
      Cc: Francois Rigaut <frigaut@gmail.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: stable@vger.kernel.org
      Tested-by: NBenoit Gschwind <gschwind@gnu-log.net>
      Tested-by: Bernhard Froemel <froemel at vmars tuwien.ac.at>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      
      --
      
      Testing feedback highgly welcome, and thanks for Benoit for finding
      out that the bpc computations are busted.
      -Daniel
      4344b813
  4. 11 8月, 2012 1 次提交
  5. 10 8月, 2012 1 次提交