Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2483914pxj; Mon, 10 May 2021 04:12:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw04lUoxgze70+tpypLLXjCqee0NhZArDNVVQ/sr/ETLKjZO9pY0gMU5+m+uBD2Otz7qBPE X-Received: by 2002:a17:906:414d:: with SMTP id l13mr24851470ejk.527.1620645126527; Mon, 10 May 2021 04:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645126; cv=none; d=google.com; s=arc-20160816; b=nPy4d1OjRJCPe/SotmSEQ+nfyQX7YsKwWMUaNrDWe5tsPi3zoMwMD88JQd88nKdLKO IHMt7WyArieOKuk0L3Fa3YL8Pzt0IbwDnlMArR+S/GEg/dcbxV9u9lB90FnqTIIsJYeC Qyjf/qSqE7l7i7xUdOpotMWx271aTzBxUagCXRLuxoufwoM7cGmsHmWlQvo4/uB8JCBw EWGFh7YrXFP8td9vMg3VHsBTKAogA71vPhyuEnYPRzLF2lbd7ldNQC/F0geAegocjgUQ e31DMhTIOg2f2RZoWgLujZPOulNHlCkNJZ5U8mqIpdYKWiFNw00FpHx5RDwusPPMju/2 OioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BGlpac2O/ADblC0MyYOukaTdSH88p45O00QRn2nBClc=; b=C32a1pzLVMAeadA7e0QCtQoOS7gwPMwtrECLiYhCQIdePBjDANRjR/NoPA39O55w+L 1HkvEKUJuXEAkfqezMOCoL5TFq7CN8nf8TnMv5+VmYPEHuonloM0FnRZAg1waXqDN6di Y8dbzhJM939mNj4q6yjA7qucgl+IpQZLBeX+wiqzP8HrninY7WAklP7vzBCRc6+Hsuv/ QPUzt9JDBPvWQ+UWRPU90jsVi6s2yOHq/7MRu5SQCA4k/IYDx+CPdjDt1Mm1U2BUymxe qLfwHQY8UhHG/AiamcXoygUP5La+ddEHLO4vqKJq9AG/8VGiTwvU8BKOreMeFw1z5vxb VRxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pJ4KOKk3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si13383869edu.599.2021.05.10.04.11.42; Mon, 10 May 2021 04:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pJ4KOKk3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235388AbhEJLKM (ORCPT + 99 others); Mon, 10 May 2021 07:10:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:41914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233365AbhEJKt6 (ORCPT ); Mon, 10 May 2021 06:49:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E5DF561432; Mon, 10 May 2021 10:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643125; bh=iP8Xl5cIV0qr7oBh+yfEjl1AhKiBKCLTrvuWfKZd+bY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJ4KOKk3MHFTNpPyx5555E8uT0QWP0LWR64NwlGL3EU1cNT9Qn3c3fFjHTGkvFlRP C4euFW6l9HMD0BJZZAp90EwFjTE8uFTTM2pIevs2j9wea05P+fCFe+d+eu20oJbylE MKHv4jglI7zodPjiaLjDcAYKkrHPXuedn2ZIWsOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Marijn Suijten , Rob Clark , Sasha Levin Subject: [PATCH 5.10 187/299] drm/msm/mdp5: Do not multiply vclk line count by 100 Date: Mon, 10 May 2021 12:19:44 +0200 Message-Id: <20210510102011.129338837@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marijn Suijten [ Upstream commit 377569f82ea8228c421cef4da33e056a900b58ca ] Neither vtotal nor drm_mode_vrefresh contain a value that is premultiplied by 100 making the x100 variable name incorrect and resulting in vclks_line to become 100 times larger than it is supposed to be. The hardware counts 100 clockticks too many before tearcheck, leading to severe panel issues on at least the Sony Xperia lineup. This is likely an artifact from the original MDSS DSI panel driver where the calculation [1] corrected for a premultiplied reference framerate by 100 [2]. It does not appear that the above values were ever premultiplied in the history of the DRM MDP5 driver. With this change applied the value written to the SYNC_CONFIG_VSYNC register is now identical to downstream kernels. [1]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c?h=LA.UM.8.6.c26-02400-89xx.0#n288 [2]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_dsi_panel.c?h=LA.UM.8.6.c26-02400-89xx.0#n1648 Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Marijn Suijten Link: https://lore.kernel.org/r/20210406214726.131534-3-marijn.suijten@somainline.org Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c index f6df4d3b1406..0392d4dfe270 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c @@ -20,7 +20,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, { struct mdp5_kms *mdp5_kms = get_kms(encoder); struct device *dev = encoder->dev->dev; - u32 total_lines_x100, vclks_line, cfg; + u32 total_lines, vclks_line, cfg; long vsync_clk_speed; struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc); int pp_id = mixer->pp; @@ -30,8 +30,8 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, return -EINVAL; } - total_lines_x100 = mode->vtotal * drm_mode_vrefresh(mode); - if (!total_lines_x100) { + total_lines = mode->vtotal * drm_mode_vrefresh(mode); + if (!total_lines) { DRM_DEV_ERROR(dev, "%s: vtotal(%d) or vrefresh(%d) is 0\n", __func__, mode->vtotal, drm_mode_vrefresh(mode)); return -EINVAL; @@ -43,7 +43,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, vsync_clk_speed); return -EINVAL; } - vclks_line = vsync_clk_speed * 100 / total_lines_x100; + vclks_line = vsync_clk_speed / total_lines; cfg = MDP5_PP_SYNC_CONFIG_VSYNC_COUNTER_EN | MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN; -- 2.30.2