Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Xin Wang <x.wang@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com, matthew.d.roper@intel.com,
	shuicheng.lin@intel.com, brian3.nguyen@intel.com,
	alex.zuo@intel.com, nakshtra.goyal@intel.com,
	dnyaneshwar.bhadane@intel.com, gustavo.sousa@intel.com,
	Xin Wang <x.wang@intel.com>
Subject: [PATCH v2 2/6] lib/xe: Use new APIs for xe device info queries
Date: Tue,  7 Oct 2025 23:26:02 +0000	[thread overview]
Message-ID: <20251007232606.363629-3-x.wang@intel.com> (raw)
In-Reply-To: <20251007232606.363629-1-x.wang@intel.com>

Update xe library to use new runtime query APIs:
- Replace intel_gen(intel_get_drm_devid(fd)) with intel_query_gen(fd)
- Replace intel_get_device_info(device_id) with intel_query_device_info(fd)
- Replace intel_graphics_ver(device_id) with intel_query_graphics_ver(fd)

These changes enable runtime device capability queries for xe devices
instead of relying on static device ID lookups.

Signed-off-by: Xin Wang <x.wang@intel.com>
---
 lib/xe/xe_legacy.c             | 2 +-
 lib/xe/xe_oa.c                 | 4 ++--
 lib/xe/xe_sriov_provisioning.c | 4 +---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/xe/xe_legacy.c b/lib/xe/xe_legacy.c
index 084445305..8e17ecff4 100644
--- a/lib/xe/xe_legacy.c
+++ b/lib/xe/xe_legacy.c
@@ -75,7 +75,7 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	igt_assert_lte(n_exec_queues, MAX_N_EXECQUEUES);
 
 	if (flags & COMPRESSION)
-		igt_require(intel_gen(intel_get_drm_devid(fd)) >= 20);
+		igt_require(intel_query_gen(fd) >= 20);
 
 	if (flags & CLOSE_FD)
 		fd = drm_open_driver(DRIVER_XE);
diff --git a/lib/xe/xe_oa.c b/lib/xe/xe_oa.c
index 428e7d0a2..a7fbf413a 100644
--- a/lib/xe/xe_oa.c
+++ b/lib/xe/xe_oa.c
@@ -447,7 +447,7 @@ static void query_hwconfig(int fd, struct intel_xe_topology_info *topinfo)
 struct intel_xe_topology_info *
 xe_fill_topology_info(int drm_fd, uint32_t device_id, uint32_t *topology_size)
 {
-	const struct intel_device_info *devinfo = intel_get_device_info(device_id);
+	const struct intel_device_info *devinfo = intel_query_device_info(drm_fd);
 	struct intel_xe_topology_info topinfo = {};
 	struct intel_xe_topology_info *ptopo;
 	struct drm_xe_query_topology_mask *xe_topo;
@@ -461,7 +461,7 @@ xe_fill_topology_info(int drm_fd, uint32_t device_id, uint32_t *topology_size)
 	};
 
 	/* Only ADL-P, DG2 and newer ip support hwconfig, use hardcoded values for previous */
