From 5ce42a7435ff011f48530e0def9321442547e5c2 Mon Sep 17 00:00:00 2001 From: Yojana Juadi Date: Thu, 23 Feb 2023 12:19:43 +0530 Subject: [PATCH] disp: msm: sde: update idle_pc_duration based on frame rate This change updates the time required to enter idle_pc based on frame rate instead of default time. In the current issue, customer is facing janks where frame rate is 30fps and race happens between sde_encoder_off_work and drm_atomic_commit scheduled from userspace. It also sets max and min bound for optimized performance. Change-Id: I5e95e920a2f7b2142b5f63e8ce6b82cf1d482db1 Signed-off-by: Yojana Juadi --- msm/sde/sde_encoder.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index 56033439..1107da4b 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -1986,8 +1986,10 @@ static void _sde_encoder_rc_restart_delayed(struct sde_encoder_virt *sde_enc, { struct drm_encoder *drm_enc = &sde_enc->base; struct msm_drm_private *priv; - unsigned int lp, idle_pc_duration; + unsigned int lp, idle_pc_duration, frame_time_ms, fps; struct msm_drm_thread *disp_thread; + unsigned int min_duration = IDLE_POWERCOLLAPSE_DURATION; + unsigned int max_duration = IDLE_POWERCOLLAPSE_IN_EARLY_WAKEUP; /* return early if called from esd thread */ if (sde_enc->delay_kickoff) @@ -2000,10 +2002,15 @@ static void _sde_encoder_rc_restart_delayed(struct sde_encoder_virt *sde_enc, else lp = SDE_MODE_DPMS_ON; + fps = sde_enc->mode_info.frame_rate; if ((lp == SDE_MODE_DPMS_LP1) || (lp == SDE_MODE_DPMS_LP2)) idle_pc_duration = IDLE_SHORT_TIMEOUT; - else - idle_pc_duration = IDLE_POWERCOLLAPSE_DURATION; + else { + frame_time_ms = 1000; + do_div(frame_time_ms, fps); + idle_pc_duration = max(4 * frame_time_ms, min_duration); + idle_pc_duration = min(idle_pc_duration, max_duration); + } priv = drm_enc->dev->dev_private; disp_thread = &priv->disp_thread[sde_enc->crtc->index];