[igt-dev] [v5 i-g-t 06/14] tests/kms_plane_scaling: Fix mode selection for 2x tests

Bhanuprakash Modem bhanuprakash.modem at intel.com
Sat May 8 16:22:55 UTC 2021


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.

This patch will find a combination of modes that fit into the BW.

Cc: Imre Deak <imre.deak at intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_plane_scaling.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 34efc588e..7464b5bdf 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -630,9 +630,6 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
 	d->plane3 = igt_output_get_plane(output2, 0);
 	d->plane4 = get_num_scalers(d, pipe2) >= 2 ? igt_output_get_plane(output2, 1) : NULL;
 
-	mode1 = igt_output_get_mode(output1);
-	mode2 = igt_output_get_mode(output2);
-
 	igt_skip_on(!igt_display_has_format_mod(display, DRM_FORMAT_XRGB8888,
 						tiling));
 
@@ -658,8 +655,20 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
 	igt_plane_set_fb(d->plane3, &d->fb[2]);
 	if (d->plane4)
 		igt_plane_set_fb(d->plane4, &d->fb[3]);
+
+	if (igt_display_try_commit_atomic(display,
+				DRM_MODE_ATOMIC_TEST_ONLY |
+				DRM_MODE_ATOMIC_ALLOW_MODESET,
+				NULL) != 0) {
+		bool found = igt_override_all_active_output_modes_to_fit_bw(display);
+		igt_require_f(found, "No valid mode combo found.\n");
+	}
+
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
+	mode1 = igt_output_get_mode(output1);
+	mode2 = igt_output_get_mode(output2);
+
 	/* Upscaling Primary */
 	igt_plane_set_size(d->plane1, mode1->hdisplay, mode1->vdisplay);
 	igt_plane_set_size(d->plane3, mode2->hdisplay, mode2->vdisplay);
-- 
2.20.1



More information about the igt-dev mailing list