diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-04 10:19:38 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-08 09:57:33 +0000 |
commit | 697c3f5550d8a58901c010635ecb7a76a524d296 (patch) | |
tree | f7c91a895d10d6d5b210023c5258b21dc2f6e725 /lib/igt_gt.h | |
parent | 60eafc548911d8625d20443a203c5aff3662c39a (diff) |
lib: Magic for_each_engine() macro to iterate over available engines
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_gt.h')
-rw-r--r-- | lib/igt_gt.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/igt_gt.h b/lib/igt_gt.h index ad993c1b..dfe1cfb3 100644 --- a/lib/igt_gt.h +++ b/lib/igt_gt.h @@ -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 */ |