1. 22 3月, 2014 2 次提交
    • D
      drm/helper: lock all around force mode restore · 3ea87855
      Dave Airlie 提交于
      Since Daniel documented things with a sledge hammer, we got lots of
      nice backtraces in suspend/resume operations, I've check the callers
      of this and they all seems safe to me,
      
      This fixes one set of warns I reported.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      3ea87855
    • D
      drm/crtc-helper: fix locking for drm_helper_disable_unused_functions · b182cc59
      Daniel Vetter 提交于
      We have two calling contexts for thise function:
      
      - In the crtc helper code itself as part of the ->set_config
        implementation. In this calling context all modeset locks are
        already held, as they should.
      
      - In drivers not implementing fastboot before the fbdev/fbcon setup
        and initialization. This has been added for all drivers in
      
        commit 76a39dbf
        Author: Daniel Vetter <daniel.vetter@ffwll.ch>
        Date:   Sun Jan 20 23:12:54 2013 +0100
      
            drm/fb-helper: don't disable everything in initial_config
      
        In this calling context we do not hold any modeset locks since the
        immediately following call to initialize the fbev emulation grabs
        all these locks themselves.
      
      - There are two exceptions to the above rule: shmob doesn't have fbdev
        emulation support. I've manually checked the callchain up to the
        driver load function and no kms locks are held.
      
      The right fix therefore is to split this helper into an internal and
      external version and add the required locking to the function exported
      to drivers.
      
      This remedies locking inconsistencies exposed by me adding locking
      WARNs as part of the recent kerneldoc abi polishing done in
      
      commit 62ff94a5
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Thu Jan 23 22:18:47 2014 +0100
      
          drm/crtc-helper: remove LOCKING from kerneldoc
      
      and
      
      commit 63951385
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Thu Jan 23 15:14:15 2014 +0100
      
          drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c
      
      v2: It helps when I actually git add the entire thing.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Tested-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      b182cc59
  2. 13 3月, 2014 6 次提交
  3. 20 1月, 2014 1 次提交
  4. 14 1月, 2014 2 次提交
  5. 06 11月, 2013 6 次提交
  6. 31 10月, 2013 1 次提交
    • T
      drm: Track the proper DPMS mode of connectors · a6ad6230
      Thierry Reding 提交于
      When userspace removes the active framebuffer using DRM_IOCTL_MODE_RMFB,
      or explicitly disables the CRTC (by calling drmModeSetCrtc(..., NULL)
      for example), a NULL framebuffer will be passed to the .set_config()
      implementation of a CRTC. The drm_crtc_helper_set_config() helper will
      decide to disable a CRTC when that happens.
      
      To do so, it calls drm_crtc_helper_disable(), which in turn will iterate
      over all encoders and decouple them from their connectors and finally
      call drm_helper_disable_unused_functions() to clean up and call the
      .disable() or .dpms() implementation for each encoder. However, at no
      point during this sequence does it track the DPMS mode of a connector,
      so it will usually remain on after this.
      
      When a connector is enabled again, drm_helper_connector_dpms() will not
      notice that the DPMS mode actually changed and won't do anything, which
      causes the connector to stay disabled indefinitely.
      
      To prevent this from happening, explicitly set the connector's DPMS mode
      to off when the CRTC is disabled. That way it reflects the correct state
      and can be enabled again.
      
      This solves an issue observed when terminating an X server running on
      the xf86-video-modesetting driver. Without this patch, the connector
      would not be enabled properly and the screen would stay dark.
      Acked-by: NDavid Airlie <airlied@linux.ie>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      a6ad6230
  7. 23 10月, 2013 1 次提交
  8. 12 10月, 2013 1 次提交
    • D
      drm: Add separate Kconfig option for fbdev helpers · 92b6f89f
      Daniel Vetter 提交于
      For drivers which might want to disable fbdev legacy support.
      
      Select the new option in all drivers for now, so this shouldn't result
      in any change. Drivers need some work anyway to make fbdev support
      optional (if they have it implemented, that is), so the recommended
      way to expose this is by adding per-driver options. At least as long
      as most drivers don't support disabling the fbdev support.
      
      v2: Update for new drm drivers msm and rcar-du. Note that Rob's msm
      driver can already take advantage of this, which allows us to build
      msm without any fbdev depencies in the kernel!
      
      v3: Move the MODULE_* stuff from the fbdev helper file to
      drm_crtc_helper.c.
      
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Acked-by: NDave Airlie <airlied@linux.ie>
      Reviewed-by: NChon Ming Lee <chon.ming.lee@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      92b6f89f
  9. 09 10月, 2013 1 次提交
  10. 01 10月, 2013 1 次提交
  11. 02 9月, 2013 1 次提交
  12. 22 7月, 2013 1 次提交
    • D
      drm/crtc-helper: explicit DPMS on after modeset · 25f397a4
      Daniel Vetter 提交于
      Atm the crtc helper implementation of set_config has really
      inconsisten semantics: If just an fb update is good enough, dpms state
      will be left as-is, but if we do a full modeset we force everything to
      dpms on.
      
      This change has already been applied to the i915 modeset code in
      
      commit e3de42b6
      Author: Imre Deak <imre.deak@intel.com>
      Date:   Fri May 3 19:44:07 2013 +0200
      
          drm/i915: force full modeset if the connector is in DPMS OFF mode
      
      which according to Greg KH seems to aim for a new record in most
      Bugzilla: links in a commit message.
      
      The history of this dpms forcing is pretty interesting. This patch
      here is an almost-revert of
      
      commit 811aaa55
      Author: Keith Packard <keithp@keithp.com>
      Date:   Thu Feb 3 16:57:28 2011 -0800
      
          drm: Only set DPMS ON when actually configuring a mode
      
      which fixed the bug of trying to dpms on disabled outputs, but
      introduced the new discrepancy between an fb update only and full
      modesets. The actual introduction of this goes back to
      
      commit bf9dc102
      Author: Keith Packard <keithp@keithp.com>
      Date:   Fri Nov 26 10:45:58 2010 -0800
      
          drm: Set connector DPMS status to ON in drm_crtc_helper_set_config
      
      And if you'd dig around in the i915 driver code there's even more fun
      around forcing dpms on and losing our heads and temper of the
      resulting inconsistencies. Especially the DP re-training code had tons
      of funny stuff in it.
      
      v2: So v1 totally blew up on resume on my radeon system here. After
      much head-scraching I've figured out that the radeon resume functions
      resumes the console system _before_ it actually restores all the
      modeset state. And resuming the console systems means that fbdev doeas
      an immediate ->set_par call.
      
      Now up to this patch that ->set_par did absolutely nothing: All the
      old sw state from pre-suspend was still around (since the modeset
      reset wasn't done yet), which means that the set_config calls done as
      a result of the ->set_par where all treated as no-ops (despite that
      the real hw state was obviously something completely different).
      
      Since v1 of this patch just added a bunch of ->dpms calls if the crtc
      was enabled, those set_config calls suddenly stopped being no-ops. But
      because the hw state wasn't restored the ->dpms callbacks resulted in
      decent amounts of hilarity and eventual full hangs.
      
      Since I can't review all kms drivers for such tricky ordering
      constraints v2 opts for a different approach and forces a full modeset
      if the connector dpms state isnt' DPMS_ON. Since the ->dpms callbacks
      implemented by the modeset helpers update the connector->dpms property
      we have the same effect of ensuring that the pipe is ultimately turned
      on, even if we just end up updating the fb. This is the same approac
      we ended up using in the intel driver.
      
      Note that besides i915.ko only all other drivers eventually call
      drm_helper_connector_dpms with the exception of vmwgfx, which does not
      support dmps at all.
      
      v3: Dave Airlie merged the broken first version of this patch, so
      squash in the revert of
      
      commit 372835a8
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Sat Jun 15 00:13:13 2013 +0200
      
          drm/crtc-helper: explicit DPMS on after modeset
      
      Also fix up the spelling fail a bit in the commit message while at it.
      
      Cc: Dave Airlie <airlied@redhat.com>
      Reviewed-by: NAlex Deucher <alexdeucher@gmail.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67043Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      25f397a4
  13. 28 6月, 2013 1 次提交
    • D
      Revert "drm: kms_helper: don't lose hotplug event" · d482e5fa
      Dave Airlie 提交于
      This reverts commit 160954b7.
      
      This was rearming the workqueue with a 0 timeout, causing
      a WARN_ON, and possible loop.
      
      Daniel writes:
      "I've looked a bit into this and I think we need to have a separate
      work struct for recovering these lost hotplug events since the
      continuous self-rearming case is a real risk (e.g. if a connector
      flip-flops all the time). At least I don't see a sane way to block out
      re-arming with the current code in a simple way. So reverting the
      offender seems like the right thing and I'll go back to the drawing
      board for 3.12."
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      d482e5fa
  14. 27 6月, 2013 1 次提交
    • D
      drm: kms_helper: don't lose hotplug event · 160954b7
      Daniel Vetter 提交于
      There's a race window (small for hpd, 10s large for polled outputs)
      where userspace could sneak in with an unrelated connnector probe
      ioctl call and eat the hotplug event (since neither the hpd nor the
      poll code see a state change).
      
      To avoid this, check whether the connector state changes in all other
      ->detect calls (in the current helper code that's only probe_single)
      and if that's the case, fire off a hotplug event. Note that we can't
      directly call the hotplug event handler, since that expects that no
      locks are held (due to reentrancy with the fb code to update the kms
      console).
      
      Also, this requires that drivers using the probe_single helper
      function set up the poll work. All current drivers do that already,
      and with the reworked hpd handling there'll be no downside to
      unconditionally setting up the poll work any more.
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      160954b7
  15. 25 6月, 2013 3 次提交
    • D
      drm/crtc-helper: explicit DPMS on after modeset · 372835a8
      Daniel Vetter 提交于
      Atm the crtc helper implementation of set_config has really
      inconsisten semantics: If just an fb update is good enough, dpms state
      will be left as-is, but if we do a full modeset we force everything to
      dpms on.
      
      This change has already been applied to the i915 modeset code in
      
      commit e3de42b6
      Author: Imre Deak <imre.deak@intel.com>
      Date:   Fri May 3 19:44:07 2013 +0200
      
          drm/i915: force full modeset if the connector is in DPMS OFF mode
      
      which according to Greg KH seems to aim for a new record in most
      Bugzilla: links in a commit message.
      
      The history of this dpms forcing is pretty interesting. This patch
      here is an almost-revert of
      
      commit 811aaa55
      Author: Keith Packard <keithp@keithp.com>
      Date:   Thu Feb 3 16:57:28 2011 -0800
      
          drm: Only set DPMS ON when actually configuring a mode
      
      which fixed the bug of trying to dpms on disabled outputs, but
      introduced the new discrepancy between an fb update only and full
      modesets. The actual introduction of this goes back to
      
      commit bf9dc102
      Author: Keith Packard <keithp@keithp.com>
      Date:   Fri Nov 26 10:45:58 2010 -0800
      
          drm: Set connector DPMS status to ON in drm_crtc_helper_set_config
      
      And if you'd dig around in the i915 driver code there's even more fun
      around forcing dpms on and losing our heads and temper of the
      resulting inconsistencies. Especially the DP re-training code had tons
      of funny stuff in it.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      372835a8
    • D
      drm/crtc-helper: no need to check for fb->depth/bpp · cbdfebc9
      Daniel Vetter 提交于
      ... since we already check for fb->pixel_format, which encodes all
      this. The other two fields are only for backwards compat of older
      drivers (and we might want to look into eventually just killing them).
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      cbdfebc9
    • D
      drm/crtc-helpers: Enforce sane set_config api · e58de880
      Daniel Vetter 提交于
      There's no point in trying to clean up after driver-bugs, so just blow
      up. Furthermore it's an interface abuse to set no mode but have an fb
      and aslo to try to set an fb without enough connectors. These two
      spefici cases of interface abuse have been committed by the fb helper,
      but that's been fixed meanwhile in
      
      commit 7e53f3a4
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Mon Jan 21 10:52:17 2013 +0100
      
          drm/fb-helper: fixup set_config semantics
      
      The i915 driver has been shipping since a while with these BUGs with
      no reports, so should be save.
      
      Note that this drops an ugly case where we clear crtc->fb behind the
      upper levels back and so cause a refcounting mayhem, which Russell
      Kins spotted while trying to hunt down a drm framebuffer leak.
      Reported-by: NRussell King <linux@arm.linux.org.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      e58de880
  16. 11 6月, 2013 1 次提交
  17. 13 5月, 2013 2 次提交
  18. 10 5月, 2013 1 次提交
  19. 22 4月, 2013 1 次提交
  20. 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: add drm_modeset_lock|unlock_all · 84849903
      Daniel Vetter 提交于
      This is the first step towards introducing the new modeset locking
      scheme. The plan is to put helper functions into place at all the
      right places step-by-step, so that the final patch to switch on the
      new locking scheme doesn't need to touch every single driver.
      
      This helper here will serve as the shotgun solutions for all places
      where a more fine-grained locking isn't (yet) implemented.
      
      v2: Fixup kerneldoc for unlock_all.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      84849903
  21. 28 11月, 2012 1 次提交
  22. 20 11月, 2012 3 次提交