Re: [CI 18/25] drm/i915: Replace the pinned context address with its unique ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/04/16 09:56, Chris Wilson wrote:
Rather than reuse the current location of the context in the global GTT
for its hardware identifier, use the context's unique ID assigned to it
for its whole lifetime.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
  drivers/gpu/drm/i915/i915_debugfs.c | 12 +++++-------
  drivers/gpu/drm/i915/intel_lrc.c    | 39 +++++++++----------------------------
  drivers/gpu/drm/i915/intel_lrc.h    |  3 ---
  3 files changed, 14 insertions(+), 40 deletions(-)

[snip]

@@ -315,14 +316,14 @@ static void
  intel_lr_context_descriptor_update(struct intel_context *ctx,
  				   struct intel_engine_cs *engine)
  {
-	uint64_t lrca, desc;
+	u64 desc;

-	lrca = ctx->engine[engine->id].lrc_vma->node.start +
-	       LRC_PPHWSP_PN * PAGE_SIZE;
+	BUILD_BUG_ON(MAX_CONTEXT_HW_ID > (1<<GEN8_CTX_ID_WIDTH));

-	desc = engine->ctx_desc_template;		   /* bits  0-11 */
-	desc |= lrca;					   /* bits 12-31 */
-	desc |= (lrca >> PAGE_SHIFT) << GEN8_CTX_ID_SHIFT; /* bits 32-52 */
+	desc = engine->ctx_desc_template;			/* bits  0-11 */
+	desc |= ctx->engine[engine->id].lrc_vma->node.start +	/* bits 12-31 */
+	       LRC_PPHWSP_PN * PAGE_SIZE;
+	desc |= (u64)ctx->hw_id << GEN8_CTX_ID_SHIFT;		/* bits 32-52 */

I'd prefer to see the LRCA mentioned and explicitly computed in a local variable first, rather than hide the calculation in the middle of assembling the descriptor! In other words, as it was before -- the only line of this function that needed changing was the last one above.

.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux