Skip to content

Commit 6d3175a

Browse files
committed
drm/msm/dpu: handle perf mode in _dpu_core_perf_crtc_update_bus()
Move perf mode handling for the bandwidth to _dpu_core_perf_crtc_update_bus() rather than overriding per-CRTC data and then aggregating known values. Note, this changes the fix_core_ab_vote. Previously it would be multiplied per the CRTC number, now it will be used directly for interconnect voting. This better reflects user requirements in the case of different resolutions being set on different CRTCs: instead of using the same bandwidth for each CRTC (which is incorrect) user can now calculate overall bandwidth required by all outputs and use that value. Note #2: this also disables threshold checks for user-entered bandwidth values. First of all, it doesn't make sense to fail atomic commits because of the debugfs input. Compositors have no way to correlate failing commits with debugfs settings. Second, it makes sense to allow users to go beyond these values and check whether this makes any difference or fixes the issue. Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/636072/ Link: https://lore.kernel.org/r/[email protected]
1 parent e7e2495 commit 6d3175a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,9 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf,
118118
return;
119119
}
120120

121-
memset(perf, 0, sizeof(struct dpu_core_perf_params));
122-
123-
if (core_perf->perf_tune.mode == DPU_PERF_MODE_MINIMUM) {
124-
perf->bw_ctl = 0;
125-
perf->max_per_pipe_ib = 0;
126-
} else if (core_perf->perf_tune.mode == DPU_PERF_MODE_FIXED) {
127-
perf->bw_ctl = core_perf->fix_core_ab_vote * 1000ULL;
128-
perf->max_per_pipe_ib = core_perf->fix_core_ib_vote;
129-
} else {
130-
perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc);
131-
perf->max_per_pipe_ib = perf_cfg->min_dram_ib;
132-
}
121+
perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc);
122+
perf->max_per_pipe_ib = perf_cfg->min_dram_ib;
133123
perf->core_clk_rate = _dpu_core_perf_calc_clk(perf_cfg, crtc, state);
134-
135124
DRM_DEBUG_ATOMIC(
136125
"crtc=%d clk_rate=%llu core_ib=%u core_ab=%u\n",
137126
crtc->base.id, perf->core_clk_rate,
@@ -220,18 +209,29 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms,
220209
{
221210
struct dpu_core_perf_params perf = { 0 };
222211
int i, ret = 0;
223-
u64 avg_bw;
212+
u32 avg_bw;
213+
u32 peak_bw;
224214

225215
if (!kms->num_paths)
226216
return 0;
227217

228-
dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf);
218+
if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) {
219+
avg_bw = 0;
220+
peak_bw = 0;
221+
} else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) {
222+
avg_bw = kms->perf.fix_core_ab_vote;
223+
peak_bw = kms->perf.fix_core_ib_vote;
224+
} else {
225+
dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf);
226+
227+
avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/
228+
peak_bw = perf.max_per_pipe_ib;
229+
}
229230

230-
avg_bw = perf.bw_ctl;
231-
do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/
231+
avg_bw /= kms->num_paths;
232232

233233
for (i = 0; i < kms->num_paths; i++)
234-
icc_set_bw(kms->path[i], avg_bw, perf.max_per_pipe_ib);
234+
icc_set_bw(kms->path[i], avg_bw, peak_bw);
235235

236236
return ret;
237237
}

0 commit comments

Comments
 (0)