struct intel_display *display = to_intel_display(intel_dp);
const struct intel_connector *connector = to_intel_connector(conn_state->connector);
int min_bpp_x16, max_bpp_x16, bpp_step_x16;
- int link_bpp_x16;
int bpp_x16;
int ret;
+ min_bpp_x16 = limits->link.min_bpp_x16;
max_bpp_x16 = limits->link.max_bpp_x16;
bpp_step_x16 = intel_dp_dsc_bpp_step_x16(connector);
- /* Compressed BPP should be less than the Input DSC bpp */
- link_bpp_x16 = intel_dp_output_format_link_bpp_x16(pipe_config->output_format, pipe_bpp);
- max_bpp_x16 = min(max_bpp_x16, link_bpp_x16 - bpp_step_x16);
-
- drm_WARN_ON(display->drm, !is_power_of_2(bpp_step_x16));
- min_bpp_x16 = round_up(limits->link.min_bpp_x16, bpp_step_x16);
- max_bpp_x16 = round_down(max_bpp_x16, bpp_step_x16);
+ max_bpp_x16 = align_max_compressed_bpp_x16(connector, pipe_config->output_format,
+ pipe_bpp, max_bpp_x16);
for (bpp_x16 = max_bpp_x16; bpp_x16 >= min_bpp_x16; bpp_x16 -= bpp_step_x16) {
if (!intel_dp_dsc_valid_compressed_bpp(intel_dp, bpp_x16))
struct intel_connector *connector =
to_intel_connector(conn_state->connector);
int pipe_bpp, forced_bpp;
- int dsc_min_bpp;
- int dsc_max_bpp;
forced_bpp = intel_dp_force_dsc_pipe_bpp(intel_dp, limits);
pipe_config->port_clock = limits->max_rate;
pipe_config->lane_count = limits->max_lane_count;
- dsc_min_bpp = fxp_q4_to_int_roundup(limits->link.min_bpp_x16);
-
- dsc_max_bpp = fxp_q4_to_int(limits->link.max_bpp_x16);
-
- /* 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_x16 =
- fxp_q4_from_int(max(dsc_min_bpp, dsc_max_bpp));
+ align_max_compressed_bpp_x16(connector, pipe_config->output_format,
+ pipe_bpp, limits->link.max_bpp_x16);
pipe_config->pipe_bpp = pipe_bpp;