From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Commit ad129d2a583689765eaef31ff57e8cdd219f1d05 ("tests/i915/gem_ctx_switch: Update with engine discovery") broke testing of I915_EXEC_DEFAULT. Bring it back. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Reported-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Andi Shyti <andi.shyti@xxxxxxxxx> Cc: Ramalingam C <ramalingam.c@xxxxxxxxx> --- lib/i915/gem_engine_topology.c | 26 +++++++++++++++++++------- lib/i915/gem_engine_topology.h | 3 +-- tests/i915/gem_ctx_switch.c | 8 ++++++-- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c index 6cfe3468e3d8..cae5a0292b02 100644 --- a/lib/i915/gem_engine_topology.c +++ b/lib/i915/gem_engine_topology.c @@ -290,17 +290,29 @@ bool gem_has_engine_topology(int fd) return !__gem_context_get_param(fd, ¶m); } -const struct intel_execution_engine2 * -gem_eb_flags_to_engine(unsigned int flags) +struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags) { - const struct intel_execution_engine2 *e2; + const unsigned int ring = flags & (I915_EXEC_RING_MASK | 3 << 13); + struct intel_execution_engine2 e2__ = { + .class = -1, + .instance = -1, + .flags = -1, + .name = "invalid" + }; + + if (ring == I915_EXEC_DEFAULT) { + e2__.flags = I915_EXEC_DEFAULT; + e2__.name = "default"; + } else { + const struct intel_execution_engine2 *e2; - __for_each_static_engine(e2) { - if (e2->flags == flags) - return e2; + __for_each_static_engine(e2) { + if (e2->flags == ring) + return *e2; + } } - return NULL; + return e2__; } bool gem_context_has_engine_map(int fd, uint32_t ctx) diff --git a/lib/i915/gem_engine_topology.h b/lib/i915/gem_engine_topology.h index b175483fac1c..9b6e2d4f9cd8 100644 --- a/lib/i915/gem_engine_topology.h +++ b/lib/i915/gem_engine_topology.h @@ -55,8 +55,7 @@ void gem_context_set_all_engines(int fd, uint32_t ctx); bool gem_context_has_engine_map(int fd, uint32_t ctx); -const struct intel_execution_engine2 * -gem_eb_flags_to_engine(unsigned int flags); +struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags); #define __for_each_static_engine(e__) \ for ((e__) = intel_execution_engines2; (e__)->name; (e__)++) diff --git a/tests/i915/gem_ctx_switch.c b/tests/i915/gem_ctx_switch.c index 407905de2d34..c071def7825e 100644 --- a/tests/i915/gem_ctx_switch.c +++ b/tests/i915/gem_ctx_switch.c @@ -347,10 +347,14 @@ igt_main /* Legacy testing must be first. */ for (e = intel_execution_engines; e->name; e++) { - e2 = gem_eb_flags_to_engine(e->exec_id | e->flags); - if (!e2) + struct intel_execution_engine2 e2__; + + e2__ = gem_eb_flags_to_engine(e->exec_id | e->flags); + if (e2__.flags == -1) continue; /* I915_EXEC_BSD with no ring selectors */ + e2 = &e2__; + for (typeof(*phases) *p = phases; p->name; p++) { igt_subtest_group { igt_fixture { -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx