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>
This commit is contained in:
Yunfei Dong 2023-05-30 20:29:05 +08:00 committed by Mauro Carvalho Chehab
parent 07b7e505ff
commit 6d5aea131f
2 changed files with 49 additions and 0 deletions

View File

@ -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)
{
@ -44,6 +86,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;
@ -59,6 +104,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);

View File

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