Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Order video decode engines even physical instances first
@ 2026-12-04 19:01 Rodrigo Vivi
  2026-12-04 19:12 ` ✓ CI.KUnit: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Rodrigo Vivi @ 2026-12-04 19:01 UTC (permalink / raw)
  To: intel-xe
  Cc: Rodrigo Vivi, Carl Zhang, Tony Ye, Matthew Brost, Matthew Auld,
	Matt Roper, Gustavo Sousa, Michal Wajdeczko

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>
---
 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++;
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-04 20:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-12-04 19:48 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-12-04 20:19 ` [PATCH] " Matt Roper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox