drm/radeon/kms/pm: interate across crtcs for vblank
authorAlex Deucher <alexdeucher@gmail.com>
Mon, 15 Mar 2010 21:09:05 +0000 (17:09 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 18 May 2010 08:20:53 +0000 (18:20 +1000)
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_pm.c

index 4ece89aa26f842b7f5ed28ff2a0522c16ffbc45b..ff3abd8c896692be7240972f066ca413c75709d9 100644 (file)
@@ -375,6 +375,8 @@ static void radeon_pm_set_clocks_locked(struct radeon_device *rdev)
 
 static void radeon_pm_set_clocks(struct radeon_device *rdev)
 {
+       int i;
+
        radeon_get_power_state(rdev, rdev->pm.planned_action);
        mutex_lock(&rdev->cp.mutex);
 
@@ -388,22 +390,18 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
        rdev->irq.gui_idle = false;
        radeon_irq_set(rdev);
 
-       if (rdev->pm.active_crtcs & (1 << 0)) {
-               rdev->pm.req_vblank |= (1 << 0);
-               drm_vblank_get(rdev->ddev, 0);
-       }
-       if (rdev->pm.active_crtcs & (1 << 1)) {
-               rdev->pm.req_vblank |= (1 << 1);
-               drm_vblank_get(rdev->ddev, 1);
+       for (i = 0; i < rdev->num_crtc; i++) {
+               if (rdev->pm.active_crtcs & (1 << i)) {
+                       rdev->pm.req_vblank |= (1 << i);
+                       drm_vblank_get(rdev->ddev, i);
+               }
        }
        radeon_pm_set_clocks_locked(rdev);
-       if (rdev->pm.req_vblank & (1 << 0)) {
-               rdev->pm.req_vblank &= ~(1 << 0);
-               drm_vblank_put(rdev->ddev, 0);
-       }
-       if (rdev->pm.req_vblank & (1 << 1)) {
-               rdev->pm.req_vblank &= ~(1 << 1);
-               drm_vblank_put(rdev->ddev, 1);
+       for (i = 0; i < rdev->num_crtc; i++) {
+               if (rdev->pm.req_vblank & (1 << i)) {
+                       rdev->pm.req_vblank &= ~(1 << i);
+                       drm_vblank_put(rdev->ddev, i);
+               }
        }
 
        mutex_unlock(&rdev->cp.mutex);