mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
183 lines
5.9 KiB
Diff
183 lines
5.9 KiB
Diff
From 2cfd18fa6a7527132b808c3dd18ddcaddf270bec Mon Sep 17 00:00:00 2001
|
|
From: Christian Hewitt <christianshewitt@gmail.com>
|
|
Date: Fri, 19 Sep 2025 14:19:53 +0000
|
|
Subject: [PATCH 111/113] WIP: media: rkvdec: Add support for the VDPU346
|
|
variant
|
|
|
|
VDPU346 is derived from VDPU381 but with a single core and limited
|
|
to 4K60 media. It also omits AV1 and AVS2 capabilities. It is used
|
|
with RK3566 and RK3568.
|
|
|
|
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
|
|
---
|
|
.../media/platform/rockchip/rkvdec/rkvdec.c | 118 +++++++++++++++++-
|
|
1 file changed, 116 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
|
|
index 1e263f6d73b8..042a5b544903 100644
|
|
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
|
|
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
|
|
@@ -91,8 +91,9 @@ static bool rkvdec_is_valid_fmt(struct rkvdec_ctx *ctx, u32 fourcc,
|
|
#define VDPU38X_STRIDE_ALIGN 16
|
|
|
|
/**
|
|
- * The default v4l2_fill_pixfmt_mp() function doesn't allow for specific alignment values.
|
|
- * As the VDPU381 and VDPU383 need lines to be aligned on 16, use our own implementation here.
|
|
+ * The default v4l2_fill_pixfmt_mp() function doesn't allow for specific alignment
|
|
+ * values. As the VDPU346, VDPU381, and VDPU383 need lines to be aligned on 16, use
|
|
+ * our own implementation here.
|
|
*/
|
|
static int vdpu38x_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pix_mp, u32 pixelformat,
|
|
u32 width, u32 height)
|
|
@@ -308,6 +309,60 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = {
|
|
.num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs),
|
|
};
|
|
|
|
+static const struct rkvdec_ctrl_desc vdpu346_hevc_ctrl_descs[] = {
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_PARAMS,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_SPS,
|
|
+ .cfg.ops = &rkvdec_ctrl_ops,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_PPS,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_SCALING_MATRIX,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_MODE,
|
|
+ .cfg.min = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED,
|
|
+ .cfg.max = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED,
|
|
+ .cfg.def = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_START_CODE,
|
|
+ .cfg.min = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B,
|
|
+ .cfg.def = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B,
|
|
+ .cfg.max = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_MPEG_VIDEO_HEVC_PROFILE,
|
|
+ .cfg.min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN,
|
|
+ .cfg.max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
|
|
+ .cfg.menu_skip_mask =
|
|
+ BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE),
|
|
+ .cfg.def = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_MPEG_VIDEO_HEVC_LEVEL,
|
|
+ .cfg.min = V4L2_MPEG_VIDEO_HEVC_LEVEL_1,
|
|
+ .cfg.max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS,
|
|
+ .cfg.dims = { 65 },
|
|
+ },
|
|
+ {
|
|
+ .cfg.id = V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS,
|
|
+ .cfg.dims = { 65 },
|
|
+ },
|
|
+};
|
|
+
|
|
+static const struct rkvdec_ctrls vdpu346_hevc_ctrls = {
|
|
+ .ctrls = vdpu346_hevc_ctrl_descs,
|
|
+ .num_ctrls = ARRAY_SIZE(vdpu346_hevc_ctrl_descs),
|
|
+};
|
|
+
|
|
static const struct rkvdec_ctrl_desc vdpu38x_hevc_ctrl_descs[] = {
|
|
{
|
|
.cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_PARAMS,
|
|
@@ -471,6 +526,43 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = {
|
|
}
|
|
};
|
|
|
|
+static const struct rkvdec_coded_fmt_desc vdpu346_coded_fmts[] = {
|
|
+ {
|
|
+ .fourcc = V4L2_PIX_FMT_H264_SLICE,
|
|
+ .frmsize = {
|
|
+ .min_width = 64,
|
|
+ .max_width = 65520,
|
|
+ .step_width = 64,
|
|
+ .min_height = 64,
|
|
+ .max_height = 65520,
|
|
+ .step_height = 16,
|
|
+ },
|
|
+ .ctrls = &rkvdec_h264_ctrls,
|
|
+ .ops = &rkvdec_vdpu381_h264_fmt_ops,
|
|
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts),
|
|
+ .decoded_fmts = rkvdec_h264_decoded_fmts,
|
|
+ .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF,
|
|
+ .capability = RKVDEC_CAPABILITY_H264,
|
|
+ },
|
|
+ {
|
|
+ .fourcc = V4L2_PIX_FMT_HEVC_SLICE,
|
|
+ .frmsize = {
|
|
+ .min_width = 64,
|
|
+ .max_width = 65472,
|
|
+ .step_width = 64,
|
|
+ .min_height = 64,
|
|
+ .max_height = 65472,
|
|
+ .step_height = 16,
|
|
+ },
|
|
+ .ctrls = &vdpu346_hevc_ctrls,
|
|
+ .ops = &rkvdec_vdpu381_hevc_fmt_ops,
|
|
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts),
|
|
+ .decoded_fmts = rkvdec_hevc_decoded_fmts,
|
|
+ .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF,
|
|
+ .capability = RKVDEC_CAPABILITY_HEVC,
|
|
+ },
|
|
+};
|
|
+
|
|
static const struct rkvdec_coded_fmt_desc vdpu381_coded_fmts[] = {
|
|
{
|
|
.fourcc = V4L2_PIX_FMT_H264_SLICE,
|
|
@@ -1637,6 +1729,18 @@ static struct rcb_size_info vdpu381_rcb_sizes[] = {
|
|
{67, PIC_HEIGHT}, // filtc col
|
|
};
|
|
|
|
+static const struct rkvdec_config config_vdpu346 = {
|
|
+ .coded_fmts = (struct rkvdec_coded_fmt_desc *)vdpu346_coded_fmts,
|
|
+ .coded_fmts_num = ARRAY_SIZE(vdpu346_coded_fmts),
|
|
+ .rcb_size_info = vdpu381_rcb_sizes,
|
|
+ .rcb_num = ARRAY_SIZE(vdpu381_rcb_sizes),
|
|
+ .irq_handler = vdpu381_irq_handler,
|
|
+ .fill_pixfmt_mp = vdpu38x_fill_pixfmt_mp,
|
|
+ .colmv_size = rkvdec_colmv_size,
|
|
+ .flatten_matrices = transpose_and_flatten_matrices,
|
|
+ .named_regs = true,
|
|
+};
|
|
+
|
|
static const struct rkvdec_config config_vdpu381 = {
|
|
.coded_fmts = (struct rkvdec_coded_fmt_desc *)vdpu381_coded_fmts,
|
|
.coded_fmts_num = ARRAY_SIZE(vdpu381_coded_fmts),
|
|
@@ -1698,6 +1802,12 @@ static const struct rkvdec_variant rk3399_rkvdec_variant = {
|
|
RKVDEC_CAPABILITY_VP9,
|
|
};
|
|
|
|
+static const struct rkvdec_variant rk3568_vdpu346_variant = {
|
|
+ .config = &config_vdpu346,
|
|
+ .capabilities = RKVDEC_CAPABILITY_H264 |
|
|
+ RKVDEC_CAPABILITY_HEVC,
|
|
+};
|
|
+
|
|
static const struct rkvdec_variant rk3588_vdpu381_variant = {
|
|
.config = &config_vdpu381,
|
|
.capabilities = RKVDEC_CAPABILITY_H264 |
|
|
@@ -1723,6 +1833,10 @@ static const struct of_device_id of_rkvdec_match[] = {
|
|
.compatible = "rockchip,rk3399-vdec",
|
|
.data = &rk3399_rkvdec_variant,
|
|
},
|
|
+ {
|
|
+ .compatible = "rockchip,rk3568-vdec",
|
|
+ .data = &rk3568_vdpu346_variant,
|
|
+ },
|
|
{
|
|
.compatible = "rockchip,rk3588-vdec",
|
|
.data = &rk3588_vdpu381_variant,
|
|
--
|
|
2.34.1
|
|
|