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>,
	Matt Coster <matt.coster@imgtec.com>
Subject: [PATCH i-g-t v2 02/10] tests/imagination: Add GEM mmap tests
Date: Fri, 17 Jul 2026 11:18:15 +0200	[thread overview]
Message-ID: <20260717-test-imagination-add-support-v2-2-e1bf415adcee@imgtec.com> (raw)
In-Reply-To: <20260717-test-imagination-add-support-v2-0-e1bf415adcee@imgtec.com>

From: Matt Coster <matt.coster@imgtec.com>

Add subtests for mmap operations on GEM buffer objects.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Signed-off-by: Robert Mazur <robert.mazur@imgtec.com>
---
 tests/imagination/pvr_gem.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/tests/imagination/pvr_gem.c b/tests/imagination/pvr_gem.c
index b80d202a2..fec98a1f2 100644
--- a/tests/imagination/pvr_gem.c
+++ b/tests/imagination/pvr_gem.c
@@ -60,6 +60,50 @@ int igt_main()
 		do_ioctl_err(fd, DRM_IOCTL_PVR_CREATE_BO, &arg, EINVAL);
 	}
 
+	igt_describe("Test valid buffer object mapping");
+	igt_subtest("mmap-bo-4096")
+	{
+		size_t size = 4096;
+		uint32_t handle = igt_pvr_ioctl_create_bo(fd, &size);
+
+		off_t offset = igt_pvr_ioctl_get_bo_mmap_offset(fd, handle);
+
+		char *mapped = mmap(NULL, size, PROT_WRITE, MAP_SHARED,
+				    fd, offset);
+		igt_assert(mapped != MAP_FAILED);
+
+		/* Test writing to beginning and end of mapped range. */
+		mapped[0] = 0xff;
+		mapped[size - 1] = 0xff;
+
+		munmap(mapped, size);
+		gem_close(fd, handle);
+	}
+
+	igt_describe("Test buffer object mapping with bad handle");
+	igt_subtest("mmap-bo-bad-handle")
+	{
+		struct drm_pvr_ioctl_get_bo_mmap_offset_args arg = {
+			.handle = 0xbad6bad6,
+		};
+
+		do_ioctl_err(fd, DRM_IOCTL_PVR_GET_BO_MMAP_OFFSET, &arg, ENOENT);
+	}
+
+	igt_describe("Test buffer object mapping with bad padding");
+	igt_subtest("mmap-bo-bad-padding")
+	{
+		size_t size = 4096;
+		uint32_t handle = igt_pvr_ioctl_create_bo(fd, &size);
+
+		struct drm_pvr_ioctl_get_bo_mmap_offset_args arg = {
+			.handle = handle,
+			._padding_4 = 0xbad6bad6,
+		};
+
+		do_ioctl_err(fd, DRM_IOCTL_PVR_GET_BO_MMAP_OFFSET, &arg, EINVAL);
+	}
+
 	igt_fixture()
 	{
 		close(fd);

-- 
2.43.0


  parent reply	other threads:[~2026-07-17  9:20 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 ` Robert Mazur [this message]
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 ` [PATCH i-g-t v2 06/10] tests/imagination: Add DEV_QUERY static data area tests Robert Mazur
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-2-e1bf415adcee@imgtec.com \
    --to=robert.mazur@imgtec.com \
    --cc=alessio.belle@imgtec.com \
    --cc=brajesh.gupta@imgtec.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=luigi.santivetti@imgtec.com \
    --cc=matt.coster@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