Commit d5e19353 authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Teach veng to defer the context allocation

Since we added the context_alloc callback to intel_context_ops, we can
safely install a custom hook for the deferred virtual context allocation.
This means that all new contexts behave the same upon creation,
simplifying later code.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191219232932.189197-1-chris@chris-wilson.co.uk
parent 7d1ff0d9
...@@ -4240,6 +4240,13 @@ static void virtual_engine_initial_hint(struct virtual_engine *ve) ...@@ -4240,6 +4240,13 @@ static void virtual_engine_initial_hint(struct virtual_engine *ve)
ve->siblings[0]); ve->siblings[0]);
} }
static int virtual_context_alloc(struct intel_context *ce)
{
struct virtual_engine *ve = container_of(ce, typeof(*ve), context);
return __execlists_context_alloc(ce, ve->siblings[0]);
}
static int virtual_context_pin(struct intel_context *ce) static int virtual_context_pin(struct intel_context *ce)
{ {
struct virtual_engine *ve = container_of(ce, typeof(*ve), context); struct virtual_engine *ve = container_of(ce, typeof(*ve), context);
...@@ -4277,6 +4284,8 @@ static void virtual_context_exit(struct intel_context *ce) ...@@ -4277,6 +4284,8 @@ static void virtual_context_exit(struct intel_context *ce)
} }
static const struct intel_context_ops virtual_context_ops = { static const struct intel_context_ops virtual_context_ops = {
.alloc = virtual_context_alloc,
.pin = virtual_context_pin, .pin = virtual_context_pin,
.unpin = execlists_context_unpin, .unpin = execlists_context_unpin,
...@@ -4593,12 +4602,6 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx, ...@@ -4593,12 +4602,6 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx,
ve->base.flags |= I915_ENGINE_IS_VIRTUAL; ve->base.flags |= I915_ENGINE_IS_VIRTUAL;
err = __execlists_context_alloc(&ve->context, siblings[0]);
if (err)
goto err_put;
__set_bit(CONTEXT_ALLOC_BIT, &ve->context.flags);
return &ve->context; return &ve->context;
err_put: err_put:
......
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