diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-02-10 07:15:52 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-03-24 07:50:59 -0400 |
commit | 223bfd6911a0129d819b4dadb0eec93da014a9d9 (patch) | |
tree | e3725eac6e1a557fc5dad428cb0e622f4b1ee5e4 | |
parent | 7439507f0118c2e806a9c7644882ee33f73e46a9 (diff) |
drm/omap: keep ref to old_fb
We store the fb being page-flipped to 'old_fb' field, but we don't
increase the ref count of the fb when doing that. While I am not
sure if it can cause problem in practice, it's still safer to keep a ref
when storing a pointer to a fb.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 7b93880a4577..f456544bf300 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -554,6 +554,7 @@ static void vblank_cb(void *arg) | |||
554 | struct drm_device *dev = crtc->dev; | 554 | struct drm_device *dev = crtc->dev; |
555 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | 555 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); |
556 | unsigned long flags; | 556 | unsigned long flags; |
557 | struct drm_framebuffer *fb; | ||
557 | 558 | ||
558 | spin_lock_irqsave(&dev->event_lock, flags); | 559 | spin_lock_irqsave(&dev->event_lock, flags); |
559 | 560 | ||
@@ -561,10 +562,15 @@ static void vblank_cb(void *arg) | |||
561 | if (omap_crtc->event) | 562 | if (omap_crtc->event) |
562 | drm_send_vblank_event(dev, omap_crtc->pipe, omap_crtc->event); | 563 | drm_send_vblank_event(dev, omap_crtc->pipe, omap_crtc->event); |
563 | 564 | ||
565 | fb = omap_crtc->old_fb; | ||
566 | |||
564 | omap_crtc->event = NULL; | 567 | omap_crtc->event = NULL; |
565 | omap_crtc->old_fb = NULL; | 568 | omap_crtc->old_fb = NULL; |
566 | 569 | ||
567 | spin_unlock_irqrestore(&dev->event_lock, flags); | 570 | spin_unlock_irqrestore(&dev->event_lock, flags); |
571 | |||
572 | if (fb) | ||
573 | drm_framebuffer_unreference(fb); | ||
568 | } | 574 | } |
569 | 575 | ||
570 | static void page_flip_worker(struct work_struct *work) | 576 | static void page_flip_worker(struct work_struct *work) |
@@ -620,6 +626,7 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, | |||
620 | 626 | ||
621 | omap_crtc->event = event; | 627 | omap_crtc->event = event; |
622 | omap_crtc->old_fb = primary->fb = fb; | 628 | omap_crtc->old_fb = primary->fb = fb; |
629 | drm_framebuffer_reference(omap_crtc->old_fb); | ||
623 | 630 | ||
624 | spin_unlock_irqrestore(&dev->event_lock, flags); | 631 | spin_unlock_irqrestore(&dev->event_lock, flags); |
625 | 632 | ||