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>,
	Imre Deak <imre.deak@intel.com>,
	Arun R Murthy <arun.r.murthy@intel.com>
Subject: [PATCH i-g-t 5/6] tests/intel/kms_linktrain_fallback: extend test for eDP connector
Date: Wed, 15 Oct 2025 15:47:58 +0530	[thread overview]
Message-ID: <20251015101759.3982477-6-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20251015101759.3982477-1-kunal1.joshi@intel.com>

Rename dp-fallback subtest name to lt-fallback and
add additional logic in test_fallback to handle eDP fallback.

In eDP fallback on the initial link training failure expectation is to retry
with max link rate and max lane count that is supported,
Further failures leads to reduction in either link rate or lane count.

v2: use helper for eDP/DP check (Jeevan)

Cc: Imre Deak <imre.deak@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/intel/kms_linktrain_fallback.c | 43 ++++++++++++++++++----------
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/tests/intel/kms_linktrain_fallback.c b/tests/intel/kms_linktrain_fallback.c
index fa58999e8..b74c5a059 100644
--- a/tests/intel/kms_linktrain_fallback.c
+++ b/tests/intel/kms_linktrain_fallback.c
@@ -18,8 +18,8 @@
 #include "kms_dsc_helper.h"
 
 /**
- * SUBTEST: dp-fallback
- * Description: Test fallback on DP connectors
+ * SUBTEST: lt-fallback
+ * Description: Test Link Training fallback on DP/eDP connectors
  *
  * SUBTEST: dsc-fallback
  * Description: Test fallback to DSC when BW isn't sufficient
@@ -336,11 +336,12 @@ static bool fix_link_status_and_recommit(data_t *data,
 	return true;
 }
 
-static void test_fallback(data_t *data, bool is_mst)
+static void test_fallback(data_t *data, bool is_mst, bool is_edp)
 {
 	int output_count, retries;
 	int max_link_rate, curr_link_rate, prev_link_rate;
 	int max_lane_count, curr_lane_count, prev_lane_count;
+	int iter = 0;
 	igt_output_t *outputs[IGT_MAX_PIPES];
 	drmModeModeInfo * modes[IGT_MAX_PIPES];
 	struct igt_fb fbs[IGT_MAX_PIPES];
@@ -365,6 +366,7 @@ static void test_fallback(data_t *data, bool is_mst)
 
 	while (!igt_get_dp_link_retrain_disabled(data->drm_fd,
 						 data->output)) {
+		iter++;
 		igt_info("Current link rate: %d, Current lane count: %d\n",
 			 prev_link_rate,
 			 prev_lane_count);
@@ -400,10 +402,19 @@ static void test_fallback(data_t *data, bool is_mst)
 		curr_link_rate = igt_get_current_link_rate(data->drm_fd, data->output);
 		curr_lane_count = igt_get_current_lane_count(data->drm_fd, data->output);
 
-		igt_assert_f((curr_link_rate < prev_link_rate ||
-			     curr_lane_count < prev_lane_count) ||
-			     ((curr_link_rate == max_link_rate && curr_lane_count == max_lane_count) && --retries),
-			     "Fallback unsuccessful\n");
+		if (is_edp && iter == 1) {
+			/* eDP first retry must stay at max, no reduction */
+			igt_assert_eq(curr_link_rate,  prev_link_rate);
+			igt_assert_eq(curr_lane_count, prev_lane_count);
+		} else {
+			/* Otherwise DP‐style fallback: either shrink or allow spurious retry */
+			igt_assert_f((curr_link_rate  < prev_link_rate ||
+				     curr_lane_count < prev_lane_count) ||
+				     ((curr_link_rate  == max_link_rate &&
+				     curr_lane_count == max_lane_count) &&
+				     --retries),
+				    "Fallback unsuccessful\n");
+		}
 
 		prev_link_rate = curr_link_rate;
 		prev_lane_count = curr_lane_count;
@@ -413,10 +424,12 @@ static void test_fallback(data_t *data, bool is_mst)
 static bool run_lt_fallback_test(data_t *data)
 {
 	bool ran = false;
+	bool is_edp = false;
 	igt_output_t *output;
 
 	for_each_connected_output(&data->display, output) {
 		data->output = output;
+		is_edp = output->config.connector->connector_type == DRM_MODE_CONNECTOR_eDP;
 
 		if (!igt_has_force_link_training_failure_debugfs(data->drm_fd,
 								 data->output)) {
@@ -425,9 +438,9 @@ static bool run_lt_fallback_test(data_t *data)
 			continue;
 		}
 
-		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) {
-			igt_info("Skipping output %s as it's not DP\n", output->name);
-				continue;
+		if (!igt_output_is_dp_family(data->output)) {
+			igt_info("Skipping output %s as it's not DP/eDP\n", output->name);
+			continue;
 		}
 
 		ran = true;
@@ -438,11 +451,12 @@ static bool run_lt_fallback_test(data_t *data)
 		if (igt_check_output_is_dp_mst(data->output)) {
 			igt_info("Testing MST output %s\n",
 				 igt_output_name(data->output));
-			test_fallback(data, true);
+			test_fallback(data, true, false);
 		} else {
-			igt_info("Testing DP output %s\n",
+			igt_info("Testing %s output %s\n",
+				 is_edp ? "eDP" : "DP",
 				 igt_output_name(data->output));
-			test_fallback(data, false);
+			test_fallback(data, false, is_edp);
 		}
 	}
 	return ran;
@@ -511,7 +525,6 @@ static void test_dsc_sst_fallback(data_t *data)
 	/* Repeatedly force link failure until DSC is required (or link is disabled) */
 	while (!igt_get_dp_link_retrain_disabled(data->drm_fd, data->output)) {
 		mon = igt_watch_uevents();
-
 		igt_assert_f(force_failure_and_wait(data, data->output,
 						    LT_FAILURE_REDUCED_CAPS,
 						    RETRAIN_COUNT, 1.0, 20.0),
@@ -616,7 +629,7 @@ igt_main
 			     "Unable to disable ignore long hpd\n");
 	}
 
-	igt_subtest("dp-fallback") {
+	igt_subtest("lt-fallback") {
 		igt_require_f(run_lt_fallback_test(&data),
 			      "Skipping test as no output found or none supports fallback\n");
 	}
-- 
2.25.1


  parent reply	other threads:[~2025-10-15 10:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 10:17 [PATCH i-g-t 0/6] extend link training test cases for eDP connector Kunal Joshi
2025-10-15 10:17 ` [PATCH i-g-t 1/6] tests/intel/kms_dp_link_training: rename to tests/intel/kms_link_training Kunal Joshi
2025-10-15 10:17 ` [PATCH i-g-t 2/6] tests/intel/kms_dp_linktrain_fallback: rename to tests/intel/kms_linktrain_fallback Kunal Joshi
2025-10-15 10:17 ` [PATCH i-g-t 3/6] lib/igt_kms: add helpers for connector type Kunal Joshi
2025-10-27  5:51   ` B, Jeevan
2025-10-15 10:17 ` [PATCH i-g-t 4/6] tests/intel/kms_link_training: extend test for eDP connector Kunal Joshi
2025-10-27  5:53   ` B, Jeevan
2025-10-15 10:17 ` Kunal Joshi [this message]
2025-10-27  6:01   ` [PATCH i-g-t 5/6] tests/intel/kms_linktrain_fallback: " B, Jeevan
2025-10-15 10:17 ` [PATCH i-g-t 6/6] HAX: Do not merge Kunal Joshi
2025-10-15 23:30 ` ✓ i915.CI.BAT: success for extend link training test cases for eDP connector (rev3) Patchwork
2025-10-15 23:34 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-16  7:31 ` ✗ i915.CI.Full: failure " Patchwork
2025-10-16 15:25 ` ✗ 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=20251015101759.3982477-6-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=imre.deak@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