[igt-dev] [PATCH i-g-t 09/93] lib: Add an intel_ctx wrapper struct and helpers (v5)

Dixit, Ashutosh ashutosh.dixit at intel.com
Fri Jun 11 02:10:32 UTC 2021


On Thu, 10 Jun 2021 09:01:59 -0700, Jason Ekstrand wrote:
>
> > > +static const intel_ctx_t __intel_ctx_0 = {};
> > > +
> > > +/**
> > > + * intel_ctx_0:
> > > + * @fd: open i915 drm file descriptor
> > > + *
> > > + * Returns an intel_ctx_t representing the default context.
> > > + */
> > > +const intel_ctx_t *intel_ctx_0(int fd)
> > > +{
> > > +     (void)fd;
> > > +     return &__intel_ctx_0;
> > > +}
> >
> > OK, so this really is just a "representation" of ctx 0 since num_engines
> > etc. are not what they are for the actual ctx 0 (even with just the legacy
> > engines).
>
> ctx0 is always in legacy mode, hence num_engines == 0.  If num_engines
> > 0 that implies a userspace-specified engine set which ctx0 does not
> have.  I feel like I've typed this explanation a couple times before
> but I'm not sure you were on those e-mails so here it goes again:
>
> With the new engine APIs, a context can have one of two different
> modes with respect to engines:
>
>  1. legacy mode.  This is the default.  In this mode, there is a fixed
> set of engines and they're specified using the I915_EXEC_RENDER,
> I915_EXEC_BLT, and friends flags.  This doesn't work well for new
> hardware with 4 media engines or 8 copy engines or whatever.
>
>  2. Userspace specified engines mode.  This is what you get if you use
> CONTEXT_PARAM_ENGINES to specify an engine set.  In this mode, the
> client specifies whatever set of engines they want as an array of
> class+instance pairs.  When they execbuf, they put an integer index
> (at most 63) in the flags field instead of I915_EXEC_BLT or whatever.
>
> So when you set CONTEXT_PARAM_ENGINES, you're not just changing the
> engine set, you're also changing how those engines are referenced in
> execbuf.  In intel_ctx_t, we make the distinction by num_engines == 0
> means legacy mode and num_engines > 0 means we're using the new
> engines API.
>
> Maybe I should add some of the above to the documentation for
> intel_ctx_cfg_t?  I'll do that.

Thanks for the explanation. Not very familiar with the API, I had
eventually figured out what was happening but only after Zbigniew pointed
me in the right direction and I understand he himself had spoken to you and
Daniel earlier. So some documentation will indeed be helpful to other
people.

Thanks.
--
Ashutosh


More information about the igt-dev mailing list