Skip to content

Commit 592b9bf

Browse files
committed
drm/i915/dp: Limit the output link bpp in DSC mode
Limit the output link bpp in DSC mode to the link_config_limits link.min_bpp_x16 .. max_bpp_x16 range the same way it's done in non-DSC mode. Atm this doesn't make a difference, the link bpp range being 0 .. max pipe bpp, but a follow-up patch will need a way to reduce max link bpp below its current value. v2: - Add to_bpp_int_roundup() instead of open coding it. (Jani) Cc: Jani Nikula <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Imre Deak <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 78015e2 commit 592b9bf

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,11 @@ static inline int to_bpp_frac(int bpp_x16)
21282128
#define BPP_X16_FMT "%d.%04d"
21292129
#define BPP_X16_ARGS(bpp_x16) to_bpp_int(bpp_x16), (to_bpp_frac(bpp_x16) * 625)
21302130

2131+
static inline int to_bpp_int_roundup(int bpp_x16)
2132+
{
2133+
return (bpp_x16 + 0xf) >> 4;
2134+
}
2135+
21312136
static inline int to_bpp_x16(int bpp)
21322137
{
21332138
return bpp << 4;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,7 @@ static int dsc_compute_compressed_bpp(struct intel_dp *intel_dp,
19251925
dsc_src_min_bpp = dsc_src_min_compressed_bpp();
19261926
dsc_sink_min_bpp = dsc_sink_min_compressed_bpp(pipe_config);
19271927
dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
1928+
dsc_min_bpp = max(dsc_min_bpp, to_bpp_int_roundup(limits->link.min_bpp_x16));
19281929

19291930
dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
19301931
dsc_sink_max_bpp = dsc_sink_max_compressed_bpp(intel_dp, pipe_config, pipe_bpp / 3);
@@ -1934,6 +1935,7 @@ static int dsc_compute_compressed_bpp(struct intel_dp *intel_dp,
19341935
adjusted_mode->hdisplay,
19351936
pipe_config->bigjoiner_pipes);
19361937
dsc_max_bpp = min(dsc_max_bpp, dsc_joiner_max_bpp);
1938+
dsc_max_bpp = min(dsc_max_bpp, to_bpp_int(limits->link.max_bpp_x16));
19371939

19381940
if (DISPLAY_VER(i915) >= 13)
19391941
return xelpd_dsc_compute_link_config(intel_dp, pipe_config, limits,
@@ -2079,10 +2081,12 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
20792081
dsc_src_min_bpp = dsc_src_min_compressed_bpp();
20802082
dsc_sink_min_bpp = dsc_sink_min_compressed_bpp(pipe_config);
20812083
dsc_min_bpp = max(dsc_src_min_bpp, dsc_sink_min_bpp);
2084+
dsc_min_bpp = max(dsc_min_bpp, to_bpp_int_roundup(limits->link.min_bpp_x16));
20822085

20832086
dsc_src_max_bpp = dsc_src_max_compressed_bpp(intel_dp);
20842087
dsc_sink_max_bpp = dsc_sink_max_compressed_bpp(intel_dp, pipe_config, pipe_bpp / 3);
20852088
dsc_max_bpp = dsc_sink_max_bpp ? min(dsc_sink_max_bpp, dsc_src_max_bpp) : dsc_src_max_bpp;
2089+
dsc_max_bpp = min(dsc_max_bpp, to_bpp_int(limits->link.max_bpp_x16));
20862090

20872091
/* Compressed BPP should be less than the Input DSC bpp */
20882092
dsc_max_bpp = min(dsc_max_bpp, pipe_bpp - 1);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ static int intel_dp_dsc_mst_compute_link_config(struct intel_encoder *encoder,
233233
if (max_bpp > sink_max_bpp)
234234
max_bpp = sink_max_bpp;
235235

236+
min_bpp = max(min_bpp, to_bpp_int_roundup(limits->link.min_bpp_x16));
237+
max_bpp = min(max_bpp, to_bpp_int(limits->link.max_bpp_x16));
238+
236239
slots = intel_dp_mst_find_vcpi_slots_for_bpp(encoder, crtc_state, max_bpp,
237240
min_bpp, limits,
238241
conn_state, 2 * 3, true);

0 commit comments

Comments
 (0)