mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
media: mediatek: vcodec: Different codec using different capture format
Vp8 need to use MM21, but vp9 and h264 need to use HyFbc mode for mt8195. Vp8/vp9/h264 use the same MM21 format for mt8192. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
02bbf16aee
commit
7501edef6b
1 changed files with 41 additions and 0 deletions
|
@ -35,6 +35,44 @@ mtk_vdec_find_format(struct v4l2_format *f,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool mtk_vdec_get_cap_fmt(struct mtk_vcodec_ctx *ctx, int format_index)
|
||||||
|
{
|
||||||
|
const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev->vdec_pdata;
|
||||||
|
const struct mtk_video_fmt *fmt;
|
||||||
|
struct mtk_q_data *q_data;
|
||||||
|
int num_frame_count = 0, i;
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
|
for (i = 0; i < *dec_pdata->num_formats; i++) {
|
||||||
|
if (dec_pdata->vdec_formats[i].type != MTK_FMT_FRAME)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
num_frame_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_frame_count == 1)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
fmt = &dec_pdata->vdec_formats[format_index];
|
||||||
|
q_data = &ctx->q_data[MTK_Q_DATA_SRC];
|
||||||
|
switch (q_data->fmt->fourcc) {
|
||||||
|
case V4L2_PIX_FMT_VP8_FRAME:
|
||||||
|
if (fmt->fourcc == V4L2_PIX_FMT_MM21)
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
case V4L2_PIX_FMT_H264_SLICE:
|
||||||
|
case V4L2_PIX_FMT_VP9_FRAME:
|
||||||
|
if (fmt->fourcc == V4L2_PIX_FMT_MM21)
|
||||||
|
ret = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static struct mtk_q_data *mtk_vdec_get_q_data(struct mtk_vcodec_ctx *ctx,
|
static struct mtk_q_data *mtk_vdec_get_q_data(struct mtk_vcodec_ctx *ctx,
|
||||||
enum v4l2_buf_type type)
|
enum v4l2_buf_type type)
|
||||||
{
|
{
|
||||||
|
@ -566,6 +604,9 @@ static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, void *priv,
|
||||||
dec_pdata->vdec_formats[i].type != MTK_FMT_FRAME)
|
dec_pdata->vdec_formats[i].type != MTK_FMT_FRAME)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!output_queue && !mtk_vdec_get_cap_fmt(ctx, i))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (j == f->index)
|
if (j == f->index)
|
||||||
break;
|
break;
|
||||||
++j;
|
++j;
|
||||||
|
|
Loading…
Reference in a new issue