From: Suraj Kandpal <suraj.kandpal@intel.com>
To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, arun.r.murthy@intel.com,
Suraj Kandpal <suraj.kandpal@intel.com>
Subject: [PATCH 04/10] drm/i915/dp: Add M/N ratio check with warning for DP link config
Date: Fri, 11 Sep 2026 09:44:43 +0530 [thread overview]
Message-ID: <20260911041449.3699400-5-suraj.kandpal@intel.com> (raw)
In-Reply-To: <20260911041449.3699400-1-suraj.kandpal@intel.com>
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Introduce intel_dp_check_m_n_ratio() to validate the computed link
M/N ratio against the maximum allowed value. If the ratio exceeds the
limit, a warning is issued via drm_WARN().
The link config limits computed in the previous patches only restrict
the configurations that may be selected; this catches anything that
still slips through and turns a silently broken link into a loud
warning.
This check works off the M/N values as actually computed, which exposes
a mismatch with the prediction done while computing the limits: the
pixel clock there is the one before intel_dp_compute_config() divides
adjusted_mode->crtc_clock by the MSO link count. Divide in the
prediction too, so both agree. The joiner needs no such handling, as
intel_joiner_adjust_timings() only rewrites the pipe mode and leaves the
adjusted mode the link M/N is derived from untouched.
v2:
-Use the platform specific ratio limit. (Wa_14014191401)
-Use the MSO adjusted pixel clock when predicting the ratio, matching
what the link M/N is actually computed from. (Imre)
-Drop the check from ilk_fdi_compute_config(): it was passing dp_m_n
rather than the fdi_m_n it had just computed, and an FDI link cannot get
anywhere near the ratio limit anyway.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 37 +++++++++++++++++++--
drivers/gpu/drm/i915/display/intel_dp.h | 3 ++
drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 ++
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 715314d3684e..585762be07bb 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -1294,6 +1294,14 @@ intel_dp_can_support_m_n(struct intel_display *display,
return m_n_ratio <= max_m_n_ratio;
}
+static int intel_dp_mso_pixel_clock(struct intel_dp *intel_dp, int pixel_clock)
+{
+ if (!intel_dp->mso_link_count)
+ return pixel_clock;
+
+ return pixel_clock / intel_dp->mso_link_count;
+}
+
static
bool intel_dp_can_join(struct intel_dp *intel_dp,
int num_joined_pipes)
@@ -1488,7 +1496,9 @@ intel_dp_mode_valid(struct drm_connector *_connector,
INTEL_DP_LINK_CAPS_ORDER_KEY_RATE_LANE,
INTEL_DP_LINK_CAPS_FILTER_ALL,
&max_rate_config) &&
- !intel_dp_can_support_m_n(display, target_clock, max_rate_config.rate))
+ !intel_dp_can_support_m_n(display,
+ intel_dp_mso_pixel_clock(intel_dp, target_clock),
+ max_rate_config.rate))
return MODE_CLOCK_HIGH;
/*
@@ -2703,7 +2713,8 @@ intel_dp_compute_m_n_ratio_limits(struct intel_dp *intel_dp,
struct intel_dp_link_caps_order order =
intel_dp_link_caps_connector_compute_order(connector);
struct intel_dp_link_caps_filter new_filter = INTEL_DP_LINK_CAPS_FILTER_NONE;
- int pixel_clock = intel_dp_mode_clock(crtc_state, conn_state);
+ int pixel_clock = intel_dp_mso_pixel_clock(intel_dp,
+ intel_dp_mode_clock(crtc_state, conn_state));
struct intel_dp_link_config link_config;
struct intel_dp_link_caps_iter iter;
bool found = false;
@@ -3362,6 +3373,24 @@ static bool can_enable_drrs(struct intel_connector *connector,
intel_panel_drrs_type(connector) == DRRS_TYPE_SEAMLESS;
}
+void intel_dp_check_m_n_ratio(struct intel_crtc_state *crtc_state,
+ struct intel_link_m_n *m_n)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+ int max_m_n_ratio = intel_dp_get_max_m_n_ratio(display);
+ int m_n_ratio;
+
+ if (!m_n || !m_n->link_n)
+ return;
+
+ m_n_ratio = DIV_ROUND_UP(m_n->link_m, m_n->link_n);
+
+ if (m_n_ratio > max_m_n_ratio)
+ drm_WARN(display->drm, 1,
+ "Link M/N ratio (%d) exceeds max allowed (%d)\n",
+ m_n_ratio, max_m_n_ratio);
+}
+
static void
intel_dp_drrs_compute_config(struct intel_connector *connector,
struct intel_crtc_state *pipe_config,
@@ -3400,6 +3429,8 @@ intel_dp_drrs_compute_config(struct intel_connector *connector,
intel_dp_bw_fec_overhead(pipe_config->fec_enable),
&pipe_config->dp_m2_n2);
+ intel_dp_check_m_n_ratio(pipe_config, &pipe_config->dp_m2_n2);
+
/* FIXME: abstract this better */
if (pipe_config->splitter.enable)
pipe_config->dp_m2_n2.data_m *= pipe_config->splitter.link_count;
@@ -3719,6 +3750,8 @@ intel_dp_compute_config(struct intel_atomic_state *state,
pipe_config->port_clock,
intel_dp_bw_fec_overhead(pipe_config->fec_enable),
&pipe_config->dp_m_n);
+
+ intel_dp_check_m_n_ratio(pipe_config, &pipe_config->dp_m_n);
}
ret = intel_dp_compute_min_hblank(pipe_config, conn_state);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
index 757e74ca8696..13e9432f98c6 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -26,6 +26,7 @@ struct intel_display;
struct intel_dp;
struct intel_dp_link_config;
struct intel_encoder;
+struct intel_link_m_n;
struct link_config_limits {
struct intel_dp_link_caps_filter link_config_filter;
@@ -244,5 +245,7 @@ void intel_dp_link_cleanup(struct intel_dp *intel_dp);
bool intel_dp_can_support_m_n(struct intel_display *display,
int pixel_clock, int link_rate);
+void intel_dp_check_m_n_ratio(struct intel_crtc_state *crtc_state,
+ struct intel_link_m_n *m_n);
#endif /* __INTEL_DP_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 796374cebf05..4faa0a86dda3 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -347,6 +347,8 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
link_bpp_x16,
&crtc_state->dp_m_n);
+ intel_dp_check_m_n_ratio(crtc_state, &crtc_state->dp_m_n);
+
if (is_mst) {
int remote_bw_overhead;
int remote_tu;
--
2.34.1
next prev parent reply other threads:[~2026-09-11 4:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 4:14 [PATCH 00/10] Implement Wa_14021768792 to bypass m_n ratio limit Suraj Kandpal
2026-09-11 4:14 ` [PATCH 01/10] drm/i915/display: Add helper to compute link M/N ratio for reuse Suraj Kandpal
2026-09-11 11:24 ` Jani Nikula
2026-09-11 11:28 ` Jani Nikula
2026-09-11 4:14 ` [PATCH 02/10] drm/i915/dp: Limit M/N ratio for DP SST Suraj Kandpal
2026-09-11 4:14 ` [PATCH 03/10] drm/i915/dp_mst: Limit M/N ratio for MST Suraj Kandpal
2026-09-11 4:30 ` sashiko-bot
2026-09-11 4:14 ` Suraj Kandpal [this message]
2026-09-11 4:14 ` [PATCH 05/10] drm/i915/display: Add bits for link_n_extended for DISPLAY >= 14 Suraj Kandpal
2026-09-11 4:14 ` [PATCH 06/10] drm/i915/display_wa: Add support for Wa_14021768792 Suraj Kandpal
2026-09-11 4:14 ` [PATCH 07/10] drm/i915/display: Add bits for Wa_14021768792 for linkm/n ratio > 10 Suraj Kandpal
2026-09-11 4:29 ` sashiko-bot
2026-09-11 4:14 ` [PATCH 08/10] drm/i915/display: Implement Wa_14021768792 for BMG DP for link_m/n " Suraj Kandpal
2026-09-11 4:30 ` sashiko-bot
2026-09-11 4:14 ` [PATCH 09/10] drm/i915/dp: Extend intel_dp_can_support_m_n() for BMG M/N bypass Suraj Kandpal
2026-09-11 4:14 ` [PATCH 10/10] drm/i915/dp: Bump the max Link M/N ratio to 22 for DISPLAY_VER >= 35 Suraj Kandpal
2026-09-11 4:23 ` ✓ CI.KUnit: success for Implement Wa_14021768792 to bypass m_n ratio limit (rev6) Patchwork
2026-09-11 5:01 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-11 12:52 ` ✓ Xe.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=20260911041449.3699400-5-suraj.kandpal@intel.com \
--to=suraj.kandpal@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=arun.r.murthy@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/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