[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <651387eb-561f-06b4-f269-7b5f7873fc59@collabora.com>
Date: Thu, 20 Jan 2022 16:10:45 +0100
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Yunfei Dong <yunfei.dong@...iatek.com>,
Alexandre Courbot <acourbot@...omium.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Tzung-Bi Shih <tzungbi@...omium.org>,
Tiffany Lin <tiffany.lin@...iatek.com>,
Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Tomasz Figa <tfiga@...gle.com>
Cc: George Sun <george.sun@...iatek.com>,
Xiaoyong Lu <xiaoyong.lu@...iatek.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Fritz Koenig <frkoenig@...omium.org>,
Dafna Hirschfeld <dafna.hirschfeld@...labora.com>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Irui Wang <irui.wang@...iatek.com>,
Steve Cho <stevecho@...omium.org>, linux-media@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, srv_heupstream@...iatek.com,
linux-mediatek@...ts.infradead.org,
Project_Global_Chrome_Upstream_Group@...iatek.com
Subject: Re: [PATCH v5, 12/15] media: mtk-vcodec: Extract H264 common code
Il 17/01/22 10:39, Yunfei Dong ha scritto:
> Mt8192 can use some of common code with mt8183. Moves them to
> a new file in order to reuse.
>
> Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> ---
> drivers/media/platform/mtk-vcodec/Makefile | 1 +
> .../mtk-vcodec/vdec/vdec_h264_req_common.c | 307 ++++++++++++++
> .../mtk-vcodec/vdec/vdec_h264_req_common.h | 253 +++++++++++
> .../mtk-vcodec/vdec/vdec_h264_req_if.c | 395 +-----------------
> 4 files changed, 579 insertions(+), 377 deletions(-)
> create mode 100644 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_common.c
> create mode 100644 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_common.h
>
> diff --git a/drivers/media/platform/mtk-vcodec/Makefile b/drivers/media/platform/mtk-vcodec/Makefile
> index 359619653a0e..3f41d748eee5 100644
> --- a/drivers/media/platform/mtk-vcodec/Makefile
> +++ b/drivers/media/platform/mtk-vcodec/Makefile
> @@ -9,6 +9,7 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
> vdec/vdec_vp8_if.o \
> vdec/vdec_vp9_if.o \
> vdec/vdec_h264_req_if.o \
> + vdec/vdec_h264_req_common.o \
> mtk_vcodec_dec_drv.o \
> vdec_drv_if.o \
> vdec_vpu_if.o \
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_common.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_common.c
> new file mode 100644
> index 000000000000..90e8c4906e2a
> --- /dev/null
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_common.c
> @@ -0,0 +1,307 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2021 MediaTek Inc.
> + * Author: Yunfei Dong <yunfei.dong@...iatek.com>
> + */
> +
> +#include "vdec_h264_req_common.h"
> +
> +/* get used parameters for sps/pps */
> +#define GET_MTK_VDEC_FLAG(cond, flag) \
> + { dst_param->cond = ((src_param->flags & flag) ? (1) : (0)); }
> +#define GET_MTK_VDEC_PARAM(param) \
> + { dst_param->param = src_param->param; }
> +
> +/*
> + * The firmware expects unused reflist entries to have the value 0x20.
> + */
> +void mtk_vdec_h264_fixup_ref_list(u8 *ref_list, size_t num_valid)
> +{
> + memset(&ref_list[num_valid], 0x20, 32 - num_valid);
> +}
> +
> +void *mtk_vdec_h264_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id)
> +{
> + struct v4l2_ctrl *ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, id);
> +
Like written in the review for the VP8 driver, please perform a NULL check and
handle the error case properly in the caller...
> + return ctrl->p_cur.p;
> +}
> +
> +void mtk_vdec_h264_fill_dpb_info(struct mtk_vcodec_ctx *ctx,
> + struct slice_api_h264_decode_param *decode_params,
> + mtk_h264_dpb_info *h264_dpb_info)
struct mtk_h264_dpb_info *h264_dpb_info)
^^^^^^
Oops! This typo makes this code unable to be compiled.
> +{
> + struct vb2_queue *vq;
> + struct vb2_buffer *vb;
> + struct vb2_v4l2_buffer *vb2_v4l2;
> + int index;
> +
> + vq = v4l2_m2m_get_vq(ctx->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
> +
> + for (index = 0; index < V4L2_H264_NUM_DPB_ENTRIES; index++) {
> + const struct slice_h264_dpb_entry *dpb;
> + int vb2_index;
> +
...snip...
> +void mtk_vdec_h264_copy_scaling_matrix(struct slice_api_h264_scaling_matrix *dst_matrix,
> + const struct v4l2_ctrl_h264_scaling_matrix *src_matrix)
> +{
> + memcpy(dst_matrix->scaling_list_4x4, src_matrix->scaling_list_4x4,
> + sizeof(dst_matrix->scaling_list_4x4));
> +
> + memcpy(dst_matrix->scaling_list_8x8, src_matrix->scaling_list_8x8,
> + sizeof(dst_matrix->scaling_list_8x8));
> +}
> +
> +void
> +mtk_vdec_h264_copy_decode_params(struct slice_api_h264_decode_param *dst_params,
> + const struct v4l2_ctrl_h264_decode_params *src_params,
> + const struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES]);
There's another overlook here:
const struct v4l2_h264_dpb_entry *dpb)
> +{
> + int i;
Regards,
Angelo
Powered by blists - more mailing lists