1 #ifndef __MSM_VIDC_H__
2 #define __MSM_VIDC_H__
3 
4 #include <linux/types.h>
5 
6 #define MSM_VIDC_HAL_INTERLACE_COLOR_FORMAT_NV12	0x2
7 #define MSM_VIDC_HAL_INTERLACE_COLOR_FORMAT_NV12_UBWC	0x8002
8 #define MSM_VIDC_4x_1 0x1
9 #define MSM_VIDC_EXTRADATA_FRAME_QP_ADV 0x1
10 
11 struct msm_vidc_extradata_header {
12 	unsigned int size;
13 	unsigned int:32; /** Keeping binary compatibility */
14 	unsigned int:32; /* with firmware and OpenMAX IL **/
15 	unsigned int type; /* msm_vidc_extradata_type */
16 	unsigned int data_size;
17 	unsigned char data[1];
18 };
19 
20 struct msm_vidc_interlace_payload {
21 	unsigned int format;
22 	unsigned int color_format;
23 };
24 
25 struct msm_vidc_framerate_payload {
26 	unsigned int frame_rate;
27 };
28 
29 struct msm_vidc_ts_payload {
30 	unsigned int timestamp_lo;
31 	unsigned int timestamp_hi;
32 };
33 
34 struct msm_vidc_concealmb_payload {
35 	unsigned int num_mbs;
36 };
37 
38 struct msm_vidc_recoverysei_payload {
39 	unsigned int flags;
40 };
41 
42 struct msm_vidc_aspect_ratio_payload {
43 	unsigned int size;
44 	unsigned int version;
45 	unsigned int port_index;
46 	unsigned int aspect_width;
47 	unsigned int aspect_height;
48 };
49 
50 struct msm_vidc_mpeg2_seqdisp_payload {
51 	unsigned int video_format;
52 	unsigned int color_descp;
53 	unsigned int color_primaries;
54 	unsigned int transfer_char;
55 	unsigned int matrix_coeffs;
56 	unsigned int disp_width;
57 	unsigned int disp_height;
58 };
59 
60 struct msm_vidc_vc1_seqdisp_payload {
61 	unsigned int prog_seg_format;
62 	unsigned int uv_sampl_fmt;
63 	unsigned int color_format;
64 	unsigned int color_primaries;
65 	unsigned int transfer_char;
66 	unsigned int matrix_coeffs;
67 	unsigned int aspect_ratio;
68 	unsigned int aspect_horiz;
69 	unsigned int aspect_vert;
70 };
71 
72 struct msm_vidc_input_crop_payload {
73 	unsigned int size;
74 	unsigned int version;
75 	unsigned int port_index;
76 	unsigned int left;
77 	unsigned int top;
78 	unsigned int width;
79 	unsigned int height;
80 };
81 
82 struct msm_vidc_misr_info {
83 	unsigned int misr_dpb_luma;
84 	unsigned int misr_dpb_chroma;
85 	unsigned int misr_opb_luma;
86 	unsigned int misr_opb_chroma;
87 };
88 struct msm_vidc_output_crop_payload {
89 	unsigned int size;
90 	unsigned int version;
91 	unsigned int port_index;
92 	unsigned int left;
93 	unsigned int top;
94 	unsigned int display_width;
95 	unsigned int display_height;
96 	unsigned int width;
97 	unsigned int height;
98 	unsigned int frame_num;
99 	unsigned int bit_depth_y;
100 	unsigned int bit_depth_c;
101 	struct msm_vidc_misr_info misr_info[2];
102 };
103 
104 
105 struct msm_vidc_digital_zoom_payload {
106 	unsigned int size;
107 	unsigned int version;
108 	unsigned int port_index;
109 	unsigned int zoom_width;
110 	unsigned int zoom_height;
111 };
112 
113 struct msm_vidc_extradata_index {
114 	unsigned int type;
115 	union {
116 		struct msm_vidc_input_crop_payload input_crop;
117 		struct msm_vidc_digital_zoom_payload digital_zoom;
118 		struct msm_vidc_aspect_ratio_payload aspect_ratio;
119 	};
120 };
121 
122 struct msm_vidc_panscan_window {
123 	unsigned int panscan_height_offset;
124 	unsigned int panscan_width_offset;
125 	unsigned int panscan_window_width;
126 	unsigned int panscan_window_height;
127 };
128 
129 struct msm_vidc_panscan_window_payload {
130 	unsigned int num_panscan_windows;
131 	struct msm_vidc_panscan_window wnd[1];
132 };
133 
134 struct msm_vidc_stream_userdata_payload {
135 	unsigned int type;
136 	unsigned int data[1];
137 };
138 
139 struct msm_vidc_frame_qp_payload {
140 	unsigned int frame_qp;
141 	unsigned int qp_sum;
142 	unsigned int skip_qp_sum;
143 	unsigned int skip_num_blocks;
144 	unsigned int total_num_blocks;
145 };
146 
147 struct msm_vidc_frame_bits_info_payload {
148 	unsigned int frame_bits;
149 	unsigned int header_bits;
150 };
151 
152 struct msm_vidc_s3d_frame_packing_payload {
153 	unsigned int fpa_id;
154 	unsigned int cancel_flag;
155 	unsigned int fpa_type;
156 	unsigned int quin_cunx_flag;
157 	unsigned int content_interprtation_type;
158 	unsigned int spatial_flipping_flag;
159 	unsigned int frame0_flipped_flag;
160 	unsigned int field_views_flag;
161 	unsigned int current_frame_is_frame0_flag;
162 	unsigned int frame0_self_contained_flag;
163 	unsigned int frame1_self_contained_flag;
164 	unsigned int frame0_graid_pos_x;
165 	unsigned int frame0_graid_pos_y;
166 	unsigned int frame1_graid_pos_x;
167 	unsigned int frame1_graid_pos_y;
168 	unsigned int fpa_reserved_byte;
169 	unsigned int fpa_repetition_period;
170 	unsigned int fpa_extension_flag;
171 };
172 
173 struct msm_vidc_vqzip_sei_payload {
174 	unsigned int size;
175 	unsigned int data[1];
176 };
177 
178 struct msm_vidc_ubwc_cr_stats_info {
179 	unsigned int stats_tile_32;
180 	unsigned int stats_tile_64;
181 	unsigned int stats_tile_96;
182 	unsigned int stats_tile_128;
183 	unsigned int stats_tile_160;
184 	unsigned int stats_tile_192;
185 	unsigned int stats_tile_256;
186 };
187 
188 struct msm_vidc_yuv_stats_payload {
189 	unsigned int frame_qp;
190 	unsigned int texture;
191 	unsigned int luma_in_q16;
192 	unsigned int frame_difference;
193 };
194 
195 struct msm_vidc_vpx_colorspace_payload {
196 	unsigned int color_space;
197 	unsigned int yuv_range_flag;
198 	unsigned int sumsampling_x;
199 	unsigned int sumsampling_y;
200 };
201 
202 struct msm_vidc_roi_qp_payload {
203 	int upper_qp_offset;
204 	int lower_qp_offset;
205 	unsigned int b_roi_info;
206 	int mbi_info_size;
207 	unsigned int data[1];
208 };
209 
210 struct msm_vidc_mastering_display_colour_sei_payload {
211 	unsigned int nDisplayPrimariesX[3];
212 	unsigned int nDisplayPrimariesY[3];
213 	unsigned int nWhitePointX;
214 	unsigned int nWhitePointY;
215 	unsigned int nMaxDisplayMasteringLuminance;
216 	unsigned int nMinDisplayMasteringLuminance;
217 };
218 
219 struct msm_vidc_content_light_level_sei_payload {
220 	unsigned int nMaxContentLight;
221 	unsigned int nMaxPicAverageLight;
222 };
223 
224 struct msm_vidc_vui_display_info_payload {
225 	unsigned int video_signal_present_flag;
226 	unsigned int video_format;
227 	unsigned int bit_depth_y;
228 	unsigned int bit_depth_c;
229 	unsigned int video_full_range_flag;
230 	unsigned int color_description_present_flag;
231 	unsigned int color_primaries;
232 	unsigned int transfer_characteristics;
233 	unsigned int matrix_coefficients;
234 	unsigned int chroma_location_info_present_flag;
235 	unsigned int chroma_format_idc;
236 	unsigned int separate_color_plane_flag;
237 	unsigned int chroma_sample_loc_type_top_field;
238 	unsigned int chroma_sample_loc_type_bottom_field;
239 };
240 
241 enum msm_vidc_extradata_type {
242 	MSM_VIDC_EXTRADATA_NONE = 0x00000000,
243 	MSM_VIDC_EXTRADATA_MB_QUANTIZATION = 0x00000001,
244 	MSM_VIDC_EXTRADATA_INTERLACE_VIDEO = 0x00000002,
245 	MSM_VIDC_EXTRADATA_VC1_FRAMEDISP = 0x00000003,
246 	MSM_VIDC_EXTRADATA_VC1_SEQDISP = 0x00000004,
247 	MSM_VIDC_EXTRADATA_TIMESTAMP = 0x00000005,
248 	MSM_VIDC_EXTRADATA_S3D_FRAME_PACKING = 0x00000006,
249 	MSM_VIDC_EXTRADATA_FRAME_RATE = 0x00000007,
250 	MSM_VIDC_EXTRADATA_PANSCAN_WINDOW = 0x00000008,
251 	MSM_VIDC_EXTRADATA_RECOVERY_POINT_SEI = 0x00000009,
252 	MSM_VIDC_EXTRADATA_MPEG2_SEQDISP = 0x0000000D,
253 	MSM_VIDC_EXTRADATA_STREAM_USERDATA = 0x0000000E,
254 	MSM_VIDC_EXTRADATA_FRAME_QP = 0x0000000F,
255 	MSM_VIDC_EXTRADATA_FRAME_BITS_INFO = 0x00000010,
256 	MSM_VIDC_EXTRADATA_VQZIP_SEI = 0x00000011,
257 	MSM_VIDC_EXTRADATA_ROI_QP = 0x00000013,
258 #define MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO \
259 	MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO
260 	MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO = 0x00000014,
261 #define MSM_VIDC_EXTRADATA_MASTERING_DISPLAY_COLOUR_SEI \
262 	MSM_VIDC_EXTRADATA_MASTERING_DISPLAY_COLOUR_SEI
263 	MSM_VIDC_EXTRADATA_MASTERING_DISPLAY_COLOUR_SEI = 0x00000015,
264 #define MSM_VIDC_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI \
265 	MSM_VIDC_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI
266 	MSM_VIDC_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI = 0x00000016,
267 #define MSM_VIDC_EXTRADATA_PQ_INFO \
268 	MSM_VIDC_EXTRADATA_PQ_INFO
269 	MSM_VIDC_EXTRADATA_PQ_INFO = 0x00000017,
270 #define MSM_VIDC_EXTRADATA_COLOUR_REMAPPING_INFO_SEI \
271 	MSM_VIDC_EXTRADATA_COLOUR_REMAPPING_INFO_SEI
272 	MSM_VIDC_EXTRADATA_COLOUR_REMAPPING_INFO_SEI = 0x00000018,
273 #define MSM_VIDC_EXTRADATA_UBWC_CR_STAT_INFO \
274 	MSM_VIDC_EXTRADATA_UBWC_CR_STAT_INFO
275 	MSM_VIDC_EXTRADATA_UBWC_CR_STAT_INFO = 0x00000019,
276 	MSM_VIDC_EXTRADATA_INPUT_CROP = 0x0700000E,
277 #define MSM_VIDC_EXTRADATA_OUTPUT_CROP \
278 	MSM_VIDC_EXTRADATA_OUTPUT_CROP
279 	MSM_VIDC_EXTRADATA_OUTPUT_CROP = 0x0700000F,
280 	MSM_VIDC_EXTRADATA_DIGITAL_ZOOM = 0x07000010,
281 	MSM_VIDC_EXTRADATA_MULTISLICE_INFO = 0x7F100000,
282 	MSM_VIDC_EXTRADATA_NUM_CONCEALED_MB = 0x7F100001,
283 	MSM_VIDC_EXTRADATA_INDEX = 0x7F100002,
284 	MSM_VIDC_EXTRADATA_ASPECT_RATIO = 0x7F100003,
285 	MSM_VIDC_EXTRADATA_METADATA_LTR = 0x7F100004,
286 	MSM_VIDC_EXTRADATA_METADATA_FILLER = 0x7FE00002,
287 	MSM_VIDC_EXTRADATA_METADATA_MBI = 0x7F100005,
288 #define MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO \
289 	MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO
290 	MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO = 0x7F100006,
291 	MSM_VIDC_EXTRADATA_YUVSTATS_INFO = 0x7F100007,
292 };
293 enum msm_vidc_interlace_type {
294 	MSM_VIDC_INTERLACE_FRAME_PROGRESSIVE = 0x01,
295 	MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST = 0x02,
296 	MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST = 0x04,
297 	MSM_VIDC_INTERLACE_FRAME_TOPFIELDFIRST = 0x08,
298 	MSM_VIDC_INTERLACE_FRAME_BOTTOMFIELDFIRST = 0x10,
299 #define MSM_VIDC_INTERLACE_FRAME_MBAFF \
300 	MSM_VIDC_INTERLACE_FRAME_MBAFF
301 	MSM_VIDC_INTERLACE_FRAME_MBAFF = 0x20,
302 };
303 
304 /* enum msm_vidc_framepack_type */
305 #define MSM_VIDC_FRAMEPACK_CHECKERBOARD 0x00
306 #define MSM_VIDC_FRAMEPACK_COLUMN_INTERLEAVE 0x01
307 #define MSM_VIDC_FRAMEPACK_ROW_INTERLEAVE 0x02
308 #define MSM_VIDC_FRAMEPACK_SIDE_BY_SIDE 0x03
309 #define MSM_VIDC_FRAMEPACK_TOP_BOTTOM 0x04
310 #define MSM_VIDC_FRAMEPACK_TEMPORAL_INTERLEAVE 0x05
311 
312 enum msm_vidc_recovery_sei {
313 	MSM_VIDC_FRAME_RECONSTRUCTION_INCORRECT = 0x0,
314 	MSM_VIDC_FRAME_RECONSTRUCTION_CORRECT = 0x01,
315 	MSM_VIDC_FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT = 0x02,
316 };
317 enum msm_vidc_userdata_type {
318 	MSM_VIDC_USERDATA_TYPE_FRAME = 0x1,
319 	MSM_VIDC_USERDATA_TYPE_TOP_FIELD = 0x2,
320 	MSM_VIDC_USERDATA_TYPE_BOTTOM_FIELD = 0x3,
321 };
322 
323 /* See colour_primaries of ISO/IEC 14496 for significance */
324 enum msm_vidc_h264_color_primaries_values {
325 	MSM_VIDC_RESERVED_1 = 0,
326 	MSM_VIDC_BT709_5 = 1,
327 	MSM_VIDC_UNSPECIFIED = 2,
328 	MSM_VIDC_RESERVED_2 = 3,
329 	MSM_VIDC_BT470_6_M = 4,
330 	MSM_VIDC_BT601_6_625 = 5,
331 	MSM_VIDC_BT470_6_BG = MSM_VIDC_BT601_6_625,
332 	MSM_VIDC_BT601_6_525 = 6,
333 	MSM_VIDC_SMPTE_240M = 7,
334 	MSM_VIDC_GENERIC_FILM = 8,
335 	MSM_VIDC_BT2020 = 9,
336 };
337 
338 enum msm_vidc_vp9_color_primaries_values {
339 	MSM_VIDC_CS_UNKNOWN,
340 	MSM_VIDC_CS_BT_601,
341 	MSM_VIDC_CS_BT_709,
342 	MSM_VIDC_CS_SMPTE_170,
343 	MSM_VIDC_CS_SMPTE_240,
344 	MSM_VIDC_CS_BT_2020,
345 	MSM_VIDC_CS_RESERVED,
346 	MSM_VIDC_CS_RGB,
347 };
348 
349 enum msm_vidc_h264_matrix_coeff_values {
350 	MSM_VIDC_MATRIX_RGB = 0,
351 	MSM_VIDC_MATRIX_BT_709_5 = 1,
352 	MSM_VIDC_MATRIX_UNSPECIFIED = 2,
353 	MSM_VIDC_MATRIX_RESERVED = 3,
354 	MSM_VIDC_MATRIX_FCC_47 = 4,
355 	MSM_VIDC_MATRIX_601_6_625 = 5,
356 	MSM_VIDC_MATRIX_BT470_BG = MSM_VIDC_MATRIX_601_6_625,
357 	MSM_VIDC_MATRIX_601_6_525 = 6,
358 	MSM_VIDC_MATRIX_SMPTE_170M = MSM_VIDC_MATRIX_601_6_525,
359 	MSM_VIDC_MATRIX_SMPTE_240M = 7,
360 	MSM_VIDC_MATRIX_Y_CG_CO = 8,
361 	MSM_VIDC_MATRIX_BT_2020 = 9,
362 	MSM_VIDC_MATRIX_BT_2020_CONST = 10,
363 };
364 
365 enum msm_vidc_h264_transfer_chars_values {
366 	MSM_VIDC_TRANSFER_RESERVED_1 = 0,
367 	MSM_VIDC_TRANSFER_BT709_5 = 1,
368 	MSM_VIDC_TRANSFER_UNSPECIFIED = 2,
369 	MSM_VIDC_TRANSFER_RESERVED_2 = 3,
370 	MSM_VIDC_TRANSFER_BT_470_6_M = 4,
371 	MSM_VIDC_TRANSFER_BT_470_6_BG = 5,
372 	MSM_VIDC_TRANSFER_601_6_625 = 6,
373 	MSM_VIDC_TRANSFER_601_6_525 = MSM_VIDC_TRANSFER_601_6_625,
374 	MSM_VIDC_TRANSFER_SMPTE_240M = 7,
375 	MSM_VIDC_TRANSFER_LINEAR = 8,
376 	MSM_VIDC_TRANSFER_LOG_100_1 = 9,
377 	MSM_VIDC_TRANSFER_LOG_100_SQRT10_1 = 10,
378 	MSM_VIDC_TRANSFER_IEC_61966 = 11,
379 	MSM_VIDC_TRANSFER_BT_1361 = 12,
380 	MSM_VIDC_TRANSFER_SRGB = 13,
381 	MSM_VIDC_TRANSFER_BT_2020_10 = 14,
382 	MSM_VIDC_TRANSFER_BT_2020_12 = 15,
383 #define MSM_VIDC_TRANSFER_SMPTE_ST2084 \
384 	MSM_VIDC_TRANSFER_SMPTE_ST2084
385 	MSM_VIDC_TRANSFER_SMPTE_ST2084 = 16,
386 #define MSM_VIDC_TRANSFER_SMPTE_ST428_1 \
387 	MSM_VIDC_TRANSFER_SMPTE_ST428_1
388 	MSM_VIDC_TRANSFER_SMPTE_ST428_1 = 17,
389 #define MSM_VIDC_TRANSFER_HLG \
390 	MSM_VIDC_TRANSFER_HLG
391 	MSM_VIDC_TRANSFER_HLG = 18,
392 };
393 
394 enum msm_vidc_pixel_depth {
395 	MSM_VIDC_BIT_DEPTH_8,
396 	MSM_VIDC_BIT_DEPTH_10,
397 	MSM_VIDC_BIT_DEPTH_UNSUPPORTED = 0XFFFFFFFF,
398 };
399 
400 enum msm_vidc_video_format {
401 	MSM_VIDC_COMPONENT,
402 	MSM_VIDC_PAL,
403 	MSM_VIDC_NTSC,
404 	MSM_VIDC_SECAM,
405 	MSM_VIDC_MAC,
406 	MSM_VIDC_UNSPECIFIED_FORMAT,
407 	MSM_VIDC_RESERVED_1_FORMAT,
408 	MSM_VIDC_RESERVED_2_FORMAT,
409 };
410 
411 enum msm_vidc_color_desc_flag {
412 	MSM_VIDC_COLOR_DESC_NOT_PRESENT,
413 	MSM_VIDC_COLOR_DESC_PRESENT,
414 };
415 
416 /*enum msm_vidc_pic_struct */
417 #define MSM_VIDC_PIC_STRUCT_MAYBE_INTERLACED 0x0
418 #define MSM_VIDC_PIC_STRUCT_PROGRESSIVE 0x1
419 #define MSM_VIDC_PIC_STRUCT_UNKNOWN 0XFFFFFFFF
420 /*default when layer ID isn't specified*/
421 #define MSM_VIDC_ALL_LAYER_ID 0xFF
422 
423 #endif
424