[Intel-gfx] [PATCH 6/9] drm/i915: Move context initialisation to first-use

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 19 10:55:00 UTC 2016


On Tue, Apr 19, 2016 at 11:15:31AM +0100, Tvrtko Ursulin wrote:
> 
> On 19/04/16 07:49, Chris Wilson wrote:
> >Instead of allocating a new request when allocating a context, use the
> >request that initiated the allocation to emit the context
> >initialisation.
> >
> >Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> >---
> >  drivers/gpu/drm/i915/i915_drv.h  |  1 +
> >  drivers/gpu/drm/i915/intel_lrc.c | 39 ++++++++++++++++++---------------------
> >  2 files changed, 19 insertions(+), 21 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >index 77becfd5a09d..b65e3b16e1b0 100644
> >--- a/drivers/gpu/drm/i915/i915_drv.h
> >+++ b/drivers/gpu/drm/i915/i915_drv.h
> >@@ -870,6 +870,7 @@ struct intel_context {
> >  		struct i915_vma *lrc_vma;
> >  		u64 lrc_desc;
> >  		uint32_t *lrc_reg_state;
> >+		bool initialised;
> >  	} engine[I915_NUM_ENGINES];
> >
> >  	struct list_head link;
> >diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> >index 79ac6f06a502..c104015813d3 100644
> >--- a/drivers/gpu/drm/i915/intel_lrc.c
> >+++ b/drivers/gpu/drm/i915/intel_lrc.c
> >@@ -669,9 +669,10 @@ static int execlists_move_to_gpu(struct drm_i915_gem_request *req,
> >
> >  int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request)
> >  {
> >-	int ret = 0;
> >+	struct intel_engine_cs *engine = request->engine;
> >+	int ret;
> >
> >-	request->ringbuf = request->ctx->engine[request->engine->id].ringbuf;
> >+	request->ringbuf = request->ctx->engine[engine->id].ringbuf;
> >
> >  	if (i915.enable_guc_submission) {
> >  		/*
> >@@ -686,7 +687,20 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
> >  			return ret;
> >  	}
> >
> >-	return intel_lr_context_pin(request->ctx, request->engine);
> >+	ret = intel_lr_context_pin(request->ctx, engine);
> >+	if (ret)
> >+		return ret;
> >+
> >+	if (!request->ctx->engine[engine->id].initialised) {
> >+		ret = engine->init_context(request);
> 
> Actually, change here is that previously this wasn't done for the
> kernel context. Needs to be explained why we either want that, or
> why it is fine.

We never execute the kernel context with execlists. It really is just a
gigantic placeholder for the HWS (and golden context state for GuC).

If we had, we would have noticed that we don't set the wa registers for
it. Hopefully, we would have noticed!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list