Move the DSC slice count and link bpp determination out of intel_dp_compute_min_hblank() into a helper, so that it can be shared with the upcoming DP symbol based timing generator computation. No functional change.
v3: change intel_dp_get_sclice_and_link_bpp -> intel_dp_compute_ (Suraj) Signed-off-by: Arun R Murthy <[email protected]> Reviewed-by: Suraj Kandpal <[email protected]> --- drivers/gpu/drm/i915/display/intel_dp.c | 51 ++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index bf5e87a72108eaf274f24bc997f2e8e2cc8320a0..db7c8fcc8683aae1a2bc7050ef7c87ed5155c8dc 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -3628,6 +3628,35 @@ intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, } } +static int intel_dp_compute_dsc_slices_and_link_bpp(const struct intel_crtc_state *crtc_state, + struct intel_connector *connector, + int *dsc_slices, int *link_bpp_x16) +{ + struct intel_display *display = to_intel_display(crtc_state); + const struct drm_display_mode *adjusted_mode = + &crtc_state->hw.adjusted_mode; + + *dsc_slices = 0; + + if (crtc_state->dsc.compression_enable) { + *dsc_slices = intel_dp_dsc_get_slice_count(connector, + adjusted_mode->crtc_clock, + adjusted_mode->crtc_hdisplay, + intel_crtc_num_joined_pipes(crtc_state)); + if (!*dsc_slices) { + drm_dbg(display->drm, "failed to calculate dsc slice count\n"); + return -EINVAL; + } + + *link_bpp_x16 = crtc_state->dsc.compressed_bpp_x16; + } else { + *link_bpp_x16 = intel_dp_output_format_link_bpp_x16(crtc_state->output_format, + crtc_state->pipe_bpp); + } + + return 0; +} + int intel_dp_compute_min_hblank(struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state) { @@ -3642,12 +3671,12 @@ int intel_dp_compute_min_hblank(struct intel_crtc_state *crtc_state, */ int min_sym_cycles = intel_dp_is_uhbr(crtc_state) ? 3 : 5; bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST); - int num_joined_pipes = intel_crtc_num_joined_pipes(crtc_state); int min_hblank; int max_lane_count = 4; int hactive_sym_cycles, htotal_sym_cycles; int dsc_slices = 0; int link_bpp_x16; + int ret; if (DISPLAY_VER(display) < 30) return 0; @@ -3656,22 +3685,10 @@ int intel_dp_compute_min_hblank(struct intel_crtc_state *crtc_state, if (!is_mst && !intel_dp_is_uhbr(crtc_state)) return 0; - if (crtc_state->dsc.compression_enable) { - dsc_slices = intel_dp_dsc_get_slice_count(connector, - adjusted_mode->crtc_clock, - adjusted_mode->crtc_hdisplay, - num_joined_pipes); - if (!dsc_slices) { - drm_dbg(display->drm, "failed to calculate dsc slice count\n"); - return -EINVAL; - } - } - - if (crtc_state->dsc.compression_enable) - link_bpp_x16 = crtc_state->dsc.compressed_bpp_x16; - else - link_bpp_x16 = intel_dp_output_format_link_bpp_x16(crtc_state->output_format, - crtc_state->pipe_bpp); + ret = intel_dp_compute_dsc_slices_and_link_bpp(crtc_state, connector, + &dsc_slices, &link_bpp_x16); + if (ret) + return ret; /* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST & 128b/132b */ hactive_sym_cycles = drm_dp_link_symbol_cycles(max_lane_count, -- 2.25.1
