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 v2 06/10] tests/imagination: Add DEV_QUERY static data area tests
Date: Fri, 17 Jul 2026 11:18:19 +0200	[thread overview]
Message-ID: <20260717-test-imagination-add-support-v2-6-e1bf415adcee@imgtec.com> (raw)
In-Reply-To: <20260717-test-imagination-add-support-v2-0-e1bf415adcee@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                     | 19 +++++++++++++++++++
 lib/igt_pvr.h                     |  2 ++
 tests/imagination/pvr_heap_info.c | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/lib/igt_pvr.c b/lib/igt_pvr.c
index a190cd67b..437362dbc 100644
--- a/lib/igt_pvr.c
+++ b/lib/igt_pvr.c
@@ -94,3 +94,22 @@ igt_pvr_get_heap_info(int fd, uint32_t *array_len_out)
 	return heaps;
 }
 
+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 181a0e843..e7fbdc82f 100644
--- a/lib/igt_pvr.h
+++ b/lib/igt_pvr.h
@@ -19,5 +19,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 b498214d9..590e4ac87 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()
 	{
 		close(fd);

-- 
2.43.0


  parent reply	other threads:[~2026-07-17  9:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  9:18 [PATCH i-g-t v2 00/10] tests/imagination: Add initial test coverage for Imagination DRM driver Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 01/10] tests/imagination: Add framework for Imagination tests Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 02/10] tests/imagination: Add GEM mmap tests Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 03/10] tests/imagination: Add DEV_QUERY tests Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 04/10] tests/imagination: Add GPU ID test Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 05/10] tests/imagination: Add DEV_QUERY heap info tests Robert Mazur
2026-07-17  9:18 ` Robert Mazur [this message]
2026-07-17  9:18 ` [PATCH i-g-t v2 07/10] tests/imagination: Add VM_CONTEXT tests Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 08/10] tests/imagination: Add tests for free list and hwrt creation ioctls Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 09/10] tests/imagination: Add DEV_QUERY quirks and enhancements tests Robert Mazur
2026-07-17  9:18 ` [PATCH i-g-t v2 10/10] tests/imagination: Add DEV_QUERY runtime_info tests Robert Mazur
2026-07-17 11:10 ` ✓ Xe.CI.BAT: success for tests/imagination: Add initial test coverage for Imagination DRM driver (rev2) Patchwork
2026-07-17 12:06 ` ✓ i915.CI.BAT: " Patchwork
2026-07-17 16:51 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-17 22:08 ` ✗ i915.CI.Full: failure " 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-v2-6-e1bf415adcee@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