helpers.h 3.09 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0-only */
2 3 4 5 6 7 8 9 10 11
/*
 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 * Copyright (C) 2017 Linaro Ltd.
 */
#ifndef __VENUS_HELPERS_H__
#define __VENUS_HELPERS_H__

#include <media/videobuf2-v4l2.h>

struct venus_inst;
12
struct venus_core;
13

14
bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt);
15 16 17 18 19 20 21 22 23 24 25 26 27
struct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst,
					      unsigned int type, u32 idx);
void venus_helper_buffers_done(struct venus_inst *inst,
			       enum vb2_buffer_state state);
int venus_helper_vb2_buf_init(struct vb2_buffer *vb);
int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb);
void venus_helper_vb2_buf_queue(struct vb2_buffer *vb);
void venus_helper_vb2_stop_streaming(struct vb2_queue *q);
int venus_helper_vb2_start_streaming(struct venus_inst *inst);
void venus_helper_m2m_device_run(void *priv);
void venus_helper_m2m_job_abort(void *priv);
int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
			    struct hfi_buffer_requirements *req);
28 29
u32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height);
u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height);
30 31 32
int venus_helper_set_input_resolution(struct venus_inst *inst,
				      unsigned int width, unsigned int height);
int venus_helper_set_output_resolution(struct venus_inst *inst,
33 34
				       unsigned int width, unsigned int height,
				       u32 buftype);
35
int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
36
int venus_helper_init_codec_freq_data(struct venus_inst *inst);
37
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
38 39
			      unsigned int output_bufs,
			      unsigned int output2_bufs);
40 41
int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format,
				u32 buftype);
42
int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt);
43
int venus_helper_set_dyn_bufmode(struct venus_inst *inst);
44
int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype);
45 46
int venus_helper_set_multistream(struct venus_inst *inst, bool out_en,
				 bool out2_en);
47
unsigned int venus_helper_get_opb_size(struct venus_inst *inst);
48 49 50
void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf);
void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx);
void venus_helper_init_instance(struct venus_inst *inst);
51 52 53 54
int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
			      u32 *out2_fmt, bool ubwc);
int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
int venus_helper_free_dpb_bufs(struct venus_inst *inst);
55 56
int venus_helper_intbufs_alloc(struct venus_inst *inst);
int venus_helper_intbufs_free(struct venus_inst *inst);
57
int venus_helper_intbufs_realloc(struct venus_inst *inst);
58 59
int venus_helper_queue_dpb_bufs(struct venus_inst *inst);
int venus_helper_unregister_bufs(struct venus_inst *inst);
60 61
int venus_helper_process_initial_cap_bufs(struct venus_inst *inst);
int venus_helper_process_initial_out_bufs(struct venus_inst *inst);
62 63
void venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us,
				  struct vb2_v4l2_buffer *vbuf);
64
#endif