Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2284258ybl; Thu, 29 Aug 2019 06:16:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgWkr6sGLjeq0+nr9a1jGto2+J7CLjeq5L9Dp4NRZ+eywfOWH6sBi86wjPllGk5OWOH46E X-Received: by 2002:a63:1020:: with SMTP id f32mr8582386pgl.203.1567084604743; Thu, 29 Aug 2019 06:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567084604; cv=none; d=google.com; s=arc-20160816; b=fOaY+266K4GoIuakF0amd/8fSDqrnmKKGNf78zo6r8loo/kfXbMT4Oc0FlO+XVZQWJ Z2GpL4bJOMTDzjV/93aUmCZRHkKQAemv02722lUwYHmgGDGUFclzpZ5vH3G1jbucHgTf 6DTskDUTj1zfHcfoOAkXkI+qHo7iXawQZU+rYnh6aB0pn6I6hooR8LhfIE2Xw7o4VyLz 4KnUcFUudXgo4nbc00ntkBltwf4JeWKlOWxq2HB+DvwjizFx4u8pHjqNtAFbp6c+Phbi Ajgw5Y0dyIm4u0wzA/Dq2vKH9+vdHKW6rCJ+VCU/ta3+z4AqsUbyeZgMyZNcnpjP0AbK xJYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:reply-to:from:subject:message-id; bh=5otQF5nzGrZOSf/OwvkROy4D6CguVyrpdhQDZxabpzc=; b=06HI+iJGvUQMlK6wP5z5TpYl8jpJMlHfvfFGji4KXdaYjKy8WGmMls66N049tT7U/y ku/pUcM7vWknCD5zmcraKhBwZAAnTfwJu7dYRxpibV0iQCsIWyv0pdvPKYrvJH6tDQqm zPsYOMA4WJZatAQt4xNfm94PrRThm3N3e3C+2NOdPOZfRqzmZulu1W6Yb12Jdo823z/Q nnpiE/h6LLs1ToovqQjkAIHm4y5lr6APQpXUaEOCCC05UYKI9RCvKoKNsBMaye8nHRo6 ZGVV+YzuDBecnxPS5grSU5N6F/IJcy7XZKxpWv51uuT88FL15nUam7KqTv7Z69Q//pGA W1FQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 134si1682639pfa.245.2019.08.29.06.16.26; Thu, 29 Aug 2019 06:16:44 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfH2NPQ (ORCPT + 99 others); Thu, 29 Aug 2019 09:15:16 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:24065 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726985AbfH2NPQ (ORCPT ); Thu, 29 Aug 2019 09:15:16 -0400 X-UUID: 95ae08a863bb4e6e83b096b647869ae8-20190829 X-UUID: 95ae08a863bb4e6e83b096b647869ae8-20190829 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1782353988; Thu, 29 Aug 2019 21:15:10 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 29 Aug 2019 21:15: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; Thu, 29 Aug 2019 21:15:14 +0800 Message-ID: <1567084508.30648.4.camel@mhfsdcap03> Subject: Re: [PATCH v4, 23/33] drm/mediatek: add ovl0/ovl_2l0 usecase From: Yongqiang Niu Reply-To: To: CK Hu CC: Philipp Zabel , Rob Herring , Matthias Brugger , "David Airlie" , Daniel Vetter , Mark Rutland , , , , , Date: Thu, 29 Aug 2019 21:15:08 +0800 In-Reply-To: <1563346064.29169.24.camel@mtksdaap41> References: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> <1562625253-29254-24-git-send-email-yongqiang.niu@mediatek.com> <1563346064.29169.24.camel@mtksdaap41> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-07-17 at 14:47 +0800, CK Hu wrote: > Hi, Yongqiang: > > On Tue, 2019-07-09 at 06:34 +0800, yongqiang.niu@mediatek.com wrote: > > From: Yongqiang Niu > > > > This patch add ovl0/ovl_2l0 usecase > > in ovl->ovl_2l0 direct link usecase: > > 1. the crtc support layer number will 4+2 > > 2. ovl_2l0 background color input select ovl0 when crtc init > > and disable it when crtc finish > > 3. config ovl_2l0 layer, if crtc config layer number is > > bigger than ovl0 support layers(max is 4) > > > > Signed-off-by: Yongqiang Niu > > --- > > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 38 +++++++++++++++++++++++++++++++-- > > 1 file changed, 36 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > index 5eac376..9ee9ce2 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > @@ -282,6 +282,15 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) > > > > for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { > > struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[i]; > > + enum mtk_ddp_comp_id prev; > > + > > + if (i > 0) > > + prev = mtk_crtc->ddp_comp[i - 1]->id; > > + else > > + prev = DDP_COMPONENT_ID_MAX; > > + > > + if (prev == DDP_COMPONENT_OVL0) > > + mtk_ddp_comp_bgclr_in_on(comp); > > I does not like to use a specific component id to check, that is not > general. For now, you could simply call mtk_ddp_comp_bgclr_in_on(comp); > for all component because only ovl_2l has implemented it. > > Regards, > CK > both OVL0 and OVL_2L0 has the function mtk_ddp_comp_bgclr_in_on > > > > mtk_ddp_comp_config(comp, width, height, vrefresh, bpc); > > mtk_ddp_comp_start(comp); > > @@ -291,9 +300,18 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) > > for (i = 0; i < mtk_crtc->layer_nr; i++) { > > struct drm_plane *plane = &mtk_crtc->planes[i]; > > struct mtk_plane_state *plane_state; > > + struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; > > + unsigned int comp_layer_nr = mtk_ddp_comp_layer_nr(comp); > > + unsigned int local_layer; > > > > plane_state = to_mtk_plane_state(plane->state); > > - mtk_ddp_comp_layer_config(mtk_crtc->ddp_comp[0], i, > > + > > + if (i >= comp_layer_nr) { > > + comp = mtk_crtc->ddp_comp[1]; > > + local_layer = i - comp_layer_nr; > > + } else > > + local_layer = i; > > + mtk_ddp_comp_layer_config(comp , local_layer, > > plane_state); > > } > > > > @@ -319,6 +337,7 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) > > mtk_crtc->ddp_comp[i]->id); > > mtk_disp_mutex_disable(mtk_crtc->mutex); > > for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { > > + mtk_ddp_comp_bgclr_in_off(mtk_crtc->ddp_comp[i]); > > mtk_ddp_remove_comp_from_path(mtk_crtc->config_regs, > > mtk_crtc->mmsys_reg_data, > > mtk_crtc->ddp_comp[i]->id, > > @@ -339,6 +358,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc) > > struct mtk_crtc_state *state = to_mtk_crtc_state(mtk_crtc->base.state); > > struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; > > unsigned int i; > > + unsigned int comp_layer_nr = mtk_ddp_comp_layer_nr(comp); > > + unsigned int local_layer; > > > > /* > > * TODO: instead of updating the registers here, we should prepare > > @@ -361,7 +382,14 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc) > > plane_state = to_mtk_plane_state(plane->state); > > > > if (plane_state->pending.config) { > > - mtk_ddp_comp_layer_config(comp, i, plane_state); > > + if (i >= comp_layer_nr) { > > + comp = mtk_crtc->ddp_comp[1]; > > + local_layer = i - comp_layer_nr; > > + } else > > + local_layer = i; > > + > > + mtk_ddp_comp_layer_config(comp, local_layer, > > + plane_state); > > plane_state->pending.config = false; > > } > > } > > @@ -592,6 +620,12 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, > > } > > > > mtk_crtc->layer_nr = mtk_ddp_comp_layer_nr(mtk_crtc->ddp_comp[0]); > > + if (mtk_crtc->ddp_comp_nr > 1) { > > + struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[1]; > > + > > + if (comp->funcs->bgclr_in_on) > > + mtk_crtc->layer_nr += mtk_ddp_comp_layer_nr(comp); > > + } > > mtk_crtc->planes = devm_kcalloc(dev, mtk_crtc->layer_nr, > > sizeof(struct drm_plane), > > GFP_KERNEL); > >