aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-25 12:07:40 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-08 11:46:45 -0400
commitd059f652e73c35678d28d4cd09ab2cec89696af9 (patch)
treee16e275dbe7435bfcb7519e603f7826abc26fc8c /drivers/gpu/drm/drm_crtc.c
parenta6a8bb848d5ca40bc0eb708ddeb23df2b0eca1fb (diff)
drm: Handle legacy per-crtc locking with full acquire ctx
So drivers using the atomic interfaces expect that they can acquire additional locks internal to the driver as-needed. Examples would be locks to protect shared state like shared display PLLs. Unfortunately the legacy ioctls assume that all locking is fully done by the drm core. Now for those paths which grab all locks we already have to keep around an acquire context in dev->mode_config. Helper functions that implement legacy interfaces in terms of atomic support can therefore grab this acquire contexts and reuse it. The only interfaces left are the cursor and pageflip ioctls. So add functions to grab the crtc lock these need using an acquire context and preserve it for atomic drivers to reuse. v2: - Fixup comments&kerneldoc. - Drop the WARNING from modeset_lock_all_crtcs since that can be used in legacy paths with crtc locking. v3: Fix a type on the kerneldoc Dave spotted. Cc: Dave Airlie <airlied@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index caaa01f3b353..ab121b6d980c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2801,7 +2801,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
2801 if (crtc->cursor) 2801 if (crtc->cursor)
2802 return drm_mode_cursor_universal(crtc, req, file_priv); 2802 return drm_mode_cursor_universal(crtc, req, file_priv);
2803 2803
2804 drm_modeset_lock(&crtc->mutex, NULL); 2804 drm_modeset_lock_crtc(crtc);
2805 if (req->flags & DRM_MODE_CURSOR_BO) { 2805 if (req->flags & DRM_MODE_CURSOR_BO) {
2806 if (!crtc->funcs->cursor_set && !crtc->funcs->cursor_set2) { 2806 if (!crtc->funcs->cursor_set && !crtc->funcs->cursor_set2) {
2807 ret = -ENXIO; 2807 ret = -ENXIO;
@@ -2825,7 +2825,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
2825 } 2825 }
2826 } 2826 }
2827out: 2827out:
2828 drm_modeset_unlock(&crtc->mutex); 2828 drm_modeset_unlock_crtc(crtc);
2829 2829
2830 return ret; 2830 return ret;
2831 2831
@@ -4561,7 +4561,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
4561 if (!crtc) 4561 if (!crtc)
4562 return -ENOENT; 4562 return -ENOENT;
4563 4563
4564 drm_modeset_lock(&crtc->mutex, NULL); 4564 drm_modeset_lock_crtc(crtc);
4565 if (crtc->primary->fb == NULL) { 4565 if (crtc->primary->fb == NULL) {
4566 /* The framebuffer is currently unbound, presumably 4566 /* The framebuffer is currently unbound, presumably
4567 * due to a hotplug event, that userspace has not 4567 * due to a hotplug event, that userspace has not
@@ -4645,7 +4645,7 @@ out:
4645 drm_framebuffer_unreference(fb); 4645 drm_framebuffer_unreference(fb);
4646 if (old_fb) 4646 if (old_fb)
4647 drm_framebuffer_unreference(old_fb); 4647 drm_framebuffer_unreference(old_fb);
4648 drm_modeset_unlock(&crtc->mutex); 4648 drm_modeset_unlock_crtc(crtc);
4649 4649
4650 return ret; 4650 return ret;
4651} 4651}