diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-21 06:25:52 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-21 10:21:50 -0400 |
commit | fe085f13c7901203445fd2ab26c0f499313b8258 (patch) | |
tree | c960eafb07e11a856cb325ca82e71f45140f040b | |
parent | 899f6204c0f8117d33226e586d3a630b3cf9bce0 (diff) |
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: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170321102552.24357-1-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_request.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_lrc.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.h | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/selftests/mock_engine.c | 1 |
6 files changed, 7 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 47e707d83c4d..29bf11d8b620 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1938,9 +1938,8 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data) | |||
1938 | 1938 | ||
1939 | static void describe_ctx_ring(struct seq_file *m, struct intel_ring *ring) | 1939 | static void describe_ctx_ring(struct seq_file *m, struct intel_ring *ring) |
1940 | { | 1940 | { |
1941 | seq_printf(m, " (ringbuffer, space: %d, head: %u, tail: %u, last head: %d)", | 1941 | seq_printf(m, " (ringbuffer, space: %d, head: %u, tail: %u)", |
1942 | ring->space, ring->head, ring->tail, | 1942 | ring->space, ring->head, ring->tail); |
1943 | ring->last_retired_head); | ||
1944 | } | 1943 | } |
1945 | 1944 | ||
1946 | static int i915_context_status(struct seq_file *m, void *unused) | 1945 | static int i915_context_status(struct seq_file *m, void *unused) |
diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 0e8d1010cecb..dbfa9db2419d 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c | |||
@@ -295,7 +295,7 @@ static void i915_gem_request_retire(struct drm_i915_gem_request *request) | |||
295 | * completion order. | 295 | * completion order. |
296 | */ | 296 | */ |
297 | list_del(&request->ring_link); | 297 | list_del(&request->ring_link); |
298 | request->ring->last_retired_head = request->postfix; | 298 | request->ring->head = request->postfix; |
299 | if (!--request->i915->gt.active_requests) { | 299 | if (!--request->i915->gt.active_requests) { |
300 | GEM_BUG_ON(!request->i915->gt.awake); | 300 | GEM_BUG_ON(!request->i915->gt.awake); |
301 | mod_delayed_work(request->i915->wq, | 301 | mod_delayed_work(request->i915->wq, |
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index a88380876ce9..090238eefd49 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
@@ -1260,7 +1260,6 @@ static void reset_common_ring(struct intel_engine_cs *engine, | |||
1260 | ce->lrc_reg_state[CTX_RING_HEAD+1] = request->postfix; | 1260 | ce->lrc_reg_state[CTX_RING_HEAD+1] = request->postfix; |
1261 | 1261 | ||
1262 | request->ring->head = request->postfix; | 1262 | request->ring->head = request->postfix; |
1263 | request->ring->last_retired_head = -1; | ||
1264 | intel_ring_update_space(request->ring); | 1263 | intel_ring_update_space(request->ring); |
1265 | 1264 | ||
1266 | /* Catch up with any missed context-switch interrupts */ | 1265 | /* Catch up with any missed context-switch interrupts */ |
@@ -2047,7 +2046,6 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv) | |||
2047 | i915_gem_object_unpin_map(ce->state->obj); | 2046 | i915_gem_object_unpin_map(ce->state->obj); |
2048 | 2047 | ||
2049 | ce->ring->head = ce->ring->tail = 0; | 2048 | ce->ring->head = ce->ring->tail = 0; |
2050 | ce->ring->last_retired_head = -1; | ||
2051 | intel_ring_update_space(ce->ring); | 2049 | intel_ring_update_space(ce->ring); |
2052 | } | 2050 | } |
2053 | } | 2051 | } |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index d9b8d17c3fc6..0ca5ea7a9407 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -49,13 +49,7 @@ static int __intel_ring_space(int head, int tail, int size) | |||
49 | 49 | ||
50 | void intel_ring_update_space(struct intel_ring *ring) | 50 | void intel_ring_update_space(struct intel_ring *ring) |
51 | { | 51 | { |
52 | if (ring->last_retired_head != -1) { | 52 | ring->space = __intel_ring_space(ring->head, ring->tail, ring->size); |
53 | ring->head = ring->last_retired_head; | ||
54 | ring->last_retired_head = -1; | ||
55 | } | ||
56 | |||
57 | ring->space = __intel_ring_space(ring->head & HEAD_ADDR, | ||
58 | ring->tail, ring->size); | ||
59 | } | 53 | } |
60 | 54 | ||
61 | static int | 55 | static int |
@@ -618,12 +612,8 @@ static void reset_ring_common(struct intel_engine_cs *engine, | |||
618 | } | 612 | } |
619 | 613 | ||
620 | /* If the rq hung, jump to its breadcrumb and skip the batch */ | 614 | /* If the rq hung, jump to its breadcrumb and skip the batch */ |
621 | if (request->fence.error == -EIO) { | 615 | if (request->fence.error == -EIO) |
622 | struct intel_ring *ring = request->ring; | 616 | request->ring->head = request->postfix; |
623 | |||
624 | ring->head = request->postfix; | ||
625 | ring->last_retired_head = -1; | ||
626 | } | ||
627 | } else { | 617 | } else { |
628 | engine->legacy_active_context = NULL; | 618 | engine->legacy_active_context = NULL; |
629 | } | 619 | } |
@@ -1392,7 +1382,6 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size) | |||
1392 | if (IS_I830(engine->i915) || IS_I845G(engine->i915)) | 1382 | if (IS_I830(engine->i915) || IS_I845G(engine->i915)) |
1393 | ring->effective_size -= 2 * CACHELINE_BYTES; | 1383 | ring->effective_size -= 2 * CACHELINE_BYTES; |
1394 | 1384 | ||
1395 | ring->last_retired_head = -1; | ||
1396 | intel_ring_update_space(ring); | 1385 | intel_ring_update_space(ring); |
1397 | 1386 | ||
1398 | vma = intel_ring_create_vma(engine->i915, size); | 1387 | vma = intel_ring_create_vma(engine->i915, size); |
@@ -1571,10 +1560,8 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv) | |||
1571 | struct intel_engine_cs *engine; | 1560 | struct intel_engine_cs *engine; |
1572 | enum intel_engine_id id; | 1561 | enum intel_engine_id id; |
1573 | 1562 | ||
1574 | for_each_engine(engine, dev_priv, id) { | 1563 | for_each_engine(engine, dev_priv, id) |
1575 | engine->buffer->head = engine->buffer->tail; | 1564 | engine->buffer->head = engine->buffer->tail; |
1576 | engine->buffer->last_retired_head = -1; | ||
1577 | } | ||
1578 | } | 1565 | } |
1579 | 1566 | ||
1580 | static int ring_request_alloc(struct drm_i915_gem_request *request) | 1567 | static int ring_request_alloc(struct drm_i915_gem_request *request) |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 847aea554464..2ecb41788fb6 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -149,16 +149,6 @@ struct intel_ring { | |||
149 | int space; | 149 | int space; |
150 | int size; | 150 | int size; |
151 | int effective_size; | 151 | int effective_size; |
152 | |||
153 | /** We track the position of the requests in the ring buffer, and | ||
154 | * when each is retired we increment last_retired_head as the GPU | ||
155 | * must have finished processing the request and so we know we | ||
156 | * can advance the ringbuffer up to that position. | ||
157 | * | ||
158 | * last_retired_head is set to -1 after the value is consumed so | ||
159 | * we can detect new retirements. | ||
160 | */ | ||
161 | u32 last_retired_head; | ||
162 | }; | 152 | }; |
163 | 153 | ||
164 | struct i915_gem_context; | 154 | struct i915_gem_context; |
diff --git a/drivers/gpu/drm/i915/selftests/mock_engine.c b/drivers/gpu/drm/i915/selftests/mock_engine.c index 8d5ba037064c..0ad624a1db90 100644 --- a/drivers/gpu/drm/i915/selftests/mock_engine.c +++ b/drivers/gpu/drm/i915/selftests/mock_engine.c | |||
@@ -118,7 +118,6 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine) | |||
118 | ring->vaddr = (void *)(ring + 1); | 118 | ring->vaddr = (void *)(ring + 1); |
119 | 119 | ||
120 | INIT_LIST_HEAD(&ring->request_list); | 120 | INIT_LIST_HEAD(&ring->request_list); |
121 | ring->last_retired_head = -1; | ||
122 | intel_ring_update_space(ring); | 121 | intel_ring_update_space(ring); |
123 | 122 | ||
124 | return ring; | 123 | return ring; |