Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Mazur <robert.mazur@imgtec.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Alessio Belle <alessio.belle@imgtec.com>,
	Luigi Santivetti <luigi.santivetti@imgtec.com>,
	Brajesh Gupta <brajesh.gupta@imgtec.com>,
	Robert Mazur <robert.mazur@imgtec.com>,
	Donald Robson <donald.robson@imgtec.com>
Subject: [PATCH i-g-t v3 06/10] tests/imagination: Add DEV_QUERY static data area tests
Date: Fri, 17 Jul 2026 16:21:38 +0200	[thread overview]
Message-ID: <20260717-test-imagination-add-support-v3-6-ce69f9ad330c@imgtec.com> (raw)
In-Reply-To: <20260717-test-imagination-add-support-v3-0-ce69f9ad330c@imgtec.com>

From: Donald Robson <donald.robson@imgtec.com>

Add subtest validating static data areas returned by DEV_QUERY.

Signed-off-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Robert Mazur <robert.mazur@imgtec.com>
---
 lib/igt_pvr.c                     | 29 +++++++++++++++++++++++++++++
 lib/igt_pvr.h                     |  2 ++
 tests/imagination/pvr_heap_info.c | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)

diff --git a/lib/igt_pvr.c b/lib/igt_pvr.c
index a26b4edad..70fc71388 100644
--- a/lib/igt_pvr.c
+++ b/lib/igt_pvr.c
@@ -135,3 +135,32 @@ igt_pvr_get_heap_info(int fd, uint32_t *array_len_out)
 	return heaps;
 }
 
+/**
+ * igt_pvr_get_static_data_areas:
+ * @fd: The file descriptor of the DRM device.
+ * @array_len_out: Pointer to store the number of static data areas.
+ *
+ * Function to get information about the device static data areas.
+ *
+ * Returns: An array of drm_pvr_static_data_area structures. The caller is responsible
+ * for freeing the array.
+ */
+struct drm_pvr_static_data_area *
+igt_pvr_get_static_data_areas(int fd, uint32_t *array_len_out)
+{
+	struct drm_pvr_static_data_area *sdas =
+		calloc(DRM_PVR_STATIC_DATA_AREA_YUV_CSC + 1, sizeof(*sdas));
+	struct drm_pvr_dev_query_static_data_areas sdas_get = {
+		.static_data_areas =
+			DRM_PVR_OBJ_ARRAY(DRM_PVR_STATIC_DATA_AREA_YUV_CSC + 1,
+					  sdas),
+	};
+
+	igt_pvr_ioctl_dev_query(fd, DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET,
+				sizeof(sdas_get), &sdas_get, 0);
+
+	if (array_len_out)
+		*array_len_out = sdas_get.static_data_areas.count;
+
+	return sdas;
+}
diff --git a/lib/igt_pvr.h b/lib/igt_pvr.h
index ca09f39e1..19909480b 100644
--- a/lib/igt_pvr.h
+++ b/lib/igt_pvr.h
@@ -18,5 +18,7 @@ igt_pvr_ioctl_dev_query(int fd, enum drm_pvr_dev_query type, uint64_t size,
 			void *pointer, int expect_err);
 struct drm_pvr_heap *
 igt_pvr_get_heap_info(int fd, uint32_t *array_len_out);
+struct drm_pvr_static_data_area *
+igt_pvr_get_static_data_areas(int fd, uint32_t *array_len_out);
 
 #endif /* IGT_PVR_H */
diff --git a/tests/imagination/pvr_heap_info.c b/tests/imagination/pvr_heap_info.c
index 7d953044e..fa8591a97 100644
--- a/tests/imagination/pvr_heap_info.c
+++ b/tests/imagination/pvr_heap_info.c
@@ -123,6 +123,45 @@ int igt_main()
 		free(heaps);
 	}
 
+	igt_describe("Test validity of static data areas");
+	igt_subtest("heap-info-static-data-areas-valid")
+	{
+		uint32_t heaps_count = 0;
+		struct drm_pvr_heap *heaps =
+			igt_pvr_get_heap_info(fd, &heaps_count);
+
+		uint32_t sda_count = 0;
+		struct drm_pvr_static_data_area *static_data_areas =
+			igt_pvr_get_static_data_areas(fd, &sda_count);
+
+		igt_assert(heaps);
+		igt_assert(static_data_areas);
+
+		for (uint32_t i = 0; i < sda_count; i++) {
+			const uint64_t start_offset = static_data_areas[i].offset;
+			const uint64_t end_offset =
+				start_offset + static_data_areas[i].size;
+			const struct drm_pvr_heap *const heap =
+				&heaps[static_data_areas[i].location_heap_id];
+
+			igt_assert_lte(static_data_areas[i].area_usage,
+				       DRM_PVR_STATIC_DATA_AREA_YUV_CSC);
+			igt_assert_lt(static_data_areas[i].location_heap_id,
+				      DRM_PVR_HEAP_COUNT);
+
+			if (!static_data_areas[i].size)
+				/* Not present for device. */
+				continue;
+
+			/* Ensure reported range is inside the heap. */
+			igt_assert_lte_u64(start_offset, heap->size);
+			igt_assert_lte_u64(end_offset, heap->size);
+		}
+
+		free(heaps);
+		free(static_data_areas);
+	}
+
 	igt_fixture()
 	{
 		drm_close_driver(fd);

-- 
2.43.0


  parent reply	other threads:[~2026-07-17 14:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 14:21 [PATCH i-g-t v3 00/10] tests/imagination: Add initial test coverage for Imagination DRM driver Robert Mazur
2026-07-17 14:21 ` [PATCH i-g-t v3 01/10] tests/imagination: Add framework for Imagination tests Robert Mazur
2026-07-22 13:44   ` Kamil Konieczny
     [not found]     ` <3a08b2b97b01954f2e6afef9244c05680d33e98d.camel@imgtec.com>
2026-07-27 18:18       ` [EXTERNAL] " Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 02/10] tests/imagination: Add GEM mmap tests Robert Mazur
2026-07-22 13:46   ` Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 03/10] tests/imagination: Add DEV_QUERY tests Robert Mazur
2026-07-22 14:12   ` Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 04/10] tests/imagination: Add GPU ID test Robert Mazur
2026-07-22 14:13   ` Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 05/10] tests/imagination: Add DEV_QUERY heap info tests Robert Mazur
2026-07-22 14:14   ` Kamil Konieczny
2026-07-17 14:21 ` Robert Mazur [this message]
2026-07-22 14:21   ` [PATCH i-g-t v3 06/10] tests/imagination: Add DEV_QUERY static data area tests Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 07/10] tests/imagination: Add VM_CONTEXT tests Robert Mazur
2026-07-22 14:22   ` Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 08/10] tests/imagination: Add tests for free list and hwrt creation ioctls Robert Mazur
2026-07-22 14:41   ` Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 09/10] tests/imagination: Add DEV_QUERY quirks and enhancements tests Robert Mazur
2026-07-22 14:43   ` Kamil Konieczny
2026-07-17 14:21 ` [PATCH i-g-t v3 10/10] tests/imagination: Add DEV_QUERY runtime_info tests Robert Mazur
2026-07-22 14:45   ` Kamil Konieczny
2026-07-17 21:16 ` ✓ i915.CI.BAT: success for tests/imagination: Add initial test coverage for Imagination DRM driver (rev3) Patchwork
2026-07-17 21:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-18  4:13 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-18 10:57 ` ✓ 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=20260717-test-imagination-add-support-v3-6-ce69f9ad330c@imgtec.com \
    --to=robert.mazur@imgtec.com \
    --cc=alessio.belle@imgtec.com \
    --cc=brajesh.gupta@imgtec.com \
    --cc=donald.robson@imgtec.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=luigi.santivetti@imgtec.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