From: Daniel Charles <daniel.charles@intel.com>
To: Xin Wang <x.wang@intel.com>, <igt-dev@lists.freedesktop.org>
Subject: Re: [v2,3/4] lib/xe: use debugfs info to implement xe_engine_class_supports_multi_queue()
Date: Mon, 6 Apr 2026 15:34:09 -0700 [thread overview]
Message-ID: <10acd127-00fa-4f3d-8b7e-7b1e9b1b2005@intel.com> (raw)
In-Reply-To: <20260403071322.366766-4-x.wang@intel.com>
On 4/3/2026 12:13 AM, Xin Wang wrote:
> Update xe_engine_class_supports_multi_queue() to take a device fd and
> use the kernel-reported multi_queue_engine_classes bitmask from debugfs
> when available, with a fallback to the hardcoded default for older KMD.
>
> Propagate the new fd argument through the xe_for_each_multi_queue_engine
> and xe_for_each_multi_queue_engine_class macros and all their call sites.
>
> Signed-off-by: Xin Wang <x.wang@intel.com>
> ---
> lib/xe/xe_query.c | 52 ++++++++++++++++++-------------
> lib/xe/xe_query.h | 8 ++---
> tests/intel/xe_exec_multi_queue.c | 4 +--
> tests/intel/xe_exec_threads.c | 4 +--
> 4 files changed, 38 insertions(+), 30 deletions(-)
>
> diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
> index e13d5e143..3286a3b37 100644
> --- a/lib/xe/xe_query.c
> +++ b/lib/xe/xe_query.c
> @@ -215,28 +215,6 @@ static uint16_t xe_device_query_engine_class_mask(int fd, const char *key)
> return mask;
> }
>
> -/**
> - * xe_engine_class_supports_multi_queue:
> - * @engine_class: engine class
> - *
> - * Returns true if multi queue supported by engine class or false.
> - */
> -bool xe_engine_class_supports_multi_queue(uint32_t engine_class)
> -{
> - switch (engine_class) {
> - case DRM_XE_ENGINE_CLASS_COPY:
> - case DRM_XE_ENGINE_CLASS_COMPUTE:
> - return true;
> - case DRM_XE_ENGINE_CLASS_RENDER:
> - case DRM_XE_ENGINE_CLASS_VIDEO_DECODE:
> - case DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE:
> - return false;
> - default:
> - igt_warn("Engine class 0x%x unknown\n", engine_class);
> - return false;
> - }
> -}
> -
> /**
> * xe_engine_class_string:
> * @engine_class: engine class
> @@ -338,6 +316,36 @@ bool xe_engine_class_supports_multi_lrc(int fd, uint32_t engine_class)
> }
> }
>
> +/**
> + * xe_engine_class_supports_multi_queue:
> + * @fd: xe device fd
> + * @engine_class: engine class
> + *
> + * Returns true if multi queue 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_queue(int fd, uint32_t engine_class)
> +{
> + struct xe_device *xe_dev = find_in_cache(fd);
> +
> + if (xe_dev && xe_dev->multi_queue_engine_class_mask != UINT16_MAX)
> + return !!(xe_dev->multi_queue_engine_class_mask & BIT(engine_class));
> +
> + switch (engine_class) {
> + case DRM_XE_ENGINE_CLASS_COPY:
> + case DRM_XE_ENGINE_CLASS_COMPUTE:
> + return true;
> + case DRM_XE_ENGINE_CLASS_RENDER:
> + case DRM_XE_ENGINE_CLASS_VIDEO_DECODE:
> + case DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE:
> + return false;
> + 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 5c26a3e88..8815c6c66 100644
> --- a/lib/xe/xe_query.h
> +++ b/lib/xe/xe_query.h
> @@ -113,10 +113,10 @@ struct xe_device {
>
> #define xe_for_each_multi_queue_engine(__fd, __hwe) \
> xe_for_each_engine(__fd, __hwe) \
> - for_if(xe_engine_class_supports_multi_queue((__hwe)->engine_class))
> -#define xe_for_each_multi_queue_engine_class(__class) \
> + for_if(xe_engine_class_supports_multi_queue(__fd, (__hwe)->engine_class))
> +#define xe_for_each_multi_queue_engine_class(__fd, __class) \
> xe_for_each_engine_class(__class) \
> - for_if(xe_engine_class_supports_multi_queue(__class))
> + for_if(xe_engine_class_supports_multi_queue(__fd, __class))
>
> #define XE_IS_CLASS_SYSMEM(__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_SYSMEM)
> #define XE_IS_CLASS_VRAM(__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_VRAM)
> @@ -161,7 +161,7 @@ uint32_t xe_get_default_alignment(int fd);
> 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_queue(int fd, 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);
> diff --git a/tests/intel/xe_exec_multi_queue.c b/tests/intel/xe_exec_multi_queue.c
> index f987f8d6a..b5ded0633 100644
> --- a/tests/intel/xe_exec_multi_queue.c
> +++ b/tests/intel/xe_exec_multi_queue.c
> @@ -1052,7 +1052,7 @@ int igt_main()
>
> igt_subtest_f("sanity")
> xe_for_each_gt(fd, gt)
> - xe_for_each_multi_queue_engine_class(class)
> + xe_for_each_multi_queue_engine_class(fd, class)
> test_sanity(fd, gt, class);
>
> igt_subtest_f("exec-sanity")
> @@ -1061,7 +1061,7 @@ int igt_main()
>
> igt_subtest_f("virtual")
> xe_for_each_gt(fd, gt)
> - xe_for_each_multi_queue_engine_class(class)
> + xe_for_each_multi_queue_engine_class(fd, class)
> test_exec_virtual(fd, gt, class);
>
> igt_subtest_f("priority")
> diff --git a/tests/intel/xe_exec_threads.c b/tests/intel/xe_exec_threads.c
> index f082a0eda..ab9565beb 100644
> --- a/tests/intel/xe_exec_threads.c
> +++ b/tests/intel/xe_exec_threads.c
> @@ -1141,7 +1141,7 @@ static void threads(int fd, int flags)
> int gt;
>
> xe_for_each_engine(fd, hwe) {
> - if ((flags & MULTI_QUEUE) && !xe_engine_class_supports_multi_queue(hwe->engine_class))
> + if ((flags & MULTI_QUEUE) && !xe_engine_class_supports_multi_queue(fd, hwe->engine_class))
> continue;
> ++n_engines;
> }
> @@ -1170,7 +1170,7 @@ static void threads(int fd, int flags)
> }
>
> xe_for_each_engine(fd, hwe) {
> - if ((flags & MULTI_QUEUE) && !xe_engine_class_supports_multi_queue(hwe->engine_class))
> + if ((flags & MULTI_QUEUE) && !xe_engine_class_supports_multi_queue(fd, hwe->engine_class))
> continue;
> threads_data[i].mutex = &mutex;
> threads_data[i].cond = &cond;
Reviewed-by:Daniel Charles <daniel.charles@intel.com>
next prev parent reply other threads:[~2026-04-06 22:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 7:13 [PATCH v2 0/4] lib/xe: query engine class capabilities from debugfs info Xin Wang
2026-04-03 7:13 ` [PATCH v2 1/4] lib/xe: cache engine class masks " Xin Wang
2026-04-06 22:25 ` [v2,1/4] " Daniel Charles
2026-04-03 7:13 ` [PATCH v2 2/4] lib/xe: add xe_engine_class_supports_multi_lrc() Xin Wang
2026-04-06 22:32 ` [v2,2/4] " Daniel Charles
2026-04-03 7:13 ` [PATCH v2 3/4] lib/xe: use debugfs info to implement xe_engine_class_supports_multi_queue() Xin Wang
2026-04-06 22:34 ` Daniel Charles [this message]
2026-04-03 7:13 ` [PATCH v2 4/4] tests/intel: skip or adjust tests for non-multi-LRC engine classes Xin Wang
2026-04-06 22:35 ` [v2,4/4] " Daniel Charles
2026-04-03 8:03 ` ✓ i915.CI.BAT: success for lib/xe: query engine class capabilities from debugfs info (rev2) Patchwork
2026-04-03 8:06 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-03 13:37 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-03 23:35 ` ✗ i915.CI.Full: failure " Patchwork
2026-04-08 2:15 ` Wang, X
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=10acd127-00fa-4f3d-8b7e-7b1e9b1b2005@intel.com \
--to=daniel.charles@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=x.wang@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