[Intel-gfx] [PATCH 08/15] drm/i915: Introduce an option for skipping engine context initialization

Zhi Wang zhi.a.wang at intel.com
Sun May 15 17:32:46 UTC 2016


GVT-g will copy guest context into GVT LRC context before using it, so
engine context initialization is not necessary.

This patch introduces an option, and caller could configure it to choose
if the engine context initialization should be skipped.

Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  | 1 +
 drivers/gpu/drm/i915/intel_lrc.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c4c72ee..48f4d6e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -882,6 +882,7 @@ struct intel_context {
 		u64 lrc_desc;
 		uint32_t *lrc_reg_state;
 		bool initialised;
+		bool skip_init_context;
 	} 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 c8fbdfb..08eeaf3 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -2478,6 +2478,13 @@ uint32_t intel_lr_context_size(struct intel_engine_cs *engine)
 	return ret;
 }
 
+static bool engine_initialised(struct intel_context *ctx,
+		struct intel_engine_cs *engine)
+{
+	return engine->init_context == NULL
+		|| ctx->engine[engine->id].skip_init_context;
+}
+
 /**
  * execlists_context_deferred_alloc() - create the LRC specific bits of a context
  * @ctx: LR context to create.
@@ -2527,7 +2534,7 @@ static int execlists_context_deferred_alloc(struct intel_context *ctx,
 
 	ctx->engine[engine->id].ringbuf = ringbuf;
 	ctx->engine[engine->id].state = ctx_obj;
-	ctx->engine[engine->id].initialised = engine->init_context == NULL;
+	ctx->engine[engine->id].initialised = engine_initialised(ctx, engine);
 
 	return 0;
 
-- 
1.9.1



More information about the Intel-gfx mailing list