From f195d40eca49800799d85d110939a125041f4028 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 5 Apr 2017 09:55:15 -0700 Subject: 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 --- src/intel/vulkan/anv_gem.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/intel/vulkan/anv_gem.c') 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 @@ -146,6 +146,23 @@ anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle, return anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &gem_set_domain); } +/** + * 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. */ -- cgit v1.2.3