drm/i915/dp: Check src/sink compressed bpp limit for edp
authorAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Thu, 17 Aug 2023 14:24:58 +0000 (19:54 +0530)
committerAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Fri, 18 Aug 2023 04:12:25 +0000 (09:42 +0530)
Use checks for src and sink limits before computing compressed bpp for
eDP.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-18-ankit.k.nautiyal@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index b295dd3..764663c 100644 (file)
@@ -2027,6 +2027,8 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
 {
        struct drm_i915_private *i915 = dp_to_i915(intel_dp);
        int pipe_bpp, forced_bpp;
+       int dsc_src_min_bpp, dsc_sink_min_bpp, dsc_min_bpp;
+       int dsc_src_max_bpp, dsc_sink_max_bpp, dsc_max_bpp;
 
        forced_bpp = intel_dp_force_dsc_pipe_bpp(intel_dp, conn_state, limits);
 
@@ -2044,9 +2046,19 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
        }
        pipe_config->port_clock = limits->max_rate;
        pipe_config->lane_count = limits->max_lane_count;
-       pipe_config->dsc.compressed_bpp =
-               min_t(u16, drm_edp_dsc_sink_output_bpp(intel_dp->dsc_dpcd) >> 4,
-                     pipe_bpp);
+
+       dsc_src_min_bpp = dsc_src_min_compressed_bpp();
+       dsc_sink_min_bpp = dsc_sink_min_compressed_bpp(pipe_config);
+       dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
+
+       dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
+       dsc_sink_max_bpp = dsc_sink_max_compressed_bpp(intel_dp, pipe_config, pipe_bpp / 3);
+       dsc_max_bpp = dsc_sink_max_bpp ? min(dsc_sink_max_bpp, dsc_src_max_bpp) : dsc_src_max_bpp;
+
+       /* Compressed BPP should be less than the Input DSC bpp */
+       dsc_max_bpp = min(dsc_max_bpp, pipe_bpp - 1);
+
+       pipe_config->dsc.compressed_bpp = max(dsc_min_bpp, dsc_max_bpp);
 
        pipe_config->pipe_bpp = pipe_bpp;