Commit 95aebcb2 authored by Chris Wilson's avatar Chris Wilson

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170504130846.4807-2-chris@chris-wilson.co.uk
parent 605d5b32
...@@ -52,9 +52,14 @@ static unsigned int __intel_ring_space(unsigned int head, ...@@ -52,9 +52,14 @@ static unsigned int __intel_ring_space(unsigned int head,
return (head - tail - CACHELINE_BYTES) & (size - 1); return (head - tail - CACHELINE_BYTES) & (size - 1);
} }
void intel_ring_update_space(struct intel_ring *ring) unsigned int intel_ring_update_space(struct intel_ring *ring)
{ {
ring->space = __intel_ring_space(ring->head, ring->emit, ring->size); unsigned int space;
space = __intel_ring_space(ring->head, ring->emit, ring->size);
ring->space = space;
return space;
} }
static int static int
...@@ -1659,8 +1664,7 @@ static int wait_for_space(struct drm_i915_gem_request *req, int bytes) ...@@ -1659,8 +1664,7 @@ static int wait_for_space(struct drm_i915_gem_request *req, int bytes)
lockdep_assert_held(&req->i915->drm.struct_mutex); lockdep_assert_held(&req->i915->drm.struct_mutex);
intel_ring_update_space(ring); if (intel_ring_update_space(ring) >= bytes)
if (ring->space >= bytes)
return 0; return 0;
/* /*
......
...@@ -486,7 +486,7 @@ int intel_ring_pin(struct intel_ring *ring, ...@@ -486,7 +486,7 @@ int intel_ring_pin(struct intel_ring *ring,
struct drm_i915_private *i915, struct drm_i915_private *i915,
unsigned int offset_bias); unsigned int offset_bias);
void intel_ring_reset(struct intel_ring *ring, u32 tail); void intel_ring_reset(struct intel_ring *ring, u32 tail);
void intel_ring_update_space(struct intel_ring *ring); unsigned int intel_ring_update_space(struct intel_ring *ring);
void intel_ring_unpin(struct intel_ring *ring); void intel_ring_unpin(struct intel_ring *ring);
void intel_ring_free(struct intel_ring *ring); void intel_ring_free(struct intel_ring *ring);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment