From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF5036E0CF for ; Fri, 11 Jun 2021 02:16:15 +0000 (UTC) Date: Thu, 10 Jun 2021 19:10:32 -0700 Message-ID: <87y2bhm9rb.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: References: <20210609173632.248880-1-jason@jlekstrand.net> <20210609173632.248880-10-jason@jlekstrand.net> <877dj2nvzj.wl-ashutosh.dixit@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [igt-dev] [PATCH i-g-t 09/93] lib: Add an intel_ctx wrapper struct and helpers (v5) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Jason Ekstrand Cc: IGT GPU Tools List-ID: 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 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev