brintos

brintos / linux-shallow public Read only

0
0
Text · 6.9 KiB · bb16d96 Raw
245 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 * Copyright (c) 2016 MediaTek Inc.4 * Author: Jungchang Tsao <jungchang.tsao@mediatek.com>5 *	   Daniel Hsiao <daniel.hsiao@mediatek.com>6 *	   Tiffany Lin <tiffany.lin@mediatek.com>7 */8 9#ifndef _VENC_IPI_MSG_H_10#define _VENC_IPI_MSG_H_11 12#define AP_IPIMSG_VENC_BASE 0xC00013#define VPU_IPIMSG_VENC_BASE 0xD00014 15/*16 * enum venc_ipi_msg_id - message id between AP and VPU17 * (ipi stands for inter-processor interrupt)18 * @AP_IPIMSG_ENC_XXX:		AP to VPU cmd message id19 * @VPU_IPIMSG_ENC_XXX_DONE:	VPU ack AP cmd message id20 */21enum venc_ipi_msg_id {22	AP_IPIMSG_ENC_INIT = AP_IPIMSG_VENC_BASE,23	AP_IPIMSG_ENC_SET_PARAM,24	AP_IPIMSG_ENC_ENCODE,25	AP_IPIMSG_ENC_DEINIT,26 27	VPU_IPIMSG_ENC_INIT_DONE = VPU_IPIMSG_VENC_BASE,28	VPU_IPIMSG_ENC_SET_PARAM_DONE,29	VPU_IPIMSG_ENC_ENCODE_DONE,30	VPU_IPIMSG_ENC_DEINIT_DONE,31};32 33/**34 * struct venc_ap_ipi_msg_init - AP to VPU init cmd structure35 * @msg_id:	message id (AP_IPIMSG_XXX_ENC_INIT)36 * @reserved:	reserved for future use. vpu is running in 32bit. Without37 *		this reserved field, if kernel run in 64bit. this struct size38 *		will be different between kernel and vpu39 * @venc_inst:	AP encoder instance40 *		(struct venc_vp8_inst/venc_h264_inst *)41 */42struct venc_ap_ipi_msg_init {43	uint32_t msg_id;44	uint32_t reserved;45	uint64_t venc_inst;46};47 48/**49 * struct venc_ap_ipi_msg_set_param - AP to VPU set_param cmd structure50 * @msg_id:	message id (AP_IPIMSG_XXX_ENC_SET_PARAM)51 * @vpu_inst_addr:	VPU encoder instance addr52 *			(struct venc_vp8_vsi/venc_h264_vsi *)53 * @param_id:	parameter id (venc_set_param_type)54 * @data_item:	number of items in the data array55 * @data:	data array to store the set parameters56 */57struct venc_ap_ipi_msg_set_param {58	uint32_t msg_id;59	uint32_t vpu_inst_addr;60	uint32_t param_id;61	uint32_t data_item;62	uint32_t data[8];63};64 65struct venc_ap_ipi_msg_set_param_ext {66	struct venc_ap_ipi_msg_set_param base;67	uint32_t data_ext[24];68};69 70/**71 * struct venc_ap_ipi_msg_enc - AP to VPU enc cmd structure72 * @msg_id:	message id (AP_IPIMSG_XXX_ENC_ENCODE)73 * @vpu_inst_addr:	VPU encoder instance addr74 *			(struct venc_vp8_vsi/venc_h264_vsi *)75 * @bs_mode:	bitstream mode for h26476 *		(H264_BS_MODE_SPS/H264_BS_MODE_PPS/H264_BS_MODE_FRAME)77 * @input_addr:	pointer to input image buffer plane78 * @bs_addr:	pointer to output bit stream buffer79 * @bs_size:	bit stream buffer size80 */81struct venc_ap_ipi_msg_enc {82	uint32_t msg_id;83	uint32_t vpu_inst_addr;84	uint32_t bs_mode;85	uint32_t input_addr[3];86	uint32_t bs_addr;87	uint32_t bs_size;88};89 90/**91 * struct venc_ap_ipi_msg_enc_ext - AP to SCP extended enc cmd structure92 *93 * @base:	base msg structure94 * @data_item:	number of items in the data array95 * @data:	data array to store the set parameters96 */97struct venc_ap_ipi_msg_enc_ext {98	struct venc_ap_ipi_msg_enc base;99	uint32_t data_item;100	uint32_t data[32];101};102 103/**104 * struct venc_ap_ipi_msg_enc_ext_34 - AP to SCP extended enc cmd structure105 * @msg_id:		message id (AP_IPIMSG_XXX_ENC_ENCODE)106 * @vpu_inst_addr:	VPU encoder instance addr107 * @bs_mode:		bitstream mode for h264108 * @reserved:		for struct padding109 * @input_addr:		input frame buffer 34 bit address110 * @bs_addr:		output bitstream buffer 34 bit address111 * @bs_size:		bitstream buffer size112 * @data_item:		number of items in the data array113 * @data:		data array to store the set parameters114 */115struct venc_ap_ipi_msg_enc_ext_34 {116	u32 msg_id;117	u32 vpu_inst_addr;118	u32 bs_mode;119	u32 reserved;120	u64 input_addr[3];121	u64 bs_addr;122	u32 bs_size;123	u32 data_item;124	u32 data[32];125};126 127/**128 * struct venc_ap_ipi_msg_deinit - AP to VPU deinit cmd structure129 * @msg_id:	message id (AP_IPIMSG_XXX_ENC_DEINIT)130 * @vpu_inst_addr:	VPU encoder instance addr131 *			(struct venc_vp8_vsi/venc_h264_vsi *)132 */133struct venc_ap_ipi_msg_deinit {134	uint32_t msg_id;135	uint32_t vpu_inst_addr;136};137 138/*139 * enum venc_ipi_msg_status - VPU ack AP cmd status140 */141enum venc_ipi_msg_status {142	VENC_IPI_MSG_STATUS_OK,143	VENC_IPI_MSG_STATUS_FAIL,144};145 146/**147 * struct venc_vpu_ipi_msg_common - VPU ack AP cmd common structure148 * @msg_id:	message id (VPU_IPIMSG_XXX_DONE)149 * @status:	cmd status (venc_ipi_msg_status)150 * @venc_inst:	AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)151 */152struct venc_vpu_ipi_msg_common {153	uint32_t msg_id;154	uint32_t status;155	uint64_t venc_inst;156};157 158/**159 * struct venc_vpu_ipi_msg_init - VPU ack AP init cmd structure160 * @msg_id:	message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE)161 * @status:	cmd status (venc_ipi_msg_status)162 * @venc_inst:	AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)163 * @vpu_inst_addr:	VPU encoder instance addr164 *			(struct venc_vp8_vsi/venc_h264_vsi *)165 * @venc_abi_version:	ABI version of the firmware. Kernel can use it to166 *			ensure that it is compatible with the firmware.167 *			For MT8173 the value of this field is undefined and168 *			should not be used.169 */170struct venc_vpu_ipi_msg_init {171	uint32_t msg_id;172	uint32_t status;173	uint64_t venc_inst;174	uint32_t vpu_inst_addr;175	uint32_t venc_abi_version;176};177 178/**179 * struct venc_vpu_ipi_msg_set_param - VPU ack AP set_param cmd structure180 * @msg_id:	message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE)181 * @status:	cmd status (venc_ipi_msg_status)182 * @venc_inst:	AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)183 * @param_id:	parameter id (venc_set_param_type)184 * @data_item:	number of items in the data array185 * @data:	data array to store the return result186 */187struct venc_vpu_ipi_msg_set_param {188	uint32_t msg_id;189	uint32_t status;190	uint64_t venc_inst;191	uint32_t param_id;192	uint32_t data_item;193	uint32_t data[6];194};195 196/**197 * enum venc_ipi_msg_enc_state - Type of encode state198 * @VEN_IPI_MSG_ENC_STATE_FRAME:	one frame being encoded199 * @VEN_IPI_MSG_ENC_STATE_PART:		bit stream buffer full200 * @VEN_IPI_MSG_ENC_STATE_SKIP:		encoded skip frame201 * @VEN_IPI_MSG_ENC_STATE_ERROR:	encounter error202 */203enum venc_ipi_msg_enc_state {204	VEN_IPI_MSG_ENC_STATE_FRAME,205	VEN_IPI_MSG_ENC_STATE_PART,206	VEN_IPI_MSG_ENC_STATE_SKIP,207	VEN_IPI_MSG_ENC_STATE_ERROR,208};209 210/**211 * struct venc_vpu_ipi_msg_enc - VPU ack AP enc cmd structure212 * @msg_id:	message id (VPU_IPIMSG_XXX_ENC_ENCODE_DONE)213 * @status:	cmd status (venc_ipi_msg_status)214 * @venc_inst:	AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)215 * @state:	encode state (venc_ipi_msg_enc_state)216 * @is_key_frm:	whether the encoded frame is key frame217 * @bs_size:	encoded bitstream size218 * @reserved:	reserved for future use. vpu is running in 32bit. Without219 *		this reserved field, if kernel run in 64bit. this struct size220 *		will be different between kernel and vpu221 */222struct venc_vpu_ipi_msg_enc {223	uint32_t msg_id;224	uint32_t status;225	uint64_t venc_inst;226	uint32_t state;227	uint32_t is_key_frm;228	uint32_t bs_size;229	uint32_t reserved;230};231 232/**233 * struct venc_vpu_ipi_msg_deinit - VPU ack AP deinit cmd structure234 * @msg_id:   message id (VPU_IPIMSG_XXX_ENC_DEINIT_DONE)235 * @status:   cmd status (venc_ipi_msg_status)236 * @venc_inst:	AP encoder instance (struct venc_vp8_inst/venc_h264_inst *)237 */238struct venc_vpu_ipi_msg_deinit {239	uint32_t msg_id;240	uint32_t status;241	uint64_t venc_inst;242};243 244#endif /* _VENC_IPI_MSG_H_ */245