[Intel-gfx] [PATCH] ctx-sync

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 6 13:07:57 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 b06088bd644c..12db7212d643 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1777,12 +1777,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.17.1



More information about the Intel-gfx mailing list