Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Vivi,  Rodrigo" <rodrigo.vivi@intel.com>
Cc: "michal.wajdeczko@intel.com" <michal.wajdeczko@intel.com>,
	"Brost, Matthew" <matthew.brost@intel.com>,
	"Sousa, Gustavo" <gustavo.sousa@intel.com>,
	"Zhang, Carl" <carl.zhang@intel.com>,
	"Ye, Tony" <tony.ye@intel.com>,
	"Auld, Matthew" <matthew.auld@intel.com>,
	"Roper, Matthew D" <matthew.d.roper@intel.com>
Subject: Re: [PATCH] drm/xe: Order video decode engines even physical instances first
Date: Fri, 4 Dec 2026 19:41:33 +0000	[thread overview]
Message-ID: <b73012d5ef9dd37a9dc57ca922211f4dfdcff047.camel@intel.com> (raw)
In-Reply-To: <20261204190130.937235-2-rodrigo.vivi@intel.com>

On Fri, 2026-12-04 at 14:01 -0500, Rodrigo Vivi wrote:
> 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.

I saw the discussion around this and I know this is what Windows KMD is
doing... but in a lot of other places in the engine enumeration we are
assigning features to engines rather than hard coding things based on
index. Is there a reason we don't continue that here? This seems more
like a feature of the different VDBOX engines than a hardware
restricted ordering. Also what if this ordering changes in the next
generation?

Thanks,
Stuart

> 
> 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>
> ---
>  drivers/gpu/drm/xe/xe_hw_engine.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c
> b/drivers/gpu/drm/xe/xe_hw_engine.c
> index 959661ecb1a2..010e87cf5f4d 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++;
> +       }
> +}
> +
>  static int hw_engine_setup_logical_and_paging_mapping(struct xe_gt
> *gt)
>  {
>         struct xe_device *xe = gt_to_xe(gt);
> @@ -799,6 +820,11 @@ static int
> hw_engine_setup_logical_and_paging_mapping(struct xe_gt *gt)
>         for (class = 0; class < XE_ENGINE_CLASS_MAX; ++class) {
>                 int logical_instance = 0;
>  
> +               if (class == XE_ENGINE_CLASS_VIDEO_DECODE) {
> +                       hw_engine_setup_vcs_logical_order(gt);
> +                       continue;
> +               }
> +
>                 for_each_hw_engine(hwe, gt, id) {
>                         if (hwe->class == class) {
>                                 hwe->logical_instance =
> logical_instance++;


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

Thread overview: 6+ 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 ` [PATCH] " sashiko-bot
2026-12-04 19:41 ` Summers, Stuart [this message]
2026-12-04 19:48 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-12-04 20:19 ` [PATCH] " Matt Roper

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=b73012d5ef9dd37a9dc57ca922211f4dfdcff047.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=carl.zhang@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tony.ye@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