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