From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, zbigniew.kempczynski@intel.com
Subject: [igt-dev] [i-g-t 4/5] lib/intel_chipset: Add support to XE driver to get devid
Date: Tue, 14 Mar 2023 16:24:51 +0530 [thread overview]
Message-ID: <20230314105452.2169208-5-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230314105452.2169208-1-bhanuprakash.modem@intel.com>
As many tests are using intel devid, add a helper to get it for
XE driver.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
lib/intel_chipset.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c
index efb6f1771..73dbd813d 100644
--- a/lib/intel_chipset.c
+++ b/lib/intel_chipset.c
@@ -41,6 +41,7 @@
#include "drmtest.h"
#include "intel_chipset.h"
#include "igt_core.h"
+#include "xe/xe_query.h"
/**
* SECTION:intel_chipset
@@ -112,9 +113,22 @@ intel_get_pci_device(void)
return pci_dev;
}
+static uint32_t __i915_get_drm_devid(int fd)
+{
+ struct drm_i915_getparam gp;
+ int devid = 0;
+
+ memset(&gp, 0, sizeof(gp));
+ gp.param = I915_PARAM_CHIPSET_ID;
+ gp.value = &devid;
+ ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
+
+ return devid;
+}
+
/**
* intel_get_drm_devid:
- * @fd: open i915 drm file descriptor
+ * @fd: open i915/xe drm file descriptor
*
* Queries the kernel for the pci device id corresponding to the drm file
* descriptor.
@@ -125,22 +139,18 @@ intel_get_pci_device(void)
uint32_t
intel_get_drm_devid(int fd)
{
- struct drm_i915_getparam gp;
const char *override;
- int devid = 0;
- igt_assert(is_i915_device(fd));
+ igt_assert(is_intel_device(fd));
override = getenv("INTEL_DEVID_OVERRIDE");
if (override)
return strtol(override, NULL, 0);
- memset(&gp, 0, sizeof(gp));
- gp.param = I915_PARAM_CHIPSET_ID;
- gp.value = &devid;
- ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
-
- return devid;
+ if (is_i915_device(fd))
+ return __i915_get_drm_devid(fd);
+ else
+ return xe_dev_id(fd);
}
/**
--
2.39.1
next prev parent reply other threads:[~2023-03-14 10:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 10:54 [igt-dev] [i-g-t 0/5] Add basic helpers to support display in XE Bhanuprakash Modem
2023-03-14 10:54 ` [igt-dev] [i-g-t 1/5] lib/drmtest: Add helpers to check and require the XE driver Bhanuprakash Modem
2023-03-14 11:14 ` Zbigniew Kempczyński
2023-03-14 11:57 ` Mauro Carvalho Chehab
2023-03-14 10:54 ` [igt-dev] [i-g-t 2/5] i915: s/igt_require_intel/igt_require_i915 Bhanuprakash Modem
2023-03-14 11:15 ` Zbigniew Kempczyński
2023-03-14 12:03 ` Mauro Carvalho Chehab
2023-03-14 14:32 ` Modem, Bhanuprakash
2023-03-14 10:54 ` [igt-dev] [i-g-t 3/5] lib/xe/xe_query: Add dev_id() interface Bhanuprakash Modem
2023-03-14 11:17 ` Zbigniew Kempczyński
2023-03-14 12:06 ` Mauro Carvalho Chehab
2023-03-14 10:54 ` Bhanuprakash Modem [this message]
2023-03-14 11:20 ` [igt-dev] [i-g-t 4/5] lib/intel_chipset: Add support to XE driver to get devid Zbigniew Kempczyński
2023-03-14 12:08 ` Mauro Carvalho Chehab
2023-03-14 12:20 ` Zbigniew Kempczyński
2023-03-14 14:30 ` Modem, Bhanuprakash
2023-03-14 10:54 ` [igt-dev] [i-g-t 5/5] lib/igt_kms: Cache xe_device info for kms tests Bhanuprakash Modem
2023-03-14 11:38 ` Zbigniew Kempczyński
2023-03-14 12:08 ` Mauro Carvalho Chehab
2023-03-14 12:45 ` [igt-dev] ✓ Fi.CI.BAT: success for Add basic helpers to support display in XE Patchwork
2023-03-15 16:57 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230314105452.2169208-5-bhanuprakash.modem@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=zbigniew.kempczynski@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