Skip to content

Commit 6d5aea1

Browse files
yunfei-mtkmchehab
authored andcommitted
media: mediatek: vcodec: Get each instance format type
Adding echo command to get capture and output queue format type of each instance:"echo '-format' > vdec", not current hardware supported. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 07b7e50 commit 6d5aea1

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,48 @@
1010
#include "mtk_vcodec_drv.h"
1111
#include "mtk_vcodec_util.h"
1212

13+
static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_ctx *ctx, char *buf,
14+
int *used, int total)
15+
{
16+
int curr_len;
17+
18+
switch (ctx->current_codec) {
19+
case V4L2_PIX_FMT_H264_SLICE:
20+
curr_len = snprintf(buf + *used, total - *used,
21+
"\toutput format: h264 slice\n");
22+
break;
23+
case V4L2_PIX_FMT_VP8_FRAME:
24+
curr_len = snprintf(buf + *used, total - *used,
25+
"\toutput format: vp8 slice\n");
26+
break;
27+
case V4L2_PIX_FMT_VP9_FRAME:
28+
curr_len = snprintf(buf + *used, total - *used,
29+
"\toutput format: vp9 slice\n");
30+
break;
31+
default:
32+
curr_len = snprintf(buf + *used, total - *used,
33+
"\tunsupported output format: 0x%x\n",
34+
ctx->current_codec);
35+
}
36+
*used += curr_len;
37+
38+
switch (ctx->capture_fourcc) {
39+
case V4L2_PIX_FMT_MM21:
40+
curr_len = snprintf(buf + *used, total - *used,
41+
"\tcapture format: MM21\n");
42+
break;
43+
case V4L2_PIX_FMT_MT21C:
44+
curr_len = snprintf(buf + *used, total - *used,
45+
"\tcapture format: MT21C\n");
46+
break;
47+
default:
48+
curr_len = snprintf(buf + *used, total - *used,
49+
"\tunsupported capture format: 0x%x\n",
50+
ctx->capture_fourcc);
51+
}
52+
*used += curr_len;
53+
}
54+
1355
static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
1456
size_t count, loff_t *ppos)
1557
{
@@ -44,6 +86,9 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,
4486
if (strstr(dbgfs->dbgfs_buf, "-picinfo"))
4587
dbgfs_index[MTK_VDEC_DBGFS_PICINFO] = true;
4688

89+
if (strstr(dbgfs->dbgfs_buf, "-format"))
90+
dbgfs_index[MTK_VDEC_DBGFS_FORMAT] = true;
91+
4792
mutex_lock(&dbgfs->dbgfs_lock);
4893
list_for_each_entry(dbgfs_inst, &dbgfs->dbgfs_head, node) {
4994
ctx = dbgfs_inst->vcodec_ctx;
@@ -59,6 +104,9 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,
59104
ctx->picinfo.buf_w, ctx->picinfo.buf_h);
60105
used_len += curr_len;
61106
}
107+
108+
if (dbgfs_index[MTK_VDEC_DBGFS_FORMAT])
109+
mtk_vdec_dbgfs_get_format_type(ctx, buf, &used_len, total_len);
62110
}
63111
mutex_unlock(&dbgfs->dbgfs_lock);
64112

drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct mtk_vcodec_ctx;
1515
*/
1616
enum mtk_vdec_dbgfs_log_index {
1717
MTK_VDEC_DBGFS_PICINFO,
18+
MTK_VDEC_DBGFS_FORMAT,
1819
MTK_VDEC_DBGFS_MAX,
1920
};
2021

0 commit comments

Comments
 (0)