aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-10 18:38:18 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-20 16:17:06 -0500
commit4ccf097f1935321f03ad36218588a9e446006b6a (patch)
treed6238772eb276ac0c7d56faf16fb920990773e9f
parent58c0dca10614117cf4b385e3314e79e3b37fa66b (diff)
drm: fb refcounting for dirtyfb_ioctl
We only need to ensure that the fb stays around for long enough. While at it, only grab the modeset locks when we need them (since most drivers don't implement the dirty callback, this should help jitter and stalls when using the generic modeset driver). Reviewed-by: Rob Clark <rob@ti.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_crtc.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index cba8c8bb789c..d4f8fa5b3c18 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2580,14 +2580,9 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
2580 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 2580 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2581 return -EINVAL; 2581 return -EINVAL;
2582 2582
2583 drm_modeset_lock_all(dev);
2584 fb = drm_framebuffer_lookup(dev, r->fb_id); 2583 fb = drm_framebuffer_lookup(dev, r->fb_id);
2585 if (!fb) { 2584 if (!fb)
2586 ret = -EINVAL; 2585 return -EINVAL;
2587 goto out_err1;
2588 }
2589 /* fb is protect by the mode_config lock, so drop the ref immediately */
2590 drm_framebuffer_unreference(fb);
2591 2586
2592 num_clips = r->num_clips; 2587 num_clips = r->num_clips;
2593 clips_ptr = (struct drm_clip_rect __user *)(unsigned long)r->clips_ptr; 2588 clips_ptr = (struct drm_clip_rect __user *)(unsigned long)r->clips_ptr;
@@ -2625,17 +2620,19 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
2625 } 2620 }
2626 2621
2627 if (fb->funcs->dirty) { 2622 if (fb->funcs->dirty) {
2623 drm_modeset_lock_all(dev);
2628 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, 2624 ret = fb->funcs->dirty(fb, file_priv, flags, r->color,
2629 clips, num_clips); 2625 clips, num_clips);
2626 drm_modeset_unlock_all(dev);
2630 } else { 2627 } else {
2631 ret = -ENOSYS; 2628 ret = -ENOSYS;
2632 goto out_err2;
2633 } 2629 }
2634 2630
2635out_err2: 2631out_err2:
2636 kfree(clips); 2632 kfree(clips);
2637out_err1: 2633out_err1:
2638 drm_modeset_unlock_all(dev); 2634 drm_framebuffer_unreference(fb);
2635
2639 return ret; 2636 return ret;
2640} 2637}
2641 2638