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, };