drm: rcar-du: Handle event when disabling CRTCs
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 10 Feb 2017 11:30:35 +0000 (13:30 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 4 Apr 2017 14:03:45 +0000 (17:03 +0300)
The driver currently handles vblank events only when updating planes on
a CRTC. The atomic update API however allows requesting an event when
disabling a CRTC. This currently leads to event objects being leaked in
the kernel and to events not being sent out. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_crtc.c

index edcbe2e3625df312385989369a0366c99fe499ba..04046c0faffd8d7e6f075f035ce933365a48da6e 100644 (file)
@@ -488,6 +488,13 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc)
        rcar_du_crtc_stop(rcrtc);
        rcar_du_crtc_put(rcrtc);
 
+       spin_lock_irq(&crtc->dev->event_lock);
+       if (crtc->state->event) {
+               drm_crtc_send_vblank_event(crtc, crtc->state->event);
+               crtc->state->event = NULL;
+       }
+       spin_unlock_irq(&crtc->dev->event_lock);
+
        rcrtc->outputs = 0;
 }