From eb696e16c72c722f43ff1db2a26354cadf81f97d Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Mon, 25 Jan 2021 23:37:56 -0800 Subject: [PATCH] drm/msm/sde: Skip heavy autorefresh checks when it's not enabled These heavy checks for seeing if autorefresh is enabled are unneeded when the autorefresh config is disabled. These checks are performed on every display commit and show up as using a significant amount of CPU time in perf top. Skip them when it's unnecessary in order to improve display rendering performance. Signed-off-by: Sultan Alsawaf --- techpack/display/msm/sde/sde_encoder_phys_cmd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/techpack/display/msm/sde/sde_encoder_phys_cmd.c b/techpack/display/msm/sde/sde_encoder_phys_cmd.c index eb0b3b578434..4021175bec76 100644 --- a/techpack/display/msm/sde/sde_encoder_phys_cmd.c +++ b/techpack/display/msm/sde/sde_encoder_phys_cmd.c @@ -1181,12 +1181,20 @@ static void sde_encoder_phys_cmd_enable(struct sde_encoder_phys *phys_enc) static bool sde_encoder_phys_cmd_is_autorefresh_enabled( struct sde_encoder_phys *phys_enc) { + struct sde_encoder_phys_cmd *cmd_enc; struct sde_hw_pingpong *hw_pp; struct sde_hw_intf *hw_intf; struct sde_hw_autorefresh cfg; int ret; - if (!phys_enc || !phys_enc->hw_pp || !phys_enc->hw_intf) + if (!phys_enc) + return false; + + cmd_enc = to_sde_encoder_phys_cmd(phys_enc); + if (!cmd_enc->autorefresh.cfg.enable) + return false; + + if (!phys_enc->hw_pp || !phys_enc->hw_intf) return false; if (!sde_encoder_phys_cmd_is_master(phys_enc))