@@ -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.