intel_dp_dsc_min_slice_count() returns 0 if DSC can't be used for the given mode: if the mode's pixel clock or hdisplay exceeds the maximum overall throughput or line width reported by a DSC branch device, or if the sink's maximum slice width is invalid. Before commit 15f908bce5d9 ("drm/i915/dp: Factor out intel_dp_dsc_min_slice_count()"), these checks returned 0 from intel_dp_dsc_get_slice_count(), which its callers treat as DSC not being possible. After the refactor, intel_dp_dsc_get_slice_config() uses the returned value as a lower bound and since 0 is less than any slice count, it selects the smallest slice config supported by the source and the sink instead of failing. This was seen with a Synaptics SST branch device (OUI 90-cc-24, dev-ID SYNAR) in a USB4 dock, which reports the same 340 MP/s per-slice DSC throughput as the monitor behind it. For 3840x2160@240Hz (2315950 kHz pixel clock) the minimum slice count computation bailed out due to the branch device's overall throughput limit, so the mode was not pruned and was enabled with 4 slices on two joined pipes, ie. ~579 MP/s per slice, resulting in a garbled image. With the monitor connected directly, the same mode is enabled with 8 slices. Fail the slice config computation if the minimum slice count is 0, so that such modes are rejected as before the above refactor. Fixes: 15f908bce5d9 ("drm/i915/dp: Factor out intel_dp_dsc_min_slice_count()") Cc: Imre Deak Cc: # v7.1+ Signed-off-by: Xiao Lu --- drivers/gpu/drm/i915/display/intel_dp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d8c0d9381..404839a2a 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -910,6 +910,10 @@ intel_dp_dsc_get_slice_config(const struct intel_connector *connector, drm_dp_dsc_sink_slice_count_mask(connector->dp.dsc_dpcd, is_edp); int slices_per_pipe; + /* A 0 minimum slice count means DSC isn't supported for the mode. */ + if (!min_slice_count) + return false; + /* * Find the closest match to the valid slice count values * -- 2.43.0