diff mbox

[v2,3/8] drm/vc4: Use wait_for_flip_done() instead of wait_for_vblanks()

Message ID 20180629111722.20299-4-boris.brezillon@bootlin.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Brezillon June 29, 2018, 11:17 a.m. UTC
drm_atomic_helper_wait_for_vblanks() assumes the CRTC will continuously
generate VBLANK events and the vblank counter will keep increasing.
While this work for a regular pipeline, it doesn't when you have the
CRTC is feeding the transposer block, because this block works in
oneshot mode, and, by the time we reach
drm_atomic_helper_wait_for_vblanks() the only VBLANK event might have
already been sent and the VBLANK counter will stay unchanged, thus
triggering a timeout.

Luckily, we can replace the drm_atomic_helper_wait_for_vblanks() call
by drm_atomic_helper_wait_for_flip_done() because the only thing we
want to check when calling drm_atomic_helper_wait_for_vblanks() from
vc4_atomic_complete_commit() is that new FBs are in use and the old
ones can be safely released.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 drivers/gpu/drm/vc4/vc4_kms.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Eric Anholt June 29, 2018, 8:19 p.m. UTC | #1
Boris Brezillon <boris.brezillon@bootlin.com> writes:

> drm_atomic_helper_wait_for_vblanks() assumes the CRTC will continuously
> generate VBLANK events and the vblank counter will keep increasing.
> While this work for a regular pipeline, it doesn't when you have the
> CRTC is feeding the transposer block, because this block works in
> oneshot mode, and, by the time we reach
> drm_atomic_helper_wait_for_vblanks() the only VBLANK event might have
> already been sent and the VBLANK counter will stay unchanged, thus
> triggering a timeout.
>
> Luckily, we can replace the drm_atomic_helper_wait_for_vblanks() call
> by drm_atomic_helper_wait_for_flip_done() because the only thing we
> want to check when calling drm_atomic_helper_wait_for_vblanks() from
> vc4_atomic_complete_commit() is that new FBs are in use and the old
> ones can be safely released.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>

Reviewed-by: Eric Anholt <eric@anholt.net>
diff mbox

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 8a411e5f8776..91239b0a4fa0 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -153,18 +153,9 @@  vc4_atomic_complete_commit(struct drm_atomic_state *state)
 
 	drm_atomic_helper_commit_modeset_enables(dev, state);
 
-	/* Make sure that drm_atomic_helper_wait_for_vblanks()
-	 * actually waits for vblank.  If we're doing a full atomic
-	 * modeset (as opposed to a vc4_update_plane() short circuit),
-	 * then we need to wait for scanout to be done with our
-	 * display lists before we free it and potentially reallocate
-	 * and overwrite the dlist memory with a new modeset.
-	 */
-	state->legacy_cursor_update = false;
-
 	drm_atomic_helper_commit_hw_done(state);
 
-	drm_atomic_helper_wait_for_vblanks(dev, state);
+	drm_atomic_helper_wait_for_flip_done(dev, state);
 
 	drm_atomic_helper_cleanup_planes(dev, state);