]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/radeon: add radeon_fence_count_emited function
authorChristian König <deathsimple@vodafone.de>
Thu, 20 Oct 2011 10:38:09 +0000 (12:38 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 20 Dec 2011 19:50:39 +0000 (19:50 +0000)
Split counting of emited fences out of power
management into a seperate function.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_fence.c
drivers/gpu/drm/radeon/radeon_pm.c

index bfa46c5583db33547652c154504b07db3ce20b1a..ea0cdf9ad61ccf76f8c6854cde41c27e176b6366 100644 (file)
@@ -226,6 +226,7 @@ int radeon_fence_wait_next(struct radeon_device *rdev, int ring);
 int radeon_fence_wait_last(struct radeon_device *rdev, int ring);
 struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence);
 void radeon_fence_unref(struct radeon_fence **fence);
+int radeon_fence_count_emitted(struct radeon_device *rdev, int ring);
 
 /*
  * Semaphores.
index 69902e623cbc62adaeff1a7ee4367e1c5ae65131..9e7f8921714ac5ad23aafc0cd4448660f67e7127 100644 (file)
@@ -368,6 +368,27 @@ void radeon_fence_process(struct radeon_device *rdev, int ring)
        }
 }
 
+int radeon_fence_count_emitted(struct radeon_device *rdev, int ring)
+{
+       unsigned long irq_flags;
+       int not_processed = 0;
+
+       read_lock_irqsave(&rdev->fence_lock, irq_flags);
+       if (!rdev->fence_drv[ring].initialized)
+               return 0;
+
+       if (!list_empty(&rdev->fence_drv[ring].emitted)) {
+               struct list_head *ptr;
+               list_for_each(ptr, &rdev->fence_drv[ring].emitted) {
+                       /* count up to 3, that's enought info */
+                       if (++not_processed >= 3)
+                               break;
+               }
+       }
+       read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
+       return not_processed;
+}
+
 int radeon_fence_driver_init(struct radeon_device *rdev, int num_rings)
 {
        unsigned long irq_flags;
index 50b632ac8237915646c40b16b0a39e28fa7275ae..aa4a4a209a6a9b0d1a693c83ec687d3cbb41262c 100644 (file)
@@ -802,27 +802,14 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
        resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev);
        mutex_lock(&rdev->pm.mutex);
        if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) {
-               unsigned long irq_flags;
                int not_processed = 0;
                int i;
 
-               read_lock_irqsave(&rdev->fence_lock, irq_flags);
                for (i = 0; i < RADEON_NUM_RINGS; ++i) {
-                       if (!rdev->fence_drv[i].initialized)
-                               continue;
-
-                       if (!list_empty(&rdev->fence_drv[i].emitted)) {
-                               struct list_head *ptr;
-                               list_for_each(ptr, &rdev->fence_drv[i].emitted) {
-                                       /* count up to 3, that's enought info */
-                                       if (++not_processed >= 3)
-                                               break;
-                               }
-                       }
+                       not_processed += radeon_fence_count_emitted(rdev, i);
                        if (not_processed >= 3)
                                break;
                }
-               read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
 
                if (not_processed >= 3) { /* should upclock */
                        if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_DOWNCLOCK) {