[PATCH i-g-t 1/2] tests/chamelium/kms_chamelium_color: force connector reprobe after plugging ports

Kunal Joshi kunal1.joshi at intel.com
Tue Apr 15 06:37:41 UTC 2025


Force reprobe connector status after plugging to assure
we always have DRM_MODE_CONNECTED status for the connector
before proceding with the test.

v2: use Closes tag (Swati)

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2371
Cc: Swati Sharma <swati2.sharma at intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 tests/chamelium/kms_chamelium_color.c | 25 +++++++++++++++++++++----
 tests/meson.build                     |  2 +-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/tests/chamelium/kms_chamelium_color.c b/tests/chamelium/kms_chamelium_color.c
index 5f61bc2ec..bf6510969 100644
--- a/tests/chamelium/kms_chamelium_color.c
+++ b/tests/chamelium/kms_chamelium_color.c
@@ -31,6 +31,7 @@
  */
 
 #include "kms_color_helper.h"
+#include "kms_chamelium_helper.h"
 
 /**
  * SUBTEST: degamma
@@ -736,13 +737,29 @@ igt_main
 
 		if (!data.port_count)
 			igt_skip("No ports connected\n");
+
 		/*
-		 * We don't cause any harm by plugging
-		 * discovered ports, just incase they are not plugged
-		 * we currently skip in test_setup
+		 * The behavior differs based on the availability of port mappings:
+		 * - When using port mappings (chamelium_read_port_mappings),
+		 *   ports are not plugged
+		 * - During autodiscovery, all ports are plugged at the end.
+		 *
+		 * This quick workaround (unplug, plug, and re-probe the connectors)
+		 * prevents any ports from being unintentionally skipped in test_setup.
 		 */
-		for( i = 0; i < data.port_count; i++)
+		for(i = 0; i < data.port_count; i++) {
+			struct udev_monitor *mon;
+			int timeout = CHAMELIUM_HOTPLUG_TIMEOUT;
+			chamelium_unplug(data.chamelium, data.ports[i]);
+			mon = igt_watch_uevents();
 			chamelium_plug(data.chamelium, data.ports[i]);
+			igt_assert(chamelium_wait_for_hotplug(mon, &timeout));
+			igt_cleanup_uevents(mon);
+			igt_assert_f(chamelium_reprobe_connector(&data.display,
+								 data.chamelium,
+								 data.ports[i]) == DRM_MODE_CONNECTED,
+								 "Output not connected\n");
+		}
 
 		kmstest_set_vt_graphics_mode();
 	}
diff --git a/tests/meson.build b/tests/meson.build
index 9224145cf..6f0beeb0a 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -368,7 +368,7 @@ extra_sources = {
 	'testdisplay': [ 'testdisplay_hotplug.c' ],
 	'kms_color':  [ 'kms_color_helper.c' ],
 	'kms_chamelium_audio': [ join_paths ('chamelium', 'kms_chamelium_helper.c') ],
-	'kms_chamelium_color':  [ 'kms_color_helper.c' ],
+	'kms_chamelium_color':  [ 'kms_color_helper.c', join_paths ('chamelium', 'kms_chamelium_helper.c') ],
 	'kms_chamelium_edid': [ join_paths ('chamelium', 'kms_chamelium_helper.c') ],
 	'kms_chamelium_frames': [ join_paths ('chamelium', 'kms_chamelium_helper.c') ],
 	'kms_chamelium_hpd': [ join_paths ('chamelium', 'kms_chamelium_helper.c') ],
-- 
2.25.1



More information about the igt-dev mailing list