summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_fence.c
diff options
context:
space:
mode:
authorChristian König <deathsimple@vodafone.de>2011-10-20 12:38:09 +0200
committerDave Airlie <airlied@redhat.com>2011-12-20 19:50:39 +0000
commit47492a23a128e953bd5087b1cac909cd8124ca5e (patch)
tree9e9d11656b23e451b05d9c958f0d24c32132c645 /drivers/gpu/drm/radeon/radeon_fence.c
parent4c87bc268d764cf8846d20ea54b355d1e87507c9 (diff)
downloadlinux-47492a23a128e953bd5087b1cac909cd8124ca5e.tar.bz2
drm/radeon: add radeon_fence_count_emited function
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>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_fence.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 69902e623cbc..9e7f8921714a 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)
}
}
+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;