[igt-dev] [PATCH i-g-t 5/5] igt: Require a display (KMS enabled) for KMS tests

Chris Wilson chris at chris-wilson.co.uk
Fri Sep 28 10:20:02 UTC 2018


Simple rule of thumb, if a kms_* test calls igt_display_init() in its
global fixture, skip the entire test if the driver has disabled KMS.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/drm_read.c                  | 2 +-
 tests/kms_atomic.c                | 3 +--
 tests/kms_atomic_interruptible.c  | 4 +---
 tests/kms_atomic_transition.c     | 3 +--
 tests/kms_available_modes_crc.c   | 2 +-
 tests/kms_busy.c                  | 3 +--
 tests/kms_ccs.c                   | 2 +-
 tests/kms_chamelium.c             | 2 +-
 tests/kms_chv_cursor_fail.c       | 2 +-
 tests/kms_color.c                 | 2 +-
 tests/kms_concurrent.c            | 3 +--
 tests/kms_crtc_background_color.c | 2 +-
 tests/kms_cursor_crc.c            | 2 +-
 tests/kms_cursor_legacy.c         | 3 +--
 tests/kms_fence_pin_leak.c        | 2 +-
 tests/kms_flip_event_leak.c       | 2 +-
 tests/kms_flip_tiling.c           | 2 +-
 tests/kms_frontbuffer_tracking.c  | 2 +-
 tests/kms_invalid_dotclock.c      | 2 +-
 tests/kms_legacy_colorkey.c       | 2 +-
 tests/kms_mmap_write_crc.c        | 2 +-
 tests/kms_panel_fitting.c         | 2 +-
 tests/kms_pipe_b_c_ivb.c          | 2 +-
 tests/kms_pipe_crc_basic.c        | 2 +-
 tests/kms_plane.c                 | 2 +-
 tests/kms_plane_lowres.c          | 2 +-
 tests/kms_plane_multiple.c        | 3 +--
 tests/kms_plane_scaling.c         | 2 +-
 tests/kms_properties.c            | 2 +-
 tests/kms_psr.c                   | 2 +-
 tests/kms_pwrite_crc.c            | 2 +-
 tests/kms_rmfb.c                  | 2 +-
 tests/kms_rotation_crc.c          | 2 +-
 tests/kms_universal_plane.c       | 2 +-
 tests/kms_vblank.c                | 2 +-
 35 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/tests/drm_read.c b/tests/drm_read.c
index b6aab7312..309f389f6 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -182,7 +182,7 @@ igt_main
 		fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&display, fd);
+		igt_display_require(&display, fd);
 		igt_display_require_output(&display);
 
 		for_each_pipe_with_valid_output(&display, pipe, output) {
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index ac02baf01..3aad2d9aa 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -871,8 +871,7 @@ igt_main
 
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&display, display.drm_fd);
-
+		igt_display_require(&display, display.drm_fd);
 		igt_require(display.is_atomic);
 		igt_display_require_output(&display);
 
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 64a005597..8e9d4cb69 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -279,10 +279,8 @@ igt_main
 
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&display, display.drm_fd);
-
+		igt_display_require(&display, display.drm_fd);
 		igt_require(display.is_atomic);
-
 		igt_display_require_output(&display);
 
 		igt_require_sw_sync();
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 2fbd94bd2..12bafe87e 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -858,8 +858,7 @@ igt_main
 
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&display, display.drm_fd);
-
+		igt_display_require(&display, display.drm_fd);
 		igt_require(display.is_atomic);
 
 		igt_display_require_output(&display);
diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index 09fb2e996..45a47750b 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -498,7 +498,7 @@ igt_main
 	igt_fixture {
 		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&data.display, data.gfx_fd);
+		igt_display_require(&data.display, data.gfx_fd);
 		igt_require_pipe_crc(data.gfx_fd);
 	}
 
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index abf39828b..d821ec711 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -323,8 +323,7 @@ igt_main
 		gem_require_mmap_wc(fd);
 
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&display, fd);
-		igt_require(display.n_pipes > 0);
+		igt_display_require(&display, fd);
 	}
 
 	/* XXX Extend to cover atomic rendering tests to all planes + legacy */
diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index e03f947ea..950f15ee7 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -525,7 +525,7 @@ igt_main
 		kmstest_set_vt_graphics_mode();
 		igt_require_pipe_crc(data.drm_fd);
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	for_each_pipe_static(pipe) {
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 2bc34d077..cf7e3c9aa 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -752,7 +752,7 @@ igt_main
 		/* So fbcon doesn't try to reprobe things itself */
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		igt_require(data.display.is_atomic);
 	}
 
diff --git a/tests/kms_chv_cursor_fail.c b/tests/kms_chv_cursor_fail.c
index 8e50978d0..86629555e 100644
--- a/tests/kms_chv_cursor_fail.c
+++ b/tests/kms_chv_cursor_fail.c
@@ -329,7 +329,7 @@ int main(int argc, char **argv)
 
 		igt_require_pipe_crc(data.drm_fd);
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	for_each_pipe_static(data.pipe) {
diff --git a/tests/kms_color.c b/tests/kms_color.c
index bb106dd00..913c70ca8 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -1163,7 +1163,7 @@ igt_main
 			data.devid = intel_get_drm_devid(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	for_each_pipe_static(pipe)
diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index 283acf8c8..c17b1fe6f 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -407,8 +407,7 @@ int main(int argc, char *argv[])
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&data.display, data.drm_fd);
-		igt_require(data.display.n_pipes > 0);
+		igt_display_require(&data.display, data.drm_fd);
 		igt_require(data.display.is_atomic);
 	}
 
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index 6407e19ba..3df3401f2 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -180,7 +180,7 @@ igt_simple_main
 
 	data.gfx_fd = drm_open_driver(DRIVER_INTEL);
 	igt_require_pipe_crc(data.gfx_fd);
-	igt_display_init(&data.display, data.gfx_fd);
+	igt_display_require(&data.display, data.gfx_fd);
 
 	test_crtc_background(&data);
 
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 99946b1ae..1514e7f2e 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -675,7 +675,7 @@ igt_main
 
 		igt_require_pipe_crc(data.drm_fd);
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	data.cursor_max_w = cursor_width;
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 82ceebcb0..79df79a38 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1365,8 +1365,7 @@ igt_main
 		display.drm_fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&display, display.drm_fd);
-		igt_require(display.n_pipes > 0);
+		igt_display_require(&display, display.drm_fd);
 	}
 
 	igt_subtest_group {
diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index 8bbd5563d..62c52b627 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -210,7 +210,7 @@ igt_simple_main
 	igt_assert(data.bufmgr);
 	drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
 
-	igt_display_init(&data.display, data.drm_fd);
+	igt_display_require(&data.display, data.drm_fd);
 
 	ctx = drm_intel_gem_context_create(data.bufmgr);
 	igt_require(ctx);
diff --git a/tests/kms_flip_event_leak.c b/tests/kms_flip_event_leak.c
index f1a8abd81..50f880ad3 100644
--- a/tests/kms_flip_event_leak.c
+++ b/tests/kms_flip_event_leak.c
@@ -103,7 +103,7 @@ igt_simple_main
 	data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 	kmstest_set_vt_graphics_mode();
 
-	igt_display_init(&data.display, data.drm_fd);
+	igt_display_require(&data.display, data.drm_fd);
 
 	for_each_pipe_with_valid_output(&data.display, pipe, output) {
 		test(&data, pipe, output);
diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c
index beeb111be..d1e6687f7 100644
--- a/tests/kms_flip_tiling.c
+++ b/tests/kms_flip_tiling.c
@@ -151,7 +151,7 @@ igt_main
 		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc(data.drm_fd);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	/*
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 265c313a3..2f677ee5f 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1284,7 +1284,7 @@ static void setup_drm(void)
 	drm.debugfs = igt_debugfs_dir(drm.fd);
 
 	kmstest_set_vt_graphics_mode();
-	igt_display_init(&drm.display, drm.fd);
+	igt_display_require(&drm.display, drm.fd);
 
 	drm.bufmgr = drm_intel_bufmgr_gem_init(drm.fd, 4096);
 	igt_assert(drm.bufmgr);
diff --git a/tests/kms_invalid_dotclock.c b/tests/kms_invalid_dotclock.c
index e6e72f528..e7a80d884 100644
--- a/tests/kms_invalid_dotclock.c
+++ b/tests/kms_invalid_dotclock.c
@@ -133,7 +133,7 @@ igt_simple_main
 
 	igt_enable_connectors();
 	kmstest_set_vt_graphics_mode();
-	igt_display_init(&data.display, data.drm_fd);
+	igt_display_require(&data.display, data.drm_fd);
 	data.res = drmModeGetResources(data.drm_fd);
 	kmstest_unset_all_crtcs(data.drm_fd, data.res);
 
diff --git a/tests/kms_legacy_colorkey.c b/tests/kms_legacy_colorkey.c
index 150520ce6..961aa0a31 100644
--- a/tests/kms_legacy_colorkey.c
+++ b/tests/kms_legacy_colorkey.c
@@ -51,7 +51,7 @@ igt_simple_main
 
 	kmstest_set_vt_graphics_mode();
 
-	igt_display_init(&display, drm_fd);
+	igt_display_require(&display, drm_fd);
 
 	for_each_pipe(&display, p) {
 		for_each_plane_on_pipe(&display, p, plane) {
diff --git a/tests/kms_mmap_write_crc.c b/tests/kms_mmap_write_crc.c
index 279d0f67d..93c96ef4d 100644
--- a/tests/kms_mmap_write_crc.c
+++ b/tests/kms_mmap_write_crc.c
@@ -281,7 +281,7 @@ int main(int argc, char **argv)
 
 		igt_require_pipe_crc(data.drm_fd);
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 
 		fork_cpuhog_helper();
 	}
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 7df8104ed..491e429f4 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -241,7 +241,7 @@ igt_main
 		igt_skip_on_simulation();
 
 		data.drm_fd = drm_open_driver(DRIVER_ANY);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
 	}
 
diff --git a/tests/kms_pipe_b_c_ivb.c b/tests/kms_pipe_b_c_ivb.c
index 64086915e..fe2250cee 100644
--- a/tests/kms_pipe_b_c_ivb.c
+++ b/tests/kms_pipe_b_c_ivb.c
@@ -263,7 +263,7 @@ igt_main
 		igt_skip_on(!IS_IVYBRIDGE(devid));
 
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	igt_subtest("pipe-B-dpms-off-modeset-pipe-C")
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 852f16972..9c9078e9b 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -187,7 +187,7 @@ igt_main
 
 		igt_require_pipe_crc(data.drm_fd);
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		data.debugfs = igt_debugfs_dir(data.drm_fd);
 	}
 
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 3999dde8f..5a0bc05b0 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -585,7 +585,7 @@ igt_main
 		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc(data.drm_fd);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	for_each_pipe_static(pipe)
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 5e83ef563..0824ef8fe 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -301,7 +301,7 @@ igt_main
 		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc(data.drm_fd);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		igt_require(data.display.is_atomic);
 	}
 
diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index a53be0014..721afe594 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -393,9 +393,8 @@ int main(int argc, char *argv[])
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		kmstest_set_vt_graphics_mode();
 		igt_require_pipe_crc(data.drm_fd);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		igt_require(data.display.is_atomic);
-		igt_require(data.display.n_pipes > 0);
 	}
 
 	for_each_pipe_static(pipe) {
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 7c64ed14b..773162ec7 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -544,7 +544,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		igt_require_pipe_crc(data.drm_fd);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		data.devid = intel_get_drm_devid(data.drm_fd);
 		igt_require(data.display.is_atomic);
 	}
diff --git a/tests/kms_properties.c b/tests/kms_properties.c
index 68c0518fc..9548cf440 100644
--- a/tests/kms_properties.c
+++ b/tests/kms_properties.c
@@ -678,7 +678,7 @@ igt_main
 
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&display, display.drm_fd);
+		igt_display_require(&display, display.drm_fd);
 	}
 
 	igt_subtest("plane-properties-legacy")
diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index fcc04770c..ea0c46261 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -111,7 +111,7 @@ static void setup_output(data_t *data)
 
 static void display_init(data_t *data)
 {
-	igt_display_init(&data->display, data->drm_fd);
+	igt_display_require(&data->display, data->drm_fd);
 	setup_output(data);
 }
 
diff --git a/tests/kms_pwrite_crc.c b/tests/kms_pwrite_crc.c
index ee895db63..ffd72e4ab 100644
--- a/tests/kms_pwrite_crc.c
+++ b/tests/kms_pwrite_crc.c
@@ -185,7 +185,7 @@ igt_simple_main
 
 		igt_require_pipe_crc(data.drm_fd);
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	run_test(&data);
diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
index f3461cc91..b1c81cb80 100644
--- a/tests/kms_rmfb.c
+++ b/tests/kms_rmfb.c
@@ -146,7 +146,7 @@ igt_main
 
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
 	}
 
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f73c6a399..c233ef651 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -532,7 +532,7 @@ igt_main
 
 		igt_require_pipe_crc(data.gfx_fd);
 
-		igt_display_init(&data.display, data.gfx_fd);
+		igt_display_require(&data.display, data.gfx_fd);
 	}
 
 	for (subtest = subtests; subtest->rot; subtest++) {
diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 58f329e68..cb5070b1d 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -798,7 +798,7 @@ igt_main
 		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc(data.drm_fd);
-		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
 	}
 
 	for_each_pipe_static(pipe) {
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 1c0771c6f..dafadb58f 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -507,7 +507,7 @@ igt_main
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&data.display, fd);
+		igt_display_require(&data.display, fd);
 		igt_display_require_output(&data.display);
 	}
 
-- 
2.19.0



More information about the igt-dev mailing list