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

Jason Ekstrand jason at jlekstrand.net
Wed Apr 5 17:17:59 UTC 2017


On Wed, Apr 5, 2017 at 10:11 AM, Chris Wilson <chris at chris-wilson.co.uk>
wrote:

> 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.
>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170405/f1387a4b/attachment.html>


More information about the mesa-dev mailing list