Skip to contentSkip to conversation

intel: Fix documentation for drm_intel_gem_bo_wait()

PATCH New Kristian Høgsberg 1 participant 1 message Feb 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel: Fix documentation for drm_intel_gem_bo_wait()

The kernel doesn't actually wait indefinately when passed a negative, timeout, it returns immediately. Document this and suggest using INT64_MAX for indefinite waits.

---

We first check if the object is already idle and return 0 if so. Then we hit this condition:

        if (args->timeout_ns <= 0) {
                ret = -ETIME;
                goto out;
        }

and return -ETIME on any timeout value <= 0. I don't know if the ioctl worked as intended initially and then was broken when this was added, but either way, there's no point in fixing it. Userspace can use INT64_MAX for indefinite timeout, which works as well and is simpler trying to determine whether or not we have a fixed DRM_IOCTL_I915_GEM_WAIT.

 intel/intel_bufmgr_gem.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
intel/intel_bufmgr_gem.c +7 -5
index cf85bb8..d7bfaae 100644
@@ -1656,12 +1656,14 @@ drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
  *
  * @bo: buffer object to wait for
  * @timeout_ns: amount of time to wait in nanoseconds.
- *   If value is less than 0, an infinite wait will occur.
+ *   If value is less than or equal to 0, return immediately.
  *
- * Returns 0 if the wait was successful ie. the last batch referencing the
- * object has completed within the allotted time. Otherwise some negative return
- * value describes the error. Of particular interest is -ETIME when the wait has
- * failed to yield the desired result.
+ * Returns 0 if the wait was successful ie. the last batch referencing
+ * the object has completed within the allotted time. Otherwise some
+ * negative return value describes the error. Of particular interest
+ * is -ETIME when the wait has failed to yield the desired result.
+ * Use a timeout of INT64_MAX to wait indefinitely (well, at least 292
+ * years).
  *
  * Similar to drm_intel_gem_bo_wait_rendering except a timeout parameter allows
  * the operation to give up after a certain amount of time. Another subtle
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx