Skip to content

Commit f6971d7

Browse files
committed
drm/i915/mst: adapt intel_dp_mtp_tu_compute_config() for 128b/132b SST
Handle 128b/132b SST in intel_dp_mtp_tu_compute_config(). The remote bandwidth overhead and time slot allocation are only relevant for MST; SST only needs the local bandwidth and a check that 64 slots isn't exceeded. Reviewed-by: Imre Deak <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/b59c94b0aac2c073b0306c0a0040b26330f94260.1735912293.git.jani.nikula@intel.com
1 parent 1ed21a6 commit f6971d7

File tree

1 file changed

+61
-48
lines changed

1 file changed

+61
-48
lines changed

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

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,7 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
257257

258258
for (bpp = max_bpp; bpp >= min_bpp; bpp -= step) {
259259
int local_bw_overhead;
260-
int remote_bw_overhead;
261260
int link_bpp_x16;
262-
int remote_tu;
263-
fixed20_12 pbn;
264261

265262
drm_dbg_kms(display->drm, "Trying bpp %d\n", bpp);
266263

@@ -269,57 +266,73 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
269266

270267
local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
271268
false, dsc_slice_count, link_bpp_x16);
272-
remote_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
273-
true, dsc_slice_count, link_bpp_x16);
274-
275269
intel_dp_mst_compute_m_n(crtc_state,
276270
local_bw_overhead,
277271
link_bpp_x16,
278272
&crtc_state->dp_m_n);
279273

280-
/*
281-
* The TU size programmed to the HW determines which slots in
282-
* an MTP frame are used for this stream, which needs to match
283-
* the payload size programmed to the first downstream branch
284-
* device's payload table.
285-
*
286-
* Note that atm the payload's PBN value DRM core sends via
287-
* the ALLOCATE_PAYLOAD side-band message matches the payload
288-
* size (which it calculates from the PBN value) it programs
289-
* to the first branch device's payload table. The allocation
290-
* in the payload table could be reduced though (to
291-
* crtc_state->dp_m_n.tu), provided that the driver doesn't
292-
* enable SSC on the corresponding link.
293-
*/
294-
pbn.full = dfixed_const(intel_dp_mst_calc_pbn(adjusted_mode->crtc_clock,
295-
link_bpp_x16,
296-
remote_bw_overhead));
297-
remote_tu = DIV_ROUND_UP(pbn.full, pbn_div.full);
298-
299-
/*
300-
* Aligning the TUs ensures that symbols consisting of multiple
301-
* (4) symbol cycles don't get split between two consecutive
302-
* MTPs, as required by Bspec.
303-
* TODO: remove the alignment restriction for 128b/132b links
304-
* on some platforms, where Bspec allows this.
305-
*/
306-
remote_tu = ALIGN(remote_tu, 4 / crtc_state->lane_count);
307-
308-
/*
309-
* Also align PBNs accordingly, since MST core will derive its
310-
* own copy of TU from the PBN in drm_dp_atomic_find_time_slots().
311-
* The above comment about the difference between the PBN
312-
* allocated for the whole path and the TUs allocated for the
313-
* first branch device's link also applies here.
314-
*/
315-
pbn.full = remote_tu * pbn_div.full;
316-
317-
drm_WARN_ON(display->drm, remote_tu < crtc_state->dp_m_n.tu);
318-
crtc_state->dp_m_n.tu = remote_tu;
274+
if (intel_dp->is_mst) {
275+
int remote_bw_overhead;
276+
int remote_tu;
277+
fixed20_12 pbn;
278+
279+
remote_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
280+
true, dsc_slice_count, link_bpp_x16);
281+
282+
/*
283+
* The TU size programmed to the HW determines which slots in
284+
* an MTP frame are used for this stream, which needs to match
285+
* the payload size programmed to the first downstream branch
286+
* device's payload table.
287+
*
288+
* Note that atm the payload's PBN value DRM core sends via
289+
* the ALLOCATE_PAYLOAD side-band message matches the payload
290+
* size (which it calculates from the PBN value) it programs
291+
* to the first branch device's payload table. The allocation
292+
* in the payload table could be reduced though (to
293+
* crtc_state->dp_m_n.tu), provided that the driver doesn't
294+
* enable SSC on the corresponding link.
295+
*/
296+
pbn.full = dfixed_const(intel_dp_mst_calc_pbn(adjusted_mode->crtc_clock,
297+
link_bpp_x16,
298+
remote_bw_overhead));
299+
remote_tu = DIV_ROUND_UP(pbn.full, pbn_div.full);
300+
301+
/*
302+
* Aligning the TUs ensures that symbols consisting of multiple
303+
* (4) symbol cycles don't get split between two consecutive
304+
* MTPs, as required by Bspec.
305+
* TODO: remove the alignment restriction for 128b/132b links
306+
* on some platforms, where Bspec allows this.
307+
*/
308+
remote_tu = ALIGN(remote_tu, 4 / crtc_state->lane_count);
309+
310+
/*
311+
* Also align PBNs accordingly, since MST core will derive its
312+
* own copy of TU from the PBN in drm_dp_atomic_find_time_slots().
313+
* The above comment about the difference between the PBN
314+
* allocated for the whole path and the TUs allocated for the
315+
* first branch device's link also applies here.
316+
*/
317+
pbn.full = remote_tu * pbn_div.full;
318+
319+
drm_WARN_ON(display->drm, remote_tu < crtc_state->dp_m_n.tu);
320+
crtc_state->dp_m_n.tu = remote_tu;
321+
322+
slots = drm_dp_atomic_find_time_slots(state, &intel_dp->mst_mgr,
323+
connector->port,
324+
dfixed_trunc(pbn));
325+
} else {
326+
/* Same as above for remote_tu */
327+
crtc_state->dp_m_n.tu = ALIGN(crtc_state->dp_m_n.tu,
328+
4 / crtc_state->lane_count);
329+
330+
if (crtc_state->dp_m_n.tu <= 64)
331+
slots = crtc_state->dp_m_n.tu;
332+
else
333+
slots = -EINVAL;
334+
}
319335

320-
slots = drm_dp_atomic_find_time_slots(state, &intel_dp->mst_mgr,
321-
connector->port,
322-
dfixed_trunc(pbn));
323336
if (slots == -EDEADLK)
324337
return slots;
325338

0 commit comments

Comments
 (0)