#include <linux/idr.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <media/videobuf2-dma-contig.h>
#include <media/v4l2-mem2mem.h>
#include <asm/div64.h>
#include "core.h"
#include "helpers.h"
#include "hfi_helper.h"
#include "pm_helpers.h"
#include "hfi_platform.h"
#include "hfi_parser.h"
#define NUM_MBS_720P …
#define NUM_MBS_4K …
enum dpb_buf_owner { … };
struct intbuf { … };
bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt)
{ … }
EXPORT_SYMBOL_GPL(…);
static void free_dpb_buf(struct venus_inst *inst, struct intbuf *buf)
{ … }
int venus_helper_queue_dpb_bufs(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_free_dpb_bufs(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
static int intbufs_set_buffer(struct venus_inst *inst, u32 type)
{ … }
static int intbufs_unset_buffers(struct venus_inst *inst)
{ … }
static const unsigned int intbuf_types_1xx[] = …;
static const unsigned int intbuf_types_4xx[] = …;
static const unsigned int intbuf_types_6xx[] = …;
int venus_helper_intbufs_alloc(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_intbufs_free(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_intbufs_realloc(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
static void fill_buffer_desc(const struct venus_buffer *buf,
struct hfi_buffer_desc *bd, bool response)
{ … }
static void return_buf_error(struct venus_inst *inst,
struct vb2_v4l2_buffer *vbuf)
{ … }
static void
put_ts_metadata(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf)
{ … }
void venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us,
struct vb2_v4l2_buffer *vbuf)
{ … }
EXPORT_SYMBOL_GPL(…);
static int
session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf)
{ … }
static bool is_dynamic_bufmode(struct venus_inst *inst)
{ … }
int venus_helper_unregister_bufs(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
static int session_register_bufs(struct venus_inst *inst)
{ … }
static u32 to_hfi_raw_fmt(u32 v4l2_fmt)
{ … }
static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,
struct hfi_buffer_requirements *req)
{ … }
int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
struct hfi_buffer_requirements *req)
{ … }
EXPORT_SYMBOL_GPL(…);
struct id_mapping { … };
static const struct id_mapping mpeg4_profiles[] = …;
static const struct id_mapping mpeg4_levels[] = …;
static const struct id_mapping mpeg2_profiles[] = …;
static const struct id_mapping mpeg2_levels[] = …;
static const struct id_mapping h264_profiles[] = …;
static const struct id_mapping h264_levels[] = …;
static const struct id_mapping hevc_profiles[] = …;
static const struct id_mapping hevc_levels[] = …;
static const struct id_mapping vp8_profiles[] = …;
static const struct id_mapping vp9_profiles[] = …;
static const struct id_mapping vp9_levels[] = …;
static u32 find_v4l2_id(u32 hfi_id, const struct id_mapping *array, unsigned int array_sz)
{ … }
static u32 find_hfi_id(u32 v4l2_id, const struct id_mapping *array, unsigned int array_sz)
{ … }
static void
v4l2_id_profile_level(u32 hfi_codec, struct hfi_profile_level *pl, u32 *profile, u32 *level)
{ … }
static void
hfi_id_profile_level(u32 hfi_codec, u32 v4l2_pf, u32 v4l2_lvl, struct hfi_profile_level *pl)
{ … }
int venus_helper_get_profile_level(struct venus_inst *inst, u32 *profile, u32 *level)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_profile_level(struct venus_inst *inst, u32 profile, u32 level)
{ … }
EXPORT_SYMBOL_GPL(…);
static u32 get_framesize_raw_nv12(u32 width, u32 height)
{ … }
static u32 get_framesize_raw_nv12_ubwc(u32 width, u32 height)
{ … }
static u32 get_framesize_raw_p010(u32 width, u32 height)
{ … }
static u32 get_framesize_raw_p010_ubwc(u32 width, u32 height)
{ … }
static u32 get_framesize_raw_yuv420_tp10_ubwc(u32 width, u32 height)
{ … }
u32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height)
{ … }
EXPORT_SYMBOL_GPL(…);
u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_input_resolution(struct venus_inst *inst,
unsigned int width, unsigned int height)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_output_resolution(struct venus_inst *inst,
unsigned int width, unsigned int height,
u32 buftype)
{ … }
EXPORT_SYMBOL_GPL(…);
static u32 venus_helper_get_work_mode(struct venus_inst *inst)
{ … }
int venus_helper_set_work_mode(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_format_constraints(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
unsigned int output_bufs,
unsigned int output2_bufs)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format,
u32 buftype)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_multistream(struct venus_inst *inst, bool out_en,
bool out2_en)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_dyn_bufmode(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int venus_helper_get_opb_size(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
static void delayed_process_buf_func(struct work_struct *work)
{ … }
void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf)
{ … }
EXPORT_SYMBOL_GPL(…);
static int is_buf_refed(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf)
{ … }
struct vb2_v4l2_buffer *
venus_helper_find_buf(struct venus_inst *inst, unsigned int type, u32 idx)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_change_dpb_owner(struct venus_inst *inst,
struct vb2_v4l2_buffer *vbuf, unsigned int type,
unsigned int buf_type, u32 tag)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_vb2_buf_init(struct vb2_buffer *vb)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb)
{ … }
EXPORT_SYMBOL_GPL(…);
static void cache_payload(struct venus_inst *inst, struct vb2_buffer *vb)
{ … }
void venus_helper_vb2_buf_queue(struct vb2_buffer *vb)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_buffers_done(struct venus_inst *inst, unsigned int type,
enum vb2_buffer_state state)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_vb2_stop_streaming(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_vb2_queue_error(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_process_initial_cap_bufs(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_process_initial_out_bufs(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_vb2_start_streaming(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_m2m_device_run(void *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_m2m_job_abort(void *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_session_init(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
void venus_helper_init_instance(struct venus_inst *inst)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool find_fmt_from_caps(struct hfi_plat_caps *caps, u32 buftype, u32 fmt)
{ … }
int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt,
u32 *out_fmt, u32 *out2_fmt, bool ubwc)
{ … }
EXPORT_SYMBOL_GPL(…);
bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt)
{ … }
EXPORT_SYMBOL_GPL(…);
int venus_helper_set_stride(struct venus_inst *inst,
unsigned int width, unsigned int height)
{ … }
EXPORT_SYMBOL_GPL(…);