Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp54337ima; Thu, 14 Mar 2019 19:35:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwh93bRipSGHEUnG17cz7cYYDaQpxo0ocoBUYWvrvuHYJE/ZYjNVkbAUsovp6SniQ8lx1ze X-Received: by 2002:a17:902:ea8c:: with SMTP id cv12mr1588647plb.123.1552617316908; Thu, 14 Mar 2019 19:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552617316; cv=none; d=google.com; s=arc-20160816; b=xyxwEGbaacyVI4iskCA4T2sM4S6iJdwr4/evG7RUL6NjTPnmFWgjlDb+tsI0LXfqU1 rplTMAbkzCgZeFZ1zAk0Y3i8sFecQ1C5oW8lawbhGH4ZzmuocnxgCl3bihX5Y0IUGgZn Vy28AIH6SBs+OhhMuipxD9IoK0fAli3jL30u+mYZdWx/YcYxQb0h+DGplx6WAae2Jm8a zJFWZ87vsynaYm7x62m7sqBEXPP2YqYBYDc5n44VZ3Q7XyuYLLaaL/yM2us/kubszq57 v8rZkca8RUk26WBGFWVklyNjIEp0G6lpT03h2nTkU6RQQ8U+JngAUqhhbwC2ElHEPaBP HK/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:reply-to:from:subject:message-id; bh=cuzlpK3tCiIM/yiQy5wzgtfL9+OO8Cxqq5TbHHsP2LM=; b=UOkuEWeoscPV05E8kWXWJo7uHhsutBAZPrD3rWUOK64IxpQClnnGzrg60+mL3BqWVL E+HRJUGgrbium4PJoIpXhcBXLqo3zehXm5Ky7Tyz16hQpHA52GYBrXJ2XZ7QZGZuARD0 rnK1nGPBC7FkQ3lT6jn7zQ+3e8w7CJ3wXYmxAZxeFynaijeahm7nd6K9hG/xU1AWjSEa iFr9IwhSSjmCKtHDvPpeU8X2p8OUS2Ow66GAmQ94pZqIriu8BaIRE62+i4vDPzwRvow7 0HwXt2g2tWf382rcmvJoC/HwGE2MWs4gCN1xgygOscp7wMDDsGnJJN2mcrdZr6bsslm1 iqqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b39si577849pla.381.2019.03.14.19.35.01; Thu, 14 Mar 2019 19:35:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727627AbfCOCe1 (ORCPT + 99 others); Thu, 14 Mar 2019 22:34:27 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:56883 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727103AbfCOCe1 (ORCPT ); Thu, 14 Mar 2019 22:34:27 -0400 X-UUID: d5bf4900edb7460bb49eabf8ed477170-20190315 X-UUID: d5bf4900edb7460bb49eabf8ed477170-20190315 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1001151406; Fri, 15 Mar 2019 10:34:22 +0800 Received: from MTKMBS01DR.mediatek.inc (172.21.101.111) by mtkexhb01.mediatek.inc (172.21.101.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 15 Mar 2019 10:34:21 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by mtkmbs01dr.mediatek.inc (172.21.101.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 15 Mar 2019 10:34:14 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 15 Mar 2019 10:34:12 +0800 Message-ID: <1552617252.31200.24.camel@mhfsdcap03> Subject: Re: [PATCH 10/18] drm/mediatek: add gmc_bits for ovl private data From: Yongqiang Niu Reply-To: To: Nicolas Boichat CC: CK Hu , Philipp Zabel , "David Airlie" , Rob Herring , Mark Rutland , Matthias Brugger , , lkml , , , linux-arm Mailing List Date: Fri, 15 Mar 2019 10:34:12 +0800 In-Reply-To: References: <1545638931-24938-1-git-send-email-yongqiang.niu@mediatek.com> <1545638931-24938-11-git-send-email-yongqiang.niu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-12-25 at 12:15 +0800, Nicolas Boichat wrote: > On Mon, Dec 24, 2018 at 6:53 PM Yongqiang Niu > wrote: > > > > This patch add gmc_bits for ovl private data > > > > Signed-off-by: Yongqiang Niu > > --- > > drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 23 +++++++++++++++++++++-- > > 1 file changed, 21 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > > index 28d1911..afb313c 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > > @@ -39,7 +39,9 @@ > > #define DISP_REG_OVL_ADDR_MT8173 0x0f40 > > #define DISP_REG_OVL_ADDR(ovl, n) ((ovl)->data->addr + 0x20 * (n)) > > > > -#define OVL_RDMA_MEM_GMC 0x40402020 > > +#define GMC_THRESHOLD_BITS 16 > > +#define GMC_THRESHOLD_HIGH ((1 << GMC_THRESHOLD_BITS) / 4) > > +#define GMC_THRESHOLD_LOW ((1 << GMC_THRESHOLD_BITS) / 8) > > > > #define OVL_CON_BYTE_SWAP BIT(24) > > #define OVL_CON_MTX_YUV_TO_RGB (6 << 16) > > @@ -57,6 +59,7 @@ > > > > struct mtk_disp_ovl_data { > > unsigned int addr; > > + unsigned int gmc_bits; > > bool fmt_rgb565_is_0; > > }; > > > > @@ -140,9 +143,23 @@ static unsigned int mtk_ovl_layer_nr(struct mtk_ddp_comp *comp) > > static void mtk_ovl_layer_on(struct mtk_ddp_comp *comp, unsigned int idx) > > { > > unsigned int reg; > > + unsigned int gmc_thrshd_l; > > + unsigned int gmc_thrshd_h; > > + unsigned int gmc_value; > > + struct mtk_disp_ovl *ovl = comp_to_ovl(comp); > > > > writel(0x1, comp->regs + DISP_REG_OVL_RDMA_CTRL(idx)); > > - writel(OVL_RDMA_MEM_GMC, comp->regs + DISP_REG_OVL_RDMA_GMC(idx)); > > + > > + gmc_thrshd_l = GMC_THRESHOLD_LOW >> > > + (GMC_THRESHOLD_BITS - ovl->data->gmc_bits); > > + gmc_thrshd_h = GMC_THRESHOLD_HIGH >> > > + (GMC_THRESHOLD_BITS - ovl->data->gmc_bits); > > + if (ovl->data->gmc_bits == 10) > > + gmc_value = gmc_thrshd_h | gmc_thrshd_h << 16; > > I don't really get what this does, but is it intentional that you > don't use gmc_thrshd_l here? > GMC register was set RDMA ultra and pre-ultra threshold. MT8183 GMC register define is different with other SOC, gmc_thrshd_l not used here. > Also, if you only ever use 8 or 10 bits gmc, maybe it's easier to > hard-code the 2 values? > if (ovl->data->gmc_bits == 10) > gmc_value = OVL_RDMA_MEM_GMC_10BIT; > else > gmc_value = OVL_RDMA_MEM_GMC_8BIT; //0x40402020 > our internal maintainer prefer calculate GMC setting with private data gmc bit instead of hard-core. and with calculation function that will be more flexible > > + else > > + gmc_value = gmc_thrshd_l | gmc_thrshd_l << 8 | > > + gmc_thrshd_h << 16 | gmc_thrshd_h << 24; > > + writel(gmc_value, comp->regs + DISP_REG_OVL_RDMA_GMC(idx)); > > > > reg = readl(comp->regs + DISP_REG_OVL_SRC_CON); > > reg = reg | BIT(idx); > > @@ -324,11 +341,13 @@ static int mtk_disp_ovl_remove(struct platform_device *pdev) > > > > static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = { > > .addr = DISP_REG_OVL_ADDR_MT2701, > > + .gmc_bits = 8, > > .fmt_rgb565_is_0 = false, > > }; > > > > static const struct mtk_disp_ovl_data mt8173_ovl_driver_data = { > > .addr = DISP_REG_OVL_ADDR_MT8173, > > + .gmc_bits = 8, > > .fmt_rgb565_is_0 = true, > > }; > > > > -- > > 1.8.1.1.dirty > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel