[PATCH 2/2] drm/radeon: interface waiting for fence values
Christian König
deathsimple at vodafone.de
Wed Feb 1 10:16:34 PST 2012
To support waiting for fence values from usermode.
Signed-off-by: Christian König <deathsimple at vodafone.de>
---
drivers/gpu/drm/radeon/radeon_fence.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index ac177c5..85893c3 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -334,6 +334,28 @@ int radeon_fence_wait_last(struct radeon_device *rdev, int ring)
return r;
}
+static bool radeon_fence_value_reached(struct radeon_device *rdev,
+ int ring, uint64_t value)
+{
+ unsigned long irq_flags;
+ bool result;
+ read_lock_irqsave(&rdev->fence_lock, irq_flags);
+ result = rdev->fence_drv[ring].last_seq <= value;
+ read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
+ return result;
+}
+
+int radeon_fence_wait_value(struct radeon_device *rdev, int ring,
+ uint64_t value, unsigned long timeout)
+{
+ int r;
+ radeon_irq_kms_sw_irq_get(rdev, ring);
+ r = wait_event_interruptible_timeout(rdev->fence_drv[ring].queue,
+ radeon_fence_value_reached(rdev, ring, value), timeout);
+ radeon_irq_kms_sw_irq_put(rdev, ring);
+ return r;
+}
+
struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence)
{
kref_get(&fence->kref);
--
1.7.5.4
--------------040606070707070606090300--
More information about the dri-devel
mailing list