[igt-dev] [PATCH 2/2] tests/prime_generic: add vendor-agnostic prime tests

Ser, Simon simon.ser at intel.com
Fri Aug 16 10:35:47 UTC 2019


On Fri, 2019-08-16 at 11:13 +0100, Chris Wilson wrote:
> Quoting Ser, Simon (2019-08-16 11:07:56)
> > On Fri, 2019-07-12 at 17:16 +0300, Oleg Vasilev wrote:
> > > +static bool has_prime_import(int fd)
> > > +{
> > > +     uint64_t value;
> > > +
> > > +     if (drmGetCap(fd, DRM_CAP_PRIME, &value))
> > > +             return false;
> > > +
> > > +     return value & DRM_PRIME_CAP_IMPORT;
> > 
> > This returns a non-zero value when import is supported, but doesn't
> > return true. This can lead to strange bugs.
> > 
> > It's common to use !! to convert to a bool.
> 
> But not required when embracing stdbool as it defined in the spec for
> the implicit cast.

Oh, indeed, I didn't know! Thanks for the heads-up.


More information about the igt-dev mailing list