[igt-dev] [PATCH i-g-t v6 05/15] lib/drmtest: Add driver enum for i915/xe

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Apr 26 09:51:59 UTC 2023


On Wed, Apr 26, 2023 at 10:23:00AM +0200, Manszewski, Christoph wrote:
> Hi Zbigniew,
> 
> On 25.04.2023 17:40, Zbigniew Kempczyński wrote:
> > Library code like intel-bb and intel-buf which requires adoption
> > to handle both drivers should store driver on which fd they are
> > working on instead of calling costful is_i915/xe_device() helper.
> > 
> > Introduce intel_driver enum which will be used on library code
> > adoption to Xe.
> 
> Agree - this is a better place than intel_batchbuffer.
> 
> But then the question arises - how does this relate to the 'DRIVER_INTEL'
> and 'DRIVER_XE' value above? Looks like we could use those values instead.

Above values are not related to enum I introduced. I wanted to have enum
as compiler may check you're using valid values (like in switch() for ex.).

--
Zbigniew


> 
> Christoph
> 
> 
> > 
> > Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> > ---
> >   lib/drmtest.h | 8 ++++++++
> >   1 file changed, 8 insertions(+)
> > 
> > diff --git a/lib/drmtest.h b/lib/drmtest.h
> > index 5878f65129..3c88b85c6f 100644
> > --- a/lib/drmtest.h
> > +++ b/lib/drmtest.h
> > @@ -62,6 +62,14 @@
> >    */
> >   #define DRIVER_ANY 	~(DRIVER_VGEM)
> > +/*
> > + * Compile friendly enum for i915/xe.
> > + */
> > +enum intel_driver {
> > +	INTEL_DRIVER_I915 = 1,
> > +	INTEL_DRIVER_XE,
> > +};
> > +
> >   void __set_forced_driver(const char *name);
> >   /**


More information about the igt-dev mailing list