From aedd309e713e69321bb3cd42084e089c70e54e95 Mon Sep 17 00:00:00 2001 From: Anjaneya Prasad Musunuri Date: Wed, 1 Sep 2021 12:04:04 +0530 Subject: [PATCH 01/94] disp: msm: sde: clear partial update mask during last close Clear partial update mask during last close to avoid rounded corner to be programmed without valid mask during shell stop/start operations. Change-Id: I378adc62b5bc5913abfc32fa3528c8e28ea273d4 Signed-off-by: Anjaneya Prasad Musunuri --- msm/sde/sde_color_processing.c | 1 + 1 file changed, 1 insertion(+) diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c index 4cf87d4dca96..8c40e4950080 100644 --- a/msm/sde/sde_color_processing.c +++ b/msm/sde/sde_color_processing.c @@ -2159,6 +2159,7 @@ void sde_cp_crtc_clear(struct drm_crtc *crtc) list_del_init(&sde_crtc->dirty_list); list_del_init(&sde_crtc->ad_active); list_del_init(&sde_crtc->ad_dirty); + sde_crtc->cp_pu_feature_mask = 0; mutex_unlock(&sde_crtc->crtc_cp_lock); spin_lock_irqsave(&sde_crtc->spin_lock, flags); From 99041a16f221d747049f0e250ad628b04aada527 Mon Sep 17 00:00:00 2001 From: Anjaneya Prasad Musunuri Date: Thu, 16 Sep 2021 20:05:03 +0530 Subject: [PATCH 02/94] disp: msm: sde: handle partial update transitions in rounded corner This change handles partial update use case transitions. Rounded corner should be programmed to full ROI when transitioning out of partial update use case. This change also clear cached ROIs when rounded corner feature is disabled to ensure full frame ROI for first frame when feature is enabled again. Change-Id: I4c48ccd3f64409d1b0fa19f0e6f92eab5f86d099 Signed-off-by: Anjaneya Prasad Musunuri --- msm/sde/sde_color_processing.c | 59 +++++++++++++++++++++++++--------- msm/sde/sde_hw_rc.c | 5 +++ 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c index 8c40e4950080..d6c60de70ffe 100644 --- a/msm/sde/sde_color_processing.c +++ b/msm/sde/sde_color_processing.c @@ -210,15 +210,37 @@ static struct sde_kms *get_kms(struct drm_crtc *crtc) static void update_pu_feature_enable(struct sde_crtc *sde_crtc, u32 feature, bool enable) { + struct drm_crtc *crtc; + struct sde_crtc_state *sde_crtc_state; + if (!sde_crtc || feature > SDE_CP_CRTC_MAX_PU_FEATURES) { DRM_ERROR("invalid args feature %d\n", feature); return; } + crtc = &(sde_crtc->base); + if (!crtc) { + DRM_ERROR("invalid crtc pointer\n"); + return; + } + + sde_crtc_state = to_sde_crtc_state(crtc->state); + if (!sde_crtc_state) { + DRM_ERROR("invalid sde_crtc_state pointer\n"); + return; + } + if (enable) sde_crtc->cp_pu_feature_mask |= BIT(feature); else sde_crtc->cp_pu_feature_mask &= ~BIT(feature); + + /* clear cached ROI list when feature is disabled */ + if ((sde_crtc->cp_pu_feature_mask == 0) && + (sde_crtc_state->cached_user_roi_list.num_rects != 0)) { + memset(&sde_crtc_state->cached_user_roi_list, 0, + sizeof(struct msm_roi_list)); + } } static int set_dspp_vlut_feature(struct sde_hw_dspp *hw_dspp, @@ -1675,27 +1697,32 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush) } /* early return if not a partial update frame or no change in rois */ - if (sde_crtc_state->user_roi_list.num_rects == 0) { + if ((sde_crtc_state->user_roi_list.num_rects == 0) && + (sde_crtc_state->cached_user_roi_list.num_rects == 0)) { DRM_DEBUG_DRIVER("no partial update required\n"); + return 0; + } else if (sde_crtc_state->user_roi_list.num_rects == 0) { + DRM_DEBUG_DRIVER("transition from PU to full update\n"); memset(&sde_crtc_state->cached_user_roi_list, 0, sizeof(struct msm_roi_list)); - return 0; - } - - sde_kms_rect_merge_rectangles(&sde_crtc_state->user_roi_list, - &user_rect); - sde_kms_rect_merge_rectangles(&sde_crtc_state->cached_user_roi_list, - &cached_rect); - if (sde_kms_rect_is_equal(&user_rect, &cached_rect)) { - DRM_DEBUG_DRIVER("no change in list of ROIs\n"); - return 0; + } else { + sde_kms_rect_merge_rectangles(&sde_crtc_state->user_roi_list, + &user_rect); + sde_kms_rect_merge_rectangles( + &sde_crtc_state->cached_user_roi_list, + &cached_rect); + if (sde_kms_rect_is_equal(&user_rect, &cached_rect)) { + DRM_DEBUG_DRIVER("no change in list of ROIs\n"); + return 0; + } } catalog = get_kms(&sde_crtc->base)->catalog; memset(&hw_cfg, 0, sizeof(hw_cfg)); hw_cfg.num_of_mixers = sde_crtc->num_mixers; hw_cfg.broadcast_disabled = catalog->dma_cfg.broadcast_disabled; - hw_cfg.payload = &sde_crtc_state->user_roi_list; + hw_cfg.payload = (sde_crtc_state->user_roi_list.num_rects) ? + &sde_crtc_state->user_roi_list : NULL; hw_cfg.len = sizeof(sde_crtc_state->user_roi_list); for (i = 0; i < hw_cfg.num_of_mixers; i++) hw_cfg.dspp[i] = sde_crtc->mixers[i].hw_dspp; @@ -1730,9 +1757,11 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush) } } - memcpy(&sde_crtc_state->cached_user_roi_list, - &sde_crtc_state->user_roi_list, - sizeof(struct msm_roi_list)); + if (sde_crtc_state->user_roi_list.num_rects != 0) { + memcpy(&sde_crtc_state->cached_user_roi_list, + &sde_crtc_state->user_roi_list, + sizeof(struct msm_roi_list)); + } return 0; } diff --git a/msm/sde/sde_hw_rc.c b/msm/sde/sde_hw_rc.c index bcf3f30a4a08..38106898b2f2 100644 --- a/msm/sde/sde_hw_rc.c +++ b/msm/sde/sde_hw_rc.c @@ -775,6 +775,7 @@ int sde_hw_rc_check_pu_roi(struct sde_hw_dspp *hw_dspp, void *cfg) roi_list = hw_cfg->payload; if (!roi_list) { SDE_DEBUG("full frame update\n"); + memset(&empty_roi_list, 0, sizeof(struct msm_roi_list)); roi_list = &empty_roi_list; } @@ -837,6 +838,7 @@ int sde_hw_rc_setup_pu_roi(struct sde_hw_dspp *hw_dspp, void *cfg) roi_list = hw_cfg->payload; if (!roi_list) { SDE_DEBUG("full frame update\n"); + memset(&empty_roi_list, 0, sizeof(struct msm_roi_list)); roi_list = &empty_roi_list; } @@ -906,6 +908,9 @@ int sde_hw_rc_setup_mask(struct sde_hw_dspp *hw_dspp, void *cfg) memset(RC_STATE(hw_dspp).last_rc_mask_cfg, 0, sizeof(struct drm_msm_rc_mask_cfg)); RC_STATE(hw_dspp).mask_programmed = false; + memset(RC_STATE(hw_dspp).last_roi_list, 0, + sizeof(struct msm_roi_list)); + RC_STATE(hw_dspp).roi_programmed = false; return 0; } From 7f067beb2820a413d967f131651460e730f83dfc Mon Sep 17 00:00:00 2001 From: Pawan Chilka Date: Thu, 30 Sep 2021 15:23:04 +0530 Subject: [PATCH 03/94] Revert "disp: msm: sde: handle partial update transitions in rounded corner". This reverts commit 99041a16f221d747049f0e250ad628b04aada527. Change-Id: I332ba310680fb173d234c54feda29656ea44a0d1 --- msm/sde/sde_color_processing.c | 59 +++++++++------------------------- msm/sde/sde_hw_rc.c | 5 --- 2 files changed, 15 insertions(+), 49 deletions(-) diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c index d6c60de70ffe..8c40e4950080 100644 --- a/msm/sde/sde_color_processing.c +++ b/msm/sde/sde_color_processing.c @@ -210,37 +210,15 @@ static struct sde_kms *get_kms(struct drm_crtc *crtc) static void update_pu_feature_enable(struct sde_crtc *sde_crtc, u32 feature, bool enable) { - struct drm_crtc *crtc; - struct sde_crtc_state *sde_crtc_state; - if (!sde_crtc || feature > SDE_CP_CRTC_MAX_PU_FEATURES) { DRM_ERROR("invalid args feature %d\n", feature); return; } - crtc = &(sde_crtc->base); - if (!crtc) { - DRM_ERROR("invalid crtc pointer\n"); - return; - } - - sde_crtc_state = to_sde_crtc_state(crtc->state); - if (!sde_crtc_state) { - DRM_ERROR("invalid sde_crtc_state pointer\n"); - return; - } - if (enable) sde_crtc->cp_pu_feature_mask |= BIT(feature); else sde_crtc->cp_pu_feature_mask &= ~BIT(feature); - - /* clear cached ROI list when feature is disabled */ - if ((sde_crtc->cp_pu_feature_mask == 0) && - (sde_crtc_state->cached_user_roi_list.num_rects != 0)) { - memset(&sde_crtc_state->cached_user_roi_list, 0, - sizeof(struct msm_roi_list)); - } } static int set_dspp_vlut_feature(struct sde_hw_dspp *hw_dspp, @@ -1697,32 +1675,27 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush) } /* early return if not a partial update frame or no change in rois */ - if ((sde_crtc_state->user_roi_list.num_rects == 0) && - (sde_crtc_state->cached_user_roi_list.num_rects == 0)) { + if (sde_crtc_state->user_roi_list.num_rects == 0) { DRM_DEBUG_DRIVER("no partial update required\n"); - return 0; - } else if (sde_crtc_state->user_roi_list.num_rects == 0) { - DRM_DEBUG_DRIVER("transition from PU to full update\n"); memset(&sde_crtc_state->cached_user_roi_list, 0, sizeof(struct msm_roi_list)); - } else { - sde_kms_rect_merge_rectangles(&sde_crtc_state->user_roi_list, - &user_rect); - sde_kms_rect_merge_rectangles( - &sde_crtc_state->cached_user_roi_list, - &cached_rect); - if (sde_kms_rect_is_equal(&user_rect, &cached_rect)) { - DRM_DEBUG_DRIVER("no change in list of ROIs\n"); - return 0; - } + return 0; + } + + sde_kms_rect_merge_rectangles(&sde_crtc_state->user_roi_list, + &user_rect); + sde_kms_rect_merge_rectangles(&sde_crtc_state->cached_user_roi_list, + &cached_rect); + if (sde_kms_rect_is_equal(&user_rect, &cached_rect)) { + DRM_DEBUG_DRIVER("no change in list of ROIs\n"); + return 0; } catalog = get_kms(&sde_crtc->base)->catalog; memset(&hw_cfg, 0, sizeof(hw_cfg)); hw_cfg.num_of_mixers = sde_crtc->num_mixers; hw_cfg.broadcast_disabled = catalog->dma_cfg.broadcast_disabled; - hw_cfg.payload = (sde_crtc_state->user_roi_list.num_rects) ? - &sde_crtc_state->user_roi_list : NULL; + hw_cfg.payload = &sde_crtc_state->user_roi_list; hw_cfg.len = sizeof(sde_crtc_state->user_roi_list); for (i = 0; i < hw_cfg.num_of_mixers; i++) hw_cfg.dspp[i] = sde_crtc->mixers[i].hw_dspp; @@ -1757,11 +1730,9 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush) } } - if (sde_crtc_state->user_roi_list.num_rects != 0) { - memcpy(&sde_crtc_state->cached_user_roi_list, - &sde_crtc_state->user_roi_list, - sizeof(struct msm_roi_list)); - } + memcpy(&sde_crtc_state->cached_user_roi_list, + &sde_crtc_state->user_roi_list, + sizeof(struct msm_roi_list)); return 0; } diff --git a/msm/sde/sde_hw_rc.c b/msm/sde/sde_hw_rc.c index 38106898b2f2..bcf3f30a4a08 100644 --- a/msm/sde/sde_hw_rc.c +++ b/msm/sde/sde_hw_rc.c @@ -775,7 +775,6 @@ int sde_hw_rc_check_pu_roi(struct sde_hw_dspp *hw_dspp, void *cfg) roi_list = hw_cfg->payload; if (!roi_list) { SDE_DEBUG("full frame update\n"); - memset(&empty_roi_list, 0, sizeof(struct msm_roi_list)); roi_list = &empty_roi_list; } @@ -838,7 +837,6 @@ int sde_hw_rc_setup_pu_roi(struct sde_hw_dspp *hw_dspp, void *cfg) roi_list = hw_cfg->payload; if (!roi_list) { SDE_DEBUG("full frame update\n"); - memset(&empty_roi_list, 0, sizeof(struct msm_roi_list)); roi_list = &empty_roi_list; } @@ -908,9 +906,6 @@ int sde_hw_rc_setup_mask(struct sde_hw_dspp *hw_dspp, void *cfg) memset(RC_STATE(hw_dspp).last_rc_mask_cfg, 0, sizeof(struct drm_msm_rc_mask_cfg)); RC_STATE(hw_dspp).mask_programmed = false; - memset(RC_STATE(hw_dspp).last_roi_list, 0, - sizeof(struct msm_roi_list)); - RC_STATE(hw_dspp).roi_programmed = false; return 0; } From 1a0d14dd152338e53935abac785b7552eda2da9c Mon Sep 17 00:00:00 2001 From: Pawan Chilka Date: Tue, 5 Oct 2021 16:33:02 +0530 Subject: [PATCH 04/94] disp: msm: sde: handle partial update transitions in rounded corner. This change handles partial update use case transitions. Rounded corner should be programmed to full ROI when transitioning out of partial update use case. This change also clear cached ROIs when rounded corner feature is disabled to ensure full frame ROI for first frame when feature is enabled again. This change depends on HAL change to disable PU for one frame when RC mask config is set. This change also moves cached rectangles from crtc state to crtc structure to avoid cached rectangles being incorrect due to race conditions between updating cached rectangles in crtc state and duplicating crtc state when next commit starts. Change-Id: I4c48ccd3f64409d1b0fa19f0e6f92eab5f86d069 Signed-off-by: Anjaneya Prasad Musunuri --- msm/sde/sde_color_processing.c | 39 ++++++++++++++++++++-------------- msm/sde/sde_crtc.h | 7 +++--- msm/sde/sde_hw_rc.c | 5 +++++ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c index 8c40e4950080..799dfdd4495d 100644 --- a/msm/sde/sde_color_processing.c +++ b/msm/sde/sde_color_processing.c @@ -1675,27 +1675,32 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush) } /* early return if not a partial update frame or no change in rois */ - if (sde_crtc_state->user_roi_list.num_rects == 0) { + if ((sde_crtc_state->user_roi_list.num_rects == 0) && + (sde_crtc->cached_user_roi_list.num_rects == 0)) { DRM_DEBUG_DRIVER("no partial update required\n"); - memset(&sde_crtc_state->cached_user_roi_list, 0, + return 0; + } else if (sde_crtc_state->user_roi_list.num_rects == 0) { + DRM_DEBUG_DRIVER("transition from PU to full update\n"); + memset(&sde_crtc->cached_user_roi_list, 0, sizeof(struct msm_roi_list)); - return 0; - } - - sde_kms_rect_merge_rectangles(&sde_crtc_state->user_roi_list, - &user_rect); - sde_kms_rect_merge_rectangles(&sde_crtc_state->cached_user_roi_list, - &cached_rect); - if (sde_kms_rect_is_equal(&user_rect, &cached_rect)) { - DRM_DEBUG_DRIVER("no change in list of ROIs\n"); - return 0; + } else { + sde_kms_rect_merge_rectangles(&sde_crtc_state->user_roi_list, + &user_rect); + sde_kms_rect_merge_rectangles( + &sde_crtc->cached_user_roi_list, + &cached_rect); + if (sde_kms_rect_is_equal(&user_rect, &cached_rect)) { + DRM_DEBUG_DRIVER("no change in list of ROIs\n"); + return 0; + } } catalog = get_kms(&sde_crtc->base)->catalog; memset(&hw_cfg, 0, sizeof(hw_cfg)); hw_cfg.num_of_mixers = sde_crtc->num_mixers; hw_cfg.broadcast_disabled = catalog->dma_cfg.broadcast_disabled; - hw_cfg.payload = &sde_crtc_state->user_roi_list; + hw_cfg.payload = (sde_crtc_state->user_roi_list.num_rects) ? + &sde_crtc_state->user_roi_list : NULL; hw_cfg.len = sizeof(sde_crtc_state->user_roi_list); for (i = 0; i < hw_cfg.num_of_mixers; i++) hw_cfg.dspp[i] = sde_crtc->mixers[i].hw_dspp; @@ -1730,9 +1735,11 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush) } } - memcpy(&sde_crtc_state->cached_user_roi_list, - &sde_crtc_state->user_roi_list, - sizeof(struct msm_roi_list)); + if (sde_crtc_state->user_roi_list.num_rects != 0) { + memcpy(&sde_crtc->cached_user_roi_list, + &sde_crtc_state->user_roi_list, + sizeof(struct msm_roi_list)); + } return 0; } diff --git a/msm/sde/sde_crtc.h b/msm/sde/sde_crtc.h index da1aa8b6c6f5..bd16cd3da6fe 100644 --- a/msm/sde/sde_crtc.h +++ b/msm/sde/sde_crtc.h @@ -277,6 +277,7 @@ struct sde_crtc_misr_info { * @plane_mask_old: keeps track of the planes used in the previous commit * @frame_trigger_mode: frame trigger mode * @cp_pu_feature_mask: mask indicating cp feature enable for partial update + * @cached_user_roi_list : Copy of user_roi_list from previous PU frame * @ltm_buffer_cnt : number of ltm buffers * @ltm_buffers : struct stores ltm buffer related data * @ltm_buf_free : list of LTM buffers that are available @@ -361,6 +362,7 @@ struct sde_crtc { enum frame_trigger_mode_type frame_trigger_mode; u32 cp_pu_feature_mask; + struct msm_roi_list cached_user_roi_list; u32 ltm_buffer_cnt; struct sde_ltm_buffer *ltm_buffers[LTM_BUFFER_SIZE]; @@ -395,8 +397,7 @@ struct sde_crtc { * @lm_roi : Current LM ROI, possibly sub-rectangle of mode. * Origin top left of CRTC. * @user_roi_list : List of user's requested ROIs as from set property - * @cached_user_roi_list : Copy of user_roi_list from previous PU frame - * @property_state: Local storage for msm_prop properties + * @property_state: Local storage for msm_prop properties * @property_values: Current crtc property values * @input_fence_timeout_ns : Cached input fence timeout, in ns * @num_dim_layers: Number of dim layers @@ -423,7 +424,7 @@ struct sde_crtc_state { struct sde_rect crtc_roi; struct sde_rect lm_bounds[CRTC_DUAL_MIXERS]; struct sde_rect lm_roi[CRTC_DUAL_MIXERS]; - struct msm_roi_list user_roi_list, cached_user_roi_list; + struct msm_roi_list user_roi_list; struct msm_property_state property_state; struct msm_property_value property_values[CRTC_PROP_COUNT]; diff --git a/msm/sde/sde_hw_rc.c b/msm/sde/sde_hw_rc.c index bcf3f30a4a08..38106898b2f2 100644 --- a/msm/sde/sde_hw_rc.c +++ b/msm/sde/sde_hw_rc.c @@ -775,6 +775,7 @@ int sde_hw_rc_check_pu_roi(struct sde_hw_dspp *hw_dspp, void *cfg) roi_list = hw_cfg->payload; if (!roi_list) { SDE_DEBUG("full frame update\n"); + memset(&empty_roi_list, 0, sizeof(struct msm_roi_list)); roi_list = &empty_roi_list; } @@ -837,6 +838,7 @@ int sde_hw_rc_setup_pu_roi(struct sde_hw_dspp *hw_dspp, void *cfg) roi_list = hw_cfg->payload; if (!roi_list) { SDE_DEBUG("full frame update\n"); + memset(&empty_roi_list, 0, sizeof(struct msm_roi_list)); roi_list = &empty_roi_list; } @@ -906,6 +908,9 @@ int sde_hw_rc_setup_mask(struct sde_hw_dspp *hw_dspp, void *cfg) memset(RC_STATE(hw_dspp).last_rc_mask_cfg, 0, sizeof(struct drm_msm_rc_mask_cfg)); RC_STATE(hw_dspp).mask_programmed = false; + memset(RC_STATE(hw_dspp).last_roi_list, 0, + sizeof(struct msm_roi_list)); + RC_STATE(hw_dspp).roi_programmed = false; return 0; } From 971ffaef06920ab3ea61a60056a953fa06b2cad5 Mon Sep 17 00:00:00 2001 From: Raghavendra Ambadas Date: Thu, 27 Jan 2022 15:18:47 +0530 Subject: [PATCH 05/94] disp: msm: sde: synx: Add quic copyright Change fixes adding quic copyright as instructed. Change-Id: I2331492b78c013969fa1d48e9ab9afdb03e2f999 Signed-off-by: Raghavendra Ambadas --- msm/sde/sde_crtc.c | 3 ++- msm/sde/sde_encoder.c | 3 ++- msm/sde/sde_encoder.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index c3b828525897..86b38a6999d2 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2014-2022 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark * diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index 733bad19992a..71bbeaf7b01a 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2014-2022, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark * diff --git a/msm/sde/sde_encoder.h b/msm/sde/sde_encoder.h index 0306459c4fd6..ebee140da628 100644 --- a/msm/sde/sde_encoder.h +++ b/msm/sde/sde_encoder.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 2015-2022, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark * From fac316f8af5d5fb7d2f71f5161f65a74c95cb43a Mon Sep 17 00:00:00 2001 From: dengwei1 Date: Sat, 7 Mar 2020 20:10:47 +0800 Subject: [PATCH 06/94] input add touch support touch init himax ic Change-Id: I260085bd4397089ca1c865e601c9ece4f87b75bc Signed-off-by: dengwei1 Reviewed-on: https://gerrit.mot.com/1508817 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hua Tan Submit-Approved: Jira Key --- msm/dsi/dsi_panel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index e1f231f13c00..6ed5910015a6 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -733,12 +733,23 @@ static int dsi_panel_update_pwm_backlight(struct dsi_panel *panel, error: return rc; } - +//temp solution for TP, tinno 20200229 start +#include +BLOCKING_NOTIFIER_HEAD(backlight_state_notifier_list); +//temp solution for TP, tinno 20200229 end int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl) { int rc = 0; struct dsi_backlight_config *bl = &panel->bl_config; +//temp solution for TP, tinno 20200229 start + static u32 last_bl_lvl = 0; + if ((bl_lvl == 0) || (last_bl_lvl == 0)) + { + blocking_notifier_call_chain(&backlight_state_notifier_list, bl_lvl, NULL); + } + last_bl_lvl = bl_lvl; +//temp solution for TP, tinno 20200229 end if (panel->host_config.ext_bridge_mode) return 0; From aa252c3330549241da20ef1aaa2351d588cdb2ed Mon Sep 17 00:00:00 2001 From: dengwei1 Date: Wed, 11 Mar 2020 14:10:01 +0800 Subject: [PATCH 07/94] guam: input add drm support input add drm support Change-Id: I156438665fb27d9a1f5afeaec11ef4fd736ea812 Signed-off-by: dengwei1 Reviewed-on: https://gerrit.mot.com/1510616 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hua Tan Submit-Approved: Jira Key --- msm/dsi/dsi_panel.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) mode change 100644 => 100755 msm/dsi/dsi_panel.c diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c old mode 100644 new mode 100755 index 6ed5910015a6..e1f231f13c00 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -733,23 +733,12 @@ static int dsi_panel_update_pwm_backlight(struct dsi_panel *panel, error: return rc; } -//temp solution for TP, tinno 20200229 start -#include -BLOCKING_NOTIFIER_HEAD(backlight_state_notifier_list); -//temp solution for TP, tinno 20200229 end + int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl) { int rc = 0; struct dsi_backlight_config *bl = &panel->bl_config; -//temp solution for TP, tinno 20200229 start - static u32 last_bl_lvl = 0; - if ((bl_lvl == 0) || (last_bl_lvl == 0)) - { - blocking_notifier_call_chain(&backlight_state_notifier_list, bl_lvl, NULL); - } - last_bl_lvl = bl_lvl; -//temp solution for TP, tinno 20200229 end if (panel->host_config.ext_bridge_mode) return 0; From 0ce5683cb1b69f57beb1b0899cac38564c696839 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Wed, 24 Jul 2019 08:05:26 -0500 Subject: [PATCH 08/94] disp: msm: dsi: Add support display 2bytes brightness. Normal, there is a brightness level from 0-255 (1 byte), but some panels are support 2 bytes for brightness, (0-1023). Port from 68e0c10 Change-Id: Id948d3d97fb3611e458b18a3345cec6a64e5c034 Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1410291 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509791 Reviewed-by: Hua Tan --- msm/dsi/dsi_panel.c | 11 +++++++++++ msm/dsi/dsi_panel.h | 1 + 2 files changed, 12 insertions(+) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index e1f231f13c00..dfc04c74b5c1 100755 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -677,6 +677,11 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, else rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl); + if (bl->bl_2bytes_enable) + rc = mipi_dsi_dcs_set_display_brightness_2bytes(dsi, bl_lvl); + else + rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl); + if (rc < 0) DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl); @@ -2419,6 +2424,12 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel) panel->bl_config.bl_inverted_dbv = utils->read_bool(utils->data, "qcom,mdss-dsi-bl-inverted-dbv"); + panel->bl_config.bl_2bytes_enable = utils->read_bool(utils->data, + "qcom,bklt-dcs-2bytes-enabled"); + + pr_info("[%s] bl_2bytes_enable=%d\n", panel->name, + panel->bl_config.bl_2bytes_enable); + if (panel->bl_config.type == DSI_BACKLIGHT_PWM) { rc = dsi_panel_parse_bl_pwm_config(panel); if (rc) { diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index ee30cd5375b4..e2742f2531c8 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -115,6 +115,7 @@ struct dsi_backlight_config { enum dsi_backlight_type type; enum bl_update_flag bl_update; + bool bl_2bytes_enable; u32 bl_min_level; u32 bl_max_level; u32 brightness_max_level; From 82dd11b2b6b8e8c7e82a7675af30b056af516cb5 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Wed, 24 Jul 2019 14:31:35 -0500 Subject: [PATCH 09/94] disp: msm: dsi: Add "bl_ctrl_dummy" to panel bl type Add a new display's backlight type "bl_ctrl_dummy". With this backlight type, the panel backlight driver will ignore any backlight requests. This new backlight type will be used with a bare_board or no-display configuration and the display driver doesn't need to have any communication with panel. Port from: cfb2acd Change-Id: I2108d7477009d06ac350ca49c380b64c9d004f65 Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1442424 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509792 Reviewed-by: Hua Tan --- msm/dsi/dsi_panel.c | 9 +++++++++ msm/dsi/dsi_panel.h | 1 + 2 files changed, 10 insertions(+) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index dfc04c74b5c1..c1f3b86d8595 100755 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -755,6 +755,9 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl) case DSI_BACKLIGHT_DCS: rc = dsi_panel_update_backlight(panel, bl_lvl); break; + case DSI_BACKLIGHT_DUMMY: + rc = 0; + break; case DSI_BACKLIGHT_EXTERNAL: break; case DSI_BACKLIGHT_PWM: @@ -834,6 +837,8 @@ static int dsi_panel_bl_register(struct dsi_panel *panel) break; case DSI_BACKLIGHT_DCS: break; + case DSI_BACKLIGHT_DUMMY: + break; case DSI_BACKLIGHT_EXTERNAL: break; case DSI_BACKLIGHT_PWM: @@ -869,6 +874,8 @@ static int dsi_panel_bl_unregister(struct dsi_panel *panel) break; case DSI_BACKLIGHT_DCS: break; + case DSI_BACKLIGHT_DUMMY: + break; case DSI_BACKLIGHT_EXTERNAL: break; case DSI_BACKLIGHT_PWM: @@ -2361,6 +2368,8 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel) panel->bl_config.type = DSI_BACKLIGHT_WLED; } else if (!strcmp(bl_type, "bl_ctrl_dcs")) { panel->bl_config.type = DSI_BACKLIGHT_DCS; + } else if (!strcmp(bl_type, "bl_ctrl_dummy")) { + panel->bl_config.type = DSI_BACKLIGHT_DUMMY; } else if (!strcmp(bl_type, "bl_ctrl_external")) { panel->bl_config.type = DSI_BACKLIGHT_EXTERNAL; } else { diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index e2742f2531c8..85ddad49a71d 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -46,6 +46,7 @@ enum dsi_backlight_type { DSI_BACKLIGHT_PWM = 0, DSI_BACKLIGHT_WLED, DSI_BACKLIGHT_DCS, + DSI_BACKLIGHT_DUMMY, DSI_BACKLIGHT_EXTERNAL, DSI_BACKLIGHT_UNKNOWN, DSI_BACKLIGHT_MAX, From c4ac8db3fe6054de50da5f7917c6d75eedc7cc06 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Thu, 25 Jul 2019 10:11:43 -0500 Subject: [PATCH 10/94] disp: msm: dsi: add prints for DSI/panel turning off/on Add some pr_info to indicate the DSI and panel are turning off and on for ESD or black screen investigation. Port from: 6fcdea6 Signed-off-by: Bang Nguyen Change-Id: I334890799fd18be9951b8d7579717d362c9878c3 Reviewed-on: https://gerrit.mot.com/1444391 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Bang Nguyen Reviewed-by: Shuo Yan Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509793 Reviewed-by: Hua Tan --- msm/dsi/dsi_display.c | 2 ++ msm/dsi/dsi_panel.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index acb1f7db43e1..8cece4f1a36e 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -7155,6 +7155,7 @@ int dsi_display_prepare(struct dsi_display *display) return -EINVAL; } + DSI_INFO("%s(%s)+\n", __func__, display->drm_conn->name); SDE_EVT32(SDE_EVTLOG_FUNC_ENTRY); mutex_lock(&display->display_lock); @@ -7778,6 +7779,7 @@ int dsi_display_disable(struct dsi_display *display) return -EINVAL; } + DSI_INFO("%s(%s)+\n", __func__, display->drm_conn->name); SDE_EVT32(SDE_EVTLOG_FUNC_ENTRY); mutex_lock(&display->display_lock); diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index c1f3b86d8595..077b909be2a9 100755 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -452,6 +452,7 @@ static int dsi_panel_power_on(struct dsi_panel *panel) { int rc = 0; + DSI_INFO("%s(%s)+\n", __func__, panel->name); rc = dsi_pwr_enable_regulator(&panel->power_info, true); if (rc) { DSI_ERR("[%s] failed to enable vregs, rc=%d\n", @@ -493,6 +494,7 @@ static int dsi_panel_power_off(struct dsi_panel *panel) { int rc = 0; + DSI_INFO("%s(%s)+\n", __func__, panel->name); if (gpio_is_valid(panel->reset_config.disp_en_gpio)) gpio_set_value(panel->reset_config.disp_en_gpio, 0); @@ -2436,7 +2438,7 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel) panel->bl_config.bl_2bytes_enable = utils->read_bool(utils->data, "qcom,bklt-dcs-2bytes-enabled"); - pr_info("[%s] bl_2bytes_enable=%d\n", panel->name, + DSI_INFO("[%s] bl_2bytes_enable=%d\n", panel->name, panel->bl_config.bl_2bytes_enable); if (panel->bl_config.type == DSI_BACKLIGHT_PWM) { @@ -4482,6 +4484,7 @@ int dsi_panel_enable(struct dsi_panel *panel) return -EINVAL; } + DSI_INFO("%s(%s)+\n", __func__, panel->name); mutex_lock(&panel->panel_lock); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ON); @@ -4548,6 +4551,7 @@ int dsi_panel_disable(struct dsi_panel *panel) return -EINVAL; } + DSI_INFO("%s(%s)+\n", __func__, panel->name); mutex_lock(&panel->panel_lock); /* Avoid sending panel off commands when ESD recovery is underway */ From fb1d5e61d12791221346aafa82182d6db3f9b2cd Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Thu, 25 Jul 2019 10:15:12 -0500 Subject: [PATCH 11/94] disp: msm: sde: Change display ESD checking interval to 8s Change the ESD detection and recovery interval to 8 second Port from: 1318dae Change-Id: I530c74592941ff2cd68362224179d38df3ef8f60 Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1444392 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509794 Reviewed-by: Hua Tan --- msm/sde/sde_kms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msm/sde/sde_kms.h b/msm/sde/sde_kms.h index 6882cdfdb00f..b9d9333f6a13 100644 --- a/msm/sde/sde_kms.h +++ b/msm/sde/sde_kms.h @@ -124,7 +124,7 @@ #define SDE_KMS_OPS_PREPARE_PLANE_FB BIT(3) /* ESD status check interval in miliseconds */ -#define STATUS_CHECK_INTERVAL_MS 5000 +#define STATUS_CHECK_INTERVAL_MS 8000 /** * enum sde_kms_smmu_state: smmu state From 8072f67d7da86ef9fecf6a5270faec010e86c350 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Thu, 25 Jul 2019 12:56:02 -0500 Subject: [PATCH 12/94] disp: msm: dsi: parsing BL setting ESD and panel After the Boot Loader (BL) detects the panel information, or reading the ESD UTAG setting, the BL will write these information to the DTS. The display driver from kernel and parse and save these setting. Port from: 61c3e44 Change-Id: I3759b73c2e1eff01269a42dfa11d20807affa17a Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1444393 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509795 Reviewed-by: Hua Tan --- msm/dsi/dsi_panel.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ msm/dsi/dsi_panel.h | 6 ++++++ 2 files changed, 54 insertions(+) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 077b909be2a9..f6409bf56f63 100755 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -34,6 +34,9 @@ #define DEFAULT_PANEL_PREFILL_LINES 25 #define MIN_PREFILL_LINES 35 +#define DSI_PANEL_UNKNOWN_PANEL_NAME "unknown" +#define DSI_PANEL_PANEL_DEFAULT_VER 0xffffffffffffffff + enum dsi_dsc_ratio_type { DSC_8BPC_8BPP, DSC_10BPC_8BPP, @@ -1500,6 +1503,45 @@ static int dsi_panel_parse_dyn_clk_caps(struct dsi_panel *panel) return 0; } +static int dsi_panel_parse_panel_cfg(struct dsi_panel *panel) +{ + struct device_node *np; + const char *pname; + u32 panel_ver, tmp; + + np = of_find_node_by_path("/chosen"); + /* Disable ESD only if the prop "mmi,esd" exists and is equal to 0 */ + if (!of_property_read_u32(np, "mmi,esd", &tmp) && tmp == 0) { + panel->esd_utag_enable = false; + DSI_WARN("ESD detection is disabled by UTAGS\n"); + } else + panel->esd_utag_enable = true; + + panel->panel_ver = DSI_PANEL_PANEL_DEFAULT_VER; + of_property_read_u64(np, "mmi,panel_ver", &panel->panel_ver); + + pname = of_get_property(np, "mmi,panel_name", NULL); + if (!pname || strlen(pname) == 0) { + DSI_WARN("Failed to get mmi,panel_name\n"); + strlcpy(panel->panel_name, DSI_PANEL_UNKNOWN_PANEL_NAME, + sizeof(panel->panel_name)); + } else + strlcpy(panel->panel_name, pname, sizeof(panel->panel_name)); + + DSI_DEBUG("esd_utage_enable=%d\n", panel->esd_utag_enable); + + panel_ver = (u32)panel->panel_ver; + DSI_INFO("BL: panel = %s, manufacture_id(0xDA) = 0x%x controller_ver(0xDB) = 0x%x controller_drv_ver(0XDC) = 0x%x, full = 0x%016llx\n", + panel->panel_name, + panel_ver & 0xff, (panel_ver & 0xff00) >> 8, + (panel_ver & 0xff0000) >> 16, + panel->panel_ver); + + of_node_put(np); + + return 0; +} + static int dsi_panel_parse_dfps_caps(struct dsi_panel *panel) { int rc = 0; @@ -3434,6 +3476,12 @@ struct dsi_panel *dsi_panel_get(struct device *parent, goto error; } + rc = dsi_panel_parse_panel_cfg(panel); + if (rc) { + pr_err("failed to parse panel config from dts. rc=%d\n", rc); + goto error; + } + rc = dsi_panel_parse_dfps_caps(panel); if (rc) DSI_ERR("failed to parse dfps configuration, rc=%d\n", rc); diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 85ddad49a71d..3f7593e0489c 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -28,6 +28,8 @@ #define DSI_MODE_MAX 32 +#define DSI_PANEL_MAX_PANEL_LEN 256 + /* * Defining custom dsi msg flag, * continued from drm_mipi_dsi.h @@ -227,6 +229,10 @@ struct dsi_panel { int panel_test_gpio; int power_mode; enum dsi_panel_physical_type panel_type; + + bool esd_utag_enable; + u64 panel_ver; + char panel_name[DSI_PANEL_MAX_PANEL_LEN]; }; static inline bool dsi_panel_ulps_feature_enabled(struct dsi_panel *panel) From 88ab274b030634d556f43ebfb321c15887c5f22c Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Tue, 30 Jul 2019 13:45:53 -0500 Subject: [PATCH 13/94] disp: msm: dsi: Check panel's power_mode during resume Check the panel's power_mode after it turns on, to see if the panel can turn on correctly. If it doesn't not, then trigger the ESD recovery to fix it. Port from: 0301a79 Change-Id: I7e6cdb099dd50559f570e201568479ba00aa0e66 Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1444394 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509796 Reviewed-by: Hua Tan --- msm/dsi/dsi_display.c | 34 ++++++++++++++ msm/dsi/dsi_display.h | 14 ++++++ msm/dsi/dsi_panel.c | 103 ++++++++++++++++++++++++++++++++++++++++-- msm/dsi/dsi_panel.h | 3 ++ 4 files changed, 151 insertions(+), 3 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 8cece4f1a36e..633dd3c5473b 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -697,6 +697,40 @@ exit: return rc; } +int dsi_display_cmd_mipi_transfer(struct dsi_display *display, + struct mipi_dsi_msg *msg, + u32 flags) +{ + int rc = 0; + struct dsi_display_ctrl *m_ctrl; + + m_ctrl = &display->ctrl[display->cmd_master_idx]; + + if (display->tx_cmd_buf == NULL) { + rc = dsi_host_alloc_cmd_tx_buffer(display); + if (rc) { + DSI_ERR("failed to allocate cmd tx buffer memory\n"); + goto done; + } + } + + rc = dsi_display_cmd_engine_enable(display); + if (rc) { + DSI_ERR("cmd engine enable failed\n"); + return -EPERM; + } + + flags |= DSI_CTRL_CMD_FETCH_MEMORY | DSI_CTRL_CMD_CUSTOM_DMA_SCHED; + rc = dsi_ctrl_cmd_transfer(m_ctrl->ctrl, msg, &flags); + if (((flags & DSI_CTRL_CMD_READ) && rc <= 0) || + (!(flags & DSI_CTRL_CMD_READ) && rc)) + DSI_ERR("failed to transfer cmd. rc = %d\n", rc); + + dsi_display_cmd_engine_disable(display); +done: + return rc; +} + static int dsi_display_status_reg_read(struct dsi_display *display) { int rc = 0, i; diff --git a/msm/dsi/dsi_display.h b/msm/dsi/dsi_display.h index d254dfe739bd..873c305497cf 100644 --- a/msm/dsi/dsi_display.h +++ b/msm/dsi/dsi_display.h @@ -718,6 +718,20 @@ enum dsi_pixel_format dsi_display_get_dst_format( struct drm_connector *connector, void *display); +/* + * dsi_display_cmd_mipi_transfer() - Sending the MIPI DSI command + * @display: Handle to display + * @msg: MIPI DSI command information + * @flags: Modifier flags + * Return: if this is a MIPI DSI read then it will return number read byte + * in success case. Otherwise will be "<=0" + * if this is a MIPI DSI write then it will return "0" for success + * + */ +int dsi_display_cmd_mipi_transfer(struct dsi_display *display, + struct mipi_dsi_msg *msg, + u32 flags); + /** * dsi_display_cont_splash_config() - initialize splash resources * @display: Handle to display diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index f6409bf56f63..e2868f083dfe 100755 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -11,6 +11,7 @@ #include #include