diff mbox

ctx-sync

Message ID 20180606130757.20600-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson June 6, 2018, 1:07 p.m. UTC
---
 drivers/gpu/drm/i915/intel_lrc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Chris Wilson June 6, 2018, 1:10 p.m. UTC | #1
Wrong branch,
-Chris
diff mbox

Patch

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.