aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Thierry <michel.thierry@intel.com>2016-02-23 05:31:49 -0500
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-02-26 06:30:17 -0500
commit715629190ef384abde18b07da93066f8aa8b9045 (patch)
treeb8b8684bfa421ecf0b447f122782f5949baed5e5
parent032b612e055ecc52dc67aaf04dace8534d94ac80 (diff)
drm/i915/gen9: Set value of Indirect Context Offset based on gen version
The cache line offset for the Indirect CS context (0x21C8) varies from gen to gen. v2: Move it into a function (Arun), use MISSING_CASE (Chris) v3: Rebased (catched by ci bat) Cc: Arun Siluvery <arun.siluvery@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arun Siluvery <arun.siluvery@linux.intel.com> Signed-off-by: Michel Thierry <michel.thierry@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1456223509-6454-1-git-send-email-michel.thierry@intel.com
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 3a03646e343d..824352a53e6e 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -223,7 +223,8 @@ enum {
223 FAULT_AND_CONTINUE /* Unsupported */ 223 FAULT_AND_CONTINUE /* Unsupported */
224}; 224};
225#define GEN8_CTX_ID_SHIFT 32 225#define GEN8_CTX_ID_SHIFT 32
226#define CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT 0x17 226#define GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT 0x17
227#define GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT 0x26
227 228
228static int intel_lr_context_pin(struct intel_context *ctx, 229static int intel_lr_context_pin(struct intel_context *ctx,
229 struct intel_engine_cs *engine); 230 struct intel_engine_cs *engine);
@@ -2317,6 +2318,27 @@ make_rpcs(struct drm_device *dev)
2317 return rpcs; 2318 return rpcs;
2318} 2319}
2319 2320
2321static u32 intel_lr_indirect_ctx_offset(struct intel_engine_cs *ring)
2322{
2323 u32 indirect_ctx_offset;
2324
2325 switch (INTEL_INFO(ring->dev)->gen) {
2326 default:
2327 MISSING_CASE(INTEL_INFO(ring->dev)->gen);
2328 /* fall through */
2329 case 9:
2330 indirect_ctx_offset =
2331 GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT;
2332 break;
2333 case 8:
2334 indirect_ctx_offset =
2335 GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT;
2336 break;
2337 }
2338
2339 return indirect_ctx_offset;
2340}
2341
2320static int 2342static int
2321populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_obj, 2343populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_obj,
2322 struct intel_engine_cs *ring, struct intel_ringbuffer *ringbuf) 2344 struct intel_engine_cs *ring, struct intel_ringbuffer *ringbuf)
@@ -2389,7 +2411,7 @@ populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_o
2389 (wa_ctx->indirect_ctx.size / CACHELINE_DWORDS); 2411 (wa_ctx->indirect_ctx.size / CACHELINE_DWORDS);
2390 2412
2391 reg_state[CTX_RCS_INDIRECT_CTX_OFFSET+1] = 2413 reg_state[CTX_RCS_INDIRECT_CTX_OFFSET+1] =
2392 CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT << 6; 2414 intel_lr_indirect_ctx_offset(ring) << 6;
2393 2415
2394 reg_state[CTX_BB_PER_CTX_PTR+1] = 2416 reg_state[CTX_BB_PER_CTX_PTR+1] =
2395 (ggtt_offset + wa_ctx->per_ctx.offset * sizeof(uint32_t)) | 2417 (ggtt_offset + wa_ctx->per_ctx.offset * sizeof(uint32_t)) |