diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_gt.c | 50 | ||||
-rw-r--r-- | lib/igt_gt.h | 38 | ||||
-rw-r--r-- | lib/igt_perf.h | 9 |
3 files changed, 89 insertions, 8 deletions
diff --git a/lib/igt_gt.c b/lib/igt_gt.c index 64a2dfd6..4a8f541f 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -608,3 +608,53 @@ bool gem_can_store_dword(int fd, unsigned int engine) return true; } + +const struct intel_execution_engine2 intel_execution_engines2[] = { + { "rcs0", I915_ENGINE_CLASS_RENDER, 0 }, + { "bcs0", I915_ENGINE_CLASS_COPY, 0 }, + { "vcs0", I915_ENGINE_CLASS_VIDEO, 0 }, + { "vcs1", I915_ENGINE_CLASS_VIDEO, 1 }, + { "vecs0", I915_ENGINE_CLASS_VIDEO_ENHANCE, 0 }, +}; + +unsigned int +gem_class_instance_to_eb_flags(int gem_fd, + enum drm_i915_gem_engine_class class, + unsigned int instance) +{ + if (class != I915_ENGINE_CLASS_VIDEO) + igt_assert(instance == 0); + else + igt_assert(instance >= 0 && instance <= 1); + + switch (class) { + case I915_ENGINE_CLASS_RENDER: + return I915_EXEC_RENDER; + case I915_ENGINE_CLASS_COPY: + return I915_EXEC_BLT; + case I915_ENGINE_CLASS_VIDEO: + if (instance == 0) { + if (gem_has_bsd2(gem_fd)) + return I915_EXEC_BSD | I915_EXEC_BSD_RING1; + else + return I915_EXEC_BSD; + + } else { + return I915_EXEC_BSD | I915_EXEC_BSD_RING2; + } + case I915_ENGINE_CLASS_VIDEO_ENHANCE: + return I915_EXEC_VEBOX; + case I915_ENGINE_CLASS_INVALID: + default: + igt_assert(0); + }; +} + +bool gem_has_engine(int gem_fd, + enum drm_i915_gem_engine_class class, + unsigned int instance) +{ + return gem_has_ring(gem_fd, + gem_class_instance_to_eb_flags(gem_fd, class, + instance)); +} diff --git a/lib/igt_gt.h b/lib/igt_gt.h index 2579cbd3..48ed48af 100644 --- a/lib/igt_gt.h +++ b/lib/igt_gt.h @@ -25,6 +25,7 @@ #define IGT_GT_H #include "igt_debugfs.h" +#include "igt_core.h" void igt_require_hang_ring(int fd, int ring); @@ -80,4 +81,41 @@ extern const struct intel_execution_engine { bool gem_can_store_dword(int fd, unsigned int engine); +extern const struct intel_execution_engine2 { + const char *name; + int class; + int instance; +} intel_execution_engines2[]; + +#define for_each_engine_class_instance(fd__, e__) \ + for ((e__) = intel_execution_engines2;\ + (e__)->name; \ + (e__)++) + +enum drm_i915_gem_engine_class { + I915_ENGINE_CLASS_RENDER = 0, + I915_ENGINE_CLASS_COPY = 1, + I915_ENGINE_CLASS_VIDEO = 2, + I915_ENGINE_CLASS_VIDEO_ENHANCE = 3, + + I915_ENGINE_CLASS_INVALID = -1 +}; + +unsigned int +gem_class_instance_to_eb_flags(int gem_fd, + enum drm_i915_gem_engine_class class, + unsigned int instance); + +bool gem_has_engine(int gem_fd, + enum drm_i915_gem_engine_class class, + unsigned int instance); + +static inline +void gem_require_engine(int gem_fd, + enum drm_i915_gem_engine_class class, + unsigned int instance) +{ + igt_require(gem_has_engine(gem_fd, class, instance)); +} + #endif /* IGT_GT_H */ diff --git a/lib/igt_perf.h b/lib/igt_perf.h index 938d5488..5428feb0 100644 --- a/lib/igt_perf.h +++ b/lib/igt_perf.h @@ -29,14 +29,7 @@ #include <linux/perf_event.h> -enum drm_i915_gem_engine_class { - I915_ENGINE_CLASS_RENDER = 0, - I915_ENGINE_CLASS_COPY = 1, - I915_ENGINE_CLASS_VIDEO = 2, - I915_ENGINE_CLASS_VIDEO_ENHANCE = 3, - - I915_ENGINE_CLASS_INVALID = -1 -}; +#include "igt_gt.h" enum drm_i915_pmu_engine_sample { I915_SAMPLE_BUSY = 0, |