Skip to contentSkip to conversation

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

PATCH New Liviu Dudau 1 participant 1 message Feb 28, 2018

Subsystems (3)
lore
Share & tools
lore

Liviu Dudau

author maintainer
#0 lore raw

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

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.

---
 drivers/gpu/drm/arm/malidp_drv.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/arm/malidp_drv.c +6 -8
index d88a3b9d59cc..ac44c6127a4f 100644
@@ -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);
Signature · 6 lines
2.16.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel