public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@intel.com>
To: Petri Latvala <petri.latvala@intel.com>
Cc: igt-dev@lists.freedesktop.org, Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [RFC PATCH i-g-t] lib/i915: Generate engine names at runtime
Date: Fri, 15 Nov 2019 16:15:29 +0200	[thread overview]
Message-ID: <20191115141529.GC1853@intel.intel> (raw)
In-Reply-To: <20191115121445.11693-1-petri.latvala@intel.com>

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
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-11-15 14:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 12:14 [igt-dev] [RFC PATCH i-g-t] lib/i915: Generate engine names at runtime Petri Latvala
2019-11-15 12:30 ` [igt-dev] ✗ GitLab.Pipeline: warning for " Patchwork
2019-11-15 12:52 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-11-15 14:15 ` Andi Shyti [this message]
2019-11-15 16:01 ` [igt-dev] [RFC PATCH i-g-t] " Tvrtko Ursulin
2019-11-18 10:05   ` Petri Latvala
2019-11-18 11:33     ` Tvrtko Ursulin
2019-11-16 18:29 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2020-01-22 13:44 ` [igt-dev] [RFC PATCH i-g-t] " Tvrtko Ursulin
2020-01-22 13:52   ` Petri Latvala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191115141529.GC1853@intel.intel \
    --to=andi.shyti@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=tvrtko.ursulin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox