diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-07-15 18:11:24 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-09-15 16:26:50 +0100 |
commit | fecfdb2db8b5fc2e6cb731a714889de5e43c2380 (patch) | |
tree | 203b33cc428db36e762aaed194e8c1624d2e1089 /drivers/gpu/drm/armada | |
parent | 28a2aebed6374c4af5224114e4b4273a3aae649a (diff) | |
download | lwn-fecfdb2db8b5fc2e6cb731a714889de5e43c2380.tar.gz lwn-fecfdb2db8b5fc2e6cb731a714889de5e43c2380.zip |
drm/armada: factor out retirement of old fb
We have two identical places in the overlay code which retire the drm
framebuffer. Factor these out into a common function.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/armada')
-rw-r--r-- | drivers/gpu/drm/armada/armada_overlay.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index 9393a15183e2..093c2d4f2b79 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -71,21 +71,27 @@ armada_ovl_update_attr(struct armada_ovl_plane_properties *prop, spin_unlock_irq(&dcrtc->irq_lock); } +static void armada_ovl_retire_fb(struct armada_ovl_plane *dplane, + struct drm_framebuffer *fb) +{ + struct drm_framebuffer *old_fb; + + spin_lock(&dplane->lock); + old_fb = dplane->old_fb; + dplane->old_fb = fb; + spin_unlock(&dplane->lock); + + if (old_fb) + armada_drm_queue_unref_work(dplane->base.dev, old_fb); +} + /* === Plane support === */ static void armada_ovl_plane_vbl(struct armada_crtc *dcrtc, void *data) { struct armada_ovl_plane *dplane = data; - struct drm_framebuffer *fb; armada_drm_crtc_update_regs(dcrtc, dplane->vbl.regs); - - spin_lock(&dplane->lock); - fb = dplane->old_fb; - dplane->old_fb = NULL; - spin_unlock(&dplane->lock); - - if (fb) - armada_drm_queue_unref_work(dcrtc->crtc.dev, fb); + armada_ovl_retire_fb(dplane, NULL); wake_up(&dplane->vbl.wait); } @@ -175,17 +181,8 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, */ drm_framebuffer_reference(fb); - if (plane->fb) { - struct drm_framebuffer *older_fb; - - spin_lock_irq(&dplane->lock); - older_fb = dplane->old_fb; - dplane->old_fb = plane->fb; - spin_unlock_irq(&dplane->lock); - if (older_fb) - armada_drm_queue_unref_work(dcrtc->crtc.dev, - older_fb); - } + if (plane->fb) + armada_ovl_retire_fb(dplane, plane->fb); src_y = src.y1 >> 16; src_x = src.x1 >> 16; |