summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-14 02:06:08 +0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-21 01:17:05 +0400
commit58c0dca10614117cf4b385e3314e79e3b37fa66b (patch)
tree3e535843a2940a28b1389e079437959da0294b79 /drivers/gpu/drm/drm_crtc.c
parent468174f748603497e73dba9b5c6d1d9f71121486 (diff)
downloadlinux-58c0dca10614117cf4b385e3314e79e3b37fa66b.tar.xz
drm: don't take modeset locks in getfb ioctl
We only need to push the fb unreference a bit down. While at it, properly pass the return value from ->create_handle back to userspace. Most drivers either return -ENODEV if they don't have a concept of buffer objects (ast, cirrus, ...) or just install a handle for the underlying gem object (which is ok since we hold a reference on that through the framebuffer). v2: Split out the ->create_handle rework in the individual drivers. Reviewed-by: Rob Clark <rob@ti.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.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 2e6103c5d632..cba8c8bb789c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2542,19 +2542,14 @@ int drm_mode_getfb(struct drm_device *dev,
{
struct drm_mode_fb_cmd *r = data;
struct drm_framebuffer *fb;
- int ret = 0;
+ int ret;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
- drm_modeset_lock_all(dev);
fb = drm_framebuffer_lookup(dev, r->fb_id);
- if (!fb) {
- ret = -EINVAL;
- goto out;
- }
- /* fb is protect by the mode_config lock, so drop the ref immediately */
- drm_framebuffer_unreference(fb);
+ if (!fb)
+ return -EINVAL;
r->height = fb->height;
r->width = fb->width;
@@ -2566,8 +2561,8 @@ int drm_mode_getfb(struct drm_device *dev,
else
ret = -ENODEV;
-out:
- drm_modeset_unlock_all(dev);
+ drm_framebuffer_unreference(fb);
+
return ret;
}