summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2025-12-22 17:35:41 +0200
committerImre Deak <imre.deak@intel.com>2026-01-13 18:42:18 +0200
commit4d2dd780970d33d4dd66c718077ee703938b0a71 (patch)
tree729296eecb1ee9108150b00057c77e5b94b6e866 /drivers/gpu
parent2bd5dd6e720952778233636e0d0dd1ede3563634 (diff)
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
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/display/intel_dp.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index e59c06b6e0b9..36cbb6aef243 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2218,20 +2218,15 @@ static int dsc_compute_compressed_bpp(struct intel_dp *intel_dp,
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))
@@ -2347,8 +2342,6 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
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);
@@ -2368,15 +2361,9 @@ 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;
- 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;