Skip to contentSkip to conversation

tests/kms_display_modes: Fit modes within MST bandwidth constraints

PATCH New Thasleem, Mohammed 1 participant 1 message May 5, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): PH0PR11MB48067E4F18268F82CD523EF8E48E2@PH0PR11MB4806.namprd11.prod.outlook.com

#1 lore raw

PATCH 1/1 tests/kms_display_modes: Fit modes within MST bandwidth constraints

-----Original Message-----
From: igt-dev <[email protected]> On Behalf Of Reddy Guddati, Santhosh
Sent: Monday, May 5, 2025 9:55 AM
To: B, Jeevan <[email protected]>; [email protected]
Subject: Re: [PATCH i-g-t] tests/kms_display_modes: Fit modes within MST bandwidth constraints

Hi Jeevan,

Quoted 8 lines · Jeevan B

Instead of checking only the current modes, find a combination of modes in the MST topology that can be accommodated within the available link bandwidth.

v2: move fit_modes_in_bw to lib/igt_kms
v3: update tag from fixes to closes
v4: remove igt_assert from fit_modes_in_bw call.

LGTM

Quoted 16 lines
  lib/igt_kms.c                           | 30 +++++++++++++++++++++++++
  lib/igt_kms.h                           |  1 +
  tests/intel/kms_dp_link_training.c      | 24 +-------------------
  tests/intel/kms_dp_linktrain_fallback.c | 18 +--------------
  tests/kms_display_modes.c               |  4 ++++
  5 files changed, 37 insertions(+), 40 deletions(-)
lib/igt_kms.c +2 -0
@@ -5046,6 +5046,36 @@ bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display)
  	return __override_all_active_output_modes_to_fit_bw(display, outputs, n_outputs, 0);
  }
 
+/*
+ * fit_modes_in_bw :

lib/igt_kms.c bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display) · line 5060

Quoted 10 lines
lib/igt_kms.c +10 -0
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Tries atomic TEST_ONLY commit; if it fails, overrides
+ * output modes to fit bandwidth.
+ *
+ * Returns: true if a valid mode combination is found or the commit 
+succeeds,
+ * false otherwise.
+ */
+bool fit_modes_in_bw(igt_display_t *display) {
	 -->Please have "igt_" before function name..
Quoted 144 lines
lib/igt_kms.c +18 -0
+	int ret;
+
+	ret = igt_display_try_commit_atomic(display,
+					    DRM_MODE_ATOMIC_TEST_ONLY |
+					    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	if (ret != 0) {
+		bool found;
+
+		found = igt_override_all_active_output_modes_to_fit_bw(display);
+		if (!found) {
+			igt_debug("No valid mode combo found for modeset\n");
+			return false;
+		}
+	}
+
+	return true;
+}
+
  /**
   * igt_pipe_refresh:
   * @display: a pointer to an #igt_display_t structure diff --git 

a/lib/igt_kms.h b/lib/igt_kms.h index 0381c82ad..fe01eaf3f 100644

lib/igt_kms.h +1 -0
@@ -1226,6 +1226,7 @@ void igt_require_pipe(igt_display_t *display,
  void igt_dump_connectors_fd(int drmfd);
  void igt_dump_crtcs_fd(int drmfd);
  bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t 
 *display);
+bool fit_modes_in_bw(igt_display_t *display);
  bool igt_get_i915_edp_lobf_status(int drmfd, char *connector_name);
  unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);

unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);

tests/intel/kms_dp_link_training.c +0 -2
index 9e9b1e6db..0152b7401 100644
@@ -140,28 +140,6 @@ static void setup_planes_fbs(data_t *data, igt_output_t *outs[],
  	}
  }
 
-/*
- * fit_modes_in_bw - Tries atomic TEST_ONLY commit; if it fails, 

overrides
- * output modes to fit bandwidth.
- */

tests/intel/kms_dp_link_training.c +2 -18
-static bool fit_modes_in_bw(data_t *data) -{
-	int ret;
-
-	ret = igt_display_try_commit_atomic(&data->display,
-					    DRM_MODE_ATOMIC_TEST_ONLY |
-					    DRM_MODE_ATOMIC_ALLOW_MODESET,
-					    NULL);
-	if (ret != 0) {
-		bool found;
-
-		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;
-}
-
  static void do_modeset(data_t *data, bool mst)
  {
  	uint32_t master_pipes_mask = 0;
@@ -204,7 +182,7 @@ static void do_modeset(data_t *data, bool mst)
  						  "Unable to assign pipes for outputs\n");
 
  	setup_planes_fbs(data, outs, out_count, modes, fbs, planes);
-	fit_modes_in_bw(data);
+	igt_assert_f(fit_modes_in_bw(&data->display), "Unable to fit modes 
+in bw\n");
  	igt_display_commit2(&data->display, COMMIT_ATOMIC);
  }
tests/intel/kms_dp_linktrain_fallback.c +2 -16
index 6a872efd2..64f21ec6f 100644
@@ -151,22 +151,6 @@ static void set_connector_link_status_good(data_t *data, igt_output_t *outputs[]
  							  DRM_MODE_LINK_STATUS_GOOD);
  }
 
-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;
-}
-
  static bool validate_modeset_for_outputs(data_t *data,
  					igt_output_t *outputs[],
  					int *output_count,
@@ -176,7 +160,7 @@ static bool validate_modeset_for_outputs(data_t *data,
  {
  	igt_require_f(*output_count > 0, "Require at least 1 output\n");
  	setup_pipe_on_outputs(data, outputs, output_count);
-	igt_assert_f(fit_modes_in_bw(data), "Unable to fit modes in bw\n");
+	igt_assert_f(fit_modes_in_bw(&data->display), "Unable to fit modes 
+in bw\n");
  	setup_modeset_on_outputs(data, outputs,
  				 output_count,
  				 mode, fb, primary);
tests/kms_display_modes.c +3 -0
@@ -93,6 +93,8 @@ static void run_extendedmode_basic(data_t *data,
  	mode[0] = igt_output_get_mode(output1);
  	mode[1] = igt_output_get_mode(output2);
 
+	igt_assert_f(fit_modes_in_bw(display), "Unable to fit modes in 
+bw\n");
+
  	pipe_crc[0] = igt_pipe_crc_new(data->drm_fd, pipe1, IGT_PIPE_CRC_SOURCE_AUTO);
  	pipe_crc[1] = igt_pipe_crc_new(data->drm_fd, pipe2, 

IGT_PIPE_CRC_SOURCE_AUTO);

tests/kms_display_modes.c +2 -0
@@ -138,6 +140,7 @@ static void run_extendedmode_basic(data_t *data,
  	igt_fb_set_size(&fb, plane[1], mode[1]->hdisplay, mode[1]->vdisplay);
  	igt_plane_set_size(plane[1], mode[1]->hdisplay, mode[1]->vdisplay);
 
+	igt_assert_f(fit_modes_in_bw(display), "Unable to fit modes in 
+bw\n");
  	igt_display_commit2(display, COMMIT_ATOMIC);
 
  	igt_pipe_crc_collect_crc(pipe_crc[0], &crc[0]); @@ -158,6 +161,7 @@ 

static void run_extendedmode_basic(data_t *data,
DRM_PLANE_TYPE_PRIMARY), NULL);
igt_plane_set_fb(igt_pipe_get_plane_type(&display->pipes[pipe2],
DRM_PLANE_TYPE_PRIMARY), NULL);

tests/kms_display_modes.c +2 -0
+	igt_assert_f(fit_modes_in_bw(display), "Unable to fit modes in 
+bw\n");
  	igt_display_commit2(display, COMMIT_ATOMIC);
 
  	/*Compare CRC*/