Skip to content

Commit

Permalink
media: mediatek: vcodec: support stateless AV1 decoder
Browse files Browse the repository at this point in the history
Add mediatek av1 decoder linux driver which use the stateless API in
MT8195.

Signed-off-by: Xiaoyong Lu<xiaoyong.lu@mediatek.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
  • Loading branch information
Xiaoyong Lu authored and intel-lab-lkp committed May 30, 2023
1 parent 8c33787 commit dcf1411
Show file tree
Hide file tree
Showing 8 changed files with 2,291 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/media/platform/mediatek/vcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
vdec/vdec_vp8_req_if.o \
vdec/vdec_vp9_if.o \
vdec/vdec_vp9_req_lat_if.o \
vdec/vdec_av1_req_lat_if.o \
vdec/vdec_h264_req_if.o \
vdec/vdec_h264_req_common.o \
vdec/vdec_h264_req_multi_if.o \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,51 @@ static const struct mtk_stateless_control mtk_stateless_controls[] = {
},
.codec_type = V4L2_PIX_FMT_HEVC_SLICE,
},
{
.cfg = {
.id = V4L2_CID_STATELESS_AV1_SEQUENCE,

},
.codec_type = V4L2_PIX_FMT_AV1_FRAME,
},
{
.cfg = {
.id = V4L2_CID_STATELESS_AV1_FRAME,

},
.codec_type = V4L2_PIX_FMT_AV1_FRAME,
},
{
.cfg = {
.id = V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY,
.dims = { V4L2_AV1_MAX_TILE_COUNT },

},
.codec_type = V4L2_PIX_FMT_AV1_FRAME,
},
{
.cfg = {
.id = V4L2_CID_MPEG_VIDEO_AV1_PROFILE,
.min = V4L2_MPEG_VIDEO_AV1_PROFILE_MAIN,
.def = V4L2_MPEG_VIDEO_AV1_PROFILE_MAIN,
.max = V4L2_MPEG_VIDEO_AV1_PROFILE_MAIN,
},
.codec_type = V4L2_PIX_FMT_AV1_FRAME,
},
{
.cfg = {
.id = V4L2_CID_MPEG_VIDEO_AV1_LEVEL,
.min = V4L2_MPEG_VIDEO_AV1_LEVEL_2_0,
.def = V4L2_MPEG_VIDEO_AV1_LEVEL_4_0,
.max = V4L2_MPEG_VIDEO_AV1_LEVEL_5_1,
},
.codec_type = V4L2_PIX_FMT_AV1_FRAME,
},
};

#define NUM_CTRLS ARRAY_SIZE(mtk_stateless_controls)

static struct mtk_video_fmt mtk_video_formats[6];
static struct mtk_video_fmt mtk_video_formats[7];

static struct mtk_video_fmt default_out_format;
static struct mtk_video_fmt default_cap_format;
Expand Down Expand Up @@ -409,6 +449,7 @@ static void mtk_vcodec_add_formats(unsigned int fourcc,
case V4L2_PIX_FMT_VP8_FRAME:
case V4L2_PIX_FMT_VP9_FRAME:
case V4L2_PIX_FMT_HEVC_SLICE:
case V4L2_PIX_FMT_AV1_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;
Expand Down Expand Up @@ -469,6 +510,10 @@ static void mtk_vcodec_get_supported_formats(struct mtk_vcodec_ctx *ctx)
mtk_vcodec_add_formats(V4L2_PIX_FMT_HEVC_SLICE, ctx);
out_format_count++;
}
if (ctx->dev->dec_capability & MTK_VDEC_FORMAT_AV1_FRAME) {
mtk_vcodec_add_formats(V4L2_PIX_FMT_AV1_FRAME, ctx);
out_format_count++;
}

if (cap_format_count)
default_cap_format = mtk_video_formats[cap_format_count - 1];
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ enum mtk_vdec_format_types {
MTK_VDEC_FORMAT_H264_SLICE = 0x100,
MTK_VDEC_FORMAT_VP8_FRAME = 0x200,
MTK_VDEC_FORMAT_VP9_FRAME = 0x400,
MTK_VDEC_FORMAT_AV1_FRAME = 0x800,
MTK_VDEC_FORMAT_HEVC_FRAME = 0x1000,
MTK_VCODEC_INNER_RACING = 0x20000,
};
Expand Down

0 comments on commit dcf1411

Please sign in to comment.