1. 28 1月, 2013 1 次提交
  2. 21 1月, 2013 2 次提交
    • D
      drm: don't hold crtc mutexes for connector ->detect callbacks · 7b24056b
      Daniel Vetter 提交于
      The coup de grace of the entire journey. No more dropped frames every
      10s on my testbox!
      
      I've tried to audit all ->detect and ->get_modes callbacks, but things
      became a bit fuzzy after trying to piece together the umpteenth
      implemenation. Afaict most drivers just have bog-standard output
      register frobbing with a notch of i2c edid reading, nothing which
      could potentially race with the newly concurrent pageflip/set_cursor
      code. The big exception is load-detection code which requires a
      running pipe, but radeon/nouveau seem to to this without touching any
      state which can be observed from page_flip (e.g. disabled crtcs
      temporarily getting enabled and so a pageflip succeeding).
      
      The only special case I could find is the i915 load detect code. That
      uses the normal modeset interface to enable the load-detect crtc, and
      so userspace could try to squeeze in a pageflip on the load-detect
      pipe. So we need to grab the relevant crtc mutex in there, to avoid
      the temporary crtc enabling to sneak out and be visible to userspace.
      
      Note that the sysfs files already stopped grabbing the per-crtc locks,
      since I didn't want to bother with doing a interruptible
      modeset_lock_all. But since there's very little in-between breakage
      (essentially just the ability for userspace to pageflip on load-detect
      crtcs when it shouldn't on the i915 driver) I figured I don't need to
      bother.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7b24056b
    • D
      drm: revamp framebuffer cleanup interfaces · 36206361
      Daniel Vetter 提交于
      We have two classes of framebuffer
      - Created by the driver (atm only for fbdev), and the driver holds
        onto the last reference count until destruction.
      - Created by userspace and associated with a given fd. These
        framebuffers will be reaped when their assoiciated fb is closed.
      
      Now these two cases are set up differently, the framebuffers are on
      different lists and hence destruction needs to clean up different
      things. Also, for userspace framebuffers we remove them from any
      current usage, whereas for internal framebuffers it is assumed that
      the driver has done this already.
      
      Long story short, we need two different ways to cleanup such drivers.
      Three functions are involved in total:
      - drm_framebuffer_remove: Convenience function which removes the fb
        from all active usage and then drops the passed-in reference.
      - drm_framebuffer_unregister_private: Will remove driver-private
        framebuffers from relevant lists and drop the corresponding
        references. Should be called for driver-private framebuffers before
        dropping the last reference (or like for a lot of the drivers where
        the fbdev is embedded someplace else, before doing the cleanup
        manually).
      - drm_framebuffer_cleanup: Final cleanup for both classes of fbs,
        should be called by the driver's ->destroy callback once the last
        reference is gone.
      
      This patch just rolls out the new interfaces and updates all drivers
      (by adding calls to drm_framebuffer_unregister_private at all the
      right places)- no functional changes yet. Follow-on patches will move
      drm core code around and update the lifetime management for
      framebuffers, so that we are no longer required to keep framebuffers
      alive by locking mode_config.mutex.
      
      I've also updated the kerneldoc already.
      
      vmwgfx seems to again be a bit special, at least I haven't figured out
      how the fbdev support in that driver works. It smells like it's
      external though.
      
      v2: The i915 driver creates another private framebuffer in the
      load-detect code. Adjust its cleanup code, too.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      36206361
  3. 20 1月, 2013 1 次提交
    • D
      drm/<drivers>: reorder framebuffer init sequence · c7d73f6a
      Daniel Vetter 提交于
      With more fine-grained locking we can no longer rely on the big
      mode_config lock to prevent concurrent access to mode resources
      like framebuffers. Instead a framebuffer becomes accessible to
      other threads as soon as it is added to the relevant lookup
      structures. Hence it needs to be fully set up by the time drivers
      call drm_framebuffer_init.
      
      This patch here is the drivers part of that reorg. Nothing really fancy
      going on safe for three special cases.
      
      - exynos needs to be careful to properly unref all handles.
      - nouveau gets a resource leak fixed for free: one of the error
        cases didn't cleanup the framebuffer, which is now moot since
        the framebuffer is only registered once it is fully set up.
      - vmwgfx requires a slight reordering of operations, I'm hoping I didn't
        break anything (but it's refcount management only, so should be safe).
      
      v2: Split out exynos, since it's a bit more hairy than expected.
      
      v3: Drop bogus cirrus hunk noticed by Richard Wilbur.
      
      v4: Split out vmwgfx since there's a small change in return values.
      
      Reviewed-by: Rob Clark <rob@ti.com> (core + omapdrm)
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c7d73f6a
  4. 09 1月, 2013 1 次提交
  5. 08 1月, 2013 1 次提交
  6. 21 12月, 2012 1 次提交
  7. 19 12月, 2012 2 次提交
    • K
      i915: ensure that VGA plane is disabled · 0fde901f
      Krzysztof Mazur 提交于
      Some broken systems (like HP nc6120) in some cases, usually after LID
      close/open, enable VGA plane, making display unusable (black screen on LVDS,
      some strange mode on VGA output). We used to disable VGA plane only once at
      startup. Now we also check, if VGA plane is still disabled while changing
      mode, and fix that if something changed it.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57434Signed-off-by: NKrzysztof Mazur <krzysiek@podlesie.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0fde901f
    • D
      drm/i915: don't disable disconnected outputs · b0a2658a
      Daniel Vetter 提交于
      This piece of neat lore has been ported painstakingly and bug-for-bug
      compatible from the old crtc helper code.
      
      Imo it's utter nonsense.
      
      If you disconnected a cable and before you reconnect it, userspace (or
      the kernel) does an set_crtc call, this will result in that connector
      getting disabled. Which will result in a nice black screen when
      plugging in the cable again.
      
      There's absolutely no reason the kernel does such policy enforcements
      - if userspace tries to set up a mode on something disconnected we
      might fail loudly (since the dp link training fails), but silently
      adjusting the output configuration behind userspace's back is a recipe
      for disaster. Specifically I think that this could explain some of our
      MI_WAIT hangs around suspend, where userspace issues a scanline wait
      on a disable pipe. This mechanisims here could explain how that pipe
      got disabled without userspace noticing.
      
      Note that this fixes a NULL deref at BIOS takeover when the firmware
      sets up a disconnected output in a clone configuration with a
      connected output on the 2nd pipe: When doing the full modeset we don't
      have a mode for the 2nd pipe and OOPS. On the first pipe this doesn't
      matter, since at boot-up the fbdev helpers will set up the choosen
      configuration on that on first. Since this is now the umptenth bug
      around handling this imo brain-dead semantics correctly, I think it's
      time to kill it and see whether there's any userspace out there which
      relies on this.
      
      It also nicely demonstrates that we have a tiny window where DP
      hotplug can still kill the driver.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58396
      Cc: stable@vger.kernel.org
      Tested-by: NPeter Ujfalusi <peter.ujfalusi@gmail.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b0a2658a
  8. 18 12月, 2012 1 次提交
    • D
      drm/i915: fixup overlay stolen memory leak · 4d7bb011
      Daniel Vetter 提交于
      We need to clean up the overlay first, before taking down the
      stolen memory allocator.
      
      This regression has been introducec in
      
      commit 80405138
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Thu Nov 15 11:32:29 2012 +0000
      
          drm/i915: Allocate overlay registers from stolen memory
      
      v2: Rework the patch a bit as suggested by Chris Wilson:
      - move the overlay teardown up, into the modeset cleanup
      - move the stolen mm takedown into i915_gem_cleanup_stolen
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4d7bb011
  9. 17 12月, 2012 3 次提交
  10. 14 12月, 2012 2 次提交
  11. 13 12月, 2012 1 次提交
    • D
      drm/i915: rework locking for intel_dpio|sbi_read|write · 09153000
      Daniel Vetter 提交于
      Spinning for up to 200 us with interrupts locked out is not good. So
      let's just spin (and even that seems to be excessive).
      
      And we don't call these functions from interrupt context, so this is
      not required. Besides that doing anything in interrupt contexts which
      might take a few hundred us is a no-go. So just convert the entire
      thing to a mutex. Also move the mutex-grabbing out of the read/write
      functions (add a WARN_ON(!is_locked)) instead) since all callers are
      nicely grouped together.
      
      Finally the real motivation for this change: Dont grab the modeset
      mutex in the dpio debugfs file, we don't need that consistency. And
      correctness of the dpio interface is ensured with the dpio_lock.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      09153000
  12. 11 12月, 2012 1 次提交
    • D
      drm/i915: disable cpt phase pointer fdi rx workaround · 539526b4
      Daniel Vetter 提交于
      We've originally added this in
      
      commit 291427f5
      Author: Jesse Barnes <jbarnes@virtuousgeek.org>
      Date:   Fri Jul 29 12:42:37 2011 -0700
      
          drm/i915: apply phase pointer override on SNB+ too
      
      and then copy-pasted it over to ivb/ppt. The w/a was originally added
      for ilk/ibx in
      
      commit 5b2adf89
      Author: Jesse Barnes <jbarnes@virtuousgeek.org>
      Date:   Thu Oct 7 16:01:15 2010 -0700
      
          drm/i915: add Ironlake clock gating workaround for FDI link training
      
      and fixed up a bit in
      
      commit 6f06ce18
      Author: Jesse Barnes <jbarnes@virtuousgeek.org>
      Date:   Tue Jan 4 15:09:38 2011 -0800
      
          drm/i915: set phase sync pointer override enable before setting phase sync pointer
      
      It turns out that this w/a isn't actually required on cpt/ppt and
      positively harmful on ivb/ppt when using fdi B/C links - it results in
      a black screen occasionally, with seemingfully everything working as
      it should. The only failure indication I've found in the hw is that
      eventually (but not right after the modeset completes) a pipe underrun
      is signalled.
      
      Big thanks to Arthur Runyan for all the ideas for registers to check
      and changes to test, otherwise I couldn't ever have tracked this down!
      
      Cc: "Runyan, Arthur J" <arthur.j.runyan@intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      539526b4
  13. 10 12月, 2012 3 次提交
  14. 08 12月, 2012 1 次提交
  15. 06 12月, 2012 5 次提交
    • D
      drm/i915: extract common link_m_n helpers · e69d0bc1
      Daniel Vetter 提交于
      Both the dp and fdi code use the exact same computations (ignore minor
      differences in conversion between bits and bytes).
      
      This makes it even more apparent that we have a _massive_ mess between
      cpu transcoder/fdi link/pch transcoder and pch link settings. And also
      that we have hilarious amounts of confusion between edp and dp
      (despite that they're identical at a link level).
      Reviewed-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e69d0bc1
    • D
      drm/i915: drop unnecessary clearing of pch dp transcoder timings · 2f0c2ad1
      Daniel Vetter 提交于
      This has originally been added in
      
      commit 8db9d77b
      Author: Zhenyu Wang <zhenyuw@linux.intel.com>
      Date:   Wed Apr 7 16:15:54 2010 +0800
      
          drm/i915: Support for Cougarpoint PCH display pipeline
      
      probably to combat issues with hw state left behind by the BIOS. And
      indeed, I've checked out that specific revision, and there is no DP
      support yet. So the pch dp transcoder won't be correctly disabled, and
      that's important since it requires a rether special disable dance:
      Just writing 0 to TRANS_DP_CTL won't cut it, since we need to select
      the NONE port when disabling, too.
      
      And indeed, things seem to still work, so let's just remove this.
      Reviewed-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2f0c2ad1
    • D
      drm/i915: move set_pll_edp to intel_dp.c · ea9b6006
      Daniel Vetter 提交于
      Now that we enable the cpu edp pll in intel_dp->pre_enable and no
      longer in crtc_mode_set, we can also move the modeset part to the
      intel_dp->mode_set callback. Previously this was not possible because
      the encoder ->mode_set callbacks are called after the crtc mode set
      callback.
      
      v2: Rebase on top of copy&pasted hsw crtc_mode_set.
      Reviewed-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ea9b6006
    • D
      drm/i915: rip out pre-DDI stuff from haswell_crtc_mode_set · ed7ef439
      Daniel Vetter 提交于
      Especially getting rid of all things lvds is ... great!
      
      v2: Drop the two additional pre-hsw hunks noticed by Paulo Zanoni.
      
      v3:
      - handle DP ports correctly (spoted by Paulo)
      - don't leave {} behind for a single-line block (again spotted by
        Paulo)
      - kill another if (IBX || CPT) block
      Reviewed-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ed7ef439
    • C
      drm/i915: Close race between processing unpin task and queueing the flip · e7d841ca
      Chris Wilson 提交于
      Before queuing the flip but crucially after attaching the unpin-work to
      the crtc, we continue to setup the unpin-work. However, should the
      hardware fire early, we see the connected unpin-work and queue the task.
      The task then promptly runs and unpins the fb before we finish taking
      the required references or even pinning it... Havoc.
      
      To close the race, we use the flip-pending atomic to indicate when the
      flip is finally setup and enqueued. So during the flip-done processing,
      we can check more accurately whether the flip was expected.
      
      v2: Add the appropriate mb() to ensure that the writes to the page-flip
      worker are complete prior to marking it active and emitting the MI_FLIP.
      On the read side, the mb should be enforced by the spinlocks.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: stable@vger.kernel.org
      [danvet: Review the barriers a bit, we need a write barrier both
      before and after updating ->pending. Similarly we need a read barrier
      in the interrupt handler both before and after reading ->pending. With
      well-ordered irqs only one barrier in each place should be required,
      but since this patch explicitly sets out to combat spurious interrupts
      with is staged activation of the unpin work we need to go full-bore on
      the barriers, too. Discussed with Chris Wilson on irc and changes
      acked by him.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e7d841ca
  16. 04 12月, 2012 1 次提交
    • D
      drm/i915: fixup sparse warnings · 1a240d4d
      Daniel Vetter 提交于
      - __iomem where there is none (I love how we mix these things up).
      - Use gfp_t instead of an other plain type.
      - Unconfuse one place about enum pipe vs enum transcoder - for the pch
        transcoder we actually use the pipe enum. Fixup the other cases
        where we assign the pipe to the cpu transcoder with explicit casts.
      - Declare the mch_lock properly in a header.
      
      There is still a decent mess in intel_bios.c about __iomem, but heck,
      this is x86 and we're allowed to do that.
      
      Makes-sparse-happy: Chris Wilson <chris@chris-wilson.co.uk>
      [danvet: Use a space after the cast consistently and fix up the
      newly-added cast in i915_irq.c to properly use __iomem.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1a240d4d
  17. 01 12月, 2012 1 次提交
    • C
      drm/i915: Delay allocation of stolen space for FBC · 11be49eb
      Chris Wilson 提交于
      As FBC is commonly disabled due to limitations of the chipset upon
      output configurations, on many systems FBC is never enabled. For those
      systems, it is advantageous to make use of the stolen memory for other
      objects and so we defer allocation of the FBC chunk until we actually
      require it. This increases the likelihood of that allocation failing,
      but that in turns means that we are already taking advantage of the
      stolen memory!
      
      As well as delaying the allocation from driver initialisation until the
      first use of FBC, we also return the stolen block after we finish using
      it - allowing greater flexibility in our usage of stolen space. A side
      effect of this is that we can then attempt to allocate only the required
      amount of space (with a little slack to reduce reallocation rate and
      avoid fragmentation).
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      11be49eb
  18. 29 11月, 2012 9 次提交
  19. 23 11月, 2012 1 次提交
    • J
      drm/i915: do not default to 18 bpp for eDP if missing from VBT · 9a30a61f
      Jani Nikula 提交于
      commit 500a8cc4
      Author: Zhenyu Wang <zhenyuw@linux.intel.com>
      Date:   Wed Jan 13 11:19:52 2010 +0800
      
          drm/i915: parse eDP panel color depth from VBT block
      
      originally introduced parsing bpp for eDP from VBT, with a default of 18
      bpp if the eDP BIOS data block is not present. Turns out that default seems
      to break the Macbook Pro with retina display, as noted in
      
      commit 4344b813
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Fri Aug 10 11:10:20 2012 +0200
      
          drm/i915: ignore eDP bpc settings from vbt
      
      Since we can't ignore bpc settings from VBT completely after all, get rid
      of the default. Do not clamp eDP to 18 bpp by default if the eDP BDB is
      missing from VBT.
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Tested-by: NHenrik Rydberg <rydberg@euromail.se>
      [danvet: paste in the updated commit message from irc.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9a30a61f
  20. 22 11月, 2012 2 次提交