162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. 462306a36Sopenharmony_ci * Copyright (C) 2017 Linaro Ltd. 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci#ifndef __VENUS_HELPERS_H__ 762306a36Sopenharmony_ci#define __VENUS_HELPERS_H__ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <media/videobuf2-v4l2.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct venus_inst; 1262306a36Sopenharmony_cistruct venus_core; 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cibool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt); 1562306a36Sopenharmony_cistruct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst, 1662306a36Sopenharmony_ci unsigned int type, u32 idx); 1762306a36Sopenharmony_civoid venus_helper_change_dpb_owner(struct venus_inst *inst, 1862306a36Sopenharmony_ci struct vb2_v4l2_buffer *vbuf, unsigned int type, 1962306a36Sopenharmony_ci unsigned int buf_type, u32 idx); 2062306a36Sopenharmony_civoid venus_helper_buffers_done(struct venus_inst *inst, unsigned int type, 2162306a36Sopenharmony_ci enum vb2_buffer_state state); 2262306a36Sopenharmony_ciint venus_helper_vb2_buf_init(struct vb2_buffer *vb); 2362306a36Sopenharmony_ciint venus_helper_vb2_buf_prepare(struct vb2_buffer *vb); 2462306a36Sopenharmony_civoid venus_helper_vb2_buf_queue(struct vb2_buffer *vb); 2562306a36Sopenharmony_civoid venus_helper_vb2_stop_streaming(struct vb2_queue *q); 2662306a36Sopenharmony_ciint venus_helper_vb2_start_streaming(struct venus_inst *inst); 2762306a36Sopenharmony_civoid venus_helper_vb2_queue_error(struct venus_inst *inst); 2862306a36Sopenharmony_civoid venus_helper_m2m_device_run(void *priv); 2962306a36Sopenharmony_civoid venus_helper_m2m_job_abort(void *priv); 3062306a36Sopenharmony_ciint venus_helper_get_bufreq(struct venus_inst *inst, u32 type, 3162306a36Sopenharmony_ci struct hfi_buffer_requirements *req); 3262306a36Sopenharmony_ciu32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height); 3362306a36Sopenharmony_ciu32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height); 3462306a36Sopenharmony_ciint venus_helper_set_input_resolution(struct venus_inst *inst, 3562306a36Sopenharmony_ci unsigned int width, unsigned int height); 3662306a36Sopenharmony_ciint venus_helper_set_output_resolution(struct venus_inst *inst, 3762306a36Sopenharmony_ci unsigned int width, unsigned int height, 3862306a36Sopenharmony_ci u32 buftype); 3962306a36Sopenharmony_ciint venus_helper_set_work_mode(struct venus_inst *inst); 4062306a36Sopenharmony_ciint venus_helper_set_format_constraints(struct venus_inst *inst); 4162306a36Sopenharmony_ciint venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, 4262306a36Sopenharmony_ci unsigned int output_bufs, 4362306a36Sopenharmony_ci unsigned int output2_bufs); 4462306a36Sopenharmony_ciint venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, 4562306a36Sopenharmony_ci u32 buftype); 4662306a36Sopenharmony_ciint venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); 4762306a36Sopenharmony_ciint venus_helper_set_dyn_bufmode(struct venus_inst *inst); 4862306a36Sopenharmony_ciint venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype); 4962306a36Sopenharmony_ciint venus_helper_set_multistream(struct venus_inst *inst, bool out_en, 5062306a36Sopenharmony_ci bool out2_en); 5162306a36Sopenharmony_ciunsigned int venus_helper_get_opb_size(struct venus_inst *inst); 5262306a36Sopenharmony_civoid venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); 5362306a36Sopenharmony_civoid venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); 5462306a36Sopenharmony_civoid venus_helper_init_instance(struct venus_inst *inst); 5562306a36Sopenharmony_ciint venus_helper_session_init(struct venus_inst *inst); 5662306a36Sopenharmony_ciint venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt, 5762306a36Sopenharmony_ci u32 *out2_fmt, bool ubwc); 5862306a36Sopenharmony_cibool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt); 5962306a36Sopenharmony_ciint venus_helper_alloc_dpb_bufs(struct venus_inst *inst); 6062306a36Sopenharmony_ciint venus_helper_free_dpb_bufs(struct venus_inst *inst); 6162306a36Sopenharmony_ciint venus_helper_intbufs_alloc(struct venus_inst *inst); 6262306a36Sopenharmony_ciint venus_helper_intbufs_free(struct venus_inst *inst); 6362306a36Sopenharmony_ciint venus_helper_intbufs_realloc(struct venus_inst *inst); 6462306a36Sopenharmony_ciint venus_helper_queue_dpb_bufs(struct venus_inst *inst); 6562306a36Sopenharmony_ciint venus_helper_unregister_bufs(struct venus_inst *inst); 6662306a36Sopenharmony_ciint venus_helper_process_initial_cap_bufs(struct venus_inst *inst); 6762306a36Sopenharmony_ciint venus_helper_process_initial_out_bufs(struct venus_inst *inst); 6862306a36Sopenharmony_civoid venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us, 6962306a36Sopenharmony_ci struct vb2_v4l2_buffer *vbuf); 7062306a36Sopenharmony_ciint venus_helper_get_profile_level(struct venus_inst *inst, u32 *profile, u32 *level); 7162306a36Sopenharmony_ciint venus_helper_set_profile_level(struct venus_inst *inst, u32 profile, u32 level); 7262306a36Sopenharmony_ciint venus_helper_set_stride(struct venus_inst *inst, unsigned int aligned_width, 7362306a36Sopenharmony_ci unsigned int aligned_height); 7462306a36Sopenharmony_ci#endif 75