-	if (intel_graphics_ver(device_id) >= IP_VER(12, 55) || devinfo->is_alderlake_p) {
+	if (intel_query_graphics_ver(drm_fd) >= IP_VER(12, 55) || devinfo->is_alderlake_p) {
 		query_hwconfig(drm_fd, &topinfo);
 	} else {
 		topinfo.max_slices = 1;
diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c
index 2a02f7cc8..fba79eddb 100644
--- a/lib/xe/xe_sriov_provisioning.c
+++ b/lib/xe/xe_sriov_provisioning.c
@@ -50,9 +50,7 @@ const char *xe_sriov_shared_res_to_string(enum xe_sriov_shared_res res)
 
 static uint64_t get_vfid_mask(int fd)
 {
-	uint16_t dev_id = intel_get_drm_devid(fd);
-
-	return (intel_graphics_ver(dev_id) >= IP_VER(12, 50)) ?
+	return (intel_query_graphics_ver(fd) >= IP_VER(12, 50)) ?
 		GGTT_PTE_VFID_MASK : PRE_1250_IP_VER_GGTT_PTE_VFID_MASK;
 }
 
-- 
2.43.0


  parent reply	other threads:[~2025-10-07 23:26 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07  5:05 [PATCH] lib/intel_device_info: get the xe .graphics_rel from GMD_ID Xin Wang
2025-10-07  9:34 ` Kamil Konieczny
2025-10-07 13:12 ` ✗ Xe.CI.BAT: failure for " Patchwork
2025-10-07 13:32 ` ✓ i915.CI.BAT: success " Patchwork
2025-10-07 16:10 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-07 16:42 ` [PATCH] " Lin, Shuicheng
2025-10-07 23:26 ` [PATCH v2 0/6] lib: Add runtime device info query APIs for xe devices Xin Wang
2025-10-07 23:26   ` [PATCH v2 1/6] " Xin Wang
2025-10-07 23:26   ` Xin Wang [this message]
2025-10-07 23:26   ` [PATCH v2 3/6] lib: Use new APIs for xe device info queries Xin Wang
2025-10-07 23:26   ` [PATCH v2 4/6] tests/intel: " Xin Wang
2025-10-07 23:26   ` [PATCH v2 5/6] tools: " Xin Wang
2025-10-07 23:26   ` [PATCH v2 6/6] lib/intel_device_info: Remove hardcoded .graphics_rel values Xin Wang
2025-10-08  1:19 ` ✓ Xe.CI.BAT: success for lib/intel_device_info: get the xe .graphics_rel from GMD_ID (rev2) Patchwork
2025-10-08  3:07 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-08  5:04 ` ✓ i915.CI.BAT: success " Patchwork
2025-10-08  6:45 ` ✗ i915.CI.Full: failure for lib/intel_device_info: get the xe .graphics_rel from GMD_ID Patchwork
2025-10-08 12:14 ` ✗ i915.CI.Full: failure for lib/intel_device_info: get the xe .graphics_rel from GMD_ID (rev2) Patchwork
2025-10-08 21:02 ` [PATCH v3 0/6] lib/intel_device_info: get the xe .graphics_rel from GMD_ID Xin Wang
2025-10-08 21:02   ` [PATCH v3 1/6] lib: Add runtime device info query APIs for xe devices Xin Wang
2025-10-08 22:01     ` Matt Roper
2025-10-09 18:00       ` Wang, X
2025-10-09 23:57         ` Matt Roper
2025-10-10 23:25           ` Ville Syrjälä
2025-10-08 22:07     ` Lin, Shuicheng
2025-10-09 22:34       ` Wang, X
2025-10-09 16:42     ` Kamil Konieczny
2025-10-09 22:30       ` Wang, X
2025-10-08 21:02   ` [PATCH v3 2/6] lib/xe: Use new APIs for xe device info queries Xin Wang
2025-10-08 21:02   ` [PATCH v3 3/6] lib: " Xin Wang
2025-10-08 21:02   ` [PATCH v3 4/6] tests/intel: " Xin Wang
2025-10-08 21:02   ` [PATCH v3 5/6] tools: " Xin Wang
2025-10-08 21:02   ` [PATCH v3 6/6] lib/intel_device_info: Remove hardcoded .graphics_rel values Xin Wang
2025-10-08 21:46 ` ✗ Xe.CI.BAT: failure for lib/intel_device_info: get the xe .graphics_rel from GMD_ID (rev3) Patchwork
2025-10-08 22:04 ` ✓ i915.CI.BAT: success " Patchwork
2025-10-09  1:06 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-09 11:21 ` ✗ 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=20251007232606.363629-3-x.wang@intel.com \
    --to=x.wang@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=brian3.nguyen@intel.com \
    --cc=dnyaneshwar.bhadane@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=nakshtra.goyal@intel.com \
    --cc=shuicheng.lin@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