Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/636058/
Link: https://lore.kernel.org/r/20250209-dpu-perf-rework-v5-1-87e936cf3004@linaro.org

+26 -21
+26 -21
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
··· 210 210 return 0; 211 211 } 212 212 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) 216 + { 217 + struct dpu_crtc_state *dpu_cstate; 218 + struct drm_crtc *tmp_crtc; 219 + 220 + drm_for_each_crtc(tmp_crtc, ddev) { 221 + if (tmp_crtc->enabled && 222 + curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { 223 + dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); 224 + 225 + perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, 226 + dpu_cstate->new_perf.max_per_pipe_ib); 227 + 228 + perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; 229 + 230 + DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", 231 + tmp_crtc->base.id, 232 + dpu_cstate->new_perf.bw_ctl); 233 + } 234 + } 235 + } 236 + 213 237 static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, 214 - struct drm_crtc *crtc) 238 + struct drm_crtc *crtc) 215 239 { 216 240 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; 220 - struct dpu_crtc_state *dpu_cstate; 221 241 int i, ret = 0; 222 242 u64 avg_bw; 223 243 224 244 if (!kms->num_paths) 225 245 return 0; 226 246 227 - drm_for_each_crtc(tmp_crtc, crtc->dev) { 228 - if (tmp_crtc->enabled && 229 - curr_client_type == 230 - dpu_crtc_get_client_type(tmp_crtc)) { 231 - dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); 232 - 233 - perf.max_per_pipe_ib = max(perf.max_per_pipe_ib, 234 - dpu_cstate->new_perf.max_per_pipe_ib); 235 - 236 - perf.bw_ctl += dpu_cstate->new_perf.bw_ctl; 237 - 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); 241 - } 242 - } 247 + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); 243 248 244 249 avg_bw = perf.bw_ctl; 245 250 do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/