[igt-dev] [PATCH i-g-t] tests/i915/gem_mmap: test for non pagealingned mmaps

Ramalingam C ramalingam.c at intel.com
Mon Apr 8 15:50:38 UTC 2019


Kernel supports the non page aligned mmaps. Hence this new subtest
helps to maintain the sanity of such support.

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 tests/i915/gem_mmap.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
index 1f5348d9133b..f66d8b896268 100644
--- a/tests/i915/gem_mmap.c
+++ b/tests/i915/gem_mmap.c
@@ -228,6 +228,21 @@ igt_main
 		}
 	}
 
+	igt_subtest("page_nonaligned") {
+		struct drm_i915_gem_mmap arg = {
+			.handle = gem_create(fd, PAGE_SIZE),
+			.size = PAGE_SIZE - 5,
+			.flags = I915_MMAP_WC,
+		};
+
+		igt_debug("Trying to mmap page nonaligned size : %'"PRIu64"\n",
+			  (unsigned long)arg.size);
+		igt_assert_eq(mmap_ioctl(fd, &arg), 0);
+
+		gem_close(fd, arg.handle);
+		munmap(from_user_pointer(arg.addr_ptr), PAGE_SIZE - 5);
+	}
+
 	igt_subtest("basic") {
 		struct drm_i915_gem_mmap arg = {
 			.handle = gem_create(fd, OBJECT_SIZE),
-- 
2.19.1



More information about the igt-dev mailing list