[PATCH 46/57] drm/i915: Pass engine to engine->emit_bb_start()

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 5 01:18:44 UTC 2021


Pass the physical engine to the vfuncs as in the future that may not be
directly available from i915_request.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 .../gpu/drm/i915/gem/i915_gem_client_blt.c    |  2 +-
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |  6 +++---
 .../gpu/drm/i915/gem/i915_gem_object_blt.c    |  4 ++--
 .../i915/gem/selftests/i915_gem_client_blt.c  |  9 ++++----
 .../drm/i915/gem/selftests/i915_gem_context.c | 10 ++++++---
 .../drm/i915/gem/selftests/i915_gem_mman.c    |  2 +-
 .../drm/i915/gem/selftests/igt_gem_utils.c    |  9 ++++----
 drivers/gpu/drm/i915/gt/gen2_engine_cs.c      | 13 +++++++-----
 drivers/gpu/drm/i915/gt/gen2_engine_cs.h      |  9 +++++---
 drivers/gpu/drm/i915/gt/gen6_engine_cs.c      |  6 ++++--
 drivers/gpu/drm/i915/gt/gen6_engine_cs.h      |  6 ++++--
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c      |  8 ++++---
 drivers/gpu/drm/i915/gt/gen8_engine_cs.h      |  6 ++++--
 drivers/gpu/drm/i915/gt/intel_engine_types.h  |  3 ++-
 drivers/gpu/drm/i915/gt/intel_renderstate.c   |  4 ++--
 .../gpu/drm/i915/gt/intel_ring_submission.c   |  2 +-
 drivers/gpu/drm/i915/gt/selftest_engine_cs.c  | 20 +++++++++---------
 drivers/gpu/drm/i915/gt/selftest_execlists.c  | 21 ++++++++++---------
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  4 +++-
 drivers/gpu/drm/i915/gt/selftest_rps.c        | 12 +++++------
 .../gpu/drm/i915/gt/selftest_workarounds.c    |  4 ++--
 drivers/gpu/drm/i915/i915_perf.c              | 11 +++++-----
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  2 +-
 drivers/gpu/drm/i915/selftests/i915_perf.c    |  8 +++----
 drivers/gpu/drm/i915/selftests/i915_request.c |  8 ++++---
 drivers/gpu/drm/i915/selftests/igt_spinner.c  |  4 +++-
 26 files changed, 111 insertions(+), 82 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c b/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
index fb457f854ba0..7837ac881d18 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
@@ -218,7 +218,7 @@ static void clear_pages_worker(struct work_struct *work)
 			goto out_request;
 	}
 
