aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-05-01 07:45:36 -0400
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>2019-05-07 04:53:43 -0400
commite766fde6511e2be83acbca1d603035e08de23f3b (patch)
treec49549d11cf600cb447efa240460ab47d7072dbb
parent9628e15ca9d5f7595ba886173e98a139d0a56cd1 (diff)
drm/i915: Delay semaphore submission until the start of the signaler
Currently we submit the semaphore busywait as soon as the signaler is submitted to HW. However, we may submit the signaler as the tail of a batch of requests, and even not as the first context in the HW list, i.e. the busywait may start spinning far in advance of the signaler even starting. If we wait until the request before the signaler is completed before submitting the busywait, we prevent the busywait from starting too early, if the signaler is not first in submission port. To handle the case where the signaler is at the start of the second (or later) submission port, we will need to delay the execution callback until we know the context is promoted to port0. A challenge for later. Fixes: e88619646971 ("drm/i915: Use HW semaphores for inter-engine synchronisation on gen8+") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190501114541.10077-9-chris@chris-wilson.co.uk (cherry picked from commit 0d90ccb70211cbf55140e91bd39db684aa4c16e9) [Joonas: edited Fixes: tag into single line.] Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_request.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index b836721d3b13..20c7c77b3768 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -799,6 +799,21 @@ err_unreserve:
799} 799}
800 800
801static int 801static int
802i915_request_await_start(struct i915_request *rq, struct i915_request *signal)
803{
804 if (list_is_first(&signal->ring_link, &signal->ring->request_list))
805 return 0;
806
807 signal = list_prev_entry(signal, ring_link);
808 if (i915_timeline_sync_is_later(rq->timeline, &signal->fence))
809 return 0;
810
811 return i915_sw_fence_await_dma_fence(&rq->submit,
812 &signal->fence, 0,
813 I915_FENCE_GFP);
814}
815
816static int
802emit_semaphore_wait(struct i915_request *to, 817emit_semaphore_wait(struct i915_request *to,
803 struct i915_request *from, 818 struct i915_request *from,
804 gfp_t gfp) 819 gfp_t gfp)
@@ -816,6 +831,10 @@ emit_semaphore_wait(struct i915_request *to,
816 &from->fence, 0, 831 &from->fence, 0,
817 I915_FENCE_GFP); 832 I915_FENCE_GFP);
818 833
834 err = i915_request_await_start(to, from);
835 if (err < 0)
836 return err;
837
819 err = i915_sw_fence_await_dma_fence(&to->semaphore, 838 err = i915_sw_fence_await_dma_fence(&to->semaphore,
820 &from->fence, 0, 839 &from->fence, 0,
821 I915_FENCE_GFP); 840 I915_FENCE_GFP);