aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_gem.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-04-05 09:55:15 -0700
committerJason Ekstrand <[email protected]>2017-04-05 21:17:11 -0700
commitf195d40eca49800799d85d110939a125041f4028 (patch)
treef626e61bf1cad28fddb3a5257ff0d42d035c9b6d /src/intel/vulkan/anv_gem.c
parentd5157ddca4072856e0afce3d7af8929a7d387044 (diff)
anv/device: Add a helper for querying whether a BO is busy
This is a bit more efficient than using GEM_WAIT with a timeout of 0. Reviewed-by: Chris Wilson <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_gem.c')
-rw-r--r--src/intel/vulkan/anv_gem.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
index 2d07a3dbb0e..185086fefcc 100644
--- a/src/intel/vulkan/anv_gem.c
+++ b/src/intel/vulkan/anv_gem.c
@@ -147,6 +147,23 @@ anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,
}
/**
+ * Returns 0, 1, or negative to indicate error
+ */
+int
+anv_gem_busy(struct anv_device *device, uint32_t gem_handle)
+{
+ struct drm_i915_gem_busy busy = {
+ .handle = gem_handle,
+ };
+
+ int ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_BUSY, &busy);
+ if (ret < 0)
+ return ret;
+
+ return busy.busy != 0;
+}
+
+/**
* On error, \a timeout_ns holds the remaining time.
*/
int