linux/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 */
#include <linux/kernel.h>
#include <linux/sizes.h>
#include <linux/videodev2.h>

#include "hfi.h"
#include "hfi_plat_bufs.h"
#include "helpers.h"

#define MIN_INPUT_BUFFERS
#define MIN_ENC_OUTPUT_BUFFERS

#define NV12_UBWC_Y_TILE_WIDTH
#define NV12_UBWC_Y_TILE_HEIGHT
#define NV12_UBWC_UV_TILE_WIDTH
#define NV12_UBWC_UV_TILE_HEIGHT
#define TP10_UBWC_Y_TILE_WIDTH
#define TP10_UBWC_Y_TILE_HEIGHT
#define METADATA_STRIDE_MULTIPLE
#define METADATA_HEIGHT_MULTIPLE
#define HFI_DMA_ALIGNMENT

#define MAX_FE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE
#define MAX_FE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE
#define MAX_FE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE
#define MAX_FE_NBR_DATA_LUMA_LINE_BUFFER_SIZE
#define MAX_FE_NBR_DATA_CB_LINE_BUFFER_SIZE
#define MAX_FE_NBR_DATA_CR_LINE_BUFFER_SIZE

#define MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE
#define MAX_SE_NBR_CTRL_LCU32_LINE_BUFFER_SIZE
#define MAX_SE_NBR_CTRL_LCU16_LINE_BUFFER_SIZE

#define MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE
#define MAX_PE_NBR_DATA_LCU32_LINE_BUFFER_SIZE
#define MAX_PE_NBR_DATA_LCU16_LINE_BUFFER_SIZE

#define MAX_TILE_COLUMNS

#define VPP_CMD_MAX_SIZE
#define NUM_HW_PIC_BUF
#define BIN_BUFFER_THRESHOLD
#define H264D_MAX_SLICE
/* sizeof(h264d_buftab_t) aligned to 256 */
#define SIZE_H264D_BUFTAB_T
/* sizeof(h264d_hw_pic_t) aligned to 32 */
#define SIZE_H264D_HW_PIC_T
#define SIZE_H264D_BSE_CMD_PER_BUF
#define SIZE_H264D_VPP_CMD_PER_BUF

/* Line Buffer definitions, One for Luma and 1/2 for each Chroma */
#define SIZE_H264D_LB_FE_TOP_DATA(width, height)

#define SIZE_H264D_LB_FE_TOP_CTRL(width, height)

#define SIZE_H264D_LB_FE_LEFT_CTRL(width, height)

#define SIZE_H264D_LB_SE_TOP_CTRL(width, height)

#define SIZE_H264D_LB_SE_LEFT_CTRL(width, height)

#define SIZE_H264D_LB_PE_TOP_DATA(width, height)

#define SIZE_H264D_LB_VSP_TOP(width, height)

#define SIZE_H264D_LB_RECON_DMA_METADATA_WR(width, height)

#define SIZE_H264D_QP(width, height)

#define SIZE_HW_PIC(size_per_buf)

#define H264_CABAC_HDR_RATIO_HD_TOT
#define H264_CABAC_RES_RATIO_HD_TOT

/*
 * Some content need more bin buffer, but limit buffer
 * size for high resolution
 */
#define NUM_SLIST_BUF_H264
#define SIZE_SLIST_BUF_H264
#define LCU_MAX_SIZE_PELS
#define LCU_MIN_SIZE_PELS
#define SIZE_SEI_USERDATA

#define H265D_MAX_SLICE
#define SIZE_H265D_HW_PIC_T
#define SIZE_H265D_BSE_CMD_PER_BUF
#define SIZE_H265D_VPP_CMD_PER_BUF

#define SIZE_H265D_LB_FE_TOP_DATA(width, height)

#define SIZE_H265D_LB_FE_TOP_CTRL(width, height)

#define SIZE_H265D_LB_FE_LEFT_CTRL(width, height)

#define SIZE_H265D_LB_SE_TOP_CTRL(width, height)

static inline u32 size_h265d_lb_se_left_ctrl(u32 width, u32 height)
{}

#define SIZE_H265D_LB_PE_TOP_DATA(width, height)

#define SIZE_H265D_LB_VSP_TOP(width, height)

#define SIZE_H265D_LB_VSP_LEFT(width, height)

#define SIZE_H265D_LB_RECON_DMA_METADATA_WR(width, height)

#define SIZE_H265D_QP(width, height)

#define H265_CABAC_HDR_RATIO_HD_TOT
#define H265_CABAC_RES_RATIO_HD_TOT

