Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2768231rdb; Fri, 22 Sep 2023 07:57:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrPBr3sSiOt4G2KfBDnIwxKwClk86ZPXr5ZBg2RRw24/h+Lj8ir4Z60EZse/G3g1saXyqf X-Received: by 2002:a17:90a:4809:b0:26f:c6d5:3cd4 with SMTP id a9-20020a17090a480900b0026fc6d53cd4mr8619522pjh.43.1695394675180; Fri, 22 Sep 2023 07:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695394675; cv=none; d=google.com; s=arc-20160816; b=bMZ71EJKRBnF7m/284nk1QVmng1rLlKK9tS1XymxEBPEdVflVbimtoNL1sBDBj05Qm gGkz2sSxXE9av9N5VQUtol5/3mJvUlisAHJt/7Uufd05UTyaAWJNYQH2HitIwwk3EU+8 peNCC0/ydOhcvGGHuftBKwZrYcgs5T3Xv940TI8TZnyL52hw6sbAqPl/0GqXg8It2rE9 415Nlj+heGgdby87AZ5IBXQioBsOwxGiN7sGX6cfoLSR0qFc4ymRsO1mDuihHvtKlfKq UqhiItpcbameZekR5SrRmCTeNjGY5gQn5IAX5/+ioJ+ecJd8UJtzCDk6Qml5IyE8qrXQ Qu9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xBKkw+SZnpwG3N6xV8Y+hw1f+U5gzW6/VgKlj1TcmpU=; fh=k5r3WFKFQbAEIb6pT/8lyqCfM6//JlyjgykC9n5/rWo=; b=nMfhAu3r3YUB0IFHCqLI3oUicIZtJ7c8kINxX7CPDgx9MZbHJT0w7u/Svr4ZYRedlq UtwWz1dLvPZeoLEQgiDze/ojXH+mcIFBwyGPa27YlHtVRgmITmGDtVU3Oc3IjRMY5Vvh QhhSEDFcFhdB/8Rd6H5nhNldH64u5S27R2APcGyDIxSh0Zl9T/CRJgf0fDaKP9FPH0Q/ bGRNCjGe0YSD0Wq7NXZzyF6UtE9x9XPTnlngTybzB5RGt96Z0I3wViakzR2jsT416QIU jnLqEmbh02xJO588mRY7Su/OmIUGSqVdFhB/HJwmyab4H+s8uZOcmOrs17o8z8OAwSqI S3cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=k4HNfQQ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l16-20020a17090ac59000b00274bdd908dasi6033664pjt.97.2023.09.22.07.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 07:57:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=k4HNfQQ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2E41382F05FF; Fri, 22 Sep 2023 00:42:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231837AbjIVHmV (ORCPT + 99 others); Fri, 22 Sep 2023 03:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjIVHmB (ORCPT ); Fri, 22 Sep 2023 03:42:01 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19C1194; Fri, 22 Sep 2023 00:41:54 -0700 (PDT) X-UUID: 7c618948591b11eea33bb35ae8d461a2-20230922 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=xBKkw+SZnpwG3N6xV8Y+hw1f+U5gzW6/VgKlj1TcmpU=; b=k4HNfQQ7TxV0z+upCgtRfLE6aQAsAUVUZMehl4VejebjlSjUG+NFH2Z7qaMlo7voIJSdYAcNbA8Gld/qR46/PRLIwG8HcNCvBK2L6AGengjBMYmbG9umrEGW+945gQTrZyjoocb84rZ2HbBOErYPJ9kqVxKmASqKpQ6GOM9YCqk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:c3b92665-94ba-464d-980a-cd86abfdfaae,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9,CLOUDID:113d55c3-1e57-4345-9d31-31ad9818b39f,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 7c618948591b11eea33bb35ae8d461a2-20230922 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2015948652; Fri, 22 Sep 2023 15:41:48 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Sep 2023 15:41:46 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 22 Sep 2023 15:41:46 +0800 From: Moudy Ho To: Mauro Carvalho Chehab , Matthias Brugger , AngeloGioacchino Del Regno , Ping-Hsun Wu , daoyuan huang , "Hans Verkuil" CC: , , , , Moudy Ho Subject: [PATCH v6 03/13] media: platform: mtk-mdp3: introduce more pipelines from MT8195 Date: Fri, 22 Sep 2023 15:41:35 +0800 Message-ID: <20230922074145.11977-4-moudy.ho@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230922074145.11977-1-moudy.ho@mediatek.com> References: <20230922074145.11977-1-moudy.ho@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--8.967800-8.000000 X-TMASE-MatchedRID: 9tznvLHRcTzPl7LciQedTgPZZctd3P4BK2i9pofGVSsKogmGusPLb8FQ 0J8JC8zgOfAiJ/eonC1mJS6k736MTIT3OBUyTeledXz3l78F3YlYN1akkye0qPt592eq2xoTVSd AA6mVeIZQRjVnEuqiiK8okvFnr1sb/02XRYC/8eue7UdJp0QINZYcYQ11P5U/nugLWtXP+42jxY yRBa/qJcFwgTvxipFajoczmuoPCq2mjeknu5ZelL26gakg7YHATWKONmqtUIAYr4fIZs5K4agcK fse3Z/uQwymtxuJ6y0= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--8.967800-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: B13C1F89118CDB16CE32EF9188AE19E9FA54C5ACA3032A24BAD78008935151C72000:8 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 22 Sep 2023 00:42:25 -0700 (PDT) Increasing the number of sets built by MMSYS and MUTEX in MT8195 will enable the creation of more pipelines in MDP3. Signed-off-by: Moudy Ho --- .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 80 ++++++++++++------- .../platform/mediatek/mdp3/mtk-mdp3-core.h | 7 ++ 2 files changed, 60 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index 5dc62c47f8a3..370f840ec593 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -50,6 +50,43 @@ static struct mtk_mutex *__get_mutex(const struct mdp_dev *mdp_dev, return mdp_dev->mm_subsys[p->sub_id].mdp_mutex[p->mutex_id]; } +static enum mdp_pipe_id __get_pipe(const struct mdp_dev *mdp_dev, + enum mtk_mdp_comp_id id) +{ + enum mdp_pipe_id pipe_id; + + switch (id) { + case MDP_COMP_RDMA0: + pipe_id = MDP_PIPE_RDMA0; + break; + case MDP_COMP_ISP_IMGI: + pipe_id = MDP_PIPE_IMGI; + break; + case MDP_COMP_WPEI: + pipe_id = MDP_PIPE_WPEI; + break; + case MDP_COMP_WPEI2: + pipe_id = MDP_PIPE_WPEI2; + break; + case MDP_COMP_RDMA1: + pipe_id = MDP_PIPE_RDMA1; + break; + case MDP_COMP_RDMA2: + pipe_id = MDP_PIPE_RDMA2; + break; + case MDP_COMP_RDMA3: + pipe_id = MDP_PIPE_RDMA3; + break; + default: + /* Avoid exceptions when operating MUTEX */ + pipe_id = MDP_PIPE_RDMA0; + dev_err(&mdp_dev->pdev->dev, "Unknown pipeline id %d", id); + break; + } + + return pipe_id; +} + static int mdp_path_subfrm_require(const struct mdp_path *path, struct mdp_cmdq_cmd *cmd, struct mdp_pipe_info *p, u32 count) @@ -57,7 +94,6 @@ static int mdp_path_subfrm_require(const struct mdp_path *path, const int p_id = path->mdp_dev->mdp_data->mdp_plat_id; const struct mdp_comp_ctx *ctx; const struct mtk_mdp_driver_data *data = path->mdp_dev->mdp_data; - struct device *dev = &path->mdp_dev->pdev->dev; struct mtk_mutex *mutex; int id, index; u32 num_comp = 0; @@ -66,23 +102,7 @@ static int mdp_path_subfrm_require(const struct mdp_path *path, num_comp = CFG_GET(MT8183, path->config, num_components); /* Decide which mutex to use based on the current pipeline */ - switch (path->comps[0].comp->public_id) { - case MDP_COMP_RDMA0: - index = MDP_PIPE_RDMA0; - break; - case MDP_COMP_ISP_IMGI: - index = MDP_PIPE_IMGI; - break; - case MDP_COMP_WPEI: - index = MDP_PIPE_WPEI; - break; - case MDP_COMP_WPEI2: - index = MDP_PIPE_WPEI2; - break; - default: - dev_err(dev, "Unknown pipeline and no mutex is assigned"); - return -EINVAL; - } + index = __get_pipe(path->mdp_dev, path->comps[0].comp->public_id); memcpy(p, &data->pipe_info[index], sizeof(struct mdp_pipe_info)); mutex = __get_mutex(path->mdp_dev, p); @@ -336,11 +356,13 @@ static void mdp_auto_release_work(struct work_struct *work) struct mdp_cmdq_cmd *cmd; struct mdp_dev *mdp; struct mtk_mutex *mutex; + enum mdp_pipe_id pipe_id; cmd = container_of(work, struct mdp_cmdq_cmd, auto_release_work); mdp = cmd->mdp; - mutex = __get_mutex(mdp, &mdp->mdp_data->pipe_info[MDP_PIPE_RDMA0]); + pipe_id = __get_pipe(mdp, cmd->comps[0].public_id); + mutex = __get_mutex(mdp, &mdp->mdp_data->pipe_info[pipe_id]); mtk_mutex_unprepare(mutex); mdp_comp_clocks_off(&mdp->pdev->dev, cmd->comps, cmd->num_comps); @@ -361,6 +383,7 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg) struct cmdq_cb_data *data; struct mdp_dev *mdp; struct device *dev; + enum mdp_pipe_id pipe_id; if (!mssg) { pr_info("%s:no callback data\n", __func__); @@ -388,7 +411,8 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg) struct mtk_mutex *mutex; dev_err(dev, "%s:queue_work fail!\n", __func__); - mutex = __get_mutex(mdp, &mdp->mdp_data->pipe_info[MDP_PIPE_RDMA0]); + pipe_id = __get_pipe(mdp, cmd->comps[0].public_id); + mutex = __get_mutex(mdp, &mdp->mdp_data->pipe_info[pipe_id]); mtk_mutex_unprepare(mutex); mdp_comp_clocks_off(&mdp->pdev->dev, cmd->comps, cmd->num_comps); @@ -412,6 +436,7 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) struct device *dev = &mdp->pdev->dev; const int p_id = mdp->mdp_data->mdp_plat_id; struct mtk_mutex *mutex = NULL; + enum mdp_pipe_id pipe_id; int i, ret; u32 num_comp = 0; @@ -449,13 +474,6 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) goto err_free_comps; } - mutex = __get_mutex(mdp, &mdp->mdp_data->pipe_info[MDP_PIPE_RDMA0]); - ret = mtk_mutex_prepare(mutex); - if (ret) { - dev_err(dev, "Fail to enable mutex clk\n"); - goto err_free_path; - } - path->mdp_dev = mdp; path->config = param->config; path->param = param->param; @@ -475,6 +493,14 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) goto err_free_path; } + pipe_id = __get_pipe(mdp, path->comps[0].comp->public_id); + mutex = __get_mutex(mdp, &mdp->mdp_data->pipe_info[pipe_id]); + ret = mtk_mutex_prepare(mutex); + if (ret) { + dev_err(dev, "Fail to enable mutex clk\n"); + goto err_free_path; + } + ret = mdp_path_config(mdp, cmd, path); if (ret) { dev_err(dev, "mdp_path_config error\n"); diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h index fde2c0b95def..ece6509666fd 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h @@ -59,6 +59,13 @@ enum mdp_pipe_id { MDP_PIPE_WPEI2, MDP_PIPE_IMGI, MDP_PIPE_RDMA0, + MDP_PIPE_RDMA1, + MDP_PIPE_RDMA2, + MDP_PIPE_RDMA3, + MDP_PIPE_SPLIT, + MDP_PIPE_SPLIT2, + MDP_PIPE_VPP0_SOUT, + MDP_PIPE_VPP1_SOUT, MDP_PIPE_MAX }; -- 2.18.0