Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Yacoub <markyacoub@google.com>
To: igt-dev@lists.freedesktop.org
Cc: Louis Chauvet <louis.chauvet@bootlin.com>,
	Mark Yacoub <markyacoub@google.com>
Subject: [PATCH i-g-t] tests/unigraf_lt: Optimize DP lane count validations
Date: Thu, 13 Aug 2026 13:59:55 -0400	[thread overview]
Message-ID: <20260813175955.2450321-1-markyacoub@google.com> (raw)

Some drivers dynamically optimize power by downshifting lane utilization
if the current video mode (e.g., 1080p) has low bandwidth requirements,
regardless of the physical ceiling.

To avoid pointlessly testing artificially high lane mock ceilings
that would result in false-negative failures, we introduce a pre-check
in the lane count subtest. We safely pre-calculate the kernel's natural
max lane utilization for the current mode through an unconstrained HPD
sequence, allowing us to skip unachievable configurations.

Signed-off-by: Mark Yacoub <markyacoub@google.com>
---
 tests/unigraf/unigraf_lt.c | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/tests/unigraf/unigraf_lt.c b/tests/unigraf/unigraf_lt.c
index 81e6ecd3f..7b9a2fc27 100644
--- a/tests/unigraf/unigraf_lt.c
+++ b/tests/unigraf/unigraf_lt.c
@@ -103,12 +103,43 @@ int igt_main()
 
 	igt_subtest_with_dynamic("unigraf-dp-lane-count") {
 		int lane_counts[3] = {1, 2, 4};
+		int max_natural_lanes = 0;
 		int current_lanes;
 
+		/*
+		 * Some drivers dynamically optimize power by downshifting lane
+		 * utilization if the current video mode (e.g., 1080p) has low
+		 * bandwidth requirements, regardless of the physical ceiling.
+		 *
+		 * To avoid pointlessly testing artificially high lane mock
+		 * ceilings (e.g. testing 4 lanes when we know the driver adamantly
+		 * refuses to use more than 1 or 2 for this mode), we first
+		 * perform an unconstrained HPD sequence. We initialize the output
+		 * and observe precisely how many lanes the kernel naturally demands.
+		 */
+		unigraf_reset();
+		unigraf_set_max_lane_count(4);
+		unigraf_hpd_pulse(500000);
+
+		igt_display_require_output(&display);
+		output = igt_output_from_connector(&display, connector);
+		igt_assert(output);
+		igt_dp_force_link_retrain(drm_fd, output, 2);
+		init_output_and_display_pattern(&display, output);
+
+		max_natural_lanes = igt_dp_get_current_lane_count(drm_fd, output);
+		igt_info("Pre-check: Kernel naturally trains a maximum of %d lanes for the current mode.\n",
+			 max_natural_lanes);
+
 		for (i = 0; i < ARRAY_SIZE(lane_counts); i++) {
-			igt_dynamic_f("unigraf-dp-lane-count-%d", lane_counts[i]) {
+			int lane_count = lane_counts[i];
+
+			if (lane_count > max_natural_lanes)
+				continue;
+
+			igt_dynamic_f("unigraf-dp-lane-count-%d", lane_count) {
 				unigraf_reset();
-				unigraf_set_max_lane_count(lane_counts[i]);
+				unigraf_set_max_lane_count(lane_count);
 				unigraf_hpd_pulse(500000);
 
 				igt_display_require_output(&display);
@@ -118,7 +149,7 @@ int igt_main()
 				init_output_and_display_pattern(&display, output);
 
 				current_lanes = igt_dp_get_current_lane_count(drm_fd, output);
-				igt_assert_eq(current_lanes, lane_counts[i]);
+				igt_assert_eq(current_lanes, lane_count);
 			}
 		}
 	}
-- 
2.55.0.691.gc56d675ccc-goog


             reply	other threads:[~2026-08-13 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 17:59 Mark Yacoub [this message]
2026-08-13 21:09 ` ✓ i915.CI.BAT: success for tests/unigraf_lt: Optimize DP lane count validations Patchwork
2026-08-13 21:26 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-14  0:35 ` ✓ 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=20260813175955.2450321-1-markyacoub@google.com \
    --to=markyacoub@google.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=louis.chauvet@bootlin.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