From 3720455502a6a4e5f629c263507337842846874c Mon Sep 17 00:00:00 2001 From: Adrian Salido Date: Tue, 11 Feb 2020 15:29:50 -0800 Subject: [PATCH 1/2] drm/msm: minimize qos remap updates Updating qos remap updates requires reading registers to update values, this adds additional CPU processing when in reality this update is only needed once. Bug: 142504774 Change-Id: Iec8d4dfd858b0602db7d2275b6b716dbcffe0d2f (cherry picked from commit dbd1cfbc21db4b9bd4f1a4fc234cedc314fa1265) Signed-off-by: Adrian Salido Signed-off-by: Samantha Tran --- msm/sde/sde_plane.c | 15 ++++++++++++--- msm/sde/sde_plane.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/msm/sde/sde_plane.c b/msm/sde/sde_plane.c index abad3c215144..c367f98c93cc 100644 --- a/msm/sde/sde_plane.c +++ b/msm/sde/sde_plane.c @@ -3104,7 +3104,9 @@ static void _sde_plane_update_properties(struct drm_plane *plane, psde->pipe_hw->ops.setup_sharpening) _sde_plane_update_sharpening(psde); - _sde_plane_set_qos_lut(plane, crtc, fb); + if (pstate->dirty & (SDE_PLANE_DIRTY_QOS | SDE_PLANE_DIRTY_RECTS | + SDE_PLANE_DIRTY_FORMAT)) + _sde_plane_set_qos_lut(plane, crtc, fb); if (plane->type != DRM_PLANE_TYPE_CURSOR) { _sde_plane_set_qos_ctrl(plane, true, SDE_PLANE_QOS_PANIC_CTRL); @@ -3113,7 +3115,8 @@ static void _sde_plane_update_properties(struct drm_plane *plane, _sde_plane_set_ts_prefill(plane, pstate); } - _sde_plane_set_qos_remap(plane); + if (pstate->dirty & SDE_PLANE_DIRTY_QOS) + _sde_plane_set_qos_remap(plane); /* clear dirty */ pstate->dirty = 0x0; @@ -3130,6 +3133,7 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane, struct drm_framebuffer *fb; int idx; int dirty_prop_flag; + bool is_rt; if (!plane) { SDE_ERROR("invalid plane\n"); @@ -3206,12 +3210,17 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane, _sde_plane_set_scanout(plane, pstate, &psde->pipe_cfg, fb); + is_rt = sde_crtc_is_rt_client(crtc, crtc->state); + if (is_rt != psde->is_rt_pipe) { + psde->is_rt_pipe = is_rt; + pstate->dirty |= SDE_PLANE_DIRTY_QOS; + } + /* early out if nothing dirty */ if (!pstate->dirty) return 0; pstate->pending = true; - psde->is_rt_pipe = sde_crtc_is_rt_client(crtc, crtc->state); _sde_plane_set_qos_ctrl(plane, false, SDE_PLANE_QOS_PANIC_CTRL); _sde_plane_update_properties(plane, crtc, fb); diff --git a/msm/sde/sde_plane.h b/msm/sde/sde_plane.h index 316bd75f47d9..d055396421dc 100644 --- a/msm/sde/sde_plane.h +++ b/msm/sde/sde_plane.h @@ -36,6 +36,7 @@ #define SDE_PLANE_DIRTY_VIG_IGC 0x40 #define SDE_PLANE_DIRTY_DMA_IGC 0x80 #define SDE_PLANE_DIRTY_DMA_GC 0x100 +#define SDE_PLANE_DIRTY_QOS 0x200 #define SDE_PLANE_DIRTY_CP (SDE_PLANE_DIRTY_VIG_GAMUT |\ SDE_PLANE_DIRTY_VIG_IGC | SDE_PLANE_DIRTY_DMA_IGC |\ SDE_PLANE_DIRTY_DMA_GC) From 5217dfd7ea5104f3e0c637ac7297b7586044ce46 Mon Sep 17 00:00:00 2001 From: Samantha Tran Date: Fri, 14 Feb 2020 14:41:00 -0800 Subject: [PATCH 2/2] disp: msm: sde: update QoS values on FPS switch This change updates plane's dirty flag with QoS value to ensure QoS gets reprogrammed with new FPS settings. This is required as QoS values will change with FPS. Change-Id: I377b99da2a640d375bd48477f149197b332e7f7b Signed-off-by: Samantha Tran --- msm/sde/sde_crtc.c | 17 +++++++++++++++++ msm/sde/sde_crtc.h | 7 +++++++ msm/sde/sde_encoder.c | 2 ++ 3 files changed, 26 insertions(+) diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index 83a7bbef28db..72853a464093 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -5330,6 +5330,23 @@ exit: return ret; } +void sde_crtc_set_qos_dirty(struct drm_crtc *crtc) +{ + struct drm_plane *plane; + struct drm_plane_state *state; + struct sde_plane_state *pstate; + + drm_atomic_crtc_for_each_plane(plane, crtc) { + state = plane->state; + if (!state) + continue; + + pstate = to_sde_plane_state(state); + + pstate->dirty |= SDE_PLANE_DIRTY_QOS; + } +} + /** * sde_crtc_atomic_get_property - retrieve a crtc drm property * @crtc: Pointer to drm crtc structure diff --git a/msm/sde/sde_crtc.h b/msm/sde/sde_crtc.h index 3b5470b4b242..133446db6785 100644 --- a/msm/sde/sde_crtc.h +++ b/msm/sde/sde_crtc.h @@ -819,6 +819,13 @@ void sde_crtc_timeline_status(struct drm_crtc *crtc); void sde_crtc_update_cont_splash_settings( struct drm_crtc *crtc); +/** + * sde_crtc_set_qos_dirty - update plane dirty flag to include + * QoS reprogramming which is required during fps switch + * @crtc: Pointer to drm crtc structure + */ +void sde_crtc_set_qos_dirty(struct drm_crtc *crtc); + /** * sde_crtc_misr_setup - to configure and enable/disable MISR * @crtc: Pointer to drm crtc structure diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index 7c9ee432b0b3..5e255937be7d 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -2122,6 +2122,8 @@ static void sde_encoder_virt_mode_set(struct drm_encoder *drm_enc, } drm_connector_list_iter_end(&conn_iter); + sde_crtc_set_qos_dirty(sde_enc->crtc); + if (!conn) { SDE_ERROR_ENC(sde_enc, "failed to find attached connector\n"); return;