#include <linux/init.h>
#include <linux/interconnect.h>
#include <linux/ioctl.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/rational.h>
#include <linux/time64.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-contig.h>
#include <linux/videodev2.h>
#include "vpu.h"
#include "vpu_rpc.h"
#include "vpu_defs.h"
#include "vpu_helpers.h"
#include "vpu_v4l2.h"
#include "vpu_cmds.h"
#include "vpu_imx8q.h"
#include "vpu_malone.h"
#define CMD_SIZE …
#define MSG_SIZE …
#define CODEC_SIZE …
#define JPEG_SIZE …
#define SEQ_SIZE …
#define GOP_SIZE …
#define PIC_SIZE …
#define QMETER_SIZE …
#define DBGLOG_SIZE …
#define DEBUG_SIZE …
#define ENG_SIZE …
#define MALONE_SKIPPED_FRAME_ID …
#define MALONE_ALIGN_MBI …
#define MALONE_DCP_CHUNK_BIT …
#define MALONE_DCP_SIZE_MAX …
#define MALONE_DCP_SIZE_MIN …
#define MALONE_DCP_FIXED_MB_ALLOC …
#define CONFIG_SET(val, cfg, pos, mask) …
#define STREAM_CONFIG_FORMAT_SET(x, y) …
#define STREAM_CONFIG_STRBUFIDX_SET(x, y) …
#define STREAM_CONFIG_NOSEQ_SET(x, y) …
#define STREAM_CONFIG_DEBLOCK_SET(x, y) …
#define STREAM_CONFIG_DERING_SET(x, y) …
#define STREAM_CONFIG_IBWAIT_SET(x, y) …
#define STREAM_CONFIG_FBC_SET(x, y) …
#define STREAM_CONFIG_PLAY_MODE_SET(x, y) …
#define STREAM_CONFIG_ENABLE_DCP_SET(x, y) …
#define STREAM_CONFIG_NUM_STR_BUF_SET(x, y) …
#define STREAM_CONFIG_MALONE_USAGE_SET(x, y) …
#define STREAM_CONFIG_MULTI_VID_SET(x, y) …
#define STREAM_CONFIG_OBFUSC_EN_SET(x, y) …
#define STREAM_CONFIG_RC4_EN_SET(x, y) …
#define STREAM_CONFIG_MCX_SET(x, y) …
#define STREAM_CONFIG_PES_SET(x, y) …
#define STREAM_CONFIG_NUM_DBE_SET(x, y) …
#define STREAM_CONFIG_FS_CTRL_MODE_SET(x, y) …
#define MALONE_DEC_FMT_RV_MASK …
enum vpu_malone_stream_input_mode { … };
enum vpu_malone_format { … };
enum { … };
enum { … };
struct vpu_malone_buffer_desc { … };
struct vpu_malone_str_buffer { … };
struct vpu_malone_picth_info { … };
struct vpu_malone_table_desc { … };
struct vpu_malone_dbglog_desc { … };
struct vpu_malone_udata { … };
struct vpu_malone_buffer_info { … };
struct vpu_malone_encrypt_info { … };
struct malone_iface { … };
struct malone_jpg_params { … };
struct malone_codec_params { … };
struct malone_padding_scode { … };
struct malone_fmt_mapping { … };
struct malone_scode_t { … };
struct malone_scode_handler { … };
struct vpu_dec_ctrl { … };
u32 vpu_malone_get_data_size(void)
{ … }
void vpu_malone_init_rpc(struct vpu_shared_addr *shared,
struct vpu_buffer *rpc, dma_addr_t boot_addr)
{ … }
void vpu_malone_set_log_buf(struct vpu_shared_addr *shared,
struct vpu_buffer *log)
{ … }
static u32 get_str_buffer_offset(u32 instance)
{ … }
void vpu_malone_set_system_cfg(struct vpu_shared_addr *shared,
u32 regs_base, void __iomem *regs, u32 core_id)
{ … }
u32 vpu_malone_get_version(struct vpu_shared_addr *shared)
{ … }
int vpu_malone_get_stream_buffer_size(struct vpu_shared_addr *shared)
{ … }
int vpu_malone_config_stream_buffer(struct vpu_shared_addr *shared,
u32 instance,
struct vpu_buffer *buf)
{ … }
int vpu_malone_get_stream_buffer_desc(struct vpu_shared_addr *shared,
u32 instance,
struct vpu_rpc_buffer_desc *desc)
{ … }
static void vpu_malone_update_wptr(struct vpu_malone_str_buffer __iomem *str_buf, u32 wptr)
{ … }
static void vpu_malone_update_rptr(struct vpu_malone_str_buffer __iomem *str_buf, u32 rptr)
{ … }
int vpu_malone_update_stream_buffer(struct vpu_shared_addr *shared,
u32 instance, u32 ptr, bool write)
{ … }
static struct malone_fmt_mapping fmt_mappings[] = …;
void vpu_malone_enable_format(u32 pixelformat, int enable)
{ … }
static enum vpu_malone_format vpu_malone_format_remap(u32 pixelformat)
{ … }
bool vpu_malone_check_fmt(enum vpu_core_type type, u32 pixelfmt)
{ … }
static void vpu_malone_set_stream_cfg(struct vpu_shared_addr *shared,
u32 instance,
enum vpu_malone_format malone_format)
{ … }
static int vpu_malone_set_params(struct vpu_shared_addr *shared,
u32 instance,
struct vpu_decode_params *params)
{ … }
static bool vpu_malone_is_non_frame_mode(struct vpu_shared_addr *shared, u32 instance)
{ … }
static int vpu_malone_update_params(struct vpu_shared_addr *shared,
u32 instance,
struct vpu_decode_params *params)
{ … }
int vpu_malone_set_decode_params(struct vpu_shared_addr *shared,
u32 instance,
struct vpu_decode_params *params,
u32 update)
{ … }
static struct vpu_pair malone_cmds[] = …;
static struct vpu_pair malone_msgs[] = …;
static void vpu_malone_pack_fs_alloc(struct vpu_rpc_event *pkt,
struct vpu_fs_info *fs)
{ … }
static void vpu_malone_pack_fs_release(struct vpu_rpc_event *pkt,
struct vpu_fs_info *fs)
{ … }
static void vpu_malone_pack_timestamp(struct vpu_rpc_event *pkt,
struct vpu_ts_info *info)
{ … }
int vpu_malone_pack_cmd(struct vpu_rpc_event *pkt, u32 index, u32 id, void *data)
{ … }
int vpu_malone_convert_msg_id(u32 id)
{ … }
static void vpu_malone_fill_planes(struct vpu_dec_codec_info *info)
{ … }
static void vpu_malone_init_seq_hdr(struct vpu_dec_codec_info *info)
{ … }
static void vpu_malone_unpack_seq_hdr(struct vpu_rpc_event *pkt,
struct vpu_dec_codec_info *info)
{ … }
static void vpu_malone_unpack_pic_info(struct vpu_rpc_event *pkt,
struct vpu_dec_pic_info *info)
{ … }
static void vpu_malone_unpack_req_frame(struct vpu_rpc_event *pkt,
struct vpu_fs_info *info)
{ … }
static void vpu_malone_unpack_rel_frame(struct vpu_rpc_event *pkt,
struct vpu_fs_info *info)
{ … }
static void vpu_malone_unpack_buff_rdy(struct vpu_rpc_event *pkt,
struct vpu_dec_pic_info *info)
{ … }
int vpu_malone_unpack_msg_data(struct vpu_rpc_event *pkt, void *data)
{ … }
static const struct malone_padding_scode padding_scodes[] = …;
static const struct malone_padding_scode padding_scode_dft = …;
static const struct malone_padding_scode *get_padding_scode(u32 type, u32 fmt)
{ … }
static int vpu_malone_add_padding_scode(struct vpu_buffer *stream_buffer,
struct vpu_malone_str_buffer __iomem *str_buf,
u32 pixelformat, u32 scode_type)
{ … }
int vpu_malone_add_scode(struct vpu_shared_addr *shared,
u32 instance,
struct vpu_buffer *stream_buffer,
u32 pixelformat,
u32 scode_type)
{ … }
#define MALONE_PAYLOAD_HEADER_SIZE …
#define MALONE_CODEC_VERSION_ID …
#define MALONE_CODEC_ID_VC1_SIMPLE …
#define MALONE_CODEC_ID_VC1_MAIN …
#define MALONE_CODEC_ID_ARV8 …
#define MALONE_CODEC_ID_ARV9 …
#define MALONE_CODEC_ID_VP6 …
#define MALONE_CODEC_ID_VP8 …
#define MALONE_CODEC_ID_DIVX3 …
#define MALONE_CODEC_ID_SPK …
#define MALONE_VP8_IVF_SEQ_HEADER_LEN …
#define MALONE_VP8_IVF_FRAME_HEADER_LEN …
#define MALONE_VC1_RCV_CODEC_V1_VERSION …
#define MALONE_VC1_RCV_CODEC_V2_VERSION …
#define MALONE_VC1_RCV_NUM_FRAMES …
#define MALONE_VC1_RCV_SEQ_EXT_DATA_SIZE …
#define MALONE_VC1_RCV_SEQ_HEADER_LEN …
#define MALONE_VC1_RCV_PIC_HEADER_LEN …
#define MALONE_VC1_NAL_HEADER_LEN …
#define MALONE_VC1_CONTAIN_NAL(data) …
static void set_payload_hdr(u8 *dst, u32 scd_type, u32 codec_id,
u32 buffer_size, u32 width, u32 height)
{ … }
static void set_vp8_ivf_seqhdr(u8 *dst, u32 width, u32 height)
{ … }
static void set_vp8_ivf_pichdr(u8 *dst, u32 frame_size)
{ … }
static void set_vc1_rcv_seqhdr(u8 *dst, u8 *src, u32 width, u32 height)
{ … }
static void set_vc1_rcv_pichdr(u8 *dst, u32 buffer_size)
{ … }
static void create_vc1_nal_pichdr(u8 *dst)
{ … }
static int vpu_malone_insert_scode_seq(struct malone_scode_t *scode, u32 codec_id, u32 ext_size)
{ … }
static int vpu_malone_insert_scode_pic(struct malone_scode_t *scode, u32 codec_id, u32 ext_size)
{ … }
static int vpu_malone_insert_scode_vc1_g_seq(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_vc1_g_pic(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_vc1_l_seq(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_vc1_l_pic(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_vp8_seq(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_vp8_pic(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_spk_seq(struct malone_scode_t *scode)
{ … }
static int vpu_malone_insert_scode_spk_pic(struct malone_scode_t *scode)
{ … }
static const struct malone_scode_handler scode_handlers[] = …;
static const struct malone_scode_handler *get_scode_handler(u32 pixelformat)
{ … }
static int vpu_malone_insert_scode(struct malone_scode_t *scode, u32 type)
{ … }
static int vpu_malone_input_frame_data(struct vpu_malone_str_buffer __iomem *str_buf,
struct vpu_inst *inst, struct vb2_buffer *vb,
u32 disp_imm)
{ … }
static int vpu_malone_input_stream_data(struct vpu_malone_str_buffer __iomem *str_buf,
struct vpu_inst *inst, struct vb2_buffer *vb)
{ … }
static int vpu_malone_input_ts(struct vpu_inst *inst, s64 timestamp, u32 size)
{ … }
int vpu_malone_input_frame(struct vpu_shared_addr *shared,
struct vpu_inst *inst, struct vb2_buffer *vb)
{ … }
static bool vpu_malone_check_ready(struct vpu_shared_addr *shared, u32 instance)
{ … }
bool vpu_malone_is_ready(struct vpu_shared_addr *shared, u32 instance)
{ … }
int vpu_malone_pre_cmd(struct vpu_shared_addr *shared, u32 instance)
{ … }
int vpu_malone_post_cmd(struct vpu_shared_addr *shared, u32 instance)
{ … }
int vpu_malone_init_instance(struct vpu_shared_addr *shared, u32 instance)
{ … }
u32 vpu_malone_get_max_instance_count(struct vpu_shared_addr *shared)
{ … }