drm: rcar-du: Wait for flip completion instead of vblank in commit tail
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 13 Jul 2017 22:26:52 +0000 (01:26 +0300)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 3 Aug 2017 13:17:26 +0000 (16:17 +0300)
Page flips can take more than one vertical blanking to complete if
arming the page flips races with the vertical blanking interrupt.
Waiting for one vblank to complete the atomic commit in the commit tail
handler is thus incorrect, and can lead to framebuffers being released
while still being scanned out.

Fix this by waiting for flip completion instead, using the
drm_atomic_helper_wait_for_flip_done() helper.

Fixes: 0d230422d256 ("drm: rcar-du: Register a completion callback with VSP1")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_kms.c

index 066b62924618334ef90b515bd6ef3d3c8d8a4328..7278b9703c15184635365523fa32145437bd7996 100644 (file)
@@ -262,7 +262,7 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
        drm_atomic_helper_commit_modeset_enables(dev, old_state);
 
        drm_atomic_helper_commit_hw_done(old_state);
-       drm_atomic_helper_wait_for_vblanks(dev, old_state);
+       drm_atomic_helper_wait_for_flip_done(dev, old_state);
 
        drm_atomic_helper_cleanup_planes(dev, old_state);
 }