diff mbox series

drm/i915: Use uabi engines for the default engine map

Message ID 20230123152523.1537564-1-jonathan.cavitt@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Use uabi engines for the default engine map | expand

Commit Message

Cavitt, Jonathan Jan. 23, 2023, 3:25 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Default engine map is exactly about uabi engines so no excuse not to use
the appropriate iterator to populate it.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Cavitt, Jonathan Jan. 23, 2023, 8:27 p.m. UTC | #1
-----Original Message-----
From: Cavitt, Jonathan <jonathan.cavitt@intel.com> 
Sent: Monday, January 23, 2023 7:25 AM
To: intel-gfx@lists.freedesktop.org
Cc: Cavitt, Jonathan <jonathan.cavitt@intel.com>; Dutt, Sudeep <sudeep.dutt@intel.com>
Subject: [PATCH] drm/i915: Use uabi engines for the default engine map
> 
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Default engine map is exactly about uabi engines so no excuse not to use
> the appropriate iterator to populate it.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>

Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
-Jonathan Cavitt

> ---
>  drivers/gpu/drm/i915/gem/i915_gem_context.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index 454e73a433c8..42a39e103d7c 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -1096,16 +1096,15 @@ static struct i915_gem_engines *alloc_engines(unsigned int count)
>  static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx,
>  						struct intel_sseu rcs_sseu)
>  {
> -	const struct intel_gt *gt = to_gt(ctx->i915);
> +	const unsigned int max = I915_NUM_ENGINES;
>  	struct intel_engine_cs *engine;
>  	struct i915_gem_engines *e, *err;
> -	enum intel_engine_id id;
>  
> -	e = alloc_engines(I915_NUM_ENGINES);
> +	e = alloc_engines(max);
>  	if (!e)
>  		return ERR_PTR(-ENOMEM);
>  
> -	for_each_engine(engine, gt, id) {
> +	for_each_uabi_engine(engine, ctx->i915) {
>  		struct intel_context *ce;
>  		struct intel_sseu sseu = {};
>  		int ret;
> @@ -1113,7 +1112,7 @@ static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx,
>  		if (engine->legacy_idx == INVALID_ENGINE)
>  			continue;
>  
> -		GEM_BUG_ON(engine->legacy_idx >= I915_NUM_ENGINES);
> +		GEM_BUG_ON(engine->legacy_idx >= max);
>  		GEM_BUG_ON(e->engines[engine->legacy_idx]);
>  
>  		ce = intel_context_create(engine);
> -- 
> 2.25.1
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 454e73a433c8..42a39e103d7c 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -1096,16 +1096,15 @@  static struct i915_gem_engines *alloc_engines(unsigned int count)
 static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx,
 						struct intel_sseu rcs_sseu)
 {
-	const struct intel_gt *gt = to_gt(ctx->i915);
+	const unsigned int max = I915_NUM_ENGINES;
 	struct intel_engine_cs *engine;
 	struct i915_gem_engines *e, *err;
-	enum intel_engine_id id;
 
-	e = alloc_engines(I915_NUM_ENGINES);
+	e = alloc_engines(max);
 	if (!e)
 		return ERR_PTR(-ENOMEM);
 
-	for_each_engine(engine, gt, id) {
+	for_each_uabi_engine(engine, ctx->i915) {
 		struct intel_context *ce;
 		struct intel_sseu sseu = {};
 		int ret;
@@ -1113,7 +1112,7 @@  static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx,
 		if (engine->legacy_idx == INVALID_ENGINE)
 			continue;
 
-		GEM_BUG_ON(engine->legacy_idx >= I915_NUM_ENGINES);
+		GEM_BUG_ON(engine->legacy_idx >= max);
 		GEM_BUG_ON(e->engines[engine->legacy_idx]);
 
 		ce = intel_context_create(engine);