[Intel-gfx] [PATCH 2/7] drm/i915: Create a kernel context for GGTT updates
Andi Shyti
andi.shyti at linux.intel.com
Thu Sep 21 13:18:32 UTC 2023
Hi Nirmoy,
[...]
> > GEM_BUG_ON(!llist_empty(&engine->barrier_tasks));
> > cleanup_status_page(engine);
> > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> > index a7e677598004..a8f527fab0f0 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> > @@ -416,6 +416,9 @@ struct intel_engine_cs {
> > struct llist_head barrier_tasks;
> >
> > struct intel_context *kernel_context; /* pinned */
> > + struct intel_context *bind_context; /* pinned, only for BCS0 */
> > + /* mark the bind context's availability status */
> > + bool bind_context_ready;
>
> So... this is used only once, set to ready and move forward...
> this would never be false, otherwise it means that we failed to
> create the bind_context...
>
> > /**
> > * pinned_contexts_list: List of pinned contexts. This list is only
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> > index 449f0b7fc843..cd0ff1597db9 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> > @@ -1019,3 +1019,21 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt,
> > else
> > return I915_MAP_WC;
> > }
> > +
> > +void intel_gt_bind_context_set_ready(struct intel_gt *gt, bool ready)
> > +{
> > + struct intel_engine_cs *engine = gt->engine[BCS0];
> > +
> > + if (engine && engine->bind_context)
> > + engine->bind_context_ready = ready;
> > +}
> > +
> > +bool intel_gt_is_bind_context_ready(struct intel_gt *gt)
> > +{
> > + struct intel_engine_cs *engine = gt->engine[BCS0];
> > +
> > + if (engine)
> > + return engine->bind_context_ready;
>
> ... can't we just use the bind_context being NULL as a boolean
> meaning and save this extra boolean that will always stay there
> and always hold the same value?
Please ignore this comment. Reading the next patches I see that I
misunderstood this part... there are some toggles ready/not ready
later on.
Andi
More information about the Intel-gfx
mailing list