diff mbox series

drm/arm: mali-dp: Reorder atomic_commit_hw_done to avoid waiting on wrong vblank event

Message ID 20180228151144.21209-1-Liviu.Dudau@arm.com
State New
Headers show
Series drm/arm: mali-dp: Reorder atomic_commit_hw_done to avoid waiting on wrong vblank event | expand

Commit Message

Liviu Dudau Feb. 28, 2018, 3:11 p.m. UTC
mali-dp driver sets the 'go' bit (config_valid) and then waits for
confirmation from the hardware that the config has been updated before
arming the vblank event. The issue is that config_valid is actually
asserted by the hardware after vblank event, during the prefetch phase,
so when arming the vblank event we are going to wait on the wrong
vblank.

Fix it by arming the vblank event first and then setting the
config_valid bit. That way the event will be signalled for the correct
vblank interrupt.

Reported-by: Alexandru-Cosmin Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
---
 drivers/gpu/drm/arm/malidp_drv.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index d88a3b9d59cc..ac44c6127a4f 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -189,12 +189,6 @@  static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
 	struct drm_device *drm = state->dev;
 	struct malidp_drm *malidp = drm->dev_private;
 
-	if (malidp->crtc.enabled) {
-		/* only set config_valid if the CRTC is enabled */
-		if (malidp_set_and_wait_config_valid(drm))
-			DRM_DEBUG_DRIVER("timed out waiting for updated configuration\n");
-	}
-
 	event = malidp->crtc.state->event;
 	if (event) {
 		malidp->crtc.state->event = NULL;
@@ -206,6 +200,12 @@  static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
 			drm_crtc_send_vblank_event(&malidp->crtc, event);
 		spin_unlock_irq(&drm->event_lock);
 	}
+	if (malidp->crtc.enabled) {
+		/* only set config_valid if the CRTC is enabled */
+		if (malidp_set_and_wait_config_valid(drm))
+			DRM_DEBUG_DRIVER("timed out waiting for updated configuration\n");
+	}
+
 	drm_atomic_helper_commit_hw_done(state);
 }
 
@@ -232,8 +232,6 @@  static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
 
 	malidp_atomic_commit_hw_done(state);
 
-	drm_atomic_helper_wait_for_vblanks(drm, state);
-
 	pm_runtime_put(drm->dev);
 
 	drm_atomic_helper_cleanup_planes(drm, state);