Re: [PATCH i-g-t v2] tests/i915/gem_ctx_switch: Update with engine discovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Andi Shyti (2019-06-27 21:15:30)
> > +bool gem_context_has_engine_map(int fd, uint32_t ctx)
> > +{
> > +     struct drm_i915_gem_context_param param = {
> > +             .param = I915_CONTEXT_PARAM_ENGINES,
> > +             .ctx_id = ctx
> > +     };
> > +     int ret;
> > +
> > +     ret = __gem_context_get_param(fd, &param);
> > +     igt_assert_eq(ret, 0);
> > +
> > +     return param.size;
> 
> a small nitpick: bool to me means '0' or '1'.
> 
> So, if you do 'return param.size', I would call the function
> gem_context_get_param_size, otherwise I would return
> '!!param.size' and keep it bool.

An integer in boolean context is 0 or 1, the !! is implicit. We use that
quite frequently, e.g. bool has_ptr(void **x) { return *x; }
 
> (We are also somehow abusing on the size definition of bool in
> C99/C17 or previous.)

I hope we never assume the size or alignment of bool. I always hope the
compiler will just reduce it to the control flags for inline predicates.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux