From: Jani Nikula <jani.nikula@intel.com>
To: Sowmiya S <sowmiya.s@intel.com>, igt-dev@lists.freedesktop.org
Cc: kunal1.joshi@intel.com, swati2.sharma@intel.com,
ramanaidu.naladala@intel.com, Sowmiya S <sowmiya.s@intel.com>
Subject: Re: [PATCH i-g-t v4 1/3] lib/igt_kms: Add MST bandwidth-fitting support and helpers
Date: Mon, 29 Jun 2026 13:02:04 +0300 [thread overview]
Message-ID: <1de68297ec2cb15a1121eb16d201a8653e251d31@intel.com> (raw)
In-Reply-To: <20260629092611.298235-2-sowmiya.s@intel.com>
On Mon, 29 Jun 2026, Sowmiya S <sowmiya.s@intel.com> wrote:
> 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.
>
> v2: Remove the flag used for caching values and update the
> function name to better describe its functionality (Jani)
> v3: Apply mst bw fit for shared link (Kunal)
> Remove unused variable (Kunal)
>
> Signed-off-by: Sowmiya S <sowmiya.s@intel.com>
> ---
> lib/igt_kms.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
> lib/igt_kms.h | 1 +
> 2 files changed, 75 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e82d32130..fceca2a1b 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5472,6 +5472,80 @@ bool igt_fit_modes_in_bw(igt_display_t *display)
> return true;
> }
>
> +/**
> + * igt_outputs_share_mst_link:
> + * @output_a: first output
> + * @output_b: second output
> + *
> + * Returns: true if both outputs are active DP-MST streams that share the
> + * same upstream link, i.e. their root connector IDs (as encoded in the
> + * MST PATH property) are equal. Returns false if either output is not an
> + * active MST stream or if they are rooted at different connectors.
> + */
> +static bool igt_outputs_share_mst_link(igt_output_t *output_a,
> + igt_output_t *output_b)
> +{
> + if (!output_a->pending_crtc || !igt_check_output_is_dp_mst(output_a))
> + return false;
The pending_crtc member is supposed to be private to igt_output_t. You
can use igt_output_get_driving_crtc(). Ditto everywhere.
> +
> + if (!output_b->pending_crtc || !igt_check_output_is_dp_mst(output_b))
> + return false;
> +
> + return igt_get_dp_mst_connector_id(output_a) ==
> + igt_get_dp_mst_connector_id(output_b);
> +}
> +
> +/**
> + * igt_require_mst_link_bw:
> + * @display: a pointer to an #igt_display_t structure
> + *
> + * When two or more DP-MST streams share the same upstream link (i.e. they
> + * are both rooted at the same MST hub), a joint atomic commit may be
> + * rejected by the driver if the combined stream bandwidth exceeds the link
> + * capacity. This function detects that situation by comparing the root
> + * connector ID embedded in each output's MST PATH property and, when two
> + * or more active outputs share the same root, calls igt_fit_modes_in_bw()
> + * to select mode overrides that satisfy the shared-link BW budget. The
> + * test is skipped if no valid combination can be found.
> + *
> + * TODO: Extend this function to proactively detect outputs that share a
> + * DP tunnel (USB4/Thunderbolt) and trigger igt_fit_modes_in_bw() for
> + * those too.
> + */
> +void igt_require_mst_link_bw(igt_display_t *display)
> +{
> + igt_output_t *mst_outputs[IGT_MAX_PIPES];
I've seen the mistake elsewhere, but IGT_MAX_PIPES is not the same as
the max number of outputs (which is based on connectors).
> + int n_mst = 0;
> + igt_output_t *output;
> + bool shared_link = false;
> + int i, j;
> +
> + /* Collect all active MST outputs in one pass. */
> + for_each_output(display, output) {
> + if (output->pending_crtc && igt_check_output_is_dp_mst(output))
> + mst_outputs[n_mst++] = output;
So this could overflow.
> + }
> +
> + /* Need at least two MST outputs before a shared-link is possible. */
> + if (n_mst < 2)
> + return;
> +
> + /* Check every pair for a shared upstream root connector. */
> + for (i = 0; i < n_mst && !shared_link; i++)
> + for (j = i + 1; j < n_mst; j++)
> + if (igt_outputs_share_mst_link(mst_outputs[i],
> + mst_outputs[j])) {
> + shared_link = true;
> + break;
> + }
> +
> + if (!shared_link)
> + 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 3df3ba866..f5aff5008 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1370,6 +1370,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_require_mst_link_bw(igt_display_t *display);
>
> igt_colorop_t *igt_find_colorop(igt_display_t *display, uint32_t id);
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-06-29 10:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 9:26 [PATCH i-g-t v4 0/3] Fix 2-display test for MST shared-link BW Sowmiya S
2026-06-29 9:26 ` [PATCH i-g-t v4 1/3] lib/igt_kms: Add MST bandwidth-fitting support and helpers Sowmiya S
2026-06-29 10:02 ` Jani Nikula [this message]
2026-06-29 9:26 ` [PATCH i-g-t v4 2/3] tests/kms_plane_multiple: Fix 2-display test for MST shared-link BW Sowmiya S
2026-06-29 9:26 ` [PATCH i-g-t v4 3/3] tests/intel/kms_pipe_stress: Fit display modes to MST link budget Sowmiya S
2026-06-29 10:05 ` Jani Nikula
2026-06-29 20:37 ` ✓ i915.CI.BAT: success for Fix 2-display test for MST shared-link BW (rev4) Patchwork
2026-06-29 20:48 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-30 4:28 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-30 7:37 ` ✓ 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=1de68297ec2cb15a1121eb16d201a8653e251d31@intel.com \
--to=jani.nikula@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kunal1.joshi@intel.com \
--cc=ramanaidu.naladala@intel.com \
--cc=sowmiya.s@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.