From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>, Sowmiya S <sowmiya.s@intel.com>
Subject: [PATCH i-g-t 09/13] tests/intel/kms_dp_link_training: train each MST topology only once
Date: Thu, 1 Oct 2026 13:06:59 +0530 [thread overview]
Message-ID: <20261001073703.5067-10-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20261001073703.5067-1-kunal1.joshi@intel.com>
The test loops over the connected outputs, so an MST topology gets
trained once per stream. The link params are forced for the whole
topology, so it's the same link trained over and over again.
Collect the DP outputs into links first, one per MST topology, and
record SST/MST and the Type-C port mode once per link. The dynamic
subtests for the other streams of a topology go away.
This prepares for selecting links by Type-C port mode.
Assisted-by: GitHub_Copilot:claude-opus-5
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Sowmiya S <sowmiya.s@intel.com>
---
tests/intel/kms_dp_link_training.c | 111 +++++++++++++++++++++++------
1 file changed, 89 insertions(+), 22 deletions(-)
diff --git a/tests/intel/kms_dp_link_training.c b/tests/intel/kms_dp_link_training.c
index 9105570d1..477dc03ba 100644
--- a/tests/intel/kms_dp_link_training.c
+++ b/tests/intel/kms_dp_link_training.c
@@ -39,6 +39,8 @@
*/
#define LINK_RECOVERY_TIMEOUT 5.0
+#define MAX_LINKS 16
+
typedef struct {
int drm_fd;
uint32_t devid;
@@ -46,6 +48,18 @@ typedef struct {
igt_output_t *output;
} data_t;
+/*
+ * struct dp_link - One trainable DP link.
+ *
+ * @output is the output the link is driven through, which for MST is the first
+ * of the topology's streams. The classification is discovered, never chosen.
+ */
+struct dp_link {
+ igt_output_t *output;
+ bool mst;
+ enum i915_dp_tc_mode tc_mode;
+};
+
/*
* check_condition_with_timeout - Polls check_fn until it returns 0
* or until 'timeout' seconds elapse.
@@ -535,42 +549,95 @@ static bool run_link_rate_test(data_t *data, bool mst, bool uhbr)
* early, then calls run_link_rate_test(). Returns true if it ran on at
* least one matching output.
*/
-static bool test_link_rate(data_t *data, bool mst, bool uhbr)
+/*
+ * discover_links - Collapse the connected DP outputs into links.
+ *
+ * One link is one trainable DP link, so a whole MST topology becomes a single
+ * entry, represented by the first of its streams. Forcing link parameters on
+ * one stream affects every stream in the topology, so training a topology once
+ * per stream would train the same link repeatedly.
+ */
+static int discover_links(data_t *data, struct dp_link *links, int max_links)
{
- bool ran_any_output = false, is_mst = false;
- igt_output_t *tmp_output;
+ igt_output_t *output;
+ int num_links = 0;
+ int i;
- igt_skip_on_f(!is_intel_device(data->drm_fd),
- "Test supported only on Intel platforms.\n");
+ for_each_connected_output(&data->display, output) {
+ bool mst, seen = false;
- for_each_connected_output(&data->display, tmp_output) {
- if (tmp_output->config.connector->connector_type !=
+ if (output->config.connector->connector_type !=
DRM_MODE_CONNECTOR_DisplayPort) {
igt_info("Skipping non-DisplayPort output %s\n",
- tmp_output->name);
- igt_info("----------------------------------------------------\n");
+ igt_output_name(output));
continue;
}
- /* Early skip if MST vs. SST does not match. */
- is_mst = igt_check_output_is_dp_mst(tmp_output);
- if (mst && !is_mst) {
- igt_info("Skipping %s: MST requested but it's SST.\n",
- tmp_output->name);
- igt_info("----------------------------------------------------\n");
+ mst = igt_check_output_is_dp_mst(output);
+
+ if (mst) {
+ int root = igt_get_dp_mst_connector_id(output);
+
+ for (i = 0; i < num_links; i++)
+ if (links[i].mst &&
+ igt_get_dp_mst_connector_id(links[i].output) == root) {
+ seen = true;
+ break;
+ }
+ }
+
+ if (seen) {
+ igt_info("Skipping %s: same MST topology as %s\n",
+ igt_output_name(output),
+ igt_output_name(links[i].output));
+ continue;
+ }
+
+ if (num_links == max_links) {
+ igt_info("Skipping %s: more than %d DP links connected\n",
+ igt_output_name(output), max_links);
continue;
- } else if (!mst && is_mst) {
- igt_info("Skipping %s: SST requested but it's MST.\n",
- tmp_output->name);
+ }
+
+ links[num_links].output = output;
+ links[num_links].mst = mst;
+ links[num_links].tc_mode = i915_dp_get_tc_mode(data->drm_fd,
+ output, NULL, NULL);
+ num_links++;
+ }
+
+ return num_links;
+}
+
+static bool test_link_rate(data_t *data, bool mst, bool uhbr)
+{
+ struct dp_link links[MAX_LINKS];
+ bool ran_any_link = false;
+ int num_links;
+ int i;
+
+ igt_skip_on_f(!is_intel_device(data->drm_fd),
+ "Test supported only on Intel platforms.\n");
+
+ num_links = discover_links(data, links, ARRAY_SIZE(links));
+
+ for (i = 0; i < num_links; i++) {
+ if (links[i].mst != mst) {
+ igt_info("Skipping %s: %s requested but it's %s.\n",
+ igt_output_name(links[i].output),
+ mst ? "MST" : "SST",
+ links[i].mst ? "MST" : "SST");
igt_info("----------------------------------------------------\n");
continue;
}
- data->output = tmp_output;
+
+ data->output = links[i].output;
igt_info("Running link training test for %s\n",
- data->output->name);
- ran_any_output = ran_any_output | run_link_rate_test(data, mst, uhbr);
+ igt_output_name(data->output));
+ ran_any_link |= run_link_rate_test(data, mst, uhbr);
}
- return ran_any_output;
+
+ return ran_any_link;
}
IGT_TEST_DESCRIPTION("Test to validate link training on SST/MST with "
--
2.25.1
next prev parent reply other threads:[~2026-10-01 7:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 7:36 [PATCH i-g-t 00/13] Expand kms_dp_link_training coverage Kunal Joshi
2026-10-01 7:36 ` [PATCH i-g-t 01/13] lib/i915/i915_dp: add helpers for the allowed link configs debugfs Kunal Joshi
2026-10-01 7:36 ` [PATCH i-g-t 02/13] tests/intel/kms_dp_link_training: use i915_dp_is_uhbr_rate() Kunal Joshi
2026-10-01 7:36 ` [PATCH i-g-t 03/13] tests/intel/kms_dp_link_training: extract train_link_config() Kunal Joshi
2026-10-01 7:36 ` [PATCH i-g-t 04/13] tests/intel/kms_dp_link_training: detect links that failed training Kunal Joshi
2026-10-01 9:05 ` S, Sowmiya
2026-10-01 7:36 ` [PATCH i-g-t 05/13] tests/intel/kms_dp_link_training: use the lowest pixel clock mode Kunal Joshi
2026-10-01 7:36 ` [PATCH i-g-t 06/13] tests/intel/kms_dp_link_training: train all allowed link configs Kunal Joshi
2026-10-01 9:05 ` S, Sowmiya
2026-10-01 7:36 ` [PATCH i-g-t 07/13] lib/i915/i915_dp: add i915_dp_get_tc_mode() Kunal Joshi
2026-10-01 7:36 ` [PATCH i-g-t 08/13] tests/intel/kms_dp_link_training: log the DP link inventory Kunal Joshi
2026-10-01 7:36 ` Kunal Joshi [this message]
2026-10-01 7:37 ` [PATCH i-g-t 10/13] tests/intel/kms_dp_link_training: add tbt-alt and direct link subtests Kunal Joshi
2026-10-01 7:37 ` [PATCH i-g-t 11/13] lib/igt_dp: add DPCD read helpers Kunal Joshi
2026-10-01 7:37 ` [PATCH i-g-t 12/13] lib/igt_dp: add DPCD link status and channel coding checks Kunal Joshi
2026-10-01 7:37 ` [PATCH i-g-t 13/13] tests/intel/kms_dp_link_training: check the link from the sink side Kunal Joshi
2026-10-01 13:13 ` ✓ i915.CI.BAT: success for Expand kms_dp_link_training coverage (rev2) Patchwork
2026-10-01 16:42 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-01 21:02 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-05 16:06 ` Joshi, Kunal1
2026-10-02 17:18 ` ✗ i915.CI.Full: " Patchwork
2026-10-05 16:04 ` Joshi, Kunal1
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=20261001073703.5067-10-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=sowmiya.s@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