[igt-dev] [PATCH v3 2/2] tests/i915/kms_cdclk: Fixed mode selection for MST modeset

Mohammed Thasleem mohammed.thasleem at intel.com
Tue Jun 27 20:34:06 UTC 2023


When two monitors connected through MST. This will find the
connector mode combo that fits into the bandwidth when more
than one monitor is connected.

Example:
  When two monitors connected through MST, the second monitor
  also tries to use the same mode. So two such modes may not
  fit into the link bandwidth. So, iterate through connected
  outputs & modes and find a combination of modes those fit
  into the link BW.

v2: -Removed if loop checks.
    -Added igt override to avoid dp mst bw failure.
v3: Rebased conflict.
v4: Skip the test if available mode is less than 4k.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 tests/i915/kms_cdclk.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/tests/i915/kms_cdclk.c b/tests/i915/kms_cdclk.c
index 0f9b8dc5..cf526ec0 100644
--- a/tests/i915/kms_cdclk.c
+++ b/tests/i915/kms_cdclk.c
@@ -43,6 +43,7 @@ typedef struct {
 	int drm_fd;
 	int debugfs_fd;
 	uint32_t devid;
+	igt_output_t *mst_output[2];
 	igt_display_t display;
 } data_t;
 
@@ -252,11 +253,12 @@ static void test_mode_transition_on_all_outputs(data_t *data)
 {
 	igt_display_t *display = &data->display;
 	int debugfs_fd = data->debugfs_fd;
-	drmModeModeInfo *mode, *mode_hi, *mode_lo;
+	drmModeModeInfo *mode, *mode_hi, *mode_lo, *mst_mode[2];
 	igt_output_t *output;
-	int valid_outputs = 0;
+	int valid_outputs = 0, count = 0;
 	int cdclk_ref, cdclk_new;
 	uint16_t width = 0, height = 0;
+	bool found;
 	struct igt_fb fb;
 	igt_pipe_t *pipe;
 	igt_plane_t *plane;
@@ -332,6 +334,24 @@ static void test_mode_transition_on_all_outputs(data_t *data)
 		j++;
 	}
 
+	/* In case of DP-MST find suitable mode(s) to fit into the link BW. */
+	found = igt_override_all_active_output_modes_to_fit_bw(display);
+	igt_require_f(found, "No valid mode combo found for MST modeset.\n");
+
+	if (found) {
+
+		for_each_connected_output(display, output)
+			data->mst_output[count++] = output;
+
+		mst_mode[0] = igt_output_get_mode(data->mst_output[0]);
+		mst_mode[1] = igt_output_get_mode(data->mst_output[1]);
+
+		igt_require_f((mst_mode[0]->hdisplay < HDISPLAY_4K &&
+			       mst_mode[0]->vdisplay < VDISPLAY_4K), "Found less than 4k mode\n");
+		igt_require_f((mst_mode[1]->hdisplay < HDISPLAY_4K &&
+			       mst_mode[1]->vdisplay < VDISPLAY_4K), "Found less than 4k mode\n");
+	}
+
 	igt_display_commit2(display, COMMIT_ATOMIC);
 	cdclk_new = get_current_cdclk_freq(debugfs_fd);
 	igt_info("CD clock frequency %d -> %d\n", cdclk_ref, cdclk_new);
-- 
2.25.1



More information about the igt-dev mailing list