[PATCH 4/6 RESEND] media: mediatek: vcodec: Get get each instance format type
Yunfei Dong
yunfei.dong at mediatek.com
Mon Mar 20 03:28:36 PDT 2023
Adding echo command to get capture and output queue format type:
'echo -format > vdec'
Signed-off-by: Yunfei Dong <yunfei.dong at mediatek.com>
---
.../mediatek/vcodec/mtk_vcodec_dbgfs.c | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
index 9e7d57d21cea..8a03f986a857 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
@@ -10,6 +10,34 @@
#include "mtk_vcodec_drv.h"
#include "mtk_vcodec_util.h"
+static void mtk_vdec_dbgfs_get_format_type(int output, int capture)
+{
+ switch (output) {
+ case V4L2_PIX_FMT_H264_SLICE:
+ pr_info("output format: h264 slice\n");
+ break;
+ case V4L2_PIX_FMT_VP8_FRAME:
+ pr_info("output format: vp8 slice\n");
+ break;
+ case V4L2_PIX_FMT_VP9_FRAME:
+ pr_info("output format: vp9 slice\n");
+ break;
+ default:
+ pr_info("unsupported output format: 0x%x\n", output);
+ }
+
+ switch (capture) {
+ case V4L2_PIX_FMT_MM21:
+ pr_info("capture format MM21\n");
+ break;
+ case V4L2_PIX_FMT_MT21C:
+ pr_info("capture format MT21C\n");
+ break;
+ default:
+ pr_info("unsupported capture format: 0x%x\n", capture);
+ }
+}
+
static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
size_t count, loff_t *ppos)
{
@@ -33,11 +61,17 @@ static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
ctx->picinfo.pic_w, ctx->picinfo.pic_h,
ctx->picinfo.buf_w, ctx->picinfo.buf_h);
}
+
+ if (strstr(buf, "-format")) {
+ str_count++;
+ mtk_vdec_dbgfs_get_format_type(ctx->current_codec, ctx->capture_fourcc);
+ }
}
if (!str_count) {
pr_info("\t can not found useful cmd: %s\n", buf);
pr_info("\t -picinfo ex. echo -picinfo\n");
+ pr_info("\t -format ex. echo -format\n");
}
return count;
--
2.25.1
More information about the linux-arm-kernel
mailing list