diff options
| author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2019-07-01 08:52:05 +0100 |
|---|---|---|
| committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2019-07-02 10:36:42 +0100 |
| commit | a1186616d25fabb951119709ed17e161b501d323 (patch) | |
| tree | 530d30bdb6ec878046628027a69ffe408578da31 /lib | |
| parent | 0280987bf29c718bcae3897ce9fb602d3659bcac (diff) | |
tests/i915/gem_ctx_switch: Fix I915_EXEC_DEFAULT testing
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@intel.com>
Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@intel.com>
Cc: Ramalingam C <ramalingam.c@intel.com>
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/i915/gem_engine_topology.c | 26 | ||||
| -rw-r--r-- | lib/i915/gem_engine_topology.h | 3 |
2 files changed, 20 insertions, 9 deletions
diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c index 6cfe3468..cae5a029 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 b175483f..9b6e2d4f 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__)++) |
