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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Signed-off-by: Liviu Dudau <liviu.dudau@xxxxxxx>
---
 drivers/gpu/drm/arm/malidp_drv.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

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);
-- 
2.16.2

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux