[Intel-gfx] [PATCH 06/10] lib/igt_kms: set_vt_graphics_mode is a low-level helper

Daniel Vetter daniel.vetter at ffwll.ch
Tue Aug 12 12:12:01 CEST 2014


So give it a kmstest_ prefix and shuffle it around a bit.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 lib/igt_kms.c               | 14 +++++++++-----
 lib/igt_kms.h               |  9 ++++++---
 tests/kms_cursor_crc.c      |  2 +-
 tests/kms_fbc_crc.c         |  2 +-
 tests/kms_fence_pin_leak.c  |  2 +-
 tests/kms_flip.c            |  2 +-
 tests/kms_flip_event_leak.c |  2 +-
 tests/kms_flip_tiling.c     |  2 +-
 tests/kms_force_connector.c |  2 +-
 tests/kms_mmio_vs_cs_flip.c |  2 +-
 tests/kms_pipe_crc_basic.c  |  2 +-
 tests/kms_plane.c           |  2 +-
 tests/kms_psr_sink_crc.c    |  2 +-
 tests/kms_render.c          |  2 +-
 tests/kms_rotation_crc.c    |  2 +-
 tests/kms_setmode.c         |  2 +-
 tests/kms_sink_crc_basic.c  |  2 +-
 tests/kms_universal_plane.c |  2 +-
 tests/pm_lpsp.c             |  2 +-
 tests/pm_rpm.c              |  2 +-
 tests/testdisplay.c         |  2 +-
 21 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index fec859c01e97..e28d7a825683 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -287,12 +287,16 @@ static void restore_vt_mode_at_exit(int sig)
 		set_vt_mode(orig_vt_mode);
 }
 
-/*
- * Set the VT to graphics mode and install an exit handler to restore the
- * original mode.
+/**
+ * kmstest_set_vt_graphics_mode:
+ *
+ * Sets the controlling VT (if available) into graphics/raw mode and installs an
+ * igt exit handler to set the VT back to text mode on exit.
+ *
+ * All kms tests must call this function to make sure that the fbcon doesn't
+ * interfere by e.g. blanking the screen.
  */
