All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rodrigo Vivi" <rodrigo.vivi@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Order video decode engines even physical instances first
Date: Fri, 04 Dec 2026 19:27:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-250539@kernel.org> (raw)
In-Reply-To: <20261204190130.937235-2-rodrigo.vivi@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/xe: query_engines() returns unsorted VCS engine_instance
  values
- [Low] drm/xe: missing Fixes trailer for VCS logical instance ordering
  fix
--

commit 1a7463f562006324b4ed09105ea7b616a0410778
Author: Rodrigo Vivi <rodrigo.vivi@intel.com>

> drm/xe: Order video decode engines even physical instances first
>
> Video decode engines share some units in pairs (VCS0/VCS1, VCS2/VCS3,
> ...), and only engines from different pairs can decode the same frame
> together. GuC requires the engines of a parallel exec queue to be
> logically contiguous, but logical instances are assigned in physical
> order. So on a part with VCS0, VCS1 and VCS2, the valid pair VCS0+VCS2
> can't be used, and the logically contiguous VCS0+VCS1 is not useful.
>
> Number the even physical instances first, then the odd ones, like i915
> does (setup_logical_ids()) and like Windows. With VCS0/1/2, logical
> 0/1/2 map to physical 0/2/1, so both logical pairs are on different
> units.
>
> This changes the logical numbering of video decode engines on some parts,
> but the logical order was never part of the uAPI and already changes with
> fusing. On DG2 it also restores the order i915 always used there.
>
> Cc: Carl Zhang <carl.zhang@intel.com>
> Cc: Tony Ye <tony.ye@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

[Severity: Low]
This fixes a bug where parallel video decode exec queues could not pair
valid VCS engines from different shared-unit pairs.  Should this include:

  Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")

> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> index 959661ecb1a26..010e87cf5f4d7 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -742,6 +742,27 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,
>  	return err;
>  }
>  
> +/*
> + * Video decode engines share some units in pairs (VCS0/VCS1, VCS2/VCS3, ...),
> + * and only engines from different pairs can work together on the same frame.
> + * GuC requires the engines of a parallel exec queue to be logically
> + * contiguous, so number the even physical instances first, then the odd ones.
> + * This way logically adjacent engines are on different pairs.
> + */
> +static void hw_engine_setup_vcs_logical_order(struct xe_gt *gt)
> +{
> +	static const u8 order[] = { 0, 2, 4, 6, 1, 3, 5, 7 };
> +	int logical_instance = 0;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(order); i++) {
> +		struct xe_hw_engine *hwe = &gt->hw_engines[XE_HW_ENGINE_VCS0 + order[i]];
> +
> +		if (xe_hw_engine_is_valid(hwe))
> +			hwe->logical_instance = logical_instance++;
> +	}
> +}

[Severity: High]
Does this cause DRM_XE_DEVICE_QUERY_ENGINES to return unsorted VCS
engine_instance values and break parallel exec queue creation?

Numbering even physical instances first leaves non-monotonic
logical_instance values in gt->hw_engines[] (for example 0, 2, 1 on a
3-VCS part).  query_engines() in drivers/gpu/drm/xe/xe_query.c iterates
via for_each_hw_engine() and exposes hwe->logical_instance in array order.

When userspace passes consecutive queried VCS entries to
DRM_IOCTL_XE_EXEC_QUEUE_CREATE with width > 1 without re-sorting them,
calc_validate_logical_mask() fails with -EINVAL because it requires
ascending contiguous instances (current_mask != prev_mask << 1).

query_oa_units() in drivers/gpu/drm/xe/xe_query.c also iterates via
for_each_hw_engine() and emits unsorted VCS engine_instance values when
multiple VCS engines share an OA unit.

Emitting engines in ascending logical_instance order per class in
query_engines() and query_oa_units() would preserve the expected uAPI
ordering while keeping the even-first GuC mapping.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204190130.937235-2-rodrigo.vivi@intel.com?part=1

  parent reply	other threads:[~2026-12-04 19:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 19:01 [PATCH] drm/xe: Order video decode engines even physical instances first Rodrigo Vivi
2026-12-04 19:12 ` ✓ CI.KUnit: success for " Patchwork
2026-12-04 19:27 ` sashiko-bot [this message]
2026-12-04 19:41 ` [PATCH] " Summers, Stuart
2026-12-04 19:48 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-12-04 20:19 ` [PATCH] " Matt Roper
2026-12-05 18:54 ` ✗ Xe.CI.FULL: failure for " 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=sashiko-outbox-250539@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.