public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Sowmiya S <sowmiya.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: swati2.sharma@intel.com, kunal1.joshi@intel.com,
	Sowmiya S <sowmiya.s@intel.com>
Subject: [PATCH i-g-t v1 1/2] lib/igt_kms: Add MST bandwidth-fitting support and helpers
Date: Tue, 21 Apr 2026 11:41:13 +0530	[thread overview]
Message-ID: <20260421061114.2262809-2-sowmiya.s@intel.com> (raw)
In-Reply-To: <20260421061114.2262809-1-sowmiya.s@intel.com>

Add helpers to handle shared-link DP bandwidth fitting for
MST/daisy-chain configurations.

On MST hubs/daisy-chains multiple streams share one DP link
and a joint atomic commit can be rejected unless modes are
chosen to fit the link BW. This will centralizes MST detection
and fitting so tests can request fitting only when required.

Signed-off-by: Sowmiya S <sowmiya.s@intel.com>
---
 lib/igt_kms.c | 33 +++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  3 +++
 2 files changed, 36 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 2d758b63c..0c7965954 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2744,6 +2744,7 @@ static void igt_output_reset(igt_output_t *output)
 {
 	output->pending_crtc = NULL;
 	output->use_override_mode = false;
+	output->bw_fit_applied = false;
 	memset(&output->override_mode, 0, sizeof(output->override_mode));
 
 	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, 0);
@@ -3227,6 +3228,15 @@ void igt_display_require(igt_display_t *display, int drm_fd)
 
 	igt_display_reset_outputs(display);
 
+	/* Detect MST outputs after they are fully initialized */
+	for (i = 0; i < display->n_outputs; i++) {
+		if (display->outputs[i].config.connector &&
+		    igt_check_output_is_dp_mst(&display->outputs[i])) {
+			display->needs_bw_fit = true;
+			break;
+		}
+	}
+
 out:
 	LOG_UNINDENT(display);
 
@@ -5372,6 +5382,7 @@ bool __override_all_active_output_modes_to_fit_bw(igt_display_t *display,
 		int ret;
 
 		igt_output_override_mode(output, mode);
+		output->bw_fit_applied = true;
 
 		if (__override_all_active_output_modes_to_fit_bw(display, outputs, n_outputs, base + 1))
 			return true;
@@ -5441,6 +5452,9 @@ bool igt_fit_modes_in_bw(igt_display_t *display)
 {
 	int ret;
 
+	for (int i = 0; i < display->n_outputs; i++)
+		display->outputs[i].bw_fit_applied = false;
+
 	if (display->is_atomic)
 		ret = igt_display_try_commit_atomic(display,
 						    DRM_MODE_ATOMIC_TEST_ONLY |
@@ -5461,6 +5475,25 @@ bool igt_fit_modes_in_bw(igt_display_t *display)
 	return true;
 }
 
+void igt_display_fit_bw(igt_display_t *display)
+{
+	int active_mst = 0;
+
+	if (!display->needs_bw_fit)
+		return;
+	for (int i = 0; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+
+		if (output->pending_crtc &&
+		    igt_check_output_is_dp_mst(output))
+			active_mst++;
+	}
+	if (active_mst < 2)
+		return;
+	igt_require_f(igt_fit_modes_in_bw(display),
+		      "No valid mode combination fits available MST link BW\n");
+}
+
 /**
  * igt_crtc_refresh:
  * @crtc: CRTC to refresh
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index fcbb6a5ad..5c60e7bb4 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -506,6 +506,7 @@ typedef struct {
 
 	/* bitmask of changed properties */
 	uint64_t changed;
+	bool bw_fit_applied;
 
 	uint32_t props[IGT_NUM_CONNECTOR_PROPS];
 	uint64_t values[IGT_NUM_CONNECTOR_PROPS];
@@ -536,6 +537,7 @@ struct _igt_display {
 	uint64_t *modifiers;
 	uint32_t *formats;
 	int format_mod_count;
+	bool needs_bw_fit;
 };
 
 typedef struct {
@@ -1286,6 +1288,7 @@ drmModePropertyBlobRes *igt_get_writeback_formats_blob(igt_output_t *output);
 uint64_t igt_get_writeback_fb_id(igt_output_t *output);
 void igt_detach_crtc(igt_display_t *display, igt_output_t *output);
 void igt_get_and_wait_out_fence(igt_output_t *output);
+void igt_display_fit_bw(igt_display_t *display);
 
 igt_colorop_t *igt_find_colorop(igt_display_t *display, uint32_t id);
 
-- 
2.43.0


  reply	other threads:[~2026-04-21  5:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  6:11 [PATCH i-g-t v1 0/2] Fix 2-display test for MST shared-link BW Sowmiya S
2026-04-21  6:11 ` Sowmiya S [this message]
2026-04-21 12:09   ` [PATCH i-g-t v1 1/2] lib/igt_kms: Add MST bandwidth-fitting support and helpers Jani Nikula
2026-04-27  9:03     ` S, Sowmiya
2026-04-21  6:11 ` [PATCH i-g-t v1 2/2] tests/kms_plane_multiple: Fix 2-display test for MST shared-link BW Sowmiya S
2026-04-21 21:03 ` ✓ i915.CI.BAT: success for " Patchwork
2026-04-21 21:55 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-22  2:02 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-22  4:34 ` ✗ i915.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260421061114.2262809-2-sowmiya.s@intel.com \
    --to=sowmiya.s@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@intel.com \
    --cc=swati2.sharma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox