Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ankit Nautiyal" <ankit.k.nautiyal@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 14/15] drm/i915/dp: Pick the bpc for a PCON DSC stream
Date: Fri, 04 Dec 2026 09:58:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-249556@kernel.org> (raw)
In-Reply-To: <20261204085746.391918-15-ankit.k.nautiyal@intel.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] drm/i915/dp: intel_dp_hdmi_compute_bpc() ignores sink and PCON
  DSC bpc caps
- [Medium] drm/i915/dp: PCON DSC ignores sink native_420 and PCON color
  format caps
- [Medium] drm/i915/dp: intel_dp_check_frl_training() skips lower DSC
  FRL retraining
- [Low] drm/i915/dp: intel_dp_hdmi_sink_max_frl() ignores zero DSC FRL
  rate
--

commit 1707d6510af7a4b652b9374bcbb1a3e1c3e1df5a
Author: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

drm/i915/dp: Pick the bpc for a PCON DSC stream

This commit adds a fallback in intel_dp_hdmi_compute_bpc() to pick the
highest bpc that an HDMI 2.1 PCON can DSC-encode when no bpc fits the
HDMI FRL link uncompressed and the DP stream is compressed.

> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index f2505b707cad5..94744ead1a6e9 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1302,6 +1302,20 @@ intel_dp_pcon_dsc_enc_compute(struct intel_dp *intel_dp,
>  	return true;
>  }
>  
> +/*
> + * Whether the PCON can compress a stream that doesn't fit the HDMI FRL link
> + * uncompressed. The DP stream has to be compressed for that as well.
> + */
> +static bool
> +intel_dp_hdmi_dsc_possible(struct intel_dp *intel_dp,
> +			   const struct drm_display_mode *mode, int pixel_clock,
> +			   int bpc, enum intel_output_format sink_format)
> +{
> +	return intel_dp_pcon_sink_support_frl(intel_dp) &&
> +		intel_dp_pcon_dsc_enc_compute(intel_dp, mode, pixel_clock, bpc,
> +					      sink_format, NULL);
> +}

[Severity: Medium]
Can intel_dp_hdmi_dsc_possible() accept a sink_format that the HDMI sink or
PCON DSC encoder cannot compress?

intel_dp_pcon_dsc_enc_compute() only checks v_1p2 and PCON DSC 1.2 support
via intel_dp_pcon_can_encode_dsc().  It never checks
info->hdmi.dsc_cap.native_420 for INTEL_OUTPUT_FORMAT_YCBCR420 or
DP_PCON_DSC_ENC_COLOR_FMT_CAP in intel_dp->pcon_dsc_dpcd.

On an HDMI 2.1 sink that supports DSC 1.2 for RGB without native 4:2:0 DSC
decoding, driving a 4:2:0 mode that requires FRL DSC will configure PCON DSC
encoding in an unsupported format and produce blank or corrupted output.

[Severity: Low]
What happens here if the HDMI sink advertises DSC 1.2 support but reports a
DSC_Max_FRL_Rate of 0 (or an unrecognized rate code that
drm_get_max_frl_rate() maps to 0)?

intel_dp_pcon_dsc_enc_compute() calls intel_dp_hdmi_frl_payload_bw(intel_dp,
true), which reaches intel_dp_hdmi_sink_max_frl():

drivers/gpu/drm/i915/display/intel_dp.c:intel_dp_hdmi_sink_max_frl() {
	...
	if (dsc && dsc_max_frl_rate)
		return min(max_frl_rate, dsc_max_frl_rate);

	return max_frl_rate;
}

When dsc is true and dsc_max_frl_rate is 0, this falls through and returns
the uncompressed max_frl_rate instead of 0.  PCON DSC is then enabled on a
sink that does not advertise compressed FRL transport, causing link failure.

Checking if (dsc) without && dsc_max_frl_rate would return 0 and let
intel_dp_pcon_dsc_enc_compute() reject the mode cleanly.

[ ... ]

> @@ -1862,12 +1880,27 @@ static int intel_dp_hdmi_compute_bpc(struct intel_dp *intel_dp,
>  			return bpc;
>  	}
>  
> +	/*
> +	 * No bpc fits the HDMI link uncompressed. If the DP stream is compressed
> +	 * the PCON may be able to compress the stream for the HDMI link as well.
> +	 */
> +	if (!dsc || !respect_downstream_limits)
> +		return -EINVAL;
> +
> +	for (bpc = max_bpc; bpc >= 8; bpc -= 2) {
> +		if (intel_hdmi_bpc_possible(crtc_state, bpc,
> +					    intel_dp_has_hdmi_sink(intel_dp)) &&
> +		    intel_dp_hdmi_dsc_possible(intel_dp, &crtc_state->hw.adjusted_mode,
> +					       clock, bpc, crtc_state->sink_format))
> +			return bpc;
> +	}
> +
>  	return -EINVAL;
>  }

[Severity: High]
Should this loop validate bpc against the sink and PCON DSC color depth
capabilities rather than only uncompressed HDMI deep-color limits?

intel_hdmi_bpc_possible() only checks uncompressed EDID deep-color flags,
and neither intel_dp_hdmi_dsc_possible() nor intel_dp_pcon_dsc_enc_compute()
checks info->hdmi.dsc_cap.bpc_supported or DP_PCON_DSC_ENC_COLOR_DEPTH_CAP
in intel_dp->pcon_dsc_dpcd.

On an HDMI 2.1 sink that advertises 12 bpc uncompressed deep color but only
8 or 10 bpc in its HF-VSDB DSC capabilities, this picks 12 bpc and
configures an unsupported compressed color depth, resulting in a blank or
corrupted screen.

[Severity: Medium]
Now that this loop allows switching to a PCON DSC stream, does
intel_dp_check_frl_training() fail to retrain the FRL link down when the
sink's DSC_Max_FRL_Rate is lower than its uncompressed Max_FRL_Rate?

After an uncompressed modeset trains the FRL link at a higher rate (for
example 48 Gbps), intel_dp->frl.is_trained stays true across modesets.  A
later PCON DSC modeset sets crtc_state->pcon_config.frl_rate_gbps to the
lower compressed rate (for example 24 Gbps), but this returns early:

drivers/gpu/drm/i915/display/intel_dp.c:intel_dp_check_frl_training() {
	...
	if (intel_dp->frl.is_trained &&
	    intel_dp->frl.trained_rate_gbps >= crtc_state->pcon_config.frl_rate_gbps)
		return;
	...
}

intel_dp_pcon_is_frl_trained() has the same *frl_trained_mask >=
max_frl_bw_mask check.  The PCON then transmits compressed video above the
sink's DSC_Max_FRL_Rate, breaking display output on the mode switch.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204085746.391918-1-ankit.k.nautiyal@intel.com?part=14

  reply	other threads:[~2026-12-04  9:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  8:57 [PATCH v5 00/15] DP-HDMI PCON DSC fixes Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 01/15] drm/i915/dp: Forget the PCON FRL training state on a long HPD Ankit Nautiyal
2026-12-04  9:45   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 02/15] drm/i915/dp: Account for FRL 16b/18b encoding overhead Ankit Nautiyal
2026-12-04  9:36   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 03/15] drm/i915/hdmi: Clamp the target_bpp only when it equals the link bpp Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 04/15] drm/i915/dp: Add PCON DSC state to crtc_state Ankit Nautiyal
2026-12-04  9:43   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 05/15] drm/dp: Add a helper to disable the PCON DSC encoder Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 06/15] drm/i915/dp: Compute the PCON DSC operation Ankit Nautiyal
2026-12-04  9:38   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 07/15] drm/i915/dp: Disable the PCON DSC encoder unless it is needed Ankit Nautiyal
2026-12-04  9:38   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 08/15] drm/i915/dp: Clamp PCON DSC bpp to the FRL link bandwidth Ankit Nautiyal
2026-12-04  9:33   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 09/15] drm/i915/dp: Add a helper for the FRL payload bandwidth Ankit Nautiyal
2026-12-04  8:57 ` [PATCH v5 10/15] drm/i915/dp: Compute the PCON DSC encoder parameters Ankit Nautiyal
2026-12-04  9:52   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 11/15] drm/i915/dp: Retrain the PCON FRL link from the link check work Ankit Nautiyal
2026-12-04  9:52   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 12/15] drm/i915/dp: Store the PCON FRL rate in the crtc state Ankit Nautiyal
2026-12-04 10:00   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 13/15] drm/i915/dp: Use the FRL rate of the stream on the HDMI link Ankit Nautiyal
2026-12-04  9:58   ` sashiko-bot
2026-12-04  8:57 ` [PATCH v5 14/15] drm/i915/dp: Pick the bpc for a PCON DSC stream Ankit Nautiyal
2026-12-04  9:58   ` sashiko-bot [this message]
2026-12-04  8:57 ` [PATCH v5 15/15] drm/i915/dp: Allow PCON DSC modes through the FRL bw check Ankit Nautiyal
2026-12-04  9:53   ` sashiko-bot
2026-12-04  9:31 ` ✓ CI.KUnit: success for DP-HDMI PCON DSC fixes (rev5) Patchwork
2026-12-04 10:10 ` ✓ Xe.CI.BAT: " 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-249556@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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