drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
authorChris Wilson <[email protected]>
Sun, 12 Feb 2017 21:53:43 +0000 (21:53 +0000)
committerChris Wilson <[email protected]>
Tue, 14 Feb 2017 09:38:42 +0000 (09:38 +0000)
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 <[email protected]>
Cc: Matthew Auld <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: <[email protected]> # v4.10-rc1+
Cc: [email protected]
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Joonas Lahtinen <[email protected]>
drivers/gpu/drm/i915/i915_gem.c

index 82489ed10373e0f9f1f11fe11253a3b364490abf..71297920fdf4128b48f5a1af1f666bc9e25f1a6f 100644 (file)
@@ -441,7 +441,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]);
@@ -454,7 +454,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);