summaryrefslogtreecommitdiff
path: root/tests/fbdev.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2020-11-20 11:52:10 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-11-23 12:13:25 +0000
commit4a35b0ecd59b67e4cd0d329ae33512bafef3e6c4 (patch)
tree0b64e20f2ff286c8915b0fdcaa6eead9bae6da47 /tests/fbdev.c
parent503df90dd2915b027df380f40babe494f2446241 (diff)
tests/fbdev: Move existing tests into separate subgroups
Move the existing tests into subgroups for testing modesetting and accessing the framebuffer. v5: * test mmap() with igt_assert() (Daniel, Chris) v4: * declare fd as volatile (Petri) * add info test to CI v3: * put igt_describe() before igt_subtest() and igt_subtest_group() (Petri) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/fbdev.c')
-rw-r--r--tests/fbdev.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/tests/fbdev.c b/tests/fbdev.c
index e5efeb93..a803f445 100644
--- a/tests/fbdev.c
+++ b/tests/fbdev.c
@@ -37,28 +37,17 @@
#include "igt.h"
-igt_main
+static void mode_tests(int fd)
{
struct fb_var_screeninfo var_info;
struct fb_fix_screeninfo fix_info;
- int fd = -1;
- /*
- * Should this test focus on the fbdev independent of any drm driver,
- * or should it look for fbdev of a particular device?
- */
igt_fixture {
- fd = open("/dev/fb0", O_RDWR);
- if (fd < 0) {
- drm_load_module(DRIVER_ANY);
- fd = open("/dev/fb0", O_RDWR);
- }
- igt_require_f(fd != -1, "/dev/fb0\n");
-
igt_require(ioctl(fd, FBIOGET_VSCREENINFO, &var_info) == 0);
igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
}
+ igt_describe("Check if screeninfo is valid");
igt_subtest("info") {
unsigned long size;
@@ -69,7 +58,17 @@ igt_main
fix_info.line_length,
fix_info.smem_len);
}
+}
+
+static void framebuffer_tests(int fd)
+{
+ struct fb_fix_screeninfo fix_info;
+
+ igt_fixture {
+ igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
+ }
+ igt_describe("Check mmap operations on framebuffer memory");
igt_subtest("mmap") {
void *map;
@@ -82,6 +81,34 @@ igt_main
memset(map, 0, fix_info.smem_len);
munmap(map, fix_info.smem_len);
}
+}
+
+igt_main
+{
+ volatile int fd = -1;
+
+ /*
+ * Should this test focus on the fbdev independent of any drm driver,
+ * or should it look for fbdev of a particular device?
+ */
+ igt_fixture {
+ fd = open("/dev/fb0", O_RDWR);
+ if (fd < 0) {
+ drm_load_module(DRIVER_ANY);
+ fd = open("/dev/fb0", O_RDWR);
+ }
+ igt_require_f(fd != -1, "/dev/fb0\n");
+ }
+
+ igt_describe("Check modesetting");
+ igt_subtest_group {
+ mode_tests(fd);
+ }
+
+ igt_describe("Check framebuffer access");
+ igt_subtest_group {
+ framebuffer_tests(fd);
+ }
igt_fixture {
close(fd);