Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5000268img; Tue, 26 Mar 2019 23:22:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2GQYoBsCFmxopEWObYlBL1MDxG+eCPQ++EHEtq+YdtQdwbaiDqGIv5JRd7c4pYDwgJUpj X-Received: by 2002:a62:3892:: with SMTP id f140mr28094349pfa.128.1553667728295; Tue, 26 Mar 2019 23:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667728; cv=none; d=google.com; s=arc-20160816; b=OX6JZbMhASTMx7k00M7E016gOKtJIxhjPYm34XFqBe8ijtWfsZjH7fJp+V+gDfwuPh I/iXQkPrAYw3mZOzCA+d2THOcCfQwJEJ06B17pUmBpkNEUMKxF26gymkUysrT3qNB4FA q9FxxcNwTIPh6AXtA3tp+0yETejBjTIVTF+D3tm8Ni6j6vEnAK6xrRJ2M90ijtG8GsNT ZyAEDaE/Dkui8Kei5RYGL03+p7ZPmUtAB/edCpCVJiIltbWLVZGBbfTj8Z/5Xs0xfAQ0 s9QSsUAVOCqXCVH0sgS6n9hL21hL5z/OUjUZMjCqbhelPYT5SyZxB13fLnjqqVw5qGvZ oA7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=9Qzr5ASQzzLZJahjEO9gtyh+zruv4Da/Hvza4++ZRT4=; b=IkqWg2GVuR7CmzsPGTsbvZukr8W1WmbydlhPgGJIgx8UdhTnJh7hJrG1HwIULQyHGL gcJyuRgHfTb9qh5E539lCt1LGsRg7TF0hkM21oCITbggG0/WNivoDBOpFum9l0PPXRBm sNsoAUg/bKsQtimWYwcaY+KJUWlYOh+vAecM396RY/AXLNmp0l0xGd217E6vNyNF73pl mgpNBq5RDHNEsHCPfp0/pdrKWQOk0HoWw0cv5myvcjPAO6Xh1aRSa2hHZSdNhw+81rvW uCiCFdyZe9iM1jJELSWyDgODfLKE30M/jCO8ShIOIejKWrvnbrgY9YHn9Xn/uObITMWx ZQ1g== 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 67si18601819plf.222.2019.03.26.23.21.53; Tue, 26 Mar 2019 23:22:08 -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 S2387520AbfC0GUB (ORCPT + 99 others); Wed, 27 Mar 2019 02:20:01 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:15146 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387474AbfC0GT7 (ORCPT ); Wed, 27 Mar 2019 02:19:59 -0400 X-UUID: eff7b8fdb7d046f2852efc1a80e90747-20190327 X-UUID: eff7b8fdb7d046f2852efc1a80e90747-20190327 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 485538325; Wed, 27 Mar 2019 14:19:55 +0800 Received: from MTKMBS01DR.mediatek.inc (172.21.101.111) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:54 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01dr.mediatek.inc (172.21.101.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:53 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:53 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 20/25] drm/mediatek: add ovl0/ovl0_2l usecase Date: Wed, 27 Mar 2019 14:19:16 +0800 Message-ID: <1553667561-25447-21-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu This patch add ovl0/ovl0_2l usecase in ovl->ovl0_2l direct link usecase: 1. the crtc support layer number will 4+2 2. ovl0_2l background color input select ovl0 when crtc init and disable it when crtc finish 3. config ovl0_2l 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 11e3404..0f97ee3 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -283,6 +283,13 @@ 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; + mtk_ddp_comp_bgclr_in_on(comp, prev); mtk_ddp_comp_config(comp, width, height, vrefresh, bpc); mtk_ddp_comp_start(comp); @@ -292,9 +299,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); } @@ -320,6 +336,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, @@ -340,6 +357,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 @@ -362,7 +381,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; } } @@ -604,6 +630,14 @@ 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]; + enum mtk_ddp_comp_type comp_type; + + comp_type = mtk_ddp_comp_get_type(comp->id); + if (comp_type == MTK_DISP_OVL || comp_type == MTK_DISP_OVL_2L) + 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); -- 1.8.1.1.dirty