[igt-dev] [PATCH i-g-t 2/5] tests: Use igt_display_require

Daniel Vetter daniel.vetter at ffwll.ch
Thu Nov 22 09:36:57 UTC 2018


Remaining tests that have been overlooked and don't need any
invasive changes to limit the skipping to only the relevant parts.

v2: [A rebase gone wrong]

v3: Move the misplaced hunk to the right patch (Antonio).

v4: Rebase, kms_content_protection is new.

v5: Rebase - need to adjust kms_lease.c too.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com> (v3)
Cc: Antonio Argenziano <antonio.argenziano at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 lib/igt_chamelium.c               |  2 +-
 tests/kms_atomic_interruptible.c  |  4 ++--
 tests/kms_content_protection.c    |  3 ++-
 tests/kms_force_connector_basic.c |  2 +-
 tests/kms_getfb.c                 |  2 +-
 tests/kms_lease.c                 | 10 +++++-----
 tests/kms_plane_alpha_blend.c     |  2 +-
 tests/kms_sequence.c              |  2 +-
 tests/perf_pmu.c                  |  2 +-
 tests/pm_backlight.c              |  2 +-
 tests/prime_mmap_kms.c            |  2 +-
 11 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index a80ead163846..d136fb04c342 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1547,7 +1547,7 @@ static void chamelium_exit_handler(int sig)
 /**
  * chamelium_init:
  * @chamelium: The Chamelium instance to use
- * @drm_fd: a display initialized with #igt_display_init
+ * @drm_fd: a display initialized with #igt_display_require
  *
  * Sets up a connection with a chamelium, using the URL specified in the
  * Chamelium configuration. This must be called first before trying to use the
diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 8e9d4cb69c4d..be688638973f 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -85,8 +85,8 @@ static void run_plane_test(igt_display_t *display, enum pipe pipe, igt_output_t
 
 	/*
 	 * Make sure we start with everything disabled to force a real modeset.
-	 * igt_display_init only sets sw state, and assumes the first test doesn't care
-	 * about hw state.
+	 * igt_display_require only sets sw state, and assumes the first test
+	 * doesn't care about hw state.
 	 */
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index ef90ed4c1792..50ae82862949 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -26,6 +26,7 @@
 #include <fcntl.h>
 #include "igt.h"
 #include "igt_sysfs.h"
+#include "igt_kms.h"
 
 IGT_TEST_DESCRIPTION("Test content protection (HDCP)");
 
@@ -291,7 +292,7 @@ igt_main
 
 		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_subtest("legacy")
diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
index e9325dec9305..b8246e669939 100644
--- a/tests/kms_force_connector_basic.c
+++ b/tests/kms_force_connector_basic.c
@@ -217,7 +217,7 @@ int main(int argc, char **argv)
 
 		/* attempt to use the display */
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&display, drm_fd);
+		igt_display_require(&display, drm_fd);
 		igt_display_commit(&display);
 		igt_display_fini(&display);
 
diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c
index 07ffd79c4613..ca0b01c05e5c 100644
--- a/tests/kms_getfb.c
+++ b/tests/kms_getfb.c
@@ -116,7 +116,7 @@ static uint32_t get_any_prop_id(int fd)
 {
 	igt_display_t display;
 
-	igt_display_init(&display, fd);
+	igt_display_require(&display, fd);
 	for (int i = 0; i < display.n_outputs; i++) {
 		igt_output_t *output = &display.outputs[i];
 		if (output->props[IGT_CONNECTOR_DPMS] != 0)
diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index e98c2a0f3506..cca424598ea7 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -294,7 +294,7 @@ static void simple_lease(data_t *data)
 	/* Create a valid lease */
 	igt_assert_eq(make_lease(data, &lease), 0);
 
-	igt_display_init(&lease.display, lease.fd);
+	igt_display_require(&lease.display, lease.fd);
 
 	/* Set a mode on the leased output */
 	igt_assert_eq(0, prepare_crtc(&lease, data->connector_id, data->crtc_id));
@@ -432,7 +432,7 @@ static void lease_unleased_crtc(data_t *data)
 	/* Create a valid lease */
 	igt_assert_eq(make_lease(data, &lease), 0);
 
-	igt_display_init(&lease.display, lease.fd);
+	igt_display_require(&lease.display, lease.fd);
 
 	/* Find another CRTC that we don't control */
 	bad_crtc_id = 0;
@@ -474,7 +474,7 @@ static void lease_unleased_connector(data_t *data)
 	/* Create a valid lease */
 	igt_assert_eq(make_lease(data, &lease), 0);
 
-	igt_display_init(&lease.display, lease.fd);
+	igt_display_require(&lease.display, lease.fd);
 
 	/* Find another connector that we don't control */
 	bad_connector_id = 0;
@@ -509,7 +509,7 @@ static void lease_revoke(data_t *data)
 	/* Create a valid lease */
 	igt_assert_eq(make_lease(data, &lease), 0);
 
-	igt_display_init(&lease.display, lease.fd);
+	igt_display_require(&lease.display, lease.fd);
 
 	/* Revoke the lease using the master fd */
 	mrl.lessee_id = lease.lessee_id;
@@ -633,7 +633,7 @@ igt_main
 	igt_fixture {
 		data.master.fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&data.master.display, data.master.fd);
+		igt_display_require(&data.master.display, data.master.fd);
 	}
 
 	for (f = funcs; f->name; f++) {
diff --git a/tests/kms_plane_alpha_blend.c b/tests/kms_plane_alpha_blend.c
index 3fab118ae0e1..1d9d8933d7e2 100644
--- a/tests/kms_plane_alpha_blend.c
+++ b/tests/kms_plane_alpha_blend.c
@@ -565,7 +565,7 @@ igt_main
 	igt_fixture {
 		data.gfx_fd = drm_open_driver(DRIVER_ANY);
 		igt_require_pipe_crc(data.gfx_fd);
-		igt_display_init(&data.display, data.gfx_fd);
+		igt_display_require(&data.display, data.gfx_fd);
 		igt_require(data.display.is_atomic);
 	}
 
diff --git a/tests/kms_sequence.c b/tests/kms_sequence.c
index c68f7707c7a4..6383b0ca41e4 100644
--- a/tests/kms_sequence.c
+++ b/tests/kms_sequence.c
@@ -300,7 +300,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);
 	}
 
 	for (f = funcs; f->name; f++) {
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index b34bc66ce2c4..21292bf3a2fe 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -811,7 +811,7 @@ event_wait(int gem_fd, const struct intel_execution_engine2 *e)
 	igt_skip_on(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid));
 
 	kmstest_set_vt_graphics_mode();
-	igt_display_init(&data.display, gem_fd);
+	igt_display_require(&data.display, gem_fd);
 
 	/**
 	 * We will use the display to render event forwarind so need to
diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
index 32808cdf6ca4..054300f6e2e1 100644
--- a/tests/pm_backlight.c
+++ b/tests/pm_backlight.c
@@ -214,7 +214,7 @@ igt_main
 		 * try to enable all.
 		 */
 		kmstest_set_vt_graphics_mode();
-		igt_display_init(&display, drm_open_driver(DRIVER_INTEL));
+		igt_display_require(&display, drm_open_driver(DRIVER_INTEL));
 
 		/* should be ../../cardX-$output */
 		igt_assert_lt(12, readlink(BACKLIGHT_PATH "/device", full_name, sizeof(full_name) - 1));
diff --git a/tests/prime_mmap_kms.c b/tests/prime_mmap_kms.c
index faace4afd478..fdc37214d96d 100644
--- a/tests/prime_mmap_kms.c
+++ b/tests/prime_mmap_kms.c
@@ -248,7 +248,7 @@ igt_main
 
 		igt_require_pipe_crc(gpu.drm_fd);
 
-		igt_display_init(&gpu.display, gpu.drm_fd);
+		igt_display_require(&gpu.display, gpu.drm_fd);
 	}
 
 	igt_subtest("buffer-sharing")
-- 
2.19.1



More information about the igt-dev mailing list