-
-void igt_set_vt_graphics_mode(void)
+void kmstest_set_vt_graphics_mode(void)
 {
 	long ret;
 
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 342208a5c86e..09f15455396d 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -36,6 +36,8 @@
 
 #include "igt_fb.h"
 
+/* Low-level helpers with kmstest_ prefix */
+
 enum pipe {
         PIPE_A = 0,
         PIPE_B,
@@ -163,6 +165,10 @@ void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources);
  * A small modeset API
  */
 
+/* set vt into graphics mode, required to prevent fbcon from interfering */
+void kmstest_set_vt_graphics_mode(void);
+
+/* High-level kms api with igt_ prefix */
 enum igt_commit_style {
 	COMMIT_LEGACY = 0,
 	COMMIT_UNIVERSAL,
@@ -239,9 +245,6 @@ struct igt_display {
 	bool has_universal_planes;
 };
 
-/* set vt into graphics mode, required to prevent fbcon from interfering */
-void igt_set_vt_graphics_mode(void);
-
 void igt_display_init(igt_display_t *display, int drm_fd);
 void igt_display_fini(igt_display_t *display);
 int  igt_display_commit2(igt_display_t *display, enum igt_commit_style s);
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index e724073287ae..6af30fda40af 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -440,7 +440,7 @@ igt_main
 		/* We assume width and height are same so max is assigned width */
 		igt_assert_cmpint(cursor_width, ==, cursor_height);
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc();
 
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 4302d1b4b54a..9aeffd09a145 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -499,7 +499,7 @@ igt_main
 		FILE *status;
 
 		data.drm_fd = drm_open_any();
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index 6a05d977217c..51bc72f118bf 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -216,7 +216,7 @@ igt_simple_main
 
 	data.devid = intel_get_drm_devid(data.drm_fd);
 
-	igt_set_vt_graphics_mode();
+	kmstest_set_vt_graphics_mode();
 
 	data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
 	igt_assert(data.bufmgr);
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 92f4eb52ebe0..45f1ba2fc9f4 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1596,7 +1596,7 @@ int main(int argc, char **argv)
 
 		igt_enable_connectors();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 		igt_install_exit_handler(kms_flip_exit_handler);
 		get_timestamp_format();
 
diff --git a/tests/kms_flip_event_leak.c b/tests/kms_flip_event_leak.c
index 99243335a17b..8cbec00e0f4b 100644
--- a/tests/kms_flip_event_leak.c
+++ b/tests/kms_flip_event_leak.c
@@ -115,7 +115,7 @@ igt_simple_main
 	igt_skip_on_simulation();
 
 	data.drm_fd = drm_open_any();
-	igt_set_vt_graphics_mode();
+	kmstest_set_vt_graphics_mode();
 
 	igt_display_init(&data.display, data.drm_fd);
 
diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c
index ca20ad96bc35..6f8ee9413369 100644
--- a/tests/kms_flip_tiling.c
+++ b/tests/kms_flip_tiling.c
@@ -128,7 +128,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_any();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc();
 		igt_display_init(&data.display, data.drm_fd);
diff --git a/tests/kms_force_connector.c b/tests/kms_force_connector.c
index 47e2b484fa85..7dba68ace9d0 100644
--- a/tests/kms_force_connector.c
+++ b/tests/kms_force_connector.c
@@ -64,7 +64,7 @@ main (int argc, char **argv)
 	drmModeFreeConnector(temp);
 
 	/* attempt to use the display */
-	igt_set_vt_graphics_mode();
+	kmstest_set_vt_graphics_mode();
 
 	igt_display_init(&display, drm_fd);
 	igt_display_commit(&display);
diff --git a/tests/kms_mmio_vs_cs_flip.c b/tests/kms_mmio_vs_cs_flip.c
index 314a31d83326..243e4244239b 100644
--- a/tests/kms_mmio_vs_cs_flip.c
+++ b/tests/kms_mmio_vs_cs_flip.c
@@ -546,7 +546,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_any();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index a93c20fa0f27..15aba2f23e58 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -233,7 +233,7 @@ igt_main
 
 		igt_enable_connectors();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc();
 
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 2e552fdc0ff9..42af2fb88f07 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -381,7 +381,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_any();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc();
 		igt_display_init(&data.display, data.drm_fd);
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 9cae9a6a844e..324f9b40f28a 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -592,7 +592,7 @@ igt_main
 
 	igt_fixture {
 		data.drm_fd = drm_open_any();
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
diff --git a/tests/kms_render.c b/tests/kms_render.c
index 84cda80a040e..d8d157c41ce9 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -236,7 +236,7 @@ igt_main
 		devid = intel_get_drm_devid(drm_fd);
 		batch = intel_batchbuffer_alloc(bufmgr, devid);
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 	}
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5041f906f165..9146b4fcf7f9 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -195,7 +195,7 @@ igt_main
 	igt_fixture {
 		data.gfx_fd = drm_open_any();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc();
 
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 46edf54b1d13..f4197854b355 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -714,7 +714,7 @@ int main(int argc, char **argv)
 	igt_fixture {
 		drm_fd = drm_open_any();
 		if (!dry_run)
-			igt_set_vt_graphics_mode();
+			kmstest_set_vt_graphics_mode();
 
 		drm_resources = drmModeGetResources(drm_fd);
 		igt_assert(drm_resources);
diff --git a/tests/kms_sink_crc_basic.c b/tests/kms_sink_crc_basic.c
index 087b79db4b36..079ec89697ed 100644
--- a/tests/kms_sink_crc_basic.c
+++ b/tests/kms_sink_crc_basic.c
@@ -180,7 +180,7 @@ igt_simple_main
 
 	data.drm_fd = drm_open_any();
 
-	igt_set_vt_graphics_mode();
+	kmstest_set_vt_graphics_mode();
 
 	data.resources = drmModeGetResources(data.drm_fd);
 	igt_assert(data.resources);
diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 805cc596c70b..2e67e2423b58 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -561,7 +561,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_any();
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 
 		igt_require_pipe_crc();
 		igt_display_init(&data.display, data.drm_fd);
diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c
index af274776a757..250b1406dca3 100644
--- a/tests/pm_lpsp.c
+++ b/tests/pm_lpsp.c
@@ -245,7 +245,7 @@ igt_main
 
 		intel_register_access_init(intel_get_pci_device(), 0);
 
-		igt_set_vt_graphics_mode();
+		kmstest_set_vt_graphics_mode();
 	}
 
 	igt_subtest("screens-disabled")
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 59a182a94265..841566ba1707 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -404,7 +404,7 @@ static void init_mode_set_data(struct mode_set_data *data)
 
 	data->devid = intel_get_drm_devid(drm_fd);
 
-	igt_set_vt_graphics_mode();
+	kmstest_set_vt_graphics_mode();
 
 	init_modeset_cached_params(&ms_data);
 }
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index f26d94252c1b..cfc629a15620 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -849,7 +849,7 @@ int main(int argc, char **argv)
 		goto out_close;
 	}
 
-	igt_set_vt_graphics_mode();
+	kmstest_set_vt_graphics_mode();
 
 	mainloop = g_main_loop_new(NULL, FALSE);
 	if (!mainloop) {
-- 
2.0.1




More information about the Intel-gfx mailing list