diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-05-04 09:08:45 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-05-04 10:40:38 -0400 |
commit | 95aebcb2da73079f9ecb7f4e353af71ff1f04c05 (patch) | |
tree | f30a90272fa56d732bec4b3091c26539b619fc87 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | 605d5b3297687cce9d3c4298c699188e61486a4c (diff) |
drm/i915: Report the ring->space from intel_ring_update_space()
Some callers immediately want to know the current ring->space after
calling intel_ring_update_space(), which we can freely provide via the
return parameter.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170504130846.4807-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 46f2696bf886..b308e73fcfae 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -52,9 +52,14 @@ static unsigned int __intel_ring_space(unsigned int head, | |||
52 | return (head - tail - CACHELINE_BYTES) & (size - 1); | 52 | return (head - tail - CACHELINE_BYTES) & (size - 1); |
53 | } | 53 | } |
54 | 54 | ||
55 | void intel_ring_update_space(struct intel_ring *ring) | 55 | unsigned int intel_ring_update_space(struct intel_ring *ring) |
56 | { | 56 | { |
57 | ring->space = __intel_ring_space(ring->head, ring->emit, ring->size); | 57 | unsigned int space; |
58 | |||
59 | space = __intel_ring_space(ring->head, ring->emit, ring->size); | ||
60 | |||
61 | ring->space = space; | ||
62 | return space; | ||
58 | } | 63 | } |
59 | 64 | ||
60 | static int | 65 | static int |
@@ -1659,8 +1664,7 @@ static int wait_for_space(struct drm_i915_gem_request *req, int bytes) | |||
1659 | 1664 | ||
1660 | lockdep_assert_held(&req->i915->drm.struct_mutex); | 1665 | lockdep_assert_held(&req->i915->drm.struct_mutex); |
1661 | 1666 | ||
1662 | intel_ring_update_space(ring); | 1667 | if (intel_ring_update_space(ring) >= bytes) |
1663 | if (ring->space >= bytes) | ||
1664 | return 0; | 1668 | return 0; |
1665 | 1669 | ||
1666 | /* | 1670 | /* |