drm/msm/dpu: update the qos remap only if the client type changes
authorAbhinav Kumar <abhinavk@codeaurora.org>
Tue, 1 Dec 2020 23:38:55 +0000 (15:38 -0800)
committerRob Clark <robdclark@chromium.org>
Thu, 3 Dec 2020 16:49:24 +0000 (08:49 -0800)
Update the qos remap only if the client type changes for the plane.
This will avoid unnecessary register programming and also avoid log
spam from the dpu_vbif_set_qos_remap() function.

changes in v2:
 - get rid of the dirty flag and simplify the logic to call
   _dpu_plane_set_qos_remap()

Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h

index f679979ae0451fe23ff5cd039add2180d90386b6..bc0231a5013293a9706bdf6ac2c236d26336f82a 100644 (file)
@@ -954,6 +954,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
 {
        int ret = 0, min_scale;
        struct dpu_plane *pdpu = to_dpu_plane(plane);
+       struct dpu_plane_state *pstate = to_dpu_plane_state(state);
        const struct drm_crtc_state *crtc_state = NULL;
        const struct dpu_format *fmt;
        struct drm_rect src, dst, fb_rect = { 0 };
@@ -1026,6 +1027,8 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
                return -E2BIG;
        }
 
+       pstate->needs_qos_remap = drm_atomic_crtc_needs_modeset(crtc_state);
+
        return 0;
 }
 
@@ -1084,6 +1087,7 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane)
        struct dpu_plane_state *pstate = to_dpu_plane_state(state);
        struct drm_crtc *crtc = state->crtc;
        struct drm_framebuffer *fb = state->fb;
+       bool is_rt_pipe, update_qos_remap;
        const struct dpu_format *fmt =
                to_dpu_format(msm_framebuffer_format(fb));
 
@@ -1093,7 +1097,7 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane)
 
        pstate->pending = true;
 
-       pdpu->is_rt_pipe = (dpu_crtc_get_client_type(crtc) != NRT_CLIENT);
+       is_rt_pipe = (dpu_crtc_get_client_type(crtc) != NRT_CLIENT);
        _dpu_plane_set_qos_ctrl(plane, false, DPU_PLANE_QOS_PANIC_CTRL);
 
        DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u " DRM_RECT_FMT
@@ -1199,7 +1203,16 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane)
                _dpu_plane_set_ot_limit(plane, crtc);
        }
 
-       _dpu_plane_set_qos_remap(plane);
+       update_qos_remap = (is_rt_pipe != pdpu->is_rt_pipe) ||
+                       pstate->needs_qos_remap;
+
+       if (update_qos_remap) {
+               if (is_rt_pipe != pdpu->is_rt_pipe)
+                       pdpu->is_rt_pipe = is_rt_pipe;
+               else if (pstate->needs_qos_remap)
+                       pstate->needs_qos_remap = false;
+               _dpu_plane_set_qos_remap(plane);
+       }
 
        _dpu_plane_calc_bw(plane, fb);
 
index ca83b8753d590ce40b808bab8bf4d857c319bb6d..13a983fa8213452aee6179bb437d8837f904b7fa 100644 (file)
@@ -19,6 +19,7 @@
  * @base:      base drm plane state object
  * @aspace:    pointer to address space for input/output buffers
  * @stage:     assigned by crtc blender
+ * @needs_qos_remap: qos remap settings need to be updated
  * @multirect_index: index of the rectangle of SSPP
  * @multirect_mode: parallel or time multiplex multirect mode
  * @pending:   whether the current update is still pending
@@ -32,6 +33,7 @@ struct dpu_plane_state {
        struct drm_plane_state base;
        struct msm_gem_address_space *aspace;
        enum dpu_stage stage;
+       bool needs_qos_remap;
        uint32_t multirect_index;
        uint32_t multirect_mode;
        bool pending;