[PATCH i-g-t 11/79] lib/i915/gem_engine_topology: Factor out static engine listing
Jason Ekstrand
jason at jlekstrand.net
Fri Apr 16 21:32:44 UTC 2021
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
lib/i915/gem_engine_topology.c | 51 +++++++++++++++++++---------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
index ae8d2a33..d1f94761 100644
--- a/lib/i915/gem_engine_topology.c
+++ b/lib/i915/gem_engine_topology.c
@@ -212,6 +212,34 @@ intel_get_current_physical_engine(struct intel_engine_data *ed)
return e;
}
+static struct intel_engine_data intel_engine_list_for_static(int fd)
+{
+ const struct intel_execution_engine2 *e2;
+ struct intel_engine_data engine_data = { };
+
+ igt_debug("using pre-allocated engine list\n");
+
+ __for_each_static_engine(e2) {
+ if (igt_only_list_subtests() ||
+ (fd < 0) ||
+ gem_has_ring(fd, e2->flags)) {
+ struct intel_execution_engine2 *__e2 =
+ &engine_data.engines[
+ engine_data.nengines];
+
+ strcpy(__e2->name, e2->name);
+ __e2->instance = e2->instance;
+ __e2->class = e2->class;
+ __e2->flags = e2->flags;
+ __e2->is_virtual = false;
+
+ engine_data.nengines++;
+ }
+ }
+
+ return engine_data;
+}
+
static int gem_topology_get_param(int fd,
struct drm_i915_gem_context_param *p)
{
@@ -232,28 +260,7 @@ struct intel_engine_data intel_init_engine_list(int fd, uint32_t ctx_id)
if (gem_topology_get_param(fd, ¶m)) {
/* if kernel does not support engine/context mapping */
- const struct intel_execution_engine2 *e2;
-
- igt_debug("using pre-allocated engine list\n");
-
- __for_each_static_engine(e2) {
- if (igt_only_list_subtests() ||
- (fd < 0) ||
- gem_has_ring(fd, e2->flags)) {
- struct intel_execution_engine2 *__e2 =
- &engine_data.engines[
- engine_data.nengines];
-
- strcpy(__e2->name, e2->name);
- __e2->instance = e2->instance;
- __e2->class = e2->class;
- __e2->flags = e2->flags;
- __e2->is_virtual = false;
-
- engine_data.nengines++;
- }
- }
- return engine_data;
+ return intel_engine_list_for_static(fd);
}
if (!param.size) {
--
2.31.1
More information about the Intel-gfx-trybot
mailing list