/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2016 MediaTek Inc. * Author: Jungchang Tsao <[email protected]> * Daniel Hsiao <[email protected]> * Tiffany Lin <[email protected]> */ #ifndef _VENC_IPI_MSG_H_ #define _VENC_IPI_MSG_H_ #define AP_IPIMSG_VENC_BASE … #define VPU_IPIMSG_VENC_BASE … /* * enum venc_ipi_msg_id - message id between AP and VPU * (ipi stands for inter-processor interrupt) * @AP_IPIMSG_ENC_XXX: AP to VPU cmd message id * @VPU_IPIMSG_ENC_XXX_DONE: VPU ack AP cmd message id */ enum venc_ipi_msg_id { … }; /** * struct venc_ap_ipi_msg_init - AP to VPU init cmd structure * @msg_id: message id (AP_IPIMSG_XXX_ENC_INIT) * @reserved: reserved for future use. vpu is running in 32bit. Without * this reserved field, if kernel run in 64bit. this struct size * will be different between kernel and vpu * @venc_inst: AP encoder instance * (struct venc_vp8_inst/venc_h264_inst *) */ struct venc_ap_ipi_msg_init { … }; /** * struct venc_ap_ipi_msg_set_param - AP to VPU set_param cmd structure * @msg_id: message id (AP_IPIMSG_XXX_ENC_SET_PARAM) * @vpu_inst_addr: VPU encoder instance addr * (struct venc_vp8_vsi/venc_h264_vsi *) * @param_id: parameter id (venc_set_param_type) * @data_item: number of items in the data array * @data: data array to store the set parameters */ struct venc_ap_ipi_msg_set_param { … }; struct venc_ap_ipi_msg_set_param_ext { … }; /** * struct venc_ap_ipi_msg_enc - AP to VPU enc cmd structure * @msg_id: message id (AP_IPIMSG_XXX_ENC_ENCODE) * @vpu_inst_addr: VPU encoder instance addr * (struct venc_vp8_vsi/venc_h264_vsi *) * @bs_mode: bitstream mode for h264 * (H264_BS_MODE_SPS/H264_BS_MODE_PPS/H264_BS_MODE_FRAME) * @input_addr: pointer to input image buffer plane * @bs_addr: pointer to output bit stream buffer * @bs_size: bit stream buffer size */ struct venc_ap_ipi_msg_enc { … }; /** * struct venc_ap_ipi_msg_enc_ext - AP to SCP extended enc cmd structure * * @base: base msg structure * @data_item: number of items in the data array * @data: data array to store the set parameters */ struct venc_ap_ipi_msg_enc_ext { … }; /** * struct venc_ap_ipi_msg_enc_ext_34 - AP to SCP extended enc cmd structure * @msg_id: message id (AP_IPIMSG_XXX_ENC_ENCODE) * @vpu_inst_addr: VPU encoder instance addr * @bs_mode: bitstream mode for h264 * @reserved: for struct padding * @input_addr: input frame buffer 34 bit address * @bs_addr: output bitstream buffer 34 bit address * @bs_size: bitstream buffer size * @data_item: number of items in the data array * @data: data array to store the set parameters */ struct venc_ap_ipi_msg_enc_ext_34 { … }; /** * struct venc_ap_ipi_msg_deinit - AP to VPU deinit cmd structure * @msg_id: message id (AP_IPIMSG_XXX_ENC_DEINIT) * @vpu_inst_addr: VPU encoder instance addr * (struct venc_vp8_vsi/venc_h264_vsi *) */ struct venc_ap_ipi_msg_deinit { … }; /* * enum venc_ipi_msg_status - VPU ack AP cmd status */ enum venc_ipi_msg_status { … }; /** * struct venc_vpu_ipi_msg_common - VPU ack AP cmd common structure * @msg_id: message id (VPU_IPIMSG_XXX_DONE) * @status: cmd status (venc_ipi_msg_status) * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *) */ struct venc_vpu_ipi_msg_common { … }; /** * struct venc_vpu_ipi_msg_init - VPU ack AP init cmd structure * @msg_id: message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE) * @status: cmd status (venc_ipi_msg_status) * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *) * @vpu_inst_addr: VPU encoder instance addr * (struct venc_vp8_vsi/venc_h264_vsi *) * @venc_abi_version: ABI version of the firmware. Kernel can use it to * ensure that it is compatible with the firmware. * For MT8173 the value of this field is undefined and * should not be used. */ struct venc_vpu_ipi_msg_init { … }; /** * struct venc_vpu_ipi_msg_set_param - VPU ack AP set_param cmd structure * @msg_id: message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE) * @status: cmd status (venc_ipi_msg_status) * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *) * @param_id: parameter id (venc_set_param_type) * @data_item: number of items in the data array * @data: data array to store the return result */ struct venc_vpu_ipi_msg_set_param { … }; /** * enum venc_ipi_msg_enc_state - Type of encode state * @VEN_IPI_MSG_ENC_STATE_FRAME: one frame being encoded * @VEN_IPI_MSG_ENC_STATE_PART: bit stream buffer full * @VEN_IPI_MSG_ENC_STATE_SKIP: encoded skip frame * @VEN_IPI_MSG_ENC_STATE_ERROR: encounter error */ enum venc_ipi_msg_enc_state { … }; /** * struct venc_vpu_ipi_msg_enc - VPU ack AP enc cmd structure * @msg_id: message id (VPU_IPIMSG_XXX_ENC_ENCODE_DONE) * @status: cmd status (venc_ipi_msg_status) * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *) * @state: encode state (venc_ipi_msg_enc_state) * @is_key_frm: whether the encoded frame is key frame * @bs_size: encoded bitstream size * @reserved: reserved for future use. vpu is running in 32bit. Without * this reserved field, if kernel run in 64bit. this struct size * will be different between kernel and vpu */ struct venc_vpu_ipi_msg_enc { … }; /** * struct venc_vpu_ipi_msg_deinit - VPU ack AP deinit cmd structure * @msg_id: message id (VPU_IPIMSG_XXX_ENC_DEINIT_DONE) * @status: cmd status (venc_ipi_msg_status) * @venc_inst: AP encoder instance (struct venc_vp8_inst/venc_h264_inst *) */ struct venc_vpu_ipi_msg_deinit { … }; #endif /* _VENC_IPI_MSG_H_ */