From 3f0a6eedc61c7616f8f2648b457dc433e95d160d Mon Sep 17 00:00:00 2001 From: Andi Shyti Date: Wed, 3 Apr 2019 18:48:23 +0300 Subject: lib: igt_gt: add execution buffer flags to class helper we have a "class/instance to eb flags" helper but not the opposite, add it. Suggested-by: Tvrtko Ursulin Signed-off-by: Andi Shyti Reviewed-by: Tvrtko Ursulin --- lib/igt_gt.c | 18 ++++++++++++++++++ lib/igt_gt.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/lib/igt_gt.c b/lib/igt_gt.c index a2eaadf5..59b62242 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -41,6 +41,7 @@ #include "intel_reg.h" #include "intel_chipset.h" #include "igt_dummyload.h" +#include "i915/gem_engine_topology.h" /** * SECTION:igt_gt @@ -586,6 +587,23 @@ const struct intel_execution_engine2 intel_execution_engines2[] = { { } }; +int gem_execbuf_flags_to_engine_class(unsigned int flags) +{ + switch (flags & 0x3f) { + case I915_EXEC_DEFAULT: + case I915_EXEC_RENDER: + return I915_ENGINE_CLASS_RENDER; + case I915_EXEC_BLT: + return I915_ENGINE_CLASS_COPY; + case I915_EXEC_BSD: + return I915_ENGINE_CLASS_VIDEO; + case I915_EXEC_VEBOX: + return I915_ENGINE_CLASS_VIDEO_ENHANCE; + default: + igt_assert(0); + } +} + unsigned int gem_class_instance_to_eb_flags(int gem_fd, enum drm_i915_gem_engine_class class, diff --git a/lib/igt_gt.h b/lib/igt_gt.h index 52b2f1ea..8ceed142 100644 --- a/lib/igt_gt.h +++ b/lib/igt_gt.h @@ -99,6 +99,8 @@ extern const struct intel_execution_engine2 { bool is_virtual; } intel_execution_engines2[]; +int gem_execbuf_flags_to_engine_class(unsigned int flags); + unsigned int gem_class_instance_to_eb_flags(int gem_fd, enum drm_i915_gem_engine_class class, -- cgit v1.2.3