drm/i915/dp: Align min/max DSC input BPPs to sink caps

Align the minimum/maximum DSC input BPPs to the corresponding sink DSC
input BPP capability limits already when computing the BPP limits. This
alignment is also performed later during state computation, however
there is no reason to initialize the limits to an unaligned/incorrect
value.

Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20251222153547.713360-6-imre.deak@intel.com
This commit is contained in:
Imre Deak 2025-12-22 17:35:32 +02:00
parent 44a95ffe68
commit 753d6b404e

View File

@ -1905,6 +1905,23 @@ int intel_dp_dsc_max_src_input_bpc(struct intel_display *display)
return intel_dp_dsc_min_src_input_bpc();
}
static int align_min_sink_dsc_input_bpp(const struct intel_connector *connector,
int min_pipe_bpp)
{
u8 dsc_bpc[3];
int num_bpc;
int i;
num_bpc = drm_dp_dsc_sink_supported_input_bpcs(connector->dp.dsc_dpcd,
dsc_bpc);
for (i = num_bpc - 1; i >= 0; i--) {
if (dsc_bpc[i] * 3 >= min_pipe_bpp)
return dsc_bpc[i] * 3;
}
return 0;
}
static int align_max_sink_dsc_input_bpp(const struct intel_connector *connector,
int max_pipe_bpp)
{
@ -2680,15 +2697,19 @@ intel_dp_dsc_compute_pipe_bpp_limits(struct intel_connector *connector,
int dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(display);
limits->pipe.min_bpp = max(limits->pipe.min_bpp, dsc_min_bpc * 3);
limits->pipe.min_bpp = align_min_sink_dsc_input_bpp(connector, limits->pipe.min_bpp);
limits->pipe.max_bpp = min(limits->pipe.max_bpp, dsc_max_bpc * 3);
limits->pipe.max_bpp = align_max_sink_dsc_input_bpp(connector, limits->pipe.max_bpp);
if (limits->pipe.min_bpp <= 0 ||
limits->pipe.min_bpp > limits->pipe.max_bpp) {
drm_dbg_kms(display->drm,
"[CONNECTOR:%d:%s] Invalid DSC src/sink input BPP (src:%d-%d pipe:%d-%d)\n",
"[CONNECTOR:%d:%s] Invalid DSC src/sink input BPP (src:%d-%d pipe:%d-%d sink-align:%d-%d)\n",
connector->base.base.id, connector->base.name,
dsc_min_bpc * 3, dsc_max_bpc * 3,
orig_limits.pipe.min_bpp, orig_limits.pipe.max_bpp);
orig_limits.pipe.min_bpp, orig_limits.pipe.max_bpp,
limits->pipe.min_bpp, limits->pipe.max_bpp);
return false;
}