[igt-dev] [PATCH v2 5/8] tests/fbdev: Add tests for write operations on framebuffer
Thomas Zimmermann
tzimmermann at suse.de
Fri Nov 6 08:29:52 UTC 2020
The write tests check the written buffer against the content of the mapped
framebuffer.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
tests/fbdev.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tests/fbdev.c b/tests/fbdev.c
index 48ffbbf5..f40a9ee1 100644
--- a/tests/fbdev.c
+++ b/tests/fbdev.c
@@ -138,6 +138,27 @@ static void framebuffer_tests(int fd)
igt_require_f(pos, "found 0x55 at pos %zu, none expected\n", pos - buf);
}
+ igt_subtest("write") {
+ ssize_t ret;
+ int cmp;
+
+ igt_describe("Check write operations on framebuffer memory");
+
+ /* write 0 to framebuffer and compare */
+ memset(buf, 0, fix_info.smem_len);
+ ret = pwrite(fd, buf, fix_info.smem_len, 0);
+ igt_require_f(ret == (ssize_t)fix_info.smem_len, "pwrite failed, ret=%zd\n", ret);
+ cmp = memcmp(map, buf, fix_info.smem_len);
+ igt_require_f(!cmp, "write buffer differs from mapped framebuffer for 0\n");
+
+ /* write 0x55 to framebuffer and compare */
+ memset(buf, 0x55, fix_info.smem_len);
+ ret = pwrite(fd, buf, fix_info.smem_len, 0);
+ igt_require_f(ret == (ssize_t)fix_info.smem_len, "pwrite failed, ret=%zd\n", ret);
+ cmp = memcmp(map, buf, fix_info.smem_len);
+ igt_require_f(!cmp, "write buffer differs from mapped framebuffer for 0\n");
+ }
+
igt_fixture {
free(buf);
memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
--
2.29.0
More information about the igt-dev
mailing list