Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: priyanka.dandamudi@intel.com
Cc: igt-dev@lists.freedesktop.org, saurabhg.gupta@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t v3 1/2] lib/igt_gt: Check for shared reset domain
Date: Mon, 17 Jan 2022 12:20:42 -0800	[thread overview]
Message-ID: <85czkq9krp.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20220117085700.1723228-2-priyanka.dandamudi@intel.com>

On Mon, 17 Jan 2022 00:56:59 -0800, <priyanka.dandamudi@intel.com> wrote:
>
> +bool has_shared_reset_domain(int fd, const intel_ctx_t *ctx)
> +{
> +	const struct intel_execution_engine2 *e;
> +	bool rcs0 = false;
> +	bool ccs0 = false;
> +	int ccs_count = 0;
> +
> +	for_each_ctx_engine(fd, ctx, e) {
> +		if ((rcs0 && ccs0) || (ccs_count > 1))
> +			break;
> +		else if (e->class == I915_ENGINE_CLASS_RENDER)
> +			rcs0 = true;
> +		else if (e->class == I915_ENGINE_CLASS_COMPUTE) {
> +			ccs0 = true;
> +			ccs_count++;
> +		}
> +	}
> +	return ((rcs0 && ccs0) || (ccs_count > 1));
> +}

No need for bool, just use counts. Something like:

bool has_shared_reset_domain(int fd, const intel_ctx_t *ctx)
{
	const struct intel_execution_engine2 *e;
	int rcs = 0, ccs = 0;

	for_each_ctx_engine(fd, ctx, e) {
		if (e->class == I915_ENGINE_CLASS_RENDER)
			rcs++;
		else if (e->class == I915_ENGINE_CLASS_COMPUTE)
			ccs++;
	}

	return ((rcs && ccs) || (ccs >= 2));
}

Hmm, this can just be:

bool has_shared_reset_domain(int fd, const intel_ctx_t *ctx)
{
	const struct intel_execution_engine2 *e;
	int count = 0;

	for_each_ctx_engine(fd, ctx, e)
		if (e->class == I915_ENGINE_CLASS_RENDER ||
			e->class == I915_ENGINE_CLASS_COMPUTE)
		count++;

	return count >= 2;
}

  reply	other threads:[~2022-01-17 20:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17  8:56 [igt-dev] [PATCH i-g-t v3 0/2] Shared reset domain priyanka.dandamudi
2022-01-17  8:56 ` [igt-dev] [PATCH i-g-t v3 1/2] lib/igt_gt: Check for shared " priyanka.dandamudi
2022-01-17 20:20   ` Dixit, Ashutosh [this message]
2022-01-18 22:32     ` Matt Roper
2022-01-19 19:09       ` John Harrison
2022-01-19 19:32         ` Matt Roper
2022-01-19 19:37           ` John Harrison
2022-01-17  8:57 ` [igt-dev] [PATCH i-g-t v3 2/2] tests/i915/gem_ctx_exec: Skip test " priyanka.dandamudi
2022-01-18  1:54   ` Dixit, Ashutosh
2022-01-19 19:25     ` John Harrison
2022-01-17  9:45 ` [igt-dev] ✓ Fi.CI.BAT: success for Shared reset domain (rev3) Patchwork
2022-01-17 14:19 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=85czkq9krp.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=priyanka.dandamudi@intel.com \
    --cc=saurabhg.gupta@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