Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: jani.nikula@linux.intel.com, uma.shankar@intel.com,
	ville.syrjala@linux.intel.com,
	Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Subject: [PATCH 3/9] drm/i915/dp_mst: Limit m/n ratio to 10 for MST
Date: Mon, 21 Jul 2025 14:45:23 +0530	[thread overview]
Message-ID: <20250721091529.3864004-4-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <20250721091529.3864004-1-ankit.k.nautiyal@intel.com>

The hardware does not support DisplayPort configurations where the ceiling
of the Link M/Link N ratio exceeds 10. Enforce this constraint for MST
as well.

Add a check to reject mode for which where the M/N ratio exceeds the
supported limit. For MST, in compute config phase currently we use the
maximum link rate so just check if the M/N ratio is with in limit,
and bail out.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c     |  2 +-
 drivers/gpu/drm/i915/display/intel_dp.h     |  1 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 20 ++++++++++++++++----
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 4245dd65b2af..a1077a7ba7da 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -1413,7 +1413,7 @@ intel_dp_get_max_m_n_ratio(void)
 	return 10;
 }
 
-static bool
+bool
 intel_dp_can_support_m_n(int pixel_clock,
 			 int link_rate)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
index 0657f5681196..16555a9c53c4 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -214,5 +214,6 @@ int intel_dp_compute_min_hblank(struct intel_crtc_state *crtc_state,
 
 int intel_dp_dsc_bpp_step_x16(const struct intel_connector *connector);
 void intel_dp_dpcd_set_probe(struct intel_dp *intel_dp, bool force_on_external);
+bool intel_dp_can_support_m_n(int pixel_clock, int link_rate);
 
 #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 74497c9a0554..62da0cb70607 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -202,10 +202,10 @@ static int intel_dp_mst_bw_overhead(const struct intel_crtc_state *crtc_state,
 	return max(overhead, intel_dp_bw_fec_overhead(crtc_state->fec_enable));
 }
 
-static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
-				     int overhead,
-				     int bpp_x16,
-				     struct intel_link_m_n *m_n)
+static int intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
+				    int overhead,
+				    int bpp_x16,
+				    struct intel_link_m_n *m_n)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
@@ -218,6 +218,8 @@ static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
 			       m_n);
 
 	m_n->tu = DIV_ROUND_UP_ULL(mul_u32_u32(m_n->data_m, 64), m_n->data_n);
+
+	return 0;
 }
 
 static int intel_dp_mst_calc_pbn(int pixel_clock, int bpp_x16, int bw_overhead)
@@ -445,6 +447,11 @@ static int mst_stream_compute_link_config(struct intel_dp *intel_dp,
 {
 	crtc_state->lane_count = limits->max_lane_count;
 	crtc_state->port_clock = limits->max_rate;
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->hw.adjusted_mode;
+
+	if (!intel_dp_can_support_m_n(adjusted_mode->clock, crtc_state->port_clock))
+		return -EINVAL;
 
 	/*
 	 * FIXME: allocate the BW according to link_bpp, which in the case of
@@ -1551,6 +1558,11 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector,
 		return 0;
 	}
 
+	if (!intel_dp_can_support_m_n(mode->clock, max_rate)) {
+		*status = MODE_CLOCK_HIGH;
+		return 0;
+	}
+
 	*status = intel_mode_valid_max_plane_size(display, mode, num_joined_pipes);
 	return 0;
 }
-- 
2.45.2


  parent reply	other threads:[~2025-07-21  9:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21  9:15 [PATCH 0/4] Implement Wa_14021768792 to bypass m_n ratio limit Ankit Nautiyal
2025-07-21  9:15 ` [PATCH 1/9] drm/i915: Add helper to compute link M/N ratio for reuse Ankit Nautiyal
2025-07-21  9:15 ` [PATCH 2/9] drm/i915/dp: Limit m/n ratio to 10 for DP SST Ankit Nautiyal
2025-07-21 11:41   ` Imre Deak
2025-07-22  5:55     ` Nautiyal, Ankit K
2025-07-22  9:22       ` Imre Deak
2025-07-22 15:15         ` Nautiyal, Ankit K
2025-07-21  9:15 ` Ankit Nautiyal [this message]
2025-07-21  9:15 ` [PATCH 4/9] drm/i915/dp: Add M/N ratio check with warning for DP link config Ankit Nautiyal
2025-07-21  9:15 ` [PATCH 5/9] drm/i915/display: Add bits for link_n_exended for DISPLAY >= 14 Ankit Nautiyal
2025-07-29 11:08   ` Jani Nikula
2025-07-21  9:15 ` [PATCH 6/9] drm/i915/display_wa: Add support for Wa_14021768792 Ankit Nautiyal
2025-07-29 11:10   ` Jani Nikula
2025-07-21  9:15 ` [PATCH 7/9] drm/i915/display: Add bits for Wa_14021768792 for linkm/n ratio > 10 Ankit Nautiyal
2025-07-21  9:15 ` [PATCH 8/9] drm/i915/display: Implement Wa_14021768792 for BMG DP for link_m/n " Ankit Nautiyal
2025-07-21  9:15 ` [PATCH 9/9] drm/i915/dp: Extend intel_dp_can_support_m_n() for BMG M/N bypass Ankit Nautiyal
2025-07-21  9:34 ` ✗ CI.checkpatch: warning for Implement Wa_14021768792 to bypass m_n ratio limit (rev5) Patchwork
2025-07-21  9:35 ` ✓ CI.KUnit: success " Patchwork
2025-07-21  9:50 ` ✗ CI.checksparse: warning " Patchwork
2025-07-21 17:27 ` ✓ Xe.CI.BAT: success " Patchwork
2025-07-21 18:17 ` ✗ Xe.CI.Full: failure " 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=20250721091529.3864004-4-ankit.k.nautiyal@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@linux.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