lib: Magic for_each_engine() macro to iterate over available engines

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2016-03-04 10:19:38 +00:00
parent 60eafc5489
commit 697c3f5550
2 changed files with 13 additions and 4 deletions
+9
View File
@@ -100,4 +100,13 @@ extern const struct intel_execution_engine {
unsigned flags;
} intel_execution_engines[];
#define for_if(expr__) if (!(expr__)) {} else
#define for_each_engine(fd__, flags__) \
for (const struct intel_execution_engine *e__ = intel_execution_engines;\
e__->name; \
e__++) \
for_if (gem_has_ring(fd, flags__ = e__->exec_id | e__->flags))
#endif /* IGT_GT_H */