Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp77408rwr; Wed, 19 Apr 2023 18:13:08 -0700 (PDT) X-Google-Smtp-Source: AKy350aN+adLcMeMGhg5Y0UI7gtd1n7hF5buEu6bwXQt5ZFA3peKMQUwtZ7QegtrRH4bXcpV5Aim X-Received: by 2002:a05:6a20:a5a8:b0:ee:fe67:5cb9 with SMTP id bc40-20020a056a20a5a800b000eefe675cb9mr668436pzb.17.1681953188614; Wed, 19 Apr 2023 18:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681953188; cv=none; d=google.com; s=arc-20160816; b=Dzk3g2rK/erpqsIDkiIPmkfFrzdJ7cawdoeI9vQpurLLv0XX5DFgw930uB1UNLjDu1 COl8mKUjBTinDwxZnvK/dY/7Q1eRf0lGHnoczWKMBsobLO57XqwVxLs/rpWP1arhV/0C A4WS/jZEQe2WRpI7Os+UlpY22HZDxIMieTin+KQlNEknmatXdkoGhLbXLDQ4LTIKs1OR bmQL5i+u92xn73dRYtNMnaxCMAtjwrR+ylGhnyjBTAdoJYJqUQx4+4sloC6Fm1VGJG1F lhLwDLkjwGyrxrF6Y7oD/1dLP1CkNmY+E4WE9LEWhOZ3hjo2bLURhxdqH109yLF2q/n0 x3WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=QRGH+8eyVHtAfLSjlnOB+uRyITWQT7h2HZdn2ZTq1sE=; b=KDonL9F2iXDu+d92/UELtNA2wId+vtUpj6hm3+zOaC1ZE9GFCbFvm6wqxgorghZ4wn BzF/bXxoj45p/KpeV/rb4Y2dFHFWZTMvlleq4dIOMfSNuTdGdPzJRTL3YcQD/rdMtDp6 aEErLMmElznr4pgSlL7KOp49AMwqNo26osHtWe5CDKhwGHcX8NWnWPY+3BHZYR9AMjA2 fu6U3x8co9XsDgVTS0PWBjgz2j2fQJEeEga6Usg+Zva3a+F0yVJYCiMkFYmtX7tFURH1 LPJi9Nk2SMZCUceLjPk8bx1mIkeMuOVUU/ui1spTb9ld+uSY/p2HjzJK74q9x+xDGOMk /bRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DVAW4gKt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q62-20020a17090a4fc400b0023361862115si2810178pjh.129.2023.04.19.18.12.31; Wed, 19 Apr 2023 18:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DVAW4gKt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232808AbjDTBBg (ORCPT + 99 others); Wed, 19 Apr 2023 21:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbjDTBBf (ORCPT ); Wed, 19 Apr 2023 21:01:35 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E4E420A for ; Wed, 19 Apr 2023 18:01:33 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id h2so925239ljh.13 for ; Wed, 19 Apr 2023 18:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681952491; x=1684544491; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QRGH+8eyVHtAfLSjlnOB+uRyITWQT7h2HZdn2ZTq1sE=; b=DVAW4gKtUAioMK7djun6d0Fqnr9P7c5VZwzdA/SLJnqoCs/yt91jDTbqVSBjR+sd1h Z3WTU6bbh+qYd5hAxSg6x3QKfho/7xKTS45VwPFbpBUXbnAaxRJmOFL2G8DD5TTyTpu5 4ogVlQ/iHBSL75Rk7MED/bauOaitW36rG+99E+EGCtd+BPnJ5fg/4/3rdeL+5lDncof4 6JZQvTi8y4HN4mpbPw7ivlApaY2hTt4bjBOmXflO1YD+mAnCC+UfUPHa1R0aMQvyNfb5 xVFACDKctwuVVDKqqpOqbezx3Y0bWQqhQ8Ow5tlRLmqo6Uhx40k3Is0E5vAgLBK3hQdH H/HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681952491; x=1684544491; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QRGH+8eyVHtAfLSjlnOB+uRyITWQT7h2HZdn2ZTq1sE=; b=OrwjnAcumjm0qid/lja2rM26SiwXunHx/MA9JO+vTYwIsUN42/viCx4K84OY/BvDwu zG6EVOOzP0JZRuq6bXsN7CuR7zSpjGp/fl978sL0A/aqODeG30V7KfNpoHEQMcsHR4zC TrIbRb8o+e9cA8zHi8/PLXWN4vpnKhdgAHhjvDmMtn82WWCy5bd1kaxWbW4D3keZz8Zo Qtff/XdAaxe7T9cxlKQd7wrx+6t71iL6jIaoiwbnO03gyDYcugjoN6XYvUwGL35tzj6h gC+RXwxno69NiNlQZ9w2hMQxqZCTT7VybXmn2+hhPvv9CFGVNWp+2TBZCz+S7BQFauXF Xdcg== X-Gm-Message-State: AAQBX9eP6KqltgtwRmsMscZBWyAJR/LiY2lMZst/lWf/5dgnZfQVsRCd yDPJIXhDWAo1TUjK0vMzkKGvUg== X-Received: by 2002:a2e:9a82:0:b0:2a7:75ae:3e63 with SMTP id p2-20020a2e9a82000000b002a775ae3e63mr2375020lji.27.1681952491472; Wed, 19 Apr 2023 18:01:31 -0700 (PDT) Received: from [192.168.1.101] (abyj144.neoplus.adsl.tpnet.pl. [83.9.29.144]) by smtp.gmail.com with ESMTPSA id w21-20020a2e8215000000b002a9f1b23604sm24066ljg.93.2023.04.19.18.01.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 18:01:31 -0700 (PDT) Message-ID: <38030486-f08a-33e6-f8d1-3f4de379a75b@linaro.org> Date: Thu, 20 Apr 2023 03:01:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v2 11/17] drm/msm/dpu: Disable MDP vsync source selection on DPU 5.0.0 and above Content-Language: en-US To: Dmitry Baryshkov , Marijn Suijten , Rob Clark , Abhinav Kumar , Sean Paul , David Airlie , Daniel Vetter , Adam Skladowski , Loic Poulain , Bjorn Andersson , Kuogee Hsieh , Robert Foss , Vinod Koul , Rajesh Yadav , Jeykumar Sankaran , Neil Armstrong , Chandan Uddaraju Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Martin Botka , Jami Kettunen , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jordan Crouse , Archit Taneja , Sravanthi Kollukuduru References: <20230411-dpu-intf-te-v2-0-ef76c877eb97@somainline.org> <20230411-dpu-intf-te-v2-11-ef76c877eb97@somainline.org> <20fab838-e05b-163d-aa72-bd8235df9f2c@linaro.org> From: Konrad Dybcio In-Reply-To: <20fab838-e05b-163d-aa72-bd8235df9f2c@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.04.2023 03:00, Dmitry Baryshkov wrote: > On 17/04/2023 23:21, Marijn Suijten wrote: >> Since hardware revision 5.0.0 the TE configuration moved out of the >> PINGPONG block into the INTF block, including vsync source selection >> that was previously part of MDP top.  Writing to the MDP_VSYNC_SEL >> register has no effect anymore and is omitted downstream via the >> DPU/SDE_MDP_VSYNC_SEL feature flag.  This flag is only added to INTF >> blocks used by hardware prior to 5.0.0. >> >> The code that writes to these registers in the INTF block will follow in >> subsequent patches. >> >> Signed-off-by: Marijn Suijten >> Reviewed-by: Dmitry Baryshkov >> --- >>   .../drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h    |  2 +- >>   .../gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h |  2 +- >>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h     |  3 ++ >>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c         | 52 +++++++++++++++------- >>   4 files changed, 41 insertions(+), 18 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h >> index b7845591c384..6906f8046b9e 100644 >> --- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h >> +++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h >> @@ -30,7 +30,7 @@ static const struct dpu_mdp_cfg msm8998_mdp[] = { >>       { >>       .name = "top_0", .id = MDP_TOP, >>       .base = 0x0, .len = 0x458, >> -    .features = 0, >> +    .features = BIT(DPU_MDP_VSYNC_SEL), >>       .clk_ctrls[DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 }, >>       .clk_ctrls[DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0 }, >>       .clk_ctrls[DPU_CLK_CTRL_VIG2] = { .reg_off = 0x2bc, .bit_off = 0 }, >> diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h >> index 5b9b3b99f1b5..14ce397800d5 100644 >> --- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h >> +++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h >> @@ -30,7 +30,7 @@ static const struct dpu_mdp_cfg sdm845_mdp[] = { >>       { >>       .name = "top_0", .id = MDP_TOP, >>       .base = 0x0, .len = 0x45c, >> -    .features = BIT(DPU_MDP_AUDIO_SELECT), >> +    .features = BIT(DPU_MDP_AUDIO_SELECT) | BIT(DPU_MDP_VSYNC_SEL), >>       .clk_ctrls[DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 }, >>       .clk_ctrls[DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0 }, >>       .clk_ctrls[DPU_CLK_CTRL_VIG2] = { .reg_off = 0x2bc, .bit_off = 0 }, >> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h >> index 71584cd56fd7..599e177b89dd 100644 >> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h >> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h >> @@ -48,6 +48,8 @@ enum { >>    * @DPU_MDP_UBWC_1_5,      Universal Bandwidth compression version 1.5 >>    * @DPU_MDP_PERIPH_0_REMOVED Indicates that access to periph top0 block results >>    *               in a failure >> + * @DPU_MDP_VSYNC_SEL      Enables vsync source selection via MDP_VSYNC_SEL register >> + *                         (moved into INTF block since DPU 5.0.0) >>    * @DPU_MDP_MAX            Maximum value >>      */ >> @@ -59,6 +61,7 @@ enum { >>       DPU_MDP_UBWC_1_5, >>       DPU_MDP_AUDIO_SELECT, >>       DPU_MDP_PERIPH_0_REMOVED, >> +    DPU_MDP_VSYNC_SEL, >>       DPU_MDP_MAX >>   }; >>   diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c >> index 2bb02e17ee52..9ea15a647a66 100644 >> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c >> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c >> @@ -126,28 +126,16 @@ static void dpu_hw_get_danger_status(struct dpu_hw_mdp *mdp, >>       status->sspp[SSPP_CURSOR1] = (value >> 26) & 0x3; >>   } >>   -static void dpu_hw_setup_vsync_source(struct dpu_hw_mdp *mdp, >> +static void dpu_hw_setup_vsync_source_v1(struct dpu_hw_mdp *mdp, >>           struct dpu_vsync_source_cfg *cfg) > > In my opinion _v1 is not really descriptive here. Could you please rename it to dpu_hw_setup_vsync_source_no_vsync_sel() ? v1 refers to the CTL rev 100 a.k.a 1.0.0 a.k.a 1, but that's not yet very well formulated upstream.. if we even need it.. Konrad > > Or maybe rename dpu_hw_setup_vsync_source() to dpu_hw_setup_vsync_source_vsync_sel() and drop _v1 from this function. > > Up to you. > > >>   { >>       struct dpu_hw_blk_reg_map *c; >> -    u32 reg, wd_load_value, wd_ctl, wd_ctl2, i; >> -    static const u32 pp_offset[PINGPONG_MAX] = {0xC, 0x8, 0x4, 0x13, 0x18}; >> +    u32 reg, wd_load_value, wd_ctl, wd_ctl2; >>   -    if (!mdp || !cfg || (cfg->pp_count > ARRAY_SIZE(cfg->ppnumber))) >> +    if (!mdp || !cfg) >>           return; >>         c = &mdp->hw; >> -    reg = DPU_REG_READ(c, MDP_VSYNC_SEL); >> -    for (i = 0; i < cfg->pp_count; i++) { >> -        int pp_idx = cfg->ppnumber[i] - PINGPONG_0; >> - >> -        if (pp_idx >= ARRAY_SIZE(pp_offset)) >> -            continue; >> - >> -        reg &= ~(0xf << pp_offset[pp_idx]); >> -        reg |= (cfg->vsync_source & 0xf) << pp_offset[pp_idx]; >> -    } >> -    DPU_REG_WRITE(c, MDP_VSYNC_SEL, reg); >>         if (cfg->vsync_source >= DPU_VSYNC_SOURCE_WD_TIMER_4 && >>               cfg->vsync_source <= DPU_VSYNC_SOURCE_WD_TIMER_0) { >> @@ -194,6 +182,33 @@ static void dpu_hw_setup_vsync_source(struct dpu_hw_mdp *mdp, >>       } >>   } >>   +static void dpu_hw_setup_vsync_source(struct dpu_hw_mdp *mdp, >> +        struct dpu_vsync_source_cfg *cfg) >> +{ >> +    struct dpu_hw_blk_reg_map *c; >> +    u32 reg, i; >> +    static const u32 pp_offset[PINGPONG_MAX] = {0xC, 0x8, 0x4, 0x13, 0x18}; >> + >> +    if (!mdp || !cfg || (cfg->pp_count > ARRAY_SIZE(cfg->ppnumber))) >> +        return; >> + >> +    c = &mdp->hw; >> + >> +    reg = DPU_REG_READ(c, MDP_VSYNC_SEL); >> +    for (i = 0; i < cfg->pp_count; i++) { >> +        int pp_idx = cfg->ppnumber[i] - PINGPONG_0; >> + >> +        if (pp_idx >= ARRAY_SIZE(pp_offset)) >> +            continue; >> + >> +        reg &= ~(0xf << pp_offset[pp_idx]); >> +        reg |= (cfg->vsync_source & 0xf) << pp_offset[pp_idx]; >> +    } >> +    DPU_REG_WRITE(c, MDP_VSYNC_SEL, reg); >> + >> +    dpu_hw_setup_vsync_source_v1(mdp, cfg); >> +} >> + >>   static void dpu_hw_get_safe_status(struct dpu_hw_mdp *mdp, >>           struct dpu_danger_safe_status *status) >>   { >> @@ -241,7 +256,12 @@ static void _setup_mdp_ops(struct dpu_hw_mdp_ops *ops, >>       ops->setup_split_pipe = dpu_hw_setup_split_pipe; >>       ops->setup_clk_force_ctrl = dpu_hw_setup_clk_force_ctrl; >>       ops->get_danger_status = dpu_hw_get_danger_status; >> -    ops->setup_vsync_source = dpu_hw_setup_vsync_source; >> + >> +    if (cap & BIT(DPU_MDP_VSYNC_SEL)) >> +        ops->setup_vsync_source = dpu_hw_setup_vsync_source; >> +    else >> +        ops->setup_vsync_source = dpu_hw_setup_vsync_source_v1; >> + >>       ops->get_safe_status = dpu_hw_get_safe_status; >>         if (cap & BIT(DPU_MDP_AUDIO_SELECT)) >> >