aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c21
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c15
3 files changed, 23 insertions, 14 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index bfa46c5583d..ea0cdf9ad61 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -226,6 +226,7 @@ int radeon_fence_wait_next(struct radeon_device *rdev, int ring);
226int radeon_fence_wait_last(struct radeon_device *rdev, int ring); 226int radeon_fence_wait_last(struct radeon_device *rdev, int ring);
227struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); 227struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence);
228void radeon_fence_unref(struct radeon_fence **fence); 228void radeon_fence_unref(struct radeon_fence **fence);
229int radeon_fence_count_emitted(struct radeon_device *rdev, int ring);
229 230
230/* 231/*
231 * Semaphores. 232 * Semaphores.
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 69902e623cb..9e7f8921714 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -368,6 +368,27 @@ void radeon_fence_process(struct radeon_device *rdev, int ring)
368 } 368 }
369} 369}
370 370
371int radeon_fence_count_emitted(struct radeon_device *rdev, int ring)
372{
373 unsigned long irq_flags;
374 int not_processed = 0;
375
376 read_lock_irqsave(&rdev->fence_lock, irq_flags);
377 if (!rdev->fence_drv[ring].initialized)
378 return 0;
379
380 if (!list_empty(&rdev->fence_drv[ring].emitted)) {
381 struct list_head *ptr;
382 list_for_each(ptr, &rdev->fence_drv[ring].emitted) {
383 /* count up to 3, that's enought info */
384 if (++not_processed >= 3)
385 break;
386 }
387 }
388 read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
389 return not_processed;
390}
391
371int radeon_fence_driver_init(struct radeon_device *rdev, int num_rings) 392int radeon_fence_driver_init(struct radeon_device *rdev, int num_rings)
372{ 393{
373 unsigned long irq_flags; 394 unsigned long irq_flags;
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 50b632ac823..aa4a4a209a6 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -802,27 +802,14 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
802 resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); 802 resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev);
803 mutex_lock(&rdev->pm.mutex); 803 mutex_lock(&rdev->pm.mutex);
804 if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) { 804 if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) {
805 unsigned long irq_flags;
806 int not_processed = 0; 805 int not_processed = 0;
807 int i; 806 int i;
808 807
809 read_lock_irqsave(&rdev->fence_lock, irq_flags);
810 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 808 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
811 if (!rdev->fence_drv[i].initialized) 809 not_processed += radeon_fence_count_emitted(rdev, i);
812 continue;
813
814 if (!list_empty(&rdev->fence_drv[i].emitted)) {
815 struct list_head *ptr;
816 list_for_each(ptr, &rdev->fence_drv[i].emitted) {
817 /* count up to 3, that's enought info */
818 if (++not_processed >= 3)
819 break;
820 }
821 }
822 if (not_processed >= 3) 810 if (not_processed >= 3)
823 break; 811 break;
824 } 812 }
825 read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
826 813
827 if (not_processed >= 3) { /* should upclock */ 814 if (not_processed >= 3) { /* should upclock */
828 if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_DOWNCLOCK) { 815 if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_DOWNCLOCK) {