diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_gt.c | 23 | ||||
-rw-r--r-- | lib/igt_gt.h | 9 |
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/igt_gt.c b/lib/igt_gt.c index f70fcb92..e630550b 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -660,3 +660,26 @@ bool gem_has_engine(int gem_fd, gem_class_instance_to_eb_flags(gem_fd, class, instance)); } + +bool gem_ring_is_physical_engine(int fd, unsigned ring) +{ + if (ring == I915_EXEC_DEFAULT) + return false; + + /* BSD uses an extra flag to chose between aliasing modes */ + if ((ring & 63) == I915_EXEC_BSD) { + bool explicit_bsd = ring & (3 << 13); + bool has_bsd2 = gem_has_bsd2(fd); + return explicit_bsd ? has_bsd2 : !has_bsd2; + } + + return true; +} + +bool gem_ring_has_physical_engine(int fd, unsigned ring) +{ + if (!gem_ring_is_physical_engine(fd, ring)) + return false; + + return gem_has_ring(fd, ring); +} diff --git a/lib/igt_gt.h b/lib/igt_gt.h index 68592410..4d9d1aa0 100644 --- a/lib/igt_gt.h +++ b/lib/igt_gt.h @@ -81,6 +81,15 @@ extern const struct intel_execution_engine { e__++) \ for_if (gem_has_ring(fd__, flags__ = e__->exec_id | e__->flags)) +#define for_each_physical_engine(fd__, flags__) \ + for (const struct intel_execution_engine *e__ = intel_execution_engines;\ + e__->name; \ + e__++) \ + for_if (gem_ring_has_physical_engine(fd__, flags__ = e__->exec_id | e__->flags)) + +bool gem_ring_is_physical_engine(int fd, unsigned int ring); +bool gem_ring_has_physical_engine(int fd, unsigned int ring); + bool gem_can_store_dword(int fd, unsigned int engine); extern const struct intel_execution_engine2 { |