media: mediatek: vcodec: support h264 extend vsi
Subsystems (3)
Yunfei Dong
maintainerv7 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.
---
compared with v6:
- fix the coding style for patch 2
- rewrite commit message for patch 2/3
compared with v5:
- add some parameters comment for patch 2
compared with v4:
- rebase this patch series with latest vcodec driver
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 | 648 +++++++++++++++--- 2 files changed, 558 insertions(+), 92 deletions(-)
Signature · 1 line
2.46.0
Yunfei Dong
maintainerPATCH v7 1/3 media: mediatek: vcodec: remove vsi operation in common interface
Extend the VSI (video shared information) struct to allow sending slice parameters to SCP, as the parameters have changed on MT8188 architecture. Remove VSI related information from the common interface to ensure, that the interface is usable by architectures with and without the extended parameters. The new VSI extensions 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->src_buf_req = src_buf_info->m2m_buf.vb.vb2_buf.req_obj.req;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
Yunfei Dong
maintainerPATCH v7 2/3 media: mediatek: vcodec: support extended h264 decode
In reply to Yunfei DongAdd a new extended vsi_ext struct besides the existing vsi struct, to enable calculating the end of the address range of the current working buffer for architectures, where simply adding the buffer size to the start of the address range isn't sufficient.
Additionally, on extended architectures, the NAL information can be fetched directly from the firmware, which allows skipping the parsing step within the kernel.
--- .../vcodec/decoder/mtk_vcodec_dec_drv.h | 2 + .../decoder/vdec/vdec_h264_req_multi_if.c | 630 +++++++++++++++--- 2 files changed, 548 insertions(+), 84 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_EXT (capability) ((capability) & MTK_VDEC_IS_SUPPORT_EXT)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_EXT = 0x80000, };/*
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +546 -84
765 lines not on this page · raw message
Signature · 1 line
2.46.0
Yunfei Dong
maintainerPATCH v7 3/3 media: mediatek: vcodec: add description for vsi struct
In reply to Yunfei DongThe vsi (video shared information) struct needs to be synchronized between firmware and host, as a change that is only done in the host version of the struct but isn't synchronized to the firmware can lead to decoding issues with H264 bitstreams. Highlight this requirement within the struct descriptions.
--- .../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 data between host and 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 data between host and 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 data between host and firmware). * * @wdma_err_addr: wdma error dma address * @wdma_start_addr: wdma start dma address
Signature · 1 line
2.46.0