From patchwork Wed Mar 22 09:46:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2249414wrt; Wed, 22 Mar 2023 02:51:00 -0700 (PDT) X-Google-Smtp-Source: AK7set8rr1LqP3QuaGxA+jAW8JM5uhTntCNd0kbQh472L0iHiz+lrWCabLKvIqQEnpYhhw3XZ8HN X-Received: by 2002:a17:903:32c7:b0:19f:a694:6d3c with SMTP id i7-20020a17090332c700b0019fa6946d3cmr2513959plr.55.1679478660202; Wed, 22 Mar 2023 02:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478660; cv=none; d=google.com; s=arc-20160816; b=wlRKEnZBt11A7fGDhPSs956xed86dgA4AFNEZI85gZWzHimdHC1GVZiSimLASqEMCh vltswis7bujwb5Dv0MKFQ7YMXMiPO64XdFBB5XVuiNgRFsDYagelAvGayxlQonhIY25x BmYA1u1HkpsbLytqcDFY7ZIG8OZTzyB/UdRCDbTYfkNYtyVJUEWM1PF7vyctylCrtuRT U3FYjWZCsU24ixRI4vam64OESDwnkCHROI2ZQt+6uXDR/sfgV+DNqAXIOIzLsmImEcEl RXy/BI8ky5EoqN+IOdvVN7cI28mPr3FjmLiNy/MKV2DqoNfaXRDE0vYEBxr6actRb9Ui luUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1auQmDPlDWuWCFjiGD/N9g5k0v7IBBTaFSzN1WpWw/k=; b=mev3NwjhxEmtcmDyIJ+7hfy51EGdCjhassnw9R5b5trAZiEfU8PUu8cKEAv6Mw6oSq mmYiJZyqxHjX/Loszcz7QnbtVWOdBfiqFjYEJdC4T9ADZ4YK9JDUZm0tc2UvDGfLPtjH 87ucFkNv9UWmqiRQyYqCisRbODHZqML0pXuYSjIJj17WqxucJLl3M1LprfUGs7xx32Kl hRoLiinKS5Pr6DzvRBeZIc0v6uoGD0g5kioaB0J0DQ2G1NF2NWNOhMNRMTisuIhKZeeH Smtyi7mhIFXCG+4h98VREV0DAGKlB3newMZrBGU7GaPZMRzAXhYwV7BGljOJ5aIt53L6 aCQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=QMcYOqGu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a6552cb000000b004fc24042ac5si15378053pgp.640.2023.03.22.02.50.47; Wed, 22 Mar 2023 02:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=QMcYOqGu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbjCVJqc (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229662AbjCVJqa (ORCPT ); Wed, 22 Mar 2023 05:46:30 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A724F5D454; Wed, 22 Mar 2023 02:46:27 -0700 (PDT) X-UUID: 676e0482c89611eda9a90f0bb45854f4-20230322 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=1auQmDPlDWuWCFjiGD/N9g5k0v7IBBTaFSzN1WpWw/k=; b=QMcYOqGud0czJOgsVQ1TYgEg49ZgHQfgqjT+CYJ8CuEhyF8DoW0qeB+Mi/9Q/JvdTOOu9IPd1DdbXrI9EZ7sONsrHyNOY7G20LQx/LbtBuKuXOPBVp4mjOWK+ugaR/e+Zuv2H2Gtks9mHdyGye17ksZSgByi7OvEJMmPXALgJE4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:aa4e542a-1c8b-4612-9642-0231e2b45565,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.22,REQID:aa4e542a-1c8b-4612-9642-0231e2b45565,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:120426c,CLOUDID:8d1593f6-ddba-41c3-91d9-10eeade8eac7,B ulkID:230322174623FZLCA41G,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,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 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 676e0482c89611eda9a90f0bb45854f4-20230322 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1705349926; Wed, 22 Mar 2023 17:46:22 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 22 Mar 2023 17:46:21 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:20 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,1/7] media: mediatek: vcodec: Add debugfs interface to get debug information Date: Wed, 22 Mar 2023 17:46:11 +0800 Message-ID: <20230322094617.19410-2-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061015892262051?= X-GMAIL-MSGID: =?utf-8?q?1761061015892262051?= This will be useful when debugging specific issues related to kernel in running status. Signed-off-by: Yunfei Dong --- .../media/platform/mediatek/vcodec/Makefile | 6 ++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 33 +++++++++++++++++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.h | 32 ++++++++++++++++++ .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 ++ .../platform/mediatek/vcodec/mtk_vcodec_drv.h | 4 +++ 5 files changed, 77 insertions(+) create mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c create mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h diff --git a/drivers/media/platform/mediatek/vcodec/Makefile b/drivers/media/platform/mediatek/vcodec/Makefile index 93e7a343b5b0..f6b750cf7077 100644 --- a/drivers/media/platform/mediatek/vcodec/Makefile +++ b/drivers/media/platform/mediatek/vcodec/Makefile @@ -44,3 +44,9 @@ 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_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c new file mode 100644 index 000000000000..fb9edd379af5 --- /dev/null +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Yunfei Dong + */ + +#include + +#include "mtk_vcodec_dbgfs.h" +#include "mtk_vcodec_drv.h" +#include "mtk_vcodec_util.h" + +void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) +{ + struct dentry *vcodec_root; + + 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", + IS_ERR(vcodec_dev->dbgfs.vcodec_root)); + + vcodec_root = vcodec_dev->dbgfs.vcodec_root; +} +EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_init); + +void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev) +{ + debugfs_remove_recursive(vcodec_dev->dbgfs.vcodec_root); +} +EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_deinit); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Mediatek video codec driver"); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h new file mode 100644 index 000000000000..5eec2211cbbe --- /dev/null +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023 MediaTek Inc. + * Author: Yunfei Dong + */ + +#ifndef __MTK_VCODEC_DBGFS_H__ +#define __MTK_VCODEC_DBGFS_H__ + +struct mtk_vcodec_dev; + +/** + * struct mtk_vcodec_dbgfs - dbgfs information + * @vcodec_root: vcodec dbgfs entry + */ +struct mtk_vcodec_dbgfs { + struct dentry *vcodec_root; +}; + +#if defined(CONFIG_DEBUG_FS) +void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev); +void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev); +#else +static inline void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) +{ +} + +static inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev) +{ +} +#endif +#endif 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 174a6eec2f54..de29b1fb0436 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -431,6 +431,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) mtk_v4l2_debug(0, "media registered as /dev/media%d", vfd_dec->minor); } + mtk_vcodec_dbgfs_init(dev); mtk_v4l2_debug(0, "decoder registered as /dev/video%d", vfd_dec->minor); return 0; @@ -505,6 +506,7 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev) if (dev->vfd_dec) video_unregister_device(dev->vfd_dec); + mtk_vcodec_dbgfs_deinit(dev); 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_drv.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h index 9acab54fd650..a7e8bb3608ac 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h @@ -16,6 +16,7 @@ #include #include +#include "mtk_vcodec_dbgfs.h" #include "mtk_vcodec_util.h" #include "vdec_msg_queue.h" @@ -470,6 +471,7 @@ struct mtk_vcodec_enc_pdata { * @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; @@ -520,6 +522,8 @@ struct mtk_vcodec_dev { 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_ctx *fh_to_ctx(struct v4l2_fh *fh) From patchwork Wed Mar 22 09:46:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2250171wrt; Wed, 22 Mar 2023 02:53:30 -0700 (PDT) X-Google-Smtp-Source: AK7set+HmSycItffQ/C+buynBuw8ZLRSpvJbnIi/N+rcqHkMOV6OOLdUn9F86NCNzpvaWW0LqLyG X-Received: by 2002:a05:6402:742:b0:4fc:8e5e:70da with SMTP id p2-20020a056402074200b004fc8e5e70damr6828185edy.27.1679478810243; Wed, 22 Mar 2023 02:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478810; cv=none; d=google.com; s=arc-20160816; b=LtVFKxFOrg1gmnZZKqLiyMnOWyFTO/CbZ7J+dAawMQbPb6SLFKCxrXvsb2YfQ2jCpC 6HAA8+sTZgEbvBg2SwSQ5pEHI8tGirP5RP9YBV1exOCpqPP8LRx3nrkKJ4C2dUgZKmKb CQIRure9pNXu7ur1QMgx+gl8CJQcCUAWOW5Q66O0AxUNaaY3lHiG1l40E4HxztMVejR6 xjEbw8YgZH8XZPlDIF47VeV5PfmOWkQ4HDWqSR2FBDow3xULIipHmPVxAqB/aMFIfeHS IN4xszkd+T7udq+FY+saJziQ7ZMMI5IpOcSdZMNgIU4kk9r3+fvV9oIrk3Rs9Ahsmdq5 LFlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=92mZB/j/7Hzvh1H2FdnRJuSeAz4j/NGjfxLL97rb2Tg=; b=cQ1rt35CMv1SO8HsPM5bB2rdWEev634QkE1cuByo0qdXNrXixyLSn+mHEOkooD1rUV wf7LwqutVG6mC51U7M4DWaKb6gtxWwbeKDrDAPXvVyo2WkI+1mJDUiFv2ZM+O4VwN0x0 ZpjddoDboFdzikglmOR57WqFwIvFGYk4H3oQF8ncvdDcFgNDXTa3za/lH1wNhry/FO9d /uDh6OJDIczNkWWLrsBkMhyIsIX/W6yU6tfiCjCbWUV2l3mlpXuy9vaSLuvo90SmWJV+ h0mE1G2mi86vG6fjEu1JHxSmHBz0gYCg4QtR1k0H48gh6Jvpsh/RxKPnwZEUSxmDlJHm ifAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Um9mVRTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne26-20020a1709077b9a00b00939ad2676ffsi6456255ejc.762.2023.03.22.02.53.07; Wed, 22 Mar 2023 02:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Um9mVRTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231200AbjCVJqh (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbjCVJqb (ORCPT ); Wed, 22 Mar 2023 05:46:31 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E4F5DCAD; Wed, 22 Mar 2023 02:46:30 -0700 (PDT) X-UUID: 68031284c89611eda9a90f0bb45854f4-20230322 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=92mZB/j/7Hzvh1H2FdnRJuSeAz4j/NGjfxLL97rb2Tg=; b=Um9mVRTZSHRLxezgCD3rQQvKTnn9K+JDhyxA7i4rKDhOx3o59f3V7FSDbZPs+KVH2y2uGOv0EU2HHETKaEQp6n8cAXXPPFWzU/KokjC5bVf53YikkLxMjXxJTzSmrfoLtBXEpMu6XAgJ+8P8fkS2pvreXq2+rC9sJQSYyAPkOnU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:bfc04964-7743-4d8e-b44e-e5c14bb2d78d,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:120426c,CLOUDID:a17f05b4-beed-4dfc-bd9c-e1b22fa6ccc4,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 68031284c89611eda9a90f0bb45854f4-20230322 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 182808877; Wed, 22 Mar 2023 17:46:23 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 22 Mar 2023 17:46:22 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:21 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,2/7] media: mediatek: vcodec: Add debug params to control different log level Date: Wed, 22 Mar 2023 17:46:12 +0800 Message-ID: <20230322094617.19410-3-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061173300056472?= X-GMAIL-MSGID: =?utf-8?q?1761061173300056472?= Add parameter mtk_vcodec_dbg to open each codec log. Add parameter mtk_v4l2_dbg_level to open each instance log according to the parameter value. Signed-off-by: Yunfei Dong --- .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 2 ++ .../mediatek/vcodec/mtk_vcodec_util.c | 8 ++++++ .../mediatek/vcodec/mtk_vcodec_util.h | 25 ++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index fb9edd379af5..b5093e4e4aa2 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -20,6 +20,8 @@ void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) 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); } EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_init); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c index ace78c4b5b9e..f214e6f67005 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c @@ -13,6 +13,14 @@ #include "mtk_vcodec_drv.h" #include "mtk_vcodec_util.h" +#if defined(CONFIG_DEBUG_FS) +int mtk_vcodec_dbg; +EXPORT_SYMBOL(mtk_vcodec_dbg); + +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) { diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h index 71956627a0e2..938f03cab3c9 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h @@ -35,15 +35,34 @@ struct mtk_vcodec_dev; pr_err("[MTK_VCODEC][ERROR][%d]: " fmt "\n", \ ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args) +#if defined(CONFIG_DEBUG_FS) +extern int mtk_v4l2_dbg_level; +extern int mtk_vcodec_dbg; -#define mtk_v4l2_debug(level, fmt, args...) pr_debug(fmt, ##args) +#define mtk_v4l2_debug(level, fmt, args...) \ + do { \ + if (mtk_v4l2_dbg_level >= level) \ + pr_info("[MTK_V4L2] level=%d %s(),%d: " fmt "\n", \ + level, __func__, __LINE__, ##args); \ + } while (0) -#define mtk_v4l2_debug_enter() mtk_v4l2_debug(3, "+") -#define mtk_v4l2_debug_leave() mtk_v4l2_debug(3, "-") +#define mtk_vcodec_debug(h, fmt, args...) \ + do { \ + if (mtk_vcodec_dbg) \ + pr_info("[MTK_VCODEC][%d]: %s() " fmt "\n", \ + ((struct mtk_vcodec_ctx *)h->ctx)->id, \ + __func__, ##args); \ + } while (0) +#else +#define mtk_v4l2_debug(level, fmt, args...) pr_debug(fmt, ##args) #define mtk_vcodec_debug(h, fmt, args...) \ pr_debug("[MTK_VCODEC][%d]: " fmt "\n", \ ((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, "-") From patchwork Wed Mar 22 09:46:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2250185wrt; Wed, 22 Mar 2023 02:53:32 -0700 (PDT) X-Google-Smtp-Source: AK7set9o2GUvkF56l+q+G3X45qOG2E1XOkJMkgDqcBOnmGa3yJimENLkSVQxhj8Nbzkd7aMWt8Rh X-Received: by 2002:a17:906:720f:b0:8b1:2bde:5c70 with SMTP id m15-20020a170906720f00b008b12bde5c70mr6198840ejk.2.1679478811892; Wed, 22 Mar 2023 02:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478811; cv=none; d=google.com; s=arc-20160816; b=HmUr7K3pl83E0trL1fDWDB+dps6DUMhCUhK/oJ426OYpPE6Im7NxE9Js9HazwXefwY fQ0OxWRtIR5qZbQ7hTKrdQlHBdsvHCsNmrQcAzTCJimD8T3wJlO8+p4fKGv3TD8zKmnp uwXnkw/M/00U+t7g3mjhqobQVG5p3Dkr+QrMN/r3kwbGazGaGIVNsl94feYGfTHGfmlD Ufwh/tqbrhBTR41OXgTN95qZtqYs9EWohIfOmL3XQDpr0lQlRjaw54T6n8+62B9l6qwr eBiudq2GGCUxzVhjHpFn1kbhMWOr0e72+7dR8ozTUK8CduT0qOttemt4DluhbpvwrIHg qpog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NN3IX4VhJe8xsbI8aOswJ8E24INvALh8nBv+h/C9/oQ=; b=WHccQAKwrKOk60lQtYUn3iT4zwnPIspL5sgCSXxaFVFOpkXKUIeYUA2h7dayOcFryc Vxxqy7vWPCRMXXFPO26NxZszH+AvyLSdfDL4emId0s3EkWRvFXoopk+LY4EPZVJg2+ye jEIkvCcYiKYo9GltfI3HKKoD3zKfRouTPRQBeSX45ojW5JvpjVPs0dHIwIGBydFv1o8R o2UbZ0Jj1+M+sKFv7VHCT6Qh27OnibiwiaUpm4XzLKpMkG69gaUTvSyvFw2GWytxshSs w9x0RQeV7+IEp7mZFv1HhfTSWmsLKIAnvf0ka8AgAFwqLEXI1WJJgidNg2otYI6by9oN SE3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=fy5zz04y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a170906369400b008dd83608278si14880923ejc.933.2023.03.22.02.53.07; Wed, 22 Mar 2023 02:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=fy5zz04y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjCVJqj (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbjCVJqd (ORCPT ); Wed, 22 Mar 2023 05:46:33 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 708C05DCB2; Wed, 22 Mar 2023 02:46:30 -0700 (PDT) X-UUID: 689a4708c89611edb6b9f13eb10bd0fe-20230322 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=NN3IX4VhJe8xsbI8aOswJ8E24INvALh8nBv+h/C9/oQ=; b=fy5zz04yBEvNoBYb119DheJ2lJZH00udQ9lGz+U10MFBN5KEArMTfUb/r5ofzNHhUS11M0Z0n5w7+Fuq7qSHfY9HzRSQ/4ZNZp/ATIp2ZMjkdx4jKDegs7SQzA4RBCLR+a87JaXUsOFgfSR9Fv4OX3nckovxBvI6ekQgUGt0XWA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:78ef8227-ae93-46ce-bcf8-18a9cf30c99f,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:120426c,CLOUDID:0b1693f6-ddba-41c3-91d9-10eeade8eac7,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 689a4708c89611edb6b9f13eb10bd0fe-20230322 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 510898661; Wed, 22 Mar 2023 17:46:24 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 22 Mar 2023 17:46:23 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:22 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,3/7] media: mediatek: vcodec: Add a debugfs file to get different useful information Date: Wed, 22 Mar 2023 17:46:13 +0800 Message-ID: <20230322094617.19410-4-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061174742231752?= X-GMAIL-MSGID: =?utf-8?q?1761061174742231752?= In oder to get each instance information according to test command, adding one file node "vdec". Can use echo command to set different string value as 'echo -picinfo > vdec'. Signed-off-by: Yunfei Dong --- .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 64 +++++++++++++++++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.h | 32 ++++++++++ .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 + 3 files changed, 98 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index b5093e4e4aa2..49f0891e4923 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -10,6 +10,64 @@ #include "mtk_vcodec_drv.h" #include "mtk_vcodec_util.h" +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_dbgfs *dbgfs = &vcodec_dev->dbgfs; + int len; + + mutex_lock(&dbgfs->dbgfs_lock); + len = simple_write_to_buffer(dbgfs->dbgfs_buf, sizeof(dbgfs->dbgfs_buf) - 1, + ppos, ubuf, count); + mutex_unlock(&dbgfs->dbgfs_lock); + if (len > 0) + return count; + + return len; +} + +static const struct file_operations vdec_fops = { + .open = simple_open, + .write = mtk_vdec_dbgfs_write, +}; + +void mtk_vcodec_dbgfs_create(struct mtk_vcodec_ctx *ctx) +{ + struct mtk_vcodec_dbgfs_inst *dbgfs_inst; + struct mtk_vcodec_dev *vcodec_dev = ctx->dev; + + dbgfs_inst = kzalloc(sizeof(*dbgfs_inst), GFP_KERNEL); + if (!dbgfs_inst) + return; + + list_add_tail(&dbgfs_inst->node, &vcodec_dev->dbgfs.dbgfs_head); + + vcodec_dev->dbgfs.inst_count++; + + dbgfs_inst->inst_id = ctx->id; + dbgfs_inst->vcodec_ctx = ctx; +} +EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_create); + +void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id) +{ + struct mtk_vcodec_dbgfs_inst *dbgfs_inst; + + list_for_each_entry(dbgfs_inst, &vcodec_dev->dbgfs.dbgfs_head, node) { + if (dbgfs_inst && dbgfs_inst->inst_id == ctx_id) { + vcodec_dev->dbgfs.inst_count--; + break; + } + } + + if (dbgfs_inst) { + list_del(&dbgfs_inst->node); + kfree(dbgfs_inst); + } +} +EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_remove); + void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) { struct dentry *vcodec_root; @@ -22,6 +80,12 @@ void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) 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; + + 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); } EXPORT_SYMBOL_GPL(mtk_vcodec_dbgfs_init); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h index 5eec2211cbbe..47c0a986877d 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h @@ -8,19 +8,51 @@ #define __MTK_VCODEC_DBGFS_H__ struct mtk_vcodec_dev; +struct mtk_vcodec_ctx; + +/** + * struct mtk_vcodec_dbgfs_inst - debugfs informatiaoin for each inst + * @node: list node for each inst + * @vcodec_ctx: struct mtk_vcodec_ctx + * @inst_id: index of the context that the same with ctx->id + */ +struct mtk_vcodec_dbgfs_inst { + struct list_head node; + struct mtk_vcodec_ctx *vcodec_ctx; + int inst_id; +}; /** * struct mtk_vcodec_dbgfs - dbgfs information + * @dbgfs_head: list head used to link each instance * @vcodec_root: vcodec dbgfs entry + * @dbgfs_lock: dbgfs lock used to protect dbgfs_buf + * @dbgfs_buf: dbgfs buf used to store dbgfs cmd + * @inst_count: the count of total instance */ struct mtk_vcodec_dbgfs { + struct list_head dbgfs_head; struct dentry *vcodec_root; + /* dbgfs lock used to protect dbgfs_buf */ + struct mutex dbgfs_lock; + char dbgfs_buf[1024]; + int inst_count; }; #if defined(CONFIG_DEBUG_FS) +void mtk_vcodec_dbgfs_create(struct mtk_vcodec_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); void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev); #else +static inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_ctx *ctx) +{ +} + +static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id) +{ +} + static inline void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) { } 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 de29b1fb0436..8c2443a18f5e 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -215,6 +215,7 @@ static int fops_vcodec_open(struct file *file) ctx->dev->vdec_pdata->init_vdec_params(ctx); list_add(&ctx->list, &dev->ctx_list); + mtk_vcodec_dbgfs_create(ctx); mutex_unlock(&dev->dev_mutex); mtk_v4l2_debug(0, "%s decoder [%d]", dev_name(&dev->plat_dev->dev), @@ -256,6 +257,7 @@ static int fops_vcodec_release(struct file *file) v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); + mtk_vcodec_dbgfs_remove(dev, ctx->id); list_del_init(&ctx->list); kfree(ctx); mutex_unlock(&dev->dev_mutex); From patchwork Wed Mar 22 09:46:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2249792wrt; Wed, 22 Mar 2023 02:52:15 -0700 (PDT) X-Google-Smtp-Source: AK7set+8YMq626qnOm0kBwCq489XvxqvxWII1zkZt2YwsjQ23aCjXNjuJzrvJUJTeCduPssOJIEd X-Received: by 2002:a05:6a20:4ca7:b0:d9:4c19:fe6a with SMTP id fq39-20020a056a204ca700b000d94c19fe6amr4880819pzb.9.1679478735219; Wed, 22 Mar 2023 02:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478735; cv=none; d=google.com; s=arc-20160816; b=YU7h3Mbak/itkLMTqHixuFDceeZl3B/7kWqnGxtJle04c91huC3iyqniJpt5yyessA S7p7Tc9Y/iju92nWU7PGy89h8S/8PXGJprFgy96EbPAymjTM/41AwATOh8IkEvRvl+bC HEaRUS/AWIQ1OA56SGSNpMxhmLHcuSEX5NCfJMt4cz25tYeaFwZHR6m24rjYQhA4qjiw GPad62cFEx7AXJdUSuHDdhmjBMzg6uNiMSLJVLQm8A6pVs7twk4RoBNDbh4fsbv9s787 h3TXrSMU/ssDb+IaTCnerYagjsHmKqMNtFTTe303xYRci8pS0K8Ep62IL5QV/9oOOwwG 73Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QZ5uBL9yfgd1NIw9cHlnnPWSdj4uOU4U2/td14iVscM=; b=n4wnIw8YIG0RcmrDNZRHHdPzz+xdFmfajkNcp6hWqLQG2zSTbC5UfQcfTzxnSPq9c8 /9OFXaqwObDUffhxqFCQly7HqvUzkmnXIyCeYMWchCA+sFWX+u7Pg5iUT9DZ1cAaHW8J sibh+iw9ZhI8QRpo8FoqTb/tE9ZYEiXUKaQwHOy7FrpUF5GywT8KINfHHHayx1f5SkUb w4KU7t0COekM+gpNwHQqsTE8kePLBGs0x1q7ne+1UilTTlPlE5ywtvL8k2WdKd0nNsX2 JM2OysA+89Q/ok5BCCv8TY+szbwO5me02pqUWBfaO7glpUEcgAw/22iZL0lquv+V0wpR k9Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=F+k3V6X2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o196-20020a62cdcd000000b005a816064ddasi15525945pfg.158.2023.03.22.02.52.02; Wed, 22 Mar 2023 02:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=F+k3V6X2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230515AbjCVJqm (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjCVJqd (ORCPT ); Wed, 22 Mar 2023 05:46:33 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5077B5DC96; Wed, 22 Mar 2023 02:46:31 -0700 (PDT) X-UUID: 692638d0c89611edb6b9f13eb10bd0fe-20230322 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=QZ5uBL9yfgd1NIw9cHlnnPWSdj4uOU4U2/td14iVscM=; b=F+k3V6X2OL49MtBhgoDYG9dKfU1E+eltP6HnA3BWhmu3iv6IBWUQWdlerDic7cW7nUBYFGWleEOt19LzBItSK9ID4vgDPwmf0qnQconlU87xM57HkHFCDtG+QWexQZm643Opak4++YqMllnmK2pN6FUfAYP6udmE0rVVMBRDtSY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:3d73d749-d4b3-48a4-b187-363902749ae5,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:120426c,CLOUDID:a71693f6-ddba-41c3-91d9-10eeade8eac7,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 692638d0c89611edb6b9f13eb10bd0fe-20230322 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1409267572; Wed, 22 Mar 2023 17:46:25 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 22 Mar 2023 17:46:24 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:23 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,4/7] media: mediatek: vcodec: Get each context resolution information Date: Wed, 22 Mar 2023 17:46:14 +0800 Message-ID: <20230322094617.19410-5-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061094389807076?= X-GMAIL-MSGID: =?utf-8?q?1761061094389807076?= Will store the string to temp buffer like "echo '-picinfo' > vdec" when user want to get needed information. Then getting debug information using command 'cat vdec' calling mtk_vdec_dbgfs_read to analysis the temp buffer. Signed-off-by: Yunfei Dong --- .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 44 +++++++++++++++++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.h | 8 ++++ 2 files changed, 52 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index 49f0891e4923..19a1dc068efd 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -27,9 +27,53 @@ static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf, return len; } +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_dbgfs *dbgfs = &vcodec_dev->dbgfs; + struct mtk_vcodec_dbgfs_inst *dbgfs_inst; + struct mtk_vcodec_ctx *ctx; + int total_len = 100 * (dbgfs->inst_count == 0 ? 1 : dbgfs->inst_count); + int used_len = 0, curr_len, ret; + bool dbgfs_index[MTK_VDEC_DBGFS_MAX] = {0}; + char *buf = kmalloc(total_len, GFP_KERNEL); + + if (!buf) + return -ENOMEM; + + if (strstr(dbgfs->dbgfs_buf, "-picinfo")) + dbgfs_index[MTK_VDEC_DBGFS_PICINFO] = true; + + mutex_lock(&dbgfs->dbgfs_lock); + list_for_each_entry(dbgfs_inst, &dbgfs->dbgfs_head, node) { + ctx = dbgfs_inst->vcodec_ctx; + + curr_len = snprintf(buf + used_len, total_len - used_len, + "inst[%d]:\n ", ctx->id); + used_len += curr_len; + + if (dbgfs_index[MTK_VDEC_DBGFS_PICINFO]) { + curr_len = snprintf(buf + used_len, total_len - used_len, + "\treal(%dx%d)=>align(%dx%d)\n", + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->picinfo.buf_w, ctx->picinfo.buf_h); + used_len += curr_len; + } + } + mutex_unlock(&dbgfs->dbgfs_lock); + + buf[used_len + 1] = '\0'; + ret = simple_read_from_buffer(ubuf, count, ppos, buf, used_len); + + kfree(buf); + return ret; +} + static const struct file_operations vdec_fops = { .open = simple_open, .write = mtk_vdec_dbgfs_write, + .read = mtk_vdec_dbgfs_read, }; void mtk_vcodec_dbgfs_create(struct mtk_vcodec_ctx *ctx) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h index 47c0a986877d..de886d79ad01 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h @@ -10,6 +10,14 @@ struct mtk_vcodec_dev; struct mtk_vcodec_ctx; +/* + * enum mtk_vdec_dbgfs_log_index - used to get different debug information + */ +enum mtk_vdec_dbgfs_log_index { + MTK_VDEC_DBGFS_PICINFO, + MTK_VDEC_DBGFS_MAX, +}; + /** * struct mtk_vcodec_dbgfs_inst - debugfs informatiaoin for each inst * @node: list node for each inst From patchwork Wed Mar 22 09:46:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2250271wrt; Wed, 22 Mar 2023 02:53:50 -0700 (PDT) X-Google-Smtp-Source: AK7set8+6fDPFjISCfRWU+1ySKOYf50HeG5zsVTOElb/wBJ/Ai8cKzij/gvHshQBghqutbt5BpFQ X-Received: by 2002:a05:6402:187:b0:4fb:5a36:1539 with SMTP id r7-20020a056402018700b004fb5a361539mr5554178edv.25.1679478830798; Wed, 22 Mar 2023 02:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478830; cv=none; d=google.com; s=arc-20160816; b=ug3HHvbavbE1PCjsdtYOENYAs+y3N6va2IPiH37C/uZ3ZarzDOFaiRyJFm1FpAWT0I h9aWYZK3dLUpAlJM4oeR/D2bfFZFE0UKr1NzhnNmTBxqZSYwCbvsEZvnZbEeuGTrCrW1 Oy3Vn0nwmah7TAI0MI3vvhunb7xPnPe45amMsnq7CHSrDCfCM2lSKRQ5Kna1hAAH1ipK UKt0LSYvD2Ud83O6fh7Sir+ERUXddJiLPVMM9+i+c4IGcmn93RLCAUFsLO05YhIeqNyU B1uYRMgx2MP8ZNTqo+utSPw9/w4yCOXhrtEXAT6nQpwaNi70n7JInNOtUBh487P0jAT+ Xe3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=m42OJ7a/VMevSJv4HQdQBs5Cmygc6KpbnLdUdu2CGrA=; b=BUlJVuElgQOEaOQfdgW2fsx7yDf8OxOdVdSMKibEyY3m7OG2BRDnehyCpe2NFACNy5 WvC+m2FWWEZGyzT+Z81x3WP49Dm+MxaRBhXo4S5/nZ5U/MjiZ0hg50LOYngPQIrJXIWa AP7c8aKzbOokbHenaF0VuS1gXKLs3dE11QT17GcXJZ2exF8Ss1GsSDDFV0xMDNLw3kcp lQiYwdYWJ7EH9fRyfpJlMvKWQyp+SKlihPO9DrVst+no+5GLkm7UhoGb4cMUau0I18qI gOGL8p3I4PCB8RoP4JhLq+DUsJZFZr/S1Su4QD9Sni5AxoPv0kmsv1ZYVQIadmE+5/zD mv8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mpgn0Kt3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020aa7d612000000b004fd298d4b3esi15148778edr.373.2023.03.22.02.53.27; Wed, 22 Mar 2023 02:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mpgn0Kt3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbjCVJqs (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231193AbjCVJqg (ORCPT ); Wed, 22 Mar 2023 05:46:36 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39FA05DED7; Wed, 22 Mar 2023 02:46:34 -0700 (PDT) X-UUID: 69c4c93cc89611eda9a90f0bb45854f4-20230322 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=m42OJ7a/VMevSJv4HQdQBs5Cmygc6KpbnLdUdu2CGrA=; b=mpgn0Kt37rq+qs6xTPyUnkJVCA0Nqk8jThVgZfYC+DQkqw3X4C+N5zxA7KzGy/xdyrFGKwtdHRvGyWCtwCIA2bea9oXtBii2GR/LuTmypQEb8H+ufJCZYtW4mI5f40m+MGqIY6v9pwRv/2JlD9JuS4QABs/1cLnsmv4+l/IJuQY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:955e9927-11d8-4b3c-8d8d-070a7b55fdfa,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:120426c,CLOUDID:c91693f6-ddba-41c3-91d9-10eeade8eac7,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 69c4c93cc89611eda9a90f0bb45854f4-20230322 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1050751798; Wed, 22 Mar 2023 17:46:26 +0800 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.25; Wed, 22 Mar 2023 17:46:24 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:24 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,5/7] media: mediatek: vcodec: Get get each instance format type Date: Wed, 22 Mar 2023 17:46:15 +0800 Message-ID: <20230322094617.19410-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061194486902323?= X-GMAIL-MSGID: =?utf-8?q?1761061194486902323?= Adding echo command to get capture and output queue format type:'echo -format > vdec' Signed-off-by: Yunfei Dong --- .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 48 +++++++++++++++++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.h | 1 + 2 files changed, 49 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index 19a1dc068efd..1b1b4301a83d 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -10,6 +10,48 @@ #include "mtk_vcodec_drv.h" #include "mtk_vcodec_util.h" +static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_ctx *ctx, char *buf, + int *used, int total) +{ + int curr_len; + + switch (ctx->current_codec) { + case V4L2_PIX_FMT_H264_SLICE: + curr_len = snprintf(buf + *used, total - *used, + "\toutput format: h264 slice\n"); + break; + case V4L2_PIX_FMT_VP8_FRAME: + curr_len = snprintf(buf + *used, total - *used, + "\toutput format: vp8 slice\n"); + break; + case V4L2_PIX_FMT_VP9_FRAME: + curr_len = snprintf(buf + *used, total - *used, + "\toutput format: vp9 slice\n"); + break; + default: + curr_len = snprintf(buf + *used, total - *used, + "\tunsupported output format: 0x%x\n", + ctx->current_codec); + } + *used += curr_len; + + switch (ctx->capture_fourcc) { + case V4L2_PIX_FMT_MM21: + curr_len = snprintf(buf + *used, total - *used, + "\tcapture format MM21\n"); + break; + case V4L2_PIX_FMT_MT21C: + curr_len = snprintf(buf + *used, total - *used, + "\tcapture format MT21C\n"); + break; + default: + curr_len = snprintf(buf + *used, total - *used, + "\tunsupported capture format: 0x%x\n", + ctx->capture_fourcc); + } + *used += curr_len; +} + static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf, size_t count, loff_t *ppos) { @@ -45,6 +87,9 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf, if (strstr(dbgfs->dbgfs_buf, "-picinfo")) dbgfs_index[MTK_VDEC_DBGFS_PICINFO] = true; + if (strstr(dbgfs->dbgfs_buf, "-format")) + dbgfs_index[MTK_VDEC_DBGFS_FORMAT] = true; + mutex_lock(&dbgfs->dbgfs_lock); list_for_each_entry(dbgfs_inst, &dbgfs->dbgfs_head, node) { ctx = dbgfs_inst->vcodec_ctx; @@ -60,6 +105,9 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf, ctx->picinfo.buf_w, ctx->picinfo.buf_h); used_len += curr_len; } + + if (dbgfs_index[MTK_VDEC_DBGFS_FORMAT]) + mtk_vdec_dbgfs_get_format_type(ctx, buf, &used_len, total_len); } mutex_unlock(&dbgfs->dbgfs_lock); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h index de886d79ad01..9e586889717b 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h @@ -15,6 +15,7 @@ struct mtk_vcodec_ctx; */ enum mtk_vdec_dbgfs_log_index { MTK_VDEC_DBGFS_PICINFO, + MTK_VDEC_DBGFS_FORMAT, MTK_VDEC_DBGFS_MAX, }; From patchwork Wed Mar 22 09:46:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2249689wrt; Wed, 22 Mar 2023 02:51:55 -0700 (PDT) X-Google-Smtp-Source: AK7set87PJV6BMsHW8+ZF68PYTP5U/PEEtOMd7pfs/XsdaALA01fAcAGMSD2ycgptCJBPtl/ncWB X-Received: by 2002:a17:906:80c3:b0:928:796d:71e8 with SMTP id a3-20020a17090680c300b00928796d71e8mr5378786ejx.3.1679478715152; Wed, 22 Mar 2023 02:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478715; cv=none; d=google.com; s=arc-20160816; b=V515QHFN6gETa0hBEtOvsHpIcAzOiq2FbXlWTG0LcO7JPVQaBIUDUmgY48Z92K2RXa yeLdYoFI4G1KHjSYA8LPlohSHBML8MhrT13uoPOZ9n0JxKbl5T90JndaTiCvUSgoMWXy s56kyLJeEBNGPaOAu4pabpZdy+DDDGerSb5MZt52VO7GiGYV7mLdwjLzEJsQ1093Cynb dGLj7KBBgolvVHv10bSDFJ+Y2MAFxzx6M5iS/YStlgxDLIoJGAIOmjMvn0BgEKYcC/l0 4bMpFYF0Fb9llJJDlRhjwTT9qtAJe0kZ/HdsyKJwE1vsWTTcUmu/LVqaiMdcu8O+UaDW Z3Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NN+Q3q0BxDoQb6X55VzHKi6+M4es95yNcRRxFvvxYg8=; b=lrJFgRDSk4rWwWuIxcj00ofRF4tGL4/mKTtlP5ST6O8qqWobnH8TDaCEFOHSZmou8a mI4+0hfQrVQSnVic2tvjiJIxppuSzcHF8i20TZgvd3hymG31bRYOVUW1p2fjYSGbGRu9 yBbUnVDhf295Hwqqw5G950Hp8+MGx5Us81fdrmsHD2yQf/Ceh55kwW5qxTvJawTWvPE3 oGidnLeR+J4/A0IqdFdYStPnwe4KWOTrbCnlcdX7Xe0VkZzILdzocFNQhpE2OMveK1vU 0sAcT/VW29zPo2XWKDIaluq8iXyalQAPnocfjC0m3M276aBb1eC5u8xt1kKSGYfPsxfS GcCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pO+WauDQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq35-20020a1709073f2300b0093a0e786128si4998301ejc.175.2023.03.22.02.51.31; Wed, 22 Mar 2023 02:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pO+WauDQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbjCVJq7 (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231204AbjCVJqm (ORCPT ); Wed, 22 Mar 2023 05:46:42 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CFAE5F6F3; Wed, 22 Mar 2023 02:46:35 -0700 (PDT) X-UUID: 6a18813ac89611eda9a90f0bb45854f4-20230322 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=NN+Q3q0BxDoQb6X55VzHKi6+M4es95yNcRRxFvvxYg8=; b=pO+WauDQei2FV8u+dh8hKSi3E40mjmWRP31PVTPpiu8lVPZ+pI+AzaM0D8828Hfw4OhIKdFwemibOmGx45WfyT2uUVBOqUwRC8683a0/nLaGetX0HQYpM4TGXdWZNfiLFb4RS1lib60uNzjUXA9ufYjOO2BfKDEf1bxatq0zVr0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:12639469-a69b-4ffc-9389-32b83b311199,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:120426c,CLOUDID:d2822429-564d-42d9-9875-7c868ee415ec,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 6a18813ac89611eda9a90f0bb45854f4-20230322 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1590059525; Wed, 22 Mar 2023 17:46:26 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 22 Mar 2023 17:46:25 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:25 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,6/7] media: mediatek: vcodec: Change dbgfs interface to support encode Date: Wed, 22 Mar 2023 17:46:16 +0800 Message-ID: <20230322094617.19410-7-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061073140683581?= X-GMAIL-MSGID: =?utf-8?q?1761061073140683581?= Extend dbgfs init interface to support encode and create encode dbgfs file. Signed-off-by: Yunfei Dong --- .../media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c | 9 +++++++-- .../media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h | 4 ++-- .../media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index 1b1b4301a83d..4f6d0a4af651 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -160,11 +160,14 @@ 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) +void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode) { struct dentry *vcodec_root; - vcodec_dev->dbgfs.vcodec_root = debugfs_create_dir("vcodec-dec", NULL); + 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); if (IS_ERR(vcodec_dev->dbgfs.vcodec_root)) dev_err(&vcodec_dev->plat_dev->dev, "create vcodec dir err:%d\n", IS_ERR(vcodec_dev->dbgfs.vcodec_root)); @@ -174,6 +177,8 @@ void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) 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); diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h index 9e586889717b..f4d6afff64f3 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h @@ -51,7 +51,7 @@ struct mtk_vcodec_dbgfs { #if defined(CONFIG_DEBUG_FS) void mtk_vcodec_dbgfs_create(struct mtk_vcodec_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); +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); #else static inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_ctx *ctx) @@ -62,7 +62,7 @@ static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, in { } -static inline void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev) +static inline void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode) { } 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 8c2443a18f5e..bba7b932f4fa 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -433,7 +433,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) mtk_v4l2_debug(0, "media registered as /dev/media%d", vfd_dec->minor); } - mtk_vcodec_dbgfs_init(dev); + mtk_vcodec_dbgfs_init(dev, false); mtk_v4l2_debug(0, "decoder registered as /dev/video%d", vfd_dec->minor); return 0; From patchwork Wed Mar 22 09:46:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 73335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2250246wrt; Wed, 22 Mar 2023 02:53:43 -0700 (PDT) X-Google-Smtp-Source: AK7set/z10TCsSHs/deedCwFT/FkOMqany95ovaDVpEYPNcqSgYP+O9IDnYrR7HJtb+kg3UFNeka X-Received: by 2002:a17:906:f8db:b0:8b1:7ae8:ba6f with SMTP id lh27-20020a170906f8db00b008b17ae8ba6fmr6077063ejb.16.1679478823101; Wed, 22 Mar 2023 02:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478823; cv=none; d=google.com; s=arc-20160816; b=FtQPWT/UDhPSOD4VgdAeDjt7mCuzeQ5wVDs2g2R3sapvPvWQvN2nLUSXRv6EqxZ2GM eI47deUmMX3DdkmGMoZzoSNaNNYwMdkVitcgqrD5KCF1c6G3pej98+6F+jewMSMWEoAz 8hf3QD9W+XrcWKWuVJkkvoGA26jGw/KQl8MdQHUFC49YOZs3rIibwz25quSumrpZHsuA Ysay8Ok7veofQw5MCnitFBL8EZIGtS1k/khKI2sf8n/UP1n3K1k8btMtflwFK1Jb3jIW JcCK0Tlkjnu4JDiDdX8ZUW7nGOLqOASuw02Oxr+U6CYwLOr+HzCyg79uDXYaukmjDLQr ClDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=US96CU8gwOlQDNGnB1czPTrVjQZwc8zoh0dPgirX9Jo=; b=swv8BKB8Uj0sBy9ftl8kn+poZvkh2Y2WxqosD3/0cfjsnYDH6gYC/b+7jZMTu+4Z3u SU4u++nJlwxEmMloNR9ueQP7h/tAByu/xXasZR+OheFYL1i+oxeKzdjA66tdPZkTmiNb G7mJh3G7OK8pNjMgczqKyGxsIJRoHgeUJbqUHq/TlE812qU+UctLSKQIEvFroWxJQdBE +tx0KBf2KjQtu5L+fMVsPVjW8Qv4+MFXK9el6BsL96H6343jhZYDxmbbWMqeJKik/vMW eUMGsujnKA2TZm0sybfwZf4YjPkg3FyRfNdbapnGYLsrT9k5395zJ4SGwJbIQn3iqLuT LPdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lB445nTn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020a1709066b1800b0092bf1091806si14398775ejr.748.2023.03.22.02.53.20; Wed, 22 Mar 2023 02:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lB445nTn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbjCVJqo (ORCPT + 99 others); Wed, 22 Mar 2023 05:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbjCVJqe (ORCPT ); Wed, 22 Mar 2023 05:46:34 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B0095DCB2; Wed, 22 Mar 2023 02:46:33 -0700 (PDT) X-UUID: 6ade84a2c89611eda9a90f0bb45854f4-20230322 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=US96CU8gwOlQDNGnB1czPTrVjQZwc8zoh0dPgirX9Jo=; b=lB445nTnCanSQQMflsKKhjjN1c4h49BsglPjE1GcuwmiIYO3XdqLkUOqHFeT+wLU3TOOErH6mX3bAPAo+8bID8xf3AdtzzgE5MtBkA+alTC8lxHkiMIYKqvyKRZv+6WErpFtzARO1x4DAI9CEPJXhd6CHkMPnHxJtPvws9XNq7k=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:8b089333-8413-4f80-bb6f-3c91fdc53af2,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.22,REQID:8b089333-8413-4f80-bb6f-3c91fdc53af2,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:120426c,CLOUDID:1e8005b4-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:230322174629W1R8T42K,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 6ade84a2c89611eda9a90f0bb45854f4-20230322 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 427927871; Wed, 22 Mar 2023 17:46:28 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 22 Mar 2023 17:46:26 +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.25 via Frontend Transport; Wed, 22 Mar 2023 17:46:26 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,7/7] media: mediatek: vcodec: Add encode to support dbgfs Date: Wed, 22 Mar 2023 17:46:17 +0800 Message-ID: <20230322094617.19410-8-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322094617.19410-1-yunfei.dong@mediatek.com> References: <20230322094617.19410-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761061186222471380?= X-GMAIL-MSGID: =?utf-8?q?1761061186222471380?= Add encode to support dbgfs. Signed-off-by: Yunfei Dong --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 2 ++ 1 file changed, 2 insertions(+) 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 9095186d5495..6961f66b5693 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c @@ -353,6 +353,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) 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); @@ -463,6 +464,7 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev) if (dev->vfd_enc) video_unregister_device(dev->vfd_enc); + mtk_vcodec_dbgfs_deinit(dev); v4l2_device_unregister(&dev->v4l2_dev); pm_runtime_disable(dev->pm.dev); mtk_vcodec_fw_release(dev->fw_handler);