Skip to content

Commit 0f1ceee

Browse files
committed
drm/i915/dp_mst: Sanitize calculating the DSC DPT bpp limit
Instead of checking each compressed bpp value against the maximum DSC/DPT bpp, simplify things by calculating the maximum bpp upfront and limiting the range of bpps looped over using this maximum. While at it add a comment about the origin of the DSC/DPT bpp limit. Bspec: 49259, 68912 Reviewed-by: Ankit Nautiyal <[email protected]> Signed-off-by: Imre Deak <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e54cc6d commit 0f1ceee

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

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

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,43 +51,39 @@
5151
#include "intel_vdsc.h"
5252
#include "skl_scaler.h"
5353

54-
static int intel_dp_mst_check_constraints(struct drm_i915_private *i915, int bpp,
55-
const struct drm_display_mode *adjusted_mode,
56-
struct intel_crtc_state *crtc_state,
57-
bool dsc)
54+
static int intel_dp_mst_max_dpt_bpp(const struct intel_crtc_state *crtc_state,
55+
bool dsc)
5856
{
59-
if (intel_dp_is_uhbr(crtc_state) && DISPLAY_VER(i915) < 20 && dsc) {
60-
int output_bpp = bpp;
61-
int symbol_clock = intel_dp_link_symbol_clock(crtc_state->port_clock);
62-
/*
63-
* Bspec/49259 suggests that the FEC overhead needs to be
64-
* applied here, though HW people claim that neither this FEC
65-
* or any other overhead is applicable here (that is the actual
66-
* available_bw is just symbol_clock * 72). However based on
67-
* testing on MTL-P the
68-
* - DELL U3224KBA display
69-
* - Unigraf UCD-500 CTS test sink
70-
* devices the
71-
* - 5120x2880/995.59Mhz
72-
* - 6016x3384/1357.23Mhz
73-
* - 6144x3456/1413.39Mhz
74-
* modes (all the ones having a DPT limit on the above devices),
75-
* both the channel coding efficiency and an additional 3%
76-
* overhead needs to be accounted for.
77-
*/
78-
int available_bw = mul_u32_u32(symbol_clock * 72,
79-
drm_dp_bw_channel_coding_efficiency(true)) /
80-
1030000;
81-
82-
if (output_bpp * adjusted_mode->crtc_clock >
83-
available_bw) {
84-
drm_dbg_kms(&i915->drm, "UHBR check failed(required bw %d available %d)\n",
85-
output_bpp * adjusted_mode->crtc_clock, available_bw);
86-
return -EINVAL;
87-
}
88-
}
57+
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
58+
const struct drm_display_mode *adjusted_mode =
59+
&crtc_state->hw.adjusted_mode;
8960

90-
return 0;
61+
if (!intel_dp_is_uhbr(crtc_state) || DISPLAY_VER(i915) >= 20 || !dsc)
62+
return INT_MAX;
63+
64+
/*
65+
* DSC->DPT interface width:
66+
* ICL-MTL: 72 bits (each branch has 72 bits, only left branch is used)
67+
* LNL+: 144 bits (not a bottleneck in any config)
68+
*
69+
* Bspec/49259 suggests that the FEC overhead needs to be
70+
* applied here, though HW people claim that neither this FEC
71+
* or any other overhead is applicable here (that is the actual
72+
* available_bw is just symbol_clock * 72). However based on
73+
* testing on MTL-P the
74+
* - DELL U3224KBA display
75+
* - Unigraf UCD-500 CTS test sink
76+
* devices the
77+
* - 5120x2880/995.59Mhz
78+
* - 6016x3384/1357.23Mhz
79+
* - 6144x3456/1413.39Mhz
80+
* modes (all the ones having a DPT limit on the above devices),
81+
* both the channel coding efficiency and an additional 3%
82+
* overhead needs to be accounted for.
83+
*/
84+
return div64_u64(mul_u32_u32(intel_dp_link_symbol_clock(crtc_state->port_clock) * 72,
85+
drm_dp_bw_channel_coding_efficiency(true)),
86+
mul_u32_u32(adjusted_mode->crtc_clock, 1030000));
9187
}
9288

9389
static int intel_dp_mst_bw_overhead(const struct intel_crtc_state *crtc_state,
@@ -175,6 +171,7 @@ static int intel_dp_mst_find_vcpi_slots_for_bpp(struct intel_encoder *encoder,
175171
const struct drm_display_mode *adjusted_mode =
176172
&crtc_state->hw.adjusted_mode;
177173
int bpp, slots = -EINVAL;
174+
int max_dpt_bpp;
178175
int ret = 0;
179176

180177
mst_state = drm_atomic_get_mst_topology_state(state, &intel_dp->mst_mgr);
@@ -195,6 +192,13 @@ static int intel_dp_mst_find_vcpi_slots_for_bpp(struct intel_encoder *encoder,
195192
crtc_state->port_clock,
196193
crtc_state->lane_count);
197194

195+
max_dpt_bpp = intel_dp_mst_max_dpt_bpp(crtc_state, dsc);
196+
if (max_bpp > max_dpt_bpp) {
197+
drm_dbg_kms(&i915->drm, "Limiting bpp to max DPT bpp (%d -> %d)\n",
198+
max_bpp, max_dpt_bpp);
199+
max_bpp = max_dpt_bpp;
200+
}
201+
198202
drm_dbg_kms(&i915->drm, "Looking for slots in range min bpp %d max bpp %d\n",
199203
min_bpp, max_bpp);
200204

@@ -206,10 +210,6 @@ static int intel_dp_mst_find_vcpi_slots_for_bpp(struct intel_encoder *encoder,
206210

207211
drm_dbg_kms(&i915->drm, "Trying bpp %d\n", bpp);
208212

209-
ret = intel_dp_mst_check_constraints(i915, bpp, adjusted_mode, crtc_state, dsc);
210-
if (ret)
211-
continue;
212-
213213
link_bpp_x16 = to_bpp_x16(dsc ? bpp :
214214
intel_dp_output_bpp(crtc_state->output_format, bpp));
215215

0 commit comments

Comments
 (0)