From patchwork Tue Jul 4 11:13:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13301007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89B66EB64D9 for ; Tue, 4 Jul 2023 11:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=ylRn94RRv9Ac2XN+XUPPfKl5Fq5/4mTwR1R1Zs4JpO8=; b=g5OXFvtXZpfpCm 5bkfU2RvYkCFj1kDbViTyP6oYJlxRMJJiS2ewNpg3T+fLWUHmrdYjPCglvo4mnYuT33obeidEo/YI DwkSQqGmzbpfl1EDnDYwLivG3jx+/vT4QVj89UdZA9KrLwODr9jqhy8iToN7AJI2mR1iO60Ilq5x+ 5HHJHPiK0hlauVh8UAlG1kRLDhIo0H9f2XLIxbF7Orax5yiGEVmt/Tl1Rsxl3a6XwvZ9OZMllZgtx zWzKbTOYCk6nE7PHcI9nHGu3z+PP/qbJyLpO6tmS96JhKiymCGug7xt7AOj0YLUE9sr4Sy8n4kvYg hdePMT/YlRdDyfLs14nA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGe8C-00D7If-0u; Tue, 04 Jul 2023 11:23:40 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGe88-00D7HD-2c; Tue, 04 Jul 2023 11:23:38 +0000 X-UUID: 35e8e0bc1a5d11ee83ed1395ce914268-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Gg3Iz7KZKq4AQwvOFCGnpPBddjNqoKfPPS0/EGMhENI=; b=ArKbi6iCqYZRjjehxopBxyyWDQIfiNzrfXCylGfCs7RG5K86ULl8uE1Ro1nO1JlY/41oRD/USi5bIad2jw5vmp+0nUcmHZdfQIcNIydF26hI+5rs4B4yyqFJ8xvptgWI+UQ+d5eyLrVW6yTp/HJtjrvKocQVVwxjhCbIuSKGwhc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:f43c75c3-6ca4-4bbe-b975-5af47a33f469,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:01c9525,CLOUDID:b535d90d-c22b-45ab-8a43-3004e9216b56,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 35e8e0bc1a5d11ee83ed1395ce914268-20230704 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1456432403; Tue, 04 Jul 2023 04:23:33 -0700 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; Tue, 4 Jul 2023 19:13:30 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:29 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,01/11] media: mediatek: vcodec: remove unused parameter Date: Tue, 4 Jul 2023 19:13:17 +0800 Message-ID: <20230704111327.7140-2-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_042336_860930_18F00D1E X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org remove unused parameter in struct mtk_vcodec_dev. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h | 6 ------ drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 2 -- 3 files changed, 10 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index d41f2121b94f..03721eda2769 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -336,8 +336,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_core_workq; } - init_waitqueue_head(&dev->queue); - vfd_dec = video_device_alloc(); if (!vfd_dec) { mtk_v4l2_err("Failed to allocate video device"); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h index f17d67e781c9..e3230a4d7b8e 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h @@ -448,10 +448,7 @@ struct mtk_vcodec_enc_pdata { * @decode_workqueue: decode work queue * @encode_workqueue: encode work queue * - * @int_cond: used to identify interrupt condition happen - * @int_type: used to identify what kind of interrupt condition happen * @dev_mutex: video_device lock - * @queue: waitqueue for waiting for completion of device commands * * @dec_irq: decoder irq resource * @enc_irq: h264 encoder irq resource @@ -496,10 +493,7 @@ struct mtk_vcodec_dev { struct workqueue_struct *decode_workqueue; struct workqueue_struct *encode_workqueue; - int int_cond; - int int_type; struct mutex dev_mutex; - wait_queue_head_t queue; int dec_irq; int enc_irq; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index 5df0a22ff3b5..a56652e476c2 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -311,8 +311,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_res; } - init_waitqueue_head(&dev->queue); - /* allocate video device for encoder and register it */ vfd_enc = video_device_alloc(); if (!vfd_enc) { From patchwork Tue Jul 4 11:13:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13300993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09FF4C001B3 for ; Tue, 4 Jul 2023 11:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=LOv/0pJEi2tf9xUlRsKjlpDrlLiFwgQhFbZEP7iE5r4=; b=DiLIywJTbdYmf/ jSCGCqlm87Lsp18fqYjiOqI665d0qaq8Z2cPED/VzC/IUkd/NccB5Oudbroq0TR0nwh63scCTXTV8 n/nQIxDF4Y68LuGdqBnu//VVvQxxHS40+TWdIX2+mUgE2htJie9f7CUP4jAEu90uKOMinBTzf3mtu AIbFQm4Uo86WhKkcPZeuTyd2A107B46qi5oGodtHAIpYwkbIsm2BstcH1gVixCynQjgW3IDONuSoo lLOhUJ9UaR4cFGk3QQCFfwTeQ9HqR8w5hD1mivpkzHslBLoIkkxzUJN1G9isyawRi6VjwMd6wj26Y rjpZDRC8S1M9t7LlBw7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyc-00D5Oa-34; Tue, 04 Jul 2023 11:13:46 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyZ-00D5MM-14; Tue, 04 Jul 2023 11:13:44 +0000 X-UUID: d0af5f561a5b11ee912e1518a6540028-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=MDLpm+deh3FoiE7WvZgKoSPC76z1q3qJIm2/WlmWycE=; b=Sj6zwjJHonwT6TNg9a14+bImXl9pAwv1NkDATANdkwVmnSCGMzXsaMA4gW5gz496GKfnSe11Bh6OLq1le1/nVANRo0map/YqdKoHN35jfbz0ZY4YFVjeSSrGU1UmI9z2KOVMSjvisiHieLBjAvfHE5O43NNQbis0zo/GXKGEYx4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:d00972ce-a57a-486a-8dca-b022d6585ffb,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.27,REQID:d00972ce-a57a-486a-8dca-b022d6585ffb,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:01c9525,CLOUDID:96128d0d-26a8-467f-b838-f99719a9c083,B ulkID:23070419133324EEIGR0,BulkQuantity:1,Recheck:0,SF:29|28|17|19|48|38,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_SDM,TF_CID_SPAM_ASC,TF_CID_SPAM_FAS, TF_CID_SPAM_FSD X-UUID: d0af5f561a5b11ee912e1518a6540028-20230704 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 797401504; Tue, 04 Jul 2023 04:13:34 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:31 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:30 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,02/11] media: mediatek: vcodec: align fw interface Date: Tue, 4 Jul 2023 19:13:18 +0800 Message-ID: <20230704111327.7140-3-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_041343_378511_3FCB3ACF X-CRM114-Status: GOOD ( 15.56 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Align scp and vpu firmware interface, remove the depedency for 'struct mtk_vcodec_dev' and 'struct mtk_vcodec_ctx'. It will be much easier to separate video encoder and decoder. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- .../media/platform/mediatek/vcodec/mtk_vcodec_fw.c | 7 +++---- .../media/platform/mediatek/vcodec/mtk_vcodec_fw.h | 3 +-- .../platform/mediatek/vcodec/mtk_vcodec_fw_priv.h | 11 +++++------ .../platform/mediatek/vcodec/mtk_vcodec_fw_scp.c | 9 ++++++--- .../platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c | 12 ++++++++---- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c index 556e54aadac9..be9159acacf8 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c @@ -5,15 +5,14 @@ #include "mtk_vcodec_util.h" #include "mtk_vcodec_drv.h" -struct mtk_vcodec_fw *mtk_vcodec_fw_select(struct mtk_vcodec_dev *dev, - enum mtk_vcodec_fw_type type, +struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type, enum mtk_vcodec_fw_use fw_use) { switch (type) { case VPU: - return mtk_vcodec_fw_vpu_init(dev, fw_use); + return mtk_vcodec_fw_vpu_init(priv, fw_use); case SCP: - return mtk_vcodec_fw_scp_init(dev); + return mtk_vcodec_fw_scp_init(priv, fw_use); default: mtk_v4l2_err("invalid vcodec fw type"); return ERR_PTR(-EINVAL); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h index 16824114657f..d8cfbec323d5 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h @@ -25,8 +25,7 @@ struct mtk_vcodec_fw; typedef void (*mtk_vcodec_ipi_handler) (void *data, unsigned int len, void *priv); -struct mtk_vcodec_fw *mtk_vcodec_fw_select(struct mtk_vcodec_dev *dev, - enum mtk_vcodec_fw_type type, +struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type, enum mtk_vcodec_fw_use fw_use); void mtk_vcodec_fw_release(struct mtk_vcodec_fw *fw); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h index b41e66185cec..3438a4917344 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h @@ -12,6 +12,7 @@ struct mtk_vcodec_fw { const struct mtk_vcodec_fw_ops *ops; struct platform_device *pdev; struct mtk_scp *scp; + enum mtk_vcodec_fw_use fw_use; }; struct mtk_vcodec_fw_ops { @@ -28,22 +29,20 @@ struct mtk_vcodec_fw_ops { }; #if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU) -struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev, - enum mtk_vcodec_fw_use fw_use); +struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use); #else static inline struct mtk_vcodec_fw * -mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev, - enum mtk_vcodec_fw_use fw_use) +mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use) { return ERR_PTR(-ENODEV); } #endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_VPU */ #if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP) -struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev); +struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use); #else static inline struct mtk_vcodec_fw * -mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev) +mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use) { return ERR_PTR(-ENODEV); } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c index d8e66b645bd8..9a2472442c6f 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c @@ -53,18 +53,21 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_rproc_msg = { .release = mtk_vcodec_scp_release, }; -struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev) +struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use) { struct mtk_vcodec_fw *fw; + struct mtk_vcodec_dev *dev = priv; + struct platform_device *plat_dev; struct mtk_scp *scp; - scp = scp_get(dev->plat_dev); + plat_dev = dev->plat_dev; + scp = scp_get(plat_dev); if (!scp) { mtk_v4l2_err("could not get vdec scp handle"); return ERR_PTR(-EPROBE_DEFER); } - fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL); fw->type = SCP; fw->ops = &mtk_vcodec_rproc_msg; fw->scp = scp; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c index cfc7ebed8fb7..46a028031133 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c @@ -77,10 +77,11 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = { .release = mtk_vcodec_vpu_release, }; -struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev, - enum mtk_vcodec_fw_use fw_use) +struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use) { struct platform_device *fw_pdev; + struct mtk_vcodec_dev *dev = priv; + struct platform_device *plat_dev; struct mtk_vcodec_fw *fw; enum rst_id rst_id; @@ -94,19 +95,22 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev, break; } - fw_pdev = vpu_get_plat_device(dev->plat_dev); + plat_dev = dev->plat_dev; + fw_pdev = vpu_get_plat_device(plat_dev); if (!fw_pdev) { mtk_v4l2_err("firmware device is not ready"); return ERR_PTR(-EINVAL); } + vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id); - fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL); + fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL); if (!fw) return ERR_PTR(-ENOMEM); fw->type = VPU; fw->ops = &mtk_vcodec_vpu_msg; fw->pdev = fw_pdev; + fw->fw_use = fw_use; return fw; } From patchwork Tue Jul 4 11:13:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13300997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 795BDEB64D9 for ; Tue, 4 Jul 2023 11:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=Qe5/BnSjY4skcSdnatMJ8varlbcbUOxpYB4WV/LtZlE=; b=KmWzofdGZ0decU t4jy6YAjJxiDIMlhnknso0w7saYmhLFTVLo4QIGHSee+vHdchWidJaY9RG21EWPBC1b1K0sPrAKOZ hJ1miH0qH2I2R/G6Cx643QObKbq7wp3fEzl4GQepECp+kY38FdlM2fSUMqKPALH2WZopNQBmmEud5 Vo1undZdLHb+w5lYBBx5WHg2QkVtxVQaXaw2hcKx5E8KHXmjyGQvMIA6bmjgOL25261yMinCajCe2 GkGqYAHTooPtTBgMKf/lBCsk/qdfERMby/hv9ACsmolz+7fRYv9tjFPuXDgOlPXbqvewfweJkX6kd tG9dEPPPzSEoPVpxIquQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGdzJ-00D5qc-1U; Tue, 04 Jul 2023 11:14:29 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGdzE-00D5nj-1H; Tue, 04 Jul 2023 11:14:27 +0000 X-UUID: e445a1e21a5b11ee912e1518a6540028-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=j/Rkx4m+U46SPlhYZB/Xxb9HqUeOS+K11s1t5Yf3nHM=; b=sq3XV24FMdZ9hYQZPXC3VGY6MyKrAoqqzQC0ZO8cEYw4OlNDkOU3/1V0bn7hzADu+WCzWd5GAHi/M+s5MidQKBs0hdPsmBzEZmQRGFw9D2Ti1eRVGT0XFQ9X8XTZ5HPyH+CT0b4uAKrtyUq89l95CE1ap1iJwV5RZUyd4goemKg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:055c4ab3-cbf5-4d23-a1d7-d24ef5b1c592,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:01c9525,CLOUDID:8189af82-5a99-42ae-a2dd-e4afb731b474,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: e445a1e21a5b11ee912e1518a6540028-20230704 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1349496800; Tue, 04 Jul 2023 04:14:06 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by MTKMBS14N2.mediatek.inc (172.21.101.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:32 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:31 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,03/11] media: mediatek: vcodec: Removing struct 'mtk_vcodec_ctx/dev' for shared interface Date: Tue, 4 Jul 2023 19:13:19 +0800 Message-ID: <20230704111327.7140-4-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_041424_466842_DCA8B6A0 X-CRM114-Status: GOOD ( 19.41 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The shared struct 'mtk_vcodec_ctx/dev' will be changed to 'mtk_vcodec_enc_ctx/dev' and 'mtk_vcodec_dec_ctx/dev' in order to separate encoder and decoder. Removing common struct 'mtk_vcodec_ctx/dev' for shared interface which encoder and decoder used at the same time. Then encoder and decoder can call the same interface independently. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/mtk_vcodec_intr.c | 30 ++++++++++++------- .../mediatek/vcodec/mtk_vcodec_intr.h | 3 +- .../mediatek/vcodec/mtk_vcodec_util.c | 19 +++++------- .../mediatek/vcodec/mtk_vcodec_util.h | 9 ++---- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 16 +++++----- .../mediatek/vcodec/venc/venc_h264_if.c | 2 +- .../mediatek/vcodec/venc/venc_vp8_if.c | 2 +- 7 files changed, 41 insertions(+), 40 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c index 552b4c93d972..daa44f635727 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c @@ -11,32 +11,40 @@ #include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" -int mtk_vcodec_wait_for_done_ctx(struct mtk_vcodec_ctx *ctx, - int command, unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms, unsigned int hw_id) { + struct mtk_vcodec_ctx *ctx = priv; long timeout_jiff, ret; - int status = 0; + int status = 0, ctx_id, ctx_type; + int *ctx_int_cond, *ctx_int_type; + wait_queue_head_t *ctx_queue; + + ctx_id = ctx->id; + ctx_type = ctx->type; + ctx_int_cond = ctx->int_cond; + ctx_int_type = ctx->int_type; + ctx_queue = ctx->queue; timeout_jiff = msecs_to_jiffies(timeout_ms); - ret = wait_event_interruptible_timeout(ctx->queue[hw_id], - ctx->int_cond[hw_id], + ret = wait_event_interruptible_timeout(ctx_queue[hw_id], + ctx_int_cond[hw_id], timeout_jiff); if (!ret) { status = -1; /* timeout */ mtk_v4l2_err("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)", - ctx->id, command, ctx->type, timeout_ms, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } else if (-ERESTARTSYS == ret) { status = -1; mtk_v4l2_err("[%d] cmd=%d, type=%d, dec inter fail (%d %d)", - ctx->id, command, ctx->type, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } - ctx->int_cond[hw_id] = 0; - ctx->int_type[hw_id] = 0; + ctx_int_cond[hw_id] = 0; + ctx_int_type[hw_id] = 0; return status; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h index 9681f492813b..11bf0ef94d5d 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h @@ -12,8 +12,7 @@ struct mtk_vcodec_ctx; /* timeout is ms */ -int mtk_vcodec_wait_for_done_ctx(struct mtk_vcodec_ctx *ctx, - int command, unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms, unsigned int hw_id); #endif /* _MTK_VCODEC_INTR_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c index f214e6f67005..847e321f4fcc 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c @@ -21,24 +21,20 @@ int mtk_v4l2_dbg_level; EXPORT_SYMBOL(mtk_v4l2_dbg_level); #endif -void __iomem *mtk_vcodec_get_reg_addr(struct mtk_vcodec_ctx *data, - unsigned int reg_idx) +void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx) { - struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; - - if (!data || reg_idx >= NUM_MAX_VCODEC_REG_BASE) { + if (reg_idx >= NUM_MAX_VCODEC_REG_BASE) { mtk_v4l2_err("Invalid arguments, reg_idx=%d", reg_idx); return NULL; } - return ctx->dev->reg_base[reg_idx]; + return reg_base[reg_idx]; } EXPORT_SYMBOL(mtk_vcodec_get_reg_addr); -int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, - struct mtk_vcodec_mem *mem) +int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) { unsigned long size = mem->size; - struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; + struct mtk_vcodec_ctx *ctx = priv; struct device *dev = &ctx->dev->plat_dev->dev; mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); @@ -57,11 +53,10 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, } EXPORT_SYMBOL(mtk_vcodec_mem_alloc); -void mtk_vcodec_mem_free(struct mtk_vcodec_ctx *data, - struct mtk_vcodec_mem *mem) +void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) { unsigned long size = mem->size; - struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; + struct mtk_vcodec_ctx *ctx = priv; struct device *dev = &ctx->dev->plat_dev->dev; if (!mem->va) { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h index 88d389b65f13..827937bcb4b4 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h @@ -68,12 +68,9 @@ extern int mtk_vcodec_dbg; #define mtk_vcodec_debug_enter(h) mtk_vcodec_debug(h, "+") #define mtk_vcodec_debug_leave(h) mtk_vcodec_debug(h, "-") -void __iomem *mtk_vcodec_get_reg_addr(struct mtk_vcodec_ctx *data, - unsigned int reg_idx); -int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, - struct mtk_vcodec_mem *mem); -void mtk_vcodec_mem_free(struct mtk_vcodec_ctx *data, - struct mtk_vcodec_mem *mem); +void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx); +int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem); +void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem); void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev, struct mtk_vcodec_ctx *ctx, int hw_idx); struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev, diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c index 88c046731754..71f94ac144bc 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c @@ -167,13 +167,15 @@ struct vdec_vp8_inst { static void get_hw_reg_base(struct vdec_vp8_inst *inst) { - inst->reg_base.top = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_TOP); - inst->reg_base.cm = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_CM); - inst->reg_base.hwd = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_HWD); - inst->reg_base.sys = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_SYS); - inst->reg_base.misc = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_MISC); - inst->reg_base.ld = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_LD); - inst->reg_base.hwb = mtk_vcodec_get_reg_addr(inst->ctx, VDEC_HWB); + void __iomem **reg_base = inst->ctx->dev->reg_base; + + inst->reg_base.top = mtk_vcodec_get_reg_addr(reg_base, VDEC_TOP); + inst->reg_base.cm = mtk_vcodec_get_reg_addr(reg_base, VDEC_CM); + inst->reg_base.hwd = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWD); + inst->reg_base.sys = mtk_vcodec_get_reg_addr(reg_base, VDEC_SYS); + inst->reg_base.misc = mtk_vcodec_get_reg_addr(reg_base, VDEC_MISC); + inst->reg_base.ld = mtk_vcodec_get_reg_addr(reg_base, VDEC_LD); + inst->reg_base.hwb = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWB); } static void write_hw_segmentation_data(struct vdec_vp8_inst *inst) diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c index 60fd165c0d94..10365c95ebbe 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c @@ -612,7 +612,7 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264; - inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx, VENC_SYS); + inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_SYS); mtk_vcodec_debug_enter(inst); diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c index 56ce58f761f1..73ebc35d7c99 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c @@ -336,7 +336,7 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id = IPI_VENC_VP8; - inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx, VENC_LT_SYS); + inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_LT_SYS); mtk_vcodec_debug_enter(inst); From patchwork Tue Jul 4 11:13:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13300994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D7E4C00528 for ; Tue, 4 Jul 2023 11:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=9KzYiSZGtp7hounPFHcDT88yvOz3prgCEeNTQb2Z7L4=; b=N1PqZr0dOVsVPS inPIOpMkZo6uDfudNDjfclSCGoziGGMgiIOKW14vITybKKh/xB6vau+RyyR7LjihPmM7uj5EDDuRF O25lzz2tixxD99gK3dOJVGMc4K0J/uIvgPtpHtP+1kt/Lhn3mSPsKf+Ud7XyD65cqSAQi4pyY74cH NQqOuxoWg98fvS0/XFxsx0DsuyrsKyZPaTWDMV1CuowTyeKmG5iiSXV6vf8QTkuFWUbc/DcHDFP6D Nt4S5+HhXR14oFwmsY7EIBi0WFyQAgUtY6Dp223DcxqUgjb+jJ0E+Eg13FrJ2K7ZiE2FdN9kfqwH/ KEK68fqkBhSd+sBwkXKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyf-00D5Px-0h; Tue, 04 Jul 2023 11:13:49 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyZ-00D5MN-14; Tue, 04 Jul 2023 11:13:47 +0000 X-UUID: d112195c1a5b11ee912e1518a6540028-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=bcEq0yIX3s8aEY5G9yARFW45qL0AKS/UAyXYFEzNI0w=; b=DRhqDFM9c4BzXS4uYAEr40rKVbbLKxdUMF5hC2EQRbEkKsFqd781xaISptZf/ejVjvFuwgISDOf0ltCHYwAhwDXKeO+qz2mJuKKxkaPHtjMTR+GV7AjeTtzmxvYAApEtJwC+SCXHtMVGO49k/b4IUszYOv0lK+bJ8fqu8dH9xMg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:a47d91db-4497-420e-8ddc-f31cca4a52ec,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.27,REQID:a47d91db-4497-420e-8ddc-f31cca4a52ec,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:01c9525,CLOUDID:8c88af82-5a99-42ae-a2dd-e4afb731b474,B ulkID:230704191336ZHT1D770,BulkQuantity:0,Recheck:0,SF:19|48|38|29|28|17,T C:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,CO L:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SDM,TF_CID_SPAM_ASC,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD, TF_CID_SPAM_ULN,TF_CID_SPAM_SNR X-UUID: d112195c1a5b11ee912e1518a6540028-20230704 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1399261952; Tue, 04 Jul 2023 04:13:34 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:33 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:32 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,04/11] media: mediatek: vcodec: Removing useless debug log Date: Tue, 4 Jul 2023 19:13:20 +0800 Message-ID: <20230704111327.7140-5-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_041343_382279_4F990172 X-CRM114-Status: GOOD ( 16.44 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Removing unresonable and useless debug log enter and leave in order to simply the log message. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 1 - .../mediatek/vcodec/mtk_vcodec_util.h | 6 ----- .../mediatek/vcodec/vdec/vdec_h264_if.c | 4 ---- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 4 ---- .../vcodec/vdec/vdec_h264_req_multi_if.c | 2 -- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 2 -- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 2 -- .../mediatek/vcodec/vdec/vdec_vp8_req_if.c | 2 -- .../platform/mediatek/vcodec/vdec_vpu_if.c | 6 ----- .../mediatek/vcodec/venc/venc_h264_if.c | 22 ------------------- .../mediatek/vcodec/venc/venc_vp8_if.c | 22 ------------------- .../platform/mediatek/vcodec/venc_vpu_if.c | 21 ++++-------------- 12 files changed, 4 insertions(+), 90 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index a56652e476c2..0db81e150b18 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -459,7 +459,6 @@ static void mtk_vcodec_enc_remove(struct platform_device *pdev) { struct mtk_vcodec_dev *dev = platform_get_drvdata(pdev); - mtk_v4l2_debug_enter(); destroy_workqueue(dev->encode_workqueue); if (dev->m2m_dev_enc) v4l2_m2m_release(dev->m2m_dev_enc); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h index 827937bcb4b4..a356f42362e4 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h @@ -62,12 +62,6 @@ extern int mtk_vcodec_dbg; ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args) #endif -#define mtk_v4l2_debug_enter() mtk_v4l2_debug(3, "+") -#define mtk_v4l2_debug_leave() mtk_v4l2_debug(3, "-") - -#define mtk_vcodec_debug_enter(h) mtk_vcodec_debug(h, "+") -#define mtk_vcodec_debug_leave(h) mtk_vcodec_debug(h, "-") - void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx); int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem); void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c index 481655bb6016..24312a90afbb 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c @@ -156,8 +156,6 @@ static void free_predication_buf(struct vdec_h264_inst *inst) { struct mtk_vcodec_mem *mem = NULL; - mtk_vcodec_debug_enter(inst); - inst->vsi->pred_buf_dma = 0; mem = &inst->pred_buf; if (mem->va) @@ -311,8 +309,6 @@ static void vdec_h264_deinit(void *h_vdec) { struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec; - mtk_vcodec_debug_enter(inst); - vpu_dec_deinit(&inst->vpu); free_predication_buf(inst); free_mv_buf(inst); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c index 4bc05ab5afea..dc6ee266f232 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c @@ -174,8 +174,6 @@ static void free_predication_buf(struct vdec_h264_slice_inst *inst) { struct mtk_vcodec_mem *mem = &inst->pred_buf; - mtk_vcodec_debug_enter(inst); - inst->vsi_ctx.pred_buf_dma = 0; if (mem->va) mtk_vcodec_mem_free(inst->ctx, mem); @@ -322,8 +320,6 @@ static void vdec_h264_slice_deinit(void *h_vdec) { struct vdec_h264_slice_inst *inst = h_vdec; - mtk_vcodec_debug_enter(inst); - vpu_dec_deinit(&inst->vpu); free_predication_buf(inst); free_mv_buf(inst); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c index a7e8e3257b7f..3cb5b967f48a 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c @@ -444,8 +444,6 @@ static void vdec_h264_slice_deinit(void *h_vdec) { struct vdec_h264_slice_inst *inst = h_vdec; - mtk_vcodec_debug_enter(inst); - vpu_dec_deinit(&inst->vpu); vdec_h264_slice_free_mv_buf(inst); vdec_msg_queue_deinit(&inst->ctx->msg_queue, inst->ctx); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c index 1e6ab138b0bb..0bb5b54578e9 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c @@ -911,8 +911,6 @@ static void vdec_hevc_slice_deinit(void *h_vdec) struct vdec_hevc_slice_inst *inst = h_vdec; struct mtk_vcodec_mem *mem; - mtk_vcodec_debug_enter(inst); - vpu_dec_deinit(&inst->vpu); vdec_hevc_slice_free_mv_buf(inst); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c index 71f94ac144bc..f02834a313d9 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c @@ -603,8 +603,6 @@ static void vdec_vp8_deinit(void *h_vdec) { struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec; - mtk_vcodec_debug_enter(inst); - vpu_dec_deinit(&inst->vpu); free_working_buf(inst); kfree(inst); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c index e1fe2603e92e..f7181f4a4d2a 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c @@ -421,8 +421,6 @@ static void vdec_vp8_slice_deinit(void *h_vdec) { struct vdec_vp8_slice_inst *inst = h_vdec; - mtk_vcodec_debug_enter(inst); - vpu_dec_deinit(&inst->vpu); vdec_vp8_slice_free_working_buf(inst); kfree(inst); diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c index df309e8e9379..60e5b70fa127 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c @@ -183,8 +183,6 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu) struct vdec_ap_ipi_init msg; int err; - mtk_vcodec_debug_enter(vpu); - init_waitqueue_head(&vpu->wq); vpu->handler = vpu_dec_ipi_handler; @@ -223,8 +221,6 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len) int i; int err = 0; - mtk_vcodec_debug_enter(vpu); - if (len > ARRAY_SIZE(msg.data)) { mtk_vcodec_err(vpu, "invalid len = %d\n", len); return -EINVAL; @@ -252,8 +248,6 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data, struct vdec_ap_ipi_get_param msg; int err; - mtk_vcodec_debug_enter(vpu); - if (len > ARRAY_SIZE(msg.data)) { mtk_vcodec_err(vpu, "invalid len = %d\n", len); return -EINVAL; diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c index 10365c95ebbe..c821ed427537 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c @@ -298,8 +298,6 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst) { int i; - mtk_vcodec_debug_enter(inst); - /* Except the SKIP_FRAME buffers, * other buffers need to be freed by AP. */ @@ -309,8 +307,6 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst) } mtk_vcodec_mem_free(inst->ctx, &inst->pps_buf); - - mtk_vcodec_debug_leave(inst); } static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit) @@ -321,8 +317,6 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit) u32 vpua, wb_size; int ret = 0; - mtk_vcodec_debug_enter(inst); - if (is_34bit) wb_34 = inst->vsi_34->work_bufs; else @@ -406,8 +400,6 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit) goto err_alloc; } - mtk_vcodec_debug_leave(inst); - return ret; err_alloc: @@ -452,8 +444,6 @@ static int h264_encode_sps(struct venc_h264_inst *inst, int ret = 0; unsigned int irq_status; - mtk_vcodec_debug_enter(inst); - ret = vpu_enc_encode(&inst->vpu_inst, H264_BS_MODE_SPS, NULL, bs_buf, NULL); if (ret) return ret; @@ -478,8 +468,6 @@ static int h264_encode_pps(struct venc_h264_inst *inst, int ret = 0; unsigned int irq_status; - mtk_vcodec_debug_enter(inst); - ret = vpu_enc_encode(&inst->vpu_inst, H264_BS_MODE_PPS, NULL, bs_buf, NULL); if (ret) return ret; @@ -531,7 +519,6 @@ static int h264_encode_frame(struct venc_h264_inst *inst, struct venc_frame_info frame_info; struct mtk_vcodec_ctx *ctx = inst->ctx; - mtk_vcodec_debug_enter(inst); mtk_vcodec_debug(inst, "frm_cnt = %d\n ", inst->frm_cnt); if (MTK_ENC_IOVA_IS_34BIT(ctx)) { @@ -614,8 +601,6 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264; inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_SYS); - mtk_vcodec_debug_enter(inst); - ret = vpu_enc_init(&inst->vpu_inst); if (MTK_ENC_IOVA_IS_34BIT(ctx)) @@ -623,8 +608,6 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) else inst->vsi = (struct venc_h264_vsi *)inst->vpu_inst.vsi; - mtk_vcodec_debug_leave(inst); - if (ret) kfree(inst); else @@ -811,8 +794,6 @@ static int h264_enc_set_param(void *handle, break; } - mtk_vcodec_debug_leave(inst); - return ret; } @@ -821,14 +802,11 @@ static int h264_enc_deinit(void *handle) int ret = 0; struct venc_h264_inst *inst = (struct venc_h264_inst *)handle; - mtk_vcodec_debug_enter(inst); - ret = vpu_enc_deinit(&inst->vpu_inst); if (inst->work_buf_allocated) h264_enc_free_work_buf(inst); - mtk_vcodec_debug_leave(inst); kfree(inst); return ret; diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c index 73ebc35d7c99..ddcdb565db17 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c @@ -141,16 +141,12 @@ static void vp8_enc_free_work_buf(struct venc_vp8_inst *inst) { int i; - mtk_vcodec_debug_enter(inst); - /* Buffers need to be freed by AP. */ for (i = 0; i < VENC_VP8_VPU_WORK_BUF_MAX; i++) { if (inst->work_bufs[i].size == 0) continue; mtk_vcodec_mem_free(inst->ctx, &inst->work_bufs[i]); } - - mtk_vcodec_debug_leave(inst); } static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) @@ -159,8 +155,6 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) int ret = 0; struct venc_vp8_vpu_buf *wb = inst->vsi->work_bufs; - mtk_vcodec_debug_enter(inst); - for (i = 0; i < VENC_VP8_VPU_WORK_BUF_MAX; i++) { if (wb[i].size == 0) continue; @@ -206,8 +200,6 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) inst->work_bufs[i].size); } - mtk_vcodec_debug_leave(inst); - return ret; err_alloc: @@ -338,14 +330,10 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) inst->vpu_inst.id = IPI_VENC_VP8; inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_LT_SYS); - mtk_vcodec_debug_enter(inst); - ret = vpu_enc_init(&inst->vpu_inst); inst->vsi = (struct venc_vp8_vsi *)inst->vpu_inst.vsi; - mtk_vcodec_debug_leave(inst); - if (ret) kfree(inst); else @@ -364,8 +352,6 @@ static int vp8_enc_encode(void *handle, struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; struct mtk_vcodec_ctx *ctx = inst->ctx; - mtk_vcodec_debug_enter(inst); - enable_irq(ctx->dev->enc_irq); switch (opt) { @@ -386,8 +372,6 @@ static int vp8_enc_encode(void *handle, encode_err: disable_irq(ctx->dev->enc_irq); - mtk_vcodec_debug_leave(inst); - return ret; } @@ -437,8 +421,6 @@ static int vp8_enc_set_param(void *handle, break; } - mtk_vcodec_debug_leave(inst); - return ret; } @@ -447,16 +429,12 @@ static int vp8_enc_deinit(void *handle) int ret = 0; struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; - mtk_vcodec_debug_enter(inst); - ret = vpu_enc_deinit(&inst->vpu_inst); if (inst->work_buf_allocated) vp8_enc_free_work_buf(inst); - mtk_vcodec_debug_leave(inst); kfree(inst); - return ret; } diff --git a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c index 09e7eaa25aab..63ebab28242c 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c @@ -55,8 +55,10 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv) vpu->signaled = 1; vpu->failure = (msg->status != VENC_IPI_MSG_STATUS_OK); - if (vpu->failure) - goto failure; + if (vpu->failure) { + mtk_vcodec_err(vpu, "vpu enc status failure %d", vpu->failure); + return; + } switch (msg->msg_id) { case VPU_IPIMSG_ENC_INIT_DONE: @@ -73,9 +75,6 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv) mtk_vcodec_err(vpu, "unknown msg id %x", msg->msg_id); break; } - -failure: - mtk_vcodec_debug_leave(vpu); } static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, @@ -83,8 +82,6 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, { int status; - mtk_vcodec_debug_enter(vpu); - if (!vpu->ctx->dev->fw_handler) { mtk_vcodec_err(vpu, "inst dev is NULL"); return -EINVAL; @@ -100,8 +97,6 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, if (vpu->failure) return -EINVAL; - mtk_vcodec_debug_leave(vpu); - return 0; } @@ -110,8 +105,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) int status; struct venc_ap_ipi_msg_init out; - mtk_vcodec_debug_enter(vpu); - init_waitqueue_head(&vpu->wq_hd); vpu->signaled = 0; vpu->failure = 0; @@ -132,8 +125,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) return -EINVAL; } - mtk_vcodec_debug_leave(vpu); - return 0; } @@ -345,8 +336,6 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu) { struct venc_ap_ipi_msg_deinit out; - mtk_vcodec_debug_enter(vpu); - memset(&out, 0, sizeof(out)); out.msg_id = AP_IPIMSG_ENC_DEINIT; out.vpu_inst_addr = vpu->inst_addr; @@ -355,7 +344,5 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu) return -EINVAL; } - mtk_vcodec_debug_leave(vpu); - return 0; } From patchwork Tue Jul 4 11:13:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13300996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13C44EB64DD for ; Tue, 4 Jul 2023 11:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=My01tN5Pei9RS+i8ni4BKmmpdJ6+8G1ujRr8XuOZmxc=; b=iMk2kAqPKY9+8j Xpn/eCXY/IRnKONX5t3c3NdlIO62QtGT7p7GZiJwKoL/uytRdE+aawWnXsS3lAUV1XeIwuhFhPljP En0i3hRZkffLDwxWRnX6oR2QAhKTbvMspNz79JghT0D0FC+XYp9chGrGFxQCYv8m8psFwq9xyqKRK tKJ8vfRZaimK8J+6VsFywQcTJjdCOG+25c1lXnigmPgH2riovRBwagdoCeRbYNYYtaE0rBpYadhg3 8aShhY4ZjBBn8hrQrtMIJOjlCq1534G8Xf/c0d+cUMP7WAN1JFXhHpWDwfrQZ27BPXhRtVe8PkAwK YgMknvyoRQl7fTdyEiZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyl-00D5Um-1H; Tue, 04 Jul 2023 11:13:55 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGdya-00D5Nb-1A; Tue, 04 Jul 2023 11:13:51 +0000 X-UUID: d359424e1a5b11ee83ed1395ce914268-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=wmogQbtSj87trFGMXFlrLNQ8JBzM7tCsNhizovU6D1s=; b=M6gHYrKRA/iSWa694bkV0aTLsmVpGXYM2j/tlcQrua4dV7IRQNgtYd3hipopdP4ycrR5xUd38N09q/OhdT+AqtV8ua/g0+v0DoGFbYg7YENk3FCCcl0RIV7j3HEkjPTvmH64mqgP+gdOvMVMAPw/UZdur7a887F0aN//gNdmiYc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:a3c43edd-7dcd-4960-ad64-46ef5a256f29,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:01c9525,CLOUDID:b7128d0d-26a8-467f-b838-f99719a9c083,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:1,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 2,OSH|NGT X-CID-BAS: 2,OSH|NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: d359424e1a5b11ee83ed1395ce914268-20230704 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1643839998; Tue, 04 Jul 2023 04:13:38 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:35 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:34 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,06/11] media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message Date: Tue, 4 Jul 2023 19:13:22 +0800 Message-ID: <20230704111327.7140-7-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Adding different macro mtk_v4l2_vdec_dbg and mtk_v4l2_venc_dbg for encoder and decoder. Then calling the common marco mtk_v4l2_debug to print debug message. Replace pr_err with dev_err for 'mtk_v4l2_err' debug message. Replace pr_debug with dev_dbg for 'mtk_v4l2_debug' debug message. Signed-off-by: Yunfei Dong Reviewed-by: AngeloGioacchino Del Regno --- .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 116 +++++----- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 53 ++--- .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 7 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 19 +- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 143 ++++++------ .../vcodec/mtk_vcodec_dec_stateless.c | 62 ++--- .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 211 ++++++++---------- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 45 ++-- .../mediatek/vcodec/mtk_vcodec_enc_pm.c | 8 +- .../platform/mediatek/vcodec/mtk_vcodec_fw.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 7 +- .../mediatek/vcodec/mtk_vcodec_intr.c | 12 +- .../mediatek/vcodec/mtk_vcodec_util.c | 30 ++- .../mediatek/vcodec/mtk_vcodec_util.h | 27 ++- .../vcodec/vdec/vdec_av1_req_lat_if.c | 10 +- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 14 +- .../vcodec/vdec/vdec_h264_req_multi_if.c | 16 +- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 14 +- .../platform/mediatek/vcodec/vdec_drv_if.c | 4 +- .../platform/mediatek/vcodec/vdec_msg_queue.c | 52 +++-- .../platform/mediatek/vcodec/vdec_msg_queue.h | 2 + .../platform/mediatek/vcodec/vdec_vpu_if.c | 2 +- 23 files changed, 416 insertions(+), 442 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c index 93fcea821001..269f90fe0a1a 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c @@ -82,7 +82,7 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, if (ret) return ret; - mtk_v4l2_debug(1, "decoder cmd=%u", cmd->cmd); + mtk_v4l2_vdec_dbg(1, ctx, "decoder cmd=%u", cmd->cmd); dst_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); switch (cmd->cmd) { @@ -90,11 +90,11 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); if (!vb2_is_streaming(src_vq)) { - mtk_v4l2_debug(1, "Output stream is off. No need to flush."); + mtk_v4l2_vdec_dbg(1, ctx, "Output stream is off. No need to flush."); return 0; } if (!vb2_is_streaming(dst_vq)) { - mtk_v4l2_debug(1, "Capture stream is off. No need to flush."); + mtk_v4l2_vdec_dbg(1, ctx, "Capture stream is off. No need to flush."); return 0; } v4l2_m2m_buf_queue(ctx->m2m_ctx, &ctx->empty_flush_buf.vb); @@ -172,8 +172,7 @@ static int vidioc_vdec_qbuf(struct file *file, void *priv, struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); if (ctx->state == MTK_STATE_ABORT) { - mtk_v4l2_err("[%d] Call on QBUF after unrecoverable error", - ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d] Call on QBUF after unrecoverable error", ctx->id); return -EIO; } @@ -186,8 +185,7 @@ static int vidioc_vdec_dqbuf(struct file *file, void *priv, struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); if (ctx->state == MTK_STATE_ABORT) { - mtk_v4l2_err("[%d] Call on DQBUF after unrecoverable error", - ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d] Call on DQBUF after unrecoverable error", ctx->id); return -EIO; } @@ -288,11 +286,10 @@ static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f, (pix_fmt_mp->height + 64) <= frmsize->max_height) pix_fmt_mp->height += 64; - mtk_v4l2_debug(0, - "before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d", - tmp_w, tmp_h, pix_fmt_mp->width, - pix_fmt_mp->height, - pix_fmt_mp->width * pix_fmt_mp->height); + mtk_v4l2_vdec_dbg(0, ctx, + "before resize wxh=%dx%d, after resize wxh=%dx%d, sizeimage=%d", + tmp_w, tmp_h, pix_fmt_mp->width, pix_fmt_mp->height, + pix_fmt_mp->width * pix_fmt_mp->height); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage = @@ -344,7 +341,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, } if (pix_fmt_mp->plane_fmt[0].sizeimage == 0) { - mtk_v4l2_err("sizeimage of output format must be given"); + mtk_v4l2_vdec_err(ctx, "sizeimage of output format must be given"); return -EINVAL; } @@ -432,7 +429,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, const struct mtk_video_fmt *fmt; const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev->vdec_pdata; - mtk_v4l2_debug(3, "[%d]", ctx->id); + mtk_v4l2_vdec_dbg(3, ctx, "[%d]", ctx->id); q_data = mtk_vdec_get_q_data(ctx, f->type); if (!q_data) @@ -446,7 +443,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, if (!dec_pdata->uses_stateless_api && f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && vb2_is_busy(&ctx->m2m_ctx->out_q_ctx.q)) { - mtk_v4l2_err("out_q_ctx buffers already requested"); + mtk_v4l2_vdec_err(ctx, "out_q_ctx buffers already requested"); ret = -EBUSY; } @@ -456,7 +453,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, */ if ((f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && vb2_is_busy(&ctx->m2m_ctx->cap_q_ctx.q)) { - mtk_v4l2_err("cap_q_ctx buffers already requested"); + mtk_v4l2_vdec_err(ctx, "cap_q_ctx buffers already requested"); ret = -EBUSY; } @@ -491,8 +488,8 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, if (ctx->state == MTK_STATE_FREE) { ret = vdec_if_init(ctx, q_data->fmt->fourcc); if (ret) { - mtk_v4l2_err("[%d]: vdec_if_init() fail ret=%d", - ctx->id, ret); + mtk_v4l2_vdec_err(ctx, "[%d]: vdec_if_init() fail ret=%d", + ctx->id, ret); return -EINVAL; } ctx->state = MTK_STATE_INIT; @@ -515,8 +512,8 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, */ ret = vdec_if_get_param(ctx, GET_PARAM_PIC_INFO, &ctx->picinfo); if (ret) { - mtk_v4l2_err("[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail", - ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail", + ctx->id); } ctx->last_decoded_picinfo = ctx->picinfo; @@ -540,11 +537,13 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, ctx->q_data[MTK_Q_DATA_DST].coded_width = ctx->picinfo.buf_w; ctx->q_data[MTK_Q_DATA_DST].coded_height = ctx->picinfo.buf_h; - mtk_v4l2_debug(2, "[%d] vdec_if_init() num_plane = %d wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x", - ctx->id, pix_mp->num_planes, ctx->picinfo.buf_w, ctx->picinfo.buf_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->q_data[MTK_Q_DATA_DST].sizeimage[0], - ctx->q_data[MTK_Q_DATA_DST].sizeimage[1]); + mtk_v4l2_vdec_dbg(2, ctx, + "[%d] init() plane:%d wxh=%dx%d pic wxh=%dx%d sz=0x%x_0x%x", + ctx->id, pix_mp->num_planes, + ctx->picinfo.buf_w, ctx->picinfo.buf_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->q_data[MTK_Q_DATA_DST].sizeimage[0], + ctx->q_data[MTK_Q_DATA_DST].sizeimage[1]); } return 0; } @@ -570,14 +569,11 @@ static int vidioc_enum_framesizes(struct file *file, void *priv, fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; fsize->stepwise = dec_pdata->vdec_formats[i].frmsize; - mtk_v4l2_debug(1, "%x, %d %d %d %d %d %d", - ctx->dev->dec_capability, - fsize->stepwise.min_width, - fsize->stepwise.max_width, - fsize->stepwise.step_width, - fsize->stepwise.min_height, - fsize->stepwise.max_height, - fsize->stepwise.step_height); + mtk_v4l2_vdec_dbg(1, ctx, "%x, %d %d %d %d %d %d", + ctx->dev->dec_capability, fsize->stepwise.min_width, + fsize->stepwise.max_width, fsize->stepwise.step_width, + fsize->stepwise.min_height, fsize->stepwise.max_height, + fsize->stepwise.step_height); return 0; } @@ -641,7 +637,7 @@ static int vidioc_vdec_g_fmt(struct file *file, void *priv, vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { - mtk_v4l2_err("no vb2 queue for type=%d", f->type); + mtk_v4l2_vdec_err(ctx, "no vb2 queue for type=%d", f->type); return -EINVAL; } @@ -712,8 +708,8 @@ static int vidioc_vdec_g_fmt(struct file *file, void *priv, pix_mp->plane_fmt[1].bytesperline = q_data->bytesperline[1]; pix_mp->plane_fmt[1].sizeimage = q_data->sizeimage[1]; - mtk_v4l2_debug(1, "[%d] type=%d state=%d Format information could not be read, not ready yet!", - ctx->id, f->type, ctx->state); + mtk_v4l2_vdec_dbg(1, ctx, "[%d] type=%d state=%d Format information not ready!", + ctx->id, f->type, ctx->state); } return 0; @@ -730,7 +726,7 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, q_data = mtk_vdec_get_q_data(ctx, vq->type); if (q_data == NULL) { - mtk_v4l2_err("vq->type=%d err\n", vq->type); + mtk_v4l2_vdec_err(ctx, "vq->type=%d err\n", vq->type); return -EINVAL; } @@ -756,10 +752,9 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, sizes[i] = q_data->sizeimage[i]; } - mtk_v4l2_debug(1, - "[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x ", - ctx->id, vq->type, *nplanes, *nbuffers, - sizes[0], sizes[1]); + mtk_v4l2_vdec_dbg(1, ctx, + "[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x ", + ctx->id, vq->type, *nplanes, *nbuffers, sizes[0], sizes[1]); return 0; } @@ -770,16 +765,15 @@ int vb2ops_vdec_buf_prepare(struct vb2_buffer *vb) struct mtk_q_data *q_data; int i; - mtk_v4l2_debug(3, "[%d] (%d) id=%d", - ctx->id, vb->vb2_queue->type, vb->index); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) id=%d", + ctx->id, vb->vb2_queue->type, vb->index); q_data = mtk_vdec_get_q_data(ctx, vb->vb2_queue->type); for (i = 0; i < q_data->fmt->num_planes; i++) { if (vb2_plane_size(vb, i) < q_data->sizeimage[i]) { - mtk_v4l2_err("data will not fit into plane %d (%lu < %d)", - i, vb2_plane_size(vb, i), - q_data->sizeimage[i]); + mtk_v4l2_vdec_err(ctx, "data will not fit into plane %d (%lu < %d)", + i, vb2_plane_size(vb, i), q_data->sizeimage[i]); return -EINVAL; } if (!V4L2_TYPE_IS_OUTPUT(vb->type)) @@ -807,7 +801,7 @@ void vb2ops_vdec_buf_finish(struct vb2_buffer *vb) mutex_unlock(&ctx->lock); if (buf_error) { - mtk_v4l2_err("Unrecoverable error on buffer."); + mtk_v4l2_vdec_err(ctx, "Unrecoverable error on buffer."); ctx->state = MTK_STATE_ABORT; } } @@ -843,8 +837,8 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q) struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(q); int ret; - mtk_v4l2_debug(3, "[%d] (%d) state=(%x) ctx->decoded_frame_cnt=%d", - ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) state=(%x) ctx->decoded_frame_cnt=%d", + ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt); if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { while ((src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx))) { @@ -870,17 +864,17 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q) */ ctx->picinfo = ctx->last_decoded_picinfo; - mtk_v4l2_debug(2, - "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)", - ctx->id, ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->last_decoded_picinfo.buf_w, - ctx->last_decoded_picinfo.buf_h); + mtk_v4l2_vdec_dbg(2, ctx, + "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)", + ctx->id, ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret = ctx->dev->vdec_pdata->flush_decoder(ctx); if (ret) - mtk_v4l2_err("DecodeFinal failed, ret=%d", ret); + mtk_v4l2_vdec_err(ctx, "DecodeFinal failed, ret=%d", ret); } ctx->state = MTK_STATE_FLUSH; @@ -905,7 +899,7 @@ static int m2mops_vdec_job_ready(void *m2m_priv) { struct mtk_vcodec_ctx *ctx = m2m_priv; - mtk_v4l2_debug(3, "[%d]", ctx->id); + mtk_v4l2_vdec_dbg(3, ctx, "[%d]", ctx->id); if (ctx->state == MTK_STATE_ABORT) return 0; @@ -973,7 +967,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, struct mtk_vcodec_ctx *ctx = priv; int ret = 0; - mtk_v4l2_debug(3, "[%d]", ctx->id); + mtk_v4l2_vdec_dbg(3, ctx, "[%d]", ctx->id); src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; src_vq->io_modes = VB2_DMABUF | VB2_MMAP; @@ -988,7 +982,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, ret = vb2_queue_init(src_vq); if (ret) { - mtk_v4l2_err("Failed to initialize videobuf2 queue(output)"); + mtk_v4l2_vdec_err(ctx, "Failed to initialize videobuf2 queue(output)"); return ret; } dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; @@ -1004,7 +998,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, ret = vb2_queue_init(dst_vq); if (ret) - mtk_v4l2_err("Failed to initialize videobuf2 queue(capture)"); + mtk_v4l2_vdec_err(ctx, "Failed to initialize videobuf2 queue(capture)"); return ret; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index 03721eda2769..4469c2411f40 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -25,7 +25,7 @@ #include "mtk_vcodec_util.h" #include "mtk_vcodec_fw.h" -static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dev *dev) +static int mtk_vcodec_get_hw_count(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_dev *dev) { switch (dev->vdec_pdata->hw_arch) { case MTK_VDEC_PURE_SINGLE_CORE: @@ -33,7 +33,7 @@ static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dev *dev) case MTK_VDEC_LAT_SINGLE_CORE: return MTK_VDEC_ONE_LAT_ONE_CORE; default: - mtk_v4l2_err("hw arch %d not supported", dev->vdec_pdata->hw_arch); + mtk_v4l2_vdec_err(ctx, "hw arch %d not supported", dev->vdec_pdata->hw_arch); return MTK_VDEC_NO_HW; } } @@ -52,8 +52,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv) /* check if HW active or not */ cg_status = readl(dev->reg_base[0]); if ((cg_status & VDEC_HW_ACTIVE) != 0) { - mtk_v4l2_err("DEC ISR, VDEC active is not 0x0 (0x%08x)", - cg_status); + mtk_v4l2_vdec_err(ctx, "DEC ISR, VDEC active is not 0x0 (0x%08x)", cg_status); return IRQ_HANDLED; } @@ -71,9 +70,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv) wake_up_ctx(ctx, MTK_INST_IRQ_RECEIVED, 0); - mtk_v4l2_debug(3, - "mtk_vcodec_dec_irq_handler :wake up ctx %d, dec_done_status=%x", - ctx->id, dec_done_status); + mtk_v4l2_vdec_dbg(3, ctx, "wake up ctx %d, dec_done_status=%x", ctx->id, dec_done_status); return IRQ_HANDLED; } @@ -96,7 +93,7 @@ static int mtk_vcodec_get_reg_bases(struct mtk_vcodec_dev *dev) if (IS_ERR(dev->reg_base[i])) return PTR_ERR(dev->reg_base[i]); - mtk_v4l2_debug(2, "reg[%d] base=%p", i, dev->reg_base[i]); + dev_dbg(&pdev->dev, "reg[%d] base=%p", i, dev->reg_base[i]); } return 0; @@ -156,7 +153,7 @@ static int fops_vcodec_open(struct file *file) INIT_LIST_HEAD(&ctx->list); ctx->dev = dev; if (ctx->dev->vdec_pdata->is_subdev_supported) { - hw_count = mtk_vcodec_get_hw_count(dev); + hw_count = mtk_vcodec_get_hw_count(ctx, dev); if (!hw_count || !dev->subdev_prob_done) { ret = -EINVAL; goto err_ctrls_setup; @@ -176,15 +173,14 @@ static int fops_vcodec_open(struct file *file) ctx->type = MTK_INST_DECODER; ret = dev->vdec_pdata->ctrls_setup(ctx); if (ret) { - mtk_v4l2_err("Failed to setup mt vcodec controls"); + mtk_v4l2_vdec_err(ctx, "Failed to setup mt vcodec controls"); goto err_ctrls_setup; } ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev_dec, ctx, &mtk_vcodec_dec_queue_init); if (IS_ERR((__force void *)ctx->m2m_ctx)) { ret = PTR_ERR((__force void *)ctx->m2m_ctx); - mtk_v4l2_err("Failed to v4l2_m2m_ctx_init() (%d)", - ret); + mtk_v4l2_vdec_err(ctx, "Failed to v4l2_m2m_ctx_init() (%d)", ret); goto err_m2m_ctx_init; } src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, @@ -202,14 +198,14 @@ static int fops_vcodec_open(struct file *file) * Return 0 if downloading firmware successfully, * otherwise it is failed */ - mtk_v4l2_err("failed to load firmware!"); + mtk_v4l2_vdec_err(ctx, "failed to load firmware!"); goto err_load_fw; } dev->dec_capability = mtk_vcodec_fw_get_vdec_capa(dev->fw_handler); - mtk_v4l2_debug(0, "decoder capability %x", dev->dec_capability); + mtk_v4l2_vdec_dbg(0, ctx, "decoder capability %x", dev->dec_capability); } ctx->dev->vdec_pdata->init_vdec_params(ctx); @@ -218,8 +214,7 @@ static int fops_vcodec_open(struct file *file) mtk_vcodec_dbgfs_create(ctx); mutex_unlock(&dev->dev_mutex); - mtk_v4l2_debug(0, "%s decoder [%d]", dev_name(&dev->plat_dev->dev), - ctx->id); + mtk_v4l2_vdec_dbg(0, ctx, "%s decoder [%d]", dev_name(&dev->plat_dev->dev), ctx->id); return ret; /* Deinit when failure occurred */ @@ -241,7 +236,7 @@ static int fops_vcodec_release(struct file *file) struct mtk_vcodec_dev *dev = video_drvdata(file); struct mtk_vcodec_ctx *ctx = fh_to_ctx(file->private_data); - mtk_v4l2_debug(0, "[%d] decoder", ctx->id); + mtk_v4l2_vdec_dbg(0, ctx, "[%d] decoder", ctx->id); mutex_lock(&dev->dev_mutex); /* @@ -296,7 +291,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) &rproc_phandle)) { fw_type = SCP; } else { - mtk_v4l2_err("Could not get vdec IPI device"); + dev_dbg(&pdev->dev, "Could not get vdec IPI device"); return -ENODEV; } dma_set_max_seg_size(&pdev->dev, UINT_MAX); @@ -316,7 +311,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) alloc_ordered_workqueue("core-decoder", WQ_MEM_RECLAIM | WQ_FREEZABLE); if (!dev->core_workqueue) { - mtk_v4l2_err("Failed to create core workqueue"); + dev_dbg(&pdev->dev, "Failed to create core workqueue"); ret = -EINVAL; goto err_res; } @@ -332,13 +327,13 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) { - mtk_v4l2_err("v4l2_device_register err=%d", ret); + dev_err(&pdev->dev, "v4l2_device_register err=%d", ret); goto err_core_workq; } vfd_dec = video_device_alloc(); if (!vfd_dec) { - mtk_v4l2_err("Failed to allocate video device"); + dev_err(&pdev->dev, "Failed to allocate video device"); ret = -ENOMEM; goto err_dec_alloc; } @@ -359,7 +354,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) dev->m2m_dev_dec = v4l2_m2m_init(&mtk_vdec_m2m_ops); if (IS_ERR((__force void *)dev->m2m_dev_dec)) { - mtk_v4l2_err("Failed to init mem2mem dec device"); + dev_err(&pdev->dev, "Failed to init mem2mem dec device"); ret = PTR_ERR((__force void *)dev->m2m_dev_dec); goto err_dec_alloc; } @@ -368,7 +363,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) alloc_ordered_workqueue(MTK_VCODEC_DEC_NAME, WQ_MEM_RECLAIM | WQ_FREEZABLE); if (!dev->decode_workqueue) { - mtk_v4l2_err("Failed to create decode workqueue"); + dev_err(&pdev->dev, "Failed to create decode workqueue"); ret = -EINVAL; goto err_event_workq; } @@ -377,7 +372,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); if (ret) { - mtk_v4l2_err("Main device of_platform_populate failed."); + dev_err(&pdev->dev, "Main device of_platform_populate failed."); goto err_reg_cont; } } else { @@ -390,7 +385,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = video_register_device(vfd_dec, VFL_TYPE_VIDEO, -1); if (ret) { - mtk_v4l2_err("Failed to register video device"); + dev_err(&pdev->dev, "Failed to register video device"); goto err_reg_cont; } @@ -409,21 +404,21 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = v4l2_m2m_register_media_controller(dev->m2m_dev_dec, dev->vfd_dec, MEDIA_ENT_F_PROC_VIDEO_DECODER); if (ret) { - mtk_v4l2_err("Failed to register media controller"); + dev_err(&pdev->dev, "Failed to register media controller"); goto err_dec_mem_init; } ret = media_device_register(&dev->mdev_dec); if (ret) { - mtk_v4l2_err("Failed to register media device"); + dev_err(&pdev->dev, "Failed to register media device"); goto err_media_reg; } - mtk_v4l2_debug(0, "media registered as /dev/media%d", vfd_dec->minor); + dev_dbg(&pdev->dev, "media registered as /dev/media%d", vfd_dec->minor); } mtk_vcodec_dbgfs_init(dev, false); - mtk_v4l2_debug(0, "decoder registered as /dev/video%d", vfd_dec->minor); + dev_dbg(&pdev->dev, "decoder registered as /dev/video%d", vfd_dec->minor); return 0; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c index e1cb2f8dca33..7c4d8ec201e3 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c @@ -77,8 +77,7 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv) /* check if HW active or not */ cg_status = readl(dev->reg_base[VDEC_HW_SYS]); if (cg_status & VDEC_HW_ACTIVE) { - mtk_v4l2_err("vdec active is not 0x0 (0x%08x)", - cg_status); + mtk_v4l2_vdec_err(ctx, "vdec active is not 0x0 (0x%08x)", cg_status); return IRQ_HANDLED; } @@ -93,8 +92,8 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv) wake_up_ctx(ctx, MTK_INST_IRQ_RECEIVED, dev->hw_idx); - mtk_v4l2_debug(3, "wake up ctx %d, dec_done_status=%x", - ctx->id, dec_done_status); + mtk_v4l2_vdec_dbg(3, ctx, "wake up ctx %d, dec_done_status=%x", + ctx->id, dec_done_status); return IRQ_HANDLED; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c index 777d445999e9..3ab996705b97 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c @@ -32,7 +32,7 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm * if (!dec_clk->clk_info) return -ENOMEM; } else { - mtk_v4l2_err("Failed to get vdec clock count"); + dev_err(&pdev->dev, "Failed to get vdec clock count"); return -EINVAL; } @@ -41,14 +41,13 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm * ret = of_property_read_string_index(pdev->dev.of_node, "clock-names", i, &clk_info->clk_name); if (ret) { - mtk_v4l2_err("Failed to get clock name id = %d", i); + dev_err(&pdev->dev, "Failed to get clock name id = %d", i); return ret; } clk_info->vcodec_clk = devm_clk_get(&pdev->dev, clk_info->clk_name); if (IS_ERR(clk_info->vcodec_clk)) { - mtk_v4l2_err("devm_clk_get (%d)%s fail", i, - clk_info->clk_name); + dev_err(&pdev->dev, "devm_clk_get (%d)%s fail", i, clk_info->clk_name); return PTR_ERR(clk_info->vcodec_clk); } } @@ -63,7 +62,7 @@ static int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) ret = pm_runtime_resume_and_get(pm->dev); if (ret) - mtk_v4l2_err("pm_runtime_resume_and_get fail %d", ret); + dev_err(pm->dev, "pm_runtime_resume_and_get fail %d", ret); return ret; } @@ -74,7 +73,7 @@ static void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm) ret = pm_runtime_put(pm->dev); if (ret && ret != -EAGAIN) - mtk_v4l2_err("pm_runtime_put fail %d", ret); + dev_err(pm->dev, "pm_runtime_put fail %d", ret); } static void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm) @@ -86,7 +85,7 @@ static void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm) for (i = 0; i < dec_clk->clk_num; i++) { ret = clk_prepare_enable(dec_clk->clk_info[i].vcodec_clk); if (ret) { - mtk_v4l2_err("clk_prepare_enable %d %s fail %d", i, + dev_err(pm->dev, "clk_prepare_enable %d %s fail %d", i, dec_clk->clk_info[i].clk_name, ret); goto error; } @@ -120,7 +119,7 @@ static void mtk_vcodec_dec_enable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_id if (subdev_dev) enable_irq(subdev_dev->dec_irq); else - mtk_v4l2_err("Failed to get hw dev\n"); + dev_err(&vdec_dev->plat_dev->dev, "Failed to get hw dev\n"); } else { enable_irq(vdec_dev->dec_irq); } @@ -138,7 +137,7 @@ static void mtk_vcodec_dec_disable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_i if (subdev_dev) disable_irq(subdev_dev->dec_irq); else - mtk_v4l2_err("Failed to get hw dev\n"); + dev_err(&vdec_dev->plat_dev->dev, "Failed to get hw dev\n"); } else { disable_irq(vdec_dev->dec_irq); } @@ -185,7 +184,7 @@ static struct mtk_vcodec_pm *mtk_vcodec_dec_get_pm(struct mtk_vcodec_dev *vdec_d if (subdev_dev) return &subdev_dev->pm; - mtk_v4l2_err("Failed to get hw dev\n"); + dev_err(&vdec_dev->plat_dev->dev, "Failed to get hw dev\n"); return NULL; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c index 0fbd030026c7..3c289b08bc87 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c @@ -61,15 +61,16 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx) struct mtk_video_dec_buf *dstbuf; struct vb2_v4l2_buffer *vb; - mtk_v4l2_debug(3, "[%d]", ctx->id); + mtk_v4l2_vdec_dbg(3, ctx, "[%d]", ctx->id); if (vdec_if_get_param(ctx, GET_PARAM_DISP_FRAME_BUFFER, &disp_frame_buffer)) { - mtk_v4l2_err("[%d]Cannot get param : GET_PARAM_DISP_FRAME_BUFFER", ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d]Cannot get param : GET_PARAM_DISP_FRAME_BUFFER", + ctx->id); return NULL; } if (!disp_frame_buffer) { - mtk_v4l2_debug(3, "No display frame buffer"); + mtk_v4l2_vdec_dbg(3, ctx, "No display frame buffer"); return NULL; } @@ -78,9 +79,9 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx) vb = &dstbuf->m2m_buf.vb; mutex_lock(&ctx->lock); if (dstbuf->used) { - mtk_v4l2_debug(2, "[%d]status=%x queue id=%d to done_list %d", - ctx->id, disp_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2); + mtk_v4l2_vdec_dbg(2, ctx, "[%d]status=%x queue id=%d to done_list %d", + ctx->id, disp_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2); v4l2_m2m_buf_done(vb, VB2_BUF_STATE_DONE); ctx->decoded_frame_cnt++; @@ -105,16 +106,16 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx) if (vdec_if_get_param(ctx, GET_PARAM_FREE_FRAME_BUFFER, &free_frame_buffer)) { - mtk_v4l2_err("[%d] Error!! Cannot get param", ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d] Error!! Cannot get param", ctx->id); return NULL; } if (!free_frame_buffer) { - mtk_v4l2_debug(3, " No free frame buffer"); + mtk_v4l2_vdec_dbg(3, ctx, " No free frame buffer"); return NULL; } - mtk_v4l2_debug(3, "[%d] tmp_frame_addr = 0x%p", ctx->id, - free_frame_buffer); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] tmp_frame_addr = 0x%p", ctx->id, + free_frame_buffer); dstbuf = container_of(free_frame_buffer, struct mtk_video_dec_buf, frame_buffer); @@ -131,9 +132,9 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx) * This reduce overheads that dq/q unused capture * buffer. In this case, queued_in_vb2 = true. */ - mtk_v4l2_debug(2, "[%d]status=%x queue id=%d to rdy_queue %d", - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2); + mtk_v4l2_vdec_dbg(2, ctx, "[%d]status=%x queue id=%d to rdy_queue %d", + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2); v4l2_m2m_buf_queue(ctx->m2m_ctx, vb); } else if (!dstbuf->queued_in_vb2 && dstbuf->queued_in_v4l2) { /* @@ -146,10 +147,10 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx) * means this buffer is not from previous decode * output. */ - mtk_v4l2_debug(2, - "[%d]status=%x queue id=%d to rdy_queue", - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index); + mtk_v4l2_vdec_dbg(2, ctx, + "[%d]status=%x queue id=%d to rdy_queue", + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index); v4l2_m2m_buf_queue(ctx->m2m_ctx, vb); dstbuf->queued_in_vb2 = true; } else { @@ -161,10 +162,10 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx) * When this buffer q from user space, it could * directly q to vb2 buffer */ - mtk_v4l2_debug(3, "[%d]status=%x err queue id=%d %d %d", - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2, - dstbuf->queued_in_v4l2); + mtk_v4l2_vdec_dbg(3, ctx, "[%d]status=%x err queue id=%d %d %d", + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2, + dstbuf->queued_in_v4l2); } dstbuf->used = false; } @@ -191,7 +192,7 @@ static void mtk_vdec_queue_res_chg_event(struct mtk_vcodec_ctx *ctx) .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, }; - mtk_v4l2_debug(1, "[%d]", ctx->id); + mtk_v4l2_vdec_dbg(1, ctx, "[%d]", ctx->id); v4l2_event_queue_fh(&ctx->fh, &ev_src_ch); } @@ -202,7 +203,7 @@ static int mtk_vdec_flush_decoder(struct mtk_vcodec_ctx *ctx) ret = vdec_if_decode(ctx, NULL, NULL, &res_chg); if (ret) - mtk_v4l2_err("DecodeFinal failed, ret=%d", ret); + mtk_v4l2_vdec_err(ctx, "DecodeFinal failed, ret=%d", ret); clean_display_buffer(ctx); clean_free_buffer(ctx); @@ -221,14 +222,14 @@ static void mtk_vdec_update_fmt(struct mtk_vcodec_ctx *ctx, for (k = 0; k < num_supported_formats; k++) { fmt = &mtk_video_formats[k]; if (fmt->fourcc == pixelformat) { - mtk_v4l2_debug(1, "Update cap fourcc(%d -> %d)", - dst_q_data->fmt->fourcc, pixelformat); + mtk_v4l2_vdec_dbg(1, ctx, "Update cap fourcc(%d -> %d)", + dst_q_data->fmt->fourcc, pixelformat); dst_q_data->fmt = fmt; return; } } - mtk_v4l2_err("Cannot get fourcc(%d), using init value", pixelformat); + mtk_v4l2_vdec_err(ctx, "Cannot get fourcc(%d), using init value", pixelformat); } static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx) @@ -238,7 +239,8 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx) if (vdec_if_get_param(ctx, GET_PARAM_PIC_INFO, &ctx->last_decoded_picinfo)) { - mtk_v4l2_err("[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR", ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR", + ctx->id); return -EINVAL; } @@ -246,7 +248,7 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx) ctx->last_decoded_picinfo.pic_h == 0 || ctx->last_decoded_picinfo.buf_w == 0 || ctx->last_decoded_picinfo.buf_h == 0) { - mtk_v4l2_err("Cannot get correct pic info"); + mtk_v4l2_vdec_err(ctx, "Cannot get correct pic info"); return -EINVAL; } @@ -258,15 +260,15 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx) ctx->last_decoded_picinfo.pic_h == ctx->picinfo.pic_h) return 0; - mtk_v4l2_debug(1, "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)", ctx->id, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w, - ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w, - ctx->last_decoded_picinfo.buf_h); + mtk_v4l2_vdec_dbg(1, ctx, "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)", ctx->id, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w, + ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret = vdec_if_get_param(ctx, GET_PARAM_DPB_SIZE, &dpbsize); if (dpbsize == 0) - mtk_v4l2_err("Incorrect dpb size, ret=%d", ret); + mtk_v4l2_vdec_err(ctx, "Incorrect dpb size, ret=%d", ret); ctx->dpb_size = dpbsize; @@ -288,14 +290,14 @@ static void mtk_vdec_worker(struct work_struct *work) src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx); if (!src_buf) { v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx); - mtk_v4l2_debug(1, "[%d] src_buf empty!!", ctx->id); + mtk_v4l2_vdec_dbg(1, ctx, "[%d] src_buf empty!!", ctx->id); return; } dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx); if (!dst_buf) { v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx); - mtk_v4l2_debug(1, "[%d] dst_buf empty!!", ctx->id); + mtk_v4l2_vdec_dbg(1, ctx, "[%d] dst_buf empty!!", ctx->id); return; } @@ -313,15 +315,15 @@ static void mtk_vdec_worker(struct work_struct *work) vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 1); pfb->base_c.size = ctx->picinfo.fb_sz[1]; pfb->status = 0; - mtk_v4l2_debug(3, "===>[%d] vdec_if_decode() ===>", ctx->id); + mtk_v4l2_vdec_dbg(3, ctx, "===>[%d] vdec_if_decode() ===>", ctx->id); - mtk_v4l2_debug(3, - "id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx", - dst_buf->vb2_buf.index, pfb, pfb->base_y.va, - &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb->base_y.size); + mtk_v4l2_vdec_dbg(3, ctx, + "id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx", + dst_buf->vb2_buf.index, pfb, pfb->base_y.va, + &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb->base_y.size); if (src_buf == &ctx->empty_flush_buf.vb) { - mtk_v4l2_debug(1, "Got empty flush input buffer."); + mtk_v4l2_vdec_dbg(1, ctx, "Got empty flush input buffer."); src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx); /* update dst buf status */ @@ -350,12 +352,12 @@ static void mtk_vdec_worker(struct work_struct *work) buf.size = (size_t)src_buf->vb2_buf.planes[0].bytesused; if (!buf.va) { v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx); - mtk_v4l2_err("[%d] id=%d src_addr is NULL!!", ctx->id, - src_buf->vb2_buf.index); + mtk_v4l2_vdec_err(ctx, "[%d] id=%d src_addr is NULL!!", ctx->id, + src_buf->vb2_buf.index); return; } - mtk_v4l2_debug(3, "[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p", - ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p", + ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf); dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp; dst_buf->timecode = src_buf->timecode; mutex_lock(&ctx->lock); @@ -366,9 +368,10 @@ static void mtk_vdec_worker(struct work_struct *work) ret = vdec_if_decode(ctx, &buf, pfb, &res_chg); if (ret) { - mtk_v4l2_err(" <===[%d], src_buf[%d] sz=0x%zx pts=%llu dst_buf[%d] vdec_if_decode() ret=%d res_chg=%d===>", - ctx->id, src_buf->vb2_buf.index, buf.size, - src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret, res_chg); + mtk_v4l2_vdec_err(ctx, + "[%d] decode src[%d] sz=0x%zx pts=%llu dst[%d] ret=%d res_chg=%d", + ctx->id, src_buf->vb2_buf.index, buf.size, + src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret, res_chg); src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx); if (ret == -EIO) { mutex_lock(&ctx->lock); @@ -421,8 +424,8 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) struct vb2_v4l2_buffer *vb2_v4l2; struct mtk_q_data *dst_q_data; - mtk_v4l2_debug(3, "[%d] (%d) id=%d, vb=%p", ctx->id, - vb->vb2_queue->type, vb->index, vb); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) id=%d, vb=%p", ctx->id, + vb->vb2_queue->type, vb->index, vb); /* * check if this buffer is ready to be used after decode */ @@ -448,20 +451,19 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->m2m_ctx, to_vb2_v4l2_buffer(vb)); if (ctx->state != MTK_STATE_INIT) { - mtk_v4l2_debug(3, "[%d] already init driver %d", ctx->id, - ctx->state); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] already init driver %d", ctx->id, ctx->state); return; } src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx); if (!src_buf) { - mtk_v4l2_err("No src buffer"); + mtk_v4l2_vdec_err(ctx, "No src buffer"); return; } if (src_buf == &ctx->empty_flush_buf.vb) { /* This shouldn't happen. Just in case. */ - mtk_v4l2_err("Invalid flush buffer."); + mtk_v4l2_vdec_err(ctx, "Invalid flush buffer."); v4l2_m2m_src_buf_remove(ctx->m2m_ctx); return; } @@ -469,9 +471,8 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) src_mem.va = vb2_plane_vaddr(&src_buf->vb2_buf, 0); src_mem.dma_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); src_mem.size = (size_t)src_buf->vb2_buf.planes[0].bytesused; - mtk_v4l2_debug(2, "[%d] buf id=%d va=%p dma=%pad size=%zx", ctx->id, - src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr, - src_mem.size); + mtk_v4l2_vdec_dbg(2, ctx, "[%d] buf id=%d va=%p dma=%pad size=%zx", ctx->id, + src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr, src_mem.size); ret = vdec_if_decode(ctx, &src_mem, NULL, &res_chg); if (ret || !res_chg) { @@ -484,20 +485,22 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx); if (ret == -EIO) { - mtk_v4l2_err("[%d] Unrecoverable error in vdec_if_decode.", ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d] Unrecoverable error in vdec_if_decode.", + ctx->id); ctx->state = MTK_STATE_ABORT; v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); } else { v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); } - mtk_v4l2_debug(ret ? 0 : 1, - "[%d] vdec_if_decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d", - ctx->id, src_buf->vb2_buf.index, src_mem.size, ret, res_chg); + mtk_v4l2_vdec_dbg(ret ? 0 : 1, ctx, + "[%d] decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d", + ctx->id, src_buf->vb2_buf.index, src_mem.size, ret, res_chg); return; } if (vdec_if_get_param(ctx, GET_PARAM_PIC_INFO, &ctx->picinfo)) { - mtk_v4l2_err("[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR", ctx->id); + mtk_v4l2_vdec_err(ctx, "[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR", + ctx->id); return; } @@ -508,17 +511,17 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) dst_q_data->bytesperline[i] = ctx->picinfo.buf_w; } - mtk_v4l2_debug(2, "[%d] vdec_if_init() OK wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x", - ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx->picinfo.pic_w, - ctx->picinfo.pic_h, dst_q_data->sizeimage[0], dst_q_data->sizeimage[1]); + mtk_v4l2_vdec_dbg(2, ctx, "[%d] init OK wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x", + ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx->picinfo.pic_w, + ctx->picinfo.pic_h, dst_q_data->sizeimage[0], dst_q_data->sizeimage[1]); ret = vdec_if_get_param(ctx, GET_PARAM_DPB_SIZE, &dpbsize); if (dpbsize == 0) - mtk_v4l2_err("[%d] GET_PARAM_DPB_SIZE fail=%d", ctx->id, ret); + mtk_v4l2_vdec_err(ctx, "[%d] GET_PARAM_DPB_SIZE fail=%d", ctx->id, ret); ctx->dpb_size = dpbsize; ctx->state = MTK_STATE_HEADER; - mtk_v4l2_debug(1, "[%d] dpbsize=%d", ctx->id, ctx->dpb_size); + mtk_v4l2_vdec_dbg(1, ctx, "[%d] dpbsize=%d", ctx->id, ctx->dpb_size); mtk_vdec_queue_res_chg_event(ctx); } @@ -533,7 +536,7 @@ static int mtk_vdec_g_v_ctrl(struct v4l2_ctrl *ctrl) if (ctx->state >= MTK_STATE_HEADER) { ctrl->val = ctx->dpb_size; } else { - mtk_v4l2_debug(0, "Seqinfo not ready"); + mtk_v4l2_vdec_dbg(0, ctx, "Seqinfo not ready"); ctrl->val = 0; } break; @@ -570,7 +573,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx) V4L2_MPEG_VIDEO_H264_PROFILE_MAIN); if (ctx->ctrl_hdl.error) { - mtk_v4l2_err("Adding control failed %d", ctx->ctrl_hdl.error); + mtk_v4l2_vdec_err(ctx, "Adding control failed %d", ctx->ctrl_hdl.error); return ctx->ctrl_hdl.error; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c index db1e14a1bd6c..f4f278d4bce3 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -232,10 +232,10 @@ static void mtk_vdec_stateless_cap_to_disp(struct mtk_vcodec_ctx *ctx, int error vb2_dst = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx); if (vb2_dst) { v4l2_m2m_buf_done(vb2_dst, state); - mtk_v4l2_debug(2, "free frame buffer id:%d to done list", - vb2_dst->vb2_buf.index); + mtk_v4l2_vdec_dbg(2, ctx, "free frame buffer id:%d to done list", + vb2_dst->vb2_buf.index); } else { - mtk_v4l2_err("dst buffer is NULL"); + mtk_v4l2_vdec_err(ctx, "dst buffer is NULL"); } if (src_buf_req) @@ -251,7 +251,7 @@ static struct vdec_fb *vdec_get_cap_buffer(struct mtk_vcodec_ctx *ctx) vb2_v4l2 = v4l2_m2m_next_dst_buf(ctx->m2m_ctx); if (!vb2_v4l2) { - mtk_v4l2_debug(1, "[%d] dst_buf empty!!", ctx->id); + mtk_v4l2_vdec_dbg(1, ctx, "[%d] dst_buf empty!!", ctx->id); return NULL; } @@ -269,9 +269,10 @@ static struct vdec_fb *vdec_get_cap_buffer(struct mtk_vcodec_ctx *ctx) vb2_dma_contig_plane_dma_addr(dst_buf, 1); pfb->base_c.size = ctx->q_data[MTK_Q_DATA_DST].sizeimage[1]; } - mtk_v4l2_debug(1, "id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx frame_count = %d", - dst_buf->index, pfb, pfb->base_y.va, &pfb->base_y.dma_addr, - &pfb->base_c.dma_addr, pfb->base_y.size, ctx->decoded_frame_cnt); + mtk_v4l2_vdec_dbg(1, ctx, + "id=%d Framebuf pfb=%p VA=%p Y/C_DMA=%pad_%pad Sz=%zx frame_count = %d", + dst_buf->index, pfb, pfb->base_y.va, &pfb->base_y.dma_addr, + &pfb->base_c.dma_addr, pfb->base_y.size, ctx->decoded_frame_cnt); return pfb; } @@ -300,7 +301,7 @@ static void mtk_vdec_worker(struct work_struct *work) vb2_v4l2_src = v4l2_m2m_next_src_buf(ctx->m2m_ctx); if (!vb2_v4l2_src) { v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx); - mtk_v4l2_debug(1, "[%d] no available source buffer", ctx->id); + mtk_v4l2_vdec_dbg(1, ctx, "[%d] no available source buffer", ctx->id); return; } @@ -309,33 +310,34 @@ static void mtk_vdec_worker(struct work_struct *work) m2m_buf.vb); bs_src = &dec_buf_src->bs_buffer; - mtk_v4l2_debug(3, "[%d] (%d) id=%d, vb=%p", ctx->id, - vb2_src->vb2_queue->type, vb2_src->index, vb2_src); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) id=%d, vb=%p", ctx->id, + vb2_src->vb2_queue->type, vb2_src->index, vb2_src); bs_src->va = vb2_plane_vaddr(vb2_src, 0); bs_src->dma_addr = vb2_dma_contig_plane_dma_addr(vb2_src, 0); bs_src->size = (size_t)vb2_src->planes[0].bytesused; if (!bs_src->va) { v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx); - mtk_v4l2_err("[%d] id=%d source buffer is NULL", ctx->id, - vb2_src->index); + mtk_v4l2_vdec_err(ctx, "[%d] id=%d source buffer is NULL", ctx->id, + vb2_src->index); return; } - mtk_v4l2_debug(3, "[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p", - ctx->id, bs_src->va, &bs_src->dma_addr, bs_src->size, vb2_src); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p", + ctx->id, bs_src->va, &bs_src->dma_addr, bs_src->size, vb2_src); /* Apply request controls. */ src_buf_req = vb2_src->req_obj.req; if (src_buf_req) v4l2_ctrl_request_setup(src_buf_req, &ctx->ctrl_hdl); else - mtk_v4l2_err("vb2 buffer media request is NULL"); + mtk_v4l2_vdec_err(ctx, "vb2 buffer media request is NULL"); ret = vdec_if_decode(ctx, bs_src, NULL, &res_chg); if (ret && ret != -EAGAIN) { - mtk_v4l2_err(" <===[%d], src_buf[%d] sz=0x%zx pts=%llu vdec_if_decode() ret=%d res_chg=%d===>", - ctx->id, vb2_src->index, bs_src->size, - vb2_src->timestamp, ret, res_chg); + mtk_v4l2_vdec_err(ctx, + "[%d] decode src_buf[%d] sz=0x%zx pts=%llu ret=%d res_chg=%d", + ctx->id, vb2_src->index, bs_src->size, + vb2_src->timestamp, ret, res_chg); if (ret == -EIO) { mutex_lock(&ctx->lock); dec_buf_src->error = true; @@ -363,7 +365,8 @@ static void vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb) struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); struct vb2_v4l2_buffer *vb2_v4l2 = to_vb2_v4l2_buffer(vb); - mtk_v4l2_debug(3, "[%d] (%d) id=%d, vb=%p", ctx->id, vb->vb2_queue->type, vb->index, vb); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) id=%d, vb=%p", ctx->id, vb->vb2_queue->type, + vb->index, vb); mutex_lock(&ctx->lock); v4l2_m2m_buf_queue(ctx->m2m_ctx, vb2_v4l2); @@ -374,9 +377,9 @@ static void vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb) /* If an OUTPUT buffer, we may need to update the state */ if (ctx->state == MTK_STATE_INIT) { ctx->state = MTK_STATE_HEADER; - mtk_v4l2_debug(1, "Init driver from init to header."); + mtk_v4l2_vdec_dbg(1, ctx, "Init driver from init to header."); } else { - mtk_v4l2_debug(3, "[%d] already init driver %d", ctx->id, ctx->state); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] already init driver %d", ctx->id, ctx->state); } } @@ -393,7 +396,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx) v4l2_ctrl_handler_init(&ctx->ctrl_hdl, NUM_CTRLS); if (ctx->ctrl_hdl.error) { - mtk_v4l2_err("v4l2_ctrl_handler_init failed\n"); + mtk_v4l2_vdec_err(ctx, "v4l2_ctrl_handler_init failed\n"); return ctx->ctrl_hdl.error; } @@ -402,7 +405,8 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx) v4l2_ctrl_new_custom(&ctx->ctrl_hdl, &cfg, NULL); if (ctx->ctrl_hdl.error) { - mtk_v4l2_err("Adding control %d failed %d", i, ctx->ctrl_hdl.error); + mtk_v4l2_vdec_err(ctx, "Adding control %d failed %d", i, + ctx->ctrl_hdl.error); return ctx->ctrl_hdl.error; } } @@ -421,11 +425,11 @@ static int fops_media_request_validate(struct media_request *mreq) /* We expect exactly one buffer with the request */ break; case 0: - mtk_v4l2_debug(1, "No buffer provided with the request"); + pr_debug(MTK_DBG_VCODEC_STR "No buffer provided with the request."); return -ENOENT; default: - mtk_v4l2_debug(1, "Too many buffers (%d) provided with the request", - buffer_cnt); + pr_debug(MTK_DBG_VCODEC_STR "Too many buffers (%d) provided with the request.", + buffer_cnt); return -EINVAL; } @@ -470,13 +474,13 @@ static void mtk_vcodec_add_formats(unsigned int fourcc, mtk_video_formats[count_formats].num_planes = 2; break; default: - mtk_v4l2_err("Can not add unsupported format type"); + mtk_v4l2_vdec_err(ctx, "Can not add unsupported format type"); return; } num_formats++; - mtk_v4l2_debug(3, "num_formats: %d dec_capability: 0x%x", - count_formats, ctx->dev->dec_capability); + mtk_v4l2_vdec_dbg(3, ctx, "num_formats: %d dec_capability: 0x%x", + count_formats, ctx->dev->dec_capability); } static void mtk_vcodec_get_supported_formats(struct mtk_vcodec_ctx *ctx) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c index 9ff439a50f53..276da79d98e7 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c @@ -51,63 +51,53 @@ static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl->id) { case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_BITRATE_MODE val= %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_BITRATE_MODE val= %d", ctrl->val); if (ctrl->val != V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) { - mtk_v4l2_err("Unsupported bitrate mode =%d", ctrl->val); + mtk_v4l2_venc_err(ctx, "Unsupported bitrate mode =%d", ctrl->val); ret = -EINVAL; } break; case V4L2_CID_MPEG_VIDEO_BITRATE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_BITRATE val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_BITRATE val = %d", ctrl->val); p->bitrate = ctrl->val; ctx->param_change |= MTK_ENCODE_PARAM_BITRATE; break; case V4L2_CID_MPEG_VIDEO_B_FRAMES: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_B_FRAMES val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_B_FRAMES val = %d", ctrl->val); p->num_b_frame = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE val = %d", + ctrl->val); p->rc_frame = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_MAX_QP: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_MAX_QP val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_H264_MAX_QP val = %d", ctrl->val); p->h264_max_qp = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_HEADER_MODE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_HEADER_MODE val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_HEADER_MODE val = %d", ctrl->val); p->seq_hdr_mode = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE val = %d", ctrl->val); p->rc_mb = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_PROFILE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_PROFILE val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_H264_PROFILE val = %d", ctrl->val); p->h264_profile = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_LEVEL val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_H264_LEVEL val = %d", ctrl->val); p->h264_level = ctrl->val; break; case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_I_PERIOD val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_H264_I_PERIOD val = %d", ctrl->val); p->intra_period = ctrl->val; ctx->param_change |= MTK_ENCODE_PARAM_INTRA_PERIOD; break; case V4L2_CID_MPEG_VIDEO_GOP_SIZE: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_GOP_SIZE val = %d", - ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_GOP_SIZE val = %d", ctrl->val); p->gop_size = ctrl->val; ctx->param_change |= MTK_ENCODE_PARAM_GOP_SIZE; break; @@ -116,10 +106,10 @@ static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl) * FIXME - what vp8 profiles are actually supported? * The ctrl is added (with only profile 0 supported) for now. */ - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_VP8_PROFILE val = %d", ctrl->val); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_VP8_PROFILE val = %d", ctrl->val); break; case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME: - mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME"); + mtk_v4l2_venc_dbg(2, ctx, "V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME"); p->force_intra = 1; ctx->param_change |= MTK_ENCODE_PARAM_FORCE_INTRA; break; @@ -341,11 +331,12 @@ static int vidioc_try_fmt_out(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f, if (pix_fmt_mp->height < tmp_h && (pix_fmt_mp->height + 32) <= max_height) pix_fmt_mp->height += 32; - mtk_v4l2_debug(0, "before resize w=%d, h=%d, after resize w=%d, h=%d, sizeimage=%d %d", - tmp_w, tmp_h, pix_fmt_mp->width, - pix_fmt_mp->height, - pix_fmt_mp->plane_fmt[0].sizeimage, - pix_fmt_mp->plane_fmt[1].sizeimage); + mtk_v4l2_venc_dbg(0, ctx, + "before resize wxh=%dx%d, after resize wxh=%dx%d, sizeimage=%d %d", + tmp_w, tmp_h, pix_fmt_mp->width, + pix_fmt_mp->height, + pix_fmt_mp->plane_fmt[0].sizeimage, + pix_fmt_mp->plane_fmt[1].sizeimage); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage = @@ -396,7 +387,7 @@ static void mtk_venc_set_param(struct mtk_vcodec_ctx *ctx, param->input_yuv_fmt = VENC_YUV_FORMAT_NV21; break; default: - mtk_v4l2_err("Unsupported fourcc =%d", q_data_src->fmt->fourcc); + mtk_v4l2_venc_err(ctx, "Unsupported fourcc =%d", q_data_src->fmt->fourcc); break; } param->h264_profile = enc_params->h264_profile; @@ -414,13 +405,13 @@ static void mtk_venc_set_param(struct mtk_vcodec_ctx *ctx, param->gop_size = enc_params->gop_size; param->bitrate = enc_params->bitrate; - mtk_v4l2_debug(0, - "fmt 0x%x, P/L %d/%d, w/h %d/%d, buf %d/%d, fps/bps %d/%d, gop %d, i_period %d", - param->input_yuv_fmt, param->h264_profile, - param->h264_level, param->width, param->height, - param->buf_width, param->buf_height, - param->frm_rate, param->bitrate, - param->gop_size, param->intra_period); + mtk_v4l2_venc_dbg(0, ctx, + "fmt 0x%x, P/L %d/%d w/h %d/%d buf %d/%d fps/bps %d/%d gop %d i_per %d", + param->input_yuv_fmt, param->h264_profile, + param->h264_level, param->width, param->height, + param->buf_width, param->buf_height, + param->frm_rate, param->bitrate, + param->gop_size, param->intra_period); } static int vidioc_venc_s_fmt_cap(struct file *file, void *priv, @@ -435,12 +426,12 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv, vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { - mtk_v4l2_err("fail to get vq"); + mtk_v4l2_venc_err(ctx, "fail to get vq"); return -EINVAL; } if (vb2_is_busy(vq)) { - mtk_v4l2_err("queue busy"); + mtk_v4l2_venc_err(ctx, "queue busy"); return -EBUSY; } @@ -468,8 +459,8 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv, if (ctx->state == MTK_STATE_FREE) { ret = venc_if_init(ctx, q_data->fmt->fourcc); if (ret) { - mtk_v4l2_err("venc_if_init failed=%d, codec type=%x", - ret, q_data->fmt->fourcc); + mtk_v4l2_venc_err(ctx, "venc_if_init failed=%d, codec type=%x", + ret, q_data->fmt->fourcc); return -EBUSY; } ctx->state = MTK_STATE_INIT; @@ -490,12 +481,12 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { - mtk_v4l2_err("fail to get vq"); + mtk_v4l2_venc_err(ctx, "fail to get vq"); return -EINVAL; } if (vb2_is_busy(vq)) { - mtk_v4l2_err("queue busy"); + mtk_v4l2_venc_err(ctx, "queue busy"); return -EBUSY; } @@ -670,8 +661,8 @@ static int vidioc_venc_qbuf(struct file *file, void *priv, struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); if (ctx->state == MTK_STATE_ABORT) { - mtk_v4l2_err("[%d] Call on QBUF after unrecoverable error", - ctx->id); + mtk_v4l2_venc_err(ctx, "[%d] Call on QBUF after unrecoverable error", + ctx->id); return -EIO; } @@ -685,8 +676,8 @@ static int vidioc_venc_dqbuf(struct file *file, void *priv, int ret; if (ctx->state == MTK_STATE_ABORT) { - mtk_v4l2_err("[%d] Call on QBUF after unrecoverable error", - ctx->id); + mtk_v4l2_venc_err(ctx, "[%d] Call on QBUF after unrecoverable error", + ctx->id); return -EIO; } @@ -724,8 +715,8 @@ static int vidioc_encoder_cmd(struct file *file, void *priv, int ret; if (ctx->state == MTK_STATE_ABORT) { - mtk_v4l2_err("[%d] Call to CMD after unrecoverable error", - ctx->id); + mtk_v4l2_venc_err(ctx, "[%d] Call to CMD after unrecoverable error", + ctx->id); return -EIO; } @@ -737,7 +728,7 @@ static int vidioc_encoder_cmd(struct file *file, void *priv, if (ctx->is_flushing) return -EBUSY; - mtk_v4l2_debug(1, "encoder cmd=%u", cmd->cmd); + mtk_v4l2_venc_dbg(1, ctx, "encoder cmd=%u", cmd->cmd); dst_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); @@ -746,11 +737,11 @@ static int vidioc_encoder_cmd(struct file *file, void *priv, src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); if (!vb2_is_streaming(src_vq)) { - mtk_v4l2_debug(1, "Output stream is off. No need to flush."); + mtk_v4l2_venc_dbg(1, ctx, "Output stream is off. No need to flush."); return 0; } if (!vb2_is_streaming(dst_vq)) { - mtk_v4l2_debug(1, "Capture stream is off. No need to flush."); + mtk_v4l2_venc_dbg(1, ctx, "Capture stream is off. No need to flush."); return 0; } ctx->is_flushing = true; @@ -841,9 +832,8 @@ static int vb2ops_venc_buf_prepare(struct vb2_buffer *vb) for (i = 0; i < q_data->fmt->num_planes; i++) { if (vb2_plane_size(vb, i) < q_data->sizeimage[i]) { - mtk_v4l2_err("data will not fit into plane %d (%lu < %d)", - i, vb2_plane_size(vb, i), - q_data->sizeimage[i]); + mtk_v4l2_venc_err(ctx, "data will not fit into plane %d (%lu < %d)", + i, vb2_plane_size(vb, i), q_data->sizeimage[i]); return -EINVAL; } } @@ -863,10 +853,8 @@ static void vb2ops_venc_buf_queue(struct vb2_buffer *vb) if ((vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) && (ctx->param_change != MTK_ENCODE_PARAM_NONE)) { - mtk_v4l2_debug(1, "[%d] Before id=%d encode parameter change %x", - ctx->id, - vb2_v4l2->vb2_buf.index, - ctx->param_change); + mtk_v4l2_venc_dbg(1, ctx, "[%d] Before id=%d encode parameter change %x", + ctx->id, vb2_v4l2->vb2_buf.index, ctx->param_change); mtk_buf->param_change = ctx->param_change; mtk_buf->enc_params = ctx->enc_params; ctx->param_change = MTK_ENCODE_PARAM_NONE; @@ -901,14 +889,14 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) ret = pm_runtime_resume_and_get(&ctx->dev->plat_dev->dev); if (ret < 0) { - mtk_v4l2_err("pm_runtime_resume_and_get fail %d", ret); + mtk_v4l2_venc_err(ctx, "pm_runtime_resume_and_get fail %d", ret); goto err_start_stream; } mtk_venc_set_param(ctx, ¶m); ret = venc_if_set_param(ctx, VENC_SET_PARAM_ENC, ¶m); if (ret) { - mtk_v4l2_err("venc_if_set_param failed=%d", ret); + mtk_v4l2_venc_err(ctx, "venc_if_set_param failed=%d", ret); ctx->state = MTK_STATE_ABORT; goto err_set_param; } @@ -921,7 +909,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) VENC_SET_PARAM_PREPEND_HEADER, NULL); if (ret) { - mtk_v4l2_err("venc_if_set_param failed=%d", ret); + mtk_v4l2_venc_err(ctx, "venc_if_set_param failed=%d", ret); ctx->state = MTK_STATE_ABORT; goto err_set_param; } @@ -933,7 +921,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) err_set_param: pm_ret = pm_runtime_put(&ctx->dev->plat_dev->dev); if (pm_ret < 0) - mtk_v4l2_err("pm_runtime_put fail %d", pm_ret); + mtk_v4l2_venc_err(ctx, "pm_runtime_put fail %d", pm_ret); err_start_stream: for (i = 0; i < q->num_buffers; ++i) { @@ -944,9 +932,8 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) * can be marked as done. */ if (buf && buf->state == VB2_BUF_STATE_ACTIVE) { - mtk_v4l2_debug(0, "[%d] id=%d, type=%d, %d -> VB2_BUF_STATE_QUEUED", - ctx->id, i, q->type, - (int)buf->state); + mtk_v4l2_venc_dbg(0, ctx, "[%d] id=%d, type=%d, %d->VB2_BUF_STATE_QUEUED", + ctx->id, i, q->type, (int)buf->state); v4l2_m2m_buf_done(to_vb2_v4l2_buffer(buf), VB2_BUF_STATE_QUEUED); } @@ -961,7 +948,7 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q) struct vb2_v4l2_buffer *src_buf, *dst_buf; int ret; - mtk_v4l2_debug(2, "[%d]-> type=%d", ctx->id, q->type); + mtk_v4l2_venc_dbg(2, ctx, "[%d]-> type=%d", ctx->id, q->type); if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { while ((dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx))) { @@ -972,7 +959,7 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q) if (ctx->is_flushing) { struct v4l2_m2m_buffer *b, *n; - mtk_v4l2_debug(1, "STREAMOFF called while flushing"); + mtk_v4l2_venc_dbg(1, ctx, "STREAMOFF called while flushing"); /* * STREAMOFF could be called before the flush buffer is * dequeued. Check whether empty flush buf is still in @@ -1006,21 +993,21 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q) vb2_is_streaming(&ctx->m2m_ctx->out_q_ctx.q)) || (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && vb2_is_streaming(&ctx->m2m_ctx->cap_q_ctx.q))) { - mtk_v4l2_debug(1, "[%d]-> q type %d out=%d cap=%d", - ctx->id, q->type, - vb2_is_streaming(&ctx->m2m_ctx->out_q_ctx.q), - vb2_is_streaming(&ctx->m2m_ctx->cap_q_ctx.q)); + mtk_v4l2_venc_dbg(1, ctx, "[%d]-> q type %d out=%d cap=%d", + ctx->id, q->type, + vb2_is_streaming(&ctx->m2m_ctx->out_q_ctx.q), + vb2_is_streaming(&ctx->m2m_ctx->cap_q_ctx.q)); return; } /* Release the encoder if both streams are stopped. */ ret = venc_if_deinit(ctx); if (ret) - mtk_v4l2_err("venc_if_deinit failed=%d", ret); + mtk_v4l2_venc_err(ctx, "venc_if_deinit failed=%d", ret); ret = pm_runtime_put(&ctx->dev->plat_dev->dev); if (ret < 0) - mtk_v4l2_err("pm_runtime_put fail %d", ret); + mtk_v4l2_venc_err(ctx, "pm_runtime_put fail %d", ret); ctx->state = MTK_STATE_FREE; } @@ -1054,7 +1041,7 @@ static int mtk_venc_encode_header(void *priv) dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx); if (!dst_buf) { - mtk_v4l2_debug(1, "No dst buffer"); + mtk_v4l2_venc_dbg(1, ctx, "No dst buffer"); return -EINVAL; } @@ -1062,12 +1049,10 @@ static int mtk_venc_encode_header(void *priv) bs_buf.dma_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); bs_buf.size = (size_t)dst_buf->vb2_buf.planes[0].length; - mtk_v4l2_debug(1, - "[%d] buf id=%d va=0x%p dma_addr=0x%llx size=%zu", - ctx->id, - dst_buf->vb2_buf.index, bs_buf.va, - (u64)bs_buf.dma_addr, - bs_buf.size); + mtk_v4l2_venc_dbg(1, ctx, + "[%d] buf id=%d va=0x%p dma_addr=0x%llx size=%zu", + ctx->id, dst_buf->vb2_buf.index, bs_buf.va, + (u64)bs_buf.dma_addr, bs_buf.size); ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_SEQUENCE_HEADER, @@ -1077,7 +1062,7 @@ static int mtk_venc_encode_header(void *priv) vb2_set_plane_payload(&dst_buf->vb2_buf, 0, 0); ctx->state = MTK_STATE_ABORT; v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); - mtk_v4l2_err("venc_if_encode failed=%d", ret); + mtk_v4l2_venc_err(ctx, "venc_if_encode failed=%d", ret); return -EINVAL; } src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx); @@ -1085,7 +1070,7 @@ static int mtk_venc_encode_header(void *priv) dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp; dst_buf->timecode = src_buf->timecode; } else { - mtk_v4l2_err("No timestamp for the header buffer."); + mtk_v4l2_venc_err(ctx, "No timestamp for the header buffer."); } ctx->state = MTK_STATE_HEADER; @@ -1114,10 +1099,8 @@ static int mtk_venc_param_change(struct mtk_vcodec_ctx *ctx) if (mtk_buf->param_change & MTK_ENCODE_PARAM_BITRATE) { enc_prm.bitrate = mtk_buf->enc_params.bitrate; - mtk_v4l2_debug(1, "[%d] id=%d, change param br=%d", - ctx->id, - vb2_v4l2->vb2_buf.index, - enc_prm.bitrate); + mtk_v4l2_venc_dbg(1, ctx, "[%d] id=%d, change param br=%d", + ctx->id, vb2_v4l2->vb2_buf.index, enc_prm.bitrate); ret |= venc_if_set_param(ctx, VENC_SET_PARAM_ADJUST_BITRATE, &enc_prm); @@ -1125,27 +1108,23 @@ static int mtk_venc_param_change(struct mtk_vcodec_ctx *ctx) if (!ret && mtk_buf->param_change & MTK_ENCODE_PARAM_FRAMERATE) { enc_prm.frm_rate = mtk_buf->enc_params.framerate_num / mtk_buf->enc_params.framerate_denom; - mtk_v4l2_debug(1, "[%d] id=%d, change param fr=%d", - ctx->id, - vb2_v4l2->vb2_buf.index, - enc_prm.frm_rate); + mtk_v4l2_venc_dbg(1, ctx, "[%d] id=%d, change param fr=%d", + ctx->id, vb2_v4l2->vb2_buf.index, enc_prm.frm_rate); ret |= venc_if_set_param(ctx, VENC_SET_PARAM_ADJUST_FRAMERATE, &enc_prm); } if (!ret && mtk_buf->param_change & MTK_ENCODE_PARAM_GOP_SIZE) { enc_prm.gop_size = mtk_buf->enc_params.gop_size; - mtk_v4l2_debug(1, "change param intra period=%d", - enc_prm.gop_size); + mtk_v4l2_venc_dbg(1, ctx, "change param intra period=%d", enc_prm.gop_size); ret |= venc_if_set_param(ctx, VENC_SET_PARAM_GOP_SIZE, &enc_prm); } if (!ret && mtk_buf->param_change & MTK_ENCODE_PARAM_FORCE_INTRA) { - mtk_v4l2_debug(1, "[%d] id=%d, change param force I=%d", - ctx->id, - vb2_v4l2->vb2_buf.index, - mtk_buf->enc_params.force_intra); + mtk_v4l2_venc_dbg(1, ctx, "[%d] id=%d, change param force I=%d", + ctx->id, vb2_v4l2->vb2_buf.index, + mtk_buf->enc_params.force_intra); if (mtk_buf->enc_params.force_intra) ret |= venc_if_set_param(ctx, VENC_SET_PARAM_FORCE_INTRA, @@ -1156,8 +1135,8 @@ static int mtk_venc_param_change(struct mtk_vcodec_ctx *ctx) if (ret) { ctx->state = MTK_STATE_ABORT; - mtk_v4l2_err("venc_if_set_param %d failed=%d", - mtk_buf->param_change, ret); + mtk_v4l2_venc_err(ctx, "venc_if_set_param %d failed=%d", + mtk_buf->param_change, ret); return -1; } @@ -1218,14 +1197,11 @@ static void mtk_venc_worker(struct work_struct *work) bs_buf.dma_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); bs_buf.size = (size_t)dst_buf->vb2_buf.planes[0].length; - mtk_v4l2_debug(2, - "Framebuf PA=%llx Size=0x%zx;PA=0x%llx Size=0x%zx;PA=0x%llx Size=%zu", - (u64)frm_buf.fb_addr[0].dma_addr, - frm_buf.fb_addr[0].size, - (u64)frm_buf.fb_addr[1].dma_addr, - frm_buf.fb_addr[1].size, - (u64)frm_buf.fb_addr[2].dma_addr, - frm_buf.fb_addr[2].size); + mtk_v4l2_venc_dbg(2, ctx, + "Framebuf PA=%llx Size=0x%zx;PA=0x%llx Size=0x%zx;PA=0x%llx Size=%zu", + (u64)frm_buf.fb_addr[0].dma_addr, frm_buf.fb_addr[0].size, + (u64)frm_buf.fb_addr[1].dma_addr, frm_buf.fb_addr[1].size, + (u64)frm_buf.fb_addr[2].dma_addr, frm_buf.fb_addr[2].size); ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_FRAME, &frm_buf, &bs_buf, &enc_result); @@ -1240,20 +1216,19 @@ static void mtk_venc_worker(struct work_struct *work) v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); vb2_set_plane_payload(&dst_buf->vb2_buf, 0, 0); v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); - mtk_v4l2_err("venc_if_encode failed=%d", ret); + mtk_v4l2_venc_err(ctx, "venc_if_encode failed=%d", ret); } else { v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); vb2_set_plane_payload(&dst_buf->vb2_buf, 0, enc_result.bs_size); v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE); - mtk_v4l2_debug(2, "venc_if_encode bs size=%d", - enc_result.bs_size); + mtk_v4l2_venc_dbg(2, ctx, "venc_if_encode bs size=%d", + enc_result.bs_size); } v4l2_m2m_job_finish(ctx->dev->m2m_dev_enc, ctx->m2m_ctx); - mtk_v4l2_debug(1, "<=== src_buf[%d] dst_buf[%d] venc_if_encode ret=%d Size=%u===>", - src_buf->vb2_buf.index, dst_buf->vb2_buf.index, ret, - enc_result.bs_size); + mtk_v4l2_venc_dbg(1, ctx, "<=== src_buf[%d] dst_buf[%d] venc_if_encode ret=%d Size=%u===>", + src_buf->vb2_buf.index, dst_buf->vb2_buf.index, ret, enc_result.bs_size); } static void m2mops_venc_device_run(void *priv) @@ -1277,8 +1252,7 @@ static int m2mops_venc_job_ready(void *m2m_priv) struct mtk_vcodec_ctx *ctx = m2m_priv; if (ctx->state == MTK_STATE_ABORT || ctx->state == MTK_STATE_FREE) { - mtk_v4l2_debug(3, "[%d]Not ready: state=0x%x.", - ctx->id, ctx->state); + mtk_v4l2_venc_dbg(3, ctx, "[%d]Not ready: state=0x%x.", ctx->id, ctx->state); return 0; } @@ -1413,8 +1387,7 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) if (handler->error) { - mtk_v4l2_err("Init control handler fail %d", - handler->error); + mtk_v4l2_venc_err(ctx, "Init control handler fail %d", handler->error); return handler->error; } @@ -1482,7 +1455,7 @@ void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx) int ret = venc_if_deinit(ctx); if (ret) - mtk_v4l2_err("venc_if_deinit failed=%d", ret); + mtk_v4l2_venc_err(ctx, "venc_if_deinit failed=%d", ret); ctx->state = MTK_STATE_FREE; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index 0db81e150b18..cb1dcbcb16bb 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -97,12 +97,11 @@ static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv) core_id = dev->venc_pdata->core_id; if (core_id < 0 || core_id >= NUM_MAX_VCODEC_REG_BASE) { - mtk_v4l2_err("Invalid core id: %d, ctx id: %d", - core_id, ctx->id); + mtk_v4l2_venc_err(ctx, "Invalid core id: %d, ctx id: %d", core_id, ctx->id); return IRQ_HANDLED; } - mtk_v4l2_debug(1, "id: %d, core id: %d", ctx->id, core_id); + mtk_v4l2_venc_dbg(1, ctx, "id: %d, core id: %d", ctx->id, core_id); addr = dev->reg_base[core_id] + MTK_VENC_IRQ_ACK_OFFSET; @@ -143,16 +142,14 @@ static int fops_vcodec_open(struct file *file) ctx->type = MTK_INST_ENCODER; ret = mtk_vcodec_enc_ctrls_setup(ctx); if (ret) { - mtk_v4l2_err("Failed to setup controls() (%d)", - ret); + mtk_v4l2_venc_err(ctx, "Failed to setup controls() (%d)", ret); goto err_ctrls_setup; } ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev_enc, ctx, &mtk_vcodec_enc_queue_init); if (IS_ERR((__force void *)ctx->m2m_ctx)) { ret = PTR_ERR((__force void *)ctx->m2m_ctx); - mtk_v4l2_err("Failed to v4l2_m2m_ctx_init() (%d)", - ret); + mtk_v4l2_venc_err(ctx, "Failed to v4l2_m2m_ctx_init() (%d)", ret); goto err_m2m_ctx_init; } src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx, @@ -171,23 +168,23 @@ static int fops_vcodec_open(struct file *file) * Return 0 if downloading firmware successfully, * otherwise it is failed */ - mtk_v4l2_err("vpu_load_firmware failed!"); + mtk_v4l2_venc_err(ctx, "vpu_load_firmware failed!"); goto err_load_fw; } dev->enc_capability = mtk_vcodec_fw_get_venc_capa(dev->fw_handler); - mtk_v4l2_debug(0, "encoder capability %x", dev->enc_capability); + mtk_v4l2_venc_dbg(0, ctx, "encoder capability %x", dev->enc_capability); } - mtk_v4l2_debug(2, "Create instance [%d]@%p m2m_ctx=%p ", - ctx->id, ctx, ctx->m2m_ctx); + mtk_v4l2_venc_dbg(2, ctx, "Create instance [%d]@%p m2m_ctx=%p ", + ctx->id, ctx, ctx->m2m_ctx); list_add(&ctx->list, &dev->ctx_list); mutex_unlock(&dev->dev_mutex); - mtk_v4l2_debug(0, "%s encoder [%d]", dev_name(&dev->plat_dev->dev), - ctx->id); + mtk_v4l2_venc_dbg(0, ctx, "%s encoder [%d]", dev_name(&dev->plat_dev->dev), + ctx->id); return ret; /* Deinit when failure occurred */ @@ -209,7 +206,7 @@ static int fops_vcodec_release(struct file *file) struct mtk_vcodec_dev *dev = video_drvdata(file); struct mtk_vcodec_ctx *ctx = fh_to_ctx(file->private_data); - mtk_v4l2_debug(1, "[%d] encoder", ctx->id); + mtk_v4l2_venc_dbg(1, ctx, "[%d] encoder", ctx->id); mutex_lock(&dev->dev_mutex); v4l2_m2m_ctx_release(ctx->m2m_ctx); @@ -255,7 +252,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) &rproc_phandle)) { fw_type = SCP; } else { - mtk_v4l2_err("Could not get venc IPI device"); + dev_err(&pdev->dev, "[MTK VCODEC] Could not get venc IPI device"); return -ENODEV; } dma_set_max_seg_size(&pdev->dev, UINT_MAX); @@ -267,7 +264,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) dev->venc_pdata = of_device_get_match_data(&pdev->dev); ret = mtk_vcodec_init_enc_clk(dev); if (ret < 0) { - dev_err(&pdev->dev, "Failed to get mtk vcodec clock source!"); + dev_err(&pdev->dev, "[MTK VCODEC] Failed to get mtk vcodec clock source!"); goto err_enc_pm; } @@ -292,7 +289,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) 0, pdev->name, dev); if (ret) { dev_err(&pdev->dev, - "Failed to install dev->enc_irq %d (%d) core_id (%d)", + "[MTK VCODEC] Failed to install dev->enc_irq %d (%d) core_id (%d)", dev->enc_irq, ret, dev->venc_pdata->core_id); ret = -EINVAL; goto err_res; @@ -307,14 +304,14 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) { - mtk_v4l2_err("v4l2_device_register err=%d", ret); + dev_err(&pdev->dev, "[MTK VCODEC] v4l2_device_register err=%d", ret); goto err_res; } /* allocate video device for encoder and register it */ vfd_enc = video_device_alloc(); if (!vfd_enc) { - mtk_v4l2_err("Failed to allocate video device"); + dev_err(&pdev->dev, "[MTK VCODEC] Failed to allocate video device"); ret = -ENOMEM; goto err_enc_alloc; } @@ -335,7 +332,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) dev->m2m_dev_enc = v4l2_m2m_init(&mtk_venc_m2m_ops); if (IS_ERR((__force void *)dev->m2m_dev_enc)) { - mtk_v4l2_err("Failed to init mem2mem enc device"); + dev_err(&pdev->dev, "[MTK VCODEC] Failed to init mem2mem enc device"); ret = PTR_ERR((__force void *)dev->m2m_dev_enc); goto err_enc_mem_init; } @@ -345,20 +342,20 @@ static int mtk_vcodec_probe(struct platform_device *pdev) WQ_MEM_RECLAIM | WQ_FREEZABLE); if (!dev->encode_workqueue) { - mtk_v4l2_err("Failed to create encode workqueue"); + dev_err(&pdev->dev, "[MTK VCODEC] Failed to create encode workqueue"); ret = -EINVAL; goto err_event_workq; } ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, -1); if (ret) { - mtk_v4l2_err("Failed to register video device"); + dev_err(&pdev->dev, "[MTK VCODEC] Failed to register video device"); goto err_enc_reg; } mtk_vcodec_dbgfs_init(dev, true); - mtk_v4l2_debug(0, "encoder %d registered as /dev/video%d", - dev->venc_pdata->core_id, vfd_enc->num); + dev_dbg(&pdev->dev, "[MTK VCODEC] encoder %d registered as /dev/video%d", + dev->venc_pdata->core_id, vfd_enc->num); return 0; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c index 7055954eb2af..3165e114b221 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c @@ -35,7 +35,7 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev) if (!enc_clk->clk_info) return -ENOMEM; } else { - mtk_v4l2_err("Failed to get venc clock count"); + dev_err(pm->dev, "[MTK VCODEC] Failed to get venc clock count"); return -EINVAL; } @@ -44,13 +44,13 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev) ret = of_property_read_string_index(pdev->dev.of_node, "clock-names", i, &clk_info->clk_name); if (ret) { - mtk_v4l2_err("venc failed to get clk name %d", i); + dev_err(pm->dev, "[MTK VCODEC] venc failed to get clk name %d", i); return ret; } clk_info->vcodec_clk = devm_clk_get(&pdev->dev, clk_info->clk_name); if (IS_ERR(clk_info->vcodec_clk)) { - mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i, + dev_err(pm->dev, "[MTK VCODEC] venc devm_clk_get (%d)%s fail", i, clk_info->clk_name); return PTR_ERR(clk_info->vcodec_clk); } @@ -67,7 +67,7 @@ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm) for (i = 0; i < enc_clk->clk_num; i++) { ret = clk_prepare_enable(enc_clk->clk_info[i].vcodec_clk); if (ret) { - mtk_v4l2_err("venc clk_prepare_enable %d %s fail %d", i, + dev_err(pm->dev, "[MTK VCODEC] venc clk_prepare_enable %d %s fail %d", i, enc_clk->clk_info[i].clk_name, ret); goto clkerr; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c index be9159acacf8..6e6986fb28bb 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c @@ -14,7 +14,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type t case SCP: return mtk_vcodec_fw_scp_init(priv, fw_use); default: - mtk_v4l2_err("invalid vcodec fw type"); + pr_err(MTK_DBG_VCODEC_STR "Invalid vcodec fw type"); return ERR_PTR(-EINVAL); } } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c index 9a2472442c6f..71ff1a6ae872 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c @@ -63,7 +63,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use plat_dev = dev->plat_dev; scp = scp_get(plat_dev); if (!scp) { - mtk_v4l2_err("could not get vdec scp handle"); + dev_err(&dev->plat_dev->dev, "could not get vdec scp handle"); return ERR_PTR(-EPROBE_DEFER); } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c index 46a028031133..ee6846886dd6 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c @@ -56,13 +56,12 @@ static void mtk_vcodec_vpu_reset_handler(void *priv) struct mtk_vcodec_dev *dev = priv; struct mtk_vcodec_ctx *ctx; - mtk_v4l2_err("Watchdog timeout!!"); + dev_err(&dev->plat_dev->dev, "Watchdog timeout!!"); mutex_lock(&dev->dev_mutex); list_for_each_entry(ctx, &dev->ctx_list, list) { ctx->state = MTK_STATE_ABORT; - mtk_v4l2_debug(0, "[%d] Change to state MTK_STATE_ABORT", - ctx->id); + mtk_v4l2_vdec_dbg(0, ctx, "[%d] Change to state MTK_STATE_ABORT", ctx->id); } mutex_unlock(&dev->dev_mutex); } @@ -98,7 +97,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use plat_dev = dev->plat_dev; fw_pdev = vpu_get_plat_device(plat_dev); if (!fw_pdev) { - mtk_v4l2_err("firmware device is not ready"); + dev_err(&dev->plat_dev->dev, "firmware device is not ready"); return ERR_PTR(-EINVAL); } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c index daa44f635727..5a06be55915b 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c @@ -33,14 +33,14 @@ int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_m if (!ret) { status = -1; /* timeout */ - mtk_v4l2_err("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)", - ctx_id, command, ctx_type, timeout_ms, - ctx_int_cond[hw_id], ctx_int_type[hw_id]); + dev_err(&ctx->dev->plat_dev->dev, "[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)", + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } else if (-ERESTARTSYS == ret) { status = -1; - mtk_v4l2_err("[%d] cmd=%d, type=%d, dec inter fail (%d %d)", - ctx_id, command, ctx_type, - ctx_int_cond[hw_id], ctx_int_type[hw_id]); + dev_err(&ctx->dev->plat_dev->dev, "[%d] cmd=%d, type=%d, dec inter fail (%d %d)", + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } ctx_int_cond[hw_id] = 0; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c index 847e321f4fcc..761194ffd2c4 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c @@ -24,7 +24,7 @@ EXPORT_SYMBOL(mtk_v4l2_dbg_level); void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx) { if (reg_idx >= NUM_MAX_VCODEC_REG_BASE) { - mtk_v4l2_err("Invalid arguments, reg_idx=%d", reg_idx); + pr_err(MTK_DBG_V4L2_STR "Invalid arguments, reg_idx=%d", reg_idx); return NULL; } return reg_base[reg_idx]; @@ -39,15 +39,14 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); if (!mem->va) { - mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev), - size); + mtk_v4l2_vdec_err(ctx, "%s dma_alloc size=%ld failed!", dev_name(dev), size); return -ENOMEM; } - mtk_v4l2_debug(3, "[%d] - va = %p", ctx->id, mem->va); - mtk_v4l2_debug(3, "[%d] - dma = 0x%lx", ctx->id, - (unsigned long)mem->dma_addr); - mtk_v4l2_debug(3, "[%d] size = 0x%lx", ctx->id, size); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] - va = %p", ctx->id, mem->va); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] - dma = 0x%lx", ctx->id, + (unsigned long)mem->dma_addr); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] size = 0x%lx", ctx->id, size); return 0; } @@ -60,15 +59,14 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) struct device *dev = &ctx->dev->plat_dev->dev; if (!mem->va) { - mtk_v4l2_err("%s dma_free size=%ld failed!", dev_name(dev), - size); + mtk_v4l2_vdec_err(ctx, "%s dma_free size=%ld failed!", dev_name(dev), size); return; } - mtk_v4l2_debug(3, "[%d] - va = %p", ctx->id, mem->va); - mtk_v4l2_debug(3, "[%d] - dma = 0x%lx", ctx->id, - (unsigned long)mem->dma_addr); - mtk_v4l2_debug(3, "[%d] size = 0x%lx", ctx->id, size); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] - va = %p", ctx->id, mem->va); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] - dma = 0x%lx", ctx->id, + (unsigned long)mem->dma_addr); + mtk_v4l2_vdec_dbg(3, ctx, "[%d] size = 0x%lx", ctx->id, size); dma_free_coherent(dev, size, mem->va, mem->dma_addr); mem->va = NULL; @@ -80,7 +78,7 @@ EXPORT_SYMBOL(mtk_vcodec_mem_free); void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx) { if (hw_idx >= MTK_VDEC_HW_MAX || hw_idx < 0 || !dev->subdev_dev[hw_idx]) { - mtk_v4l2_err("hw idx is out of range:%d", hw_idx); + dev_err(&dev->plat_dev->dev, "hw idx is out of range:%d", hw_idx); return NULL; } @@ -98,7 +96,7 @@ void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev, if (vdec_dev->vdec_pdata->is_subdev_supported) { subdev_dev = mtk_vcodec_get_hw_dev(vdec_dev, hw_idx); if (!subdev_dev) { - mtk_v4l2_err("Failed to get hw dev"); + dev_err(&vdec_dev->plat_dev->dev, "Failed to get hw dev"); spin_unlock_irqrestore(&vdec_dev->irqlock, flags); return; } @@ -121,7 +119,7 @@ struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev, if (vdec_dev->vdec_pdata->is_subdev_supported) { subdev_dev = mtk_vcodec_get_hw_dev(vdec_dev, hw_idx); if (!subdev_dev) { - mtk_v4l2_err("Failed to get hw dev"); + dev_err(&vdec_dev->plat_dev->dev, "Failed to get hw dev"); spin_unlock_irqrestore(&vdec_dev->irqlock, flags); return NULL; } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h index a684a7e4ab6e..65542c345f41 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h @@ -11,6 +11,9 @@ #include #include +#define MTK_DBG_VCODEC_STR "[MTK_VCODEC]" +#define MTK_DBG_V4L2_STR "[MTK_V4L2]" + struct mtk_vcodec_mem { size_t size; void *va; @@ -28,8 +31,8 @@ struct mtk_vcodec_dev; #undef pr_fmt #define pr_fmt(fmt) "%s(),%d: " fmt, __func__, __LINE__ -#define mtk_v4l2_err(fmt, args...) \ - pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args) +#define mtk_v4l2_err(plat_dev, fmt, args...) \ + dev_err(&(plat_dev)->dev, "[MTK_V4L2][ERROR] " fmt "\n", ##args) #define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \ dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args) @@ -38,11 +41,11 @@ struct mtk_vcodec_dev; extern int mtk_v4l2_dbg_level; extern int mtk_vcodec_dbg; -#define mtk_v4l2_debug(level, fmt, args...) \ - do { \ - if (mtk_v4l2_dbg_level >= (level)) \ - pr_debug("[MTK_V4L2] %s, %d: " fmt "\n", \ - __func__, __LINE__, ##args); \ +#define mtk_v4l2_debug(plat_dev, level, fmt, args...) \ + do { \ + if (mtk_v4l2_dbg_level >= (level)) \ + dev_dbg(&(plat_dev)->dev, "[MTK_V4L2] %s, %d: " fmt "\n", \ + __func__, __LINE__, ##args); \ } while (0) #define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \ @@ -70,6 +73,16 @@ extern int mtk_vcodec_dbg; #define mtk_venc_debug(ctx, fmt, args...) \ mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) +#define mtk_v4l2_vdec_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_v4l2_vdec_dbg(level, ctx, fmt, args...) \ + mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args) + +#define mtk_v4l2_venc_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_v4l2_venc_dbg(level, ctx, fmt, args...) \ + mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args) + void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx); int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem); void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c index dfed8fe7f54c..6e731f84a801 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c @@ -861,8 +861,8 @@ static void vdec_av1_slice_decrease_ref_count(struct vdec_av1_slice_slot *slots, frame_info[fb_idx].ref_count--; if (frame_info[fb_idx].ref_count < 0) { frame_info[fb_idx].ref_count = 0; - mtk_v4l2_err("av1_error: %s() fb_idx %d decrease ref_count error\n", - __func__, fb_idx); + pr_err(MTK_DBG_V4L2_STR "av1_error: %s() fb_idx %d decrease ref_count error\n", + __func__, fb_idx); } vdec_av1_slice_clear_fb(&frame_info[fb_idx]); @@ -910,7 +910,7 @@ static void vdec_av1_slice_setup_slot(struct vdec_av1_slice_instance *instance, vsi->slot_id = vdec_av1_slice_get_new_slot(vsi); if (vsi->slot_id == AV1_INVALID_IDX) { - mtk_v4l2_err("warning:av1 get invalid index slot\n"); + mtk_v4l2_vdec_err(instance->ctx, "warning:av1 get invalid index slot\n"); vsi->slot_id = 0; } cur_frame_info = &vsi->slots.frame_info[vsi->slot_id]; @@ -1504,8 +1504,8 @@ static void vdec_av1_slice_setup_ref(struct vdec_av1_slice_pfc *pfc, slot_id = frame->ref_frame_map[ref_idx]; frame_info = &slots->frame_info[slot_id]; if (slot_id == AV1_INVALID_IDX) { - mtk_v4l2_err("cannot match reference[%d] 0x%llx\n", i, - ctrl_fh->reference_frame_ts[ref_idx]); + pr_err(MTK_DBG_V4L2_STR "cannot match reference[%d] 0x%llx\n", i, + ctrl_fh->reference_frame_ts[ref_idx]); frame->order_hints[i] = 0; frame->ref_frame_valid[i] = 0; continue; diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c index 250746db366b..bdff1d2feb1c 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c @@ -187,7 +187,7 @@ static int alloc_mv_buf(struct vdec_h264_slice_inst *inst, struct mtk_vcodec_mem *mem = NULL; unsigned int buf_sz = mtk_vdec_h264_get_mv_buf_size(pic->buf_w, pic->buf_h); - mtk_v4l2_debug(3, "size = 0x%x", buf_sz); + mtk_v4l2_vdec_dbg(3, inst->ctx, "size = 0x%x", buf_sz); for (i = 0; i < H264_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; if (mem->va) @@ -243,12 +243,12 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst, ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->vsi_ctx.dec.realloc_mv_buf = true; - mtk_v4l2_debug(1, "ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)", - inst->vsi_ctx.dec.resolution_changed, - inst->vsi_ctx.dec.realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); + mtk_v4l2_vdec_dbg(1, inst->ctx, "ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)", + inst->vsi_ctx.dec.resolution_changed, + inst->vsi_ctx.dec.realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } } diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c index 2a160dcb5296..1c2389e63e4c 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c @@ -294,7 +294,7 @@ static void vdec_h264_slice_fill_decode_reflist(struct vdec_h264_slice_inst *ins mtk_vdec_h264_fill_dpb_info(inst->ctx, &slice_param->decode_params, slice_param->h264_dpb_info); - mtk_v4l2_debug(3, "cur poc = %d\n", dec_params->bottom_field_order_cnt); + mtk_v4l2_vdec_dbg(3, inst->ctx, "cur poc = %d\n", dec_params->bottom_field_order_cnt); /* Build the reference lists */ v4l2_h264_init_reflist_builder(&reflist_builder, dec_params, sps, inst->dpb); @@ -314,7 +314,7 @@ static int vdec_h264_slice_alloc_mv_buf(struct vdec_h264_slice_inst *inst, struct mtk_vcodec_mem *mem; int i, err; - mtk_v4l2_debug(3, "size = 0x%x", buf_sz); + mtk_v4l2_vdec_dbg(3, inst->ctx, "size = 0x%x", buf_sz); for (i = 0; i < H264_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; if (mem->va) @@ -372,12 +372,12 @@ static void vdec_h264_slice_get_pic_info(struct vdec_h264_slice_inst *inst) ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->realloc_mv_buf = true; - mtk_v4l2_debug(1, "resChg: (%d %d) : old(%d, %d) -> new(%d, %d)", - inst->resolution_changed, - inst->realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); + mtk_v4l2_vdec_dbg(1, inst->ctx, "resChg: (%d %d) : old(%d, %d) -> new(%d, %d)", + inst->resolution_changed, + inst->realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } } diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c index 5a864bcfe7ba..aa32b7cbf6f1 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c @@ -649,7 +649,7 @@ static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst, struct mtk_vcodec_mem *mem; int i, err; - mtk_v4l2_debug(3, "allocate mv buffer size = 0x%x", buf_sz); + mtk_v4l2_vdec_dbg(3, inst->ctx, "allocate mv buffer size = 0x%x", buf_sz); for (i = 0; i < HEVC_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; if (mem->va) @@ -707,12 +707,12 @@ static void vdec_hevc_slice_get_pic_info(struct vdec_hevc_slice_inst *inst) ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->realloc_mv_buf = true; - mtk_v4l2_debug(1, "resChg: (%d %d) : old(%d, %d) -> new(%d, %d)", - inst->resolution_changed, - inst->realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); + mtk_v4l2_vdec_dbg(1, inst->ctx, "resChg: (%d %d) : old(%d, %d) -> new(%d, %d)", + inst->resolution_changed, + inst->realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } } diff --git a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.c b/drivers/media/platform/mediatek/vcodec/vdec_drv_if.c index 06d393174cc2..e66faf50892b 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_drv_if.c @@ -75,7 +75,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs, if (bs) { if ((bs->dma_addr & 63) != 0) { - mtk_v4l2_err("bs dma_addr should 64 byte align"); + mtk_v4l2_vdec_err(ctx, "bs dma_addr should 64 byte align"); return -EINVAL; } } @@ -83,7 +83,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs, if (fb) { if (((fb->base_y.dma_addr & 511) != 0) || ((fb->base_c.dma_addr & 511) != 0)) { - mtk_v4l2_err("frame buffer dma_addr should 512 byte align"); + mtk_v4l2_vdec_err(ctx, "frame buffer dma_addr should 512 byte align"); return -EINVAL; } } diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c index f555341ae708..1b2d01b15032 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c @@ -77,7 +77,7 @@ int vdec_msg_queue_qbuf(struct vdec_msg_queue_ctx *msg_ctx, struct vdec_lat_buf head = vdec_get_buf_list(msg_ctx->hardware_index, buf); if (!head) { - mtk_v4l2_err("fail to qbuf: %d", msg_ctx->hardware_index); + mtk_v4l2_vdec_err(buf->ctx, "fail to qbuf: %d", msg_ctx->hardware_index); return -EINVAL; } @@ -95,8 +95,8 @@ int vdec_msg_queue_qbuf(struct vdec_msg_queue_ctx *msg_ctx, struct vdec_lat_buf } } - mtk_v4l2_debug(3, "enqueue buf type: %d addr: 0x%p num: %d", - msg_ctx->hardware_index, buf, msg_ctx->ready_num); + mtk_v4l2_vdec_dbg(3, buf->ctx, "enqueue buf type: %d addr: 0x%p num: %d", + msg_ctx->hardware_index, buf, msg_ctx->ready_num); spin_unlock(&msg_ctx->ready_lock); return 0; @@ -123,8 +123,6 @@ struct vdec_lat_buf *vdec_msg_queue_dqbuf(struct vdec_msg_queue_ctx *msg_ctx) spin_lock(&msg_ctx->ready_lock); if (list_empty(&msg_ctx->ready_queue)) { - mtk_v4l2_debug(3, "queue is NULL, type:%d num: %d", - msg_ctx->hardware_index, msg_ctx->ready_num); spin_unlock(&msg_ctx->ready_lock); if (msg_ctx->hardware_index == MTK_VDEC_CORE) @@ -146,15 +144,15 @@ struct vdec_lat_buf *vdec_msg_queue_dqbuf(struct vdec_msg_queue_ctx *msg_ctx) head = vdec_get_buf_list(msg_ctx->hardware_index, buf); if (!head) { spin_unlock(&msg_ctx->ready_lock); - mtk_v4l2_err("fail to dqbuf: %d", msg_ctx->hardware_index); + mtk_v4l2_vdec_err(buf->ctx, "fail to dqbuf: %d", msg_ctx->hardware_index); return NULL; } list_del(head); vdec_msg_queue_dec(&buf->ctx->msg_queue, msg_ctx->hardware_index); msg_ctx->ready_num--; - mtk_v4l2_debug(3, "dqueue buf type:%d addr: 0x%p num: %d", - msg_ctx->hardware_index, buf, msg_ctx->ready_num); + mtk_v4l2_vdec_dbg(3, buf->ctx, "dqueue buf type:%d addr: 0x%p num: %d", + msg_ctx->hardware_index, buf, msg_ctx->ready_num); spin_unlock(&msg_ctx->ready_lock); return buf; @@ -164,7 +162,7 @@ void vdec_msg_queue_update_ube_rptr(struct vdec_msg_queue *msg_queue, uint64_t u { spin_lock(&msg_queue->lat_ctx.ready_lock); msg_queue->wdma_rptr_addr = ube_rptr; - mtk_v4l2_debug(3, "update ube rprt (0x%llx)", ube_rptr); + mtk_v4l2_vdec_dbg(3, msg_queue->ctx, "update ube rprt (0x%llx)", ube_rptr); spin_unlock(&msg_queue->lat_ctx.ready_lock); } @@ -172,20 +170,19 @@ void vdec_msg_queue_update_ube_wptr(struct vdec_msg_queue *msg_queue, uint64_t u { spin_lock(&msg_queue->lat_ctx.ready_lock); msg_queue->wdma_wptr_addr = ube_wptr; - mtk_v4l2_debug(3, "update ube wprt: (0x%llx 0x%llx) offset: 0x%llx", - msg_queue->wdma_rptr_addr, msg_queue->wdma_wptr_addr, - ube_wptr); + mtk_v4l2_vdec_dbg(3, msg_queue->ctx, "update ube wprt: (0x%llx 0x%llx) offset: 0x%llx", + msg_queue->wdma_rptr_addr, msg_queue->wdma_wptr_addr, + ube_wptr); spin_unlock(&msg_queue->lat_ctx.ready_lock); } bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue) { if (atomic_read(&msg_queue->lat_list_cnt) == NUM_BUFFER_COUNT) { - mtk_v4l2_debug(3, "wait buf full: list(%d %d) ready_num:%d status:%d", - atomic_read(&msg_queue->lat_list_cnt), - atomic_read(&msg_queue->core_list_cnt), - msg_queue->lat_ctx.ready_num, - msg_queue->status); + mtk_v4l2_vdec_dbg(3, msg_queue->ctx, "wait buf full: (%d %d) ready:%d status:%d", + atomic_read(&msg_queue->lat_list_cnt), + atomic_read(&msg_queue->core_list_cnt), + msg_queue->lat_ctx.ready_num, msg_queue->status); return true; } @@ -193,10 +190,10 @@ bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue) vdec_msg_queue_qbuf(&msg_queue->core_ctx, &msg_queue->empty_lat_buf); wait_event(msg_queue->core_dec_done, msg_queue->flush_done); - mtk_v4l2_debug(3, "flush done => ready_num:%d status:%d list(%d %d)", - msg_queue->lat_ctx.ready_num, msg_queue->status, - atomic_read(&msg_queue->lat_list_cnt), - atomic_read(&msg_queue->core_list_cnt)); + mtk_v4l2_vdec_dbg(3, msg_queue->ctx, "flush done => ready_num:%d status:%d list(%d %d)", + msg_queue->lat_ctx.ready_num, msg_queue->status, + atomic_read(&msg_queue->lat_list_cnt), + atomic_read(&msg_queue->core_list_cnt)); return false; } @@ -305,7 +302,7 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, ctx->picinfo.buf_h); err = mtk_vcodec_mem_alloc(ctx, &msg_queue->wdma_addr); if (err) { - mtk_v4l2_err("failed to allocate wdma_addr buf"); + mtk_v4l2_vdec_err(ctx, "failed to allocate wdma_addr buf"); return -ENOMEM; } msg_queue->wdma_rptr_addr = msg_queue->wdma_addr.dma_addr; @@ -315,20 +312,21 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, msg_queue->empty_lat_buf.core_decode = NULL; msg_queue->empty_lat_buf.is_last_frame = true; + msg_queue->ctx = ctx; for (i = 0; i < NUM_BUFFER_COUNT; i++) { lat_buf = &msg_queue->lat_buf[i]; lat_buf->wdma_err_addr.size = VDEC_ERR_MAP_SZ_AVC; err = mtk_vcodec_mem_alloc(ctx, &lat_buf->wdma_err_addr); if (err) { - mtk_v4l2_err("failed to allocate wdma_err_addr buf[%d]", i); + mtk_v4l2_vdec_err(ctx, "failed to allocate wdma_err_addr buf[%d]", i); goto mem_alloc_err; } lat_buf->slice_bc_addr.size = VDEC_LAT_SLICE_HEADER_SZ; err = mtk_vcodec_mem_alloc(ctx, &lat_buf->slice_bc_addr); if (err) { - mtk_v4l2_err("failed to allocate wdma_addr buf[%d]", i); + mtk_v4l2_vdec_err(ctx, "failed to allocate wdma_addr buf[%d]", i); goto mem_alloc_err; } @@ -336,14 +334,14 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, lat_buf->rd_mv_addr.size = VDEC_RD_MV_BUFFER_SZ; err = mtk_vcodec_mem_alloc(ctx, &lat_buf->rd_mv_addr); if (err) { - mtk_v4l2_err("failed to allocate rd_mv_addr buf[%d]", i); + mtk_v4l2_vdec_err(ctx, "failed to allocate rd_mv_addr buf[%d]", i); return -ENOMEM; } lat_buf->tile_addr.size = VDEC_LAT_TILE_SZ; err = mtk_vcodec_mem_alloc(ctx, &lat_buf->tile_addr); if (err) { - mtk_v4l2_err("failed to allocate tile_addr buf[%d]", i); + mtk_v4l2_vdec_err(ctx, "failed to allocate tile_addr buf[%d]", i); return -ENOMEM; } } @@ -359,7 +357,7 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, lat_buf->is_last_frame = false; err = vdec_msg_queue_qbuf(&msg_queue->lat_ctx, lat_buf); if (err) { - mtk_v4l2_err("failed to qbuf buf[%d]", i); + mtk_v4l2_vdec_err(ctx, "failed to qbuf buf[%d]", i); goto mem_alloc_err; } } diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h index 2a745e902ad1..2f82cc08caa3 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h @@ -100,6 +100,7 @@ struct vdec_lat_buf { * @empty_lat_buf: the last lat buf used to flush decode * @core_dec_done: core work queue decode done event * @status: current context decode status for core hardware + * @ctx: mtk vcodec context information */ struct vdec_msg_queue { struct vdec_lat_buf lat_buf[NUM_BUFFER_COUNT]; @@ -118,6 +119,7 @@ struct vdec_msg_queue { struct vdec_lat_buf empty_lat_buf; wait_queue_head_t core_dec_done; int status; + struct mtk_vcodec_ctx *ctx; }; /** diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c index ab15ee6e2005..d82391411ba1 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c @@ -91,7 +91,7 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv) (unsigned long)msg->ap_inst_addr; if (!vpu) { - mtk_v4l2_err("ap_inst_addr is NULL, did the SCP hang or crash?"); + mtk_v4l2_vdec_err(vpu->ctx, "ap_inst_addr is NULL, did the SCP hang or crash?"); return; } From patchwork Tue Jul 4 11:13:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13300998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0ACD0EB64D9 for ; Tue, 4 Jul 2023 11:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=upFm6brUGcGKstMl1ljDI5GSE4t13fK/C7ScaUbfaaQ=; b=OoneoBkGTpbRKZ P/uvoBrzVfgVsL0jm62F27mgfRnVXZNPh2rFS2dzD4ILPvlPh4DxeGcvmwBFISB4zG3HraGBKkfkp OSPw/YgkG/kcrUZkc8symW55F4CSy6G3GH5MbPSK/XlKLMb8Oyb78gQDg+jNjp4MKgNpqRBDCEGgX HBJsf1F//YkmuASytDFwME0esGR6dC3PXSEXDXoJRdnXIX5FoOgCTd7ayDFpIcKXzQNZhuzPqpWeN 909UhBnQKGsNzHSZNTdwCtdmBybq9y5ClHxpGvOVBXgzKOo4Kt7eZaePuJTNZOysWuCeCIIyDkEjB 3mf1CodfDiolDP05TuZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGdzP-00D5tu-07; Tue, 04 Jul 2023 11:14:35 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGdzF-00D5oT-14; Tue, 04 Jul 2023 11:14:32 +0000 X-UUID: e4a859f41a5b11ee912e1518a6540028-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=y5dVlxcxfena/4JZ0NBg3G5pO5bgrTZC1vosztSuh9g=; b=YP84i+TiZqZIxJJr1rt5zIHw09Rx7fH/jlaAMlR44KJ+1pv3VgJvdgjcOsvo8C/NhKa0NYQtyNFF2I9QvJxB/Cx1GjQvHkH1nOU9E20MvOWqcIuWzF4CEcp5aAGhjXp3V1REGPwA4Jl+LRtXu9ITB+5FfOuFxMcvXMuZpPvw/O8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:686d26f7-eaa9-4d79-883f-86a0db2f2456,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:01c9525,CLOUDID:9a138d0d-26a8-467f-b838-f99719a9c083,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:1,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 2,OSH|NGT X-CID-BAS: 2,OSH|NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: e4a859f41a5b11ee912e1518a6540028-20230704 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 705596537; Tue, 04 Jul 2023 04:14:07 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by MTKMBS14N2.mediatek.inc (172.21.101.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:37 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:37 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,08/11] media: mediatek: vcodec: separate struct mtk_vcodec_dev Date: Tue, 4 Jul 2023 19:13:24 +0800 Message-ID: <20230704111327.7140-9-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_041425_401209_17C07B69 X-CRM114-Status: GOOD ( 23.41 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Adding different dev struct for encoder and decoder, remove 'struct mtk_vcodec_dev'. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/mtk_vcodec_com_drv.h | 71 +++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 51 ++- .../mediatek/vcodec/mtk_vcodec_dbgfs.h | 14 +- .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 4 +- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 19 +- .../mediatek/vcodec/mtk_vcodec_dec_drv.h | 172 +++++++++- .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 5 +- .../mediatek/vcodec/mtk_vcodec_dec_hw.h | 4 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 10 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.h | 2 +- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 3 +- .../vcodec/mtk_vcodec_dec_stateless.c | 5 +- .../platform/mediatek/vcodec/mtk_vcodec_drv.h | 295 ------------------ .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 5 +- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 15 +- .../mediatek/vcodec/mtk_vcodec_enc_drv.h | 93 +++++- .../mediatek/vcodec/mtk_vcodec_enc_pm.c | 4 +- .../mediatek/vcodec/mtk_vcodec_enc_pm.h | 4 +- .../platform/mediatek/vcodec/mtk_vcodec_fw.c | 12 +- .../platform/mediatek/vcodec/mtk_vcodec_fw.h | 3 +- .../mediatek/vcodec/mtk_vcodec_fw_priv.h | 3 +- .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 21 +- .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 18 +- .../mediatek/vcodec/mtk_vcodec_intr.c | 4 +- .../mediatek/vcodec/mtk_vcodec_util.c | 10 +- .../mediatek/vcodec/mtk_vcodec_util.h | 8 +- .../vcodec/vdec/vdec_h264_req_common.h | 2 +- .../vcodec/vdec/vdec_h264_req_multi_if.c | 2 +- .../platform/mediatek/vcodec/vdec_drv_if.h | 1 - .../platform/mediatek/vcodec/vdec_msg_queue.c | 4 +- .../platform/mediatek/vcodec/vdec_msg_queue.h | 2 +- .../platform/mediatek/vcodec/vdec_vpu_if.c | 3 +- .../mediatek/vcodec/venc/venc_h264_if.c | 2 +- .../mediatek/vcodec/venc/venc_vp8_if.c | 2 +- .../platform/mediatek/vcodec/venc_drv_base.h | 2 +- .../platform/mediatek/vcodec/venc_drv_if.c | 4 +- .../platform/mediatek/vcodec/venc_drv_if.h | 3 +- .../platform/mediatek/vcodec/venc_vpu_if.c | 2 +- 38 files changed, 465 insertions(+), 419 deletions(-) delete mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h index 3b6e1faf60ce..6087e27bd604 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h @@ -17,6 +17,77 @@ #define MTK_VCODEC_MAX_PLANES 3 +#define WAIT_INTR_TIMEOUT_MS 1000 + +/* + * enum mtk_q_type - Type of queue + */ +enum mtk_q_type { + MTK_Q_DATA_SRC = 0, + MTK_Q_DATA_DST = 1, +}; + +/* + * enum mtk_hw_reg_idx - MTK hw register base index + */ +enum mtk_hw_reg_idx { + VDEC_SYS, + VDEC_MISC, + VDEC_LD, + VDEC_TOP, + VDEC_CM, + VDEC_AD, + VDEC_AV, + VDEC_PP, + VDEC_HWD, + VDEC_HWQ, + VDEC_HWB, + VDEC_HWG, + NUM_MAX_VDEC_REG_BASE, + /* h264 encoder */ + VENC_SYS = NUM_MAX_VDEC_REG_BASE, + /* vp8 encoder */ + VENC_LT_SYS, + NUM_MAX_VCODEC_REG_BASE +}; + +/* + * struct mtk_vcodec_clk_info - Structure used to store clock name + */ +struct mtk_vcodec_clk_info { + const char *clk_name; + struct clk *vcodec_clk; +}; + +/* + * struct mtk_vcodec_clk - Structure used to store vcodec clock information + */ +struct mtk_vcodec_clk { + struct mtk_vcodec_clk_info *clk_info; + int clk_num; +}; + +/* + * struct mtk_vcodec_pm - Power management data structure + */ +struct mtk_vcodec_pm { + struct mtk_vcodec_clk vdec_clk; + struct mtk_vcodec_clk venc_clk; + struct device *dev; +}; + +/* + * enum mtk_vdec_hw_id - Hardware index used to separate + * different hardware + */ +enum mtk_vdec_hw_id { + MTK_VDEC_CORE, + MTK_VDEC_LAT0, + MTK_VDEC_LAT1, + MTK_VDEC_LAT_SOC, + MTK_VDEC_HW_MAX, +}; + /** * enum mtk_instance_state - The state of an MTK Vcodec instance. * @MTK_STATE_FREE: default state when instance is created diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index 0f4bbfb3bba5..c6a02b33cc74 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -7,7 +7,8 @@ #include #include "mtk_vcodec_dbgfs.h" -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_dec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_util.h" static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_dec_ctx *ctx, char *buf, @@ -72,7 +73,7 @@ static void mtk_vdec_dbgfs_get_help(char *buf, int *used, int total) static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf, size_t count, loff_t *ppos) { - struct mtk_vcodec_dev *vcodec_dev = filp->private_data; + struct mtk_vcodec_dec_dev *vcodec_dev = filp->private_data; struct mtk_vcodec_dbgfs *dbgfs = &vcodec_dev->dbgfs; mutex_lock(&dbgfs->dbgfs_lock); @@ -88,7 +89,7 @@ static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf, static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf, size_t count, loff_t *ppos) { - struct mtk_vcodec_dev *vcodec_dev = filp->private_data; + struct mtk_vcodec_dec_dev *vcodec_dev = filp->private_data; struct mtk_vcodec_dbgfs *dbgfs = &vcodec_dev->dbgfs; struct mtk_vcodec_dbgfs_inst *dbgfs_inst; struct mtk_vcodec_dec_ctx *ctx; @@ -146,7 +147,7 @@ static const struct file_operations vdec_fops = { void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx) { struct mtk_vcodec_dbgfs_inst *dbgfs_inst; - struct mtk_vcodec_dev *vcodec_dev = ctx->dev; + struct mtk_vcodec_dec_dev *vcodec_dev = ctx->dev; dbgfs_inst = kzalloc(sizeof(*dbgfs_inst), GFP_KERNEL); if (!dbgfs_inst) @@ -161,7 +162,7 @@ void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx) } EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_create); -void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id) +void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id) { struct mtk_vcodec_dbgfs_inst *dbgfs_inst; @@ -179,16 +180,13 @@ void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id) } EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_remove); -void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode) +static void mtk_vcodec_dbgfs_vdec_init(struct mtk_vcodec_dec_dev *vcodec_dev) { struct dentry *vcodec_root; - if (is_encode) - vcodec_dev->dbgfs.vcodec_root = debugfs_create_dir("vcodec-enc", NULL); - else - vcodec_dev->dbgfs.vcodec_root = debugfs_create_dir("vcodec-dec", NULL); + vcodec_dev->dbgfs.vcodec_root = debugfs_create_dir("vcodec-dec", NULL); if (IS_ERR(vcodec_dev->dbgfs.vcodec_root)) - dev_err(&vcodec_dev->plat_dev->dev, "create vcodec dir err:%d\n", + dev_err(&vcodec_dev->plat_dev->dev, "create vdec dir err:%d\n", IS_ERR(vcodec_dev->dbgfs.vcodec_root)); vcodec_root = vcodec_dev->dbgfs.vcodec_root; @@ -196,18 +194,39 @@ void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode) debugfs_create_x32("mtk_vcodec_dbg", 0644, vcodec_root, &mtk_vcodec_dbg); vcodec_dev->dbgfs.inst_count = 0; - if (is_encode) - return; - INIT_LIST_HEAD(&vcodec_dev->dbgfs.dbgfs_head); debugfs_create_file("vdec", 0200, vcodec_root, vcodec_dev, &vdec_fops); mutex_init(&vcodec_dev->dbgfs.dbgfs_lock); } + +static void mtk_vcodec_dbgfs_venc_init(struct mtk_vcodec_enc_dev *vcodec_dev) +{ + struct dentry *vcodec_root; + + vcodec_dev->dbgfs.vcodec_root = debugfs_create_dir("vcodec-enc", NULL); + if (IS_ERR(vcodec_dev->dbgfs.vcodec_root)) + dev_err(&vcodec_dev->plat_dev->dev, "create venc dir err:%d\n", + IS_ERR(vcodec_dev->dbgfs.vcodec_root)); + + vcodec_root = vcodec_dev->dbgfs.vcodec_root; + debugfs_create_x32("mtk_v4l2_dbg_level", 0644, vcodec_root, &mtk_v4l2_dbg_level); + debugfs_create_x32("mtk_vcodec_dbg", 0644, vcodec_root, &mtk_vcodec_dbg); + + vcodec_dev->dbgfs.inst_count = 0; +} + +void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode) +{ + if (is_encode) + mtk_vcodec_dbgfs_venc_init(vcodec_dev); + else + mtk_vcodec_dbgfs_vdec_init(vcodec_dev); +} EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_init); -void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev) +void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs) { - debugfs_remove_recursive(vcodec_dev->dbgfs.vcodec_root); + debugfs_remove_recursive(dbgfs->vcodec_root); } EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_deinit); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h index 372413d590c5..073d2fedb54a 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h @@ -7,7 +7,7 @@ #ifndef __MTK_VCODEC_DBGFS_H__ #define __MTK_VCODEC_DBGFS_H__ -struct mtk_vcodec_dev; +struct mtk_vcodec_dec_dev; struct mtk_vcodec_dec_ctx; /* @@ -51,23 +51,23 @@ struct mtk_vcodec_dbgfs { #if defined(CONFIG_DEBUG_FS) void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx); -void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id); -void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode); -void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev); +void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id); +void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode); +void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs); #else static inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx) { } -static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id) +static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id) { } -static inline void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode) +static inline void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode) { } -static inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev) +static inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs) { } #endif diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c index 619ff3dd8d50..0363fec572e5 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c @@ -9,7 +9,7 @@ #include #include -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_dec_drv.h" #include "mtk_vcodec_dec.h" #include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" @@ -890,7 +890,7 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q) static void m2mops_vdec_device_run(void *priv) { struct mtk_vcodec_dec_ctx *ctx = priv; - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_dec_dev *dev = ctx->dev; queue_work(dev->decode_workqueue, &ctx->decode_work); } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index 5609fd3268f2..8e3aea9a3ab0 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -17,7 +17,6 @@ #include #include -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_dec.h" #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" @@ -25,7 +24,7 @@ #include "mtk_vcodec_util.h" #include "mtk_vcodec_fw.h" -static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vcodec_dev *dev) +static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vcodec_dec_dev *dev) { switch (dev->vdec_pdata->hw_arch) { case MTK_VDEC_PURE_SINGLE_CORE: @@ -40,7 +39,7 @@ static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vc static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv) { - struct mtk_vcodec_dev *dev = priv; + struct mtk_vcodec_dec_dev *dev = priv; struct mtk_vcodec_dec_ctx *ctx; u32 cg_status = 0; unsigned int dec_done_status = 0; @@ -75,7 +74,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv) return IRQ_HANDLED; } -static int mtk_vcodec_get_reg_bases(struct mtk_vcodec_dev *dev) +static int mtk_vcodec_get_reg_bases(struct mtk_vcodec_dec_dev *dev) { struct platform_device *pdev = dev->plat_dev; int reg_num, i; @@ -99,7 +98,7 @@ static int mtk_vcodec_get_reg_bases(struct mtk_vcodec_dev *dev) return 0; } -static int mtk_vcodec_init_dec_resources(struct mtk_vcodec_dev *dev) +static int mtk_vcodec_init_dec_resources(struct mtk_vcodec_dec_dev *dev) { struct platform_device *pdev = dev->plat_dev; int ret; @@ -136,7 +135,7 @@ static int mtk_vcodec_init_dec_resources(struct mtk_vcodec_dev *dev) static int fops_vcodec_open(struct file *file) { - struct mtk_vcodec_dev *dev = video_drvdata(file); + struct mtk_vcodec_dec_dev *dev = video_drvdata(file); struct mtk_vcodec_dec_ctx *ctx = NULL; int ret = 0, i, hw_count; struct vb2_queue *src_vq; @@ -233,7 +232,7 @@ static int fops_vcodec_open(struct file *file) static int fops_vcodec_release(struct file *file) { - struct mtk_vcodec_dev *dev = video_drvdata(file); + struct mtk_vcodec_dec_dev *dev = video_drvdata(file); struct mtk_vcodec_dec_ctx *ctx = fh_to_dec_ctx(file->private_data); mtk_v4l2_vdec_dbg(0, ctx, "[%d] decoder", ctx->id); @@ -270,7 +269,7 @@ static const struct v4l2_file_operations mtk_vcodec_fops = { static int mtk_vcodec_probe(struct platform_device *pdev) { - struct mtk_vcodec_dev *dev; + struct mtk_vcodec_dec_dev *dev; struct video_device *vfd_dec; phandle rproc_phandle; enum mtk_vcodec_fw_type fw_type; @@ -477,7 +476,7 @@ MODULE_DEVICE_TABLE(of, mtk_vcodec_match); static void mtk_vcodec_dec_remove(struct platform_device *pdev) { - struct mtk_vcodec_dev *dev = platform_get_drvdata(pdev); + struct mtk_vcodec_dec_dev *dev = platform_get_drvdata(pdev); destroy_workqueue(dev->decode_workqueue); @@ -493,7 +492,7 @@ static void mtk_vcodec_dec_remove(struct platform_device *pdev) if (dev->vfd_dec) video_unregister_device(dev->vfd_dec); - mtk_vcodec_dbgfs_deinit(dev); + mtk_vcodec_dbgfs_deinit(&dev->dbgfs); v4l2_device_unregister(&dev->v4l2_dev); if (!dev->vdec_pdata->is_subdev_supported) pm_runtime_disable(dev->pm.dev); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h index dd835baea099..983a83f7b640 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h @@ -8,9 +8,49 @@ #define _MTK_VCODEC_DEC_DRV_H_ #include "mtk_vcodec_com_drv.h" +#include "mtk_vcodec_dbgfs.h" #include "mtk_vcodec_fw_priv.h" +#include "mtk_vcodec_util.h" #include "vdec_msg_queue.h" +#define MTK_VCODEC_DEC_NAME "mtk-vcodec-dec" + +#define IS_VDEC_LAT_ARCH(hw_arch) ((hw_arch) >= MTK_VDEC_LAT_SINGLE_CORE) +#define IS_VDEC_INNER_RACING(capability) ((capability) & MTK_VCODEC_INNER_RACING) + +/* + * struct mtk_vdec_format_types - Structure used to get supported + * format types according to decoder capability + */ +enum mtk_vdec_format_types { + MTK_VDEC_FORMAT_MM21 = 0x20, + MTK_VDEC_FORMAT_MT21C = 0x40, + MTK_VDEC_FORMAT_H264_SLICE = 0x100, + MTK_VDEC_FORMAT_VP8_FRAME = 0x200, + MTK_VDEC_FORMAT_VP9_FRAME = 0x400, + MTK_VDEC_FORMAT_AV1_FRAME = 0x800, + MTK_VDEC_FORMAT_HEVC_FRAME = 0x1000, + MTK_VCODEC_INNER_RACING = 0x20000, +}; + +/* + * enum mtk_vdec_hw_count - Supported hardware count + */ +enum mtk_vdec_hw_count { + MTK_VDEC_NO_HW = 0, + MTK_VDEC_ONE_CORE, + MTK_VDEC_ONE_LAT_ONE_CORE, + MTK_VDEC_MAX_HW_COUNT, +}; + +/* + * enum mtk_vdec_hw_arch - Used to separate different hardware architecture + */ +enum mtk_vdec_hw_arch { + MTK_VDEC_PURE_SINGLE_CORE, + MTK_VDEC_LAT_SINGLE_CORE, +}; + /** * struct vdec_pic_info - picture size information * @pic_w: picture width @@ -33,24 +73,54 @@ struct vdec_pic_info { unsigned int reserved; }; -/* - * enum mtk_vdec_hw_id - Hardware index used to separate - * different hardware +/** + * struct mtk_vcodec_dec_pdata - compatible data for each IC + * @init_vdec_params: init vdec params + * @ctrls_setup: init vcodec dec ctrls + * @worker: worker to start a decode job + * @flush_decoder: function that flushes the decoder + * @get_cap_buffer: get capture buffer from capture queue + * @cap_to_disp: put capture buffer to disp list for lat and core arch + * @vdec_vb2_ops: struct vb2_ops + * + * @vdec_formats: supported video decoder formats + * @num_formats: count of video decoder formats + * @default_out_fmt: default output buffer format + * @default_cap_fmt: default capture buffer format + * + * @hw_arch: hardware arch is used to separate pure_sin_core and lat_sin_core + * + * @is_subdev_supported: whether support parent-node architecture(subdev) + * @uses_stateless_api: whether the decoder uses the stateless API with requests */ -enum mtk_vdec_hw_id { - MTK_VDEC_CORE, - MTK_VDEC_LAT0, - MTK_VDEC_LAT1, - MTK_VDEC_LAT_SOC, - MTK_VDEC_HW_MAX, +struct mtk_vcodec_dec_pdata { + void (*init_vdec_params)(struct mtk_vcodec_dec_ctx *ctx); + int (*ctrls_setup)(struct mtk_vcodec_dec_ctx *ctx); + void (*worker)(struct work_struct *work); + int (*flush_decoder)(struct mtk_vcodec_dec_ctx *ctx); + struct vdec_fb *(*get_cap_buffer)(struct mtk_vcodec_dec_ctx *ctx); + void (*cap_to_disp)(struct mtk_vcodec_dec_ctx *ctx, int error, + struct media_request *src_buf_req); + + const struct vb2_ops *vdec_vb2_ops; + + const struct mtk_video_fmt *vdec_formats; + const int *num_formats; + const struct mtk_video_fmt *default_out_fmt; + const struct mtk_video_fmt *default_cap_fmt; + + enum mtk_vdec_hw_arch hw_arch; + + bool is_subdev_supported; + bool uses_stateless_api; }; /** * struct mtk_vcodec_dec_ctx - Context (instance) private data. * * @type: type of decoder instance - * @dev: pointer to the mtk_vcodec_dev of the device - * @list: link to ctx_list of mtk_vcodec_dev + * @dev: pointer to the mtk_vcodec_dec_dev of the device + * @list: link to ctx_list of mtk_vcodec_dec_dev * * @fh: struct v4l2_fh * @m2m_ctx: pointer to the v4l2_m2m_ctx of the context @@ -93,7 +163,7 @@ enum mtk_vdec_hw_id { */ struct mtk_vcodec_dec_ctx { enum mtk_instance_type type; - struct mtk_vcodec_dev *dev; + struct mtk_vcodec_dec_dev *dev; struct list_head list; struct v4l2_fh fh; @@ -134,6 +204,84 @@ struct mtk_vcodec_dec_ctx { struct vdec_msg_queue msg_queue; }; +/** + * struct mtk_vcodec_dec_dev - driver data + * @v4l2_dev: V4L2 device to register video devices for. + * @vfd_dec: Video device for decoder + * @mdev_dec: Media device for decoder + * + * @m2m_dev_dec: m2m device for decoder + * @plat_dev: platform device + * @ctx_list: list of struct mtk_vcodec_ctx + * @curr_ctx: The context that is waiting for codec hardware + * + * @reg_base: Mapped address of MTK Vcodec registers. + * @vdec_pdata: decoder IC-specific data + * + * @fw_handler: used to communicate with the firmware. + * @id_counter: used to identify current opened instance + * + * @dec_mutex: decoder hardware lock + * @dev_mutex: video_device lock + * @decode_workqueue: decode work queue + * + * @irqlock: protect data access by irq handler and work thread + * @dec_irq: decoder irq resource + * + * @pm: power management control + * @dec_capability: used to identify decode capability, ex: 4k + * + * @core_workqueue: queue used for core hardware decode + * + * @subdev_dev: subdev hardware device + * @subdev_prob_done: check whether all used hw device is prob done + * @subdev_bitmap: used to record hardware is ready or not + * + * @dec_active_cnt: used to mark whether need to record register value + * @vdec_racing_info: record register value + * @dec_racing_info_mutex: mutex lock used for inner racing mode + * @dbgfs: debug log related information + */ +struct mtk_vcodec_dec_dev { + struct v4l2_device v4l2_dev; + struct video_device *vfd_dec; + struct media_device mdev_dec; + + struct v4l2_m2m_dev *m2m_dev_dec; + struct platform_device *plat_dev; + struct list_head ctx_list; + struct mtk_vcodec_dec_ctx *curr_ctx; + + void __iomem *reg_base[NUM_MAX_VCODEC_REG_BASE]; + const struct mtk_vcodec_dec_pdata *vdec_pdata; + + struct mtk_vcodec_fw *fw_handler; + unsigned long id_counter; + + /* decoder hardware mutex lock */ + struct mutex dec_mutex[MTK_VDEC_HW_MAX]; + struct mutex dev_mutex; + struct workqueue_struct *decode_workqueue; + + spinlock_t irqlock; + int dec_irq; + + struct mtk_vcodec_pm pm; + unsigned int dec_capability; + + struct workqueue_struct *core_workqueue; + + void *subdev_dev[MTK_VDEC_HW_MAX]; + int (*subdev_prob_done)(struct mtk_vcodec_dec_dev *vdec_dev); + DECLARE_BITMAP(subdev_bitmap, MTK_VDEC_HW_MAX); + + atomic_t dec_active_cnt; + u32 vdec_racing_info[132]; + /* Protects access to vdec_racing_info data */ + struct mutex dec_racing_info_mutex; + struct mtk_vcodec_dbgfs dbgfs; +}; + static inline struct mtk_vcodec_dec_ctx *fh_to_dec_ctx(struct v4l2_fh *fh) { return container_of(fh, struct mtk_vcodec_dec_ctx, fh); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c index dde0894f2ab0..23c19efa3cf6 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c @@ -12,7 +12,6 @@ #include #include -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_dec.h" #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" @@ -36,7 +35,7 @@ static const struct of_device_id mtk_vdec_hw_match[] = { }; MODULE_DEVICE_TABLE(of, mtk_vdec_hw_match); -static int mtk_vdec_hw_prob_done(struct mtk_vcodec_dev *vdec_dev) +static int mtk_vdec_hw_prob_done(struct mtk_vcodec_dec_dev *vdec_dev) { struct platform_device *pdev = vdec_dev->plat_dev; struct device_node *subdev_node; @@ -123,7 +122,7 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct mtk_vdec_hw_dev *subdev_dev; - struct mtk_vcodec_dev *main_dev; + struct mtk_vcodec_dec_dev *main_dev; const struct of_device_id *of_id; int hw_idx; int ret; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h index d62c7f961cfa..2b33f00e931e 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h @@ -10,7 +10,7 @@ #include #include -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_dec_drv.h" #define VDEC_HW_ACTIVE 0x10 #define VDEC_IRQ_CFG 0x11 @@ -45,7 +45,7 @@ enum mtk_vdec_hw_reg_idx { */ struct mtk_vdec_hw_dev { struct platform_device *plat_dev; - struct mtk_vcodec_dev *main_dev; + struct mtk_vcodec_dec_dev *main_dev; void __iomem *reg_base[VDEC_HW_MAX]; struct mtk_vcodec_dec_ctx *curr_ctx; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c index 29ef00c4a326..ed1f503a944e 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c @@ -107,7 +107,7 @@ static void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm) clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk); } -static void mtk_vcodec_dec_enable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_idx) +static void mtk_vcodec_dec_enable_irq(struct mtk_vcodec_dec_dev *vdec_dev, int hw_idx) { struct mtk_vdec_hw_dev *subdev_dev; @@ -125,7 +125,7 @@ static void mtk_vcodec_dec_enable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_id } } -static void mtk_vcodec_dec_disable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_idx) +static void mtk_vcodec_dec_disable_irq(struct mtk_vcodec_dec_dev *vdec_dev, int hw_idx) { struct mtk_vdec_hw_dev *subdev_dev; @@ -171,7 +171,7 @@ static void mtk_vcodec_record_racing_info(struct mtk_vcodec_dec_ctx *ctx) mutex_unlock(&ctx->dev->dec_racing_info_mutex); } -static struct mtk_vcodec_pm *mtk_vcodec_dec_get_pm(struct mtk_vcodec_dev *vdec_dev, +static struct mtk_vcodec_pm *mtk_vcodec_dec_get_pm(struct mtk_vcodec_dec_dev *vdec_dev, int hw_idx) { struct mtk_vdec_hw_dev *subdev_dev; @@ -191,7 +191,7 @@ static struct mtk_vcodec_pm *mtk_vcodec_dec_get_pm(struct mtk_vcodec_dev *vdec_d return &vdec_dev->pm; } -static void mtk_vcodec_dec_child_dev_on(struct mtk_vcodec_dev *vdec_dev, +static void mtk_vcodec_dec_child_dev_on(struct mtk_vcodec_dec_dev *vdec_dev, int hw_idx) { struct mtk_vcodec_pm *pm; @@ -211,7 +211,7 @@ static void mtk_vcodec_dec_child_dev_on(struct mtk_vcodec_dev *vdec_dev, } } -static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dev *vdec_dev, +static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dec_dev *vdec_dev, int hw_idx) { struct mtk_vcodec_pm *pm; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h index f6c68e57bcc1..87a50d589d42 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h @@ -7,7 +7,7 @@ #ifndef _MTK_VCODEC_DEC_PM_H_ #define _MTK_VCODEC_DEC_PM_H_ -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_dec_drv.h" int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c index 93230fe7ab97..459e74a46737 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c @@ -4,7 +4,6 @@ #include #include -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_dec.h" #include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" @@ -279,7 +278,7 @@ static void mtk_vdec_worker(struct work_struct *work) { struct mtk_vcodec_dec_ctx *ctx = container_of(work, struct mtk_vcodec_dec_ctx, decode_work); - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_dec_dev *dev = ctx->dev; struct vb2_v4l2_buffer *src_buf, *dst_buf; struct mtk_vcodec_mem buf; struct vdec_fb *pfb; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c index 9f9d2425a060..c65744d3cd28 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -6,7 +6,6 @@ #include #include -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_dec.h" #include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" @@ -288,7 +287,7 @@ static void mtk_vdec_worker(struct work_struct *work) { struct mtk_vcodec_dec_ctx *ctx = container_of(work, struct mtk_vcodec_dec_ctx, decode_work); - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_dec_dev *dev = ctx->dev; struct vb2_v4l2_buffer *vb2_v4l2_src; struct vb2_buffer *vb2_src; struct mtk_vcodec_mem *bs_src; @@ -444,7 +443,7 @@ const struct media_device_ops mtk_vcodec_media_ops = { static void mtk_vcodec_add_formats(unsigned int fourcc, struct mtk_vcodec_dec_ctx *ctx) { - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_dec_dev *dev = ctx->dev; const struct mtk_vcodec_dec_pdata *pdata = dev->vdec_pdata; int count_formats = *pdata->num_formats; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h deleted file mode 100644 index 76db7770d981..000000000000 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h +++ /dev/null @@ -1,295 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen -* Tiffany Lin -*/ - -#ifndef _MTK_VCODEC_DRV_H_ -#define _MTK_VCODEC_DRV_H_ - -#include -#include -#include -#include -#include -#include -#include - -#include "mtk_vcodec_dbgfs.h" -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" -#include "mtk_vcodec_util.h" -#include "vdec_msg_queue.h" - -#define MTK_VCODEC_DEC_NAME "mtk-vcodec-dec" -#define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" - -#define MTK_V4L2_BENCHMARK 0 -#define WAIT_INTR_TIMEOUT_MS 1000 -#define IS_VDEC_LAT_ARCH(hw_arch) ((hw_arch) >= MTK_VDEC_LAT_SINGLE_CORE) -#define IS_VDEC_INNER_RACING(capability) ((capability) & MTK_VCODEC_INNER_RACING) - -/* - * enum mtk_hw_reg_idx - MTK hw register base index - */ -enum mtk_hw_reg_idx { - VDEC_SYS, - VDEC_MISC, - VDEC_LD, - VDEC_TOP, - VDEC_CM, - VDEC_AD, - VDEC_AV, - VDEC_PP, - VDEC_HWD, - VDEC_HWQ, - VDEC_HWB, - VDEC_HWG, - NUM_MAX_VDEC_REG_BASE, - /* h264 encoder */ - VENC_SYS = NUM_MAX_VDEC_REG_BASE, - /* vp8 encoder */ - VENC_LT_SYS, - NUM_MAX_VCODEC_REG_BASE -}; - - - -/* - * enum mtk_vdec_hw_count - Supported hardware count - */ -enum mtk_vdec_hw_count { - MTK_VDEC_NO_HW = 0, - MTK_VDEC_ONE_CORE, - MTK_VDEC_ONE_LAT_ONE_CORE, - MTK_VDEC_MAX_HW_COUNT, -}; - -/* - * enum mtk_q_type - Type of queue - */ -enum mtk_q_type { - MTK_Q_DATA_SRC = 0, - MTK_Q_DATA_DST = 1, -}; - - -/* - * struct mtk_vcodec_clk_info - Structure used to store clock name - */ -struct mtk_vcodec_clk_info { - const char *clk_name; - struct clk *vcodec_clk; -}; - -/* - * struct mtk_vcodec_clk - Structure used to store vcodec clock information - */ -struct mtk_vcodec_clk { - struct mtk_vcodec_clk_info *clk_info; - int clk_num; -}; - -/* - * struct mtk_vcodec_pm - Power management data structure - */ -struct mtk_vcodec_pm { - struct mtk_vcodec_clk vdec_clk; - struct mtk_vcodec_clk venc_clk; - struct device *dev; -}; - -/* - * enum mtk_vdec_hw_arch - Used to separate different hardware architecture - */ -enum mtk_vdec_hw_arch { - MTK_VDEC_PURE_SINGLE_CORE, - MTK_VDEC_LAT_SINGLE_CORE, -}; - -/* - * struct mtk_vdec_format_types - Structure used to get supported - * format types according to decoder capability - */ -enum mtk_vdec_format_types { - MTK_VDEC_FORMAT_MM21 = 0x20, - MTK_VDEC_FORMAT_MT21C = 0x40, - MTK_VDEC_FORMAT_H264_SLICE = 0x100, - MTK_VDEC_FORMAT_VP8_FRAME = 0x200, - MTK_VDEC_FORMAT_VP9_FRAME = 0x400, - MTK_VDEC_FORMAT_AV1_FRAME = 0x800, - MTK_VDEC_FORMAT_HEVC_FRAME = 0x1000, - MTK_VCODEC_INNER_RACING = 0x20000, -}; - -/** - * struct mtk_vcodec_dec_pdata - compatible data for each IC - * @init_vdec_params: init vdec params - * @ctrls_setup: init vcodec dec ctrls - * @worker: worker to start a decode job - * @flush_decoder: function that flushes the decoder - * @get_cap_buffer: get capture buffer from capture queue - * @cap_to_disp: put capture buffer to disp list for lat and core arch - * @vdec_vb2_ops: struct vb2_ops - * - * @vdec_formats: supported video decoder formats - * @num_formats: count of video decoder formats - * @default_out_fmt: default output buffer format - * @default_cap_fmt: default capture buffer format - * - * @hw_arch: hardware arch is used to separate pure_sin_core and lat_sin_core - * - * @is_subdev_supported: whether support parent-node architecture(subdev) - * @uses_stateless_api: whether the decoder uses the stateless API with requests - */ - -struct mtk_vcodec_dec_pdata { - void (*init_vdec_params)(struct mtk_vcodec_dec_ctx *ctx); - int (*ctrls_setup)(struct mtk_vcodec_dec_ctx *ctx); - void (*worker)(struct work_struct *work); - int (*flush_decoder)(struct mtk_vcodec_dec_ctx *ctx); - struct vdec_fb *(*get_cap_buffer)(struct mtk_vcodec_dec_ctx *ctx); - void (*cap_to_disp)(struct mtk_vcodec_dec_ctx *ctx, int error, - struct media_request *src_buf_req); - - struct vb2_ops *vdec_vb2_ops; - - const struct mtk_video_fmt *vdec_formats; - const int *num_formats; - const struct mtk_video_fmt *default_out_fmt; - const struct mtk_video_fmt *default_cap_fmt; - - enum mtk_vdec_hw_arch hw_arch; - - bool is_subdev_supported; - bool uses_stateless_api; -}; - -/** - * struct mtk_vcodec_enc_pdata - compatible data for each IC - * - * @uses_ext: whether the encoder uses the extended firmware messaging format - * @min_bitrate: minimum supported encoding bitrate - * @max_bitrate: maximum supported encoding bitrate - * @capture_formats: array of supported capture formats - * @num_capture_formats: number of entries in capture_formats - * @output_formats: array of supported output formats - * @num_output_formats: number of entries in output_formats - * @core_id: stand for h264 or vp8 encode index - * @uses_34bit: whether the encoder uses 34-bit iova - */ -struct mtk_vcodec_enc_pdata { - bool uses_ext; - unsigned long min_bitrate; - unsigned long max_bitrate; - const struct mtk_video_fmt *capture_formats; - size_t num_capture_formats; - const struct mtk_video_fmt *output_formats; - size_t num_output_formats; - int core_id; - bool uses_34bit; -}; - -#define MTK_ENC_CTX_IS_EXT(ctx) ((ctx)->dev->venc_pdata->uses_ext) -#define MTK_ENC_IOVA_IS_34BIT(ctx) ((ctx)->dev->venc_pdata->uses_34bit) - -/** - * struct mtk_vcodec_dev - driver data - * @v4l2_dev: V4L2 device to register video devices for. - * @vfd_dec: Video device for decoder - * @mdev_dec: Media device for decoder - * @vfd_enc: Video device for encoder. - * - * @m2m_dev_dec: m2m device for decoder - * @m2m_dev_enc: m2m device for encoder. - * @plat_dev: platform device - * @ctx_list: list of struct mtk_vcodec_dec_ctx - * @irqlock: protect data access by irq handler and work thread - * @curr_ctx: The context that is waiting for codec hardware - * @curr_enc_ctx: The encoder context that is waiting for codec hardware - * - * @reg_base: Mapped address of MTK Vcodec registers. - * @vdec_pdata: decoder IC-specific data - * @venc_pdata: encoder IC-specific data - * - * @fw_handler: used to communicate with the firmware. - * @id_counter: used to identify current opened instance - * - * @decode_workqueue: decode work queue - * @encode_workqueue: encode work queue - * - * @dev_mutex: video_device lock - * - * @dec_irq: decoder irq resource - * @enc_irq: h264 encoder irq resource - * - * @dec_mutex: decoder hardware lock - * @enc_mutex: encoder hardware lock. - * - * @pm: power management control - * @dec_capability: used to identify decode capability, ex: 4k - * @enc_capability: used to identify encode capability - * - * @core_workqueue: queue used for core hardware decode - * - * @subdev_dev: subdev hardware device - * @subdev_prob_done: check whether all used hw device is prob done - * @subdev_bitmap: used to record hardware is ready or not - * - * @dec_active_cnt: used to mark whether need to record register value - * @vdec_racing_info: record register value - * @dec_racing_info_mutex: mutex lock used for inner racing mode - * @dbgfs: debug log related information - */ -struct mtk_vcodec_dev { - struct v4l2_device v4l2_dev; - struct video_device *vfd_dec; - struct media_device mdev_dec; - struct video_device *vfd_enc; - - struct v4l2_m2m_dev *m2m_dev_dec; - struct v4l2_m2m_dev *m2m_dev_enc; - struct platform_device *plat_dev; - struct list_head ctx_list; - spinlock_t irqlock; - struct mtk_vcodec_dec_ctx *curr_ctx; - struct mtk_vcodec_enc_ctx *curr_enc_ctx; - void __iomem *reg_base[NUM_MAX_VCODEC_REG_BASE]; - const struct mtk_vcodec_dec_pdata *vdec_pdata; - const struct mtk_vcodec_enc_pdata *venc_pdata; - - struct mtk_vcodec_fw *fw_handler; - - unsigned long id_counter; - - struct workqueue_struct *decode_workqueue; - struct workqueue_struct *encode_workqueue; - struct mutex dev_mutex; - - int dec_irq; - int enc_irq; - - /* decoder hardware mutex lock */ - struct mutex dec_mutex[MTK_VDEC_HW_MAX]; - struct mutex enc_mutex; - - struct mtk_vcodec_pm pm; - unsigned int dec_capability; - unsigned int enc_capability; - - struct workqueue_struct *core_workqueue; - - void *subdev_dev[MTK_VDEC_HW_MAX]; - int (*subdev_prob_done)(struct mtk_vcodec_dev *vdec_dev); - DECLARE_BITMAP(subdev_bitmap, MTK_VDEC_HW_MAX); - - atomic_t dec_active_cnt; - u32 vdec_racing_info[132]; - /* Protects access to vdec_racing_info data */ - struct mutex dec_racing_info_mutex; - - struct mtk_vcodec_dbgfs dbgfs; -}; - -#endif /* _MTK_VCODEC_DRV_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c index deabf012848e..85dabb20fb11 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c @@ -10,7 +10,6 @@ #include #include -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_enc.h" #include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" @@ -1436,7 +1435,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq, int mtk_venc_unlock(struct mtk_vcodec_enc_ctx *ctx) { - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_enc_dev *dev = ctx->dev; mutex_unlock(&dev->enc_mutex); return 0; @@ -1444,7 +1443,7 @@ int mtk_venc_unlock(struct mtk_vcodec_enc_ctx *ctx) int mtk_venc_lock(struct mtk_vcodec_enc_ctx *ctx) { - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_enc_dev *dev = ctx->dev; mutex_lock(&dev->enc_mutex); return 0; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index c9b6ce9dfa2d..0830708de32f 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -16,7 +16,6 @@ #include #include -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_enc.h" #include "mtk_vcodec_enc_pm.h" #include "mtk_vcodec_intr.h" @@ -85,14 +84,14 @@ static void clean_irq_status(unsigned int irq_status, void __iomem *addr) } static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv) { - struct mtk_vcodec_dev *dev = priv; + struct mtk_vcodec_enc_dev *dev = priv; struct mtk_vcodec_enc_ctx *ctx; unsigned long flags; void __iomem *addr; int core_id; spin_lock_irqsave(&dev->irqlock, flags); - ctx = dev->curr_enc_ctx; + ctx = dev->curr_ctx; spin_unlock_irqrestore(&dev->irqlock, flags); core_id = dev->venc_pdata->core_id; @@ -116,7 +115,7 @@ static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv) static int fops_vcodec_open(struct file *file) { - struct mtk_vcodec_dev *dev = video_drvdata(file); + struct mtk_vcodec_enc_dev *dev = video_drvdata(file); struct mtk_vcodec_enc_ctx *ctx = NULL; int ret = 0; struct vb2_queue *src_vq; @@ -203,7 +202,7 @@ static int fops_vcodec_open(struct file *file) static int fops_vcodec_release(struct file *file) { - struct mtk_vcodec_dev *dev = video_drvdata(file); + struct mtk_vcodec_enc_dev *dev = video_drvdata(file); struct mtk_vcodec_enc_ctx *ctx = fh_to_enc_ctx(file->private_data); mtk_v4l2_venc_dbg(1, ctx, "[%d] encoder", ctx->id); @@ -232,7 +231,7 @@ static const struct v4l2_file_operations mtk_vcodec_fops = { static int mtk_vcodec_probe(struct platform_device *pdev) { - struct mtk_vcodec_dev *dev; + struct mtk_vcodec_enc_dev *dev; struct video_device *vfd_enc; phandle rproc_phandle; enum mtk_vcodec_fw_type fw_type; @@ -454,7 +453,7 @@ MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match); static void mtk_vcodec_enc_remove(struct platform_device *pdev) { - struct mtk_vcodec_dev *dev = platform_get_drvdata(pdev); + struct mtk_vcodec_enc_dev *dev = platform_get_drvdata(pdev); destroy_workqueue(dev->encode_workqueue); if (dev->m2m_dev_enc) @@ -463,7 +462,7 @@ static void mtk_vcodec_enc_remove(struct platform_device *pdev) if (dev->vfd_enc) video_unregister_device(dev->vfd_enc); - mtk_vcodec_dbgfs_deinit(dev); + mtk_vcodec_dbgfs_deinit(&dev->dbgfs); v4l2_device_unregister(&dev->v4l2_dev); pm_runtime_disable(dev->pm.dev); mtk_vcodec_fw_release(dev->fw_handler); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h index 34f25a6c8339..4662b7871f74 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h @@ -8,7 +8,39 @@ #define _MTK_VCODEC_ENC_DRV_H_ #include "mtk_vcodec_com_drv.h" +#include "mtk_vcodec_dbgfs.h" #include "mtk_vcodec_fw_priv.h" +#include "mtk_vcodec_util.h" + +#define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" + +#define MTK_ENC_CTX_IS_EXT(ctx) ((ctx)->dev->venc_pdata->uses_ext) +#define MTK_ENC_IOVA_IS_34BIT(ctx) ((ctx)->dev->venc_pdata->uses_34bit) + +/** + * struct mtk_vcodec_enc_pdata - compatible data for each IC + * + * @uses_ext: whether the encoder uses the extended firmware messaging format + * @min_bitrate: minimum supported encoding bitrate + * @max_bitrate: maximum supported encoding bitrate + * @capture_formats: array of supported capture formats + * @num_capture_formats: number of entries in capture_formats + * @output_formats: array of supported output formats + * @num_output_formats: number of entries in output_formats + * @core_id: stand for h264 or vp8 encode index + * @uses_34bit: whether the encoder uses 34-bit iova + */ +struct mtk_vcodec_enc_pdata { + bool uses_ext; + unsigned long min_bitrate; + unsigned long max_bitrate; + const struct mtk_video_fmt *capture_formats; + size_t num_capture_formats; + const struct mtk_video_fmt *output_formats; + size_t num_output_formats; + int core_id; + bool uses_34bit; +}; /* * enum mtk_encode_param - General encoding parameters type @@ -61,8 +93,8 @@ struct mtk_enc_params { * struct mtk_vcodec_enc_ctx - Context (instance) private data. * * @type: type of encoder instance - * @dev: pointer to the mtk_vcodec_dev of the device - * @list: link to ctx_list of mtk_vcodec_dev + * @dev: pointer to the mtk_vcodec_enc_dev of the device + * @list: link to ctx_list of mtk_vcodec_enc_dev * * @fh: struct v4l2_fh * @m2m_ctx: pointer to the v4l2_m2m_ctx of the context @@ -94,7 +126,7 @@ struct mtk_enc_params { */ struct mtk_vcodec_enc_ctx { enum mtk_instance_type type; - struct mtk_vcodec_dev *dev; + struct mtk_vcodec_enc_dev *dev; struct list_head list; struct v4l2_fh fh; @@ -126,6 +158,61 @@ struct mtk_vcodec_enc_ctx { struct mutex q_mutex; }; +/** + * struct mtk_vcodec_enc_dev - driver data + * @v4l2_dev: V4L2 device to register video devices for. + * @vfd_enc: Video device for encoder. + * + * @m2m_dev_enc: m2m device for encoder. + * @plat_dev: platform device + * @ctx_list: list of struct mtk_vcodec_ctx + * @curr_ctx: The context that is waiting for codec hardware + * + * @reg_base: Mapped address of MTK Vcodec registers. + * @venc_pdata: encoder IC-specific data + * + * @fw_handler: used to communicate with the firmware. + * @id_counter: used to identify current opened instance + * + * @enc_mutex: encoder hardware lock. + * @dev_mutex: video_device lock + * @encode_workqueue: encode work queue + * + * @enc_irq: h264 encoder irq resource + * @irqlock: protect data access by irq handler and work thread + * + * @pm: power management control + * @enc_capability: used to identify encode capability + * @dbgfs: debug log related information + */ +struct mtk_vcodec_enc_dev { + struct v4l2_device v4l2_dev; + struct video_device *vfd_enc; + + struct v4l2_m2m_dev *m2m_dev_enc; + struct platform_device *plat_dev; + struct list_head ctx_list; + struct mtk_vcodec_enc_ctx *curr_ctx; + + void __iomem *reg_base[NUM_MAX_VCODEC_REG_BASE]; + const struct mtk_vcodec_enc_pdata *venc_pdata; + + struct mtk_vcodec_fw *fw_handler; + unsigned long id_counter; + + /* encoder hardware mutex lock */ + struct mutex enc_mutex; + struct mutex dev_mutex; + struct workqueue_struct *encode_workqueue; + + int enc_irq; + spinlock_t irqlock; + + struct mtk_vcodec_pm pm; + unsigned int enc_capability; + struct mtk_vcodec_dbgfs dbgfs; +}; + static inline struct mtk_vcodec_enc_ctx *fh_to_enc_ctx(struct v4l2_fh *fh) { return container_of(fh, struct mtk_vcodec_enc_ctx, fh); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c index 3165e114b221..f7481f33a0b2 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c @@ -9,10 +9,10 @@ #include #include +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_enc_pm.h" -#include "mtk_vcodec_util.h" -int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev) +int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *mtkdev) { struct platform_device *pdev; struct mtk_vcodec_pm *pm; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.h index bc455cefc0cd..e50be0575190 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.h @@ -7,9 +7,9 @@ #ifndef _MTK_VCODEC_ENC_PM_H_ #define _MTK_VCODEC_ENC_PM_H_ -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_enc_drv.h" -int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *dev); +int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *dev); void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm); void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c index 6e6986fb28bb..99e6c8d7ef79 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c @@ -1,20 +1,28 @@ // SPDX-License-Identifier: GPL-2.0 +#include "mtk_vcodec_dec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw.h" #include "mtk_vcodec_fw_priv.h" #include "mtk_vcodec_util.h" -#include "mtk_vcodec_drv.h" struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type, enum mtk_vcodec_fw_use fw_use) { + struct platform_device *plat_dev; + + if (fw_use == ENCODER) + plat_dev = ((struct mtk_vcodec_enc_dev *)priv)->plat_dev; + else + plat_dev = ((struct mtk_vcodec_dec_dev *)priv)->plat_dev; + switch (type) { case VPU: return mtk_vcodec_fw_vpu_init(priv, fw_use); case SCP: return mtk_vcodec_fw_scp_init(priv, fw_use); default: - pr_err(MTK_DBG_VCODEC_STR "Invalid vcodec fw type"); + dev_err(&plat_dev->dev, "Invalid vcodec fw type"); return ERR_PTR(-EINVAL); } } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h index d8cfbec323d5..83479ab70385 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h @@ -8,7 +8,8 @@ #include "../vpu/mtk_vpu.h" -struct mtk_vcodec_dev; +struct mtk_vcodec_dec_dev; +struct mtk_vcodec_enc_dev; enum mtk_vcodec_fw_type { VPU, diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h index 3438a4917344..99603accd82e 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h @@ -5,7 +5,8 @@ #include "mtk_vcodec_fw.h" -struct mtk_vcodec_dev; +struct mtk_vcodec_dec_dev; +struct mtk_vcodec_enc_dev; struct mtk_vcodec_fw { enum mtk_vcodec_fw_type type; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c index 71ff1a6ae872..3cb5a5befd24 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 +#include "mtk_vcodec_dec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw_priv.h" -#include "mtk_vcodec_util.h" -#include "mtk_vcodec_drv.h" static int mtk_vcodec_scp_load_firmware(struct mtk_vcodec_fw *fw) { @@ -56,14 +56,25 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_rproc_msg = { struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use fw_use) { struct mtk_vcodec_fw *fw; - struct mtk_vcodec_dev *dev = priv; struct platform_device *plat_dev; struct mtk_scp *scp; - plat_dev = dev->plat_dev; + if (fw_use == ENCODER) { + struct mtk_vcodec_enc_dev *enc_dev = priv; + + plat_dev = enc_dev->plat_dev; + } else if (fw_use == DECODER) { + struct mtk_vcodec_dec_dev *dec_dev = priv; + + plat_dev = dec_dev->plat_dev; + } else { + pr_err("Invalid fw_use %d (use a resonable fw id here)\n", fw_use); + return ERR_PTR(-EINVAL); + } + scp = scp_get(plat_dev); if (!scp) { - dev_err(&dev->plat_dev->dev, "could not get vdec scp handle"); + dev_err(&plat_dev->dev, "could not get vdec scp handle"); return ERR_PTR(-EPROBE_DEFER); } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c index 571072dffbfa..18274a51a8f8 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 +#include "mtk_vcodec_dec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw_priv.h" -#include "mtk_vcodec_util.h" -#include "mtk_vcodec_drv.h" static int mtk_vcodec_vpu_load_firmware(struct mtk_vcodec_fw *fw) { @@ -53,7 +53,7 @@ static void mtk_vcodec_vpu_release(struct mtk_vcodec_fw *fw) static void mtk_vcodec_vpu_reset_dec_handler(void *priv) { - struct mtk_vcodec_dev *dev = priv; + struct mtk_vcodec_dec_dev *dev = priv; struct mtk_vcodec_dec_ctx *ctx; dev_err(&dev->plat_dev->dev, "Watchdog timeout!!"); @@ -68,7 +68,7 @@ static void mtk_vcodec_vpu_reset_dec_handler(void *priv) static void mtk_vcodec_vpu_reset_enc_handler(void *priv) { - struct mtk_vcodec_dev *dev = priv; + struct mtk_vcodec_enc_dev *dev = priv; struct mtk_vcodec_enc_ctx *ctx; dev_err(&dev->plat_dev->dev, "Watchdog timeout!!"); @@ -94,24 +94,28 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = { struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use fw_use) { struct platform_device *fw_pdev; - struct mtk_vcodec_dev *dev = priv; struct platform_device *plat_dev; struct mtk_vcodec_fw *fw; enum rst_id rst_id; if (fw_use == ENCODER) { + struct mtk_vcodec_enc_dev *enc_dev = priv; + + plat_dev = enc_dev->plat_dev; rst_id = VPU_RST_ENC; } else if (fw_use == DECODER) { + struct mtk_vcodec_dec_dev *dec_dev = priv; + + plat_dev = dec_dev->plat_dev; rst_id = VPU_RST_DEC; } else { pr_err("Invalid fw_use %d (use a resonable fw id here)\n", fw_use); return ERR_PTR(-EINVAL); } - plat_dev = dev->plat_dev; fw_pdev = vpu_get_plat_device(plat_dev); if (!fw_pdev) { - dev_err(&dev->plat_dev->dev, "firmware device is not ready"); + dev_err(&plat_dev->dev, "firmware device is not ready"); return ERR_PTR(-EINVAL); } diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c index 1a77b9b39894..1c63fbbec653 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c @@ -7,9 +7,9 @@ #include #include -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_dec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms, unsigned int hw_id) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c index 92a4c2fca780..f6eba7163fdf 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c @@ -9,9 +9,9 @@ #include #include +#include "mtk_vcodec_dec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_dec_hw.h" -#include "mtk_vcodec_drv.h" -#include "mtk_vcodec_util.h" #if defined(CONFIG_DEBUG_FS) int mtk_vcodec_dbg; @@ -75,7 +75,7 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) } EXPORT_SYMBOL(mtk_vcodec_mem_free); -void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx) +void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dec_dev *dev, int hw_idx) { if (hw_idx >= MTK_VDEC_HW_MAX || hw_idx < 0 || !dev->subdev_dev[hw_idx]) { dev_err(&dev->plat_dev->dev, "hw idx is out of range:%d", hw_idx); @@ -86,7 +86,7 @@ void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx) } EXPORT_SYMBOL(mtk_vcodec_get_hw_dev); -void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev, +void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dec_dev *vdec_dev, struct mtk_vcodec_dec_ctx *ctx, int hw_idx) { unsigned long flags; @@ -108,7 +108,7 @@ void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev, } EXPORT_SYMBOL(mtk_vcodec_set_curr_ctx); -struct mtk_vcodec_dec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev, +struct mtk_vcodec_dec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dec_dev *vdec_dev, unsigned int hw_idx) { unsigned long flags; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h index d70ad171fa16..27fe2363373a 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h @@ -26,7 +26,7 @@ struct mtk_vcodec_fb { }; struct mtk_vcodec_dec_ctx; -struct mtk_vcodec_dev; +struct mtk_vcodec_dec_dev; #undef pr_fmt #define pr_fmt(fmt) "%s(),%d: " fmt, __func__, __LINE__ @@ -86,10 +86,10 @@ extern int mtk_vcodec_dbg; void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx); int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem); void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem); -void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev, +void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dec_dev *vdec_dev, struct mtk_vcodec_dec_ctx *ctx, int hw_idx); -struct mtk_vcodec_dec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev, +struct mtk_vcodec_dec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dec_dev *vdec_dev, unsigned int hw_idx); -void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx); +void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dec_dev *dev, int hw_idx); #endif /* _MTK_VCODEC_UTIL_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h index 0dda9e2315c0..ac82be336055 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h @@ -13,7 +13,7 @@ #include #include -#include "../mtk_vcodec_drv.h" +#include "../mtk_vcodec_dec_drv.h" #define NAL_NON_IDR_SLICE 0x01 #define NAL_IDR_SLICE 0x05 diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c index 846cc39c0168..79eff921fc97 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c @@ -540,7 +540,7 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf) return 0; } -static void vdec_h264_insert_startcode(struct mtk_vcodec_dev *vcodec_dev, unsigned char *buf, +static void vdec_h264_insert_startcode(struct mtk_vcodec_dec_dev *vcodec_dev, unsigned char *buf, size_t *bs_size, struct mtk_h264_pps_param *pps) { struct device *dev = &vcodec_dev->plat_dev->dev; diff --git a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h b/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h index 816ed6ab1ed0..7b41ce23158b 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h +++ b/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h @@ -8,7 +8,6 @@ #ifndef _VDEC_DRV_IF_H_ #define _VDEC_DRV_IF_H_ -#include "mtk_vcodec_drv.h" #include "mtk_vcodec_dec.h" #include "mtk_vcodec_util.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c index 0dd1374ccc38..890b955e4b31 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c @@ -8,8 +8,8 @@ #include #include +#include "mtk_vcodec_dec_drv.h" #include "mtk_vcodec_dec_pm.h" -#include "mtk_vcodec_drv.h" #include "vdec_msg_queue.h" #define VDEC_MSG_QUEUE_TIMEOUT_MS 1500 @@ -239,7 +239,7 @@ static void vdec_msg_queue_core_work(struct work_struct *work) container_of(work, struct vdec_msg_queue, core_work); struct mtk_vcodec_dec_ctx *ctx = container_of(msg_queue, struct mtk_vcodec_dec_ctx, msg_queue); - struct mtk_vcodec_dev *dev = ctx->dev; + struct mtk_vcodec_dec_dev *dev = ctx->dev; struct vdec_lat_buf *lat_buf; spin_lock(&msg_queue->core_ctx.ready_lock); diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h index 1fb3f57c2384..eeb5deb907ed 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h @@ -18,7 +18,7 @@ struct vdec_lat_buf; struct mtk_vcodec_dec_ctx; -struct mtk_vcodec_dev; +struct mtk_vcodec_dec_dev; typedef int (*core_decode_cb_t)(struct vdec_lat_buf *lat_buf); /** diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c index d82391411ba1..7fe8e196cb45 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c @@ -4,8 +4,7 @@ * Author: PC Chen */ -#include "mtk_vcodec_drv.h" -#include "mtk_vcodec_util.h" +#include "mtk_vcodec_dec_drv.h" #include "vdec_drv_if.h" #include "vdec_ipi_msg.h" #include "vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c index c5f9fc24a692..41d463d40843 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c @@ -10,7 +10,7 @@ #include #include -#include "../mtk_vcodec_drv.h" +#include "../mtk_vcodec_enc_drv.h" #include "../mtk_vcodec_util.h" #include "../mtk_vcodec_intr.h" #include "../mtk_vcodec_enc.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c index e8e4474eacc7..dfd6833576f4 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c @@ -9,7 +9,7 @@ #include #include -#include "../mtk_vcodec_drv.h" +#include "../mtk_vcodec_enc_drv.h" #include "../mtk_vcodec_util.h" #include "../mtk_vcodec_intr.h" #include "../mtk_vcodec_enc.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc_drv_base.h b/drivers/media/platform/mediatek/vcodec/venc_drv_base.h index 17f8183461b5..856d50151bf6 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_drv_base.h +++ b/drivers/media/platform/mediatek/vcodec/venc_drv_base.h @@ -9,7 +9,7 @@ #ifndef _VENC_DRV_BASE_ #define _VENC_DRV_BASE_ -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "venc_drv_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc_drv_if.c b/drivers/media/platform/mediatek/vcodec/venc_drv_if.c index 08083030516e..1bdaecdd64a7 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_drv_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc_drv_if.c @@ -65,7 +65,7 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx, mtk_venc_lock(ctx); spin_lock_irqsave(&ctx->dev->irqlock, flags); - ctx->dev->curr_enc_ctx = ctx; + ctx->dev->curr_ctx = ctx; spin_unlock_irqrestore(&ctx->dev->irqlock, flags); mtk_vcodec_enc_clock_on(&ctx->dev->pm); @@ -74,7 +74,7 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx, mtk_vcodec_enc_clock_off(&ctx->dev->pm); spin_lock_irqsave(&ctx->dev->irqlock, flags); - ctx->dev->curr_enc_ctx = NULL; + ctx->dev->curr_ctx = NULL; spin_unlock_irqrestore(&ctx->dev->irqlock, flags); mtk_venc_unlock(ctx); diff --git a/drivers/media/platform/mediatek/vcodec/venc_drv_if.h b/drivers/media/platform/mediatek/vcodec/venc_drv_if.h index 90d714e86ede..d00fb68b8235 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_drv_if.h +++ b/drivers/media/platform/mediatek/vcodec/venc_drv_if.h @@ -9,8 +9,7 @@ #ifndef _VENC_DRV_IF_H_ #define _VENC_DRV_IF_H_ -#include "mtk_vcodec_drv.h" -#include "mtk_vcodec_util.h" +#include "mtk_vcodec_enc_drv.h" /* * enum venc_yuv_fmt - The type of input yuv format diff --git a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c index c69f66b6d341..bfff16da0451 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c @@ -4,7 +4,7 @@ * Author: PoChun Lin */ -#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw.h" #include "venc_ipi_msg.h" #include "venc_vpu_if.h" From patchwork Tue Jul 4 11:13:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13301009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23443EB64D9 for ; Tue, 4 Jul 2023 11:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=j0BDoCnpFIhIGTZIpQQVMW5oqVHdo7wsqc64MPsr4IA=; b=IYi/SlBObzVzdF LM3SinISfzI+BJdA/VwLVkfoPhafSYlz7iUkT8k2srEzsUZovOA86yVRDUAiM0JY45UOOuoGWzUHt yYRhfb2X5h590jCj22mynD6c8ZPsg03Lxnm//0QeVy9XxcK4jYFRWld3/LA3+o+2tg6h5ukOidDMy POymebg6L0hlQ0AQlP+H9h4YYN0dzrctsmCp1+oiRG8nROJG6K8BmT8Vkkq3wvopA6bPGiwVle72D vw8/H8QvLC3YKcvK+zHY2XGLZcdW2yFbnj/mp1Pk+Bvk9vvprsQVQ10zSLcwbUPxG06x23+cztIw+ iAgnyBlQrwwvtXLbvK5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGe8M-00D7NO-1u; Tue, 04 Jul 2023 11:23:50 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGe8J-00D7Lu-1b; Tue, 04 Jul 2023 11:23:48 +0000 X-UUID: 3b5397541a5d11ee912e1518a6540028-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=IhKUWk3HweVVnCZmH7MiqP20PZkaQtj3SSJwS7C570E=; b=NbhvcnnTxd6frbojn6Uhy+8BLLq9wulVC5Hsp04MWgZXyskZ5moXeXEFjtwBU8bVXYItq2S4ab/0Q56dKArMuXRXqFKUu6GtUucbxhjyfaTk27OhBrlAEYx0CQvN6yJhOdi9Pqmd25rsqlkxxYGNHzgwmvqhq/sbxVwxicheK3c=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:46c18139-9858-4b26-a486-522af16a6266,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:01c9525,CLOUDID:ff228d0d-26a8-467f-b838-f99719a9c083,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 3b5397541a5d11ee912e1518a6540028-20230704 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 805717257; Tue, 04 Jul 2023 04:23:42 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:38 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:38 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,09/11] media: mediatek: vcodec: fix unreasonable parameter definition and style Date: Tue, 4 Jul 2023 19:13:25 +0800 Message-ID: <20230704111327.7140-10-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_042347_536708_634A562C X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix unreasonable coding style. Fix unreasonable parameter definition. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- .../media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h | 4 ++-- .../media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h index 983a83f7b640..36a4cfa622f5 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h @@ -19,7 +19,7 @@ #define IS_VDEC_INNER_RACING(capability) ((capability) & MTK_VCODEC_INNER_RACING) /* - * struct mtk_vdec_format_types - Structure used to get supported + * enum mtk_vdec_format_types - Structure used to get supported * format types according to decoder capability */ enum mtk_vdec_format_types { @@ -256,7 +256,7 @@ struct mtk_vcodec_dec_dev { const struct mtk_vcodec_dec_pdata *vdec_pdata; struct mtk_vcodec_fw *fw_handler; - unsigned long id_counter; + u64 id_counter; /* decoder hardware mutex lock */ struct mutex dec_mutex[MTK_VDEC_HW_MAX]; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h index 4662b7871f74..fcd3d9b271ea 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h @@ -32,13 +32,13 @@ */ struct mtk_vcodec_enc_pdata { bool uses_ext; - unsigned long min_bitrate; - unsigned long max_bitrate; + u64 min_bitrate; + u64 max_bitrate; const struct mtk_video_fmt *capture_formats; size_t num_capture_formats; const struct mtk_video_fmt *output_formats; size_t num_output_formats; - int core_id; + u8 core_id; bool uses_34bit; }; @@ -198,7 +198,7 @@ struct mtk_vcodec_enc_dev { const struct mtk_vcodec_enc_pdata *venc_pdata; struct mtk_vcodec_fw *fw_handler; - unsigned long id_counter; + u64 id_counter; /* encoder hardware mutex lock */ struct mutex enc_mutex; From patchwork Tue Jul 4 11:13:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13300995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6324EC001B3 for ; Tue, 4 Jul 2023 11:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=CGdGdHvF4H1Gf+DtPPV+MKT5XWxqYDh34r/Zk9jB0HI=; b=BE0wE44hUcvXU9 S9xqFuodYAFO1nmykX8hi/IvG2nFTGN3U22IholEyhGEiJ/su1ChoZPsh0tSyIv23auvRJ/9or7HX k//e1IAPM4ZmkNt1owqYoCB8h3NdMpHg2o/0tV2QYezQq5kGduvefW6/inJRcLOtK6AP2FGtqmfRQ pyKMXN2hNY5kupIcrAntgci3exrE8SZ+ozryUqFgOzy6WpM/+F32WCn+2K9EsGhuK9kYgP9I8QGoi 099+SDv/MH17KpsPOOLyeAj24AE9RgNBrOX46mlnN7ONBCaUb2MlLM3caHM1hDzdEdGn/O76/WO3j HCSHl8b5P01l+di61cxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyk-00D5TH-0V; Tue, 04 Jul 2023 11:13:54 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGdyd-00D5On-11; Tue, 04 Jul 2023 11:13:50 +0000 X-UUID: d5c3fb5a1a5b11ee83ed1395ce914268-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=w6hd//U+G4yE+u7SMv6qfYeSLxX6tcQ82NxKW3hklfg=; b=TA3onMV08KwmllZPSr/wqVPBJ3PCH9GbUBHpshdEkoEKp9Gfxwltz4Cg9yvdS8VDcgyUxbe3l+IO5D3eMuFgVjRT1fVzDX0a1rTrrIT3ZVtotpBs0eIKETGyKdJFeVrD5euujYJmgjPPJ4Ook78BFnTDqTPX1DeUl4n/7mOhWtI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:23135f4c-042e-4443-98ec-3d120a451887,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.27,REQID:23135f4c-042e-4443-98ec-3d120a451887,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:01c9525,CLOUDID:cd128d0d-26a8-467f-b838-f99719a9c083,B ulkID:2307041913439Y8D1WA1,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_ASC,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_SNR, TF_CID_SPAM_SDM X-UUID: d5c3fb5a1a5b11ee83ed1395ce914268-20230704 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1819434035; Tue, 04 Jul 2023 04:13:42 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 4 Jul 2023 19:13:39 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:39 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,10/11] media: mediatek: vcodec: remove unused include header Date: Tue, 4 Jul 2023 19:13:26 +0800 Message-ID: <20230704111327.7140-11-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_041347_372729_4A77A429 X-CRM114-Status: GOOD ( 11.31 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org remove unused include header for .c files Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c | 1 - drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c | 1 - .../media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c | 2 -- .../media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c | 2 -- .../media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c | 1 - drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c | 1 - drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c | 1 - .../platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c | 1 - .../platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c | 1 - drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c | 1 - drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c | 1 - .../media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 1 - drivers/media/platform/mediatek/vcodec/vdec_drv_if.h | 1 - drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h | 2 -- drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c | 1 - drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h | 2 -- drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c | 1 - drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c | 1 - drivers/media/platform/mediatek/vcodec/venc_vpu_if.c | 1 - drivers/media/platform/mediatek/vcodec/venc_vpu_if.h | 1 - 25 files changed, 34 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c index 0363fec572e5..5acb7dff18f2 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c @@ -11,8 +11,6 @@ #include "mtk_vcodec_dec_drv.h" #include "mtk_vcodec_dec.h" -#include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" #include "vdec_drv_if.h" #include "mtk_vcodec_dec_pm.h" diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index 8e3aea9a3ab0..36970113d069 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -21,8 +21,6 @@ #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" #include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" -#include "mtk_vcodec_fw.h" static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vcodec_dec_dev *dev) { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c index 23c19efa3cf6..fa02fcf4e8c2 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c @@ -16,7 +16,6 @@ #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" #include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" static const struct of_device_id mtk_vdec_hw_match[] = { { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c index ed1f503a944e..edd3e6e2df85 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c @@ -12,7 +12,6 @@ #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" -#include "mtk_vcodec_util.h" int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm) { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c index 459e74a46737..11ca2c2fbaad 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c @@ -5,8 +5,6 @@ #include #include "mtk_vcodec_dec.h" -#include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" #include "mtk_vcodec_dec_pm.h" #include "vdec_drv_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c index c65744d3cd28..99a84c7e1901 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -7,8 +7,6 @@ #include #include "mtk_vcodec_dec.h" -#include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" #include "mtk_vcodec_dec_pm.h" #include "vdec_drv_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c index 85dabb20fb11..8e44a051edda 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c @@ -11,8 +11,6 @@ #include #include "mtk_vcodec_enc.h" -#include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" #include "venc_drv_if.h" #define MTK_VENC_MIN_W 160U diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c index 0830708de32f..f1b4d5e8cd49 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -19,8 +19,6 @@ #include "mtk_vcodec_enc.h" #include "mtk_vcodec_enc_pm.h" #include "mtk_vcodec_intr.h" -#include "mtk_vcodec_util.h" -#include "mtk_vcodec_fw.h" static const struct mtk_video_fmt mtk_video_formats_output[] = { { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c index 99e6c8d7ef79..de77c71f7e87 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c @@ -2,9 +2,7 @@ #include "mtk_vcodec_dec_drv.h" #include "mtk_vcodec_enc_drv.h" -#include "mtk_vcodec_fw.h" #include "mtk_vcodec_fw_priv.h" -#include "mtk_vcodec_util.h" struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type, enum mtk_vcodec_fw_use fw_use) diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c index ebd2f76be863..e7ae2dc8f6bf 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c @@ -8,7 +8,6 @@ #include #include -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c index 69914e26cd20..a8175f977ed2 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c @@ -8,7 +8,6 @@ #include #include "../vdec_drv_if.h" -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c index 4eb98a705be4..4c5ef35199a1 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c @@ -6,7 +6,6 @@ #include #include -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c index 79eff921fc97..0f9f7b56882f 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c @@ -10,7 +10,6 @@ #include #include -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c index 67a5f8b82eb8..2682f40d1361 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c @@ -8,7 +8,6 @@ #include #include -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c index ce5fbed6432e..5beb58f97905 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c @@ -7,7 +7,6 @@ #include #include "../vdec_drv_if.h" -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c index d3103b877b61..c85c849d2548 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c @@ -9,7 +9,6 @@ #include #include -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c index 106ee4daf00b..3e9458470484 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c @@ -9,7 +9,6 @@ #include #include -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_dec.h" #include "../mtk_vcodec_intr.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h b/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h index 7b41ce23158b..bfd297c96850 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h +++ b/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h @@ -9,7 +9,6 @@ #define _VDEC_DRV_IF_H_ #include "mtk_vcodec_dec.h" -#include "mtk_vcodec_util.h" /** diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h index eeb5deb907ed..1d9beb9e4a14 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h @@ -12,8 +12,6 @@ #include #include -#include "mtk_vcodec_util.h" - #define NUM_BUFFER_COUNT 3 struct vdec_lat_buf; diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c index 7fe8e196cb45..82c3dc8c4127 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c @@ -8,7 +8,6 @@ #include "vdec_drv_if.h" #include "vdec_ipi_msg.h" #include "vdec_vpu_if.h" -#include "mtk_vcodec_fw.h" static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg) { diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h index c9766c108209..fbb3f34a73f0 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h +++ b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h @@ -7,8 +7,6 @@ #ifndef _VDEC_VPU_IF_H_ #define _VDEC_VPU_IF_H_ -#include "mtk_vcodec_fw.h" - struct mtk_vcodec_dec_ctx; /** diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c index 41d463d40843..9127bceb0db4 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c @@ -11,7 +11,6 @@ #include #include "../mtk_vcodec_enc_drv.h" -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_intr.h" #include "../mtk_vcodec_enc.h" #include "../mtk_vcodec_enc_pm.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c index dfd6833576f4..510f3b042670 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c @@ -10,7 +10,6 @@ #include #include "../mtk_vcodec_enc_drv.h" -#include "../mtk_vcodec_util.h" #include "../mtk_vcodec_intr.h" #include "../mtk_vcodec_enc.h" #include "../mtk_vcodec_enc_pm.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c index bfff16da0451..708db1bb32d4 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c @@ -5,7 +5,6 @@ */ #include "mtk_vcodec_enc_drv.h" -#include "mtk_vcodec_fw.h" #include "venc_ipi_msg.h" #include "venc_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.h b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.h index 71370ab98809..ede55fc3bd07 100644 --- a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.h +++ b/drivers/media/platform/mediatek/vcodec/venc_vpu_if.h @@ -7,7 +7,6 @@ #ifndef _VENC_VPU_IF_H_ #define _VENC_VPU_IF_H_ -#include "mtk_vcodec_fw.h" #include "venc_drv_if.h" /* From patchwork Tue Jul 4 11:13:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13301019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B22DEB64DA for ; Tue, 4 Jul 2023 11:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=yVvpFlpgsl02GrHtWh2MqS/LdzbojPfsh/+cv7Lki9Q=; b=nqwF/XsZRzYN4H pd0CylpUN4owelXE8TRjHWyVCNbtjkMRBico2yJtpnFtZmjV1Zfgs5Cqf4NrFE1N1LfXEjz4OKeRs SBJbD1BWF9J+rSKBrmJPg3QwxueEsiLLWwDaITTq17rzQV/8N6kuBDC+zsmAYLxWSXH8hZ3zE9iTJ rfssWqK9OzzpJq+PneU5eRARJGsA5JkhEdYR4aQVBQxpdYAVmKEJNO8OzN838DZUhQY7aTnuR7RDv LdcvLhzkbjixg9sDVcm/kdrW26I5j00ifB3R4VLuXZgayz4PqYIS9/uYOiPZIcGzvJAYMRN+ecmLe jIrkT6pGIfE540297uMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGeId-00D8qr-27; Tue, 04 Jul 2023 11:34:27 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGeIW-00D8oQ-2k; Tue, 04 Jul 2023 11:34:25 +0000 X-UUID: b576d57c1a5e11ee912e1518a6540028-20230704 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=/3W07IN0Dm+LWDFxMaYxCE+fSeL0MrbJUBJsDy0fKkk=; b=odcUJimL0Q+K76GET7b8yx/hSTEQgPxha+zXmdc6Y9piz3gnDchDhtGL/T5SqnN3deWBY/aRNWyeiz/gZWhnKDrEIYrJQwiWD442onZvhDDFAmZcqhyk0RXvF+f8qGg35T6zKrrHLZbCJp/cDwrdfP2YJ4TaMi3Y3l4HHACicyU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:5e032f35-2ce1-446e-9f76-635521a71b09,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:01c9525,CLOUDID:1f46d90d-c22b-45ab-8a43-3004e9216b56,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 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: b576d57c1a5e11ee912e1518a6540028-20230704 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 144085455; Tue, 04 Jul 2023 04:34:16 -0700 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; Tue, 4 Jul 2023 19:13:40 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 4 Jul 2023 19:13:40 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Yunfei Dong , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v5,11/11] media: mediatek: vcodec: separete decoder and encoder Date: Tue, 4 Jul 2023 19:13:27 +0800 Message-ID: <20230704111327.7140-12-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704111327.7140-1-yunfei.dong@mediatek.com> References: <20230704111327.7140-1-yunfei.dong@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-20230704_043420_910661_0865E5EC X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move all decoder files to folder video-decoder. Move all encoder files to folder video-encoder. Move common files which shared for encoder and decoder to folder video-common. Change include header files and Makefile to fix build error. Signed-off-by: Yunfei Dong Reviewed-by: Nicolas Dufresne Reviewed-by: AngeloGioacchino Del Regno --- .../media/platform/mediatek/vcodec/Makefile | 55 +------------------ .../platform/mediatek/vcodec/common/Makefile | 21 +++++++ .../vcodec/{ => common}/mtk_vcodec_com_drv.h | 0 .../vcodec/{ => common}/mtk_vcodec_dbgfs.c | 4 +- .../vcodec/{ => common}/mtk_vcodec_dbgfs.h | 0 .../vcodec/{ => common}/mtk_vcodec_fw.c | 4 +- .../vcodec/{ => common}/mtk_vcodec_fw.h | 2 +- .../vcodec/{ => common}/mtk_vcodec_fw_priv.h | 0 .../vcodec/{ => common}/mtk_vcodec_fw_scp.c | 4 +- .../vcodec/{ => common}/mtk_vcodec_fw_vpu.c | 4 +- .../vcodec/{ => common}/mtk_vcodec_intr.c | 4 +- .../vcodec/{ => common}/mtk_vcodec_intr.h | 0 .../vcodec/{ => common}/mtk_vcodec_util.c | 6 +- .../vcodec/{ => common}/mtk_vcodec_util.h | 22 -------- .../platform/mediatek/vcodec/decoder/Makefile | 25 +++++++++ .../vcodec/{ => decoder}/mtk_vcodec_dec.c | 0 .../vcodec/{ => decoder}/mtk_vcodec_dec.h | 0 .../vcodec/{ => decoder}/mtk_vcodec_dec_drv.c | 2 +- .../vcodec/{ => decoder}/mtk_vcodec_dec_drv.h | 19 +++++-- .../vcodec/{ => decoder}/mtk_vcodec_dec_hw.c | 2 +- .../vcodec/{ => decoder}/mtk_vcodec_dec_hw.h | 0 .../vcodec/{ => decoder}/mtk_vcodec_dec_pm.c | 0 .../vcodec/{ => decoder}/mtk_vcodec_dec_pm.h | 0 .../{ => decoder}/mtk_vcodec_dec_stateful.c | 0 .../{ => decoder}/mtk_vcodec_dec_stateless.c | 0 .../{ => decoder}/vdec/vdec_av1_req_lat_if.c | 2 +- .../vcodec/{ => decoder}/vdec/vdec_h264_if.c | 2 +- .../{ => decoder}/vdec/vdec_h264_req_common.c | 0 .../{ => decoder}/vdec/vdec_h264_req_common.h | 0 .../{ => decoder}/vdec/vdec_h264_req_if.c | 2 +- .../vdec/vdec_h264_req_multi_if.c | 2 +- .../vdec/vdec_hevc_req_multi_if.c | 2 +- .../vcodec/{ => decoder}/vdec/vdec_vp8_if.c | 2 +- .../{ => decoder}/vdec/vdec_vp8_req_if.c | 2 +- .../vcodec/{ => decoder}/vdec/vdec_vp9_if.c | 2 +- .../{ => decoder}/vdec/vdec_vp9_req_lat_if.c | 2 +- .../vcodec/{ => decoder}/vdec_drv_base.h | 0 .../vcodec/{ => decoder}/vdec_drv_if.c | 0 .../vcodec/{ => decoder}/vdec_drv_if.h | 0 .../vcodec/{ => decoder}/vdec_ipi_msg.h | 0 .../vcodec/{ => decoder}/vdec_msg_queue.c | 0 .../vcodec/{ => decoder}/vdec_msg_queue.h | 0 .../vcodec/{ => decoder}/vdec_vpu_if.c | 0 .../vcodec/{ => decoder}/vdec_vpu_if.h | 0 .../platform/mediatek/vcodec/encoder/Makefile | 11 ++++ .../vcodec/{ => encoder}/mtk_vcodec_enc.c | 0 .../vcodec/{ => encoder}/mtk_vcodec_enc.h | 0 .../vcodec/{ => encoder}/mtk_vcodec_enc_drv.c | 2 +- .../vcodec/{ => encoder}/mtk_vcodec_enc_drv.h | 19 +++++-- .../vcodec/{ => encoder}/mtk_vcodec_enc_pm.c | 0 .../vcodec/{ => encoder}/mtk_vcodec_enc_pm.h | 0 .../vcodec/{ => encoder}/venc/venc_h264_if.c | 2 +- .../vcodec/{ => encoder}/venc/venc_vp8_if.c | 2 +- .../vcodec/{ => encoder}/venc_drv_base.h | 0 .../vcodec/{ => encoder}/venc_drv_if.c | 0 .../vcodec/{ => encoder}/venc_drv_if.h | 0 .../vcodec/{ => encoder}/venc_ipi_msg.h | 0 .../vcodec/{ => encoder}/venc_vpu_if.c | 0 .../vcodec/{ => encoder}/venc_vpu_if.h | 0 59 files changed, 118 insertions(+), 110 deletions(-) create mode 100644 drivers/media/platform/mediatek/vcodec/common/Makefile rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_com_drv.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_dbgfs.c (98%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_dbgfs.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw.c (95%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw.h (97%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw_priv.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw_scp.c (96%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw_vpu.c (97%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_intr.c (95%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_intr.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_util.c (96%) rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_util.h (72%) create mode 100644 drivers/media/platform/mediatek/vcodec/decoder/Makefile rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_drv.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_drv.h (93%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_hw.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_hw.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_pm.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_pm.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_stateful.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_stateless.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_av1_req_lat_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_common.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_common.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_multi_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_hevc_req_multi_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp8_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp8_req_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp9_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp9_req_lat_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_drv_base.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_drv_if.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_drv_if.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_ipi_msg.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_msg_queue.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_msg_queue.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_vpu_if.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_vpu_if.h (100%) create mode 100644 drivers/media/platform/mediatek/vcodec/encoder/Makefile rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_drv.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_drv.h (91%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_pm.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_pm.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc/venc_h264_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc/venc_vp8_if.c (99%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_drv_base.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_drv_if.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_drv_if.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_ipi_msg.h (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_vpu_if.c (100%) rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_vpu_if.h (100%) diff --git a/drivers/media/platform/mediatek/vcodec/Makefile b/drivers/media/platform/mediatek/vcodec/Makefile index 5f4c30fec85a..014abbfbd993 100644 --- a/drivers/media/platform/mediatek/vcodec/Makefile +++ b/drivers/media/platform/mediatek/vcodec/Makefile @@ -1,54 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \ - mtk-vcodec-enc.o \ - mtk-vcodec-common.o \ - mtk-vcodec-dec-hw.o - -mtk-vcodec-dec-y := vdec/vdec_h264_if.o \ - vdec/vdec_vp8_if.o \ - vdec/vdec_vp8_req_if.o \ - vdec/vdec_vp9_if.o \ - vdec/vdec_vp9_req_lat_if.o \ - vdec/vdec_av1_req_lat_if.o \ - vdec/vdec_h264_req_if.o \ - vdec/vdec_h264_req_common.o \ - vdec/vdec_h264_req_multi_if.o \ - vdec/vdec_hevc_req_multi_if.o \ - mtk_vcodec_dec_drv.o \ - vdec_drv_if.o \ - vdec_vpu_if.o \ - vdec_msg_queue.o \ - mtk_vcodec_dec.o \ - mtk_vcodec_dec_stateful.o \ - mtk_vcodec_dec_stateless.o \ - mtk_vcodec_dec_pm.o \ - -mtk-vcodec-dec-hw-y := mtk_vcodec_dec_hw.o - -mtk-vcodec-enc-y := venc/venc_vp8_if.o \ - venc/venc_h264_if.o \ - mtk_vcodec_enc.o \ - mtk_vcodec_enc_drv.o \ - mtk_vcodec_enc_pm.o \ - venc_drv_if.o \ - venc_vpu_if.o \ - - -mtk-vcodec-common-y := mtk_vcodec_intr.o \ - mtk_vcodec_util.o \ - mtk_vcodec_fw.o \ - -ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU),) -mtk-vcodec-common-y += mtk_vcodec_fw_vpu.o -endif - -ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP),) -mtk-vcodec-common-y += mtk_vcodec_fw_scp.o -endif - -ifneq ($(CONFIG_DEBUG_FS),) -obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dbgfs.o - -mtk-vcodec-dbgfs-y := mtk_vcodec_dbgfs.o -endif \ No newline at end of file +obj-y += common/ +obj-y += encoder/ +obj-y += decoder/ diff --git a/drivers/media/platform/mediatek/vcodec/common/Makefile b/drivers/media/platform/mediatek/vcodec/common/Makefile new file mode 100644 index 000000000000..d0479914dfb3 --- /dev/null +++ b/drivers/media/platform/mediatek/vcodec/common/Makefile @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-common.o + +mtk-vcodec-common-y := mtk_vcodec_intr.o \ + mtk_vcodec_util.o \ + mtk_vcodec_fw.o \ + +ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU),) +mtk-vcodec-common-y += mtk_vcodec_fw_vpu.o +endif + +ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP),) +mtk-vcodec-common-y += mtk_vcodec_fw_scp.o +endif + +ifneq ($(CONFIG_DEBUG_FS),) +obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dbgfs.o + +mtk-vcodec-dbgfs-y := mtk_vcodec_dbgfs.o +endif \ No newline at end of file diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_com_drv.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_com_drv.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c similarity index 98% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c index c6a02b33cc74..54d5accf87d2 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c @@ -7,8 +7,8 @@ #include #include "mtk_vcodec_dbgfs.h" -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" +#include "../decoder/mtk_vcodec_dec_drv.h" +#include "../encoder/mtk_vcodec_enc_drv.h" #include "mtk_vcodec_util.h" static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_dec_ctx *ctx, char *buf, diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c similarity index 95% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c index de77c71f7e87..08949b08fbc6 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" +#include "../decoder/mtk_vcodec_dec_drv.h" +#include "../encoder/mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw_priv.h" struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type, diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h similarity index 97% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h index 83479ab70385..300363a40158 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h @@ -6,7 +6,7 @@ #include #include -#include "../vpu/mtk_vpu.h" +#include "../../vpu/mtk_vpu.h" struct mtk_vcodec_dec_dev; struct mtk_vcodec_enc_dev; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_priv.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_priv.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c similarity index 96% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c index 3cb5a5befd24..9e744d07a1e8 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" +#include "../decoder/mtk_vcodec_dec_drv.h" +#include "../encoder/mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw_priv.h" static int mtk_vcodec_scp_load_firmware(struct mtk_vcodec_fw *fw) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c similarity index 97% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c index 18274a51a8f8..5e03b0886559 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" +#include "../decoder/mtk_vcodec_dec_drv.h" +#include "../encoder/mtk_vcodec_enc_drv.h" #include "mtk_vcodec_fw_priv.h" static int mtk_vcodec_vpu_load_firmware(struct mtk_vcodec_fw *fw) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c similarity index 95% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c index 1c63fbbec653..3c4e79bf04de 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c @@ -7,8 +7,8 @@ #include #include -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" +#include "../decoder/mtk_vcodec_dec_drv.h" +#include "../encoder/mtk_vcodec_enc_drv.h" #include "mtk_vcodec_intr.h" int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms, diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c similarity index 96% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c index f6eba7163fdf..de6857ab6502 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c @@ -9,9 +9,9 @@ #include #include -#include "mtk_vcodec_dec_drv.h" -#include "mtk_vcodec_enc_drv.h" -#include "mtk_vcodec_dec_hw.h" +#include "../decoder/mtk_vcodec_dec_drv.h" +#include "../encoder/mtk_vcodec_enc_drv.h" +#include "../decoder/mtk_vcodec_dec_hw.h" #if defined(CONFIG_DEBUG_FS) int mtk_vcodec_dbg; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.h similarity index 72% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h rename to drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.h index 27fe2363373a..af87c2606dcc 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.h @@ -61,28 +61,6 @@ extern int mtk_vcodec_dbg; dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: " fmt "\n", inst_id, ##args) #endif -#define mtk_vdec_err(ctx, fmt, args...) \ - mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) - -#define mtk_vdec_debug(ctx, fmt, args...) \ - mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) - -#define mtk_venc_err(ctx, fmt, args...) \ - mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) - -#define mtk_venc_debug(ctx, fmt, args...) \ - mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) - -#define mtk_v4l2_vdec_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args) - -#define mtk_v4l2_vdec_dbg(level, ctx, fmt, args...) \ - mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args) - -#define mtk_v4l2_venc_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args) - -#define mtk_v4l2_venc_dbg(level, ctx, fmt, args...) \ - mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args) - void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx); int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem); void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/Makefile b/drivers/media/platform/mediatek/vcodec/decoder/Makefile new file mode 100644 index 000000000000..904cd22def84 --- /dev/null +++ b/drivers/media/platform/mediatek/vcodec/decoder/Makefile @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \ + mtk-vcodec-dec-hw.o + +mtk-vcodec-dec-y := vdec/vdec_h264_if.o \ + vdec/vdec_vp8_if.o \ + vdec/vdec_vp8_req_if.o \ + vdec/vdec_vp9_if.o \ + vdec/vdec_vp9_req_lat_if.o \ + vdec/vdec_av1_req_lat_if.o \ + vdec/vdec_h264_req_if.o \ + vdec/vdec_h264_req_common.o \ + vdec/vdec_h264_req_multi_if.o \ + vdec/vdec_hevc_req_multi_if.o \ + mtk_vcodec_dec_drv.o \ + vdec_drv_if.o \ + vdec_vpu_if.o \ + vdec_msg_queue.o \ + mtk_vcodec_dec.o \ + mtk_vcodec_dec_stateful.o \ + mtk_vcodec_dec_stateless.o \ + mtk_vcodec_dec_pm.o \ + +mtk-vcodec-dec-hw-y := mtk_vcodec_dec_hw.o diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.h rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c index 36970113d069..6ee319762418 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c @@ -20,7 +20,7 @@ #include "mtk_vcodec_dec.h" #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" -#include "mtk_vcodec_intr.h" +#include "../common/mtk_vcodec_intr.h" static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vcodec_dec_dev *dev) { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h similarity index 93% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h index 36a4cfa622f5..160f8da56293 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h @@ -7,10 +7,10 @@ #ifndef _MTK_VCODEC_DEC_DRV_H_ #define _MTK_VCODEC_DEC_DRV_H_ -#include "mtk_vcodec_com_drv.h" -#include "mtk_vcodec_dbgfs.h" -#include "mtk_vcodec_fw_priv.h" -#include "mtk_vcodec_util.h" +#include "../common/mtk_vcodec_com_drv.h" +#include "../common/mtk_vcodec_dbgfs.h" +#include "../common/mtk_vcodec_fw_priv.h" +#include "../common/mtk_vcodec_util.h" #include "vdec_msg_queue.h" #define MTK_VCODEC_DEC_NAME "mtk-vcodec-dec" @@ -301,4 +301,15 @@ wake_up_dec_ctx(struct mtk_vcodec_dec_ctx *ctx, unsigned int reason, unsigned in wake_up_interruptible(&ctx->queue[hw_id]); } +#define mtk_vdec_err(ctx, fmt, args...) \ + mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_vdec_debug(ctx, fmt, args...) \ + mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_v4l2_vdec_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_v4l2_vdec_dbg(level, ctx, fmt, args...) \ + mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args) + #endif /* _MTK_VCODEC_DEC_DRV_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c index fa02fcf4e8c2..4f05a179970c 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c @@ -15,7 +15,7 @@ #include "mtk_vcodec_dec.h" #include "mtk_vcodec_dec_hw.h" #include "mtk_vcodec_dec_pm.h" -#include "mtk_vcodec_intr.h" +#include "../common/mtk_vcodec_intr.h" static const struct of_device_id mtk_vdec_hw_match[] = { { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.c diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_pm.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c rename to drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c index e7ae2dc8f6bf..cc267589d192 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c @@ -9,7 +9,7 @@ #include #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c index a8175f977ed2..bf7dffe60d07 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c @@ -9,7 +9,7 @@ #include "../vdec_drv_if.h" #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_vpu_if.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_common.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_common.c diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_common.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_common.h diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c index 4c5ef35199a1..5600f1df653d 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c @@ -7,7 +7,7 @@ #include #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c index 0f9f7b56882f..0e741e0dc8ba 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c @@ -11,7 +11,7 @@ #include #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c index 2682f40d1361..06ed47df693b 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c @@ -9,7 +9,7 @@ #include #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c index 5beb58f97905..32ca5b89a39b 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c @@ -8,7 +8,7 @@ #include #include "../vdec_drv_if.h" #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_vpu_if.h" #include "../vdec_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c index c85c849d2548..f64b21c07169 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c @@ -10,7 +10,7 @@ #include #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c index d3493d36329d..5780052d9b38 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c @@ -12,7 +12,7 @@ #include #include -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c index 3e9458470484..e393e3e668f8 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c @@ -10,7 +10,7 @@ #include #include "../mtk_vcodec_dec.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" diff --git a/drivers/media/platform/mediatek/vcodec/vdec_drv_base.h b/drivers/media/platform/mediatek/vcodec/decoder/vdec_drv_base.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_drv_base.h rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_drv_base.h diff --git a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_drv_if.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_drv_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_drv_if.c diff --git a/drivers/media/platform/mediatek/vcodec/vdec_drv_if.h b/drivers/media/platform/mediatek/vcodec/decoder/vdec_drv_if.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_drv_if.h rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_drv_if.h diff --git a/drivers/media/platform/mediatek/vcodec/vdec_ipi_msg.h b/drivers/media/platform/mediatek/vcodec/decoder/vdec_ipi_msg.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_ipi_msg.h rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_ipi_msg.h diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.h diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c diff --git a/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h rename to drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.h diff --git a/drivers/media/platform/mediatek/vcodec/encoder/Makefile b/drivers/media/platform/mediatek/vcodec/encoder/Makefile new file mode 100644 index 000000000000..e621b5b7e5e6 --- /dev/null +++ b/drivers/media/platform/mediatek/vcodec/encoder/Makefile @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o + +mtk-vcodec-enc-y := venc/venc_vp8_if.o \ + venc/venc_h264_if.o \ + mtk_vcodec_enc.o \ + mtk_vcodec_enc_drv.o \ + mtk_vcodec_enc_pm.o \ + venc_drv_if.o \ + venc_vpu_if.o \ diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c rename to drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.h rename to drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.h diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c rename to drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c index f1b4d5e8cd49..5db2bf3db4c5 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c @@ -18,7 +18,7 @@ #include "mtk_vcodec_enc.h" #include "mtk_vcodec_enc_pm.h" -#include "mtk_vcodec_intr.h" +#include "../common/mtk_vcodec_intr.h" static const struct mtk_video_fmt mtk_video_formats_output[] = { { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h similarity index 91% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h rename to drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h index fcd3d9b271ea..ec1d1fe6b3e7 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h @@ -7,10 +7,10 @@ #ifndef _MTK_VCODEC_ENC_DRV_H_ #define _MTK_VCODEC_ENC_DRV_H_ -#include "mtk_vcodec_com_drv.h" -#include "mtk_vcodec_dbgfs.h" -#include "mtk_vcodec_fw_priv.h" -#include "mtk_vcodec_util.h" +#include "../common/mtk_vcodec_com_drv.h" +#include "../common/mtk_vcodec_dbgfs.h" +#include "../common/mtk_vcodec_fw_priv.h" +#include "../common/mtk_vcodec_util.h" #define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" @@ -232,4 +232,15 @@ wake_up_enc_ctx(struct mtk_vcodec_enc_ctx *ctx, unsigned int reason, unsigned in wake_up_interruptible(&ctx->queue[hw_id]); } +#define mtk_venc_err(ctx, fmt, args...) \ + mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_venc_debug(ctx, fmt, args...) \ + mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_v4l2_venc_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args) + +#define mtk_v4l2_venc_dbg(level, ctx, fmt, args...) \ + mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args) + #endif /* _MTK_VCODEC_ENC_DRV_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c rename to drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.h rename to drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c rename to drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c index 9127bceb0db4..a68dac72c4e4 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c @@ -11,7 +11,7 @@ #include #include "../mtk_vcodec_enc_drv.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../mtk_vcodec_enc.h" #include "../mtk_vcodec_enc_pm.h" #include "../venc_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c similarity index 99% rename from drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c rename to drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c index 510f3b042670..05abca91e742 100644 --- a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c @@ -10,7 +10,7 @@ #include #include "../mtk_vcodec_enc_drv.h" -#include "../mtk_vcodec_intr.h" +#include "../../common/mtk_vcodec_intr.h" #include "../mtk_vcodec_enc.h" #include "../mtk_vcodec_enc_pm.h" #include "../venc_drv_base.h" diff --git a/drivers/media/platform/mediatek/vcodec/venc_drv_base.h b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_base.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/venc_drv_base.h rename to drivers/media/platform/mediatek/vcodec/encoder/venc_drv_base.h diff --git a/drivers/media/platform/mediatek/vcodec/venc_drv_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/venc_drv_if.c rename to drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c diff --git a/drivers/media/platform/mediatek/vcodec/venc_drv_if.h b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/venc_drv_if.h rename to drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.h diff --git a/drivers/media/platform/mediatek/vcodec/venc_ipi_msg.h b/drivers/media/platform/mediatek/vcodec/encoder/venc_ipi_msg.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/venc_ipi_msg.h rename to drivers/media/platform/mediatek/vcodec/encoder/venc_ipi_msg.h diff --git a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c similarity index 100% rename from drivers/media/platform/mediatek/vcodec/venc_vpu_if.c rename to drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c diff --git a/drivers/media/platform/mediatek/vcodec/venc_vpu_if.h b/drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.h similarity index 100% rename from drivers/media/platform/mediatek/vcodec/venc_vpu_if.h rename to drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.h