[Intel-gfx] [PATCH] drm/i915: Fix up the inverse mapping for default ctx->engines[]

Chris Wilson chris at chris-wilson.co.uk
Thu Aug 8 08:41:00 UTC 2019


Quoting Mika Kuoppala (2019-08-08 09:28:38)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > The order in which we store the engines inside default_engines() for the
> > legacy ctx->engines[] has to match the legacy I915_EXEC_RING selector
> > mapping in execbuf::user_map. If we present VCS2 as being the second
> > instance of the video engine, legacy userspace calls that I915_EXEC_BSD2
> > and so we need to insert it into the second video slot.
> >
> > Fixes: 2edda80db3d0 ("drm/i915: Rename engines to match their user interface")
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> > ---
> > Contract the static mapping table.
> > ---
> >  drivers/gpu/drm/i915/gem/i915_gem_context.c |  5 ++-
> >  drivers/gpu/drm/i915/gt/intel_engine_user.c | 49 +++++++++++++++++++++
> >  drivers/gpu/drm/i915/gt/intel_gt_types.h    |  1 +
> >  3 files changed, 53 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > index 1c5bc21a80ff..fae8ca72e240 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > @@ -279,6 +279,7 @@ static void free_engines_rcu(struct rcu_head *rcu)
> >  
> >  static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx)
> >  {
> > +     const struct intel_gt *gt = &ctx->i915->gt;
> >       struct intel_engine_cs *engine;
> >       struct i915_gem_engines *e;
> >       enum intel_engine_id id;
> > @@ -288,7 +289,7 @@ static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx)
> >               return ERR_PTR(-ENOMEM);
> >  
> >       init_rcu_head(&e->rcu);
> > -     for_each_engine(engine, ctx->i915, id) {
> > +     for_each_engine(engine, gt, id) {
> 
> Don't know yet if I love it or hate it.

Oh, i915->engine[] is being phased out. The plan wasn't to do this until
later!

> As I got bruised I started yearning for intel_legacy_engine_id
> with a strong type.

Yes, been bruised by the lack of legacy_id as well.
-Chris


More information about the Intel-gfx mailing list