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 <[email protected]> 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/[email protected]?part=14
