Skip to content

Commit f55c1f6

Browse files
committed
drm/i915/dp: Align min/max compressed BPPs when calculating BPP limits
Align the minimum/maximum DSC compressed BPPs to the corresponding source compressed BPP limits already when computing the BPP limits. This alignment is also performed later during state computation, however there is no reason to initialize the limits to an unaligned/incorrect value. Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patch.msgid.link/20251222153547.713360-7-imre.deak@intel.com
1 parent 753d6b4 commit f55c1f6

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,20 @@ small_joiner_ram_size_bits(struct intel_display *display)
868868
return 6144 * 8;
869869
}
870870

871+
static int align_min_vesa_compressed_bpp_x16(int min_link_bpp_x16)
872+
{
873+
int i;
874+
875+
for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp); i++) {
876+
int vesa_bpp_x16 = fxp_q4_from_int(valid_dsc_bpp[i]);
877+
878+
if (vesa_bpp_x16 >= min_link_bpp_x16)
879+
return vesa_bpp_x16;
880+
}
881+
882+
return 0;
883+
}
884+
871885
static int align_max_vesa_compressed_bpp_x16(int max_link_bpp_x16)
872886
{
873887
int i;
@@ -2262,6 +2276,40 @@ bool intel_dp_dsc_valid_compressed_bpp(struct intel_dp *intel_dp, int bpp_x16)
22622276
return align_max_vesa_compressed_bpp_x16(bpp_x16) == bpp_x16;
22632277
}
22642278

2279+
static int align_min_compressed_bpp_x16(const struct intel_connector *connector, int min_bpp_x16)
2280+
{
2281+
struct intel_display *display = to_intel_display(connector);
2282+
2283+
if (DISPLAY_VER(display) >= 13) {
2284+
int bpp_step_x16 = intel_dp_dsc_bpp_step_x16(connector);
2285+
2286+
drm_WARN_ON(display->drm, !is_power_of_2(bpp_step_x16));
2287+
2288+
return round_up(min_bpp_x16, bpp_step_x16);
2289+
} else {
2290+
return align_min_vesa_compressed_bpp_x16(min_bpp_x16);
2291+
}
2292+
}
2293+
2294+
static int align_max_compressed_bpp_x16(const struct intel_connector *connector,
2295+
enum intel_output_format output_format,
2296+
int pipe_bpp, int max_bpp_x16)
2297+
{
2298+
struct intel_display *display = to_intel_display(connector);
2299+
int link_bpp_x16 = intel_dp_output_format_link_bpp_x16(output_format, pipe_bpp);
2300+
int bpp_step_x16 = intel_dp_dsc_bpp_step_x16(connector);
2301+
2302+
max_bpp_x16 = min(max_bpp_x16, link_bpp_x16 - bpp_step_x16);
2303+
2304+
if (DISPLAY_VER(display) >= 13) {
2305+
drm_WARN_ON(display->drm, !is_power_of_2(bpp_step_x16));
2306+
2307+
return round_down(max_bpp_x16, bpp_step_x16);
2308+
} else {
2309+
return align_max_vesa_compressed_bpp_x16(max_bpp_x16);
2310+
}
2311+
}
2312+
22652313
/*
22662314
* Find the max compressed BPP we can find a link configuration for. The BPPs to
22672315
* try depend on the source (platform) and sink.
@@ -2640,6 +2688,9 @@ intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp,
26402688
dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
26412689
limits->link.min_bpp_x16 = fxp_q4_from_int(dsc_min_bpp);
26422690

2691+
limits->link.min_bpp_x16 =
2692+
align_min_compressed_bpp_x16(connector, limits->link.min_bpp_x16);
2693+
26432694
dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
26442695
joiner_max_bpp =
26452696
get_max_compressed_bpp_with_joiner(display,
@@ -2664,6 +2715,12 @@ intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp,
26642715
connector->base.base.id, connector->base.name,
26652716
FXP_Q4_ARGS(max_link_bpp_x16));
26662717
}
2718+
2719+
max_link_bpp_x16 =
2720+
align_max_compressed_bpp_x16(connector,
2721+
crtc_state->output_format,
2722+
limits->pipe.max_bpp,
2723+
max_link_bpp_x16);
26672724
}
26682725

26692726
limits->link.max_bpp_x16 = max_link_bpp_x16;

0 commit comments

Comments
 (0)