diff mbox series

[v5,2/2] Revert "drm/vblank: Do not update vblank count if interrupts are already disabled."

Message ID 3f4e42ee5250ce8697f4ad2fa6b57ef8bd5b9663.1561729581.git.bob.beckett@collabora.com (mailing list archive)
State New, archived
Headers show
Series handle vblank when disabling ctc with interrupt disabled | expand

Commit Message

Bob Beckett June 28, 2019, 2:15 p.m. UTC
If interrupts are already disabled, then the timestamp for the vblank
does not get updated, causing a stale timestamp to be reported to
userland while disabling crtcs.

This reverts commit 68036b08b91bc491ccc308f902616a570a49227c.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
---
 drivers/gpu/drm/drm_vblank.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 9395b8c690b8..d71c49983be3 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -371,25 +371,23 @@  void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
 	spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
 
 	/*
-	 * Update vblank count and disable vblank interrupts only if the
-	 * interrupts were enabled. This avoids calling the ->disable_vblank()
-	 * operation in atomic context with the hardware potentially runtime
-	 * suspended.
+	 * Only disable vblank interrupts if they're enabled. This avoids
+	 * calling the ->disable_vblank() operation in atomic context with the
+	 * hardware potentially runtime suspended.
 	 */
-	if (!vblank->enabled)
-		goto out;
+	if (vblank->enabled) {
+		__disable_vblank(dev, pipe);
+		vblank->enabled = false;
+	}
 
 	/*
-	 * Update the count and timestamp to maintain the
+	 * Always update the count and timestamp to maintain the
 	 * appearance that the counter has been ticking all along until
 	 * this time. This makes the count account for the entire time
 	 * between drm_crtc_vblank_on() and drm_crtc_vblank_off().
 	 */
 	drm_update_vblank_count(dev, pipe, false);
-	__disable_vblank(dev, pipe);
-	vblank->enabled = false;
 
-out:
 	spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
 }