aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Hoath <nicholas.hoath@intel.com>2015-01-15 08:10:36 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-27 03:50:52 -0500
commit2d12955a3e539f0938b4b90d1eade852105ba290 (patch)
tree6a60073d802904453d3faca49fecf63aa884b382
parent16f3f658e5f808235c04f0ac157e9b5c8916d7a3 (diff)
drm/i915: execlist request keeps ptr/ref to gem_request
Add a reference and pointer from the execlist queue item to the associated gem request. For execlist requests that don't have a request, create one as a placeholder. Issue: VIZ-4274 v1: Rebase after upstream of "Replace seqno values with request structures" patchset. Signed-off-by: Nick Hoath <nicholas.hoath@intel.com> Reviewed-by: Thomas Daniel <thomas.daniel@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c31
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.h6
2 files changed, 30 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index e405b61cdac5..7992af808404 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -534,7 +534,8 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
534 534
535static int execlists_context_queue(struct intel_engine_cs *ring, 535static int execlists_context_queue(struct intel_engine_cs *ring,
536 struct intel_context *to, 536 struct intel_context *to,
537 u32 tail) 537 u32 tail,
538 struct drm_i915_gem_request *request)
538{ 539{
539 struct intel_ctx_submit_request *req = NULL, *cursor; 540 struct intel_ctx_submit_request *req = NULL, *cursor;
540 struct drm_i915_private *dev_priv = ring->dev->dev_private; 541 struct drm_i915_private *dev_priv = ring->dev->dev_private;
@@ -553,6 +554,21 @@ static int execlists_context_queue(struct intel_engine_cs *ring,
553 req->ring = ring; 554 req->ring = ring;
554 req->tail = tail; 555 req->tail = tail;
555 556
557 if (!request) {
558 /*
559 * If there isn't a request associated with this submission,
560 * create one as a temporary holder.
561 */
562 WARN(1, "execlist context submission without request");
563 request = kzalloc(sizeof(*request), GFP_KERNEL);
564 if (request == NULL)
565 return -ENOMEM;
566 request->ctx = to;
567 request->ring = ring;
568 }
569 req->request = request;
570 i915_gem_request_reference(request);
571
556 intel_runtime_pm_get(dev_priv); 572 intel_runtime_pm_get(dev_priv);
557 573
558 spin_lock_irqsave(&ring->execlist_lock, flags); 574 spin_lock_irqsave(&ring->execlist_lock, flags);
@@ -766,6 +782,7 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring)
766 intel_lr_context_unpin(ring, ctx); 782 intel_lr_context_unpin(ring, ctx);
767 intel_runtime_pm_put(dev_priv); 783 intel_runtime_pm_put(dev_priv);
768 i915_gem_context_unreference(req->ctx); 784 i915_gem_context_unreference(req->ctx);
785 i915_gem_request_unreference(req->request);
769 list_del(&req->execlist_link); 786 list_del(&req->execlist_link);
770 kfree(req); 787 kfree(req);
771 } 788 }
@@ -818,7 +835,8 @@ int logical_ring_flush_all_caches(struct intel_ringbuffer *ringbuf)
818 * on a queue waiting for the ELSP to be ready to accept a new context submission. At that 835 * on a queue waiting for the ELSP to be ready to accept a new context submission. At that
819 * point, the tail *inside* the context is updated and the ELSP written to. 836 * point, the tail *inside* the context is updated and the ELSP written to.
820 */ 837 */
821void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf) 838void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf,
839 struct drm_i915_gem_request *request)
822{ 840{
823 struct intel_engine_cs *ring = ringbuf->ring; 841 struct intel_engine_cs *ring = ringbuf->ring;
824 struct intel_context *ctx = ringbuf->FIXME_lrc_ctx; 842 struct intel_context *ctx = ringbuf->FIXME_lrc_ctx;
@@ -828,7 +846,7 @@ void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf)
828 if (intel_ring_stopped(ring)) 846 if (intel_ring_stopped(ring))
829 return; 847 return;
830 848
831 execlists_context_queue(ring, ctx, ringbuf->tail); 849 execlists_context_queue(ring, ctx, ringbuf->tail, request);
832} 850}
833 851
834static int intel_lr_context_pin(struct intel_engine_cs *ring, 852static int intel_lr_context_pin(struct intel_engine_cs *ring,
@@ -972,7 +990,7 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,
972 return ret; 990 return ret;
973 991
974 /* Force the context submission in case we have been skipping it */ 992 /* Force the context submission in case we have been skipping it */
975 intel_logical_ring_advance_and_submit(ringbuf); 993 intel_logical_ring_advance_and_submit(ringbuf, NULL);
976 994
977 /* With GEM the hangcheck timer should kick us out of the loop, 995 /* With GEM the hangcheck timer should kick us out of the loop,
978 * leaving it early runs the risk of corrupting GEM state (due 996 * leaving it early runs the risk of corrupting GEM state (due
@@ -1311,7 +1329,8 @@ static void gen8_set_seqno(struct intel_engine_cs *ring, u32 seqno)
1311 intel_write_status_page(ring, I915_GEM_HWS_INDEX, seqno); 1329 intel_write_status_page(ring, I915_GEM_HWS_INDEX, seqno);
1312} 1330}
1313 1331
1314static int gen8_emit_request(struct intel_ringbuffer *ringbuf) 1332static int gen8_emit_request(struct intel_ringbuffer *ringbuf,
1333 struct drm_i915_gem_request *request)
1315{ 1334{
1316 struct intel_engine_cs *ring = ringbuf->ring; 1335 struct intel_engine_cs *ring = ringbuf->ring;
1317 u32 cmd; 1336 u32 cmd;
@@ -1333,7 +1352,7 @@ static int gen8_emit_request(struct intel_ringbuffer *ringbuf)
1333 i915_gem_request_get_seqno(ring->outstanding_lazy_request)); 1352 i915_gem_request_get_seqno(ring->outstanding_lazy_request));
1334 intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT); 1353 intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT);
1335 intel_logical_ring_emit(ringbuf, MI_NOOP); 1354 intel_logical_ring_emit(ringbuf, MI_NOOP);
1336 intel_logical_ring_advance_and_submit(ringbuf); 1355 intel_logical_ring_advance_and_submit(ringbuf, request);
1337 1356
1338 return 0; 1357 return 0;
1339} 1358}
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index 960fcbd2c98a..7a82bc9b03a7 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -39,7 +39,9 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *ring);
39int intel_logical_rings_init(struct drm_device *dev); 39int intel_logical_rings_init(struct drm_device *dev);
40 40
41int logical_ring_flush_all_caches(struct intel_ringbuffer *ringbuf); 41int logical_ring_flush_all_caches(struct intel_ringbuffer *ringbuf);
42void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf); 42void intel_logical_ring_advance_and_submit(
43 struct intel_ringbuffer *ringbuf,
44 struct drm_i915_gem_request *request);
43/** 45/**
44 * intel_logical_ring_advance() - advance the ringbuffer tail 46 * intel_logical_ring_advance() - advance the ringbuffer tail
45 * @ringbuf: Ringbuffer to advance. 47 * @ringbuf: Ringbuffer to advance.
@@ -110,6 +112,8 @@ struct intel_ctx_submit_request {
110 struct list_head execlist_link; 112 struct list_head execlist_link;
111 113
112 int elsp_submitted; 114 int elsp_submitted;
115
116 struct drm_i915_gem_request *request;
113}; 117};
114 118
115void intel_lrc_irq_handler(struct intel_engine_cs *ring); 119void intel_lrc_irq_handler(struct intel_engine_cs *ring);