<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 5, 2017 at 10:11 AM, Chris Wilson <span dir="ltr"><<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Apr 05, 2017 at 10:03:21AM -0700, Jason Ekstrand wrote:<br>
> ---<br>
> src/intel/vulkan/anv_device.c | 26 +++++++++++++++++++-------<br>
> src/intel/vulkan/anv_gem.c | 17 +++++++++++++++++<br>
> src/intel/vulkan/anv_private.h | 1 +<br>
> 3 files changed, 37 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
> index 9e860d5..fc3c27e 100644<br>
> --- a/src/intel/vulkan/anv_device.<wbr>c<br>
> +++ b/src/intel/vulkan/anv_device.<wbr>c<br>
> @@ -1294,13 +1294,25 @@ VkResult<br>
> anv_device_wait(struct anv_device *device, struct anv_bo *bo,<br>
> int64_t timeout)<br>
> {<br>
> - int ret = anv_gem_wait(device, bo->gem_handle, &timeout);<br>
> - if (ret == -1 && errno == ETIME) {<br>
> - return VK_TIMEOUT;<br>
> - } else if (ret == -1) {<br>
> - /* We don't know the real error. */<br>
> - device->lost = true;<br>
> - return vk_errorf(VK_ERROR_DEVICE_<wbr>LOST, "gem wait failed: %m");<br>
> + if (timeout == 0) {<br>
> + /* GEM_BUSY is more efficient if we don't want to wait */<br>
> + int ret = anv_gem_busy(device, bo->gem_handle);<br>
<br>
</span>On the other thread, I just mentioned a subtlety that GEM_BUSY is<br>
restricted to reporting on i915.ko GPU users of the bo, whereas GEM_WAIT<br>
will report on the status of all users, including third parties and<br>
miscellaneous asynchronous tasks.<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><br></div><div class="gmail_extra">At the moment, 100% of the uses of anv_device_wait are waiting on i915 GPU users. I'll make busy into its own function and add a comment.<br></div></div>