[Intel-gfx] [PATCH] ctx-sync

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 20 11:20:32 UTC 2018


---
 drivers/gpu/drm/i915/intel_lrc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index dc556595a845..2c310754e1f9 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1780,12 +1780,31 @@ execlists_context_pin(struct intel_engine_cs *engine,
 	return __execlists_context_pin(engine, ctx, ce);
 }
 
+static int await_context_update(struct i915_request *request)
+{
+	struct i915_vma *vma = request->hw_context->state;
+	struct dma_fence *fence;
+	int err = 0;
+
+	fence = reservation_object_get_excl_rcu(vma->resv);
+	if (fence) {
+		err = i915_request_await_dma_fence(request, fence);
+		dma_fence_put(fence);
+	}
+
+	return err;
+}
+
 static int execlists_request_alloc(struct i915_request *request)
 {
 	int ret;
 
 	GEM_BUG_ON(!request->hw_context->pin_count);
 
+	ret = await_context_update(request);
+	if (ret)
+		return ret;
+
 	/* Flush enough space to reduce the likelihood of waiting after
 	 * we start building the request - in which case we will just
 	 * have to repeat work.
-- 
2.18.0.rc2



More information about the Intel-gfx mailing list