From 90a2dca98f9df0d5757e9ab0b0aee25c034cd178 Mon Sep 17 00:00:00 2001 From: Rajeev Nandan Date: Thu, 5 May 2022 15:13:17 +0530 Subject: [PATCH 1/3] disp: msm: dsi: add missing dsi ctrl mutex lock in host timing update Acquire dsi_ctrl->ctrl_lock lock before programming dsi ctrl registers. Failing this may lead to race conditions in register programming. Add missing mutex lock inside dsi_ctrl_host_timing_update(). Change-Id: Ic86cbe282333c0b4d63ae3d5b3356a5d24752203 Signed-off-by: Rajeev Nandan --- msm/dsi/dsi_ctrl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/msm/dsi/dsi_ctrl.c b/msm/dsi/dsi_ctrl.c index d9721e102a55..278e3dcbe921 100644 --- a/msm/dsi/dsi_ctrl.c +++ b/msm/dsi/dsi_ctrl.c @@ -3076,6 +3076,8 @@ int dsi_ctrl_host_timing_update(struct dsi_ctrl *dsi_ctrl) return -EINVAL; } + mutex_lock(&dsi_ctrl->ctrl_lock); + if (dsi_ctrl->hw.ops.host_setup) dsi_ctrl->hw.ops.host_setup(&dsi_ctrl->hw, &dsi_ctrl->host_config.common_config); @@ -3093,9 +3095,11 @@ int dsi_ctrl_host_timing_update(struct dsi_ctrl *dsi_ctrl) 0x0, NULL); } else { DSI_CTRL_ERR(dsi_ctrl, "invalid panel mode for resolution switch\n"); + mutex_unlock(&dsi_ctrl->ctrl_lock); return -EINVAL; } + mutex_unlock(&dsi_ctrl->ctrl_lock); return 0; } From 0a00bff777adc8747476f7c60b38fdaf3b691eec Mon Sep 17 00:00:00 2001 From: Mahadevan Date: Mon, 16 Jan 2023 15:25:36 +0530 Subject: [PATCH 2/3] disp: msm: sde: cancel delayed idle_notify_work beginning of every commit In some cases HAL sets CRTC_PROP_IDLE_TIMEOUT property to zero and idle_notify_work which is already scheduled will send notfication on timer expire. This will cause janks in subsequent commit. This change cancels the existing delayed idle_notify work and will get rescheduled after frame trigger if CRTC_PROP_IDLE_TIMEOUT property is non zero. Change-Id: I8b9ebce8282425f55838b94cfd345b5e733fa645 Signed-off-by: Mahadevan --- msm/sde/sde_crtc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index 132222fa68e9..9caa41328e80 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark @@ -3323,6 +3323,12 @@ static void sde_crtc_atomic_begin(struct drm_crtc *crtc, _sde_crtc_blend_setup(crtc, old_state, true); _sde_crtc_dest_scaler_setup(crtc); + /* cancel the idle notify delayed work */ + if (sde_encoder_check_curr_mode(sde_crtc->mixers[0].encoder, + MSM_DISPLAY_VIDEO_MODE) && + kthread_cancel_delayed_work_sync(&sde_crtc->idle_notify_work)) + SDE_DEBUG("idle notify work cancelled\n"); + if (crtc->state->mode_changed || sde_kms->perf.catalog->uidle_cfg.dirty) sde_core_perf_crtc_update_uidle(crtc, true); From a4fdef4c120bbdf44f54156013d25a6a3af795e4 Mon Sep 17 00:00:00 2001 From: Jayaprakash Madisetty Date: Mon, 23 Jan 2023 22:57:06 +0530 Subject: [PATCH 3/3] disp: msm: sde: drop suspend state if commit is skipped Drop refcount on pm_suspend commit state if atomic commit is skipped due to failure. It will avoid frame trigger during pm_resume call. Change-Id: Iecd98b106454c82c81a1ef9faaf1af4be2bf19e6 Signed-off-by: Dhaval Patel Signed-off-by: Jayaprakash Madisetty --- msm/sde/sde_kms.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index 534aafd834e2..9f7a815c9227 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark @@ -3907,6 +3907,7 @@ retry: DRM_ERROR("failed to get crtc %d state\n", conn->state->crtc->base.id); drm_connector_list_iter_end(&conn_iter); + ret = -EINVAL; goto unlock; } @@ -3945,6 +3946,12 @@ unlock: drm_modeset_backoff(&ctx); goto retry; } + + if ((ret || !num_crtcs) && sde_kms->suspend_state) { + drm_atomic_state_put(sde_kms->suspend_state); + sde_kms->suspend_state = NULL; + } + drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -3985,7 +3992,8 @@ static int sde_kms_pm_resume(struct device *dev) SDE_EVT32(sde_kms->suspend_state != NULL); - drm_mode_config_reset(ddev); + if (sde_kms->suspend_state) + drm_mode_config_reset(ddev); drm_modeset_acquire_init(&ctx, 0); retry: