summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r600.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-04-28 12:13:06 -0400
committerDave Airlie <airlied@redhat.com>2010-05-18 18:21:29 +1000
commitf81f202402640c27b38e1452dcb4d3e447043f48 (patch)
tree7f081e491e256d792c7b9c5e9df817894227fe05 /drivers/gpu/drm/radeon/r600.c
parent612e06ce9c78840c3a1a207dfbe489a059d87c28 (diff)
radeon: Try harder to ensure we reclock in vblank
The vblank interrupt on r600 doesn't seem to be especially reliable, so perform some sanity checks before the actual reclock. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r600.c')
-rw-r--r--drivers/gpu/drm/radeon/r600.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 1696cc277d8..d3a79e0a912 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -289,8 +289,34 @@ void r600_set_power_state(struct radeon_device *rdev, bool static_switch)
}
} else {
+ u32 position;
+ u32 vbl;
+
radeon_sync_with_vblank(rdev);
+ if (!radeon_pm_in_vbl(rdev))
+ return;
+
+ if (rdev->pm.active_crtcs & (1 << 0)) {
+ vbl = RREG32(AVIVO_D1CRTC_V_BLANK_START_END);
+ position = RREG32(AVIVO_D1CRTC_STATUS_POSITION);
+ position &= 0xfff;
+ vbl &= 0xfff;
+
+ if (position < vbl && position > 1)
+ return;
+ }
+
+ if (rdev->pm.active_crtcs & (1 << 1)) {
+ vbl = RREG32(AVIVO_D2CRTC_V_BLANK_START_END);
+ position = RREG32(AVIVO_D2CRTC_STATUS_POSITION);
+ position &= 0xfff;
+ vbl &= 0xfff;
+
+ if (position < vbl && position > 1)
+ return;
+ }
+
if (sclk != rdev->pm.current_sclk) {
radeon_pm_debug_check_in_vbl(rdev, false);
radeon_set_engine_clock(rdev, sclk);