On 3/13/2024 6:10 PM, Dmitry Baryshkov wrote:
The max_per_pipe_ib is a constant across all CRTCs and is read from the
catalog. Drop corresponding calculations and read the value directly at
icc_set_bw() time.

Suggested-by: Konrad Dybcio <konrad.dyb...@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 17 +++++------------
  drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  2 --
  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |  2 --
  3 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
index 2e78e57665fc..2fc05665dc7a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
@@ -105,13 +105,12 @@ static void _dpu_core_perf_calc_crtc(const struct 
dpu_core_perf *core_perf,
        }
perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc);
-       perf->max_per_pipe_ib = perf_cfg->min_dram_ib;
        perf->core_clk_rate = _dpu_core_perf_calc_clk(perf_cfg, crtc, state);
DRM_DEBUG_ATOMIC(
-               "crtc=%d clk_rate=%llu core_ib=%llu core_ab=%llu\n",
+               "crtc=%d clk_rate=%llu core_ab=%llu\n",
                        crtc->base.id, perf->core_clk_rate,
-                       perf->max_per_pipe_ib, perf->bw_ctl);
+                       perf->bw_ctl);
  }
int dpu_core_perf_crtc_check(struct drm_crtc *crtc,
@@ -190,9 +189,6 @@ static void dpu_core_perf_aggregate(struct drm_device *ddev,
                    curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) {
                        dpu_cstate = to_dpu_crtc_state(tmp_crtc->state);
- perf->max_per_pipe_ib = max(perf->max_per_pipe_ib,
-                                                   
dpu_cstate->new_perf.max_per_pipe_ib);

during the override case

perf->max_per_pipe_ib = core_perf->fix_core_ib_vote

So this is one case where max_per_pipe_ib can actually be changed right?

Now, fix_core_ib_vote will not be used then?

-
                        perf->bw_ctl += dpu_cstate->new_perf.bw_ctl;
DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n",
@@ -216,7 +212,7 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms 
*kms,
        dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), 
&perf);
avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/
-       peak_bw = perf.max_per_pipe_ib;
+       peak_bw = kms->catalog->perf->min_dram_ib;
if (kms->perf.fix_core_ab_vote)
                avg_bw = kms->perf.fix_core_ab_vote;
@@ -321,15 +317,12 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
                 * 2. new bandwidth vote - "ab or ib vote" is lower
                 *    than current vote at end of commit or stop.
                 */
-               if ((params_changed && ((new->bw_ctl > old->bw_ctl) ||
-                       (new->max_per_pipe_ib > old->max_per_pipe_ib)))        
||
-                       (!params_changed && ((new->bw_ctl < old->bw_ctl) ||
-                       (new->max_per_pipe_ib < old->max_per_pipe_ib)))) {
+               if ((params_changed && new->bw_ctl > old->bw_ctl) ||
+                   (!params_changed && new->bw_ctl < old->bw_ctl)) {
                        DRM_DEBUG_ATOMIC("crtc=%d p=%d 
new_bw=%llu,old_bw=%llu\n",
                                crtc->base.id, params_changed,
                                new->bw_ctl, old->bw_ctl);
                        old->bw_ctl = new->bw_ctl;
-                       old->max_per_pipe_ib = new->max_per_pipe_ib;
                        update_bus = true;
                }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
index 5a3d18ca9555..a5a9c3389718 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
@@ -14,12 +14,10 @@
/**
   * struct dpu_core_perf_params - definition of performance parameters
- * @max_per_pipe_ib: maximum instantaneous bandwidth request
   * @bw_ctl: arbitrated bandwidth request
   * @core_clk_rate: core clock rate request
   */
  struct dpu_core_perf_params {
-       u64 max_per_pipe_ib;
        u64 bw_ctl;
        u64 core_clk_rate;
  };
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 88c2e51ab166..771c04c1a5ea 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1389,8 +1389,6 @@ static int dpu_crtc_debugfs_state_show(struct seq_file 
*s, void *v)
        seq_printf(s, "core_clk_rate: %llu\n",
                        dpu_crtc->cur_perf.core_clk_rate);
        seq_printf(s, "bw_ctl: %llu\n", dpu_crtc->cur_perf.bw_ctl);
-       seq_printf(s, "max_per_pipe_ib: %llu\n",
-                               dpu_crtc->cur_perf.max_per_pipe_ib);
return 0;
  }

Reply via email to