Commit 58c0dca1 authored by Daniel Vetter's avatar Daniel Vetter

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: default avatarRob Clark <rob@ti.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 468174f7
...@@ -2542,19 +2542,14 @@ int drm_mode_getfb(struct drm_device *dev, ...@@ -2542,19 +2542,14 @@ int drm_mode_getfb(struct drm_device *dev,
{ {
struct drm_mode_fb_cmd *r = data; struct drm_mode_fb_cmd *r = data;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
int ret = 0; int ret;
if (!drm_core_check_feature(dev, DRIVER_MODESET)) if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL; return -EINVAL;
drm_modeset_lock_all(dev);
fb = drm_framebuffer_lookup(dev, r->fb_id); fb = drm_framebuffer_lookup(dev, r->fb_id);
if (!fb) { if (!fb)
ret = -EINVAL; return -EINVAL;
goto out;
}
/* fb is protect by the mode_config lock, so drop the ref immediately */
drm_framebuffer_unreference(fb);
r->height = fb->height; r->height = fb->height;
r->width = fb->width; r->width = fb->width;
...@@ -2566,8 +2561,8 @@ int drm_mode_getfb(struct drm_device *dev, ...@@ -2566,8 +2561,8 @@ int drm_mode_getfb(struct drm_device *dev,
else else
ret = -ENODEV; ret = -ENODEV;
out: drm_framebuffer_unreference(fb);
drm_modeset_unlock_all(dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment