All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Suraj Kandpal" <suraj.kandpal@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v7 02/13] drm/i915/dp: Limit M/N ratio for DP
Date: Thu, 22 Oct 2026 03:34:53 +0000	[thread overview]
Message-ID: <sashiko-outbox-180971@kernel.org> (raw)
In-Reply-To: <20261022032247.1378809-3-suraj.kandpal@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/i915/dp: misordered M/N ratio filter in intel_dp_compute_config_limits()
--

commit 702cc07abf5c42e8a3c593b53932c55fcc454655
Author: Suraj Kandpal <suraj.kandpal@intel.com>

drm/i915/dp: Limit M/N ratio for DP

This commit restricts DisplayPort link configurations and prunes modes where
the ceiling of the Link M/N ratio exceeds the hardware limit supported by the
transcoder timing generator DDA.

> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index d8c0d9381471d..7ceb7c02b597b 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c

[ ... ]

> @@ -2656,6 +2725,48 @@ intel_dp_dsc_compute_pipe_bpp_limits(struct intel_connector *connector,
>  	return true;
>  }
>  
> +static bool
> +intel_dp_compute_m_n_ratio_limits(struct intel_dp *intel_dp,
> +				  struct drm_connector_state *conn_state,
> +				  const struct intel_crtc_state *crtc_state,
> +				  struct link_config_limits *limits)
> +{
> +	struct intel_display *display = to_intel_display(intel_dp);
> +	struct intel_connector *connector = to_intel_connector(conn_state->connector);
> +	struct intel_dp_link_caps *link_caps = intel_dp->link.caps;
> +	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_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;
> +
> +	intel_dp_link_caps_iter_start(&iter, link_caps, order, limits->link_config_filter);
> +	for_each_dp_link_config(&iter, &link_config) {
> +		if (!intel_dp_can_support_m_n(display, pixel_clock, link_config.rate))
> +			continue;
> +
> +		intel_dp_link_caps_filter_add(link_caps, &new_filter, &link_config);
> +		found = true;
> +	}
> +	intel_dp_link_caps_iter_end(&iter);
> +
> +	if (!found) {
> +		drm_dbg_kms(display->drm,
> +			    "[CONNECTOR:%d:%s] No link config with a Link M/N ratio <= %d\n",
> +			    connector->base.base.id, connector->base.name,
> +			    intel_dp_get_max_m_n_ratio(display));
> +
> +		return false;
> +	}
> +
> +	limits->link_config_filter = new_filter;
> +
> +	return true;
> +}
> +
>  bool
>  intel_dp_compute_config_limits(struct intel_dp *intel_dp,
>  			       struct drm_connector_state *conn_state,
> @@ -2772,6 +2883,9 @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
>  		limits->link_config_filter = new_filter;
>  	}
>  
> +	if (!intel_dp_compute_m_n_ratio_limits(intel_dp, conn_state, crtc_state, limits))
> +		return false;
> +
>  	if (!intel_dp_test_compute_config(connector, crtc_state, limits))
>  		return false;

[Severity: Medium]
Does calling intel_dp_compute_m_n_ratio_limits() after the
(is_mst || intel_dp->use_max_params) block and before
intel_dp_test_compute_config() in intel_dp_compute_config_limits() cause two
filtering regressions?

First, in drivers/gpu/drm/i915/display/intel_dp.c:
intel_dp_compute_config_limits() narrows limits->link_config_filter to a
single max_config before intel_dp_compute_m_n_ratio_limits() runs:

	if (is_mst || intel_dp->use_max_params) {
		...
		if (!intel_dp_get_connector_max_link_config(connector, limits, &max_config))
			return false;

		if (!intel_dp_link_caps_filter_add(link_caps, &new_filter, &max_config))
			return false;

		limits->link_config_filter = new_filter;
	}

	if (!intel_dp_compute_m_n_ratio_limits(intel_dp, conn_state, crtc_state, limits))
		return false;

Because 128b/132b symbol clocks (rate * 10 / 32) are lower than 8b/10b symbol
clocks (rate * 10 / 10), max_config can pick a UHBR rate such as UHBR10
(312.5 MHz symbol clock) or UHBR20 (625 MHz symbol clock) that exceeds the
M/N ratio limit for a high pixel clock mode, even when a lower link rate like
HBR3 (810 MHz symbol clock) or HBR2 (540 MHz symbol clock) satisfies the M/N
ratio and passed intel_dp_mode_valid_m_n(). Since
intel_dp_compute_m_n_ratio_limits() only iterates over
limits->link_config_filter, won't it reject the modeset instead of allowing
intel_dp_get_connector_max_link_config() to select the highest M/N-compatible
configuration?

Second, intel_dp_test_compute_config() is called right after
intel_dp_compute_m_n_ratio_limits(). When intel_dp->compliance.test_type is
DP_TEST_LINK_TRAINING, intel_dp_test_compute_config() ->
set_filter_for_link_params() -> set_filter_for_link_config() in
drivers/gpu/drm/i915/display/intel_dp_test.c overwrites
limits->link_config_filter with a fresh filter:

static bool set_filter_for_link_config(struct intel_connector *connector,
				       struct intel_dp_link_caps *link_caps,
				       const struct intel_dp_link_config *link_params,
				       struct link_config_limits *limits)
{
	struct intel_dp_link_caps_filter new_filter = INTEL_DP_LINK_CAPS_FILTER_NONE;

	if (!intel_dp_link_caps_filter_add(link_caps, &new_filter, link_params))
		return false;

	limits->link_config_filter = new_filter;

	return true;
}

Because intel_dp_link_caps_filter_add() checks get_allowed_config_filter()
rather than limits->link_config_filter, won't this discard the M/N ratio
filter applied by intel_dp_compute_m_n_ratio_limits() and allow an
M/N-invalid compliance link configuration?

Should intel_dp_compute_m_n_ratio_limits() be called before the
(is_mst || intel_dp->use_max_params) block, or after
intel_dp_test_compute_config() while also filtering before
intel_dp_get_connector_max_link_config()?

>  
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022032247.1378809-1-suraj.kandpal@intel.com?part=2

  reply	other threads:[~2026-10-22  3:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  3:22 [PATCH v7 00/13] Implement Wa_14021768792 to bypass m_n ratio limit Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 01/13] drm/i915/display: Add helper to compute link M/N ratio for reuse Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 02/13] drm/i915/dp: Limit M/N ratio for DP Suraj Kandpal
2026-10-22  3:34   ` sashiko-bot [this message]
2026-10-22 16:29   ` Golani, Mitulkumar Ajitkumar
2026-10-22  3:22 ` [PATCH v7 03/13] drm/i915/display_wa: Add support for Wa_14014191401 Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 04/13] drm/i915/dp_mst: Limit M/N ratio for MST Suraj Kandpal
2026-10-22  3:43   ` sashiko-bot
2026-10-22 16:42   ` Golani, Mitulkumar Ajitkumar
2026-10-22  3:22 ` [PATCH v7 05/13] drm/i915/dp: Add M/N ratio check for DP link config Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 06/13] drm/i915/display: Add bits for link_n_extended for DISPLAY >= 14 Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 07/13] drm/i915/display_wa: Add support for Wa_14021768792 Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 08/13] drm/i915/display: Add bits for Wa_14021768792 for linkm/n ratio > 10 Suraj Kandpal
2026-10-22 17:32   ` Golani, Mitulkumar Ajitkumar
2026-10-22 17:42     ` Golani, Mitulkumar Ajitkumar
2026-10-23  3:39       ` Kandpal, Suraj
2026-10-22  3:22 ` [PATCH v7 09/13] drm/i915/display: Compare bypass_m_n_ratio_limit in the state checker Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 10/13] drm/i915/display: Dump bypass_m_n_ratio_limit in the crtc state dump Suraj Kandpal
2026-10-22  7:38   ` Golani, Mitulkumar Ajitkumar
2026-10-22  3:22 ` [PATCH v7 11/13] drm/i915/display: Implement Wa_14021768792 for BMG DP for link_m/n ratio > 10 Suraj Kandpal
2026-10-22  3:22 ` [PATCH v7 12/13] drm/i915/dp: Extend intel_dp_can_support_m_n() for BMG M/N bypass Suraj Kandpal
2026-10-22 16:13   ` Golani, Mitulkumar Ajitkumar
2026-10-22 17:05     ` Kandpal, Suraj
2026-10-22  3:22 ` [PATCH v7 13/13] drm/i915/dp: Bump the max Link M/N ratio to 22 for DISPLAY_VER >= 35 Suraj Kandpal
2026-10-22 14:08   ` Golani, Mitulkumar Ajitkumar
2026-10-22  3:32 ` ✓ CI.KUnit: success for Implement Wa_14021768792 to bypass m_n ratio limit (rev11) Patchwork
2026-10-22  4:10 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-22  4:21 ` ✓ i915.CI.BAT: " Patchwork
2026-10-22  7:39 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-22 11:13 ` ✗ 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=sashiko-outbox-180971@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=suraj.kandpal@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.