linux/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2023 MediaTek Inc.
 * Author: Yunfei Dong <[email protected]>
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <media/videobuf2-dma-contig.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"

/* the size used to store hevc wrap information */
#define VDEC_HEVC_WRAP_SZ

#define HEVC_MAX_MV_NUM

/* get used parameters for sps/pps */
#define GET_HEVC_VDEC_FLAG(cond, flag)
#define GET_HEVC_VDEC_PARAM(param)

/**
 * enum vdec_hevc_core_dec_err_type  - core decode error type
 *
 * @TRANS_BUFFER_FULL: trans buffer is full
 * @SLICE_HEADER_FULL: slice header buffer is full
 */
enum vdec_hevc_core_dec_err_type {};

/**
 * struct mtk_hevc_dpb_info  - hevc dpb information
 *
 * @y_dma_addr:     Y plane physical address
 * @c_dma_addr:     CbCr plane physical address
 * @reference_flag: reference picture flag (short/long term reference picture)
 * @field:          field picture flag
 */
struct mtk_hevc_dpb_info {};

/*
 * struct mtk_hevc_sps_param  - parameters for sps
 */
struct mtk_hevc_sps_param {};

/*
 * struct mtk_hevc_pps_param  - parameters for pps
 */
struct mtk_hevc_pps_param {};

/*
 * struct mtk_hevc_slice_header_param  - parameters for slice header
 */
struct mtk_hevc_slice_header_param {};

/*
 * struct slice_api_hevc_scaling_matrix  - parameters for scaling list
 */
struct slice_api_hevc_scaling_matrix {};

/*
 * struct slice_hevc_dpb_entry  - each dpb information
 */
struct slice_hevc_dpb_entry {};

/*
 * struct slice_api_hevc_decode_param - parameters for decode.
 */
struct slice_api_hevc_decode_param {};

/**
 * struct hevc_fb - hevc decode frame buffer information
 *
 * @vdec_fb_va: virtual address of struct vdec_fb
 * @y_fb_dma:   dma address of Y frame buffer (luma)
 * @c_fb_dma:   dma address of C frame buffer (chroma)
 * @poc:        picture order count of frame buffer
 * @reserved:   for 8 bytes alignment
 */
struct hevc_fb {};

/**
 * struct vdec_hevc_slice_lat_dec_param  - parameters for decode current frame
 *
 * @sps:            hevc sps syntax parameters
 * @pps:            hevc pps syntax parameters
 * @slice_header:   hevc slice header syntax parameters
 * @scaling_matrix: hevc scaling list parameters
 * @decode_params:  decoder parameters of each frame used for hardware decode
 * @hevc_dpb_info:  dpb reference list
 */
struct vdec_hevc_slice_lat_dec_param {};

/**
 * struct vdec_hevc_slice_info - decode information
 *
 * @wdma_end_addr_offset: wdma end address offset
 * @timeout:              Decode timeout: 1 timeout, 0 no timeout
 * @vdec_fb_va:           VDEC frame buffer struct virtual address
 * @crc:                  Used to check whether hardware's status is right
 */
struct vdec_hevc_slice_info {};

/*
 * struct vdec_hevc_slice_mem - memory address and size
 */
struct vdec_hevc_slice_mem {};

/**
 * struct vdec_hevc_slice_fb - frame buffer for decoding
 * @y:  current y buffer address info
 * @c:  current c buffer address info
 */
struct vdec_hevc_slice_fb {};

/**
 * struct vdec_hevc_slice_vsi - shared memory for decode information exchange
 *        between SCP and Host.
 *
 * @bs:                input buffer info
 *
 * @ube:               ube buffer
 * @trans:             transcoded buffer
 * @err_map:           err map buffer
 * @slice_bc:          slice bc buffer
 * @wrap:              temp buffer
 *
 * @fb:                current y/c buffer
 * @mv_buf_dma:        HW working motion vector buffer
 * @dec:               decode information (AP-R, VPU-W)
 * @hevc_slice_params: decode parameters for hw used
 */
struct vdec_hevc_slice_vsi {};

