diff mbox series

[v6,1/3] media: mediatek: vcodec: remove vsi operation in common interface

Message ID 20241116031616.15656-2-yunfei.dong@mediatek.com
State Superseded
Headers show
Series media: mediatek: vcodec: support h264 extend vsi | expand

Commit Message

Yunfei Dong Nov. 16, 2024, 3:16 a.m. UTC
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 <yunfei.dong@mediatek.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c    | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Sebastian Fricke Dec. 11, 2024, 1:17 p.m. UTC | #1
Hey Yunfei,

On 16.11.2024 11:16, Yunfei Dong wrote:
>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.

My recommendation:

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.

The rest looks good to me.

Regards,
Sebastian Fricke

>Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

>Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>---
> .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c    | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
>index 1ed0ccec5665..ab192ce0b851 100644
>--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
>+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
>@@ -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 *bs
> 	if (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) {
>-- 
>2.46.0
diff mbox series

Patch

diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
index 1ed0ccec5665..ab192ce0b851 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
@@ -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 *bs
 	if (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) {