public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Xin Wang <x.wang@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Xin Wang <x.wang@intel.com>
Subject: [PATCH 2/5] lib/xe: add xe_engine_class_supports_multi_lrc()
Date: Thu,  2 Apr 2026 18:40:37 -0700	[thread overview]
Message-ID: <20260403014040.310758-3-x.wang@intel.com> (raw)
In-Reply-To: <20260403014040.310758-1-x.wang@intel.com>

Add xe_engine_class_supports_multi_lrc() to query whether an engine
class supports multi-LRC submission.  When the kernel exposes the
information via the debugfs info node it is used directly; otherwise
fall back to a hardcoded default to keep compatibility with older KMD.

Signed-off-by: Xin Wang <x.wang@intel.com>
---
 lib/xe/xe_query.c | 30 ++++++++++++++++++++++++++++++
 lib/xe/xe_query.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 441e95794..e13d5e143 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -308,6 +308,36 @@ static struct xe_device *find_in_cache(int fd)
 	return xe_dev;
 }
 
+/**
+ * xe_engine_class_supports_multi_lrc:
+ * @fd: xe device fd
+ * @engine_class: engine class
+ *
+ * Returns true if multi LRC supported by engine class or false.
+ * Uses the kernel-reported bitmask from debugfs when available, otherwise
+ * falls back to the hardcoded per-class default.
+ */
+bool xe_engine_class_supports_multi_lrc(int fd, uint32_t engine_class)
+{
+	struct xe_device *xe_dev = find_in_cache(fd);
+
+	if (xe_dev && xe_dev->multi_lrc_mask != UINT16_MAX)
+		return !!(xe_dev->multi_lrc_mask & BIT(engine_class));
+
+	switch (engine_class) {
+	case DRM_XE_ENGINE_CLASS_COPY:
+	case DRM_XE_ENGINE_CLASS_COMPUTE:
+	case DRM_XE_ENGINE_CLASS_RENDER:
+		return false;
+	case DRM_XE_ENGINE_CLASS_VIDEO_DECODE:
+	case DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE:
+		return true;
+	default:
+		igt_warn("Engine class 0x%x unknown\n", engine_class);
+		return false;
+	}
+}
+
 static void xe_device_free(struct xe_device *xe_dev)
 {
 	free(xe_dev->config);
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index f33562bda..5c26a3e88 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -162,6 +162,7 @@ uint32_t xe_va_bits(int fd);
 uint16_t xe_dev_id(int fd);
 int xe_supports_faults(int fd);
 bool xe_engine_class_supports_multi_queue(uint32_t engine_class);
+bool xe_engine_class_supports_multi_lrc(int fd, uint32_t engine_class);
 const char *xe_engine_class_string(uint32_t engine_class);
 const char *xe_engine_class_short_string(uint32_t engine_class);
 bool xe_has_engine_class(int fd, uint16_t engine_class);
-- 
2.43.0


  parent reply	other threads:[~2026-04-03  1:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03  1:40 [PATCH 0/5] lib/xe: query engine class capabilities from debugfs info Xin Wang
2026-04-03  1:40 ` [PATCH 1/5] lib/xe: cache engine class masks " Xin Wang
2026-04-03  1:40 ` Xin Wang [this message]
2026-04-03  1:40 ` [PATCH 3/5] lib/xe: use debugfs info to implement xe_engine_class_supports_multi_queue() Xin Wang
2026-04-03  1:40 ` [PATCH 4/5] tests/intel/xe_exec_multi_queue: fix expected error for parallel queue creation Xin Wang
2026-04-03  3:22   ` Niranjana Vishwanathapura
2026-04-03  7:00     ` Wang, X
2026-04-03  1:40 ` [PATCH 5/5] tests/intel: skip multi-LRC tests for engine classes that do not support it Xin Wang
2026-04-03  2:42 ` ✓ Xe.CI.BAT: success for lib/xe: query engine class capabilities from debugfs info Patchwork
2026-04-03  3:03 ` ✓ i915.CI.BAT: " Patchwork
2026-04-03 12:57 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-03 22:34 ` ✗ i915.CI.Full: " 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=20260403014040.310758-3-x.wang@intel.com \
    --to=x.wang@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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