Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Maíra Canal" <mcanal@igalia.com>
To: Iago Toral <itoral@igalia.com>, Melissa Wen <mwen@igalia.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
	Bhanuprakash Modem <bhanuprakash.modem@gmail.com>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>,
	Karthik B S <karthik.b.s@intel.com>
Cc: igt-dev@lists.freedesktop.org, kernel-dev@igalia.com,
	"Maíra Canal" <mcanal@igalia.com>
Subject: [PATCH i-g-t 4/5] lib/v3d: Add helper to query the V3D hardware version
Date: Fri,  8 May 2026 09:42:53 -0300	[thread overview]
Message-ID: <20260508124446.1260672-6-mcanal@igalia.com> (raw)
In-Reply-To: <20260508124446.1260672-2-mcanal@igalia.com>

Add a helper to help tests to branch on the hardware version. Some HW
configurations can change from v42 to v71, such as performance counter
IDs, and this helper will assist tests to retrieve the HW version.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 lib/igt_v3d.c | 12 ++++++++++++
 lib/igt_v3d.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/lib/igt_v3d.c b/lib/igt_v3d.c
index eb1adaaa4..2353c97a8 100644
--- a/lib/igt_v3d.c
+++ b/lib/igt_v3d.c
@@ -114,6 +114,18 @@ igt_v3d_get_param(int fd, enum drm_v3d_param param)
 	return get.value;
 }
 
+uint32_t
+igt_v3d_get_version(int fd)
+{
+	uint32_t ident0 = igt_v3d_get_param(fd, DRM_V3D_PARAM_V3D_CORE0_IDENT0);
+	uint32_t ident1 = igt_v3d_get_param(fd, DRM_V3D_PARAM_V3D_CORE0_IDENT1);
+
+	uint32_t major = (ident0 >> 24) & 0xff;
+	uint32_t minor = (ident1 >> 0) & 0xf;
+
+	return major * 10 + minor;
+}
+
 void *
 igt_v3d_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot)
 {
diff --git a/lib/igt_v3d.h b/lib/igt_v3d.h
index 70dd6f011..e3a9f381b 100644
--- a/lib/igt_v3d.h
+++ b/lib/igt_v3d.h
@@ -72,6 +72,7 @@ void igt_v3d_free_bo(int fd, struct v3d_bo *bo);
 /* IOCTL wrappers */
 uint32_t igt_v3d_get_bo_offset(int fd, uint32_t handle);
 uint32_t igt_v3d_get_param(int fd, enum drm_v3d_param param);
+uint32_t igt_v3d_get_version(int fd);
 void *igt_v3d_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
 
 void igt_v3d_bo_mmap(int fd, struct v3d_bo *bo);
-- 
2.54.0


  parent reply	other threads:[~2026-05-08 12:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 12:42 [PATCH i-g-t 0/5] tests/v3d_perfmon: Fix V3D 7.1 regression and extend perfmon testing Maíra Canal
2026-05-08 12:42 ` [PATCH i-g-t 1/5] tests/v3d_perfmon: Don't use the deprecated V3D_PERFCNT_NUM Maíra Canal
2026-05-08 12:42 ` [PATCH i-g-t 2/5] drm-uapi/v3d: Sync v3d UAPI Maíra Canal
2026-05-08 12:42 ` [PATCH i-g-t 3/5] lib/v3d: Allow callers to retrieve perfmon counter values Maíra Canal
2026-05-08 12:42 ` Maíra Canal [this message]
2026-05-08 12:42 ` [PATCH i-g-t 5/5] tests/v3d_perfmon: Add global perfmon and counter isolation tests Maíra Canal
2026-05-12  6:50   ` Iago Toral
2026-05-09  0:21 ` ✓ i915.CI.BAT: success for tests/v3d_perfmon: Fix V3D 7.1 regression and extend perfmon testing Patchwork
2026-05-09  0:28 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-09 13:32 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-10  1:38 ` ✓ i915.CI.Full: success " 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=20260508124446.1260672-6-mcanal@igalia.com \
    --to=mcanal@igalia.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=bhanuprakash.modem@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=itoral@igalia.com \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=karthik.b.s@intel.com \
    --cc=kernel-dev@igalia.com \
    --cc=mwen@igalia.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