The i915_gem_object_wait_fence() uses an incoming timeout=0 to query
whether the current fence is busy or idle, without waiting. This can be
used by the wait-ioctl to implement a busy query.

Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with 
callers")
Testcase: igt/gem_wait/basic-busy-write-all
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.a...@gmail.com>
Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
Cc: <drm-intel-fi...@lists.freedesktop.org> # v4.10-rc1+
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b8d869d7937d..cf8132c49600 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -440,7 +440,7 @@ i915_gem_object_wait_reservation(struct reservation_object 
*resv,
                        timeout = i915_gem_object_wait_fence(shared[i],
                                                             flags, timeout,
                                                             rps);
-                       if (timeout <= 0)
+                       if (timeout < 0)
                                break;
 
                        dma_fence_put(shared[i]);
@@ -453,7 +453,7 @@ i915_gem_object_wait_reservation(struct reservation_object 
*resv,
                excl = reservation_object_get_excl_rcu(resv);
        }
 
-       if (excl && timeout > 0)
+       if (excl && timeout >= 0)
                timeout = i915_gem_object_wait_fence(excl, flags, timeout, rps);
 
        dma_fence_put(excl);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to