[PATCH i-g-t 2/7] tests/intel/kms_mst_helper: Add helper to check for MST outputs

Kunal Joshi
2026-04-01T15:45:59Z

Add igt_display_has_mst_output() to check
if a display has at least one DP MST output
connected. This is useful for tests that need
to verify MST output availability before running.

Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
---
tests/intel/kms_mst_helper.c | 19 +++++++++++++++++++
tests/intel/kms_mst_helper.h | 1 +
2 files changed, 20 insertions(+)

diff --git a/tests/intel/kms_mst_helper.c b/tests/intel/kms_mst_helper.c
index 38859cffc..1918c8d10 100644
--- a/tests/intel/kms_mst_helper.c
+++ b/tests/intel/kms_mst_helper.c
@@ -47,3 +47,22 @@ int igt_find_all_mst_output_in_topology(int drm_fd, igt_display_t *display,
}
return 0;
}
+
+/**
+ * igt_display_has_mst_output:
+ * @display: pointer to #igt_display_t structure
+ *
+ * Check if a display has at least one DP MST output connected.
+ *
+ * Returns: true if MST output is found, false otherwise
+ */
+bool igt_display_has_mst_output(igt_display_t *display)
+{
+ igt_output_t *output;
+
+ for_each_connected_output(display, output) {
+ if (igt_check_output_is_dp_mst(output))
+ return true;
+ }
+ return false;
+}
diff --git a/tests/intel/kms_mst_helper.h b/tests/intel/kms_mst_helper.h
index 7391494ab..0e8ece0a0 100644
--- a/tests/intel/kms_mst_helper.h
+++ b/tests/intel/kms_mst_helper.h
@@ -12,4 +12,5 @@ int igt_find_all_mst_output_in_topology(int drm_fd, igt_display_t *display,
igt_output_t *output,
igt_output_t *mst_outputs[],
int *num_mst_outputs);
+bool igt_display_has_mst_output(igt_display_t *display);
#endif
--
2.25.1