[igt-dev] [PATCH i-g-t 1/2] tests/kms_chamelium Fix DP FSM in dp-mode-timings

Kunal Joshi kunal1.joshi at intel.com
Sun May 10 19:35:50 UTC 2020


Receiver reset is always required after we set a new mode, so let's disable
the mode (reset_state() does that) before we switch to a new mode.
With this we will get the HPD pulses reliably for each iteration over
all the supoprted modes.

For more details
Refer commit: c8dc1fd926a550308b971ca7d83fe0a927a38152

Cc: Hiler Arkadiusz <arkadiusz.hiler at intel.com>
Cc: Imre Deak <imre.deak at intel.com>
Issue: https://gitlab.freedesktop.org/drm/intel/issues/262
Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 tests/kms_chamelium.c | 46 ++++++++++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 421a9006..26bf4dd5 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -1017,24 +1017,39 @@ static const char test_mode_timings_desc[] =
 	"mode detected by the Chamelium receiver matches the mode we set";
 static void test_mode_timings(data_t *data, struct chamelium_port *port)
 {
-	igt_output_t *output;
-	igt_plane_t *primary;
-	drmModeConnector *connector;
-	int fb_id, i;
-	struct igt_fb fb;
+	int i, count_modes;
 
+	i = 0;
 	igt_require(chamelium_supports_get_video_params(data->chamelium));
+	do {
+		igt_output_t *output;
+		igt_plane_t *primary;
+		drmModeConnector *connector;
+		drmModeModeInfo *mode;
+		int fb_id;
+		struct igt_fb fb;
 
-	reset_state(data, port);
+		/*
+		 * let's reset state each mode so we will get the
+		 * HPD pulses realibably
+		 */
+		reset_state(data, port);
 
-	output = prepare_output(data, port, TEST_EDID_BASE);
-	connector = chamelium_port_get_connector(data->chamelium, port, false);
-	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-	igt_assert(primary);
+		/*
+		 * modes may change due to mode pruining and link issues, so we
+		 * need to refresh the connector
+		 */
+		output = prepare_output(data, port, TEST_EDID_BASE);
+		connector = chamelium_port_get_connector(data->chamelium, port, false);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		igt_assert(primary);
 
-	igt_assert(connector->count_modes > 0);
-	for (i = 0; i < connector->count_modes; i++) {
-		drmModeModeInfo *mode = &connector->modes[i];
+		/* we may skip some modes due to above but that's ok */
+		count_modes = connector->count_modes;
+		if (i >= count_modes)
+			break;
+
+		mode = &connector->modes[i];
 
 		fb_id = igt_create_color_pattern_fb(data->drm_fd,
 						    mode->hdisplay, mode->vdisplay,
@@ -1051,9 +1066,8 @@ static void test_mode_timings(data_t *data, struct chamelium_port *port)
 		check_mode(data->chamelium, port, mode);
 
 		igt_remove_fb(data->drm_fd, &fb);
-	}
-
-	drmModeFreeConnector(connector);
+		drmModeFreeConnector(connector);
+	} while (++i < count_modes);
 }
 
 /* Set of Video Identification Codes advertised in the EDID */
-- 
2.25.1



More information about the igt-dev mailing list