Commit e6829625 authored by Chris Wilson's avatar Chris Wilson

drm/i915/gem: Wait until the context is finally retired before releasing engines

If we want to percolate information back from the HW, up through the GEM
context, we need to wait until the intel_context is scheduled out for
the last time. This is handled by the retirement of the intel_context's
barrier, i.e. by listening to the pulse after the notional unpin. So
wait until the intel_context is finally retired before releasing the
engine, so that we can inspect the final context state and pass it on.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200406155840.1728-3-chris@chris-wilson.co.uk
parent 3b0a0579
...@@ -570,23 +570,19 @@ static void engines_idle_release(struct i915_gem_context *ctx, ...@@ -570,23 +570,19 @@ static void engines_idle_release(struct i915_gem_context *ctx,
engines->ctx = i915_gem_context_get(ctx); engines->ctx = i915_gem_context_get(ctx);
for_each_gem_engine(ce, engines, it) { for_each_gem_engine(ce, engines, it) {
struct dma_fence *fence; int err;
int err = 0;
/* serialises with execbuf */ /* serialises with execbuf */
set_bit(CONTEXT_CLOSED_BIT, &ce->flags); set_bit(CONTEXT_CLOSED_BIT, &ce->flags);
if (!intel_context_pin_if_active(ce)) if (!intel_context_pin_if_active(ce))
continue; continue;
fence = i915_active_fence_get(&ce->timeline->last_request); /* Wait until context is finally scheduled out and retired */
if (fence) { err = i915_sw_fence_await_active(&engines->fence,
err = i915_sw_fence_await_dma_fence(&engines->fence, &ce->active,
fence, 0, I915_ACTIVE_AWAIT_BARRIER);
GFP_KERNEL);
dma_fence_put(fence);
}
intel_context_unpin(ce); intel_context_unpin(ce);
if (err < 0) if (err)
goto kill; goto kill;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment