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 13/15] drm/i915/dp: Use the FRL rate of the stream on the HDMI link
Date: Fri, 04 Dec 2026 09:58:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-249558@kernel.org> (raw)
In-Reply-To: <20261204085746.391918-14-ankit.k.nautiyal@intel.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] drm/i915/dp: FRL link not retrained down to sink DSC max FRL
  rate
- [Medium] drm/i915/dp: stale FRL state after failed retrain TMDS
  fallback
- [Medium] drm/i915/dp: intel_dp_hdmi_sink_max_frl() ignores zero DSC
  max FRL rate
- [Medium] drm/i915/dp: race between FRL retraining and HPD pulse on
  intel_dp->frl
--

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

drm/i915/dp: Use the FRL rate of the stream on the HDMI link

This commit passes a boolean indicating whether the HDMI stream is
compressed to the sink and PCON FRL rate helpers, and stores the
matching FRL rate in crtc_state->pcon_config.frl_rate_gbps.

> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index da3aeba84c602..f2505b707cad5 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c

[ ... ]

> @@ -3094,8 +3101,8 @@ intel_dp_pcon_compute_config(struct intel_dp *intel_dp,
>  	if (!intel_dp_is_hdmi_2_1_sink(intel_dp))
>  		return 0;
>  
> -	crtc_state->pcon_config.frl_rate_gbps =
> -		min(intel_dp->dfp.pcon_max_frl_bw, intel_dp_hdmi_sink_max_frl(intel_dp));
> +	/* The HDMI link carries an uncompressed stream, unless the PCON compresses it */
> +	crtc_state->pcon_config.frl_rate_gbps = intel_dp_pcon_max_frl_rate(intel_dp, false);

[Severity: Medium]
Can a failed FRL retrain now leave intel_dp->frl.is_trained true while the
PCON has fallen back to TMDS mode?

With stream-dependent FRL rates, switching from a PCON DSC mode trained at a
lower rate to an uncompressed mode at a higher rate calls
intel_dp_pcon_start_frl_training() while intel_dp->frl.is_trained is still
true.  drm_dp_pcon_frl_prepare() tears down the previous FRL link, and if
training then fails, intel_dp_check_frl_training() switches the PCON to TMDS
via intel_dp_pcon_set_tmds_mode() without clearing intel_dp->frl.is_trained
or intel_dp->frl.trained_rate_gbps.

Later modesets requesting a rate at or below the stale trained_rate_gbps
will then skip FRL training and remain stuck in TMDS mode, and
intel_dp_pcon_frl_recover() will return early because is_trained is still
set.

[Severity: Medium]
Is there a data race between FRL retraining and HPD pulse handling on
intel_dp->frl and DP_PCON_HDMI_LINK_CONFIG_1?

When switching from a lower DSC FRL rate to a higher uncompressed FRL rate,
intel_dp_check_frl_training() runs before intel_dp_start_link_train(), so
intel_hpd_block() is not active yet:

CPU0                             CPU1
intel_dp_check_frl_training()
  ...
  drm_dp_pcon_frl_prepare()
  /* HDMI link down;
     frl.is_trained is true */
                                 intel_dp_hpd_pulse()
                                   ...
                                   intel_dp_handle_hdmi_link_status_change()
                                     /* is_trained && !is_active */
                                     clear DP_PCON_ENABLE_HDMI_LINK
                                       <-- aborts FRL retrain

Tearing down the active HDMI link can itself trigger a short HPD.
intel_dp_handle_hdmi_link_status_change() then does an unsynchronized
read-modify-write on DP_PCON_HDMI_LINK_CONFIG_1 and clears
intel_dp->frl.is_trained, causing FRL training to time out and fall back to
TMDS mode.  A concurrent long HPD in intel_dp_hpd_pulse() can also race with
the two-field update of trained_rate_gbps and is_trained at the end of
intel_dp_pcon_start_frl_training().

Clearing intel_dp->frl.is_trained before tearing down the link and
synchronizing FRL training with HPD pulse handling (for example via
intel_hpd_block() / intel_hpd_unblock()) would avoid these races.

> @@ -3127,6 +3134,7 @@ intel_dp_pcon_compute_config(struct intel_dp *intel_dp,
>  	}
>  
>  	crtc_state->pcon_config.dsc_op = INTEL_PCON_DSC_DECODE_ENCODE;
> +	crtc_state->pcon_config.frl_rate_gbps = intel_dp_pcon_max_frl_rate(intel_dp, true);

[Severity: High]
Does the FRL training path fail to retrain the link down when switching from
an uncompressed mode to a PCON DSC mode with a lower sink DSC max FRL rate?

When an uncompressed mode trains the FRL link at the sink's regular max rate
(for example 48 Gbps), intel_dp->frl.is_trained and trained_rate_gbps are
not cleared on disable.  On a later modeset to a PCON DSC mode capped by
DSC_Max_FRL_Rate (for example 24 Gbps), intel_dp_check_frl_training() checks
trained_rate_gbps >= crtc_state->pcon_config.frl_rate_gbps and returns early
without retraining.

Even if intel_dp->frl.is_trained were false, intel_dp_pcon_is_frl_trained()
also accepts *frl_trained_mask >= max_frl_bw_mask, so
intel_dp_pcon_start_frl_training() jumps straight to frl_trained.
intel_dp_pcon_dsc_configure() then enables the PCON DSC encoder over an FRL
link exceeding the sink's DSC_Max_FRL_Rate, which can cause a blank display
or link failure.

[ ... ]

> @@ -4478,7 +4486,7 @@ static int intel_dp_pcon_set_frl_mask(int max_frl)
>  	return 0;
>  }
>  
> -static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp)
> +static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp, bool dsc)
>  {
>  	struct intel_connector *connector = intel_dp->attached_connector;
>  	struct drm_connector *drm_connector = &connector->base;
> @@ -4487,12 +4495,10 @@ static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp)
>  
>  	/*
>  	 * The sink's DSC max FRL rate only applies to compressed video
> -	 * transport, which requires a DSC 1.2 encoder in the PCON. Without
> -	 * one the HDMI link always carries uncompressed video, for which
> -	 * the regular max FRL rate is the limit.
> +	 * transport. For uncompressed video the regular max FRL rate is the
> +	 * limit.
>  	 */
> -	if (drm_dp_pcon_enc_is_dsc_1_2(intel_dp->pcon_dsc_dpcd) &&
> -	    dsc_max_frl_rate)
> +	if (dsc && dsc_max_frl_rate)
>  		return min(max_frl_rate, dsc_max_frl_rate);
>  
>  	return max_frl_rate;

[Severity: Medium]
When dsc is true and the sink reports a zero dsc_max_frl_rate, shouldn't
this return 0 instead of falling back to max_frl_rate?

In HDMI 2.1, a zero DSC_Max_FRL_Rate (or an unrecognized rate code mapped to
0 by drm_get_max_frl_rate()) indicates that compressed transport over FRL is
unsupported.  Because intel_dp_pcon_can_encode_dsc() only checks
dsc_cap.v_1p2, falling through to max_frl_rate allows
intel_dp_pcon_dsc_enc_compute() to succeed and intel_dp_pcon_compute_config()
to enable INTEL_PCON_DSC_DECODE_ENCODE at the uncompressed FRL rate, which
can cause link failure or a blank screen.

Changing the condition to "if (dsc)" so it returns min(max_frl_rate,
dsc_max_frl_rate) would return 0 when compressed FRL is unsupported.

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

  reply	other threads:[~2026-12-04  9:59 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 [this message]
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
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-249558@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