/*
 * Some content need more bin buffer, but limit buffer size
 * for high resolution
 */
#define SIZE_SLIST_BUF_H265
#define NUM_SLIST_BUF_H265
#define H265_NUM_TILE_COL
#define H265_NUM_TILE_ROW
#define H265_NUM_TILE

static inline u32 size_vpxd_lb_fe_left_ctrl(u32 width, u32 height)
{}

#define SIZE_VPXD_LB_FE_TOP_CTRL(width, height)
#define SIZE_VPXD_LB_SE_TOP_CTRL(width, height)

static inline u32 size_vpxd_lb_se_left_ctrl(u32 width, u32 height)
{}

#define SIZE_VPXD_LB_RECON_DMA_METADATA_WR(width, height)
#define SIZE_VP8D_LB_FE_TOP_DATA(width, height)
#define SIZE_VP9D_LB_FE_TOP_DATA(width, height)
#define SIZE_VP8D_LB_PE_TOP_DATA(width, height)
#define SIZE_VP9D_LB_PE_TOP_DATA(width, height)
#define SIZE_VP8D_LB_VSP_TOP(width, height)
#define SIZE_VP9D_LB_VSP_TOP(width, height)

#define HFI_IRIS2_VP9D_COMV_SIZE

#define VPX_DECODER_FRAME_CONCURENCY_LVL
#define VPX_DECODER_FRAME_BIN_HDR_BUDGET_RATIO_NUM
#define VPX_DECODER_FRAME_BIN_HDR_BUDGET_RATIO_DEN
#define VPX_DECODER_FRAME_BIN_RES_BUDGET_RATIO_NUM
#define VPX_DECODER_FRAME_BIN_RES_BUDGET_RATIO_DEN

#define VP8_NUM_FRAME_INFO_BUF
#define VP9_NUM_FRAME_INFO_BUF
#define VP8_NUM_PROBABILITY_TABLE_BUF
#define VP9_NUM_PROBABILITY_TABLE_BUF
#define VP8_PROB_TABLE_SIZE
#define VP9_PROB_TABLE_SIZE

#define VP9_UDC_HEADER_BUF_SIZE
#define MAX_SUPERFRAME_HEADER_LEN
#define CCE_TILE_OFFSET_SIZE

#define QMATRIX_SIZE
#define MP2D_QPDUMP_SIZE
#define HFI_IRIS2_ENC_PERSIST_SIZE
#define HFI_MAX_COL_FRAME
#define HFI_VENUS_VENC_TRE_WB_BUFF_SIZE
#define HFI_VENUS_VENC_DB_LINE_BUFF_PER_MB
#define HFI_VENUS_VPPSG_MAX_REGISTERS
#define HFI_VENUS_WIDTH_ALIGNMENT
#define HFI_VENUS_WIDTH_TEN_BIT_ALIGNMENT
#define HFI_VENUS_HEIGHT_ALIGNMENT

#define SYSTEM_LAL_TILE10
#define NUM_MBS_720P
#define NUM_MBS_4K
#define MB_SIZE_IN_PIXEL
#define HDR10PLUS_PAYLOAD_SIZE
#define HDR10_HIST_EXTRADATA_SIZE

static u32 size_vpss_lb(u32 width, u32 height, u32 num_vpp_pipes)
{}

static u32 size_h264d_hw_bin_buffer(u32 width, u32 height)
{}

static u32 h264d_scratch_size(u32 width, u32 height, bool is_interlaced)
{}

static u32 size_h265d_hw_bin_buffer(u32 width, u32 height)
{}

static u32 h265d_scratch_size(u32 width, u32 height, bool is_interlaced)
{}

static u32 vpxd_scratch_size(u32 width, u32 height, bool is_interlaced)
{}

static u32 mpeg2d_scratch_size(u32 width, u32 height, bool is_interlaced)
{}

static u32 calculate_enc_output_frame_size(u32 width, u32 height, u32 rc_type)
{}

static u32 calculate_enc_scratch_size(u32 width, u32 height, u32 work_mode,
				      u32 lcu_size, u32 num_vpp_pipes,
				      u32 rc_type)
{}

static u32 h264e_scratch_size(u32 width, u32 height, u32 work_mode,
			      u32 num_vpp_pipes, u32 rc_type)
{}

static u32 h265e_scratch_size(u32 width, u32 height, u32 work_mode,
			      u32 num_vpp_pipes, u32 rc_type)
{}

static u32 vp8e_scratch_size(u32 width, u32 height, u32 work_mode,
			     u32 num_vpp_pipes, u32 rc_type)
{}

