media: mediatek: vcodec: support h264 extend vsi
Subsystems (3)
Yunfei Dong
maintainerv4 cover media: mediatek: vcodec: support h264 extend vsi
The working buffer address start and end are calculated in kernel side currently, the address end can't be calculated if the driver only getting the address file handle, not the real physical address. Need to send the extended vsi to firmware to calculate the address end.
Re-construct some interface and add configuration to support extend
and non extend driver at the same time. Needn't to parse nal info for
extended architecture.
---
This patch series depends on:
[1] https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]
---
compared with v3:
- change code logic with callback to decode for patch 2
compared with v2:
- squash patch 2/3/4 together
- re-write commit message for patch 1
compared with v1:
- combine some pathes together for patch 2
- re-write patch 4
---
Yunfei Dong (3):
media: mediatek: vcodec: remove vsi operation in common interface
media: mediatek: vcodec: support extended h264 decode
media: mediatek: vcodec: add description for vsi struct
.../vcodec/decoder/mtk_vcodec_dec_drv.h | 2 + .../decoder/vdec/vdec_h264_req_multi_if.c | 589 ++++++++++++++++-- 2 files changed, 524 insertions(+), 67 deletions(-)
Signature · 1 line
2.46.0
Yunfei Dong
maintainerPATCH v4 1/3 media: mediatek: vcodec: remove vsi operation in common interface
Extend struct video shared information (vsi) to send different parameters to scp for mt8188 architecture is changed. Remove vsi related operation in common interface to make sure the interface can be called by extended and non extended architecture at the same time. The new extended interfaces with new vsi will be introduced in later patches.
--- .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +7 -6
@@ -171,9 +171,9 @@ struct vdec_h264_slice_inst { };static int vdec_h264_slice_fill_decode_parameters (struct vdec_h264_slice_inst *inst, -struct vdec_h264_slice_share_info *share_info) +struct vdec_h264_slice_share_info *share_info, +struct vdec_h264_slice_lat_dec_param *slice_param) { -struct vdec_h264_slice_lat_dec_param *slice_param = &inst->vsi->h264_slice_params;const struct v4l2_ctrl_h264_decode_params *dec_params;const struct v4l2_ctrl_h264_scaling_matrix *src_matrix;const struct v4l2_ctrl_h264_sps *sps;
@@ -266,9 +266,6 @@ static int get_vdec_sig_decode_parameters(struct vdec_h264_slice_inst *inst)mtk_vdec_h264_get_ref_list (b0_reflist, v4l2_b0_reflist, reflist_builder.num_valid);mtk_vdec_h264_get_ref_list (b1_reflist, v4l2_b1_reflist, reflist_builder.num_valid); -memcpy (&inst->vsi_ctx.h264_slice_params, slice_param, -sizeof (inst->vsi_ctx.h264_slice_params)); -return 0 ; }
@@ -608,7 +605,8 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf->vb2_v4l2_src = &src_buf_info->m2m_buf.vb;v4l2_m2m_buf_copy_metadata (&src_buf_info->m2m_buf.vb, &lat_buf->ts_info, true); - err =vdec_h264_slice_fill_decode_parameters (inst, share_info); + err =vdec_h264_slice_fill_decode_parameters (inst, share_info, + &inst->vsi->h264_slice_params);if (err) goto err_free_fb_out;
@@ -749,6 +747,9 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bsif (err) goto err_free_fb_out; +memcpy (&inst->vsi_ctx.h264_slice_params, &inst->h264_slice_param, +sizeof (inst->vsi_ctx.h264_slice_params)); + buf = (unsigned char *)bs->va; nal_start_idx =mtk_vdec_h264_find_start_code (buf, bs->size);if (nal_start_idx <0 ) {
Signature · 1 line
2.46.0
Re: [PATCH v4 1/3] media: mediatek: vcodec: remove vsi operation in common interface
Il 08/11/24 04:40, Yunfei Dong ha scritto:
Quoted 9 lines
Extend struct video shared information (vsi) to send different parameters to scp for mt8188 architecture is changed. Remove vsi related operation in common interface to make sure the interface can be called by extended and non extended architecture at the same time. The new extended interfaces with new vsi will be introduced in later patches.
Signed-off-by Yunfei Dong <[email protected]>Reviewed-by Chen-Yu Tsai <[email protected]>
Yunfei Dong
maintainerPATCH v4 2/3 media: mediatek: vcodec: support extended h264 decode
In reply to Yunfei DongThe address end of working buffer can't be calculated directly with buffer size in kernel for some special architecture. Adding new extend vsi_ex to calculate the address end in firmware.
Adding capability to separate extend and non extend driver for different platform.
At last, hardware can parse the syntax to get nal information in firmware for extend architecture, needn't to parse it again in kernel.
--- .../vcodec/decoder/mtk_vcodec_dec_drv.h | 2 + .../decoder/vdec/vdec_h264_req_multi_if.c | 571 ++++++++++++++++-- 2 files changed, 514 insertions(+), 59 deletions(-)
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h +2 -0
@@ -17,6 +17,7 @@#define IS_VDEC_LAT_ARCH (hw_arch) ((hw_arch) >= MTK_VDEC_LAT_SINGLE_CORE)#define IS_VDEC_INNER_RACING (capability) ((capability) & MTK_VCODEC_INNER_RACING) +#define IS_VDEC_SUPPORT_EX (capability) ((capability) & MTK_VDEC_IS_SUPPORT_EX)enum mtk_vcodec_dec_chip_name {MTK_VDEC_INVAL =0 ,
@@ -42,6 +43,7 @@ enum mtk_vdec_format_types {MTK_VDEC_FORMAT_HEVC_FRAME =0x1000 ,MTK_VCODEC_INNER_RACING =0x20000 ,MTK_VDEC_IS_SUPPORT_10BIT =0x40000 , + MTK_VDEC_IS_SUPPORT_EX = 0x80000, };/*
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +512 -59
657 lines not on this page · raw message
Signature · 1 line
2.46.0
Re: [PATCH v4 2/3] media: mediatek: vcodec: support extended h264 decode
Il 08/11/24 04:40, Yunfei Dong ha scritto:
Quoted 9 lines
The address end of working buffer can't be calculated directly with buffer size in kernel for some special architecture. Adding new extend
vsi_exto calculate the address end in firmware.
Adding capability to separate extend and non extend driver for different platform.
At last, hardware can parse the syntax to get nal information in firmware for extend architecture, needn't to parse it again in kernel.Signed-off-by Yunfei Dong <[email protected]>
Yunfei Dong
maintainerPATCH v4 3/3 media: mediatek: vcodec: add description for vsi struct
In reply to Yunfei DongIf the video shared information (vsi) is changed accidentally, will leading to play h264 bitstream fail if the firmware won't be changed at the same time. Marking the shared struct with "shared interface with firmware".
--- .../mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +3 -2
@@ -30,6 +30,7 @@ enum vdec_h264_core_dec_err_type {/** * struct vdec_h264_slice_lat_dec_param - parameters for decode current frame +* (shared interface with firmware) * * @sps: h264 sps syntax parameters * @pps: h264 pps syntax parameters
@@ -48,7 +49,7 @@ struct vdec_h264_slice_lat_dec_param { };/** -* struct vdec_h264_slice_info - decode information +* struct vdec_h264_slice_info - decode information (shared interface with firmware) * * @nal_info: nal info of current picture * @timeout: Decode timeout: 1 timeout, 0 no timeout
@@ -72,7 +73,7 @@ struct vdec_h264_slice_info {/** * struct vdec_h264_slice_vsi - shared memory for decode information exchange -* between SCP and Host. +* between SCP and Host (shared interface with firmware). * * @wdma_err_addr: wdma error dma address * @wdma_start_addr: wdma start dma address
Signature · 1 line
2.46.0
Re: [PATCH v4 3/3] media: mediatek: vcodec: add description for vsi struct
Il 08/11/24 04:40, Yunfei Dong ha scritto:
Quoted 7 lines
If the video shared information (vsi) is changed accidentally, will leading to play h264 bitstream fail if the firmware won't be changed at the same time. Marking the shared struct with "shared interface with firmware".
Signed-off-by Yunfei Dong <[email protected]>Reviewed-by Chen-Yu Tsai <[email protected]>