aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Hoath <nicholas.hoath@intel.com>2015-01-15 08:10:37 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-27 03:50:52 -0500
commit72f95afa5faaf899f7344879b6ccd5f0cb271b28 (patch)
tree0ca821288c433cb1d9dfa2c3d5c2b1878126045a
parent2d12955a3e539f0938b4b90d1eade852105ba290 (diff)
drm/i915: Removed duplicate members from submit_request
Where there were duplicate variables for the tail, context and ring (engine) in the gem request and the execlist queue item, use the one from the request and remove the duplicate from the execlist queue item. Issue: VIZ-4274 v1: Rebase v2: Fixed build issues. Keep separate postfix & tail pointers as these are used in different ways. Reinserted missing full tail pointer update. 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/i915_debugfs.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h9
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c8
-rw-r--r--drivers/gpu/drm/i915/i915_gpu_error.c2
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c25
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.h4
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c2
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h3
8 files changed, 29 insertions, 28 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index f56cf627f8b6..064efec2c7cb 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1968,11 +1968,11 @@ static int i915_execlists(struct seq_file *m, void *data)
1968 if (head_req) { 1968 if (head_req) {
1969 struct drm_i915_gem_object *ctx_obj; 1969 struct drm_i915_gem_object *ctx_obj;
1970 1970
1971 ctx_obj = head_req->ctx->engine[ring_id].state; 1971 ctx_obj = head_req->request->ctx->engine[ring_id].state;
1972 seq_printf(m, "\tHead request id: %u\n", 1972 seq_printf(m, "\tHead request id: %u\n",
1973 intel_execlists_ctx_id(ctx_obj)); 1973 intel_execlists_ctx_id(ctx_obj));
1974 seq_printf(m, "\tHead request tail: %u\n", 1974 seq_printf(m, "\tHead request tail: %u\n",
1975 head_req->tail); 1975 head_req->request->tail);
1976 } 1976 }
1977 1977
1978 seq_putc(m, '\n'); 1978 seq_putc(m, '\n');
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 600a2250fe03..81d102abb9b5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2089,7 +2089,14 @@ struct drm_i915_gem_request {
2089 /** Position in the ringbuffer of the start of the request */ 2089 /** Position in the ringbuffer of the start of the request */
2090 u32 head; 2090 u32 head;
2091 2091
2092 /** Position in the ringbuffer of the end of the request */ 2092 /**
2093 * Position in the ringbuffer of the start of the postfix.
2094 * This is required to calculate the maximum available ringbuffer
2095 * space without overwriting the postfix.
2096 */
2097 u32 postfix;
2098
2099 /** Position in the ringbuffer of the end of the whole request */
2093 u32 tail; 2100 u32 tail;
2094 2101
2095 /** Context related to this request */ 2102 /** Context related to this request */
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6c403654e33a..e6768d339243 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2453,7 +2453,7 @@ int __i915_add_request(struct intel_engine_cs *ring,
2453 request_ring_position = intel_ring_get_tail(ringbuf); 2453 request_ring_position = intel_ring_get_tail(ringbuf);
2454 2454
2455 if (i915.enable_execlists) { 2455 if (i915.enable_execlists) {
2456 ret = ring->emit_request(ringbuf); 2456 ret = ring->emit_request(ringbuf, request);
2457 if (ret) 2457 if (ret)
2458 return ret; 2458 return ret;
2459 } else { 2459 } else {
@@ -2463,7 +2463,7 @@ int __i915_add_request(struct intel_engine_cs *ring,
2463 } 2463 }
2464 2464
2465 request->head = request_start; 2465 request->head = request_start;
2466 request->tail = request_ring_position; 2466 request->postfix = request_ring_position;
2467 2467
2468 /* Whilst this request exists, batch_obj will be on the 2468 /* Whilst this request exists, batch_obj will be on the
2469 * active_list, and so will hold the active reference. Only when this 2469 * active_list, and so will hold the active reference. Only when this
@@ -2657,7 +2657,7 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
2657 execlist_link); 2657 execlist_link);
2658 list_del(&submit_req->execlist_link); 2658 list_del(&submit_req->execlist_link);
2659 intel_runtime_pm_put(dev_priv); 2659 intel_runtime_pm_put(dev_priv);
2660 i915_gem_context_unreference(submit_req->ctx); 2660 i915_gem_context_unreference(submit_req->request->ctx);
2661 kfree(submit_req); 2661 kfree(submit_req);
2662 } 2662 }
2663 2663
@@ -2783,7 +2783,7 @@ i915_gem_retire_requests_ring(struct intel_engine_cs *ring)
2783 * of tail of the request to update the last known position 2783 * of tail of the request to update the last known position
2784 * of the GPU head. 2784 * of the GPU head.
2785 */ 2785 */
2786 ringbuf->last_retired_head = request->tail; 2786 ringbuf->last_retired_head = request->postfix;
2787 2787
2788 i915_gem_free_request(request); 2788 i915_gem_free_request(request);
2789 } 2789 }
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index be5c9908659b..48ddbf44c862 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1052,7 +1052,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
1052 erq = &error->ring[i].requests[count++]; 1052 erq = &error->ring[i].requests[count++];
1053 erq->seqno = request->seqno; 1053 erq->seqno = request->seqno;
1054 erq->jiffies = request->emitted_jiffies; 1054 erq->jiffies = request->emitted_jiffies;
1055 erq->tail = request->tail; 1055 erq->tail = request->postfix;
1056 } 1056 }
1057 } 1057 }
1058} 1058}
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 7992af808404..5b6e3698ead3 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -417,7 +417,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
417 execlist_link) { 417 execlist_link) {
418 if (!req0) { 418 if (!req0) {
419 req0 = cursor; 419 req0 = cursor;
420 } else if (req0->ctx == cursor->ctx) { 420 } else if (req0->request->ctx == cursor->request->ctx) {
421 /* Same ctx: ignore first request, as second request 421 /* Same ctx: ignore first request, as second request
422 * will update tail past first request's workload */ 422 * will update tail past first request's workload */
423 cursor->elsp_submitted = req0->elsp_submitted; 423 cursor->elsp_submitted = req0->elsp_submitted;
@@ -433,9 +433,9 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
433 433
434 WARN_ON(req1 && req1->elsp_submitted); 434 WARN_ON(req1 && req1->elsp_submitted);
435 435
436 execlists_submit_contexts(ring, req0->ctx, req0->tail, 436 execlists_submit_contexts(ring, req0->request->ctx, req0->request->tail,
437 req1 ? req1->ctx : NULL, 437 req1 ? req1->request->ctx : NULL,
438 req1 ? req1->tail : 0); 438 req1 ? req1->request->tail : 0);
439 439
440 req0->elsp_submitted++; 440 req0->elsp_submitted++;
441 if (req1) 441 if (req1)
@@ -455,7 +455,7 @@ static bool execlists_check_remove_request(struct intel_engine_cs *ring,
455 455
456 if (head_req != NULL) { 456 if (head_req != NULL) {
457 struct drm_i915_gem_object *ctx_obj = 457 struct drm_i915_gem_object *ctx_obj =
458 head_req->ctx->engine[ring->id].state; 458 head_req->request->ctx->engine[ring->id].state;
459 if (intel_execlists_ctx_id(ctx_obj) == request_id) { 459 if (intel_execlists_ctx_id(ctx_obj) == request_id) {
460 WARN(head_req->elsp_submitted == 0, 460 WARN(head_req->elsp_submitted == 0,
461 "Never submitted head request\n"); 461 "Never submitted head request\n");
@@ -545,15 +545,10 @@ static int execlists_context_queue(struct intel_engine_cs *ring,
545 req = kzalloc(sizeof(*req), GFP_KERNEL); 545 req = kzalloc(sizeof(*req), GFP_KERNEL);
546 if (req == NULL) 546 if (req == NULL)
547 return -ENOMEM; 547 return -ENOMEM;
548 req->ctx = to;
549 i915_gem_context_reference(req->ctx);
550 548
551 if (to != ring->default_context) 549 if (to != ring->default_context)
552 intel_lr_context_pin(ring, to); 550 intel_lr_context_pin(ring, to);
553 551
554 req->ring = ring;
555 req->tail = tail;
556
557 if (!request) { 552 if (!request) {
558 /* 553 /*
559 * If there isn't a request associated with this submission, 554 * If there isn't a request associated with this submission,
@@ -563,11 +558,13 @@ static int execlists_context_queue(struct intel_engine_cs *ring,
563 request = kzalloc(sizeof(*request), GFP_KERNEL); 558 request = kzalloc(sizeof(*request), GFP_KERNEL);
564 if (request == NULL) 559 if (request == NULL)
565 return -ENOMEM; 560 return -ENOMEM;
566 request->ctx = to;
567 request->ring = ring; 561 request->ring = ring;
568 } 562 }
563 request->ctx = to;
564 request->tail = tail;
569 req->request = request; 565 req->request = request;
570 i915_gem_request_reference(request); 566 i915_gem_request_reference(request);
567 i915_gem_context_reference(req->request->ctx);
571 568
572 intel_runtime_pm_get(dev_priv); 569 intel_runtime_pm_get(dev_priv);
573 570
@@ -584,7 +581,7 @@ static int execlists_context_queue(struct intel_engine_cs *ring,
584 struct intel_ctx_submit_request, 581 struct intel_ctx_submit_request,
585 execlist_link); 582 execlist_link);
586 583
587 if (to == tail_req->ctx) { 584 if (to == tail_req->request->ctx) {
588 WARN(tail_req->elsp_submitted != 0, 585 WARN(tail_req->elsp_submitted != 0,
589 "More than 2 already-submitted reqs queued\n"); 586 "More than 2 already-submitted reqs queued\n");
590 list_del(&tail_req->execlist_link); 587 list_del(&tail_req->execlist_link);
@@ -774,14 +771,14 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring)
774 spin_unlock_irqrestore(&ring->execlist_lock, flags); 771 spin_unlock_irqrestore(&ring->execlist_lock, flags);
775 772
776 list_for_each_entry_safe(req, tmp, &retired_list, execlist_link) { 773 list_for_each_entry_safe(req, tmp, &retired_list, execlist_link) {
777 struct intel_context *ctx = req->ctx; 774 struct intel_context *ctx = req->request->ctx;
778 struct drm_i915_gem_object *ctx_obj = 775 struct drm_i915_gem_object *ctx_obj =
779 ctx->engine[ring->id].state; 776 ctx->engine[ring->id].state;
780 777
781 if (ctx_obj && (ctx != ring->default_context)) 778 if (ctx_obj && (ctx != ring->default_context))
782 intel_lr_context_unpin(ring, ctx); 779 intel_lr_context_unpin(ring, ctx);
783 intel_runtime_pm_put(dev_priv); 780 intel_runtime_pm_put(dev_priv);
784 i915_gem_context_unreference(req->ctx); 781 i915_gem_context_unreference(ctx);
785 i915_gem_request_unreference(req->request); 782 i915_gem_request_unreference(req->request);
786 list_del(&req->execlist_link); 783 list_del(&req->execlist_link);
787 kfree(req); 784 kfree(req);
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index 7a82bc9b03a7..376c307f6835 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -105,10 +105,6 @@ u32 intel_execlists_ctx_id(struct drm_i915_gem_object *ctx_obj);
105 * All accesses to the queue are mediated by a spinlock (ring->execlist_lock). 105 * All accesses to the queue are mediated by a spinlock (ring->execlist_lock).
106 */ 106 */
107struct intel_ctx_submit_request { 107struct intel_ctx_submit_request {
108 struct intel_context *ctx;
109 struct intel_engine_cs *ring;
110 u32 tail;
111
112 struct list_head execlist_link; 108 struct list_head execlist_link;
113 109
114 int elsp_submitted; 110 int elsp_submitted;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 23020d67329b..b117717639fe 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1949,7 +1949,7 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n)
1949 return 0; 1949 return 0;
1950 1950
1951 list_for_each_entry(request, &ring->request_list, list) { 1951 list_for_each_entry(request, &ring->request_list, list) {
1952 if (__intel_ring_space(request->tail, ringbuf->tail, 1952 if (__intel_ring_space(request->postfix, ringbuf->tail,
1953 ringbuf->size) >= n) { 1953 ringbuf->size) >= n) {
1954 break; 1954 break;
1955 } 1955 }
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 6dbb6f462007..32aa3f36a796 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -239,7 +239,8 @@ struct intel_engine_cs {
239 struct list_head execlist_retired_req_list; 239 struct list_head execlist_retired_req_list;
240 u8 next_context_status_buffer; 240 u8 next_context_status_buffer;
241 u32 irq_keep_mask; /* bitmask for interrupts that should not be masked */ 241 u32 irq_keep_mask; /* bitmask for interrupts that should not be masked */
242 int (*emit_request)(struct intel_ringbuffer *ringbuf); 242 int (*emit_request)(struct intel_ringbuffer *ringbuf,
243 struct drm_i915_gem_request *request);
243 int (*emit_flush)(struct intel_ringbuffer *ringbuf, 244 int (*emit_flush)(struct intel_ringbuffer *ringbuf,
244 u32 invalidate_domains, 245 u32 invalidate_domains,
245 u32 flush_domains); 246 u32 flush_domains);