summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-04-15 15:10:38 +1000
committerDave Airlie <airlied@redhat.com>2016-04-22 10:38:24 +1000
commit9cd47424fb410e478e5a97e83ac10263c13ed65c (patch)
tree055d4a9d2a2c0e15f8d44f7e4499458c616f6ded /drivers/gpu/drm/drm_crtc.c
parentcee26ac47dc2c2846ecd0fc80cf857942c1fcd77 (diff)
drm/mode: reduce scope of fb_lock in framebuffer init
We don't need to hold the fb lock around the initialisation, only around the list manipulaton. So do the lock hold only around the register for now. From Daniel: Previously fb refcounting, and especially the weak reference (kref_get_unless_zero) used in fb lookups have been protected by fb_lock. But with the refactoring to share refcounting in the drm_mode_object base class that switched to being protected by idr_mutex, which means fb_lock critical sections can be reduced. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 0e4e25509c3d..b088840582cc 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -458,21 +458,22 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
{
int ret;
- mutex_lock(&dev->mode_config.fb_lock);
INIT_LIST_HEAD(&fb->filp_head);
fb->dev = dev;
fb->funcs = funcs;
ret = drm_mode_object_get_reg(dev, &fb->base, DRM_MODE_OBJECT_FB,
- true, drm_framebuffer_free);
+ false, drm_framebuffer_free);
if (ret)
goto out;
+ mutex_lock(&dev->mode_config.fb_lock);
dev->mode_config.num_fb++;
list_add(&fb->head, &dev->mode_config.fb_list);
-out:
- mutex_unlock(&dev->mode_config.fb_lock);
+ drm_mode_object_register(dev, &fb->base);
+ mutex_unlock(&dev->mode_config.fb_lock);
+out:
return ret;
}
EXPORT_SYMBOL(drm_framebuffer_init);