[igt-dev] [PATCH i-g-t] tests/kms_fbcon_fbt: When restoring fbcon always set mode to text mode

José Roberto de Souza jose.souza at intel.com
Fri May 29 00:52:18 UTC 2020


If by some reason or tests, this tests is executed and VT mode is
already in KD_GRAPHICS the call to kmstest_set_vt_graphics_mode() will
set orig_vt_mode as KD_GRAPHICS and when it was calling
kmstest_restore_vt_mode() it would set KD_GRAPHICS again not returning
to fbcon and causing the test to fail.

As it can be seen here:
(kms_fbcon_fbt:11004) igt_kms-DEBUG: VT: graphics mode set (mode was 0x1)"
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_499/fi-ehl-1/igt@kms_fbcon_fbt@fbc.html

So here adding a new function to alaways set mode the KD_TEXT when we
want to restore to fbcon.

Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
 lib/igt_kms.c         | 11 +++++++++++
 lib/igt_kms.h         |  1 +
 tests/kms_fbcon_fbt.c |  2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d4cbc1c53..afef59396 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -968,6 +968,17 @@ void kmstest_set_vt_graphics_mode(void)
 	igt_debug("VT: graphics mode set (mode was 0x%lx)\n", ret);
 }
 
+/**
+ * kmstest_set_vt_text_mode:
+ *
+ * Sets the controlling VT (if available) into text mode.
+ * Unlikely kmstest_set_vt_graphics_mode() it do not install an igt exit
+ * handler to set the VT back to the previous mode.
+ */
+void kmstest_set_vt_text_mode(void)
+{
+	igt_assert(set_vt_mode(KD_TEXT) >= 0);
+}
 
 static void reset_connectors_at_exit(int sig)
 {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index adca59ac6..32a0e4cc6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -93,6 +93,7 @@ void kmstest_dump_mode(drmModeModeInfo *mode);
 int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
 void kmstest_set_vt_graphics_mode(void);
 void kmstest_restore_vt_mode(void);
+void kmstest_set_vt_text_mode(void);
 
 enum igt_atomic_crtc_properties {
        IGT_CRTC_BACKGROUND = 0,
diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index e6dd4353b..e99a1f2f2 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -283,7 +283,7 @@ static void restore_fbcon(struct drm_info *drm)
 	kmstest_unset_all_crtcs(drm->fd, drm->res);
 	igt_remove_fb(drm->fd, &drm->fb);
 	igt_device_drop_master(drm->fd);
-	kmstest_restore_vt_mode();
+	kmstest_set_vt_text_mode();
 }
 
 static void subtest(struct drm_info *drm, struct feature *feature, bool suspend)
-- 
2.26.2



More information about the igt-dev mailing list