diff mbox

[RFT] drm/radeon/kms: check for being in VBLANK on VBLANK interrupt

Message ID 1267655619-3849-1-git-send-email-zajec5@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rafał Miłecki March 3, 2010, 10:33 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 73f9a79..0ac1651 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -311,11 +311,15 @@  int r100_irq_process(struct radeon_device *rdev)
 		}
 		/* Vertical blank interrupts */
 		if (status & RADEON_CRTC_VBLANK_STAT) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 0);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
 		}
 		if (status & RADEON_CRTC2_VBLANK_STAT) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 1);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 5b56a1b..a98fb4e 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2764,6 +2764,8 @@  restart_ih:
 			switch (src_data) {
 			case 0: /* D1 vblank */
 				if (disp_int & LB_D1_VBLANK_INTERRUPT) {
+					if (!rdev->pm.vblank_sync)
+						radeon_pm_debug_check_in_vbl(rdev, false);
 					drm_handle_vblank(rdev->ddev, 0);
 					rdev->pm.vblank_sync = true;
 					wake_up(&rdev->irq.vblank_queue);
@@ -2786,6 +2788,8 @@  restart_ih:
 			switch (src_data) {
 			case 0: /* D2 vblank */
 				if (disp_int & LB_D2_VBLANK_INTERRUPT) {
+					if (!rdev->pm.vblank_sync)
+						radeon_pm_debug_check_in_vbl(rdev, false);
 					drm_handle_vblank(rdev->ddev, 1);
 					rdev->pm.vblank_sync = true;
 					wake_up(&rdev->irq.vblank_queue);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 0d7caee..9e103ec 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -74,6 +74,8 @@ 
 #include "radeon_mode.h"
 #include "radeon_reg.h"
 
+bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
+
 /*
  * Modules parameters.
  */
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 4f37b52..6b65f15 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -28,7 +28,6 @@ 
 #define RADEON_RECLOCK_DELAY_MS 200
 #define RADEON_WAIT_VBLANK_TIMEOUT 200
 
-static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
 static void radeon_pm_set_clocks_locked(struct radeon_device *rdev);
 static void radeon_pm_set_clocks(struct radeon_device *rdev);
 static void radeon_pm_idle_work_handler(struct work_struct *work);
@@ -209,9 +208,7 @@  static void radeon_set_power_state(struct radeon_device *rdev)
 
 	/* set engine clock */
 	radeon_sync_with_vblank(rdev);
-	radeon_pm_debug_check_in_vbl(rdev, false);
 	radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk);
-	radeon_pm_debug_check_in_vbl(rdev, true);
 
 #if 0
 	/* set memory clock */
@@ -322,7 +319,7 @@  void radeon_pm_compute_clocks(struct radeon_device *rdev)
 	mutex_unlock(&rdev->pm.mutex);
 }
 
-static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish)
+bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish)
 {
 	u32 stat_crtc1 = 0, stat_crtc2 = 0;
 	bool in_vbl = true;
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index ac7c27a..e1935bb 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -391,11 +391,15 @@  int rs600_irq_process(struct radeon_device *rdev)
 			radeon_fence_process(rdev);
 		/* Vertical blank interrupts */
 		if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 0);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
 		}
 		if (G_007EDC_LB_D2_VBLANK_INTERRUPT(r500_disp_int)) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 1);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);