[PATCH i-g-t] tests/kms_display_modes: fit modes in mst bw

Kunal Joshi kunal1.joshi at intel.com
Thu Jan 16 06:17:49 UTC 2025


Instead of checking only currrent modes,
find combination of modes in mst topology
that can be accomodated in current link bw.

Fixes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2633
Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 tests/kms_display_modes.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/kms_display_modes.c b/tests/kms_display_modes.c
index e41c60cc0..a582ba1a9 100644
--- a/tests/kms_display_modes.c
+++ b/tests/kms_display_modes.c
@@ -60,6 +60,22 @@ typedef struct {
 	int n_pipes;
 } data_t;
 
+static bool fit_modes_in_bw(data_t *data)
+{
+        bool found;
+        int ret;
+
+        ret = igt_display_try_commit_atomic(&data->display,
+                                            DRM_MODE_ATOMIC_TEST_ONLY |
+                                            DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+        if (ret != 0) {
+                found = igt_override_all_active_output_modes_to_fit_bw(&data->display);
+                igt_require_f(found,
+                              "No valid mode combo found for modeset\n");
+        }
+        return true;
+}
+
 /* Get higher mode supported by panel. */
 static drmModeModeInfo *get_highres_mode(igt_output_t *output)
 {
@@ -279,7 +295,6 @@ static void run_extendedmode_negative(data_t *data, int pipe1, int pipe2)
 	struct igt_fb fbs[2];
 	igt_display_t *display = &data->display;
 	igt_plane_t *plane[2];
-	int ret;
 
 	igt_display_reset(display);
 
@@ -306,8 +321,7 @@ static void run_extendedmode_negative(data_t *data, int pipe1, int pipe2)
 	igt_output_override_mode(data->mst_output[1], &data->mode_mst[1]);
 
 	igt_require(intel_pipe_output_combo_valid(display));
-	ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
-	igt_assert(ret != 0 && errno == ENOSPC);
+	igt_assert_f(fit_modes_in_bw(data), "Unable to fit modes in bw\n");
 }
 
 igt_main
-- 
2.25.1



More information about the igt-dev mailing list