Commit 9c01524d authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Daniel Vetter

drm/i915: Populate logical context during first pin.

This allows us to remove pin_map from state allocation, which saves
us a few retry loops. We won't need this until first pin, anyway.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
[danvet: Resolve context conflict because we don't have the
i915_scheduler.c extraction from the below patches set:
https://lore.kernel.org/intel-gfx/20210203165259.13087-6-chris@chris-wilson.co.uk/]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210323155059.628690-19-maarten.lankhorst@linux.intel.com
parent abd2f577
...@@ -2457,11 +2457,31 @@ static void execlists_submit_request(struct i915_request *request) ...@@ -2457,11 +2457,31 @@ static void execlists_submit_request(struct i915_request *request)
spin_unlock_irqrestore(&engine->active.lock, flags); spin_unlock_irqrestore(&engine->active.lock, flags);
} }
static int
__execlists_context_pre_pin(struct intel_context *ce,
struct intel_engine_cs *engine,
struct i915_gem_ww_ctx *ww, void **vaddr)
{
int err;
err = lrc_pre_pin(ce, engine, ww, vaddr);
if (err)
return err;
if (!__test_and_set_bit(CONTEXT_INIT_BIT, &ce->flags)) {
lrc_init_state(ce, engine, *vaddr);
__i915_gem_object_flush_map(ce->state->obj, 0, engine->context_size);
}
return 0;
}
static int execlists_context_pre_pin(struct intel_context *ce, static int execlists_context_pre_pin(struct intel_context *ce,
struct i915_gem_ww_ctx *ww, struct i915_gem_ww_ctx *ww,
void **vaddr) void **vaddr)
{ {
return lrc_pre_pin(ce, ce->engine, ww, vaddr); return __execlists_context_pre_pin(ce, ce->engine, ww, vaddr);
} }
static int execlists_context_pin(struct intel_context *ce, void *vaddr) static int execlists_context_pin(struct intel_context *ce, void *vaddr)
...@@ -3365,8 +3385,8 @@ static int virtual_context_pre_pin(struct intel_context *ce, ...@@ -3365,8 +3385,8 @@ static int virtual_context_pre_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);
/* Note: we must use a real engine class for setting up reg state */ /* Note: we must use a real engine class for setting up reg state */
return lrc_pre_pin(ce, ve->siblings[0], ww, vaddr); return __execlists_context_pre_pin(ce, ve->siblings[0], ww, vaddr);
} }
static int virtual_context_pin(struct intel_context *ce, void *vaddr) static int virtual_context_pin(struct intel_context *ce, void *vaddr)
......
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