diff mbox

drm/radeon/kms: really wait for VBLANK in PM code

Message ID 20100218180839.GA3386@pogo (mailing list archive)
State New, archived
Headers show

Commit Message

Jaime Velasco Juan Feb. 18, 2010, 6:08 p.m. UTC
None
diff mbox

Patch

>From b44da60bce551b7119b0eb2e521e2e7635b9b98e Mon Sep 17 00:00:00 2001
From: Jaime Velasco Juan <jsagarribay@gmail.com>
Date: Mon, 15 Feb 2010 14:50:46 +0000
Subject: [PATCH] radeon/PM Really wait for vblank before reclocking

The old code used a false condition so it always waited until
timeout.

Signed-off-by: Jaime Velasco Juan <jsagarribay@gmail.com>
---
 drivers/gpu/drm/radeon/radeon_pm.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index a8e151e..7d8c5d9 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -337,10 +337,18 @@  static void radeon_pm_set_clocks(struct radeon_device *rdev)
 		rdev->pm.req_vblank |= (1 << 1);
 		drm_vblank_get(rdev->ddev, 1);
 	}
-	if (rdev->pm.active_crtcs)
-		wait_event_interruptible_timeout(
-			rdev->irq.vblank_queue, 0,
-			msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT));
+	if (rdev->pm.active_crtcs) {
+		/* We code the wait istead of using the usual
+		   wait_event_interruptible_timeout because there is not
+		   condition to check, we want to be always waken up by
+		   the vblank IRQ handler */
+		DEFINE_WAIT(reclock_wait);
+		prepare_to_wait(&rdev->irq.vblank_queue,
+				&reclock_wait, TASK_INTERRUPTIBLE);
+		if (!signal_pending(current))
+			schedule_timeout(msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT));
+		finish_wait(&rdev->irq.vblank_queue, &reclock_wait);
+	}
 	if (rdev->pm.req_vblank & (1 << 0)) {
 		rdev->pm.req_vblank &= ~(1 << 0);
 		drm_vblank_put(rdev->ddev, 0);
-- 
1.7.0