// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2021 MediaTek Inc. * Author: Yunfei Dong <[email protected]> */ #include <linux/slab.h> #include <media/v4l2-mem2mem.h> #include <media/videobuf2-dma-contig.h> #include <uapi/linux/v4l2-controls.h> #include "../mtk_vcodec_dec.h" #include "../../common/mtk_vcodec_intr.h" #include "../vdec_drv_base.h" #include "../vdec_drv_if.h" #include "../vdec_vpu_if.h" /* Decoding picture buffer size (3 reference frames plus current frame) */ #define VP8_DPB_SIZE … /* HW working buffer size (bytes) */ #define VP8_SEG_ID_SZ … #define VP8_PP_WRAPY_SZ … #define VP8_PP_WRAPC_SZ … #define VP8_VLD_PRED_SZ … /** * struct vdec_vp8_slice_info - decode misc information * * @vld_wrapper_dma: vld wrapper dma address * @seg_id_buf_dma: seg id dma address * @wrap_y_dma: wrap y dma address * @wrap_c_dma: wrap y dma address * @cur_y_fb_dma: current plane Y frame buffer dma address * @cur_c_fb_dma: current plane C frame buffer dma address * @bs_dma: bitstream dma address * @bs_sz: bitstream size * @resolution_changed:resolution change flag 1 - changed, 0 - not changed * @frame_header_type: current frame header type * @crc: used to check whether hardware's status is right * @reserved: reserved, currently unused */ struct vdec_vp8_slice_info { … }; /** * struct vdec_vp8_slice_dpb_info - vp8 reference information * * @y_dma_addr: Y bitstream physical address * @c_dma_addr: CbCr bitstream physical address * @reference_flag: reference picture flag * @reserved: 64bit align */ struct vdec_vp8_slice_dpb_info { … }; /** * struct vdec_vp8_slice_vsi - VPU shared information * * @dec: decoding information * @pic: picture information * @vp8_dpb_info: reference buffer information */ struct vdec_vp8_slice_vsi { … }; /** * struct vdec_vp8_slice_inst - VP8 decoder instance * * @seg_id_buf: seg buffer * @wrap_y_buf: wrapper y buffer * @wrap_c_buf: wrapper c buffer * @vld_wrapper_buf: vld wrapper buffer * @ctx: V4L2 context * @vpu: VPU instance for decoder * @vsi: VPU share information */ struct vdec_vp8_slice_inst { … }; static void *vdec_vp8_slice_get_ctrl_ptr(struct mtk_vcodec_dec_ctx *ctx, int id) { … } static void vdec_vp8_slice_get_pic_info(struct vdec_vp8_slice_inst *inst) { … } static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst) { … } static void vdec_vp8_slice_free_working_buf(struct vdec_vp8_slice_inst *inst) { … } static u64 vdec_vp8_slice_get_ref_by_ts(const struct v4l2_ctrl_vp8_frame *frame_header, int index) { … } static int vdec_vp8_slice_get_decode_parameters(struct vdec_vp8_slice_inst *inst) { … } static int vdec_vp8_slice_init(struct mtk_vcodec_dec_ctx *ctx) { … } static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, struct vdec_fb *fb, bool *res_chg) { … } static int vdec_vp8_slice_get_param(void *h_vdec, enum vdec_get_param_type type, void *out) { … } static void vdec_vp8_slice_deinit(void *h_vdec) { … } const struct vdec_common_if vdec_vp8_slice_if = …;