18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. 48c2ecf20Sopenharmony_ci * Copyright (C) 2017 Linaro Ltd. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef __VENUS_HELPERS_H__ 78c2ecf20Sopenharmony_ci#define __VENUS_HELPERS_H__ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <media/videobuf2-v4l2.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct venus_inst; 128c2ecf20Sopenharmony_cistruct venus_core; 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cibool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt); 158c2ecf20Sopenharmony_cistruct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst, 168c2ecf20Sopenharmony_ci unsigned int type, u32 idx); 178c2ecf20Sopenharmony_civoid venus_helper_buffers_done(struct venus_inst *inst, unsigned int type, 188c2ecf20Sopenharmony_ci enum vb2_buffer_state state); 198c2ecf20Sopenharmony_ciint venus_helper_vb2_buf_init(struct vb2_buffer *vb); 208c2ecf20Sopenharmony_ciint venus_helper_vb2_buf_prepare(struct vb2_buffer *vb); 218c2ecf20Sopenharmony_civoid venus_helper_vb2_buf_queue(struct vb2_buffer *vb); 228c2ecf20Sopenharmony_civoid venus_helper_vb2_stop_streaming(struct vb2_queue *q); 238c2ecf20Sopenharmony_ciint venus_helper_vb2_start_streaming(struct venus_inst *inst); 248c2ecf20Sopenharmony_civoid venus_helper_m2m_device_run(void *priv); 258c2ecf20Sopenharmony_civoid venus_helper_m2m_job_abort(void *priv); 268c2ecf20Sopenharmony_ciint venus_helper_get_bufreq(struct venus_inst *inst, u32 type, 278c2ecf20Sopenharmony_ci struct hfi_buffer_requirements *req); 288c2ecf20Sopenharmony_ciu32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height); 298c2ecf20Sopenharmony_ciu32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height); 308c2ecf20Sopenharmony_ciint venus_helper_set_input_resolution(struct venus_inst *inst, 318c2ecf20Sopenharmony_ci unsigned int width, unsigned int height); 328c2ecf20Sopenharmony_ciint venus_helper_set_output_resolution(struct venus_inst *inst, 338c2ecf20Sopenharmony_ci unsigned int width, unsigned int height, 348c2ecf20Sopenharmony_ci u32 buftype); 358c2ecf20Sopenharmony_ciint venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); 368c2ecf20Sopenharmony_ciint venus_helper_init_codec_freq_data(struct venus_inst *inst); 378c2ecf20Sopenharmony_ciint venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, 388c2ecf20Sopenharmony_ci unsigned int output_bufs, 398c2ecf20Sopenharmony_ci unsigned int output2_bufs); 408c2ecf20Sopenharmony_ciint venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, 418c2ecf20Sopenharmony_ci u32 buftype); 428c2ecf20Sopenharmony_ciint venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); 438c2ecf20Sopenharmony_ciint venus_helper_set_dyn_bufmode(struct venus_inst *inst); 448c2ecf20Sopenharmony_ciint venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype); 458c2ecf20Sopenharmony_ciint venus_helper_set_multistream(struct venus_inst *inst, bool out_en, 468c2ecf20Sopenharmony_ci bool out2_en); 478c2ecf20Sopenharmony_ciunsigned int venus_helper_get_opb_size(struct venus_inst *inst); 488c2ecf20Sopenharmony_civoid venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); 498c2ecf20Sopenharmony_civoid venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); 508c2ecf20Sopenharmony_civoid venus_helper_init_instance(struct venus_inst *inst); 518c2ecf20Sopenharmony_ciint venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt, 528c2ecf20Sopenharmony_ci u32 *out2_fmt, bool ubwc); 538c2ecf20Sopenharmony_ciint venus_helper_alloc_dpb_bufs(struct venus_inst *inst); 548c2ecf20Sopenharmony_ciint venus_helper_free_dpb_bufs(struct venus_inst *inst); 558c2ecf20Sopenharmony_ciint venus_helper_intbufs_alloc(struct venus_inst *inst); 568c2ecf20Sopenharmony_ciint venus_helper_intbufs_free(struct venus_inst *inst); 578c2ecf20Sopenharmony_ciint venus_helper_intbufs_realloc(struct venus_inst *inst); 588c2ecf20Sopenharmony_ciint venus_helper_queue_dpb_bufs(struct venus_inst *inst); 598c2ecf20Sopenharmony_ciint venus_helper_unregister_bufs(struct venus_inst *inst); 608c2ecf20Sopenharmony_ciint venus_helper_process_initial_cap_bufs(struct venus_inst *inst); 618c2ecf20Sopenharmony_ciint venus_helper_process_initial_out_bufs(struct venus_inst *inst); 628c2ecf20Sopenharmony_civoid venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us, 638c2ecf20Sopenharmony_ci struct vb2_v4l2_buffer *vbuf); 648c2ecf20Sopenharmony_ciint venus_helper_get_profile_level(struct venus_inst *inst, u32 *profile, u32 *level); 658c2ecf20Sopenharmony_ciint venus_helper_set_profile_level(struct venus_inst *inst, u32 profile, u32 level); 668c2ecf20Sopenharmony_ci#endif 67