-	err = engine->emit_bb_start(rq,
+	err = engine->emit_bb_start(engine, rq,
 				    batch->node.start, batch->node.size,
 				    0);
 out_request:
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index aaf4cfa200fe..efbe1e92a3ab 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1337,7 +1337,7 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,
 	if (err)
 		goto err_request;
 
-	err = eb->engine->emit_bb_start(rq,
+	err = eb->engine->emit_bb_start(eb->engine, rq,
 					batch->node.start, PAGE_SIZE,
 					cache->gen > 5 ? 0 : I915_DISPATCH_SECURE);
 	if (err)
@@ -2553,7 +2553,7 @@ static int eb_submit(struct i915_execbuffer *eb, struct i915_vma *batch)
 			return err;
 	}
 
-	err = eb->engine->emit_bb_start(eb->request,
+	err = eb->engine->emit_bb_start(eb->engine, eb->request,
 					batch->node.start +
 					eb->batch_start_offset,
 					eb->batch_len,
@@ -2563,7 +2563,7 @@ static int eb_submit(struct i915_execbuffer *eb, struct i915_vma *batch)
 
 	if (eb->trampoline) {
 		GEM_BUG_ON(eb->batch_start_offset);
-		err = eb->engine->emit_bb_start(eb->request,
+		err = eb->engine->emit_bb_start(eb->engine, eb->request,
 						eb->trampoline->node.start +
 						eb->batch_len,
 						0, 0);
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c b/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
index a0a68549580e..817956c58cf4 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
@@ -199,7 +199,7 @@ int i915_gem_object_fill_blt(struct drm_i915_gem_object *obj,
 		err = engine->emit_init_breadcrumb(engine, rq);
 
 	if (likely(!err))
-		err = engine->emit_bb_start(rq,
+		err = engine->emit_bb_start(engine, rq,
 					    batch->node.start,
 					    batch->node.size,
 					    0);
@@ -424,7 +424,7 @@ int i915_gem_object_copy_blt(struct drm_i915_gem_object *src,
 			goto out_request;
 	}
 
-	err = engine->emit_bb_start(rq,
+	err = engine->emit_bb_start(engine, rq,
 				    batch->node.start, batch->node.size,
 				    0);
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
index 175581724d44..6b435f722512 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
@@ -453,6 +453,7 @@ tiled_blit(struct tiled_blits *t,
 	   struct blit_buffer *dst, u64 dst_addr,
 	   struct blit_buffer *src, u64 src_addr)
 {
+	struct intel_engine_cs *engine = t->ce->engine;
 	struct i915_request *rq;
 	int err;
 
@@ -490,10 +491,10 @@ tiled_blit(struct tiled_blits *t,
 	if (!err)
 		err = move_to_active(dst->vma, rq, 0);
 	if (!err)
-		err = rq->engine->emit_bb_start(rq,
-						t->batch->node.start,
-						t->batch->node.size,
-						0);
+		err = engine->emit_bb_start(engine, rq,
+					    t->batch->node.start,
+					    t->batch->node.size,
+					    0);
 	i915_request_get(rq);
 	i915_request_add(rq);
 	if (i915_request_wait(rq, 0, HZ / 2) < 0)
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index 14f7fd294674..a046821e5963 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -992,7 +992,7 @@ emit_rpcs_query(struct drm_i915_gem_object *obj,
 			goto skip_request;
 	}
 
-	err = engine->emit_bb_start(rq,
+	err = engine->emit_bb_start(engine, rq,
 				    batch->node.start, batch->node.size,
 				    0);
 	if (err)
@@ -1562,7 +1562,9 @@ static int write_to_scratch(struct i915_gem_context *ctx,
 			goto skip_request;
 	}
 
-	err = engine->emit_bb_start(rq, vma->node.start, vma->node.size, 0);
+	err = engine->emit_bb_start(engine, rq,
+				    vma->node.start, vma->node.size,
+				    0);
 	if (err)
 		goto skip_request;
 
@@ -1700,7 +1702,9 @@ static int read_from_scratch(struct i915_gem_context *ctx,
 			goto skip_request;
 	}
 
-	err = engine->emit_bb_start(rq, vma->node.start, vma->node.size, flags);
+	err = engine->emit_bb_start(engine, rq,
+				    vma->node.start, vma->node.size,
+				    flags);
 	if (err)
 		goto skip_request;
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
index 39293d98f34d..cb4d84c9179a 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
@@ -1145,7 +1145,7 @@ static int __igt_mmap_gpu(struct drm_i915_private *i915,
 		if (err == 0)
 			err = i915_vma_move_to_active(vma, rq, 0);
 
-		err = engine->emit_bb_start(rq, vma->node.start, 0, 0);
+		err = engine->emit_bb_start(engine, rq, vma->node.start, 0, 0);
 		i915_request_get(rq);
 		i915_request_add(rq);
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
index b7e064667d39..f351ff63defb 100644
--- a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
+++ b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
@@ -112,12 +112,13 @@ int igt_gpu_fill_dw(struct intel_context *ce,
 		    struct i915_vma *vma, u64 offset,
 		    unsigned long count, u32 val)
 {
+	struct intel_engine_cs *engine = ce->engine;
 	struct i915_request *rq;
 	struct i915_vma *batch;
 	unsigned int flags;
 	int err;
 
-	GEM_BUG_ON(!intel_engine_can_store_dword(ce->engine));
+	GEM_BUG_ON(!intel_engine_can_store_dword(engine));
 	GEM_BUG_ON(!i915_vma_is_pinned(vma));
 
 	batch = igt_emit_store_dw(vma, offset, count, val);
@@ -152,9 +153,9 @@ int igt_gpu_fill_dw(struct intel_context *ce,
 	if (INTEL_GEN(ce->vm->i915) <= 5)
 		flags |= I915_DISPATCH_SECURE;
 
-	err = rq->engine->emit_bb_start(rq,
-					batch->node.start, batch->node.size,
-					flags);
+	err = engine->emit_bb_start(engine, rq,
+				    batch->node.start, batch->node.size,
+				    flags);
 
 skip_request:
 	if (err)
diff --git a/drivers/gpu/drm/i915/gt/gen2_engine_cs.c b/drivers/gpu/drm/i915/gt/gen2_engine_cs.c
index 7829aff8bfb8..4da0a63c231d 100644
--- a/drivers/gpu/drm/i915/gt/gen2_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/gen2_engine_cs.c
@@ -261,15 +261,16 @@ int gen4_emit_init_breadcrumb_xcs(const struct intel_engine_cs *engine,
 #define I830_BATCH_LIMIT SZ_256K
 #define I830_TLB_ENTRIES (2)
 #define I830_WA_SIZE max(I830_TLB_ENTRIES * SZ_4K, I830_BATCH_LIMIT)
-int i830_emit_bb_start(struct i915_request *rq,
+int i830_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       unsigned int dispatch_flags)
 {
 	u32 *cs, cs_offset =
-		intel_gt_scratch_offset(rq->engine->gt,
+		intel_gt_scratch_offset(engine->gt,
 					INTEL_GT_SCRATCH_FIELD_DEFAULT);
 
-	GEM_BUG_ON(rq->engine->gt->scratch->size < I830_WA_SIZE);
+	GEM_BUG_ON(engine->gt->scratch->size < I830_WA_SIZE);
 
 	cs = intel_ring_begin(rq, 6);
 	if (IS_ERR(cs))
@@ -326,7 +327,8 @@ int i830_emit_bb_start(struct i915_request *rq,
 	return 0;
 }
 
-int gen3_emit_bb_start(struct i915_request *rq,
+int gen3_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       unsigned int dispatch_flags)
 {
@@ -346,7 +348,8 @@ int gen3_emit_bb_start(struct i915_request *rq,
 	return 0;
 }
 
-int gen4_emit_bb_start(struct i915_request *rq,
+int gen4_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 length,
 		       unsigned int dispatch_flags)
 {
diff --git a/drivers/gpu/drm/i915/gt/gen2_engine_cs.h b/drivers/gpu/drm/i915/gt/gen2_engine_cs.h
index a07b163608e2..f22e912ffbe6 100644
--- a/drivers/gpu/drm/i915/gt/gen2_engine_cs.h
+++ b/drivers/gpu/drm/i915/gt/gen2_engine_cs.h
@@ -34,13 +34,16 @@ u32 *gen4_emit_breadcrumb_xcs(const struct intel_engine_cs *engine,
 int gen4_emit_init_breadcrumb_xcs(const struct intel_engine_cs *engine,
 				  struct i915_request *rq);
 
-int i830_emit_bb_start(struct i915_request *rq,
+int i830_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       unsigned int dispatch_flags);
-int gen3_emit_bb_start(struct i915_request *rq,
+int gen3_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       unsigned int dispatch_flags);
-int gen4_emit_bb_start(struct i915_request *rq,
+int gen4_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 length,
 		       unsigned int dispatch_flags);
 
diff --git a/drivers/gpu/drm/i915/gt/gen6_engine_cs.c b/drivers/gpu/drm/i915/gt/gen6_engine_cs.c
index 6d9279af2762..fe06554729f9 100644
--- a/drivers/gpu/drm/i915/gt/gen6_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/gen6_engine_cs.c
@@ -247,7 +247,8 @@ int gen6_emit_flush_vcs(const struct intel_engine_cs *engine,
 	return gen6_flush_dw(rq, mode, MI_INVALIDATE_TLB | MI_INVALIDATE_BSD);
 }
 
-int gen6_emit_bb_start(struct i915_request *rq,
+int gen6_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       unsigned int dispatch_flags)
 {
@@ -269,7 +270,8 @@ int gen6_emit_bb_start(struct i915_request *rq,
 }
 
 int
-hsw_emit_bb_start(struct i915_request *rq,
+hsw_emit_bb_start(const struct intel_engine_cs *engine,
+		  struct i915_request *rq,
 		  u64 offset, u32 len,
 		  unsigned int dispatch_flags)
 {
diff --git a/drivers/gpu/drm/i915/gt/gen6_engine_cs.h b/drivers/gpu/drm/i915/gt/gen6_engine_cs.h
index 9d752f9b7873..b1812bb4ecd8 100644
--- a/drivers/gpu/drm/i915/gt/gen6_engine_cs.h
+++ b/drivers/gpu/drm/i915/gt/gen6_engine_cs.h
@@ -41,10 +41,12 @@ u32 *gen7_emit_breadcrumb_xcs(const struct intel_engine_cs *engine,
 			      struct i915_request *rq,
 			      u32 *cs);
 
-int gen6_emit_bb_start(struct i915_request *rq,
+int gen6_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       unsigned int dispatch_flags);
-int hsw_emit_bb_start(struct i915_request *rq,
+int hsw_emit_bb_start(const struct intel_engine_cs *engine,
+		      struct i915_request *rq,
 		      u64 offset, u32 len,
 		      unsigned int dispatch_flags);
 
diff --git a/drivers/gpu/drm/i915/gt/gen8_engine_cs.c b/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
index 85cdd777f54f..4e8dddc817a5 100644
--- a/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/gen8_engine_cs.c
@@ -393,7 +393,8 @@ int gen8_emit_init_breadcrumb(const struct intel_engine_cs *engine,
 	return 0;
 }
 
-int gen8_emit_bb_start_noarb(struct i915_request *rq,
+int gen8_emit_bb_start_noarb(const struct intel_engine_cs *engine,
+			     struct i915_request *rq,
 			     u64 offset, u32 len,
 			     const unsigned int flags)
 {
@@ -429,14 +430,15 @@ int gen8_emit_bb_start_noarb(struct i915_request *rq,
 	return 0;
 }
 
-int gen8_emit_bb_start(struct i915_request *rq,
+int gen8_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       const unsigned int flags)
 {
 	u32 *cs;
 
 	if (unlikely(i915_request_has_nopreempt(rq)))
-		return gen8_emit_bb_start_noarb(rq, offset, len, flags);
+		return gen8_emit_bb_start_noarb(engine, rq, offset, len, flags);
 
 	cs = intel_ring_begin(rq, 6);
 	if (IS_ERR(cs))
diff --git a/drivers/gpu/drm/i915/gt/gen8_engine_cs.h b/drivers/gpu/drm/i915/gt/gen8_engine_cs.h
index 3225c186e363..c4b57fb0d801 100644
--- a/drivers/gpu/drm/i915/gt/gen8_engine_cs.h
+++ b/drivers/gpu/drm/i915/gt/gen8_engine_cs.h
@@ -36,10 +36,12 @@ int gen12_emit_flush_xcs(const struct intel_engine_cs *engine,
 int gen8_emit_init_breadcrumb(const struct intel_engine_cs *engine,
 			      struct i915_request *rq);
 
-int gen8_emit_bb_start_noarb(struct i915_request *rq,
+int gen8_emit_bb_start_noarb(const struct intel_engine_cs *engine,
+			     struct i915_request *rq,
 			     u64 offset, u32 len,
 			     const unsigned int flags);
-int gen8_emit_bb_start(struct i915_request *rq,
+int gen8_emit_bb_start(const struct intel_engine_cs *engine,
+		       struct i915_request *rq,
 		       u64 offset, u32 len,
 		       const unsigned int flags);
 
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h
index 8bc0881989f8..b2865d4cd76c 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
@@ -394,7 +394,8 @@ struct intel_engine_cs {
 #define EMIT_FLUSH	BIT(1)
 #define EMIT_BARRIER	(EMIT_INVALIDATE | EMIT_FLUSH)
 
-	int		(*emit_bb_start)(struct i915_request *rq,
+	int		(*emit_bb_start)(const struct intel_engine_cs *engine,
+					 struct i915_request *rq,
 					 u64 offset, u32 length,
 					 unsigned int dispatch_flags);
 #define I915_DISPATCH_SECURE BIT(0)
diff --git a/drivers/gpu/drm/i915/gt/intel_renderstate.c b/drivers/gpu/drm/i915/gt/intel_renderstate.c
index 0f7c0a148b80..6b98f73fa48e 100644
--- a/drivers/gpu/drm/i915/gt/intel_renderstate.c
+++ b/drivers/gpu/drm/i915/gt/intel_renderstate.c
@@ -219,14 +219,14 @@ int intel_renderstate_emit(struct intel_renderstate *so,
 	if (err)
 		return err;
 
-	err = engine->emit_bb_start(rq,
+	err = engine->emit_bb_start(engine, rq,
 				    so->batch_offset, so->batch_size,
 				    I915_DISPATCH_SECURE);
 	if (err)
 		return err;
 
 	if (so->aux_size > 8) {
-		err = engine->emit_bb_start(rq,
+		err = engine->emit_bb_start(engine, rq,
 					    so->aux_offset, so->aux_size,
 					    I915_DISPATCH_SECURE);
 		if (err)
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
index 8102413f5b9f..c56870132855 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
@@ -796,7 +796,7 @@ clear_residuals(struct intel_engine_cs *engine, struct i915_request *rq)
 			return ret;
 	}
 
-	ret = engine->emit_bb_start(rq,
+	ret = engine->emit_bb_start(engine, rq,
 				    engine->wa_ctx.vma->node.start, 0,
 				    0);
 	if (ret)
diff --git a/drivers/gpu/drm/i915/gt/selftest_engine_cs.c b/drivers/gpu/drm/i915/gt/selftest_engine_cs.c
index e33ec4e3b35d..c7f912140f2f 100644
--- a/drivers/gpu/drm/i915/gt/selftest_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/selftest_engine_cs.c
@@ -161,9 +161,9 @@ static int perf_mi_bb_start(void *arg)
 			if (err)
 				goto out;
 
-			err = rq->engine->emit_bb_start(rq,
-							batch->node.start, 8,
-							0);
+			err = engine->emit_bb_start(engine, rq,
+						    batch->node.start, 8,
+						    0);
 			if (err)
 				goto out;
 
@@ -301,9 +301,9 @@ static int perf_mi_noop(void *arg)
 			if (err)
 				goto out;
 
-			err = rq->engine->emit_bb_start(rq,
-							base->node.start, 8,
-							0);
+			err = engine->emit_bb_start(engine, rq,
+						    base->node.start, 8,
+						    0);
 			if (err)
 				goto out;
 
@@ -311,10 +311,10 @@ static int perf_mi_noop(void *arg)
 			if (err)
 				goto out;
 
-			err = rq->engine->emit_bb_start(rq,
-							nop->node.start,
-							nop->node.size,
-							0);
+			err = engine->emit_bb_start(engine, rq,
+						    nop->node.start,
+						    nop->node.size,
+						    0);
 			if (err)
 				goto out;
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_execlists.c b/drivers/gpu/drm/i915/gt/selftest_execlists.c
index afbf8dc039cf..958087d46c77 100644
--- a/drivers/gpu/drm/i915/gt/selftest_execlists.c
+++ b/drivers/gpu/drm/i915/gt/selftest_execlists.c
@@ -2741,9 +2741,9 @@ static int create_gang(struct intel_engine_cs *engine,
 	if (!err)
 		err = i915_vma_move_to_active(vma, rq, 0);
 	if (!err)
-		err = rq->engine->emit_bb_start(rq,
-						vma->node.start,
-						PAGE_SIZE, 0);
+		err = engine->emit_bb_start(engine, rq,
+					    vma->node.start,
+					    PAGE_SIZE, 0);
 	i915_vma_unlock(vma);
 	i915_request_add(rq);
 	if (err)
@@ -3165,9 +3165,9 @@ create_gpr_client(struct intel_engine_cs *engine,
 	if (!err)
 		err = i915_vma_move_to_active(batch, rq, 0);
 	if (!err)
-		err = rq->engine->emit_bb_start(rq,
-						batch->node.start,
-						PAGE_SIZE, 0);
+		err = engine->emit_bb_start(engine, rq,
+					    batch->node.start,
+					    PAGE_SIZE, 0);
 	i915_vma_unlock(batch);
 	i915_vma_unpin(batch);
 
@@ -3463,6 +3463,7 @@ static int smoke_submit(struct preempt_smoke *smoke,
 			struct i915_gem_context *ctx, int prio,
 			struct drm_i915_gem_object *batch)
 {
+	struct intel_engine_cs *engine = smoke->engine;
 	struct i915_request *rq;
 	struct i915_vma *vma = NULL;
 	int err = 0;
@@ -3483,7 +3484,7 @@ static int smoke_submit(struct preempt_smoke *smoke,
 
 	ctx->sched.priority = prio;
 
-	rq = igt_request_alloc(ctx, smoke->engine);
+	rq = igt_request_alloc(ctx, engine);
 	if (IS_ERR(rq)) {
 		err = PTR_ERR(rq);
 		goto unpin;
@@ -3495,9 +3496,9 @@ static int smoke_submit(struct preempt_smoke *smoke,
 		if (!err)
 			err = i915_vma_move_to_active(vma, rq, 0);
 		if (!err)
-			err = rq->engine->emit_bb_start(rq,
-							vma->node.start,
-							PAGE_SIZE, 0);
+			err = engine->emit_bb_start(engine, rq,
+						    vma->node.start,
+						    PAGE_SIZE, 0);
 		i915_vma_unlock(vma);
 	}
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
index ea05892a4d94..3050fa68e188 100644
--- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
+++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
@@ -246,7 +246,9 @@ hang_create_request(struct hang *h, struct intel_engine_cs *engine)
 	if (INTEL_GEN(gt->i915) <= 5)
 		flags |= I915_DISPATCH_SECURE;
 
-	err = engine->emit_bb_start(rq, vma->node.start, PAGE_SIZE, flags);
+	err = engine->emit_bb_start(engine, rq,
+				    vma->node.start, PAGE_SIZE,
+				    flags);
 
 cancel_rq:
 	if (err) {
diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c
index 967641fee42a..faefe1c5d1f1 100644
--- a/drivers/gpu/drm/i915/gt/selftest_rps.c
+++ b/drivers/gpu/drm/i915/gt/selftest_rps.c
@@ -654,9 +654,9 @@ int live_rps_frequency_cs(void *arg)
 		if (!err)
 			err = i915_vma_move_to_active(vma, rq, 0);
 		if (!err)
-			err = rq->engine->emit_bb_start(rq,
-							vma->node.start,
-							PAGE_SIZE, 0);
+			err = engine->emit_bb_start(engine, rq,
+						    vma->node.start,
+						    PAGE_SIZE, 0);
 		i915_request_add(rq);
 		if (err)
 			goto err_vma;
@@ -795,9 +795,9 @@ int live_rps_frequency_srm(void *arg)
 		if (!err)
 			err = i915_vma_move_to_active(vma, rq, 0);
 		if (!err)
-			err = rq->engine->emit_bb_start(rq,
-							vma->node.start,
-							PAGE_SIZE, 0);
+			err = engine->emit_bb_start(engine, rq,
+						    vma->node.start,
+						    PAGE_SIZE, 0);
 		i915_request_add(rq);
 		if (err)
 			goto err_vma;
diff --git a/drivers/gpu/drm/i915/gt/selftest_workarounds.c b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
index 6f09716ce75c..98dd6fa56fcd 100644
--- a/drivers/gpu/drm/i915/gt/selftest_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
@@ -583,7 +583,7 @@ static int check_dirty_whitelist(struct intel_context *ce)
 		if (err)
 			goto err_request;
 
-		err = engine->emit_bb_start(rq,
+		err = engine->emit_bb_start(engine, rq,
 					    batch->node.start, PAGE_SIZE,
 					    0);
 		if (err)
@@ -865,7 +865,7 @@ static int scrub_whitelisted_registers(struct intel_context *ce)
 		goto err_request;
 
 	/* Perform the writes from an unprivileged "user" batch */
-	err = engine->emit_bb_start(rq, batch->node.start, 0, 0);
+	err = engine->emit_bb_start(engine, rq, batch->node.start, 0, 0);
 
 err_request:
 	err = request_add_sync(rq, err);
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 89665e14ab01..61bc95236964 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -1947,6 +1947,7 @@ emit_oa_config(struct i915_perf_stream *stream,
 	       struct intel_context *ce,
 	       struct i915_active *active)
 {
+	struct intel_engine_cs *engine = ce->engine;
 	struct i915_request *rq;
 	struct i915_vma *vma;
 	struct i915_gem_ww_ctx ww;
@@ -1966,9 +1967,9 @@ emit_oa_config(struct i915_perf_stream *stream,
 	if (err)
 		goto err;
 
-	intel_engine_pm_get(ce->engine);
+	intel_engine_pm_get(engine);
 	rq = i915_request_create(ce);
-	intel_engine_pm_put(ce->engine);
+	intel_engine_pm_put(engine);
 	if (IS_ERR(rq)) {
 		err = PTR_ERR(rq);
 		goto err_vma_unpin;
@@ -1992,9 +1993,9 @@ emit_oa_config(struct i915_perf_stream *stream,
 	if (err)
 		goto err_add_request;
 
-	err = rq->engine->emit_bb_start(rq,
-					vma->node.start, 0,
-					I915_DISPATCH_SECURE);
+	err = engine->emit_bb_start(engine, rq,
+				    vma->node.start, 0,
+				    I915_DISPATCH_SECURE);
 	if (err)
 		goto err_add_request;
 
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 401ee975bbe2..6b986ae888d2 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1765,7 +1765,7 @@ submit_batch(struct intel_context *ce, u64 addr)
 	if (engine->emit_init_breadcrumb) /* detect a hang */
 		err = engine->emit_init_breadcrumb(engine, rq);
 	if (err == 0)
-		err = engine->emit_bb_start(rq, addr, 0, 0);
+		err = engine->emit_bb_start(engine, rq, addr, 0, 0);
 
 	if (err == 0)
 		i915_request_get(rq);
diff --git a/drivers/gpu/drm/i915/selftests/i915_perf.c b/drivers/gpu/drm/i915/selftests/i915_perf.c
index 56bb7db79c23..c5f45afb9614 100644
--- a/drivers/gpu/drm/i915/selftests/i915_perf.c
+++ b/drivers/gpu/drm/i915/selftests/i915_perf.c
@@ -235,9 +235,9 @@ static int live_noa_delay(void *arg)
 		goto out;
 	}
 
-	err = rq->engine->emit_bb_start(rq,
-					i915_ggtt_offset(stream->noa_wait), 0,
-					I915_DISPATCH_SECURE);
+	err = stream->engine->emit_bb_start(stream->engine, rq,
+					    i915_ggtt_offset(stream->noa_wait), 0,
+					    I915_DISPATCH_SECURE);
 	if (err) {
 		i915_request_add(rq);
 		goto out;
@@ -342,7 +342,7 @@ static int live_noa_gpr(void *arg)
 	intel_ring_advance(rq, cs);
 
 	/* Execute the GPU delay */
-	err = stream->engine->emit_bb_start(rq,
+	err = stream->engine->emit_bb_start(stream->engine, rq,
 					    i915_ggtt_offset(stream->noa_wait), 0,
 					    I915_DISPATCH_SECURE);
 	if (err) {
diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index c5d7427bd429..5d747c2d937b 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -667,7 +667,7 @@ empty_request(struct intel_engine_cs *engine,
 	if (IS_ERR(request))
 		return request;
 
-	err = engine->emit_bb_start(request,
+	err = engine->emit_bb_start(engine, request,
 				    batch->node.start,
 				    batch->node.size,
 				    I915_DISPATCH_SECURE);
@@ -879,7 +879,8 @@ static int live_all_engines(void *arg)
 			err = i915_vma_move_to_active(batch, request[idx], 0);
 		GEM_BUG_ON(err);
 
-		err = engine->emit_bb_start(request[idx],
+		err = engine->emit_bb_start(engine,
+					    request[idx],
 					    batch->node.start,
 					    batch->node.size,
 					    0);
@@ -1009,7 +1010,8 @@ static int live_sequential_engines(void *arg)
 			err = i915_vma_move_to_active(batch, request[idx], 0);
 		GEM_BUG_ON(err);
 
-		err = engine->emit_bb_start(request[idx],
+		err = engine->emit_bb_start(engine,
+					    request[idx],
 					    batch->node.start,
 					    batch->node.size,
 					    0);
diff --git a/drivers/gpu/drm/i915/selftests/igt_spinner.c b/drivers/gpu/drm/i915/selftests/igt_spinner.c
index 7e148e3975cc..5d83079bedd2 100644
--- a/drivers/gpu/drm/i915/selftests/igt_spinner.c
+++ b/drivers/gpu/drm/i915/selftests/igt_spinner.c
@@ -179,7 +179,9 @@ igt_spinner_create_request(struct igt_spinner *spin,
 	flags = 0;
 	if (INTEL_GEN(engine->i915) <= 5)
 		flags |= I915_DISPATCH_SECURE;
-	err = engine->emit_bb_start(rq, vma->node.start, PAGE_SIZE, flags);
+	err = engine->emit_bb_start(engine, rq,
+				    vma->node.start, PAGE_SIZE,
+				    flags);
 
 cancel_rq:
 	if (err) {
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list