1 #ifndef _MSM_VIDC_ENC_H_
2 #define _MSM_VIDC_ENC_H_
3 
4 #include <linux/types.h>
5 #include <linux/ioctl.h>
6 
7 /** STATUS CODES*/
8 /* Base value for status codes */
9 #define VEN_S_BASE	0x00000000
10 #define VEN_S_SUCCESS	(VEN_S_BASE)/* Success */
11 #define VEN_S_EFAIL	(VEN_S_BASE+1)/* General failure */
12 #define VEN_S_EFATAL	(VEN_S_BASE+2)/* Fatal irrecoverable failure*/
13 #define VEN_S_EBADPARAM	(VEN_S_BASE+3)/* Error passed parameters*/
14 /*Command called in invalid state*/
15 #define VEN_S_EINVALSTATE	(VEN_S_BASE+4)
16 #define VEN_S_ENOSWRES	(VEN_S_BASE+5)/* Insufficient OS resources*/
17 #define VEN_S_ENOHWRES	(VEN_S_BASE+6)/*Insufficient HW resources */
18 #define VEN_S_EBUFFREQ	(VEN_S_BASE+7)/* Buffer requirements were not met*/
19 #define VEN_S_EINVALCMD	(VEN_S_BASE+8)/* Invalid command called */
20 #define VEN_S_ETIMEOUT	(VEN_S_BASE+9)/* Command timeout. */
21 /*Re-attempt was made when multiple invocation not supported for API.*/
22 #define VEN_S_ENOREATMPT	(VEN_S_BASE+10)
23 #define VEN_S_ENOPREREQ	(VEN_S_BASE+11)/*Pre-requirement is not met for API*/
24 #define VEN_S_ECMDQFULL	(VEN_S_BASE+12)/*Command queue is full*/
25 #define VEN_S_ENOTSUPP	(VEN_S_BASE+13)/*Command not supported*/
26 #define VEN_S_ENOTIMPL	(VEN_S_BASE+14)/*Command not implemented.*/
27 #define VEN_S_ENOTPMEM	(VEN_S_BASE+15)/*Buffer is not from PMEM*/
28 #define VEN_S_EFLUSHED	(VEN_S_BASE+16)/*returned buffer was flushed*/
29 #define VEN_S_EINSUFBUF	(VEN_S_BASE+17)/*provided buffer size insufficient*/
30 #define VEN_S_ESAMESTATE	(VEN_S_BASE+18)
31 #define VEN_S_EINVALTRANS	(VEN_S_BASE+19)
32 
33 #define VEN_INTF_VER			 1
34 
35 /*Asynchronous messages from driver*/
36 #define VEN_MSG_INDICATION	0
37 #define VEN_MSG_INPUT_BUFFER_DONE	1
38 #define VEN_MSG_OUTPUT_BUFFER_DONE	2
39 #define VEN_MSG_NEED_OUTPUT_BUFFER	3
40 #define VEN_MSG_FLUSH_INPUT_DONE	4
41 #define VEN_MSG_FLUSH_OUTPUT_DONE	5
42 #define VEN_MSG_START	6
43 #define VEN_MSG_STOP	7
44 #define VEN_MSG_PAUSE	8
45 #define VEN_MSG_RESUME	9
46 #define VEN_MSG_STOP_READING_MSG	10
47 #define VEN_MSG_LTRUSE_FAILED	    11
48 #define VEN_MSG_HW_OVERLOAD	12
49 #define VEN_MSG_MAX_CLIENTS	13
50 
51 
52 /*Buffer flags bits masks*/
53 #define VEN_BUFFLAG_EOS	0x00000001
54 #define VEN_BUFFLAG_ENDOFFRAME	0x00000010
55 #define VEN_BUFFLAG_SYNCFRAME	0x00000020
56 #define VEN_BUFFLAG_EXTRADATA	0x00000040
57 #define VEN_BUFFLAG_CODECCONFIG	0x00000080
58 
59 /*Post processing flags bit masks*/
60 #define VEN_EXTRADATA_NONE          0x001
61 #define VEN_EXTRADATA_QCOMFILLER    0x002
62 #define VEN_EXTRADATA_SLICEINFO     0x100
63 #define VEN_EXTRADATA_LTRINFO       0x200
64 #define VEN_EXTRADATA_MBINFO        0x400
65 
66 /*ENCODER CONFIGURATION CONSTANTS*/
67 
68 /*Encoded video frame types*/
69 #define VEN_FRAME_TYPE_I	1/* I frame type */
70 #define VEN_FRAME_TYPE_P	2/* P frame type */
71 #define VEN_FRAME_TYPE_B	3/* B frame type */
72 
73 /*Video codec types*/
74 #define VEN_CODEC_MPEG4	1/* MPEG4 Codec */
75 #define VEN_CODEC_H264	2/* H.264 Codec */
76 #define VEN_CODEC_H263	3/* H.263 Codec */
77 
78 /*Video codec profile types.*/
79 #define VEN_PROFILE_MPEG4_SP      1/* 1 - MPEG4 SP profile      */
80 #define VEN_PROFILE_MPEG4_ASP     2/* 2 - MPEG4 ASP profile     */
81 #define VEN_PROFILE_H264_BASELINE 3/* 3 - H264 Baseline profile	*/
82 #define VEN_PROFILE_H264_MAIN     4/* 4 - H264 Main profile     */
83 #define VEN_PROFILE_H264_HIGH     5/* 5 - H264 High profile     */
84 #define VEN_PROFILE_H263_BASELINE 6/* 6 - H263 Baseline profile */
85 
86 /*Video codec profile level types.*/
87 #define VEN_LEVEL_MPEG4_0	 0x1/* MPEG4 Level 0  */
88 #define VEN_LEVEL_MPEG4_1	 0x2/* MPEG4 Level 1  */
89 #define VEN_LEVEL_MPEG4_2	 0x3/* MPEG4 Level 2  */
90 #define VEN_LEVEL_MPEG4_3	 0x4/* MPEG4 Level 3  */
91 #define VEN_LEVEL_MPEG4_4	 0x5/* MPEG4 Level 4  */
92 #define VEN_LEVEL_MPEG4_5	 0x6/* MPEG4 Level 5  */
93 #define VEN_LEVEL_MPEG4_3b	 0x7/* MPEG4 Level 3b */
94 #define VEN_LEVEL_MPEG4_6	 0x8/* MPEG4 Level 6  */
95 
96 #define VEN_LEVEL_H264_1	 0x9/* H.264 Level 1   */
97 #define VEN_LEVEL_H264_1b        0xA/* H.264 Level 1b  */
98 #define VEN_LEVEL_H264_1p1	 0xB/* H.264 Level 1.1 */
99 #define VEN_LEVEL_H264_1p2	 0xC/* H.264 Level 1.2 */
100 #define VEN_LEVEL_H264_1p3	 0xD/* H.264 Level 1.3 */
101 #define VEN_LEVEL_H264_2	 0xE/* H.264 Level 2   */
102 #define VEN_LEVEL_H264_2p1	 0xF/* H.264 Level 2.1 */
103 #define VEN_LEVEL_H264_2p2	0x10/* H.264 Level 2.2 */
104 #define VEN_LEVEL_H264_3	0x11/* H.264 Level 3   */
105 #define VEN_LEVEL_H264_3p1	0x12/* H.264 Level 3.1 */
106 #define VEN_LEVEL_H264_3p2	0x13/* H.264 Level 3.2 */
107 #define VEN_LEVEL_H264_4	0x14/* H.264 Level 4   */
108 
109 #define VEN_LEVEL_H263_10	0x15/* H.263 Level 10  */
110 #define VEN_LEVEL_H263_20	0x16/* H.263 Level 20  */
111 #define VEN_LEVEL_H263_30	0x17/* H.263 Level 30  */
112 #define VEN_LEVEL_H263_40	0x18/* H.263 Level 40  */
113 #define VEN_LEVEL_H263_45	0x19/* H.263 Level 45  */
114 #define VEN_LEVEL_H263_50	0x1A/* H.263 Level 50  */
115 #define VEN_LEVEL_H263_60	0x1B/* H.263 Level 60  */
116 #define VEN_LEVEL_H263_70	0x1C/* H.263 Level 70  */
117 
118 /*Entropy coding model selection for H.264 encoder.*/
119 #define VEN_ENTROPY_MODEL_CAVLC	1
120 #define VEN_ENTROPY_MODEL_CABAC	2
121 /*Cabac model number (0,1,2) for encoder.*/
122 #define VEN_CABAC_MODEL_0	1/* CABAC Model 0. */
123 #define VEN_CABAC_MODEL_1	2/* CABAC Model 1. */
124 #define VEN_CABAC_MODEL_2	3/* CABAC Model 2. */
125 
126 /*Deblocking filter control type for encoder.*/
127 #define VEN_DB_DISABLE	1/* 1 - Disable deblocking filter*/
128 #define VEN_DB_ALL_BLKG_BNDRY	2/* 2 - All blocking boundary filtering*/
129 #define VEN_DB_SKIP_SLICE_BNDRY	3/* 3 - Filtering except sliceboundary*/
130 
131 /*Different methods of Multi slice selection.*/
132 #define VEN_MSLICE_OFF	1
133 #define VEN_MSLICE_CNT_MB	2 /*number of MBscount per slice*/
134 #define VEN_MSLICE_CNT_BYTE	3 /*number of bytes count per slice.*/
135 #define VEN_MSLICE_GOB	4 /*Multi slice by GOB for H.263 only.*/
136 
137 /*Different modes for Rate Control.*/
138 #define VEN_RC_OFF	1
139 #define VEN_RC_VBR_VFR	2
140 #define VEN_RC_VBR_CFR	3
141 #define VEN_RC_CBR_VFR	4
142 #define VEN_RC_CBR_CFR	5
143 
144 /*Different modes for flushing buffers*/
145 #define VEN_FLUSH_INPUT	1
146 #define VEN_FLUSH_OUTPUT	2
147 #define VEN_FLUSH_ALL	3
148 
149 /*Different input formats for YUV data.*/
150 #define VEN_INPUTFMT_NV12	1/* NV12 Linear */
151 #define VEN_INPUTFMT_NV21	2/* NV21 Linear */
152 #define VEN_INPUTFMT_NV12_16M2KA	3/* NV12 Linear */
153 
154 /*Different allowed rotation modes.*/
155 #define VEN_ROTATION_0	1/* 0 degrees */
156 #define VEN_ROTATION_90	2/* 90 degrees */
157 #define VEN_ROTATION_180	3/* 180 degrees */
158 #define VEN_ROTATION_270	4/* 270 degrees */
159 
160 /*IOCTL timeout values*/
161 #define VEN_TIMEOUT_INFINITE	0xffffffff
162 
163 /*Different allowed intra refresh modes.*/
164 #define VEN_IR_OFF	1
165 #define VEN_IR_CYCLIC	2
166 #define VEN_IR_RANDOM	3
167 
168 /*IOCTL BASE CODES Not to be used directly by the client.*/
169 /* Base value for ioctls that are not related to encoder configuration.*/
170 #define VEN_IOCTLBASE_NENC	0x800
171 /* Base value for encoder configuration ioctls*/
172 #define VEN_IOCTLBASE_ENC	0x850
173 
174 struct venc_ioctl_msg {
175 	void *in;
176 	void *out;
177 };
178 
179 /*NON ENCODER CONFIGURATION IOCTLs*/
180 
181 /*IOCTL params:SET: InputData - unsigned long, OutputData - NULL*/
182 #define VEN_IOCTL_SET_INTF_VERSION \
183 	_IOW(VEN_IOCTLBASE_NENC, 0, struct venc_ioctl_msg)
184 
185 /*IOCTL params:CMD: InputData - venc_timeout, OutputData - venc_msg*/
186 #define VEN_IOCTL_CMD_READ_NEXT_MSG \
187 	_IOWR(VEN_IOCTLBASE_NENC, 1, struct venc_ioctl_msg)
188 
189 /*IOCTL params:CMD: InputData - NULL, OutputData - NULL*/
190 #define VEN_IOCTL_CMD_STOP_READ_MSG	_IO(VEN_IOCTLBASE_NENC, 2)
191 
192 /*
193  * IOCTL params:SET: InputData - venc_allocatorproperty, OutputData - NULL
194  * GET: InputData - NULL, OutputData - venc_allocatorproperty
195  */
196 #define VEN_IOCTL_SET_INPUT_BUFFER_REQ \
197 	_IOW(VEN_IOCTLBASE_NENC, 3, struct venc_ioctl_msg)
198 #define VEN_IOCTL_GET_INPUT_BUFFER_REQ \
199 	_IOR(VEN_IOCTLBASE_NENC, 4, struct venc_ioctl_msg)
200 
201 /*IOCTL params:CMD: InputData - venc_bufferpayload, OutputData - NULL*/
202 #define VEN_IOCTL_CMD_ALLOC_INPUT_BUFFER \
203 	_IOW(VEN_IOCTLBASE_NENC, 5, struct venc_ioctl_msg)
204 
205 /*IOCTL params:CMD: InputData - venc_bufferpayload, OutputData - NULL*/
206 #define VEN_IOCTL_SET_INPUT_BUFFER \
207 	_IOW(VEN_IOCTLBASE_NENC, 6, struct venc_ioctl_msg)
208 
209 /*IOCTL params: CMD: InputData - venc_bufferpayload, OutputData - NULL*/
210 #define VEN_IOCTL_CMD_FREE_INPUT_BUFFER \
211 	_IOW(VEN_IOCTLBASE_NENC, 7, struct venc_ioctl_msg)
212 
213 /*
214  * IOCTL params:SET: InputData - venc_allocatorproperty, OutputData - NULL
215  * GET: InputData - NULL, OutputData - venc_allocatorproperty
216  */
217 #define VEN_IOCTL_SET_OUTPUT_BUFFER_REQ \
218 	_IOW(VEN_IOCTLBASE_NENC, 8, struct venc_ioctl_msg)
219 #define VEN_IOCTL_GET_OUTPUT_BUFFER_REQ \
220 	_IOR(VEN_IOCTLBASE_NENC, 9, struct venc_ioctl_msg)
221 
222 /*IOCTL params:CMD: InputData - venc_bufferpayload, OutputData - NULL*/
223 #define VEN_IOCTL_CMD_ALLOC_OUTPUT_BUFFER \
224 	_IOW(VEN_IOCTLBASE_NENC, 10, struct venc_ioctl_msg)
225 
226 
227 /*IOCTL params:CMD: InputData - venc_bufferpayload, OutputData - NULL*/
228 #define VEN_IOCTL_SET_OUTPUT_BUFFER \
229 	_IOW(VEN_IOCTLBASE_NENC, 11, struct venc_ioctl_msg)
230 
231 /*IOCTL params:CMD: InputData - venc_bufferpayload, OutputData - NULL.*/
232 #define VEN_IOCTL_CMD_FREE_OUTPUT_BUFFER \
233 	_IOW(VEN_IOCTLBASE_NENC, 12, struct venc_ioctl_msg)
234 
235 
236 /* Asynchronous respone message code:* VEN_MSG_START*/
237 #define VEN_IOCTL_CMD_START	_IO(VEN_IOCTLBASE_NENC, 13)
238 
239 
240 /*
241  * IOCTL params:CMD: InputData - venc_buffer, OutputData - NULL
242  * Asynchronous respone message code:VEN_MSG_INPUT_BUFFER_DONE
243  */
244 #define VEN_IOCTL_CMD_ENCODE_FRAME \
245 	_IOW(VEN_IOCTLBASE_NENC, 14, struct venc_ioctl_msg)
246 
247 
248 /*
249  *IOCTL params:CMD: InputData - venc_buffer, OutputData - NULL
250  *Asynchronous response message code:VEN_MSG_OUTPUT_BUFFER_DONE
251  */
252 #define VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER \
253 	_IOW(VEN_IOCTLBASE_NENC, 15, struct venc_ioctl_msg)
254 
255 /*
256  * IOCTL params:CMD: InputData - venc_bufferflush, OutputData - NULL
257  * Asynchronous response message code:VEN_MSG_INPUT_BUFFER_DONE
258  */
259 #define VEN_IOCTL_CMD_FLUSH \
260 	_IOW(VEN_IOCTLBASE_NENC, 16, struct venc_ioctl_msg)
261 
262 
263 /*Asynchronous respone message code:VEN_MSG_PAUSE*/
264 #define VEN_IOCTL_CMD_PAUSE	_IO(VEN_IOCTLBASE_NENC, 17)
265 
266 /*Asynchronous respone message code:VEN_MSG_RESUME*/
267 #define VEN_IOCTL_CMD_RESUME _IO(VEN_IOCTLBASE_NENC, 18)
268 
269 /* Asynchronous respone message code:VEN_MSG_STOP*/
270 #define VEN_IOCTL_CMD_STOP _IO(VEN_IOCTLBASE_NENC, 19)
271 
272 #define VEN_IOCTL_SET_RECON_BUFFER \
273 	_IOW(VEN_IOCTLBASE_NENC, 20, struct venc_ioctl_msg)
274 
275 #define VEN_IOCTL_FREE_RECON_BUFFER \
276 	_IOW(VEN_IOCTLBASE_NENC, 21, struct venc_ioctl_msg)
277 
278 #define VEN_IOCTL_GET_RECON_BUFFER_SIZE \
279 	_IOW(VEN_IOCTLBASE_NENC, 22, struct venc_ioctl_msg)
280 
281 
282 
283 /*ENCODER PROPERTY CONFIGURATION & CAPABILITY IOCTLs*/
284 
285 /*
286  * IOCTL params:SET: InputData - venc_basecfg, OutputData - NULL
287  * GET: InputData - NULL, OutputData - venc_basecfg
288  */
289 #define VEN_IOCTL_SET_BASE_CFG \
290 	_IOW(VEN_IOCTLBASE_ENC, 1, struct venc_ioctl_msg)
291 #define VEN_IOCTL_GET_BASE_CFG \
292 	_IOR(VEN_IOCTLBASE_ENC, 2, struct venc_ioctl_msg)
293 
294 /*
295  * IOCTL params:SET: InputData - venc_switch, OutputData - NULL
296  * GET: InputData - NULL, OutputData - venc_switch
297  */
298 #define VEN_IOCTL_SET_LIVE_MODE \
299 	_IOW(VEN_IOCTLBASE_ENC, 3, struct venc_ioctl_msg)
300 #define VEN_IOCTL_GET_LIVE_MODE \
301 	_IOR(VEN_IOCTLBASE_ENC, 4, struct venc_ioctl_msg)
302 
303 
304 /*
305  * IOCTL params:SET: InputData - venc_profile, OutputData - NULL
306  * GET: InputData - NULL, OutputData - venc_profile
307  */
308 #define VEN_IOCTL_SET_CODEC_PROFILE \
309 	_IOW(VEN_IOCTLBASE_ENC, 5, struct venc_ioctl_msg)
310 #define VEN_IOCTL_GET_CODEC_PROFILE \
311 	_IOR(VEN_IOCTLBASE_ENC, 6, struct venc_ioctl_msg)
312 
313 
314 /*
315  * IOCTL params:SET: InputData - ven_profilelevel, OutputData - NULL
316  * GET: InputData - NULL, OutputData - ven_profilelevel
317  */
318 #define VEN_IOCTL_SET_PROFILE_LEVEL \
319 	_IOW(VEN_IOCTLBASE_ENC, 7, struct venc_ioctl_msg)
320 
321 #define VEN_IOCTL_GET_PROFILE_LEVEL \
322 	_IOR(VEN_IOCTLBASE_ENC, 8, struct venc_ioctl_msg)
323 
324 /*
325  * IOCTL params:SET: InputData - venc_switch, OutputData - NULL
326  * GET: InputData - NULL, OutputData - venc_switch
327  */
328 #define VEN_IOCTL_SET_SHORT_HDR \
329 	_IOW(VEN_IOCTLBASE_ENC, 9, struct venc_ioctl_msg)
330 #define VEN_IOCTL_GET_SHORT_HDR \
331 	_IOR(VEN_IOCTLBASE_ENC, 10, struct venc_ioctl_msg)
332 
333 
334 /*
335  * IOCTL params: SET: InputData - venc_sessionqp, OutputData - NULL
336  * GET: InputData - NULL, OutputData - venc_sessionqp
337  */
338 #define VEN_IOCTL_SET_SESSION_QP \
339 	_IOW(VEN_IOCTLBASE_ENC, 11, struct venc_ioctl_msg)
340 #define VEN_IOCTL_GET_SESSION_QP \
341 	_IOR(VEN_IOCTLBASE_ENC, 12, struct venc_ioctl_msg)
342 
343 
344 /*
345  * IOCTL params:SET: InputData - venc_intraperiod, OutputData - NULL
346  * GET: InputData - NULL, OutputData - venc_intraperiod
347  */
348 #define VEN_IOCTL_SET_INTRA_PERIOD \
349 	_IOW(VEN_IOCTLBASE_ENC, 13, struct venc_ioctl_msg)
350 #define VEN_IOCTL_GET_INTRA_PERIOD \
351 	_IOR(VEN_IOCTLBASE_ENC, 14, struct venc_ioctl_msg)
352 
353 
354 /* Request an Iframe*/
355 #define VEN_IOCTL_CMD_REQUEST_IFRAME _IO(VEN_IOCTLBASE_ENC, 15)
356 
357 /*IOCTL params:GET: InputData - NULL, OutputData - venc_capability*/
358 #define VEN_IOCTL_GET_CAPABILITY \
359 	_IOR(VEN_IOCTLBASE_ENC, 16, struct venc_ioctl_msg)
360 
361 
362 /*IOCTL params:GET: InputData - NULL, OutputData - venc_seqheader*/
363 #define VEN_IOCTL_GET_SEQUENCE_HDR \
364 	_IOR(VEN_IOCTLBASE_ENC, 17, struct venc_ioctl_msg)
365 
366 /*
367  * IOCTL params:SET: InputData - venc_entropycfg, OutputData - NULL
368  * GET: InputData - NULL, OutputData - venc_entropycfg
369  */
370 #define VEN_IOCTL_SET_ENTROPY_CFG \
371 	_IOW(VEN_IOCTLBASE_ENC, 18, struct venc_ioctl_msg)
372 #define VEN_IOCTL_GET_ENTROPY_CFG \
373 	_IOR(VEN_IOCTLBASE_ENC, 19, struct venc_ioctl_msg)
374 
375 /*
376  * IOCTL params:SET: InputData - venc_dbcfg, OutputData - NULL
377  * GET: InputData - NULL, OutputData - venc_dbcfg
378  */
379 #define VEN_IOCTL_SET_DEBLOCKING_CFG \
380 	_IOW(VEN_IOCTLBASE_ENC, 20, struct venc_ioctl_msg)
381 #define VEN_IOCTL_GET_DEBLOCKING_CFG \
382 	_IOR(VEN_IOCTLBASE_ENC, 21, struct venc_ioctl_msg)
383 
384 
385 /*
386  * IOCTL params:SET: InputData - venc_intrarefresh, OutputData - NULL
387  * GET: InputData - NULL, OutputData - venc_intrarefresh
388  */
389 #define VEN_IOCTL_SET_INTRA_REFRESH \
390 	_IOW(VEN_IOCTLBASE_ENC, 22, struct venc_ioctl_msg)
391 #define VEN_IOCTL_GET_INTRA_REFRESH \
392 	_IOR(VEN_IOCTLBASE_ENC, 23, struct venc_ioctl_msg)
393 
394 
395 /*
396  * IOCTL params:SET: InputData - venc_multiclicecfg, OutputData - NULL
397  * GET: InputData - NULL, OutputData - venc_multiclicecfg
398  */
399 #define VEN_IOCTL_SET_MULTI_SLICE_CFG \
400 	_IOW(VEN_IOCTLBASE_ENC, 24, struct venc_ioctl_msg)
401 #define VEN_IOCTL_GET_MULTI_SLICE_CFG \
402 	_IOR(VEN_IOCTLBASE_ENC, 25, struct venc_ioctl_msg)
403 
404 /*
405  * IOCTL params:SET: InputData - venc_ratectrlcfg, OutputData - NULL
406  * GET: InputData - NULL, OutputData - venc_ratectrlcfg
407  */
408 #define VEN_IOCTL_SET_RATE_CTRL_CFG \
409 	_IOW(VEN_IOCTLBASE_ENC, 26, struct venc_ioctl_msg)
410 #define VEN_IOCTL_GET_RATE_CTRL_CFG \
411 	_IOR(VEN_IOCTLBASE_ENC, 27, struct venc_ioctl_msg)
412 
413 
414 /*
415  * IOCTL params:SET: InputData - venc_voptimingcfg, OutputData - NULL
416  * GET: InputData - NULL, OutputData - venc_voptimingcfg
417  */
418 #define VEN_IOCTL_SET_VOP_TIMING_CFG \
419 	_IOW(VEN_IOCTLBASE_ENC, 28, struct venc_ioctl_msg)
420 #define VEN_IOCTL_GET_VOP_TIMING_CFG \
421 	_IOR(VEN_IOCTLBASE_ENC, 29, struct venc_ioctl_msg)
422 
423 
424 /*
425  * IOCTL params:SET: InputData - venc_framerate, OutputData - NULL
426  * GET: InputData - NULL, OutputData - venc_framerate
427  */
428 #define VEN_IOCTL_SET_FRAME_RATE \
429 	_IOW(VEN_IOCTLBASE_ENC, 30, struct venc_ioctl_msg)
430 #define VEN_IOCTL_GET_FRAME_RATE \
431 	_IOR(VEN_IOCTLBASE_ENC, 31, struct venc_ioctl_msg)
432 
433 
434 /*
435  * IOCTL params:SET: InputData - venc_targetbitrate, OutputData - NULL
436  * GET: InputData - NULL, OutputData - venc_targetbitrate
437  */
438 #define VEN_IOCTL_SET_TARGET_BITRATE \
439 	_IOW(VEN_IOCTLBASE_ENC, 32, struct venc_ioctl_msg)
440 #define VEN_IOCTL_GET_TARGET_BITRATE \
441 	_IOR(VEN_IOCTLBASE_ENC, 33, struct venc_ioctl_msg)
442 
443 
444 /*
445  * IOCTL params:SET: InputData - venc_rotation, OutputData - NULL
446  * GET: InputData - NULL, OutputData - venc_rotation
447  */
448 #define VEN_IOCTL_SET_ROTATION \
449 	_IOW(VEN_IOCTLBASE_ENC, 34, struct venc_ioctl_msg)
450 #define VEN_IOCTL_GET_ROTATION \
451 	_IOR(VEN_IOCTLBASE_ENC, 35, struct venc_ioctl_msg)
452 
453 
454 /*
455  * IOCTL params:SET: InputData - venc_headerextension, OutputData - NULL
456  * GET: InputData - NULL, OutputData - venc_headerextension
457  */
458 #define VEN_IOCTL_SET_HEC \
459 	_IOW(VEN_IOCTLBASE_ENC, 36, struct venc_ioctl_msg)
460 #define VEN_IOCTL_GET_HEC \
461 	_IOR(VEN_IOCTLBASE_ENC, 37, struct venc_ioctl_msg)
462 
463 /*
464  * IOCTL params:SET: InputData - venc_switch, OutputData - NULL
465  * GET: InputData - NULL, OutputData - venc_switch
466  */
467 #define VEN_IOCTL_SET_DATA_PARTITION \
468 	_IOW(VEN_IOCTLBASE_ENC, 38, struct venc_ioctl_msg)
469 #define VEN_IOCTL_GET_DATA_PARTITION \
470 	_IOR(VEN_IOCTLBASE_ENC, 39, struct venc_ioctl_msg)
471 
472 /*
473  * IOCTL params:SET: InputData - venc_switch, OutputData - NULL
474  * GET: InputData - NULL, OutputData - venc_switch
475  */
476 #define VEN_IOCTL_SET_RVLC \
477 	_IOW(VEN_IOCTLBASE_ENC, 40, struct venc_ioctl_msg)
478 #define VEN_IOCTL_GET_RVLC \
479 	_IOR(VEN_IOCTLBASE_ENC, 41, struct venc_ioctl_msg)
480 
481 
482 /*
483  * IOCTL params:SET: InputData - venc_switch, OutputData - NULL
484  * GET: InputData - NULL, OutputData - venc_switch
485  */
486 #define VEN_IOCTL_SET_AC_PREDICTION \
487 	_IOW(VEN_IOCTLBASE_ENC, 42, struct venc_ioctl_msg)
488 #define VEN_IOCTL_GET_AC_PREDICTION \
489 	_IOR(VEN_IOCTLBASE_ENC, 43, struct venc_ioctl_msg)
490 
491 
492 /*
493  * IOCTL params:SET: InputData - venc_qprange, OutputData - NULL
494  * GET: InputData - NULL, OutputData - venc_qprange
495  */
496 #define VEN_IOCTL_SET_QP_RANGE \
497 	_IOW(VEN_IOCTLBASE_ENC, 44, struct venc_ioctl_msg)
498 #define VEN_IOCTL_GET_QP_RANGE \
499 	_IOR(VEN_IOCTLBASE_ENC, 45, struct venc_ioctl_msg)
500 
501 #define VEN_IOCTL_GET_NUMBER_INSTANCES \
502 	_IOR(VEN_IOCTLBASE_ENC, 46, struct venc_ioctl_msg)
503 
504 #define VEN_IOCTL_SET_METABUFFER_MODE \
505 	_IOW(VEN_IOCTLBASE_ENC, 47, struct venc_ioctl_msg)
506 
507 
508 /*IOCTL params:SET: InputData - unsigned int, OutputData - NULL.*/
509 #define VEN_IOCTL_SET_EXTRADATA \
510 	_IOW(VEN_IOCTLBASE_ENC, 48, struct venc_ioctl_msg)
511 /*IOCTL params:GET: InputData - NULL, OutputData - unsigned int.*/
512 #define VEN_IOCTL_GET_EXTRADATA \
513 	_IOR(VEN_IOCTLBASE_ENC, 49, struct venc_ioctl_msg)
514 
515 /*IOCTL params:SET: InputData - NULL, OutputData - NULL.*/
516 #define VEN_IOCTL_SET_SLICE_DELIVERY_MODE \
517 	_IO(VEN_IOCTLBASE_ENC, 50)
518 
519 #define VEN_IOCTL_SET_H263_PLUSPTYPE \
520 	_IOW(VEN_IOCTLBASE_ENC, 51, struct venc_ioctl_msg)
521 
522 /*IOCTL params:SET: InputData - venc_range, OutputData - NULL.*/
523 #define VEN_IOCTL_SET_CAPABILITY_LTRCOUNT \
524 	_IOW(VEN_IOCTLBASE_ENC, 52, struct venc_ioctl_msg)
525 /*IOCTL params:GET: InputData - NULL, OutputData - venc_range.*/
526 #define VEN_IOCTL_GET_CAPABILITY_LTRCOUNT \
527 	_IOR(VEN_IOCTLBASE_ENC, 53, struct venc_ioctl_msg)
528 
529 /*IOCTL params:SET: InputData - venc_ltrmode, OutputData - NULL.*/
530 #define VEN_IOCTL_SET_LTRMODE \
531 	_IOW(VEN_IOCTLBASE_ENC, 54, struct venc_ioctl_msg)
532 /*IOCTL params:GET: InputData - NULL, OutputData - venc_ltrmode.*/
533 #define VEN_IOCTL_GET_LTRMODE \
534 	_IOR(VEN_IOCTLBASE_ENC, 55, struct venc_ioctl_msg)
535 
536 /*IOCTL params:SET: InputData - venc_ltrcount, OutputData - NULL.*/
537 #define VEN_IOCTL_SET_LTRCOUNT \
538 	_IOW(VEN_IOCTLBASE_ENC, 56, struct venc_ioctl_msg)
539 /*IOCTL params:GET: InputData - NULL, OutputData - venc_ltrcount.*/
540 #define VEN_IOCTL_GET_LTRCOUNT \
541 	_IOR(VEN_IOCTLBASE_ENC, 57, struct venc_ioctl_msg)
542 
543 /*IOCTL params:SET: InputData - venc_ltrperiod, OutputData - NULL.*/
544 #define VEN_IOCTL_SET_LTRPERIOD \
545 	_IOW(VEN_IOCTLBASE_ENC, 58, struct venc_ioctl_msg)
546 /*IOCTL params:GET: InputData - NULL, OutputData - venc_ltrperiod.*/
547 #define VEN_IOCTL_GET_LTRPERIOD \
548 	_IOR(VEN_IOCTLBASE_ENC, 59, struct venc_ioctl_msg)
549 
550 /*IOCTL params:SET: InputData - venc_ltruse, OutputData - NULL.*/
551 #define VEN_IOCTL_SET_LTRUSE \
552 	_IOW(VEN_IOCTLBASE_ENC, 60, struct venc_ioctl_msg)
553 /*IOCTL params:GET: InputData - NULL, OutputData - venc_ltruse.*/
554 #define VEN_IOCTL_GET_LTRUSE \
555 	_IOR(VEN_IOCTLBASE_ENC, 61, struct venc_ioctl_msg)
556 
557 /*IOCTL params:SET: InputData - venc_ltrmark, OutputData - NULL.*/
558 #define VEN_IOCTL_SET_LTRMARK \
559 	_IOW(VEN_IOCTLBASE_ENC, 62, struct venc_ioctl_msg)
560 /*IOCTL params:GET: InputData - NULL, OutputData - venc_ltrmark.*/
561 #define VEN_IOCTL_GET_LTRMARK \
562 	_IOR(VEN_IOCTLBASE_ENC, 63, struct venc_ioctl_msg)
563 
564 /*IOCTL params:SET: InputData - unsigned int, OutputData - NULL*/
565 #define VEN_IOCTL_SET_SPS_PPS_FOR_IDR \
566 	_IOW(VEN_IOCTLBASE_ENC, 64, struct venc_ioctl_msg)
567 
568 struct venc_range {
569 	unsigned long	max;
570 	unsigned long	min;
571 	unsigned long	step_size;
572 };
573 
574 struct venc_switch {
575 	unsigned char	status;
576 };
577 
578 struct venc_allocatorproperty {
579 	unsigned long	 mincount;
580 	unsigned long	 maxcount;
581 	unsigned long	 actualcount;
582 	unsigned long	 datasize;
583 	unsigned long	 suffixsize;
584 	unsigned long	 alignment;
585 	unsigned long	 bufpoolid;
586 };
587 
588 struct venc_bufferpayload {
589 	unsigned char *pbuffer;
590 	size_t	sz;
591 	int	fd;
592 	unsigned int	offset;
593 	unsigned int	maped_size;
594 	unsigned long	filled_len;
595 };
596 
597 struct venc_buffer {
598 	unsigned char *ptrbuffer;
599 	unsigned long	sz;
600 	unsigned long	len;
601 	unsigned long	offset;
602 	long long	timestamp;
603 	unsigned long	flags;
604 	void	*clientdata;
605 };
606 
607 struct venc_basecfg {
608 	unsigned long	input_width;
609 	unsigned long	input_height;
610 	unsigned long	dvs_width;
611 	unsigned long	dvs_height;
612 	unsigned long	codectype;
613 	unsigned long	fps_num;
614 	unsigned long	fps_den;
615 	unsigned long	targetbitrate;
616 	unsigned long	inputformat;
617 };
618 
619 struct venc_profile {
620 	unsigned long	profile;
621 };
622 struct ven_profilelevel {
623 	unsigned long	level;
624 };
625 
626 struct venc_sessionqp {
627 	unsigned long	iframeqp;
628 	unsigned long	pframqp;
629 };
630 
631 struct venc_qprange {
632 	unsigned long	maxqp;
633 	unsigned long	minqp;
634 };
635 
636 struct venc_plusptype {
637 	unsigned long	plusptype_enable;
638 };
639 
640 struct venc_intraperiod {
641 	unsigned long	num_pframes;
642 	unsigned long	num_bframes;
643 };
644 struct venc_seqheader {
645 	unsigned char *hdrbufptr;
646 	unsigned long	bufsize;
647 	unsigned long	hdrlen;
648 };
649 
650 struct venc_capability {
651 	unsigned long	codec_types;
652 	unsigned long	maxframe_width;
653 	unsigned long	maxframe_height;
654 	unsigned long	maxtarget_bitrate;
655 	unsigned long	maxframe_rate;
656 	unsigned long	input_formats;
657 	unsigned char	dvs;
658 };
659 
660 struct venc_entropycfg {
661 	unsigned int longentropysel;
662 	unsigned long	cabacmodel;
663 };
664 
665 struct venc_dbcfg {
666 	unsigned long	db_mode;
667 	unsigned long	slicealpha_offset;
668 	unsigned long	slicebeta_offset;
669 };
670 
671 struct venc_intrarefresh {
672 	unsigned long	irmode;
673 	unsigned long	mbcount;
674 };
675 
676 struct venc_multiclicecfg {
677 	unsigned long	mslice_mode;
678 	unsigned long	mslice_size;
679 };
680 
681 struct venc_bufferflush {
682 	unsigned long	flush_mode;
683 };
684 
685 struct venc_ratectrlcfg {
686 	unsigned long	rcmode;
687 };
688 
689 struct	venc_voptimingcfg {
690 	unsigned long	voptime_resolution;
691 };
692 struct venc_framerate {
693 	unsigned long	fps_denominator;
694 	unsigned long	fps_numerator;
695 };
696 
697 struct venc_targetbitrate {
698 	unsigned long	target_bitrate;
699 };
700 
701 
702 struct venc_rotation {
703 	unsigned long	rotation;
704 };
705 
706 struct venc_timeout {
707 	 unsigned long	millisec;
708 };
709 
710 struct venc_headerextension {
711 	 unsigned long	header_extension;
712 };
713 
714 struct venc_msg {
715 	unsigned long	statuscode;
716 	unsigned long	msgcode;
717 	struct venc_buffer	buf;
718 	unsigned long	msgdata_size;
719 };
720 
721 struct venc_recon_addr {
722 	unsigned char *pbuffer;
723 	unsigned long buffer_size;
724 	unsigned long pmem_fd;
725 	unsigned long offset;
726 };
727 
728 struct venc_recon_buff_size {
729 	int width;
730 	int height;
731 	int size;
732 	int alignment;
733 };
734 
735 struct venc_ltrmode {
736 	unsigned long   ltr_mode;
737 };
738 
739 struct venc_ltrcount {
740 	unsigned long   ltr_count;
741 };
742 
743 struct venc_ltrperiod {
744 	unsigned long   ltr_period;
745 };
746 
747 struct venc_ltruse {
748 	unsigned long   ltr_id;
749 	unsigned long   ltr_frames;
750 };
751 
752 #endif /* _MSM_VIDC_ENC_H_ */
753