/**
 * struct vdec_hevc_slice_share_info - shared information used to exchange
 *                                     message between lat and core
 *
 * @sps:               sequence header information from user space
 * @dec_params:        decoder params from user space
 * @hevc_slice_params: decoder params used for hardware
 * @trans:             trans buffer dma address
 */
struct vdec_hevc_slice_share_info {};

/**
 * struct vdec_hevc_slice_inst - hevc decoder instance
 *
 * @slice_dec_num:      Number of frames to be decoded
 * @ctx:                point to mtk_vcodec_dec_ctx
 * @mv_buf:             HW working motion vector buffer
 * @vpu:                VPU instance
 * @vsi:                vsi used for lat
 * @vsi_core:           vsi used for core
 * @wrap_addr:          wrap address used for hevc
 *
 * @hevc_slice_param:   the parameters that hardware use to decode
 *
 * @resolution_changed: resolution changed
 * @realloc_mv_buf:     reallocate mv buffer
 * @cap_num_planes:     number of capture queue plane
 */
struct vdec_hevc_slice_inst {};

static unsigned int vdec_hevc_get_mv_buf_size(unsigned int width, unsigned int height)
{}

static void *vdec_hevc_get_ctrl_ptr(struct mtk_vcodec_dec_ctx *ctx, int id)
{}

static void vdec_hevc_fill_dpb_info(struct mtk_vcodec_dec_ctx *ctx,
				    struct slice_api_hevc_decode_param *decode_params,
				    struct mtk_hevc_dpb_info *hevc_dpb_info)
{}

static void vdec_hevc_copy_sps_params(struct mtk_hevc_sps_param *dst_param,
				      const struct v4l2_ctrl_hevc_sps *src_param)
{}

static void vdec_hevc_copy_pps_params(struct mtk_hevc_pps_param *dst_param,
				      const struct v4l2_ctrl_hevc_pps *src_param)
{}

static void vdec_hevc_copy_scaling_matrix(struct slice_api_hevc_scaling_matrix *dst_matrix,
					  const struct v4l2_ctrl_hevc_scaling_matrix *src_matrix)
{}

static void
vdec_hevc_copy_decode_params(struct slice_api_hevc_decode_param *dst_param,
			     const struct v4l2_ctrl_hevc_decode_params *src_param,
			     const struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX])
{}

static int vdec_hevc_slice_fill_decode_parameters(struct vdec_hevc_slice_inst *inst,
						  struct vdec_hevc_slice_share_info *share_info)
{}

static void vdec_hevc_slice_fill_decode_reflist(struct vdec_hevc_slice_inst *inst,
						struct vdec_hevc_slice_lat_dec_param *slice_param,
						struct vdec_hevc_slice_share_info *share_info)
{}

static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst,
					struct vdec_pic_info *pic)
{}

static void vdec_hevc_slice_free_mv_buf(struct vdec_hevc_slice_inst *inst)
{}

static void vdec_hevc_slice_get_pic_info(struct vdec_hevc_slice_inst *inst)
{}

static void vdec_hevc_slice_get_crop_info(struct vdec_hevc_slice_inst *inst,
					  struct v4l2_rect *cr)
{}

static int vdec_hevc_slice_setup_lat_buffer(struct vdec_hevc_slice_inst *inst,
					    struct mtk_vcodec_mem *bs,
					    struct vdec_lat_buf *lat_buf,
					    bool *res_chg)
{}

static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst,
					     struct vdec_hevc_slice_share_info *share_info,
					     struct vdec_lat_buf *lat_buf)
{}

static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx)
{}

static void vdec_hevc_slice_deinit(void *h_vdec)
{}

static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf)
{}

static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
				      struct vdec_fb *fb, bool *res_chg)
{}

static int vdec_hevc_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
				  struct vdec_fb *unused, bool *res_chg)
{}

static int vdec_hevc_slice_get_param(void *h_vdec, enum vdec_get_param_type type,
				     void *out)
{}

const struct vdec_common_if vdec_hevc_slice_multi_if =;