1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _MSM_VENC_H_ 13 #define _MSM_VENC_H_ 14 15 #include <linux/types.h> 16 17 #define VENC_MAX_RECON_BUFFERS 2 18 19 #define VENC_FLAG_EOS 0x00000001 20 #define VENC_FLAG_END_OF_FRAME 0x00000010 21 #define VENC_FLAG_SYNC_FRAME 0x00000020 22 #define VENC_FLAG_EXTRA_DATA 0x00000040 23 #define VENC_FLAG_CODEC_CONFIG 0x00000080 24 25 enum venc_flush_type { 26 VENC_FLUSH_INPUT, 27 VENC_FLUSH_OUTPUT, 28 VENC_FLUSH_ALL 29 }; 30 31 enum venc_state_type { 32 VENC_STATE_PAUSE = 0x1, 33 VENC_STATE_START = 0x2, 34 VENC_STATE_STOP = 0x4 35 }; 36 37 enum venc_event_type_enum { 38 VENC_EVENT_START_STATUS, 39 VENC_EVENT_STOP_STATUS, 40 VENC_EVENT_SUSPEND_STATUS, 41 VENC_EVENT_RESUME_STATUS, 42 VENC_EVENT_FLUSH_STATUS, 43 VENC_EVENT_RELEASE_INPUT, 44 VENC_EVENT_DELIVER_OUTPUT, 45 VENC_EVENT_UNKNOWN_STATUS 46 }; 47 48 enum venc_status_code { 49 VENC_STATUS_SUCCESS, 50 VENC_STATUS_ERROR, 51 VENC_STATUS_INVALID_STATE, 52 VENC_STATUS_FLUSHING, 53 VENC_STATUS_INVALID_PARAM, 54 VENC_STATUS_CMD_QUEUE_FULL, 55 VENC_STATUS_CRITICAL, 56 VENC_STATUS_INSUFFICIENT_RESOURCES, 57 VENC_STATUS_TIMEOUT 58 }; 59 60 enum venc_msg_code { 61 VENC_MSG_INDICATION, 62 VENC_MSG_INPUT_BUFFER_DONE, 63 VENC_MSG_OUTPUT_BUFFER_DONE, 64 VENC_MSG_NEED_OUTPUT_BUFFER, 65 VENC_MSG_FLUSH, 66 VENC_MSG_START, 67 VENC_MSG_STOP, 68 VENC_MSG_PAUSE, 69 VENC_MSG_RESUME, 70 VENC_MSG_STOP_READING_MSG 71 }; 72 73 enum venc_error_code { 74 VENC_S_SUCCESS, 75 VENC_S_EFAIL, 76 VENC_S_EFATAL, 77 VENC_S_EBADPARAM, 78 VENC_S_EINVALSTATE, 79 VENC_S_ENOSWRES, 80 VENC_S_ENOHWRES, 81 VENC_S_EBUFFREQ, 82 VENC_S_EINVALCMD, 83 VENC_S_ETIMEOUT, 84 VENC_S_ENOREATMPT, 85 VENC_S_ENOPREREQ, 86 VENC_S_ECMDQFULL, 87 VENC_S_ENOTSUPP, 88 VENC_S_ENOTIMPL, 89 VENC_S_ENOTPMEM, 90 VENC_S_EFLUSHED, 91 VENC_S_EINSUFBUF, 92 VENC_S_ESAMESTATE, 93 VENC_S_EINVALTRANS 94 }; 95 96 enum venc_mem_region_enum { 97 VENC_PMEM_EBI1, 98 VENC_PMEM_SMI 99 }; 100 101 struct venc_buf_type { 102 unsigned int region; 103 unsigned int phys; 104 unsigned int size; 105 int offset; 106 }; 107 108 struct venc_qp_range { 109 unsigned int min_qp; 110 unsigned int max_qp; 111 }; 112 113 struct venc_frame_rate { 114 unsigned int frame_rate_num; 115 unsigned int frame_rate_den; 116 }; 117 118 struct venc_slice_info { 119 unsigned int slice_mode; 120 unsigned int units_per_slice; 121 }; 122 123 struct venc_extra_data { 124 unsigned int slice_extra_data_flag; 125 unsigned int slice_client_data1; 126 unsigned int slice_client_data2; 127 unsigned int slice_client_data3; 128 unsigned int none_extra_data_flag; 129 unsigned int none_client_data1; 130 unsigned int none_client_data2; 131 unsigned int none_client_data3; 132 }; 133 134 struct venc_common_config { 135 unsigned int standard; 136 unsigned int input_frame_height; 137 unsigned int input_frame_width; 138 unsigned int output_frame_height; 139 unsigned int output_frame_width; 140 unsigned int rotation_angle; 141 unsigned int intra_period; 142 unsigned int rate_control; 143 struct venc_frame_rate frame_rate; 144 unsigned int bitrate; 145 struct venc_qp_range qp_range; 146 unsigned int iframe_qp; 147 unsigned int pframe_qp; 148 struct venc_slice_info slice_config; 149 struct venc_extra_data extra_data; 150 }; 151 152 struct venc_nonio_buf_config { 153 struct venc_buf_type recon_buf1; 154 struct venc_buf_type recon_buf2; 155 struct venc_buf_type wb_buf; 156 struct venc_buf_type cmd_buf; 157 struct venc_buf_type vlc_buf; 158 }; 159 160 struct venc_mpeg4_config { 161 unsigned int profile; 162 unsigned int level; 163 unsigned int time_resolution; 164 unsigned int ac_prediction; 165 unsigned int hec_interval; 166 unsigned int data_partition; 167 unsigned int short_header; 168 unsigned int rvlc_enable; 169 }; 170 171 struct venc_h263_config { 172 unsigned int profile; 173 unsigned int level; 174 }; 175 176 struct venc_h264_config { 177 unsigned int profile; 178 unsigned int level; 179 unsigned int max_nal; 180 unsigned int idr_period; 181 }; 182 183 struct venc_pmem { 184 int src; 185 int fd; 186 unsigned int offset; 187 void *virt; 188 void *phys; 189 unsigned int size; 190 }; 191 192 struct venc_buffer { 193 unsigned char *ptr_buffer; 194 unsigned int size; 195 unsigned int len; 196 unsigned int offset; 197 long long time_stamp; 198 unsigned int flags; 199 unsigned int client_data; 200 201 }; 202 203 struct venc_buffers { 204 struct venc_pmem recon_buf[VENC_MAX_RECON_BUFFERS]; 205 struct venc_pmem wb_buf; 206 struct venc_pmem cmd_buf; 207 struct venc_pmem vlc_buf; 208 }; 209 210 struct venc_buffer_flush { 211 unsigned int flush_mode; 212 }; 213 214 union venc_msg_data { 215 struct venc_buffer buf; 216 struct venc_buffer_flush flush_ret; 217 218 }; 219 220 struct venc_msg { 221 unsigned int status_code; 222 unsigned int msg_code; 223 union venc_msg_data msg_data; 224 unsigned int msg_data_size; 225 }; 226 227 union venc_codec_config { 228 struct venc_mpeg4_config mpeg4_params; 229 struct venc_h263_config h263_params; 230 struct venc_h264_config h264_params; 231 }; 232 233 struct venc_q6_config { 234 struct venc_common_config config_params; 235 union venc_codec_config codec_params; 236 struct venc_nonio_buf_config buf_params; 237 void *callback_event; 238 }; 239 240 struct venc_hdr_config { 241 struct venc_common_config config_params; 242 union venc_codec_config codec_params; 243 }; 244 245 struct venc_init_config { 246 struct venc_q6_config q6_config; 247 struct venc_buffers q6_bufs; 248 }; 249 250 struct venc_seq_config { 251 int size; 252 struct venc_pmem buf; 253 struct venc_q6_config q6_config; 254 }; 255 256 #define VENC_IOCTL_MAGIC 'V' 257 258 #define VENC_IOCTL_CMD_READ_NEXT_MSG _IOWR(VENC_IOCTL_MAGIC, 1, struct venc_msg) 259 260 #define VENC_IOCTL_CMD_STOP_READ_MSG _IO(VENC_IOCTL_MAGIC, 2) 261 262 #define VENC_IOCTL_SET_INPUT_BUFFER _IOW(VENC_IOCTL_MAGIC, 3, struct venc_pmem) 263 264 #define VENC_IOCTL_SET_OUTPUT_BUFFER _IOW(VENC_IOCTL_MAGIC, 4, struct venc_pmem) 265 266 #define VENC_IOCTL_CMD_START _IOW(VENC_IOCTL_MAGIC, 5, struct venc_init_config) 267 268 #define VENC_IOCTL_CMD_ENCODE_FRAME _IOW(VENC_IOCTL_MAGIC, 6, struct venc_buffer) 269 270 #define VENC_IOCTL_CMD_FILL_OUTPUT_BUFFER _IOW(VENC_IOCTL_MAGIC, 7, struct venc_buffer) 271 272 #define VENC_IOCTL_CMD_FLUSH _IOW(VENC_IOCTL_MAGIC, 8, struct venc_buffer_flush) 273 274 #define VENC_IOCTL_CMD_PAUSE _IO(VENC_IOCTL_MAGIC, 9) 275 276 #define VENC_IOCTL_CMD_RESUME _IO(VENC_IOCTL_MAGIC, 10) 277 278 #define VENC_IOCTL_CMD_STOP _IO(VENC_IOCTL_MAGIC, 11) 279 280 #define VENC_IOCTL_SET_INTRA_PERIOD _IOW(VENC_IOCTL_MAGIC, 12, int) 281 282 #define VENC_IOCTL_CMD_REQUEST_IFRAME _IO(VENC_IOCTL_MAGIC, 13) 283 284 #define VENC_IOCTL_GET_SEQUENCE_HDR _IOWR(VENC_IOCTL_MAGIC, 14, struct venc_seq_config) 285 286 #define VENC_IOCTL_SET_INTRA_REFRESH _IOW(VENC_IOCTL_MAGIC, 15, int) 287 288 #define VENC_IOCTL_SET_FRAME_RATE _IOW(VENC_IOCTL_MAGIC, 16, struct venc_frame_rate) 289 290 #define VENC_IOCTL_SET_TARGET_BITRATE _IOW(VENC_IOCTL_MAGIC, 17, int) 291 292 #define VENC_IOCTL_SET_QP_RANGE _IOW(VENC_IOCTL_MAGIC, 18, struct venc_qp_range) 293 294 #endif 295