[Intel-gfx] [PATCH 2/3] drm/i915: Store engine mask in intel_gt

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 16 13:03:34 UTC 2019


Quoting Tvrtko Ursulin (2019-10-16 13:28:42)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Medium term goal is to eliminate the i915->engine[] array and to get there
> we have recently introduced equivalent array in intel_gt. Now we need to
> migrate the code further towards this state.
> 
> To allow for_each_engine_masked call sites to pass in gt instead of i915
> we need to have a copy of INTEL_INFO()->engine_mask in intel_gt.
> 
> For this to work we also need to use engine->id as index when populating
> the gt->engine[] array.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/intel_engine_user.c | 4 ++--
>  drivers/gpu/drm/i915/gt/intel_gt.c          | 5 +++++
>  drivers/gpu/drm/i915/gt/intel_gt.h          | 1 +
>  drivers/gpu/drm/i915/gt/intel_gt_types.h    | 4 ++++
>  drivers/gpu/drm/i915/i915_drv.c             | 2 ++
>  5 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> index 77cd5de83930..099abae860ec 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
> @@ -183,8 +183,8 @@ static void add_legacy_ring(struct legacy_ring *ring,
>         if (unlikely(idx == -1))
>                 return;
>  
> -       GEM_BUG_ON(idx >= ARRAY_SIZE(ring->gt->engine));
> -       ring->gt->engine[idx] = engine;

This is used for the legacy uapi mapping. So we need to adjust the loop
in i915_gem_context.c::default_engines() to use engine->legacy_idx
instead of id. And all other users of engine->legacy_idx are now
backwards.
-Chris


More information about the Intel-gfx mailing list