From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32F46606A338 for ; Fri, 4 Dec 2026 09:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nXLKkvUb Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D007C10E647; Fri, 4 Dec 2026 09:58:55 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 788C010E53F; Fri, 4 Dec 2026 09:58:49 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id F0F3861135; Fri, 4 Dec 2026 09:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84ED71F000C2; Fri, 4 Dec 2026 09:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796378328; bh=FssQdIlxscMQG+TdeC6d+g2DD3EE6JxzeqzvC+eCuRw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=nXLKkvUbWVgEhu8eeiFfBoHqwkCZ6nYwP/ne3TITbDV/QY9546lLQWS5ePth6sRsr 5nH7EbXb9ZOnXSU5FKHfnrYSynICwNvGCHYBNfTuqQ2QJCftLm1pI50wX8pH76sukD luv7GsoNwAclAdWSa+5zSxgxKfi7lFGL1S7inEvXWUoeVIqAVb4VVd9UqFHVswplEv zG0rRbrBxSAyh1GKLyObyhi+A12Ohlwn/GyvA8PAgR7EcOXUa5KNdhi01TwHCMsXgI FSW4YUuos3yS9NzhVqMLxiYSqA8uGY3MQ6Kyff4SRu9T5X3XvXVfsF4qvQJwQOv8U8 U7ZycAIsdtbVg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 13/15] drm/i915/dp: Use the FRL rate of the stream on the HDMI link To: "Ankit Nautiyal" , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261204085746.391918-14-ankit.k.nautiyal@intel.com> References: <20261204085746.391918-1-ankit.k.nautiyal@intel.com> <20261204085746.391918-14-ankit.k.nautiyal@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:58:48 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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/i9= 15/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; > =20 > - crtc_state->pcon_config.frl_rate_gbps =3D > - 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 compre= sses it */ > + crtc_state->pcon_config.frl_rate_gbps =3D intel_dp_pcon_max_frl_rate(in= tel_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, > } > =20 > crtc_state->pcon_config.dsc_op =3D INTEL_PCON_DSC_DECODE_ENCODE; > + crtc_state->pcon_config.frl_rate_gbps =3D intel_dp_pcon_max_frl_rate(in= tel_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 >=3D crtc_state->pcon_config.frl_rate_gbps and returns ea= rly without retraining. Even if intel_dp->frl.is_trained were false, intel_dp_pcon_is_frl_trained() also accepts *frl_trained_mask >=3D 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; > } > =20 > -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 ds= c) > { > struct intel_connector *connector =3D intel_dp->attached_connector; > struct drm_connector *drm_connector =3D &connector->base; > @@ -4487,12 +4495,10 @@ static int intel_dp_hdmi_sink_max_frl(struct inte= l_dp *intel_dp) > =20 > /* > * 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); > =20 > 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204085746.3919= 18-1-ankit.k.nautiyal@intel.com?part=3D13