diff mbox

[v3,2/4] drm: rcar-du: Wait for flip completion instead of vblank in commit tail

Message ID 20170729210855.9187-3-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart July 29, 2017, 9:08 p.m. UTC
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>
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Aug. 3, 2017, 12:24 p.m. UTC | #1
Hi Laurent,

On 29/07/17 22:08, Laurent Pinchart wrote:
> 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>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index b91257dee98f..221e22922396 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -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);

Ahh yes, that makes sense!

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>


>  	drm_atomic_helper_cleanup_planes(dev, old_state);
>  }
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index b91257dee98f..221e22922396 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -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);
 }