On Thu, 2025-11-27 at 19:49 +0200, Imre Deak wrote:
> 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.
> 
> Signed-off-by: Imre Deak <[email protected]>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 25
> +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 

Reviewed-by: Vinod Govindapillai <[email protected]>

> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 1ef64b90492ea..e7a42c9e4fef1 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1904,6 +1904,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)
>  {
> @@ -2679,15 +2696,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;
>       }

Reply via email to