[igt-dev] [PATCH 2/2] tests/prime_generic: add vendor-agnostic prime tests
Chris Wilson
chris at chris-wilson.co.uk
Fri Aug 16 10:13:16 UTC 2019
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.
-Chris
More information about the igt-dev
mailing list