media: mediatek: vcodec: support stateless VP9 decoding

Add support for VP9 decoding using the stateless API,
as supported by MT8192. And the drivers is lat and core architecture.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: George Sun <george.sun@mediatek.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@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 2022-05-12 04:19:49 +02:00 committed by Mauro Carvalho Chehab
parent 7a7ae26fd4
commit 5d418351ca
7 changed files with 2061 additions and 3 deletions

View File

@ -22,6 +22,7 @@ config VIDEO_MEDIATEK_VCODEC
select VIDEO_MEDIATEK_VCODEC_VPU if VIDEO_MEDIATEK_VPU
select VIDEO_MEDIATEK_VCODEC_SCP if MTK_SCP
select V4L2_H264
select V4L2_VP9
select MEDIA_CONTROLLER
select MEDIA_CONTROLLER_REQUEST_API
help

View File

@ -9,6 +9,7 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
vdec/vdec_vp8_if.o \
vdec/vdec_vp8_req_if.o \
vdec/vdec_vp9_if.o \
vdec/vdec_vp9_req_lat_if.o \
vdec/vdec_h264_req_if.o \
vdec/vdec_h264_req_common.o \
vdec/vdec_h264_req_multi_if.o \

View File

@ -91,13 +91,28 @@ static const struct mtk_stateless_control mtk_stateless_controls[] = {
.max = V4L2_MPEG_VIDEO_VP8_PROFILE_3,
},
.codec_type = V4L2_PIX_FMT_VP8_FRAME,
}
},
{
.cfg = {
.id = V4L2_CID_STATELESS_VP9_FRAME,
},
.codec_type = V4L2_PIX_FMT_VP9_FRAME,
},
{
.cfg = {
.id = V4L2_CID_MPEG_VIDEO_VP9_PROFILE,
.min = V4L2_MPEG_VIDEO_VP9_PROFILE_0,
.def = V4L2_MPEG_VIDEO_VP9_PROFILE_0,
.max = V4L2_MPEG_VIDEO_VP9_PROFILE_3,
},
.codec_type = V4L2_PIX_FMT_VP9_FRAME,
},
};
#define NUM_CTRLS ARRAY_SIZE(mtk_stateless_controls)
static struct mtk_video_fmt mtk_video_formats[4];
static struct mtk_codec_framesizes mtk_vdec_framesizes[2];
static struct mtk_video_fmt mtk_video_formats[5];
static struct mtk_codec_framesizes mtk_vdec_framesizes[3];
static struct mtk_video_fmt default_out_format;
static struct mtk_video_fmt default_cap_format;
@ -338,6 +353,7 @@ static void mtk_vcodec_add_formats(unsigned int fourcc,
switch (fourcc) {
case V4L2_PIX_FMT_H264_SLICE:
case V4L2_PIX_FMT_VP8_FRAME:
case V4L2_PIX_FMT_VP9_FRAME:
mtk_video_formats[count_formats].fourcc = fourcc;
mtk_video_formats[count_formats].type = MTK_FMT_DEC;
mtk_video_formats[count_formats].num_planes = 1;
@ -385,6 +401,10 @@ static void mtk_vcodec_get_supported_formats(struct mtk_vcodec_ctx *ctx)
mtk_vcodec_add_formats(V4L2_PIX_FMT_VP8_FRAME, ctx);
out_format_count++;
}
if (ctx->dev->dec_capability & MTK_VDEC_FORMAT_VP9_FRAME) {
mtk_vcodec_add_formats(V4L2_PIX_FMT_VP9_FRAME, ctx);
out_format_count++;
}
if (cap_format_count)
default_cap_format = mtk_video_formats[cap_format_count - 1];

View File

@ -355,6 +355,7 @@ enum mtk_vdec_format_types {
MTK_VDEC_FORMAT_MT21C = 0x40,
MTK_VDEC_FORMAT_H264_SLICE = 0x100,
MTK_VDEC_FORMAT_VP8_FRAME = 0x200,
MTK_VDEC_FORMAT_VP9_FRAME = 0x400,
};
/**

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,10 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
ctx->dec_if = &vdec_vp9_if;
ctx->hw_id = MTK_VDEC_CORE;
break;
case V4L2_PIX_FMT_VP9_FRAME:
ctx->dec_if = &vdec_vp9_slice_lat_if;
ctx->hw_id = MTK_VDEC_LAT0;
break;
default:
return -EINVAL;
}

View File

@ -60,6 +60,7 @@ extern const struct vdec_common_if vdec_h264_slice_multi_if;
extern const struct vdec_common_if vdec_vp8_if;
extern const struct vdec_common_if vdec_vp8_slice_if;
extern const struct vdec_common_if vdec_vp9_if;
extern const struct vdec_common_if vdec_vp9_slice_lat_if;
/**
* vdec_if_init() - initialize decode driver