Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>,
	Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t 1/2] tests/chamelium/kms_chamelium_color: force connector reprobe after plugging ports
Date: Tue, 15 Apr 2025 12:07:41 +0530	[thread overview]
Message-ID: <20250415063742.3026718-2-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20250415063742.3026718-1-kunal1.joshi@intel.com>

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@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@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


  reply	other threads:[~2025-04-15  6:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15  6:37 [PATCH i-g-t 0/2] tests/chamelium/kms_chamelium_color: force connector reprobe after plugging ports Kunal Joshi
2025-04-15  6:37 ` Kunal Joshi [this message]
2025-04-22  5:41   ` [PATCH i-g-t 1/2] " Sharma, Swati2
2025-04-15  6:37 ` [PATCH i-g-t 2/2] tests/chamelium/kms_chamelium_color: print output name in assert Kunal Joshi
2025-04-22  7:36   ` Sharma, Swati2
2025-04-24 17:18   ` Kamil Konieczny
2025-04-15  8:31 ` ✓ i915.CI.BAT: success for tests/chamelium/kms_chamelium_color: force connector reprobe after plugging ports Patchwork
2025-04-15  8:50 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-15 10:28 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-15 13:08 ` ✗ Xe.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250415063742.3026718-2-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=swati2.sharma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox