drm/radeon: use drm_crtc_vblank_{get,put}()
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Mon, 6 Jun 2016 14:41:44 +0000 (11:41 -0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 6 Jun 2016 16:05:08 +0000 (18:05 +0200)
Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465224105-21485-13-git-send-email-gustavo@padovan.org
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_pm.c

index 6a41b49826470f8cffe99fb888c4f6a4529ab787..2fb18f13395c3297fceceea859d0770dcd503cc4 100644 (file)
@@ -381,7 +381,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
 
        spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);
 
-       drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id);
+       drm_crtc_vblank_put(&radeon_crtc->base);
        radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id);
        queue_work(radeon_crtc->flip_queue, &work->unpin_work);
 }
@@ -598,7 +598,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
        }
        work->base = base;
 
-       r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id);
+       r = drm_crtc_vblank_get(crtc);
        if (r) {
                DRM_ERROR("failed to get vblank before flip\n");
                goto pflip_cleanup;
@@ -625,7 +625,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
        return 0;
 
 vblank_cleanup:
-       drm_vblank_put(crtc->dev, radeon_crtc->crtc_id);
+       drm_crtc_vblank_put(&radeon_crtc->base);
 
 pflip_cleanup:
        if (unlikely(radeon_bo_reserve(new_rbo, false) != 0)) {
index 38226d925a5b1e0b034a7288384df7cdf1778c32..4b6542538ff91581272deadb6e971c50f2429033 100644 (file)
@@ -246,6 +246,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
 
 static void radeon_pm_set_clocks(struct radeon_device *rdev)
 {
+       struct drm_crtc *crtc;
        int i, r;
 
        /* no need to take locks, etc. if nothing's going to change */
@@ -274,26 +275,30 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
        radeon_unmap_vram_bos(rdev);
 
        if (rdev->irq.installed) {
-               for (i = 0; i < rdev->num_crtc; i++) {
+               i = 0;
+               drm_for_each_crtc(crtc, rdev->ddev) {
                        if (rdev->pm.active_crtcs & (1 << i)) {
                                /* This can fail if a modeset is in progress */
-                               if (drm_vblank_get(rdev->ddev, i) == 0)
+                               if (drm_crtc_vblank_get(crtc) == 0)
                                        rdev->pm.req_vblank |= (1 << i);
                                else
                                        DRM_DEBUG_DRIVER("crtc %d no vblank, can glitch\n",
                                                         i);
                        }
+                       i++;
                }
        }
 
        radeon_set_power_state(rdev);
 
        if (rdev->irq.installed) {
-               for (i = 0; i < rdev->num_crtc; i++) {
+               i = 0;
+               drm_for_each_crtc(crtc, rdev->ddev) {
                        if (rdev->pm.req_vblank & (1 << i)) {
                                rdev->pm.req_vblank &= ~(1 << i);
-                               drm_vblank_put(rdev->ddev, i);
+                               drm_crtc_vblank_put(crtc);
                        }
+                       i++;
                }
        }