Skip to content

Commit b9aedd3

Browse files
committed
drm/msm/dpu: extract bandwidth aggregation function
In preparation to refactoring the dpu_core_perf debugfs interface, extract the bandwidth aggregation function from _dpu_core_perf_crtc_update_bus(). Reviewed-by: Abhinav Kumar <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/636058/ Link: https://lore.kernel.org/r/[email protected]
1 parent 989a242 commit b9aedd3

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

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

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -210,36 +210,41 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc,
210210
return 0;
211211
}
212212

213-
static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms,
214-
struct drm_crtc *crtc)
213+
static void dpu_core_perf_aggregate(struct drm_device *ddev,
214+
enum dpu_crtc_client_type curr_client_type,
215+
struct dpu_core_perf_params *perf)
215216
{
216-
struct dpu_core_perf_params perf = { 0 };
217-
enum dpu_crtc_client_type curr_client_type
218-
= dpu_crtc_get_client_type(crtc);
219-
struct drm_crtc *tmp_crtc;
220217
struct dpu_crtc_state *dpu_cstate;
221-
int i, ret = 0;
222-
u64 avg_bw;
223-
224-
if (!kms->num_paths)
225-
return 0;
218+
struct drm_crtc *tmp_crtc;
226219

227-
drm_for_each_crtc(tmp_crtc, crtc->dev) {
220+
drm_for_each_crtc(tmp_crtc, ddev) {
228221
if (tmp_crtc->enabled &&
229-
curr_client_type ==
230-
dpu_crtc_get_client_type(tmp_crtc)) {
222+
curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) {
231223
dpu_cstate = to_dpu_crtc_state(tmp_crtc->state);
232224

233-
perf.max_per_pipe_ib = max(perf.max_per_pipe_ib,
234-
dpu_cstate->new_perf.max_per_pipe_ib);
225+
perf->max_per_pipe_ib = max(perf->max_per_pipe_ib,
226+
dpu_cstate->new_perf.max_per_pipe_ib);
235227

236-
perf.bw_ctl += dpu_cstate->new_perf.bw_ctl;
228+
perf->bw_ctl += dpu_cstate->new_perf.bw_ctl;
237229

238-
DRM_DEBUG_ATOMIC("crtc=%d bw=%llu paths:%d\n",
239-
tmp_crtc->base.id,
240-
dpu_cstate->new_perf.bw_ctl, kms->num_paths);
230+
DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n",
231+
tmp_crtc->base.id,
232+
dpu_cstate->new_perf.bw_ctl);
241233
}
242234
}
235+
}
236+
237+
static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms,
238+
struct drm_crtc *crtc)
239+
{
240+
struct dpu_core_perf_params perf = { 0 };
241+
int i, ret = 0;
242+
u64 avg_bw;
243+
244+
if (!kms->num_paths)
245+
return 0;
246+
247+
dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf);
243248

244249
avg_bw = perf.bw_ctl;
245250
do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/

0 commit comments

Comments
 (0)