[igt-dev] [PATCH i-g-t] tests/fbdev: Add mmap readback subtest
Imre Deak
imre.deak at intel.com
Tue Nov 17 14:43:56 UTC 2020
Add a simple subtest checking that the mmap address we get for an FB
corresponds to the content that we read back from the FB via the read
syscall.
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
tests/fbdev.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tests/fbdev.c b/tests/fbdev.c
index e5efeb93d..38623b215 100644
--- a/tests/fbdev.c
+++ b/tests/fbdev.c
@@ -83,6 +83,27 @@ igt_main
munmap(map, fix_info.smem_len);
}
+ igt_subtest("mmap-readback") {
+ const uint32_t pattern = 0x55aa55aa;
+ uint32_t *map;
+ uint32_t buf;
+
+ igt_require(fix_info.smem_len);
+
+ kmstest_set_vt_graphics_mode();
+
+ map = mmap(NULL, fix_info.smem_len,
+ PROT_WRITE, MAP_SHARED, fd, 0);
+ igt_assert(map != MAP_FAILED);
+
+ map[0] = pattern;
+
+ munmap(map, fix_info.smem_len);
+
+ igt_assert_eq(read(fd, &buf, sizeof(buf)), sizeof(buf));
+ igt_assert_eq(buf, pattern);
+ }
+
igt_fixture {
close(fd);
}
--
2.25.1
More information about the igt-dev
mailing list