Quoting Tvrtko Ursulin (2019-10-17 14:45:31) > From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > 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. > > This next step is to eliminate usage of i915->engines[] from the > for_each_engine_masked iterator. > > For this to work we also need to use engine->id as index when populating > the gt->engine[] array and adjust the default engine set indexing to use > engine->legacy_idx instead of assuming gt->engines[] indexing. > > v2: > * Populate gt->engine[] earlier. > > v3: > * Work around the initialization order issue between default_engines() > and intel_engines_driver_register() which sets engine->legacy_idx for > now. It will be fixed properly later. > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> # v1 > --- > drivers/gpu/drm/i915/gem/i915_gem_context.c | 7 +++++-- > drivers/gpu/drm/i915/gt/intel_engine_cs.c | 4 ++++ > drivers/gpu/drm/i915/gt/intel_engine_user.c | 2 -- > drivers/gpu/drm/i915/gt/intel_gt.c | 2 +- > drivers/gpu/drm/i915/gt/intel_hangcheck.c | 2 +- > drivers/gpu/drm/i915/gt/intel_reset.c | 12 ++++++------ > drivers/gpu/drm/i915/gvt/execlist.c | 4 ++-- > drivers/gpu/drm/i915/gvt/scheduler.c | 2 +- > drivers/gpu/drm/i915/i915_active.c | 4 ++-- > drivers/gpu/drm/i915/i915_drv.h | 6 +++--- > 10 files changed, 25 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c > index 5d8221c7ba83..87d66d8faff1 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c > @@ -203,14 +203,17 @@ static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx) > for_each_engine(engine, gt, id) { > struct intel_context *ce; > > + if (engine->legacy_idx == -1) > + continue; > + > ce = intel_context_create(ctx, engine); > if (IS_ERR(ce)) { > __free_engines(e, id); > return ERR_CAST(ce); > } > > - e->engines[id] = ce; > - e->num_engines = id + 1; > + e->engines[engine->legacy_idx] = ce; > + e->num_engines = engine->legacy_idx + 1; e->num_engines = max(e->num_engines, engine->legacy_idx + 1); and remove id above. Please take the v2.5, throw in the legacy_idx=-1 and remove bits until you are happy :) -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx