Skip to contentSkip to conversation

tests: Check and skip tests when driver don't have display enabled

PATCH Superseded José Roberto de Souza 3 participants 5 messages Sep 11, 2018 – Sep 12, 2018 Library code

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Check and skip tests when driver don't have display enabled

Right now i915 is not doing the full job to complete disable display when i915.disable_display parameters is set, when that is completed it will cause several tests to fail, so here skiping all the tests that depends on modeset or display block when those are not available.

v2: Not skipping all tests in debugfs_test, perf_pmu and perf_pmu, now skiping only the required subtests

---
 lib/igt_kms.c                     | 20 +++++++++
 lib/igt_kms.h                     |  1 +
 tests/debugfs_test.c              | 13 +++++-
 tests/gem_exec_nop.c              |  1 +
 tests/kms_3d.c                    |  1 +
 tests/kms_addfb_basic.c           |  4 +-
 tests/kms_atomic.c                |  1 +
 tests/kms_atomic_interruptible.c  |  1 +
 tests/kms_available_modes_crc.c   |  1 +
 tests/kms_busy.c                  |  1 +
 tests/kms_ccs.c                   |  1 +
 tests/kms_chamelium.c             |  1 +
 tests/kms_chv_cursor_fail.c       |  1 +
 tests/kms_color.c                 |  1 +
 tests/kms_concurrent.c            |  1 +
 tests/kms_crtc_background_color.c |  1 +
 tests/kms_cursor_crc.c            |  1 +
 tests/kms_cursor_legacy.c         |  1 +
 tests/kms_draw_crc.c              |  1 +
 tests/kms_fbcon_fbt.c             |  1 +
 tests/kms_fence_pin_leak.c        |  1 +
 tests/kms_flip.c                  |  1 +
 tests/kms_flip_event_leak.c       |  1 +
 tests/kms_flip_tiling.c           |  1 +
 tests/kms_force_connector_basic.c |  1 +
 tests/kms_frontbuffer_tracking.c  |  1 +
 tests/kms_getfb.c                 |  4 +-
 tests/kms_hdmi_inject.c           |  1 +
 tests/kms_invalid_dotclock.c      |  1 +
 tests/kms_legacy_colorkey.c       |  1 +
 tests/kms_mmap_write_crc.c        |  1 +
 tests/kms_panel_fitting.c         |  1 +
 tests/kms_pipe_b_c_ivb.c          |  1 +
 tests/kms_pipe_crc_basic.c        |  1 +
 tests/kms_plane.c                 |  1 +
 tests/kms_plane_lowres.c          |  1 +
 tests/kms_plane_multiple.c        |  1 +
 tests/kms_plane_scaling.c         |  1 +
 tests/kms_properties.c            |  1 +
 tests/kms_psr.c                   |  1 +
 tests/kms_pwrite_crc.c            |  1 +
 tests/kms_rmfb.c                  |  1 +
 tests/kms_rotation_crc.c          |  1 +
 tests/kms_setmode.c               |  1 +
 tests/kms_sysfs_edid_timing.c     |  5 +++
 tests/kms_tv_load_detect.c        |  1 +
 tests/kms_universal_plane.c       |  1 +
 tests/kms_vblank.c                |  1 +
 tests/perf_pmu.c                  | 13 +++---
 tests/pm_backlight.c              |  5 ++-
 tests/pm_lpsp.c                   |  1 +
 tests/pm_rpm.c                    | 69 ++++++++++++++++++++++++-------
 tests/prime_vgem.c                |  2 +
 tests/testdisplay.c               |  1 +
 54 files changed, 155 insertions(+), 25 deletions(-)
lib/igt_kms.c +20 -0
index 4563bfd9..a12d4b79 100644
@@ -2018,6 +2018,26 @@ int igt_display_get_n_pipes(igt_display_t *display)
 	return display->n_pipes;
 }
 
+/**
+ * igt_display_require_output:
+ * @drm_fd: a drm file descriptor
+ *
+ * Checks if driver supports modeset and have display enabled.
+ */
+void igt_require_display(int fd)
+{
+	drmModeRes *resources;
+	int pipes;
+
+	resources = drmModeGetResources(fd);
+	igt_require_f(resources, "drm driver do not support modeset\n");
+
+	pipes = resources->count_crtcs;
+	drmModeFreeResources(resources);
+
+	igt_require_f(pipes > 0, "drm driver without display hardware\n");
+}
+
 /**
  * igt_display_require_output:
  * @display: A pointer to an #igt_display_t structure
lib/igt_kms.h +1 -0
index 3862efa2..0c6a7b1c 100644
@@ -388,6 +388,7 @@ void igt_display_commit_atomic(igt_display_t *display, uint32_t flags, void *use
 int  igt_display_try_commit2(igt_display_t *display, enum igt_commit_style s);
 int  igt_display_drop_events(igt_display_t *display);
 int  igt_display_get_n_pipes(igt_display_t *display);
+void igt_require_display(int fd);
 void igt_display_require_output(igt_display_t *display);
 void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe);
 
tests/debugfs_test.c +12 -1
index 2e87e442..041027c5 100644
@@ -102,10 +102,16 @@ igt_main
 		debugfs = igt_debugfs_dir(fd);
 
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&display, fd);
+
+		memset(&display, 0, sizeof(igt_display_t));
 	}
 
 	igt_subtest("read_all_entries") {
+		if (!display.n_pipes) {
+			igt_require_display(fd);
+			igt_display_init(&display, fd);
+		}
+
 		/* try to light all pipes */
 		for_each_pipe(&display, pipe) {
 			igt_output_t *output;
@@ -140,6 +146,11 @@ igt_main
 		igt_output_t *output;
 		igt_plane_t *plane;
 
+		if (!display.n_pipes) {
+			igt_require_display(fd);
+			igt_display_init(&display, fd);
+		}
+
 		for_each_connected_output(&display, output)
 			igt_output_set_pipe(output, PIPE_NONE);
 
tests/gem_exec_nop.c +1 -0
index 74d27522..1cd3d70d 100644
@@ -279,6 +279,7 @@ static void headless(int fd, uint32_t handle)
 	drmModeRes *res;
 	double n_display, n_headless;
 
+	igt_require_display(fd);
 	res = drmModeGetResources(fd);
 	igt_assert(res);
 
tests/kms_3d.c +1 -0
index bfc981ee..830b3321 100644
@@ -36,6 +36,7 @@ igt_simple_main
 	int mode_count, connector_id;
 
 	drm_fd = drm_open_driver_master(DRIVER_INTEL);
+	igt_require_display(drm_fd);
 	res = drmModeGetResources(drm_fd);
 
 	igt_assert(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) >= 0);
tests/kms_addfb_basic.c +3 -1
index ce48d24f..ce4caa5e 100644
@@ -671,8 +671,10 @@ int fd;
 
 igt_main
 {
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(fd);
+	}
 
 	invalid_tests(fd);
 
tests/kms_atomic.c +1 -0
index ac02baf0..6998a116 100644
@@ -868,6 +868,7 @@ igt_main
 
 	igt_fixture {
 		display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(display.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
tests/kms_atomic_interruptible.c +1 -0
index 64a00559..d3182d62 100644
@@ -276,6 +276,7 @@ igt_main
 
 	igt_fixture {
 		display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(display.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
tests/kms_available_modes_crc.c +1 -0
index b67b4f83..f7eb8214 100644
@@ -493,6 +493,7 @@ igt_main
 
 	igt_fixture {
 		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.gfx_fd);
 		kmstest_set_vt_graphics_mode();
 		igt_display_init(&data.display, data.gfx_fd);
 		igt_require_pipe_crc(data.gfx_fd);
tests/kms_busy.c +1 -0
index abf39828..b25b1853 100644
@@ -321,6 +321,7 @@ igt_main
 
 		igt_require_gem(fd);
 		gem_require_mmap_wc(fd);
+		igt_require_display(fd);
 
 		kmstest_set_vt_graphics_mode();
 		igt_display_init(&display, fd);
tests/kms_ccs.c +1 -0
index e1ee5880..5774b14b 100644
@@ -521,6 +521,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 
+		igt_require_display(data.drm_fd);
 		igt_require(intel_gen(intel_get_drm_devid(data.drm_fd)) >= 9);
 		kmstest_set_vt_graphics_mode();
 		igt_require_pipe_crc(data.drm_fd);
tests/kms_chamelium.c +1 -0
index 2bc34d07..b8876f49 100644
@@ -736,6 +736,7 @@ igt_main
 		igt_skip_on_simulation();
 
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 		data.chamelium = chamelium_init(data.drm_fd);
 		igt_require(data.chamelium);
 
tests/kms_chv_cursor_fail.c +1 -0
index 7138e549..683b08a9 100644
@@ -316,6 +316,7 @@ int main(int argc, char **argv)
 		int ret;
 
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
tests/kms_color.c +1 -0
index bb106dd0..86100e46 100644
@@ -1159,6 +1159,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_AMDGPU);
+		igt_require_display(data.drm_fd);
 		if (is_i915_device(data.drm_fd))
 			data.devid = intel_get_drm_devid(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
tests/kms_concurrent.c +1 -0
index 283acf8c..90476ad2 100644
@@ -406,6 +406,7 @@ int main(int argc, char *argv[])
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 		igt_display_init(&data.display, data.drm_fd);
 		igt_require(data.display.n_pipes > 0);
tests/kms_crtc_background_color.c +1 -0
index 6407e19b..61edf3b2 100644
@@ -179,6 +179,7 @@ igt_simple_main
 	igt_skip_on_simulation();
 
 	data.gfx_fd = drm_open_driver(DRIVER_INTEL);
+	igt_require_display(data.gfx_fd);
 	igt_require_pipe_crc(data.gfx_fd);
 	igt_display_init(&data.display, data.gfx_fd);
 
tests/kms_cursor_crc.c +1 -0
index 99946b1a..daa825d9 100644
@@ -661,6 +661,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 
 		ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width);
 		igt_assert(ret == 0 || errno == EINVAL);
tests/kms_cursor_legacy.c +1 -0
index 82ceebcb..3d64d8c8 100644
@@ -1363,6 +1363,7 @@ igt_main
 
 	igt_fixture {
 		display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(display.drm_fd);
 		kmstest_set_vt_graphics_mode();
 
 		igt_display_init(&display, display.drm_fd);
tests/kms_draw_crc.c +1 -0
index 86dcf392..18a60131 100644
@@ -251,6 +251,7 @@ static void setup_environment(void)
 
 	drm_fd = drm_open_driver_master(DRIVER_INTEL);
 	igt_require(drm_fd >= 0);
+	igt_require_display(drm_fd);
 
 	drm_res = drmModeGetResources(drm_fd);
 	igt_assert(drm_res->count_connectors <= MAX_CONNECTORS);
tests/kms_fbcon_fbt.c +1 -0
index 138eda9b..a13968d3 100644
@@ -293,6 +293,7 @@ static void setup_environment(void)
 
 	drm_fd = drm_open_driver_master(DRIVER_INTEL);
 	igt_require(drm_fd >= 0);
+	igt_require_display(drm_fd);
 	igt_assert(close(drm_fd) == 0);
 }
 
tests/kms_fence_pin_leak.c +1 -0
index 8bbd5563..d2d5c236 100644
@@ -201,6 +201,7 @@ igt_simple_main
 	igt_skip_on_simulation();
 
 	data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+	igt_require_display(data.drm_fd);
 
 	data.devid = intel_get_drm_devid(data.drm_fd);
 
tests/kms_flip.c +1 -0
index 393d690a..b94c068b 100644
@@ -1574,6 +1574,7 @@ int main(int argc, char **argv)
 
 	igt_fixture {
 		drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(drm_fd);
 
 		igt_enable_connectors();
 
tests/kms_flip_event_leak.c +1 -0
index f1a8abd8..42b3a703 100644
@@ -101,6 +101,7 @@ igt_simple_main
 	igt_skip_on_simulation();
 
 	data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+	igt_require_display(data.drm_fd);
 	kmstest_set_vt_graphics_mode();
 
 	igt_display_init(&data.display, data.drm_fd);
tests/kms_flip_tiling.c +1 -0
index beeb111b..54258e2f 100644
@@ -146,6 +146,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 		data.gen = intel_gen(intel_get_drm_devid(data.drm_fd));
 
 		kmstest_set_vt_graphics_mode();
tests/kms_force_connector_basic.c +1 -0
index 89431232..06c1a0cb 100644
@@ -89,6 +89,7 @@ int main(int argc, char **argv)
 		unsigned vga_connector_id = 0;
 
 		drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(drm_fd);
 		res = drmModeGetResources(drm_fd);
 		igt_assert(res);
 
tests/kms_frontbuffer_tracking.c +1 -0
index b33f3128..16fd6599 100644
@@ -1281,6 +1281,7 @@ static void init_crcs(enum pixel_format format,
 static void setup_drm(void)
 {
 	drm.fd = drm_open_driver_master(DRIVER_INTEL);
+	igt_require_display(drm.fd);
 	drm.debugfs = igt_debugfs_dir(drm.fd);
 
 	kmstest_set_vt_graphics_mode();
tests/kms_getfb.c +3 -1
index 81d796a4..94fd0fea 100644
@@ -198,8 +198,10 @@ igt_main
 {
 	int fd;
 
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(fd);
+	}
 
 	igt_subtest_group
 		test_handle_input(fd);
tests/kms_hdmi_inject.c +1 -0
index 22570a4b..eedc282b 100644
@@ -254,6 +254,7 @@ igt_main
 
 	igt_fixture {
 		drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(drm_fd);
 		res = drmModeGetResources(drm_fd);
 
 		connector = get_connector(drm_fd, res);
tests/kms_invalid_dotclock.c +1 -0
index e6e72f52..8c5ebab5 100644
@@ -130,6 +130,7 @@ igt_simple_main
 
 	data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 	igt_require_intel(data.drm_fd);
+	igt_require_display(data.drm_fd);
 
 	igt_enable_connectors();
 	kmstest_set_vt_graphics_mode();
tests/kms_legacy_colorkey.c +1 -0
index 150520ce..e1cc33b6 100644
@@ -48,6 +48,7 @@ igt_simple_main
 	igt_skip_on_simulation();
 
 	drm_fd = drm_open_driver_master(DRIVER_INTEL);
+	igt_require_display(drm_fd);
 
 	kmstest_set_vt_graphics_mode();
 
tests/kms_mmap_write_crc.c +1 -0
index 279d0f67..802d5a37 100644
@@ -274,6 +274,7 @@ int main(int argc, char **argv)
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
tests/kms_panel_fitting.c +1 -0
index 7df8104e..bb11399d 100644
@@ -241,6 +241,7 @@ igt_main
 		igt_skip_on_simulation();
 
 		data.drm_fd = drm_open_driver(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 		igt_display_init(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
 	}
tests/kms_pipe_b_c_ivb.c +1 -0
index 64086915..1854ff68 100644
@@ -259,6 +259,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 		devid = intel_get_drm_devid(data.drm_fd);
 		igt_skip_on(!IS_IVYBRIDGE(devid));
 
tests/kms_pipe_crc_basic.c +1 -0
index 852f1697..4a6e950b 100644
@@ -180,6 +180,7 @@ igt_main
 {
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 
 		igt_enable_connectors();
 
tests/kms_plane.c +1 -0
index 3999dde8..385d475e 100644
@@ -581,6 +581,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
tests/kms_plane_lowres.c +1 -0
index 5e83ef56..1a531f3c 100644
@@ -297,6 +297,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
tests/kms_plane_multiple.c +1 -0
index a53be001..017d791a 100644
@@ -391,6 +391,7 @@ int main(int argc, char *argv[])
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 		igt_require_pipe_crc(data.drm_fd);
 		igt_display_init(&data.display, data.drm_fd);
tests/kms_plane_scaling.c +1 -0
index 7c64ed14..3b7b41db 100644
@@ -543,6 +543,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 		igt_require_pipe_crc(data.drm_fd);
 		igt_display_init(&data.display, data.drm_fd);
 		data.devid = intel_get_drm_devid(data.drm_fd);
tests/kms_properties.c +1 -0
index 68c0518f..41e90e5f 100644
@@ -675,6 +675,7 @@ igt_main
 
 	igt_fixture {
 		display.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(display.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
tests/kms_psr.c +1 -0
index fcc04770..73bbab6b 100644
@@ -410,6 +410,7 @@ int main(int argc, char *argv[])
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 		data.devid = intel_get_drm_devid(data.drm_fd);
tests/kms_pwrite_crc.c +1 -0
index ee895db6..71aa093d 100644
@@ -178,6 +178,7 @@ igt_simple_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
tests/kms_rmfb.c +1 -0
index f3461cc9..abb854cc 100644
@@ -143,6 +143,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(data.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
tests/kms_rotation_crc.c +1 -0
index f73c6a39..fd30f3b5 100644
@@ -525,6 +525,7 @@ igt_main
 
 	igt_fixture {
 		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.gfx_fd);
 		data.devid = intel_get_drm_devid(data.gfx_fd);
 		gen = intel_gen(data.devid);
 
tests/kms_setmode.c +1 -0
index 47d04fb5..4ad4740b 100644
@@ -854,6 +854,7 @@ int main(int argc, char **argv)
 
 	igt_fixture {
 		drm_fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(drm_fd);
 		if (!dry_run)
 			kmstest_set_vt_graphics_mode();
 
tests/kms_sysfs_edid_timing.c +5 -0
index 12013881..ecdfea37 100644
@@ -41,6 +41,11 @@ igt_simple_main
 {
 	DIR *dirp;
 	struct dirent *de;
+	int drm_fd;
+
+	drm_fd = drm_open_driver_master(DRIVER_ANY);
+	igt_require_display(drm_fd);
+	close(drm_fd);
 
 	dirp = opendir("/sys/class/drm");
 	igt_assert(dirp != NULL);
tests/kms_tv_load_detect.c +1 -0
index 5684b267..6c9da3ea 100644
@@ -37,6 +37,7 @@ int main(int argc, char **argv)
 
 	igt_fixture {
 		drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(drm_fd);
 		res = drmModeGetResources(drm_fd);
 		igt_assert(res);
 
tests/kms_universal_plane.c +1 -0
index 58f329e6..1c03fad9 100644
@@ -793,6 +793,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		igt_require_display(data.drm_fd);
 		data.gen = intel_gen(intel_get_drm_devid(data.drm_fd));
 
 		kmstest_set_vt_graphics_mode();
tests/kms_vblank.c +1 -0
index 1c0771c6..90dd6e4a 100644
@@ -506,6 +506,7 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require_display(fd);
 		kmstest_set_vt_graphics_mode();
 		igt_display_init(&data.display, fd);
 		igt_display_require_output(&data.display);
tests/perf_pmu.c +7 -6
index 6ab2595b..759eca6b 100644
@@ -809,6 +809,7 @@ event_wait(int gem_fd, const struct intel_execution_engine2 *e)
 	devid = intel_get_drm_devid(gem_fd);
 	igt_require(intel_gen(devid) >= 7);
 	igt_skip_on(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid));
+	igt_require_display(gem_fd);
 
 	kmstest_set_vt_graphics_mode();
 	igt_display_init(&data.display, gem_fd);
@@ -1398,12 +1399,12 @@ test_rc6(int gem_fd, unsigned int flags)
 		drmModeRes *res;
 
 		res = drmModeGetResources(gem_fd);
-		igt_assert(res);
-
-		/* force all connectors off */
-		kmstest_set_vt_graphics_mode();
-		kmstest_unset_all_crtcs(gem_fd, res);
-		drmModeFreeResources(res);
+		if (res) {
+			/* force all connectors off */
+			kmstest_set_vt_graphics_mode();
+			kmstest_unset_all_crtcs(gem_fd, res);
+			drmModeFreeResources(res);
+		}
 
 		igt_require(igt_setup_runtime_pm());
 		igt_require(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
tests/pm_backlight.c +4 -1
index 32808cdf..ac556b3d 100644
@@ -204,6 +204,7 @@ igt_main
 		char *name;
 		drmModeModeInfo *mode;
 		igt_plane_t *primary;
+		int drm_fd;
 
 		/* Get the max value and skip the whole test if sysfs interface not available */
 		igt_skip_on(backlight_read(&old, "brightness"));
@@ -213,8 +214,10 @@ igt_main
 		 * Backlight tests requires the output to be enabled,
 		 * try to enable all.
 		 */
+		drm_fd = drm_open_driver(DRIVER_INTEL);
+		igt_require_display(drm_fd);
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&display, drm_open_driver(DRIVER_INTEL));
+		igt_display_init(&display, drm_fd);
 
 		/* should be ../../cardX-$output */
 		igt_assert_lt(12, readlink(BACKLIGHT_PATH "/device", full_name, sizeof(full_name) - 1));
tests/pm_lpsp.c +1 -0
index a741cb78..d4f96d25 100644
@@ -195,6 +195,7 @@ igt_main
 
 		drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		igt_require(drm_fd >= 0);
+		igt_require_display(drm_fd);
 
 		devid = intel_get_drm_devid(drm_fd);
 
tests/pm_rpm.c +54 -15

208 lines not on this page · raw message

tests/prime_vgem.c +2 -0
index b821fbb8..a99cd8a9 100644
@@ -747,6 +747,8 @@ static void test_flip(int i915, int vgem, unsigned hang)
 	struct vgem_bo bo[2];
 	uint32_t fb_id[2], handle[2], crtc_id;
 
+	igt_require_display(i915);
+
 	signal(SIGHUP, sighandler);
 
 	for (int i = 0; i < 2; i++) {
tests/testdisplay.c +1 -0
index 0ff98a2b..a770b29f 100644
@@ -716,6 +716,7 @@ int main(int argc, char **argv)
 		test_all_modes = 1;
 
 	drm_fd = drm_open_driver(DRIVER_ANY);
+	igt_require_display(drm_fd);
 
 	if (test_stereo_modes &&
 	    drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) < 0) {
Signature · 6 lines
2.18.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tests: Check and skip tests when driver don't have display enabled (rev2)

== Series Details ==

== Series Details ==

Series: tests: Check and skip tests when driver don't have display enabled (rev2)
URL : https://patchwork.freedesktop.org/series/49314/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4806 -> IGTPW_1825 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/49314/revisions/2/mbox/

== Known issues ==

Here are the changes found in IGTPW_1825 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_coherency:
      fi-gdg-551:         PASS -> DMESG-FAIL (fdo#107164)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    igt@kms_frontbuffer_tracking@basic:
      fi-byt-clapper:     PASS -> FAIL (fdo#103167)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362) +1

    igt@pm_rpm@basic-pci-d3-state:
      fi-glk-dsi:         PASS -> INCOMPLETE (fdo#103359, k.org#198133)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS
      fi-icl-u:           INCOMPLETE (fdo#107901) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#107901 https://bugs.freedesktop.org/show_bug.cgi?id=107901
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (49 -> 44) ==

Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* IGT: IGT_4638 -> IGTPW_1825

CI_DRM_4806: feeccde66999c5e87be3550f2159e5d7eeb61c67 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1825: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1825/
IGT_4638: 20a7ead8bdf09774c7d58fcbe6a0980d08ed5365 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1825/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for tests: Check and skip tests when driver don't have display enabled (rev2)

In reply to José Roberto de Souza
== Series Details ==

== Series Details ==

Series: tests: Check and skip tests when driver don't have display enabled (rev2)
URL : https://patchwork.freedesktop.org/series/49314/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4638_full -> IGTPW_1825_full =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/49314/revisions/2/mbox/

== Known issues ==

Here are the changes found in IGTPW_1825_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@2x-flip-vs-expired-vblank:
      shard-glk:          PASS -> FAIL (fdo#105363)

    igt@testdisplay:
      shard-glk:          PASS -> INCOMPLETE (fdo#107093, fdo#103359, k.org#198133)

    
    ==== Possible fixes ====

    igt@drv_suspend@shrink:
      shard-snb:          FAIL (fdo#106886) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-pwrite:
      shard-glk:          FAIL (fdo#103167) -> PASS +1

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#107093 https://bugs.freedesktop.org/show_bug.cgi?id=107093
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* IGT: IGT_4638 -> IGTPW_1825
* Linux: CI_DRM_4798 -> CI_DRM_4806

CI_DRM_4798: b35a9812b9bbb5b562fd5b4faf7bf06fc80f59ee @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4806: feeccde66999c5e87be3550f2159e5d7eeb61c67 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1825: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1825/
IGT_4638: 20a7ead8bdf09774c7d58fcbe6a0980d08ed5365 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1825/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw
In reply to José Roberto de Souza

Quoting José Roberto de Souza (2018-09-12 00:42:52)

Quoted 81 lines

Right now i915 is not doing the full job to complete disable display when i915.disable_display parameters is set, when that is completed it will cause several tests to fail, so here skiping all the tests that depends on modeset or display block when those are not available.

v2: Not skipping all tests in debugfs_test, perf_pmu and perf_pmu, now skiping only the required subtests

---
 lib/igt_kms.c                     | 20 +++++++++
 lib/igt_kms.h                     |  1 +
 tests/debugfs_test.c              | 13 +++++-
 tests/gem_exec_nop.c              |  1 +
 tests/kms_3d.c                    |  1 +
 tests/kms_addfb_basic.c           |  4 +-
 tests/kms_atomic.c                |  1 +
 tests/kms_atomic_interruptible.c  |  1 +
 tests/kms_available_modes_crc.c   |  1 +
 tests/kms_busy.c                  |  1 +
 tests/kms_ccs.c                   |  1 +
 tests/kms_chamelium.c             |  1 +
 tests/kms_chv_cursor_fail.c       |  1 +
 tests/kms_color.c                 |  1 +
 tests/kms_concurrent.c            |  1 +
 tests/kms_crtc_background_color.c |  1 +
 tests/kms_cursor_crc.c            |  1 +
 tests/kms_cursor_legacy.c         |  1 +
 tests/kms_draw_crc.c              |  1 +
 tests/kms_fbcon_fbt.c             |  1 +
 tests/kms_fence_pin_leak.c        |  1 +
 tests/kms_flip.c                  |  1 +
 tests/kms_flip_event_leak.c       |  1 +
 tests/kms_flip_tiling.c           |  1 +
 tests/kms_force_connector_basic.c |  1 +
 tests/kms_frontbuffer_tracking.c  |  1 +
 tests/kms_getfb.c                 |  4 +-
 tests/kms_hdmi_inject.c           |  1 +
 tests/kms_invalid_dotclock.c      |  1 +
 tests/kms_legacy_colorkey.c       |  1 +
 tests/kms_mmap_write_crc.c        |  1 +
 tests/kms_panel_fitting.c         |  1 +
 tests/kms_pipe_b_c_ivb.c          |  1 +
 tests/kms_pipe_crc_basic.c        |  1 +
 tests/kms_plane.c                 |  1 +
 tests/kms_plane_lowres.c          |  1 +
 tests/kms_plane_multiple.c        |  1 +
 tests/kms_plane_scaling.c         |  1 +
 tests/kms_properties.c            |  1 +
 tests/kms_psr.c                   |  1 +
 tests/kms_pwrite_crc.c            |  1 +
 tests/kms_rmfb.c                  |  1 +
 tests/kms_rotation_crc.c          |  1 +
 tests/kms_setmode.c               |  1 +
 tests/kms_sysfs_edid_timing.c     |  5 +++
 tests/kms_tv_load_detect.c        |  1 +
 tests/kms_universal_plane.c       |  1 +
 tests/kms_vblank.c                |  1 +
 tests/perf_pmu.c                  | 13 +++---
 tests/pm_backlight.c              |  5 ++-
 tests/pm_lpsp.c                   |  1 +
 tests/pm_rpm.c                    | 69 ++++++++++++++++++++++++-------
 tests/prime_vgem.c                |  2 +
 tests/testdisplay.c               |  1 +
 54 files changed, 155 insertions(+), 25 deletions(-)
lib/igt_kms.c +3 -0
index 4563bfd9..a12d4b79 100644
@@ -2018,6 +2018,26 @@ int igt_display_get_n_pipes(igt_display_t *display)
        return display->n_pipes;
 }
 
+/**
+ * igt_display_require_output:
+ * @drm_fd: a drm file descriptor

lib/igt_kms.c int igt_display_get_n_pipes(igt_display_t *display) · line 2033

Quoted 10 lines
lib/igt_kms.c +10 -0
+ *
+ * Checks if driver supports modeset and have display enabled.
+ */
+void igt_require_display(int fd)
+{
+       drmModeRes *resources;
+       int pipes;
+
+       resources = drmModeGetResources(fd);
+       igt_require_f(resources, "drm driver do not support modeset\n");

Do you still not know how to do this without an allocation?

lib/igt_kms.c int igt_display_get_n_pipes(igt_display_t *display) · line 2037

Quoted 4 lines
lib/igt_kms.c +3 -0
        igt_subtest("read_all_entries") {
+               if (!display.n_pipes) {
+                       igt_require_display(fd);
+                       igt_display_init(&display, fd);

No, this test does not depend on there being a display.

Quoted 20 lines
lib/igt_kms.c +5 -0
                /* try to light all pipes */
                for_each_pipe(&display, pipe) {
                        igt_output_t *output;
@@ -140,6 +146,11 @@ igt_main
                igt_output_t *output;
                igt_plane_t *plane;
 
+               if (!display.n_pipes) {
+                       igt_require_display(fd);
+                       igt_display_init(&display, fd);
+               }
+
                for_each_connected_output(&display, output)
                        igt_output_set_pipe(output, PIPE_NONE);
 
tests/gem_exec_nop.c +0 -0
index 74d27522..1cd3d70d 100644

tests/gem_exec_nop.c static void headless(int fd, uint32_t handle) · line 284

Quoted 6 lines
tests/gem_exec_nop.c +1 -0
@@ -279,6 +279,7 @@ static void headless(int fd, uint32_t handle)
        drmModeRes *res;
        double n_display, n_headless;
 
+       igt_require_display(fd);
        res = drmModeGetResources(fd);
        igt_assert(res);

This already skips without a display.

I expect all the others that iterate over resources handle the absence of their target setup similarly.

Quoted 17 lines
tests/kms_3d.c +1 -0
index bfc981ee..830b3321 100644
@@ -36,6 +36,7 @@ igt_simple_main
        int mode_count, connector_id;
 
        drm_fd = drm_open_driver_master(DRIVER_INTEL);
+       igt_require_display(drm_fd);
        res = drmModeGetResources(drm_fd);
 
        igt_assert(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) >= 0);
tests/kms_addfb_basic.c +0 -0
index ce48d24f..ce4caa5e 100644

tests/kms_addfb_basic.c int fd; · line 677

Quoted 8 lines
tests/kms_addfb_basic.c +3 -1
@@ -671,8 +671,10 @@ int fd;
 
 igt_main
 {
-       igt_fixture
+       igt_fixture {
                fd = drm_open_driver_master(DRIVER_ANY);
+               igt_require_display(fd);
+       }

Does not require a display, just the addfb interface.

Etc.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw
Quoted 82 lines · Chris Wilson

Quoting José Roberto de Souza (2018-09-12 00:42:52)

Quoted 81 lines

Right now i915 is not doing the full job to complete disable display
when i915.disable_display parameters is set, when that is completed it will cause several tests to fail, so here skiping all the tests that depends on modeset or display block when those are not available.

v2: Not skipping all tests in debugfs_test, perf_pmu and perf_pmu, now skiping only the required subtests

---
 lib/igt_kms.c                     | 20 +++++++++
 lib/igt_kms.h                     |  1 +
 tests/debugfs_test.c              | 13 +++++-
 tests/gem_exec_nop.c              |  1 +
 tests/kms_3d.c                    |  1 +
 tests/kms_addfb_basic.c           |  4 +-
 tests/kms_atomic.c                |  1 +
 tests/kms_atomic_interruptible.c  |  1 +
 tests/kms_available_modes_crc.c   |  1 +
 tests/kms_busy.c                  |  1 +
 tests/kms_ccs.c                   |  1 +
 tests/kms_chamelium.c             |  1 +
 tests/kms_chv_cursor_fail.c       |  1 +
 tests/kms_color.c                 |  1 +
 tests/kms_concurrent.c            |  1 +
 tests/kms_crtc_background_color.c |  1 +
 tests/kms_cursor_crc.c            |  1 +
 tests/kms_cursor_legacy.c         |  1 +
 tests/kms_draw_crc.c              |  1 +
 tests/kms_fbcon_fbt.c             |  1 +
 tests/kms_fence_pin_leak.c        |  1 +
 tests/kms_flip.c                  |  1 +
 tests/kms_flip_event_leak.c       |  1 +
 tests/kms_flip_tiling.c           |  1 +
 tests/kms_force_connector_basic.c |  1 +
 tests/kms_frontbuffer_tracking.c  |  1 +
 tests/kms_getfb.c                 |  4 +-
 tests/kms_hdmi_inject.c           |  1 +
 tests/kms_invalid_dotclock.c      |  1 +
 tests/kms_legacy_colorkey.c       |  1 +
 tests/kms_mmap_write_crc.c        |  1 +
 tests/kms_panel_fitting.c         |  1 +
 tests/kms_pipe_b_c_ivb.c          |  1 +
 tests/kms_pipe_crc_basic.c        |  1 +
 tests/kms_plane.c                 |  1 +
 tests/kms_plane_lowres.c          |  1 +
 tests/kms_plane_multiple.c        |  1 +
 tests/kms_plane_scaling.c         |  1 +
 tests/kms_properties.c            |  1 +
 tests/kms_psr.c                   |  1 +
 tests/kms_pwrite_crc.c            |  1 +
 tests/kms_rmfb.c                  |  1 +
 tests/kms_rotation_crc.c          |  1 +
 tests/kms_setmode.c               |  1 +
 tests/kms_sysfs_edid_timing.c     |  5 +++
 tests/kms_tv_load_detect.c        |  1 +
 tests/kms_universal_plane.c       |  1 +
 tests/kms_vblank.c                |  1 +
 tests/perf_pmu.c                  | 13 +++---
 tests/pm_backlight.c              |  5 ++-
 tests/pm_lpsp.c                   |  1 +
 tests/pm_rpm.c                    | 69 ++++++++++++++++++++++++---
----
 tests/prime_vgem.c                |  2 +
 tests/testdisplay.c               |  1 +
 54 files changed, 155 insertions(+), 25 deletions(-)
lib/igt_kms.c +0 -0
index 4563bfd9..a12d4b79 100644
@@ -2018,6 +2018,26 @@ int igt_display_get_n_pipes(igt_display_t
 *display)
        return display->n_pipes;
 }
 
Quoted 16 lines
Quoted 4 lines
lib/igt_kms.c +4 -0
+/**
+ * igt_display_require_output:
+ * @drm_fd: a drm file descriptor
+ *

lib/igt_kms.c int igt_display_get_n_pipes(igt_display_t *display)

Quoted 10 lines
lib/igt_kms.c +9 -0
+ * Checks if driver supports modeset and have display enabled.
+ */
+void igt_require_display(int fd)
+{
+       drmModeRes *resources;
+       int pipes;
+
+       resources = drmModeGetResources(fd);
+       igt_require_f(resources, "drm driver do not support
 modeset\n");

Do you still not know how to do this without an allocation?

Okay, now I changed it.

Quoted 6 lines

lib/igt_kms.c int igt_display_get_n_pipes(igt_display_t · line 2039

Quoted 4 lines
lib/igt_kms.c +3 -0
        igt_subtest("read_all_entries") {
+               if (!display.n_pipes) {
+                       igt_require_display(fd);
+                       igt_display_init(&display, fd);

No, this test does not depend on there being a display.

Okay, so I will just jump to read_and_discard_sysfs_entries()

Quoted 24 lines
Quoted 24 lines
lib/igt_kms.c +5 -0
                /* try to light all pipes */
                for_each_pipe(&display, pipe) {
                        igt_output_t *output;
@@ -140,6 +146,11 @@ igt_main
                igt_output_t *output;
                igt_plane_t *plane;
 
+               if (!display.n_pipes) {
+                       igt_require_display(fd);
+                       igt_display_init(&display, fd);
+               }
+
                for_each_connected_output(&display, output)
                        igt_output_set_pipe(output, PIPE_NONE);
 
tests/gem_exec_nop.c +0 -0
index 74d27522..1cd3d70d 100644
@@ -279,6 +279,7 @@ static void headless(int fd, uint32_t handle)
        drmModeRes *res;
        double n_display, n_headless;
 
Quoted 5 lines

tests/gem_exec_nop.c static void headless(int fd, uint32_t handle) · line 284

Quoted 3 lines
tests/gem_exec_nop.c +1 -0
+       igt_require_display(fd);
        res = drmModeGetResources(fd);
        igt_assert(res);

This already skips without a display.

Oh true, if the igt_device_set_master() fails it skips, thanks.

Quoted 24 lines

I expect all the others that iterate over resources handle the absence
of their target setup similarly.

Quoted 19 lines
tests/kms_3d.c +1 -0
index bfc981ee..830b3321 100644
@@ -36,6 +36,7 @@ igt_simple_main
        int mode_count, connector_id;
 
        drm_fd = drm_open_driver_master(DRIVER_INTEL);
+       igt_require_display(drm_fd);
        res = drmModeGetResources(drm_fd);
 
        igt_assert(drmSetClientCap(drm_fd,

DRM_CLIENT_CAP_STEREO_3D, 1) >= 0);

tests/kms_addfb_basic.c +0 -0
index ce48d24f..ce4caa5e 100644
@@ -671,8 +671,10 @@ int fd;
 
Quoted 9 lines

tests/kms_addfb_basic.c int fd; · line 677

Quoted 7 lines
tests/kms_addfb_basic.c +3 -1
 igt_main
 {
-       igt_fixture
+       igt_fixture {
                fd = drm_open_driver_master(DRIVER_ANY);
+               igt_require_display(fd);
+       }

Does not require a display, just the addfb interface.

You mean add the addfb interface in kernel when loading driver with display off? Okay this test is not setting the FB to any CRTC but why would we want to test that with display off?
Also to do that we would need to keep DRIVER_MODESET set with display off otherwise drm_mode_addfb2() would fail.

Quoted 3 lines

Etc.
-Chris

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev