[Mesa-dev] [PATCH v2 1/2] anv: Use GEM_BUSY instead of GEM_WAIT when timeout == 0

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 5 17:11:42 UTC 2017


On Wed, Apr 05, 2017 at 10:03:21AM -0700, Jason Ekstrand wrote:
> ---
>  src/intel/vulkan/anv_device.c  | 26 +++++++++++++++++++-------
>  src/intel/vulkan/anv_gem.c     | 17 +++++++++++++++++
>  src/intel/vulkan/anv_private.h |  1 +
>  3 files changed, 37 insertions(+), 7 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 9e860d5..fc3c27e 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1294,13 +1294,25 @@ VkResult
>  anv_device_wait(struct anv_device *device, struct anv_bo *bo,
>                  int64_t timeout)
>  {
> -   int ret = anv_gem_wait(device, bo->gem_handle, &timeout);
> -   if (ret == -1 && errno == ETIME) {
> -      return VK_TIMEOUT;
> -   } else if (ret == -1) {
> -      /* We don't know the real error. */
> -      device->lost = true;
> -      return vk_errorf(VK_ERROR_DEVICE_LOST, "gem wait failed: %m");
> +   if (timeout == 0) {
> +      /* GEM_BUSY is more efficient if we don't want to wait */
> +      int ret = anv_gem_busy(device, bo->gem_handle);

On the other thread, I just mentioned a subtlety that GEM_BUSY is
restricted to reporting on i915.ko GPU users of the bo, whereas GEM_WAIT
will report on the status of all users, including third parties and
miscellaneous asynchronous tasks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the mesa-dev mailing list