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 	MSM_VIDC_EXTRADATA_INPUT_CROP = 0x0700000E,
239 #define MSM_VIDC_EXTRADATA_OUTPUT_CROP \
240 	MSM_VIDC_EXTRADATA_OUTPUT_CROP
241 	MSM_VIDC_EXTRADATA_OUTPUT_CROP = 0x0700000F,
242 	MSM_VIDC_EXTRADATA_DIGITAL_ZOOM = 0x07000010,
243 #define MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO \
244 	MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO
245 	MSM_VIDC_EXTRADATA_VPX_COLORSPACE_INFO = 0x070000011,
246 	MSM_VIDC_EXTRADATA_MULTISLICE_INFO = 0x7F100000,
247 	MSM_VIDC_EXTRADATA_NUM_CONCEALED_MB = 0x7F100001,
248 	MSM_VIDC_EXTRADATA_INDEX = 0x7F100002,
249 	MSM_VIDC_EXTRADATA_ASPECT_RATIO = 0x7F100003,
250 	MSM_VIDC_EXTRADATA_METADATA_LTR = 0x7F100004,
251 	MSM_VIDC_EXTRADATA_METADATA_FILLER = 0x7FE00002,
252 	MSM_VIDC_EXTRADATA_METADATA_MBI = 0x7F100005,
253 #define MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO \
254 	MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO
255 	MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO = 0x7F100006,
256 	MSM_VIDC_EXTRADATA_YUVSTATS_INFO = 0x7F100007,
257 };
258 enum msm_vidc_interlace_type {
259 	MSM_VIDC_INTERLACE_FRAME_PROGRESSIVE = 0x01,
260 	MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST = 0x02,
261 	MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST = 0x04,
262 	MSM_VIDC_INTERLACE_FRAME_TOPFIELDFIRST = 0x08,
263 	MSM_VIDC_INTERLACE_FRAME_BOTTOMFIELDFIRST = 0x10,
264 };
265 
266 /* enum msm_vidc_framepack_type */
267 #define MSM_VIDC_FRAMEPACK_CHECKERBOARD 0x00
268 #define MSM_VIDC_FRAMEPACK_COLUMN_INTERLEAVE 0x01
269 #define MSM_VIDC_FRAMEPACK_ROW_INTERLEAVE 0x02
270 #define MSM_VIDC_FRAMEPACK_SIDE_BY_SIDE 0x03
271 #define MSM_VIDC_FRAMEPACK_TOP_BOTTOM 0x04
272 #define MSM_VIDC_FRAMEPACK_TEMPORAL_INTERLEAVE 0x05
273 
274 enum msm_vidc_recovery_sei {
275 	MSM_VIDC_FRAME_RECONSTRUCTION_INCORRECT = 0x0,
276 	MSM_VIDC_FRAME_RECONSTRUCTION_CORRECT = 0x01,
277 	MSM_VIDC_FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT = 0x02,
278 };
279 enum msm_vidc_userdata_type {
280 	MSM_VIDC_USERDATA_TYPE_FRAME = 0x1,
281 	MSM_VIDC_USERDATA_TYPE_TOP_FIELD = 0x2,
282 	MSM_VIDC_USERDATA_TYPE_BOTTOM_FIELD = 0x3,
283 };
284 
285 /* See colour_primaries of ISO/IEC 14496 for significance */
286 enum msm_vidc_h264_color_primaries_values {
287 	MSM_VIDC_RESERVED_1 = 0,
288 	MSM_VIDC_BT709_5 = 1,
289 	MSM_VIDC_UNSPECIFIED = 2,
290 	MSM_VIDC_RESERVED_2 = 3,
291 	MSM_VIDC_BT470_6_M = 4,
292 	MSM_VIDC_BT601_6_625 = 5,
293 	MSM_VIDC_BT470_6_BG = MSM_VIDC_BT601_6_625,
294 	MSM_VIDC_BT601_6_525 = 6,
295 	MSM_VIDC_SMPTE_240M = 7,
296 	MSM_VIDC_GENERIC_FILM = 8,
297 	MSM_VIDC_BT2020 = 9,
298 };
299 
300 enum msm_vidc_vp9_color_primaries_values {
301 	MSM_VIDC_CS_UNKNOWN,
302 	MSM_VIDC_CS_BT_601,
303 	MSM_VIDC_CS_BT_709,
304 	MSM_VIDC_CS_SMPTE_170,
305 	MSM_VIDC_CS_SMPTE_240,
306 	MSM_VIDC_CS_BT_2020,
307 	MSM_VIDC_CS_RESERVED,
308 	MSM_VIDC_CS_RGB,
309 };
310 
311 enum msm_vidc_h264_matrix_coeff_values {
312 	MSM_VIDC_MATRIX_RGB = 0,
313 	MSM_VIDC_MATRIX_BT_709_5 = 1,
314 	MSM_VIDC_MATRIX_UNSPECIFIED = 2,
315 	MSM_VIDC_MATRIX_RESERVED = 3,
316 	MSM_VIDC_MATRIX_FCC_47 = 4,
317 	MSM_VIDC_MATRIX_601_6_625 = 5,
318 	MSM_VIDC_MATRIX_BT470_BG = MSM_VIDC_MATRIX_601_6_625,
319 	MSM_VIDC_MATRIX_601_6_525 = 6,
320 	MSM_VIDC_MATRIX_SMPTE_170M = MSM_VIDC_MATRIX_601_6_525,
321 	MSM_VIDC_MATRIX_SMPTE_240M = 7,
322 	MSM_VIDC_MATRIX_Y_CG_CO = 8,
323 	MSM_VIDC_MATRIX_BT_2020 = 9,
324 	MSM_VIDC_MATRIX_BT_2020_CONST = 10,
325 };
326 
327 enum msm_vidc_h264_transfer_chars_values {
328 	MSM_VIDC_TRANSFER_RESERVED_1 = 0,
329 	MSM_VIDC_TRANSFER_BT709_5 = 1,
330 	MSM_VIDC_TRANSFER_UNSPECIFIED = 2,
331 	MSM_VIDC_TRANSFER_RESERVED_2 = 3,
332 	MSM_VIDC_TRANSFER_BT_470_6_M = 4,
333 	MSM_VIDC_TRANSFER_BT_470_6_BG = 5,
334 	MSM_VIDC_TRANSFER_601_6_625 = 6,
335 	MSM_VIDC_TRANSFER_601_6_525 = MSM_VIDC_TRANSFER_601_6_625,
336 	MSM_VIDC_TRANSFER_SMPTE_240M = 7,
337 	MSM_VIDC_TRANSFER_LINEAR = 8,
338 	MSM_VIDC_TRANSFER_LOG_100_1 = 9,
339 	MSM_VIDC_TRANSFER_LOG_100_SQRT10_1 = 10,
340 	MSM_VIDC_TRANSFER_IEC_61966 = 11,
341 	MSM_VIDC_TRANSFER_BT_1361 = 12,
342 	MSM_VIDC_TRANSFER_SRGB = 13,
343 	MSM_VIDC_TRANSFER_BT_2020_10 = 14,
344 	MSM_VIDC_TRANSFER_BT_2020_12 = 15,
345 };
346 
347 enum msm_vidc_pixel_depth {
348 	MSM_VIDC_BIT_DEPTH_8,
349 	MSM_VIDC_BIT_DEPTH_10,
350 	MSM_VIDC_BIT_DEPTH_UNSUPPORTED = 0XFFFFFFFF,
351 };
352 
353 enum msm_vidc_video_format {
354 	MSM_VIDC_COMPONENT,
355 	MSM_VIDC_PAL,
356 	MSM_VIDC_NTSC,
357 	MSM_VIDC_SECAM,
358 	MSM_VIDC_MAC,
359 	MSM_VIDC_UNSPECIFIED_FORMAT,
360 	MSM_VIDC_RESERVED_1_FORMAT,
361 	MSM_VIDC_RESERVED_2_FORMAT,
362 };
363 
364 enum msm_vidc_color_desc_flag {
365 	MSM_VIDC_COLOR_DESC_NOT_PRESENT,
366 	MSM_VIDC_COLOR_DESC_PRESENT,
367 };
368 
369 /*enum msm_vidc_pic_struct */
370 #define MSM_VIDC_PIC_STRUCT_MAYBE_INTERLACED 0x0
371 #define MSM_VIDC_PIC_STRUCT_PROGRESSIVE 0x1
372 
373 #endif
374