[igt-dev] [RFC PATCH i-g-t] lib/i915: Generate engine names at runtime
Andi Shyti
andi.shyti at intel.com
Fri Nov 15 14:15:29 UTC 2019
Hi Petri,
> @@ -120,12 +121,22 @@ static void init_engine(struct intel_execution_engine2 *e2,
> if (__e2->class == class && __e2->instance == instance)
> break;
>
> - if (__e2->name) {
> - e2->name = __e2->name;
> + if (__e2->name[0]) {
> + strncpy(e2->name, __e2->name, sizeof(e2->name));
> } else {
> - igt_warn("found unknown engine (%d, %d)\n", class, instance);
> - e2->name = unknown_name;
> - e2->flags = -1;
> + for (cls = intel_execution_engine_class_map; cls->name; cls++) {
> + if (cls->class == class) {
> + snprintf(e2->name, sizeof(e2->name), "%s%d", cls->name, instance);
> + igt_info("unknown but supported engine %s found\n", e2->name);
> + break;
> + }
> + }
We need to make a decision here and refactor this library
accordingly. We either:
1. decide to get rid of all the static table and keep only
"intel_execution_engine_class" (and maybe we can spare that one
as well).
or
2. add the new classes in the static table as it's meant to be
used.
I honestly do not like any hybrid solution and when this library
was developed in a first place we had to accept lots of
compromises because we needed both.
Now that we have the dynamic_libraries, can we finally remove
all the static tables and finally go for the solution 1?
> +
> + if (!e2->name[0]) {
> + igt_info("found unknown engine (%d, %d)\n", class, instance);
> + strncpy(e2->name, unknown_name, sizeof(e2->name));
nit: just strcpy would do, we know how big is unkown_name and it
won't change.
[...]
> +const struct intel_execution_engine_class intel_execution_engine_class_map[] = {
> + { "rcs", I915_ENGINE_CLASS_RENDER },
> + { "bcs", I915_ENGINE_CLASS_COPY },
> + { "vcs", I915_ENGINE_CLASS_VIDEO },
> + { "vecs", I915_ENGINE_CLASS_VIDEO_ENHANCE },
> + { }
> +};
another one? it would be the third const struct that is used to
get the engine names/instances. I thought we wanted to eliminate
them in the long run :'(
Andi
More information about the igt-dev
mailing list