static u32 hfi_iris2_h264d_comv_size(u32 width, u32 height,
				     u32 yuv_buf_min_count)
{}

static u32 size_h264d_bse_cmd_buf(u32 height)
{}

static u32 size_h264d_vpp_cmd_buf(u32 height)
{}

static u32 hfi_iris2_h264d_non_comv_size(u32 width, u32 height,
					 u32 num_vpp_pipes)
{}

static u32 size_h265d_bse_cmd_buf(u32 width, u32 height)
{}

static u32 size_h265d_vpp_cmd_buf(u32 width, u32 height)
{}

static u32 hfi_iris2_h265d_comv_size(u32 width, u32 height,
				     u32 yuv_buf_count_min)
{}

static u32 hfi_iris2_h265d_non_comv_size(u32 width, u32 height,
					 u32 num_vpp_pipes)
{}

static u32 hfi_iris2_vp8d_comv_size(u32 width, u32 height,
				    u32 yuv_min_buf_count)
{}

static u32 h264d_scratch1_size(u32 width, u32 height, u32 min_buf_count,
			       bool split_mode_enabled, u32 num_vpp_pipes)
{}

static u32 h265d_scratch1_size(u32 width, u32 height, u32 min_buf_count,
			       bool split_mode_enabled, u32 num_vpp_pipes)
{}

static u32 vp8d_scratch1_size(u32 width, u32 height, u32 min_buf_count,
			      bool split_mode_enabled, u32 num_vpp_pipes)
{}

static u32 vp9d_scratch1_size(u32 width, u32 height, u32 min_buf_count,
			      bool split_mode_enabled, u32 num_vpp_pipes)
{}

static u32 mpeg2d_scratch1_size(u32 width, u32 height, u32 min_buf_count,
				bool split_mode_enabled, u32 num_vpp_pipes)
{}

static u32
calculate_enc_scratch1_size(u32 width, u32 height, u32 lcu_size, u32 num_ref,
			    bool ten_bit, u32 num_vpp_pipes, bool is_h265)
{}

static u32 h264e_scratch1_size(u32 width, u32 height, u32 num_ref, bool ten_bit,
			       u32 num_vpp_pipes)
{}

static u32 h265e_scratch1_size(u32 width, u32 height, u32 num_ref, bool ten_bit,
			       u32 num_vpp_pipes)
{}

static u32 vp8e_scratch1_size(u32 width, u32 height, u32 num_ref, bool ten_bit,
			      u32 num_vpp_pipes)
{}

static u32 ubwc_metadata_plane_stride(u32 width, u32 metadata_stride_multi,
				      u32 tile_width_pels)
{}

static u32 ubwc_metadata_plane_bufheight(u32 height, u32 metadata_height_multi,
					 u32 tile_height_pels)
{}

static u32 ubwc_metadata_plane_buffer_size(u32 metadata_stride,
					   u32 metadata_buf_height)
{}

static u32 enc_scratch2_size(u32 width, u32 height, u32 num_ref, bool ten_bit)
{}

static u32 enc_persist_size(void)
{}

static u32 h264d_persist1_size(void)
{}

static u32 h265d_persist1_size(void)
{}

static u32 vp8d_persist1_size(void)
{}

static u32 vp9d_persist1_size(void)
{}

static u32 mpeg2d_persist1_size(void)
{}

struct dec_bufsize_ops {};

struct enc_bufsize_ops {};

static struct dec_bufsize_ops dec_h264_ops =;

static struct dec_bufsize_ops dec_h265_ops =;

static struct dec_bufsize_ops dec_vp8_ops =;

static struct dec_bufsize_ops dec_vp9_ops =;

static struct dec_bufsize_ops dec_mpeg2_ops =;

static struct enc_bufsize_ops enc_h264_ops =;

static struct enc_bufsize_ops enc_h265_ops =;

static struct enc_bufsize_ops enc_vp8_ops =;

static u32
calculate_dec_input_frame_size(u32 width, u32 height, u32 codec,
			       u32 max_mbs_per_frame, u32 buffer_size_limit)
{}

static int output_buffer_count(u32 session_type, u32 codec)
{}

static int bufreq_dec(struct hfi_plat_buffers_params *params, u32 buftype,
		      struct hfi_buffer_requirements *bufreq)
{}

static int bufreq_enc(struct hfi_plat_buffers_params *params, u32 buftype,
		      struct hfi_buffer_requirements *bufreq)
{}

int hfi_plat_bufreq_v6(struct hfi_plat_buffers_params *params, u32 session_type,
		       u32 buftype, struct hfi_buffer_requirements *bufreq)
{}