Skip to content

Commit 4d2dd78

Browse files
committed
drm/i915/dp: Use helpers to align min/max compressed BPPs
The minimum/maximum compressed BPP values are aligned/bounded in intel_dp_compute_link_bpp_limits() to the corresponding source limits. The minimum compressed BPP value doesn't change afterwards, so no need to align it again, remove that. The maximum compressed BPP, which depends on the pipe BPP value still needs to be aligned, since the pipe BPP value could change after the above limits were computed, via intel_dp_force_dsc_pipe_bpp(). Use the corresponding helper for this alignment instead of open-coding the same. Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patch.msgid.link/20251222153547.713360-15-imre.deak@intel.com
1 parent 2bd5dd6 commit 4d2dd78

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,20 +2218,15 @@ static int dsc_compute_compressed_bpp(struct intel_dp *intel_dp,
22182218
struct intel_display *display = to_intel_display(intel_dp);
22192219
const struct intel_connector *connector = to_intel_connector(conn_state->connector);
22202220
int min_bpp_x16, max_bpp_x16, bpp_step_x16;
2221-
int link_bpp_x16;
22222221
int bpp_x16;
22232222
int ret;
22242223

2224+
min_bpp_x16 = limits->link.min_bpp_x16;
22252225
max_bpp_x16 = limits->link.max_bpp_x16;
22262226
bpp_step_x16 = intel_dp_dsc_bpp_step_x16(connector);
22272227

2228-
/* Compressed BPP should be less than the Input DSC bpp */
2229-
link_bpp_x16 = intel_dp_output_format_link_bpp_x16(pipe_config->output_format, pipe_bpp);
2230-
max_bpp_x16 = min(max_bpp_x16, link_bpp_x16 - bpp_step_x16);
2231-
2232-
drm_WARN_ON(display->drm, !is_power_of_2(bpp_step_x16));
2233-
min_bpp_x16 = round_up(limits->link.min_bpp_x16, bpp_step_x16);
2234-
max_bpp_x16 = round_down(max_bpp_x16, bpp_step_x16);
2228+
max_bpp_x16 = align_max_compressed_bpp_x16(connector, pipe_config->output_format,
2229+
pipe_bpp, max_bpp_x16);
22352230

22362231
for (bpp_x16 = max_bpp_x16; bpp_x16 >= min_bpp_x16; bpp_x16 -= bpp_step_x16) {
22372232
if (!intel_dp_dsc_valid_compressed_bpp(intel_dp, bpp_x16))
@@ -2347,8 +2342,6 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
23472342
struct intel_connector *connector =
23482343
to_intel_connector(conn_state->connector);
23492344
int pipe_bpp, forced_bpp;
2350-
int dsc_min_bpp;
2351-
int dsc_max_bpp;
23522345

23532346
forced_bpp = intel_dp_force_dsc_pipe_bpp(intel_dp, limits);
23542347

@@ -2368,15 +2361,9 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
23682361
pipe_config->port_clock = limits->max_rate;
23692362
pipe_config->lane_count = limits->max_lane_count;
23702363

2371-
dsc_min_bpp = fxp_q4_to_int_roundup(limits->link.min_bpp_x16);
2372-
2373-
dsc_max_bpp = fxp_q4_to_int(limits->link.max_bpp_x16);
2374-
2375-
/* Compressed BPP should be less than the Input DSC bpp */
2376-
dsc_max_bpp = min(dsc_max_bpp, pipe_bpp - 1);
2377-
23782364
pipe_config->dsc.compressed_bpp_x16 =
2379-
fxp_q4_from_int(max(dsc_min_bpp, dsc_max_bpp));
2365+
align_max_compressed_bpp_x16(connector, pipe_config->output_format,
2366+
pipe_bpp, limits->link.max_bpp_x16);
23802367

23812368
pipe_config->pipe_bpp = pipe_bpp;
23822369

0 commit comments

Comments
 (0)