Re: [PATCH i-g-t v3 02/10] tests/imagination: Add GEM mmap tests

Kamil Konieczny <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
Hi Robert,
On 2026-07-17 at 16:21:34 +0200, Robert Mazur wrote:
> From: Matt Coster <[email protected]>
> 
> Add subtests for mmap operations on GEM buffer objects.
> 
> Signed-off-by: Matt Coster <[email protected]>
> Signed-off-by: Robert Mazur <[email protected]>

LGTM
Acked-by: Kamil Konieczny <[email protected]>

Regards,
Kamil

> ---
>  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 273f4d56f..74bfd4eee 100644
> --- a/tests/imagination/pvr_gem.c
> +++ b/tests/imagination/pvr_gem.c
> @@ -59,6 +59,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()
>  	{
>  		drm_close_driver(fd);
> 
> -- 
> 2.43.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.