diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2012-06-05 18:24:24 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-06-06 06:25:46 -0400 |
commit | eac1f14fd1e7243aa782ef85f2a217e0c3a709ad (patch) | |
tree | a6078850f0479ccc9c5f18a52b8fec5897e843be /drivers/gpu/drm/i915/i915_gem.c | |
parent | de9a35abb3b343a25065449234e47a76c4f3454a (diff) |
drm/i915: Inifite timeout for wait ioctl
Change the ns_timeout parameter of the wait ioctl to a signed value.
Doing this allows the kernel to provide an infinite wait when a timeout
of less than 0 is provided. This mimics select/poll.
Initially the parameter was meant to match up with the GL spec 1:1, but
after being made aware of how much 2^64 - 1 nanoseconds actually is, I
do not think anyone will ever notice the loss of 1 bit.
The infinite timeout on waiting is similar to the existing i915
userspace interface with the exception that struct_mutex is dropped
while doing the wait in this ioctl.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index af67803e635f..deaa0d4bb456 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2082,11 +2082,14 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2082 | struct drm_i915_gem_wait *args = data; | 2082 | struct drm_i915_gem_wait *args = data; |
2083 | struct drm_i915_gem_object *obj; | 2083 | struct drm_i915_gem_object *obj; |
2084 | struct intel_ring_buffer *ring = NULL; | 2084 | struct intel_ring_buffer *ring = NULL; |
2085 | struct timespec timeout; | 2085 | struct timespec timeout_stack, *timeout = NULL; |
2086 | u32 seqno = 0; | 2086 | u32 seqno = 0; |
2087 | int ret = 0; | 2087 | int ret = 0; |
2088 | 2088 | ||
2089 | timeout = ns_to_timespec(args->timeout_ns); | 2089 | if (args->timeout_ns >= 0) { |
2090 | timeout_stack = ns_to_timespec(args->timeout_ns); | ||
2091 | timeout = &timeout_stack; | ||
2092 | } | ||
2090 | 2093 | ||
2091 | ret = i915_mutex_lock_interruptible(dev); | 2094 | ret = i915_mutex_lock_interruptible(dev); |
2092 | if (ret) | 2095 | if (ret) |
@@ -2122,9 +2125,11 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2122 | drm_gem_object_unreference(&obj->base); | 2125 | drm_gem_object_unreference(&obj->base); |
2123 | mutex_unlock(&dev->struct_mutex); | 2126 | mutex_unlock(&dev->struct_mutex); |
2124 | 2127 | ||
2125 | ret = __wait_seqno(ring, seqno, true, &timeout); | 2128 | ret = __wait_seqno(ring, seqno, true, timeout); |
2126 | WARN_ON(!timespec_valid(&timeout)); | 2129 | if (timeout) { |
2127 | args->timeout_ns = timespec_to_ns(&timeout); | 2130 | WARN_ON(!timespec_valid(timeout)); |
2131 | args->timeout_ns = timespec_to_ns(timeout); | ||
2132 | } | ||
2128 | return ret; | 2133 | return ret; |
2129 | 2134 | ||
2130 | out: | 2135 | out: |