From patchwork Mon Apr 12 12:45:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9B6FC43603 for ; Mon, 12 Apr 2021 12:46:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A4F361350 for ; Mon, 12 Apr 2021 12:46:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A4F361350 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HQw2KKfx7mQkABTBCelOYuDWwjUmq1ZTJt5Xc7M3eIM=; b=KMk955Jcu+BrEWdMfeiUWBbb9 rmDS/YLFwbZ+Gu81Hrt3l7B4vqFnzgu1kIFPOcIFoVhPugK45mVtEpDRn3gDmfGnoVWRnqbE96pd7 0mctaQu3KVIg82p5DVXPPOB7QypVstPw3npMF4zaE/Q6XNkKCfN1b8CYkvmNX3zUiABLZZ7Jp4Jh+ SYRA/R+RcH+TklEr4vSwJOyjERlHCFJTBqdBI/4tN7Fkl1qGxyndlTdI9004FjGfNXqi4IcZWiUHd 5mQ9yX2EEMcI2ozYv79PbFYp+J54DKRf2ugOPogMgj7qNE3uGuaI/UTGcBeT5bAfQrA3TCGrqvy/x zvd3ww3Kw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxF-006jVj-J0; Mon, 12 Apr 2021 12:46:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxD-006jUt-C9; Mon, 12 Apr 2021 12:46:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Sa9Q96t18yBT/AJIm+DoU/yHlnH+BC5fArmV0BzNcZw=; b=IWgoDPMpRiQziyyDBeO0dMncC7 ATyR1AOKTs0AiIv2lIFanzBjkCGb3T1obv1lzrkjtYpZHWwCBJ1O5ZWmW7MDrqgktWpM4gbAd1Emh pGQejqhOqB9/LaAzPRsy9xGcse7hQZESM9HFt36w6dLyoYGd+78Bit/l7I9Ik509uOGiE/LwoL3oR UFLptxv+2DfS8WyhNEe8rKe1vh6sYNYG+OILcDKxBz2uf2mJ3sa/RqnQK3ZDUithgmGZoYWGDaLkc uFRPrTRdJ6nAhSxQfZ5GfYvSgNeySwZB3V+5GYISv4QiUNDn3xl3TfvT6JK0u3eUZdY5gJnOjNnp4 pkvIggvA==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxA-006EOV-SQ; Mon, 12 Apr 2021 12:46:10 +0000 X-UUID: 2f0dcd809797422eb5405ae5a7778246-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Sa9Q96t18yBT/AJIm+DoU/yHlnH+BC5fArmV0BzNcZw=; b=b2Oa7xR/5V8WnIhjd9JyWqOz4PBtZC/W46nKATJGqJuiOOo6YbQLwiu0vHJ3wh9vSClOZnaoIHXZ8pyxMS7A3tqIzY+fBaIHQa2sz+Ui/G/SxHp7pacBgR+yTeiIz/LRMOw+9w54pPTIxOp/84z/xObTjLOz1P5XaZK41UiWuNo=; X-UUID: 2f0dcd809797422eb5405ae5a7778246-20210412 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1842161867; Mon, 12 Apr 2021 05:46:08 -0700 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:05 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:04 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:02 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3,1/6] media: mtk-vcodec: venc: remove redundant code Date: Mon, 12 Apr 2021 20:45:50 +0800 Message-ID: <20210412124555.26897-2-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_054608_946108_AD474C4D X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Alexandre Courbot vidioc_try_fmt() does clamp height and width when called on the OUTPUT queue, so clamping them prior to calling this function is redundant. Set the queue's parameters after calling vidioc_try_fmt() so we can use the values it computed. Signed-off-by: Alexandre Courbot --- .../media/platform/mtk-vcodec/mtk_vcodec_enc.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 4831052f475d..42ff13867940 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -443,7 +443,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, struct mtk_q_data *q_data; int ret, i; const struct mtk_video_fmt *fmt; - struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { @@ -468,20 +467,13 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, f->fmt.pix.pixelformat = fmt->fourcc; } - pix_fmt_mp->height = clamp(pix_fmt_mp->height, - MTK_VENC_MIN_H, - MTK_VENC_MAX_H); - pix_fmt_mp->width = clamp(pix_fmt_mp->width, - MTK_VENC_MIN_W, - MTK_VENC_MAX_W); - - q_data->visible_width = f->fmt.pix_mp.width; - q_data->visible_height = f->fmt.pix_mp.height; - q_data->fmt = fmt; - ret = vidioc_try_fmt(f, q_data->fmt); + ret = vidioc_try_fmt(f, fmt); if (ret) return ret; + q_data->fmt = fmt; + q_data->visible_width = f->fmt.pix_mp.width; + q_data->visible_height = f->fmt.pix_mp.height; q_data->coded_width = f->fmt.pix_mp.width; q_data->coded_height = f->fmt.pix_mp.height; From patchwork Mon Apr 12 12:45:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D783C433ED for ; Mon, 12 Apr 2021 12:46:59 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1A1F61246 for ; Mon, 12 Apr 2021 12:46:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1A1F61246 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UQgAln9ogHjIEjRC/PxEsC4MC8Zd5jTlvy7WY4vwiYs=; b=D1KABKVEv6sfEVzBNSXOK/1gV e49XcI75sP8vYzeSraGKcrF2aCYP3Xnw6CoyR4DSAE9f5CeDRAN48b3UclruNC3zTvyy8xM+gDGZo Jsbz9zHP82SGS+6JY2rZoRazpFh8FHCo+0eHyE/FnGJnNOKvnbxDgpHR0DdRk+SOCeqQuXyPSRhaK zZHPnTvWCtREI8U5PBdTJX/Cy7H5nnvWWh0xaNaEVe1RyeenyBsqjSKOsU+zBVeOn6EiVta05E2qS l02xUt0fy7WxtiTkHd6xlldViKGQiY8bHso/hlQALRPsC8qKVDFnriSj5RAYbgtAySuPy1J+e8BR4 ttDvbtszw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxm-006jcs-Fy; Mon, 12 Apr 2021 12:46:46 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxK-006jWv-Ns; Mon, 12 Apr 2021 12:46:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=VShok5BxHIlhvQvjNhCFWkNkkqN0A/06I08Capmau5A=; b=rtfRPs8lblUZcSsNkN2KiESAw2 +FGXTm5fjYaGej3DBaogH1VhAarG02EIItZbTE14DaXWoc18cfgVDQOTfuBZ/AbsOyCKS25uYI/ti ZRCJBFXoXxm2/XQRtbByeRr6GMJ/fb7AGypi2fPeA5dOsI1c6Knhv/TBTNUF2Hz5I1lapa7G2iSDc zeSXCcHuX0YULk4jRSCkbYyte7R/OjBQA+r6f8ILjqSHrxojgtrvE0ceUIfw6fWnUzw1YoF7ojUpY xkiX653y3kPTuKE6Exp9W7VizDe570L+ctVW9TaAvWKxLJyY3nBz6CLVfcXdwpGOtcqY4ykA3E3nf DRUyoBGA==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxI-006EPn-8S; Mon, 12 Apr 2021 12:46:17 +0000 X-UUID: 93bb49c48fc446f9bd738971de0c5272-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=VShok5BxHIlhvQvjNhCFWkNkkqN0A/06I08Capmau5A=; b=nxdidZM5RHY+iraQBo1QH/Vx1MSRGb2xIc1gsWvb6j76NKR0ry/aFpT2ncGJfEgdUkj3X9ziiy6FUaofyo9Ox2/Wei2y4ZzpFNYgyuY1z8+D8j8bZ6deB23eodezJpMzmBij50HOSjFMRtg5vti0Bl5h8oXdkMIlPQl9NzZmqDI=; X-UUID: 93bb49c48fc446f9bd738971de0c5272-20210412 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 699021756; Mon, 12 Apr 2021 05:46:12 -0700 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:11 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:09 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:07 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3, 2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property Date: Mon, 12 Apr 2021 20:45:51 +0800 Message-ID: <20210412124555.26897-3-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 7A245EEF486F4D984B2C3822463F9071D1DE909E28870D326F70B646EA8206E62000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_054616_320460_49F9A047 X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The mt8192 iommu support 0~16GB iova. We separate it to four banks: 0~4G; 4G~8G; 8G~12G; 12G~16G. The "dma-ranges" could be used to adjust the bank we locate. If we don't set this property. The default range always is 0~4G. Here we don't have actual bus/parent concept here. And the iova requirement is for our HW. Thus put the property in our node. Signed-off-by: Irui Wang --- Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt index 06db6837cefd..b7801e3c354a 100644 --- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt +++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt @@ -22,6 +22,8 @@ Required properties: - iommus : should point to the respective IOMMU block with master port as argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details. +- dma-ranges : describes how the physical address space of the IOMMU maps + to memory. One of the two following nodes: - mediatek,vpu : the node of the video processor unit, if using VPU. - mediatek,scp : the node of the SCP unit, if using SCP. From patchwork Mon Apr 12 12:45:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01FD3C43460 for ; Mon, 12 Apr 2021 12:52:23 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DF9761263 for ; Mon, 12 Apr 2021 12:52:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DF9761263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iR4gP3q8Oki2uanlOGGLdqYXhGC+Vc10NZbe04ouT+0=; b=OugjbzM10Yic3HXvJtWC1rRqb b3eLZD9h2IsPn9oOeLdsf3X2Rr8BbHx3QVXOz6/256pcbvRRXw0kc9FMuCOLVzl2M57IUz//OEeg4 L5JKqp1dxNmwYG9wYeonw2kNCYwkSLnuu8X9gjRz4AXSe01JRqKWZj6nWUf+jwUr2Ou5qC0yOOR4m 2VCP4PVS3aBWpgcYWNj6IXmHEKCTYqkKRBt1iFYIYz3egNhVb22xMq8UG2Dd2zdp5tW0n353JUtPz VCchfe6BouW3UxjpIcH/I7c8BrkLYiChHd2XDhr9L8OD6bHqdVxhkjmkbp5CC6Hm9d5MiIc7WRu53 1yEin9x/A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVw30-006l00-8c; Mon, 12 Apr 2021 12:52:10 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVw2u-006kyg-Ps; Mon, 12 Apr 2021 12:52:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=UdCfHuhcVQAmaNgdUEBKEwjL2Qzc+m4XCY/pLvDImmI=; b=OhQ7qaCfyDGoZsvRauiyEAmdqy w6hUgj0NyP4jWPCBm4fRQk1HrrFI5rI3fpXN9QWbP3cqp/YGMIHqbN6vYystF22rYgkcbVJtxgwqK j7jgqyGIYsE7shQ20lE5OnE5swpwvBU30YmJrBLKCGxgy4b890xGcSBBeo5+Jrb0zdZo8dtiNh7mT QuwBA8cQvboFps+tp0hxlN6WRrm2VqQusejNqCfCUq6kXVSeJHTF2q6vI0UGE8I4r6ykVOsK77hfy AC9KzvWD/INWyjxITsZqt6WJI8aCDGjoszElNci3HZO9Rb5r/f1f6XYtHVGkt8o1JfWbJxjhGry6k hNwBZSTw==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVw2o-006ElJ-3e; Mon, 12 Apr 2021 12:52:03 +0000 X-UUID: 2e6862ba3fc84fe9a466e9d3396822b6-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=UdCfHuhcVQAmaNgdUEBKEwjL2Qzc+m4XCY/pLvDImmI=; b=WyTN4dFUkzKrPbg8WkmbDcyZjq+e4tKTn9e8dTA95W3x9G9ehd5oW7bM/gqxvWM5GTDKFQNGeZRZB6sCes49lOd+sjv/IgIAjA6VrYlPSbFOVXD2nxnYmw23t658AwfLqwWGUp1YvRsajMnT6dW7mLd8z8gBRsJZYzJ+mw8W+mU=; X-UUID: 2e6862ba3fc84fe9a466e9d3396822b6-20210412 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 234941160; Mon, 12 Apr 2021 05:51:56 -0700 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:13 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:11 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:10 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3, 3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc Date: Mon, 12 Apr 2021 20:45:52 +0800 Message-ID: <20210412124555.26897-4-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_055158_182288_329964F6 X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use the dma_set_mask_and_coherent helper to set venc DMA bit mask to support 4GB~8GB range iova space. Signed-off-by: Irui Wang --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 7d7b8cfc2cc5..26b089e81213 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -361,6 +361,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_event_workq; } + if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); + ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, 1); if (ret) { mtk_v4l2_err("Failed to register video device"); From patchwork Mon Apr 12 12:45:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E86C433B4 for ; Mon, 12 Apr 2021 12:52:22 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7FA7761261 for ; Mon, 12 Apr 2021 12:52:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FA7761261 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rqVcBgGL++UlP1lK/QgXC3zTBYyDVfhnpLbWBfwFDLY=; b=I0bIA8TZFGleBAOmJZlFf47Qm Pr5Qy3m9QHTWaSss1QDVKSXhC8KelhFH+/c1rGTjc6+7UYeFbd1+yjd0Fy5KhslC7Ym886frr8wLg /Gixyspzlg3fAJMSSsq+AcQCmcTvD2IIQ2ydTTABogF1fil+hwtdm5GdgHixXotdCPqlDWXQam4Ze 2ItK6FL4yqTNnUaGLcrn4LJJ98Qju7mkOYxFEoJKDOv5/B62paEAKAYqtQOQtK1tKfCltaojKvl7q V3yWM10sTUh6BwmtEB91a+rqehO8UEWDkwj12K1SypKOdDDwShsaUKIchBJuuf3R44n3rrPQ1BWkX lZ903pCow==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVw31-006l0Q-Vr; Mon, 12 Apr 2021 12:52:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVw2v-006kyq-Fl; Mon, 12 Apr 2021 12:52:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=YErKguPWkwlLTdBHCTZ7ag8buCoj/iPP6f2aGd9bYbA=; b=bCXzso1Crw4VrtzJsVWi5/7rf0 caKTHjjlnnW1Ne986WiJACiUSDVP+jZFMdHxQAy4CG8CC2YS/G4s++vsEQZSRFwye3Z0ZtVKWFhAA RiXa4ldySzLEAtexQSa1mwaXmipWNfzOAy1cNAjBDcnFIx5g41zGfwgmkgolQ2a1nc1w0WffhsghC t/YnJj6qMmU2YLyBiX8QnvYp4zfWiZtDVgFzByuDmJEwObZEtVdZJS0NrMNkeo3IF2ShfYHI1MBAL 56oEvvi/dJlwchrjym3eUWU0M+qUK1ymK9gl6+6DzygN4vqdMq7yQ1SmHcq+fo1mMoeo8Adjy0mFh NO9CH9Pw==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVw2t-006ElJ-29; Mon, 12 Apr 2021 12:52:04 +0000 X-UUID: 0619a668fa1845a1802d5fc950fd8471-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=YErKguPWkwlLTdBHCTZ7ag8buCoj/iPP6f2aGd9bYbA=; b=t2F4HddO7dbvePFyQqWfYe4hEAQqspOV63A2zDlkFPxjNKQMrGVaBUuQFCi8IBRugSxBR7Ot9cSbZ5EcFjezMCZyt4Q4uqHrszOGO29FOrrjnEmMorjFe16khyOd+se/WSvYnF7X+0zM0ZwNHzWW9BIJZzscWhP/zhisEy7teIM=; X-UUID: 0619a668fa1845a1802d5fc950fd8471-20210412 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1647884264; Mon, 12 Apr 2021 05:51:56 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:15 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:14 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:13 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3, 4/6] dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC Date: Mon, 12 Apr 2021 20:45:53 +0800 Message-ID: <20210412124555.26897-5-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_055203_139835_27FC56ED X-CRM114-Status: GOOD ( 11.19 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Updates binding document for mt8192 encoder driver. Acked-by: Rob Herring Signed-off-by: Irui Wang --- Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt index b7801e3c354a..4171f8761322 100644 --- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt +++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt @@ -9,6 +9,7 @@ Required properties: "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder. "mediatek,mt8183-vcodec-enc" for MT8183 encoder. "mediatek,mt8173-vcodec-dec" for MT8173 decoder. + "mediatek,mt8192-vcodec-enc" for MT8192 encoder. - reg : Physical base address of the video codec registers and length of memory mapped region. - interrupts : interrupt number to the cpu. From patchwork Mon Apr 12 12:45:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 869E3C433B4 for ; Mon, 12 Apr 2021 12:47:09 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BC9061263 for ; Mon, 12 Apr 2021 12:47:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BC9061263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=emUzdOwTmvZtGwTzGva5IJ8Vp/zfVW3+lJ3peGAxHag=; b=KLdAVYzjuslRmwHw+60Y6XRhp SMxf387SBN8e1pKp8pISURBUO+ip5dWHymf4oTpPV+sL5PDtHN7GrBtcEMwxrea8qdt1ZBIXytvSc Jrph45ns4g/SVfQyT79BWLjqsqUE+Ni6d+s5qYcbbBoUWOkdQGwmr/HV8VYj9OM/xBrbXDze74ed0 EGus2cVGNHAqqaxT2Sayaze/Mps5uYOsncEGaJyB512xZtlPmmjvWRMiOj0N0OMwbWgXRAv43eLy7 /852UdmSO8SQm7RQqhpejOnJIulosCGNcWXd1vhh7qjJhU4mkSgh5z3kihT36tctyN0EJhgpLhBjU ca9gmxGxQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvy0-006jhV-Ue; Mon, 12 Apr 2021 12:47:01 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxQ-006jY9-Do; Mon, 12 Apr 2021 12:46:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=qQl7aNwhh8W5u6difRmmqhbsYrTgp/wm2M/74UxB/go=; b=f1ly6dCZyHqOp4+GtnbXIY6hV6 A6Ij3uOuTbVlASurfsfe+Fk52t1gUgO+LchKCl1h4RBbSeFk3S+xrHWHqLUkDP90nslpDkYsKXWi1 HUAj4lWRlgefwp0H78uYilS4Htf6C/bbooTSqpkHT9g9wmB9aBcRykNyleJYhKgGKqNoOWDAIoIpX vT7QClCgqMcEUx6PSqYotUb8P4TeMeBlpgA4ZCQaVBdBFtyXGLryiJrW9K9c3IOxWTc3OxMyS+W01 TLqsq+yL6MW5v81D5r8F4t3Yhd+EgUX67+5gfwxz+5po7Rvhm4d/ngyLyIxkJCGNyAaufLRTDu18A EVFnnuLw==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxN-006ERP-Sm; Mon, 12 Apr 2021 12:46:23 +0000 X-UUID: 58ac2d5cfad446d1acece20865b26753-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=qQl7aNwhh8W5u6difRmmqhbsYrTgp/wm2M/74UxB/go=; b=CZog9xwWMdLCcbVgfoH9jAUN9dijEpxmnr7uulB/RdYoploA5llKdUwXsVXDpzA1DWCRHZ+KEIV0o4U1ci6FLTZmuy47OSV1y/0fcqJNH4CQcLcYONlR/z/UyprEuC6CW/ISEAVzs36UtriDd2PGNhGyU57CTIKJLRSuFnXuZOI=; X-UUID: 58ac2d5cfad446d1acece20865b26753-20210412 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2007333088; Mon, 12 Apr 2021 05:46:19 -0700 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:18 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:16 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:15 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver Date: Mon, 12 Apr 2021 20:45:54 +0800 Message-ID: <20210412124555.26897-6-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_054621_953414_2FE355D6 X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add MT8192 venc driver's compatible and device private data. Signed-off-by: Irui Wang --- drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 1 + .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index d03cca95e99b..14893d277bb8 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx { enum mtk_chip { MTK_MT8173, MTK_MT8183, + MTK_MT8192, }; /** diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 26b089e81213..78f3dd166917 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = { .core_id = VENC_SYS, }; +static const struct mtk_vcodec_enc_pdata mt8192_pdata = { + .chip = MTK_MT8192, + .uses_ext = true, + /* MT8192 supports the same capture formats as MT8183*/ + .capture_formats = mtk_video_formats_capture_mt8183, + .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183), + /* MT8192 supports the same output formats as MT8173 */ + .output_formats = mtk_video_formats_output_mt8173, + .num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173), + .min_bitrate = 64, + .max_bitrate = 100000000, + .core_id = VENC_SYS, +}; static const struct of_device_id mtk_vcodec_enc_match[] = { {.compatible = "mediatek,mt8173-vcodec-enc", .data = &mt8173_avc_pdata}, {.compatible = "mediatek,mt8173-vcodec-enc-vp8", .data = &mt8173_vp8_pdata}, {.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata}, + {.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata}, {}, }; MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match); From patchwork Mon Apr 12 12:45:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A20EC433ED for ; Mon, 12 Apr 2021 12:47:27 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE7FE6109F for ; Mon, 12 Apr 2021 12:47:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE7FE6109F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n6DDv1Y3hBpQYN4abO5PWwkUJeCUSS+BJ3lSfFJ+BdM=; b=Rw5qI/lPBpvEO5E/aqDjJOxhu Gz8fYmvcLgzNddwNy0SLo6M62yDBefVPrg0ZhnE/zV9mow/02lIBmIYXue5hPPg1gX6SvBEuMkc/g 0Xj5T1aHwdHbGd44Qywwew9kuL+AxmMu+OZbWtUDHoEuxvGdVdYHifxjkjKjGOArgpyAs11oDjeN1 B3W9uwL3e5iUE99dOmbayMo5llE6Oa/AkDVVtvFeiZcE3ELNG68mvK9UjStPdak/WcUafYWIgP6Zw cppqFBWFbEWHpRtWVWCxhfSM9c1Y4uc7y+CP0zB8n/+d+dCo47glYdjysfuaHR9Ri3+SxQR9QUccE QgJhJZJ6Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvyI-006jn6-N9; Mon, 12 Apr 2021 12:47:18 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxU-006jZE-PP; Mon, 12 Apr 2021 12:46:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=GKB1Y30n/5Dh6tP5rg9zdm5RA/FlZOf7VuVIgnAzGfE=; b=i1x93/DspDJK1JwjLZnNBgnYTb PVjdJqFtNPfR6eRD33Rr+//8iZrngteIs5Q96j4C5NxG0qPBRSXiSJyCLe3OWFQlIecDwb+sA75Nm U13MyBNK1GmGRFU5F8hA+2xcv/D+UJtNwfakSlnqUrcsxT1BYWi5y7zrL6jxoqDahbZPUnpPL5Nmz xPz2/Cm5DcaPKm5NdPleEBwH0ZlwHIN/GtNDC77gJjqaSfJ8kXWbR4SIZcOPPhuxAhgJzq0eeNyVU MKNKaGrzWA6U0ncSHU8XoV1uTapoY61/M8V2RCYhYpJCQHaNPv8EW+o9SiLZS6Of+DzT/CULox0hm lvtlUNjQ==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxR-006ET2-Sq; Mon, 12 Apr 2021 12:46:27 +0000 X-UUID: 7a1fcb9715f8439eaf4a5a642adaaa94-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=GKB1Y30n/5Dh6tP5rg9zdm5RA/FlZOf7VuVIgnAzGfE=; b=huCz25ilriHioGHA9mMuDc7MyEevNKQdEUpzl3dQWe+ZoaAzyDdlsU/ptl2q7oMqZqjmnLtwG2kdOk52XLM+z/DEaJYw2DRsik7TZg3HvFIgGhjnrAHYX3J9hYJXSG+c27/05GWvv63jsGyRo+EbJhBRqGbveE6tJ0wZxhTXcwk=; X-UUID: 7a1fcb9715f8439eaf4a5a642adaaa94-20210412 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 735055619; Mon, 12 Apr 2021 05:46:23 -0700 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:20 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:18 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:17 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding Date: Mon, 12 Apr 2021 20:45:55 +0800 Message-ID: <20210412124555.26897-7-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_054625_962450_056AEB21 X-CRM114-Status: GOOD ( 19.80 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding, add related path according to enc_capability. Signed-off-by: Irui Wang --- .../platform/mtk-vcodec/mtk_vcodec_enc.c | 75 ++++++++++++------- .../platform/mtk-vcodec/venc/venc_h264_if.c | 4 + 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 42ff13867940..7396a5050b45 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -19,23 +19,32 @@ #define MTK_VENC_MIN_W 160U #define MTK_VENC_MIN_H 128U -#define MTK_VENC_MAX_W 1920U -#define MTK_VENC_MAX_H 1088U +#define MTK_VENC_HD_MAX_W 1920U +#define MTK_VENC_HD_MAX_H 1088U +#define MTK_VENC_4K_MAX_W 3840U +#define MTK_VENC_4K_MAX_H 2176U + #define DFT_CFG_WIDTH MTK_VENC_MIN_W #define DFT_CFG_HEIGHT MTK_VENC_MIN_H #define MTK_MAX_CTRLS_HINT 20 #define MTK_DEFAULT_FRAMERATE_NUM 1001 #define MTK_DEFAULT_FRAMERATE_DENOM 30000 +#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0) static void mtk_venc_worker(struct work_struct *work); -static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = { - MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16, - MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16, +static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = { + MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16, + MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16, +}; + +static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = { + MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16, + MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16, }; -#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes) +#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes) static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl) { @@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh, struct v4l2_frmsizeenum *fsize) { const struct mtk_video_fmt *fmt; + struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh); if (fsize->index != 0) return -EINVAL; fmt = mtk_venc_find_format(fsize->pixel_format, - fh_to_ctx(fh)->dev->venc_pdata); + ctx->dev->venc_pdata); if (!fmt) return -EINVAL; fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; - fsize->stepwise = mtk_venc_framesizes; + fsize->stepwise = + (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ? + mtk_venc_4k_framesizes : mtk_venc_hd_framesizes; return 0; } @@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx, /* V4L2 specification suggests the driver corrects the format struct if any of * the dimensions is unsupported */ -static int vidioc_try_fmt(struct v4l2_format *f, +static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f, const struct mtk_video_fmt *fmt) { struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; @@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f, pix_fmt_mp->plane_fmt[0].bytesperline = 0; } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { int tmp_w, tmp_h; + unsigned int max_width, max_height; + + if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) { + max_width = MTK_VENC_4K_MAX_W; + max_height = MTK_VENC_4K_MAX_H; + } else { + max_width = MTK_VENC_HD_MAX_W; + max_height = MTK_VENC_HD_MAX_H; + } pix_fmt_mp->height = clamp(pix_fmt_mp->height, MTK_VENC_MIN_H, - MTK_VENC_MAX_H); + max_height); pix_fmt_mp->width = clamp(pix_fmt_mp->width, MTK_VENC_MIN_W, - MTK_VENC_MAX_W); + max_width); /* find next closer width align 16, heign align 32, size align * 64 rectangle @@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f, tmp_h = pix_fmt_mp->height; v4l_bound_align_image(&pix_fmt_mp->width, MTK_VENC_MIN_W, - MTK_VENC_MAX_W, 4, + max_width, 4, &pix_fmt_mp->height, MTK_VENC_MIN_H, - MTK_VENC_MAX_H, 5, 6); + max_height, 5, 6); if (pix_fmt_mp->width < tmp_w && - (pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W) + (pix_fmt_mp->width + 16) <= max_width) pix_fmt_mp->width += 16; if (pix_fmt_mp->height < tmp_h && - (pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H) + (pix_fmt_mp->height + 32) <= max_height) pix_fmt_mp->height += 32; mtk_v4l2_debug(0, @@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv, } q_data->fmt = fmt; - ret = vidioc_try_fmt(f, q_data->fmt); + ret = vidioc_try_fmt(ctx, f, q_data->fmt); if (ret) return ret; @@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, f->fmt.pix.pixelformat = fmt->fourcc; } - ret = vidioc_try_fmt(f, fmt); + ret = vidioc_try_fmt(ctx, f, fmt); if (ret) return ret; @@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv, f->fmt.pix_mp.quantization = ctx->quantization; f->fmt.pix_mp.xfer_func = ctx->xfer_func; - return vidioc_try_fmt(f, fmt); + return vidioc_try_fmt(ctx, f, fmt); } static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, @@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT; } - return vidioc_try_fmt(f, fmt); + return vidioc_try_fmt(ctx, f, fmt); } static int vidioc_venc_g_selection(struct file *file, void *priv, @@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx) v4l_bound_align_image(&q_data->coded_width, MTK_VENC_MIN_W, - MTK_VENC_MAX_W, 4, + MTK_VENC_HD_MAX_W, 4, &q_data->coded_height, MTK_VENC_MIN_H, - MTK_VENC_MAX_H, 5, 6); + MTK_VENC_HD_MAX_H, 5, 6); if (q_data->coded_width < DFT_CFG_WIDTH && - (q_data->coded_width + 16) <= MTK_VENC_MAX_W) + (q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W) q_data->coded_width += 16; if (q_data->coded_height < DFT_CFG_HEIGHT && - (q_data->coded_height + 32) <= MTK_VENC_MAX_H) + (q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H) q_data->coded_height += 32; q_data->sizeimage[0] = @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) { const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops; struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl; + const u8 h264_max_level = + (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ? + V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2; v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT); @@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, 0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH); v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL, - V4L2_MPEG_VIDEO_H264_LEVEL_4_2, - 0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0); + h264_max_level, + 0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0); + if (handler->error) { mtk_v4l2_err("Init control handler fail %d", handler->error); diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c index d0123dfc5f93..b6a4f2074fa5 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c @@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst, return 41; case V4L2_MPEG_VIDEO_H264_LEVEL_4_2: return 42; + case V4L2_MPEG_VIDEO_H264_LEVEL_5_0: + return 50; + case V4L2_MPEG_VIDEO_H264_LEVEL_5_1: + return 51; default: mtk_vcodec_debug(inst, "unsupported level %d", level); return 31;