From 4d27e37beb65128023597a32edfa62f37566d213 Mon Sep 17 00:00:00 2001 From: Ping Li Date: Tue, 19 Oct 2021 20:32:06 -0700 Subject: [PATCH] disp: msm: sde: add new function for updating the cp feature lists only When sde_crtc_atomic_begin is called before crtc is enabled, all the color processing features need to be moved from active_list to dirty_list after sde_cp_crtc_apply_properties(). However, the ltm_hist_en flag doesn't need to be set to false in this case. Setting ltm_hist_en to false in this case will result LTM merge_en bit being cleared incorrectly. This change replaces sde_cp_crtc_suspend() with a new function that only updates the color processing feature lists in sde_crtc_atomic_begin(). Change-Id: I75d7874899838855bda05a1e8eca0cb9523417e9 Signed-off-by: Ping Li --- msm/sde/sde_color_processing.c | 27 ++++++++++++++++++++++----- msm/sde/sde_color_processing.h | 6 ++++++ msm/sde/sde_crtc.c | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c index 01fa0863bd..6bfe3a5232 100644 --- a/msm/sde/sde_color_processing.c +++ b/msm/sde/sde_color_processing.c @@ -2612,12 +2612,11 @@ void sde_cp_crtc_destroy_properties(struct drm_crtc *crtc) INIT_LIST_HEAD(&sde_crtc->ltm_buf_busy); } -void sde_cp_crtc_suspend(struct drm_crtc *crtc) +void sde_cp_crtc_mark_features_dirty(struct drm_crtc *crtc) { struct sde_crtc *sde_crtc = NULL; struct sde_cp_node *prop_node = NULL, *n = NULL; bool ad_suspend = false; - unsigned long irq_flags; if (!crtc) { DRM_ERROR("crtc %pK\n", crtc); @@ -2644,12 +2643,30 @@ void sde_cp_crtc_suspend(struct drm_crtc *crtc) } mutex_unlock(&sde_crtc->crtc_cp_lock); + if (ad_suspend) + _sde_cp_ad_set_prop(sde_crtc, AD_SUSPEND); +} + +void sde_cp_crtc_suspend(struct drm_crtc *crtc) +{ + struct sde_crtc *sde_crtc = NULL; + unsigned long irq_flags; + + if (!crtc) { + DRM_ERROR("crtc %pK\n", crtc); + return; + } + sde_crtc = to_sde_crtc(crtc); + if (!sde_crtc) { + DRM_ERROR("sde_crtc %pK\n", sde_crtc); + return; + } + + sde_cp_crtc_mark_features_dirty(crtc); + spin_lock_irqsave(&sde_crtc->ltm_lock, irq_flags); sde_crtc->ltm_hist_en = false; spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags); - - if (ad_suspend) - _sde_cp_ad_set_prop(sde_crtc, AD_SUSPEND); } void sde_cp_crtc_resume(struct drm_crtc *crtc) diff --git a/msm/sde/sde_color_processing.h b/msm/sde/sde_color_processing.h index a2fef78910..32f40905c4 100644 --- a/msm/sde/sde_color_processing.h +++ b/msm/sde/sde_color_processing.h @@ -228,6 +228,12 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc); int sde_cp_crtc_get_property(struct drm_crtc *crtc, struct drm_property *property, uint64_t *val); +/** + * sde_cp_crtc_mark_features_dirty: Move the cp features from active list to dirty list + * @crtc: Pointer to crtc. + */ +void sde_cp_crtc_mark_features_dirty(struct drm_crtc *crtc); + /** * sde_cp_crtc_suspend: Suspend the crtc features * @crtc: Pointer to crtc. diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index 6373507f5b..5e024cb106 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -3620,7 +3620,7 @@ static void sde_crtc_atomic_begin(struct drm_crtc *crtc, sde_cp_crtc_apply_properties(crtc); if (!sde_crtc->enabled) - sde_cp_crtc_suspend(crtc); + sde_cp_crtc_mark_features_dirty(crtc); /* * PP_DONE irq is only used by command mode for now.