Commit fe085f13 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Remove intel_ring.last_retired_head

Storing the position of the breadcrumb of the last retired request as
a separate last_retired_head is superfluous as we always copy that into
head prior to recalculation of the intel_ring.space.
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/20170321102552.24357-1-chris@chris-wilson.co.uk
parent 899f6204
...@@ -1938,9 +1938,8 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data) ...@@ -1938,9 +1938,8 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
static void describe_ctx_ring(struct seq_file *m, struct intel_ring *ring) static void describe_ctx_ring(struct seq_file *m, struct intel_ring *ring)
{ {
seq_printf(m, " (ringbuffer, space: %d, head: %u, tail: %u, last head: %d)", seq_printf(m, " (ringbuffer, space: %d, head: %u, tail: %u)",
ring->space, ring->head, ring->tail, ring->space, ring->head, ring->tail);
ring->last_retired_head);
} }
static int i915_context_status(struct seq_file *m, void *unused) static int i915_context_status(struct seq_file *m, void *unused)
......
...@@ -295,7 +295,7 @@ static void i915_gem_request_retire(struct drm_i915_gem_request *request) ...@@ -295,7 +295,7 @@ static void i915_gem_request_retire(struct drm_i915_gem_request *request)
* completion order. * completion order.
*/ */
list_del(&request->ring_link); list_del(&request->ring_link);
request->ring->last_retired_head = request->postfix; request->ring->head = request->postfix;
if (!--request->i915->gt.active_requests) { if (!--request->i915->gt.active_requests) {
GEM_BUG_ON(!request->i915->gt.awake); GEM_BUG_ON(!request->i915->gt.awake);
mod_delayed_work(request->i915->wq, mod_delayed_work(request->i915->wq,
......
...@@ -1260,7 +1260,6 @@ static void reset_common_ring(struct intel_engine_cs *engine, ...@@ -1260,7 +1260,6 @@ static void reset_common_ring(struct intel_engine_cs *engine,
ce->lrc_reg_state[CTX_RING_HEAD+1] = request->postfix; ce->lrc_reg_state[CTX_RING_HEAD+1] = request->postfix;
request->ring->head = request->postfix; request->ring->head = request->postfix;
request->ring->last_retired_head = -1;
intel_ring_update_space(request->ring); intel_ring_update_space(request->ring);
/* Catch up with any missed context-switch interrupts */ /* Catch up with any missed context-switch interrupts */
...@@ -2047,7 +2046,6 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv) ...@@ -2047,7 +2046,6 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv)
i915_gem_object_unpin_map(ce->state->obj); i915_gem_object_unpin_map(ce->state->obj);
ce->ring->head = ce->ring->tail = 0; ce->ring->head = ce->ring->tail = 0;
ce->ring->last_retired_head = -1;
intel_ring_update_space(ce->ring); intel_ring_update_space(ce->ring);
} }
} }
......
...@@ -49,13 +49,7 @@ static int __intel_ring_space(int head, int tail, int size) ...@@ -49,13 +49,7 @@ static int __intel_ring_space(int head, int tail, int size)
void intel_ring_update_space(struct intel_ring *ring) void intel_ring_update_space(struct intel_ring *ring)
{ {
if (ring->last_retired_head != -1) { ring->space = __intel_ring_space(ring->head, ring->tail, ring->size);
ring->head = ring->last_retired_head;
ring->last_retired_head = -1;
}
ring->space = __intel_ring_space(ring->head & HEAD_ADDR,
ring->tail, ring->size);
} }
static int static int
...@@ -618,12 +612,8 @@ static void reset_ring_common(struct intel_engine_cs *engine, ...@@ -618,12 +612,8 @@ static void reset_ring_common(struct intel_engine_cs *engine,
} }
/* If the rq hung, jump to its breadcrumb and skip the batch */ /* If the rq hung, jump to its breadcrumb and skip the batch */
if (request->fence.error == -EIO) { if (request->fence.error == -EIO)
struct intel_ring *ring = request->ring; request->ring->head = request->postfix;
ring->head = request->postfix;
ring->last_retired_head = -1;
}
} else { } else {
engine->legacy_active_context = NULL; engine->legacy_active_context = NULL;
} }
...@@ -1392,7 +1382,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size) ...@@ -1392,7 +1382,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size)
if (IS_I830(engine->i915) || IS_I845G(engine->i915)) if (IS_I830(engine->i915) || IS_I845G(engine->i915))
ring->effective_size -= 2 * CACHELINE_BYTES; ring->effective_size -= 2 * CACHELINE_BYTES;
ring->last_retired_head = -1;
intel_ring_update_space(ring); intel_ring_update_space(ring);
vma = intel_ring_create_vma(engine->i915, size); vma = intel_ring_create_vma(engine->i915, size);
...@@ -1571,10 +1560,8 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv) ...@@ -1571,10 +1560,8 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv)
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
enum intel_engine_id id; enum intel_engine_id id;
for_each_engine(engine, dev_priv, id) { for_each_engine(engine, dev_priv, id)
engine->buffer->head = engine->buffer->tail; engine->buffer->head = engine->buffer->tail;
engine->buffer->last_retired_head = -1;
}
} }
static int ring_request_alloc(struct drm_i915_gem_request *request) static int ring_request_alloc(struct drm_i915_gem_request *request)
......
...@@ -149,16 +149,6 @@ struct intel_ring { ...@@ -149,16 +149,6 @@ struct intel_ring {
int space; int space;
int size; int size;
int effective_size; int effective_size;
/** We track the position of the requests in the ring buffer, and
* when each is retired we increment last_retired_head as the GPU
* must have finished processing the request and so we know we
* can advance the ringbuffer up to that position.
*
* last_retired_head is set to -1 after the value is consumed so
* we can detect new retirements.
*/
u32 last_retired_head;
}; };
struct i915_gem_context; struct i915_gem_context;
......
...@@ -118,7 +118,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine) ...@@ -118,7 +118,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine)
ring->vaddr = (void *)(ring + 1); ring->vaddr = (void *)(ring + 1);
INIT_LIST_HEAD(&ring->request_list); INIT_LIST_HEAD(&ring->request_list);
ring->last_retired_head = -1;
intel_ring_update_space(ring); intel_ring_update_space(ring);
return ring; return 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