[PATCH v2 1/4] media: mediatek: vcodec: remove vsi operation in common interface

Chen-Yu Tsai wenst at chromium.org
Mon Oct 21 20:58:26 PDT 2024


On Wed, Oct 16, 2024 at 11:49 AM Yunfei Dong <yunfei.dong at mediatek.com> wrote:
>
> Remove vsi related operation in common interface to make sure the
> interface can be called by different architecture at the same time.

Nit: it would be nice to provide more context here. You could mention
that a new extended interface with a different shared memory layout (vsi)
will be introduced in later patches.

> Signed-off-by: Yunfei Dong <yunfei.dong at mediatek.com>
> ---
>  .../decoder/vdec/vdec_h264_req_multi_if.c     | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 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 732d78f63e5a..57c85af5ffb4 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_data)

Nit: you could just name this new parameter |slice_param| and avoid the
changes in the next bit.

>  {
> -       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;
> @@ -203,9 +203,9 @@ static int vdec_h264_slice_fill_decode_parameters(struct vdec_h264_slice_inst *i
>                 return -EINVAL;
>         }
>
> -       mtk_vdec_h264_copy_sps_params(&slice_param->sps, sps);
> -       mtk_vdec_h264_copy_pps_params(&slice_param->pps, pps);
> -       mtk_vdec_h264_copy_scaling_matrix(&slice_param->scaling_matrix, src_matrix);
> +       mtk_vdec_h264_copy_sps_params(&slice_data->sps, sps);
> +       mtk_vdec_h264_copy_pps_params(&slice_data->pps, pps);
> +       mtk_vdec_h264_copy_scaling_matrix(&slice_data->scaling_matrix, src_matrix);
>
>         memcpy(&share_info->sps, sps, sizeof(*sps));
>         memcpy(&share_info->dec_params, dec_params, sizeof(*dec_params));
> @@ -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 *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) {

Code wise this patch seems fine.

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



More information about the Linux-mediatek mailing list