drm: Fixup locking for universal cursor planes
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 12 Sep 2014 15:07:32 +0000 (17:07 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 24 Sep 2014 10:09:23 +0000 (12:09 +0200)
commitf2b50c1161590c3bcdbf3455fe4c575f1c1bd293
tree6340ffd8dea81f9980e6603a8a08043c8ece149b
parentda8f43962bd323813f7215b00b5da48ad766b9b2
drm: Fixup locking for universal cursor planes

Bunch of things amiss:
- Updating crtc->cursor_x/y was done without any locking. Spotted by
  David Herrmann.
- Dereferencing crtc->cursor->fb was using the wrong lock, should take
  the crtc lock.
- Grabbing _all_ modeset locks torpedoes the reason why we added
  fine-grained locks originally: Cursor updates shouldn't stall on
  background stuff like probing outputs.

Best is to just grab the crtc lock around everything and drop all the
other locking. The only issue is that we can't switch planes between
crtcs with that, so make sure that never happens when someone uses
universal plane helpers. This shouldn't be a possible regression ever
since legacy ioctls also only grabbed the crtc lock, so switching
crtcs was never possible for the underlying plane object. And i915
(the only user of universal cursors thus far) has fixed cursor->crtc
links.

Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Pallavi G<pallavi.g@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Tested-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
drivers/gpu/drm/drm_crtc.c