[Intel-gfx] [PATCH igt 1/2] lib/gt: Mark up engine classes

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 15 14:37:47 UTC 2017


Quoting Tvrtko Ursulin (2017-11-15 14:29:41)
> 
> On 15/11/2017 13:32, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2017-11-15 13:26:09)
> >>
> >> On 14/11/2017 13:19, Chris Wilson wrote:
> >>> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
> >>> index 2579cbd3..4f13f86f 100644
> >>> --- a/lib/igt_gt.h
> >>> +++ b/lib/igt_gt.h
> >>> @@ -63,10 +63,17 @@ void igt_clflush_range(void *addr, int size);
> >>>    
> >>>    unsigned intel_detect_and_clear_missed_interrupts(int fd);
> >>>    
> >>> +#define LOCAL_ENGINE_CLASS_INVALID           -1
> >>> +#define LOCAL_ENGINE_CLASS_RENDER            0
> >>> +#define LOCAL_ENGINE_CLASS_COPY                      1
> >>> +#define LOCAL_ENGINE_CLASS_VIDEO             2
> >>> +#define LOCAL_ENGINE_CLASS_VIDEO_ENHANCE     3
> >>
> >> Why not make a local copy of the enum to be consistent with the kernel
> >> uPAI headers?
> > 
> > Shrug. It has to be temporary. #define have the advantage that the
> > compiler only complains when they differ, which was why I suggesting we
> > didn't use enum ;)
> 
> enum would have to be temporary and these ones can be left in "forever" 
> you mean? I actually have no idea at the moment on how the enum 
> namespace is handled in C. But anyway, none of this matters hugely.

No, I mean whatever we write today, we have to convert to the canonical
form when we have i915_drm.h. Just enum's make me more uneasy than
defines (esp. with a C++ compiler). I actually quite like that if we
locally #define I915_ENGINE_CLASS_RENDER A then we get an error if we
import a kernel header #defining to B, but LOCAL stands out and is easy
to grep.
-Chris



More information about the Intel-gfx mailing list