1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
4  * Copyright (C) 2017 Linaro Ltd.
5  */
6 #ifndef __VENUS_HFI_HELPER_H__
7 #define __VENUS_HFI_HELPER_H__
8 
9 #define HFI_DOMAIN_BASE_COMMON				0
10 
11 #define HFI_DOMAIN_BASE_VDEC				0x1000000
12 #define HFI_DOMAIN_BASE_VENC				0x2000000
13 #define HFI_DOMAIN_BASE_VPE				0x3000000
14 
15 #define HFI_VIDEO_ARCH_OX				0x1
16 
17 #define HFI_ARCH_COMMON_OFFSET				0
18 #define HFI_ARCH_OX_OFFSET				0x200000
19 
20 #define HFI_OX_BASE					0x1000000
21 
22 #define HFI_CMD_START_OFFSET				0x10000
23 #define HFI_MSG_START_OFFSET				0x20000
24 
25 #define HFI_ERR_NONE					0x0
26 #define HFI_ERR_SYS_FATAL				0x1
27 #define HFI_ERR_SYS_INVALID_PARAMETER			0x2
28 #define HFI_ERR_SYS_VERSION_MISMATCH			0x3
29 #define HFI_ERR_SYS_INSUFFICIENT_RESOURCES		0x4
30 #define HFI_ERR_SYS_MAX_SESSIONS_REACHED		0x5
31 #define HFI_ERR_SYS_UNSUPPORTED_CODEC			0x6
32 #define HFI_ERR_SYS_SESSION_IN_USE			0x7
33 #define HFI_ERR_SYS_SESSION_ID_OUT_OF_RANGE		0x8
34 #define HFI_ERR_SYS_UNSUPPORTED_DOMAIN			0x9
35 
36 #define HFI_ERR_SESSION_FATAL				0x1001
37 #define HFI_ERR_SESSION_INVALID_PARAMETER		0x1002
38 #define HFI_ERR_SESSION_BAD_POINTER			0x1003
39 #define HFI_ERR_SESSION_INVALID_SESSION_ID		0x1004
40 #define HFI_ERR_SESSION_INVALID_STREAM_ID		0x1005
41 #define HFI_ERR_SESSION_INCORRECT_STATE_OPERATION	0x1006
42 #define HFI_ERR_SESSION_UNSUPPORTED_PROPERTY		0x1007
43 #define HFI_ERR_SESSION_UNSUPPORTED_SETTING		0x1008
44 #define HFI_ERR_SESSION_INSUFFICIENT_RESOURCES		0x1009
45 #define HFI_ERR_SESSION_STREAM_CORRUPT_OUTPUT_STALLED	0x100a
46 #define HFI_ERR_SESSION_STREAM_CORRUPT			0x100b
47 #define HFI_ERR_SESSION_ENC_OVERFLOW			0x100c
48 #define HFI_ERR_SESSION_UNSUPPORTED_STREAM		0x100d
49 #define HFI_ERR_SESSION_CMDSIZE				0x100e
50 #define HFI_ERR_SESSION_UNSUPPORT_CMD			0x100f
51 #define HFI_ERR_SESSION_UNSUPPORT_BUFFERTYPE		0x1010
52 #define HFI_ERR_SESSION_BUFFERCOUNT_TOOSMALL		0x1011
53 #define HFI_ERR_SESSION_INVALID_SCALE_FACTOR		0x1012
54 #define HFI_ERR_SESSION_UPSCALE_NOT_SUPPORTED		0x1013
55 
56 #define HFI_EVENT_SYS_ERROR				0x1
57 #define HFI_EVENT_SESSION_ERROR				0x2
58 
59 #define HFI_EVENT_DATA_SEQUENCE_CHANGED_SUFFICIENT_BUF_RESOURCES   0x1000001
60 #define HFI_EVENT_DATA_SEQUENCE_CHANGED_INSUFFICIENT_BUF_RESOURCES 0x1000002
61 #define HFI_EVENT_SESSION_SEQUENCE_CHANGED			   0x1000003
62 #define HFI_EVENT_SESSION_PROPERTY_CHANGED			   0x1000004
63 #define HFI_EVENT_SESSION_LTRUSE_FAILED				   0x1000005
64 #define HFI_EVENT_RELEASE_BUFFER_REFERENCE			   0x1000006
65 
66 #define HFI_BUFFERFLAG_EOS				0x00000001
67 #define HFI_BUFFERFLAG_STARTTIME			0x00000002
68 #define HFI_BUFFERFLAG_DECODEONLY			0x00000004
69 #define HFI_BUFFERFLAG_DATACORRUPT			0x00000008
70 #define HFI_BUFFERFLAG_ENDOFFRAME			0x00000010
71 #define HFI_BUFFERFLAG_SYNCFRAME			0x00000020
72 #define HFI_BUFFERFLAG_EXTRADATA			0x00000040
73 #define HFI_BUFFERFLAG_CODECCONFIG			0x00000080
74 #define HFI_BUFFERFLAG_TIMESTAMPINVALID			0x00000100
75 #define HFI_BUFFERFLAG_READONLY				0x00000200
76 #define HFI_BUFFERFLAG_ENDOFSUBFRAME			0x00000400
77 #define HFI_BUFFERFLAG_EOSEQ				0x00200000
78 #define HFI_BUFFERFLAG_MBAFF				0x08000000
79 #define HFI_BUFFERFLAG_VPE_YUV_601_709_CSC_CLAMP	0x10000000
80 #define HFI_BUFFERFLAG_DROP_FRAME			0x20000000
81 #define HFI_BUFFERFLAG_TEI				0x40000000
82 #define HFI_BUFFERFLAG_DISCONTINUITY			0x80000000
83 
84 #define HFI_ERR_SESSION_EMPTY_BUFFER_DONE_OUTPUT_PENDING	0x1001001
85 #define HFI_ERR_SESSION_SAME_STATE_OPERATION			0x1001002
86 #define HFI_ERR_SESSION_SYNC_FRAME_NOT_DETECTED			0x1001003
87 #define HFI_ERR_SESSION_START_CODE_NOT_FOUND			0x1001004
88 
89 #define HFI_FLUSH_INPUT					0x1000001
90 #define HFI_FLUSH_OUTPUT				0x1000002
91 #define HFI_FLUSH_OUTPUT2				0x1000003
92 #define HFI_FLUSH_ALL					0x1000004
93 
94 #define HFI_EXTRADATA_NONE				0x00000000
95 #define HFI_EXTRADATA_MB_QUANTIZATION			0x00000001
96 #define HFI_EXTRADATA_INTERLACE_VIDEO			0x00000002
97 #define HFI_EXTRADATA_VC1_FRAMEDISP			0x00000003
98 #define HFI_EXTRADATA_VC1_SEQDISP			0x00000004
99 #define HFI_EXTRADATA_TIMESTAMP				0x00000005
100 #define HFI_EXTRADATA_S3D_FRAME_PACKING			0x00000006
101 #define HFI_EXTRADATA_FRAME_RATE			0x00000007
102 #define HFI_EXTRADATA_PANSCAN_WINDOW			0x00000008
103 #define HFI_EXTRADATA_RECOVERY_POINT_SEI		0x00000009
104 #define HFI_EXTRADATA_MPEG2_SEQDISP			0x0000000d
105 #define HFI_EXTRADATA_STREAM_USERDATA			0x0000000e
106 #define HFI_EXTRADATA_FRAME_QP				0x0000000f
107 #define HFI_EXTRADATA_FRAME_BITS_INFO			0x00000010
108 #define HFI_EXTRADATA_MULTISLICE_INFO			0x7f100000
109 #define HFI_EXTRADATA_NUM_CONCEALED_MB			0x7f100001
110 #define HFI_EXTRADATA_INDEX				0x7f100002
111 #define HFI_EXTRADATA_METADATA_LTR			0x7f100004
112 #define HFI_EXTRADATA_METADATA_FILLER			0x7fe00002
113 
114 #define HFI_INDEX_EXTRADATA_INPUT_CROP			0x0700000e
115 #define HFI_INDEX_EXTRADATA_OUTPUT_CROP			0x0700000f
116 #define HFI_INDEX_EXTRADATA_DIGITAL_ZOOM		0x07000010
117 #define HFI_INDEX_EXTRADATA_ASPECT_RATIO		0x7f100003
118 
119 #define HFI_INTERLACE_FRAME_PROGRESSIVE			0x01
120 #define HFI_INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST	0x02
121 #define HFI_INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST	0x04
122 #define HFI_INTERLACE_FRAME_TOPFIELDFIRST		0x08
123 #define HFI_INTERLACE_FRAME_BOTTOMFIELDFIRST		0x10
124 
125 /*
126  * HFI_PROPERTY_PARAM_OX_START
127  * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_OX_OFFSET + 0x1000
128  */
129 #define HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL				0x201001
130 #define HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO	0x201002
131 #define HFI_PROPERTY_PARAM_INTERLACE_FORMAT_SUPPORTED			0x201003
132 #define HFI_PROPERTY_PARAM_CHROMA_SITE					0x201004
133 #define HFI_PROPERTY_PARAM_EXTRA_DATA_HEADER_CONFIG			0x201005
134 #define HFI_PROPERTY_PARAM_INDEX_EXTRADATA				0x201006
135 #define HFI_PROPERTY_PARAM_DIVX_FORMAT					0x201007
136 #define HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE				0x201008
137 #define HFI_PROPERTY_PARAM_S3D_FRAME_PACKING_EXTRADATA			0x201009
138 #define HFI_PROPERTY_PARAM_ERR_DETECTION_CODE_EXTRADATA			0x20100a
139 #define HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED			0x20100b
140 #define HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL				0x20100c
141 #define HFI_PROPERTY_PARAM_BUFFER_DISPLAY_HOLD_COUNT_ACTUAL		0x20100d
142 
143 /*
144  * HFI_PROPERTY_CONFIG_OX_START
145  * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_OX_OFFSET + 0x2000
146  */
147 #define HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS		0x202001
148 #define HFI_PROPERTY_CONFIG_REALTIME			0x202002
149 #define HFI_PROPERTY_CONFIG_PRIORITY			0x202003
150 #define HFI_PROPERTY_CONFIG_BATCH_INFO			0x202004
151 
152 /*
153  * HFI_PROPERTY_PARAM_VDEC_OX_START	\
154  * HFI_DOMAIN_BASE_VDEC + HFI_ARCH_OX_OFFSET + 0x3000
155  */
156 #define HFI_PROPERTY_PARAM_VDEC_CONTINUE_DATA_TRANSFER		0x1203001
157 #define HFI_PROPERTY_PARAM_VDEC_DISPLAY_PICTURE_BUFFER_COUNT	0x1203002
158 #define HFI_PROPERTY_PARAM_VDEC_MULTI_VIEW_SELECT		0x1203003
159 #define HFI_PROPERTY_PARAM_VDEC_PICTURE_TYPE_DECODE		0x1203004
160 #define HFI_PROPERTY_PARAM_VDEC_OUTPUT_ORDER			0x1203005
161 #define HFI_PROPERTY_PARAM_VDEC_MB_QUANTIZATION			0x1203006
162 #define HFI_PROPERTY_PARAM_VDEC_NUM_CONCEALED_MB		0x1203007
163 #define HFI_PROPERTY_PARAM_VDEC_H264_ENTROPY_SWITCHING		0x1203008
164 #define HFI_PROPERTY_PARAM_VDEC_OUTPUT2_KEEP_ASPECT_RATIO	0x1203009
165 #define HFI_PROPERTY_PARAM_VDEC_FRAME_RATE_EXTRADATA		0x120300a
166 #define HFI_PROPERTY_PARAM_VDEC_PANSCAN_WNDW_EXTRADATA		0x120300b
167 #define HFI_PROPERTY_PARAM_VDEC_RECOVERY_POINT_SEI_EXTRADATA	0x120300c
168 #define HFI_PROPERTY_PARAM_VDEC_THUMBNAIL_MODE			0x120300d
169 #define HFI_PROPERTY_PARAM_VDEC_FRAME_ASSEMBLY			0x120300e
170 #define HFI_PROPERTY_PARAM_VDEC_VC1_FRAMEDISP_EXTRADATA		0x1203011
171 #define HFI_PROPERTY_PARAM_VDEC_VC1_SEQDISP_EXTRADATA		0x1203012
172 #define HFI_PROPERTY_PARAM_VDEC_TIMESTAMP_EXTRADATA		0x1203013
173 #define HFI_PROPERTY_PARAM_VDEC_INTERLACE_VIDEO_EXTRADATA	0x1203014
174 #define HFI_PROPERTY_PARAM_VDEC_AVC_SESSION_SELECT		0x1203015
175 #define HFI_PROPERTY_PARAM_VDEC_MPEG2_SEQDISP_EXTRADATA		0x1203016
176 #define HFI_PROPERTY_PARAM_VDEC_STREAM_USERDATA_EXTRADATA	0x1203017
177 #define HFI_PROPERTY_PARAM_VDEC_FRAME_QP_EXTRADATA		0x1203018
178 #define HFI_PROPERTY_PARAM_VDEC_FRAME_BITS_INFO_EXTRADATA	0x1203019
179 #define HFI_PROPERTY_PARAM_VDEC_SCS_THRESHOLD			0x120301a
180 
181 /*
182  * HFI_PROPERTY_CONFIG_VDEC_OX_START
183  * HFI_DOMAIN_BASE_VDEC + HFI_ARCH_OX_OFFSET + 0x0000
184  */
185 #define HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER		0x1200001
186 #define HFI_PROPERTY_CONFIG_VDEC_MB_ERROR_MAP_REPORTING		0x1200002
187 #define HFI_PROPERTY_CONFIG_VDEC_MB_ERROR_MAP			0x1200003
188 
189 #define HFI_PROPERTY_CONFIG_VDEC_ENTROPY			0x1204004
190 
191 /*
192  * HFI_PROPERTY_PARAM_VENC_OX_START
193  * HFI_DOMAIN_BASE_VENC + HFI_ARCH_OX_OFFSET + 0x5000
194  */
195 #define  HFI_PROPERTY_PARAM_VENC_MULTI_SLICE_INFO		0x2205001
196 #define  HFI_PROPERTY_PARAM_VENC_H264_IDR_S3D_FRAME_PACKING_NAL	0x2205002
197 #define  HFI_PROPERTY_PARAM_VENC_LTR_INFO			0x2205003
198 #define  HFI_PROPERTY_PARAM_VENC_MBI_DUMPING			0x2205005
199 
200 /*
201  * HFI_PROPERTY_CONFIG_VENC_OX_START
202  * HFI_DOMAIN_BASE_VENC + HFI_ARCH_OX_OFFSET + 0x6000
203  */
204 #define HFI_PROPERTY_CONFIG_VENC_FRAME_QP			0x2206001
205 
206 /*
207  * HFI_PROPERTY_PARAM_VPE_OX_START
208  * HFI_DOMAIN_BASE_VPE + HFI_ARCH_OX_OFFSET + 0x7000
209  */
210 #define HFI_PROPERTY_PARAM_VPE_COLOR_SPACE_CONVERSION		0x3207001
211 
212 #define HFI_PROPERTY_CONFIG_VPE_OX_START	\
213 	(HFI_DOMAIN_BASE_VPE + HFI_ARCH_OX_OFFSET + 0x8000)
214 
215 #define HFI_CHROMA_SITE_0			0x1000001
216 #define HFI_CHROMA_SITE_1			0x1000002
217 #define HFI_CHROMA_SITE_2			0x1000003
218 #define HFI_CHROMA_SITE_3			0x1000004
219 #define HFI_CHROMA_SITE_4			0x1000005
220 #define HFI_CHROMA_SITE_5			0x1000006
221 
222 #define HFI_PRIORITY_LOW			10
223 #define HFI_PRIOIRTY_MEDIUM			20
224 #define HFI_PRIORITY_HIGH			30
225 
226 #define HFI_OUTPUT_ORDER_DISPLAY		0x1000001
227 #define HFI_OUTPUT_ORDER_DECODE			0x1000002
228 
229 #define HFI_RATE_CONTROL_OFF			0x1000001
230 #define HFI_RATE_CONTROL_VBR_VFR		0x1000002
231 #define HFI_RATE_CONTROL_VBR_CFR		0x1000003
232 #define HFI_RATE_CONTROL_CBR_VFR		0x1000004
233 #define HFI_RATE_CONTROL_CBR_CFR		0x1000005
234 #define HFI_RATE_CONTROL_CQ			0x1000008
235 
236 #define HFI_VIDEO_CODEC_H264			0x00000002
237 #define HFI_VIDEO_CODEC_H263			0x00000004
238 #define HFI_VIDEO_CODEC_MPEG1			0x00000008
239 #define HFI_VIDEO_CODEC_MPEG2			0x00000010
240 #define HFI_VIDEO_CODEC_MPEG4			0x00000020
241 #define HFI_VIDEO_CODEC_DIVX_311		0x00000040
242 #define HFI_VIDEO_CODEC_DIVX			0x00000080
243 #define HFI_VIDEO_CODEC_VC1			0x00000100
244 #define HFI_VIDEO_CODEC_SPARK			0x00000200
245 #define HFI_VIDEO_CODEC_VP8			0x00001000
246 #define HFI_VIDEO_CODEC_HEVC			0x00002000
247 #define HFI_VIDEO_CODEC_VP9			0x00004000
248 #define HFI_VIDEO_CODEC_HEVC_HYBRID		0x80000000
249 
250 #define HFI_H264_PROFILE_BASELINE		0x00000001
251 #define HFI_H264_PROFILE_MAIN			0x00000002
252 #define HFI_H264_PROFILE_HIGH			0x00000004
253 #define HFI_H264_PROFILE_STEREO_HIGH		0x00000008
254 #define HFI_H264_PROFILE_MULTIVIEW_HIGH		0x00000010
255 #define HFI_H264_PROFILE_CONSTRAINED_BASE	0x00000020
256 #define HFI_H264_PROFILE_CONSTRAINED_HIGH	0x00000040
257 
258 #define HFI_H264_LEVEL_1			0x00000001
259 #define HFI_H264_LEVEL_1b			0x00000002
260 #define HFI_H264_LEVEL_11			0x00000004
261 #define HFI_H264_LEVEL_12			0x00000008
262 #define HFI_H264_LEVEL_13			0x00000010
263 #define HFI_H264_LEVEL_2			0x00000020
264 #define HFI_H264_LEVEL_21			0x00000040
265 #define HFI_H264_LEVEL_22			0x00000080
266 #define HFI_H264_LEVEL_3			0x00000100
267 #define HFI_H264_LEVEL_31			0x00000200
268 #define HFI_H264_LEVEL_32			0x00000400
269 #define HFI_H264_LEVEL_4			0x00000800
270 #define HFI_H264_LEVEL_41			0x00001000
271 #define HFI_H264_LEVEL_42			0x00002000
272 #define HFI_H264_LEVEL_5			0x00004000
273 #define HFI_H264_LEVEL_51			0x00008000
274 #define HFI_H264_LEVEL_52			0x00010000
275 
276 #define HFI_H263_PROFILE_BASELINE		0x00000001
277 
278 #define HFI_H263_LEVEL_10			0x00000001
279 #define HFI_H263_LEVEL_20			0x00000002
280 #define HFI_H263_LEVEL_30			0x00000004
281 #define HFI_H263_LEVEL_40			0x00000008
282 #define HFI_H263_LEVEL_45			0x00000010
283 #define HFI_H263_LEVEL_50			0x00000020
284 #define HFI_H263_LEVEL_60			0x00000040
285 #define HFI_H263_LEVEL_70			0x00000080
286 
287 #define HFI_MPEG2_PROFILE_SIMPLE		0x00000001
288 #define HFI_MPEG2_PROFILE_MAIN			0x00000002
289 #define HFI_MPEG2_PROFILE_422			0x00000004
290 #define HFI_MPEG2_PROFILE_SNR			0x00000008
291 #define HFI_MPEG2_PROFILE_SPATIAL		0x00000010
292 #define HFI_MPEG2_PROFILE_HIGH			0x00000020
293 
294 #define HFI_MPEG2_LEVEL_LL			0x00000001
295 #define HFI_MPEG2_LEVEL_ML			0x00000002
296 #define HFI_MPEG2_LEVEL_H14			0x00000004
297 #define HFI_MPEG2_LEVEL_HL			0x00000008
298 
299 #define HFI_MPEG4_PROFILE_SIMPLE		0x00000001
300 #define HFI_MPEG4_PROFILE_ADVANCEDSIMPLE	0x00000002
301 
302 #define HFI_MPEG4_LEVEL_0			0x00000001
303 #define HFI_MPEG4_LEVEL_0b			0x00000002
304 #define HFI_MPEG4_LEVEL_1			0x00000004
305 #define HFI_MPEG4_LEVEL_2			0x00000008
306 #define HFI_MPEG4_LEVEL_3			0x00000010
307 #define HFI_MPEG4_LEVEL_4			0x00000020
308 #define HFI_MPEG4_LEVEL_4a			0x00000040
309 #define HFI_MPEG4_LEVEL_5			0x00000080
310 #define HFI_MPEG4_LEVEL_6			0x00000100
311 #define HFI_MPEG4_LEVEL_7			0x00000200
312 #define HFI_MPEG4_LEVEL_8			0x00000400
313 #define HFI_MPEG4_LEVEL_9			0x00000800
314 #define HFI_MPEG4_LEVEL_3b			0x00001000
315 
316 #define HFI_VC1_PROFILE_SIMPLE			0x00000001
317 #define HFI_VC1_PROFILE_MAIN			0x00000002
318 #define HFI_VC1_PROFILE_ADVANCED		0x00000004
319 
320 #define HFI_VC1_LEVEL_LOW			0x00000001
321 #define HFI_VC1_LEVEL_MEDIUM			0x00000002
322 #define HFI_VC1_LEVEL_HIGH			0x00000004
323 #define HFI_VC1_LEVEL_0				0x00000008
324 #define HFI_VC1_LEVEL_1				0x00000010
325 #define HFI_VC1_LEVEL_2				0x00000020
326 #define HFI_VC1_LEVEL_3				0x00000040
327 #define HFI_VC1_LEVEL_4				0x00000080
328 
329 #define HFI_VPX_PROFILE_SIMPLE			0x00000001
330 #define HFI_VPX_PROFILE_ADVANCED		0x00000002
331 #define HFI_VPX_PROFILE_VERSION_0		0x00000004
332 #define HFI_VPX_PROFILE_VERSION_1		0x00000008
333 #define HFI_VPX_PROFILE_VERSION_2		0x00000010
334 #define HFI_VPX_PROFILE_VERSION_3		0x00000020
335 
336 #define HFI_DIVX_FORMAT_4			0x1
337 #define HFI_DIVX_FORMAT_5			0x2
338 #define HFI_DIVX_FORMAT_6			0x3
339 
340 #define HFI_DIVX_PROFILE_QMOBILE		0x00000001
341 #define HFI_DIVX_PROFILE_MOBILE			0x00000002
342 #define HFI_DIVX_PROFILE_MT			0x00000004
343 #define HFI_DIVX_PROFILE_HT			0x00000008
344 #define HFI_DIVX_PROFILE_HD			0x00000010
345 
346 #define HFI_HEVC_PROFILE_MAIN			0x00000001
347 #define HFI_HEVC_PROFILE_MAIN10			0x00000002
348 #define HFI_HEVC_PROFILE_MAIN_STILL_PIC		0x00000004
349 
350 #define HFI_HEVC_LEVEL_1			0x00000001
351 #define HFI_HEVC_LEVEL_2			0x00000002
352 #define HFI_HEVC_LEVEL_21			0x00000004
353 #define HFI_HEVC_LEVEL_3			0x00000008
354 #define HFI_HEVC_LEVEL_31			0x00000010
355 #define HFI_HEVC_LEVEL_4			0x00000020
356 #define HFI_HEVC_LEVEL_41			0x00000040
357 #define HFI_HEVC_LEVEL_5			0x00000080
358 #define HFI_HEVC_LEVEL_51			0x00000100
359 #define HFI_HEVC_LEVEL_52			0x00000200
360 #define HFI_HEVC_LEVEL_6			0x00000400
361 #define HFI_HEVC_LEVEL_61			0x00000800
362 #define HFI_HEVC_LEVEL_62			0x00001000
363 
364 #define HFI_HEVC_TIER_MAIN			0x1
365 #define HFI_HEVC_TIER_HIGH0			0x2
366 
367 #define HFI_VPX_PROFILE_MAIN			0x00000001
368 
369 #define HFI_VPX_LEVEL_VERSION_0			0x00000001
370 #define HFI_VPX_LEVEL_VERSION_1			0x00000002
371 #define HFI_VPX_LEVEL_VERSION_2			0x00000004
372 #define HFI_VPX_LEVEL_VERSION_3			0x00000008
373 
374 /* VP9 Profile 0, 8-bit */
375 #define HFI_VP9_PROFILE_P0			0x00000001
376 /* VP9 Profile 2, 10-bit */
377 #define HFI_VP9_PROFILE_P2_10B			0x00000004
378 
379 #define HFI_VP9_LEVEL_1				0x00000001
380 #define HFI_VP9_LEVEL_11			0x00000002
381 #define HFI_VP9_LEVEL_2				0x00000004
382 #define HFI_VP9_LEVEL_21			0x00000008
383 #define HFI_VP9_LEVEL_3				0x00000010
384 #define HFI_VP9_LEVEL_31			0x00000020
385 #define HFI_VP9_LEVEL_4				0x00000040
386 #define HFI_VP9_LEVEL_41			0x00000080
387 #define HFI_VP9_LEVEL_5				0x00000100
388 #define HFI_VP9_LEVEL_51			0x00000200
389 #define HFI_VP9_LEVEL_6				0x00000400
390 #define HFI_VP9_LEVEL_61			0x00000800
391 
392 #define HFI_BUFFER_INPUT			0x1
393 #define HFI_BUFFER_OUTPUT			0x2
394 #define HFI_BUFFER_OUTPUT2			0x3
395 #define HFI_BUFFER_INTERNAL_PERSIST		0x4
396 #define HFI_BUFFER_INTERNAL_PERSIST_1		0x5
397 #define HFI_BUFFER_INTERNAL_SCRATCH(ver)	\
398 	(((ver) == HFI_VERSION_4XX ||		\
399 	(ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001)
400 #define HFI_BUFFER_INTERNAL_SCRATCH_1(ver)	\
401 	(((ver) == HFI_VERSION_4XX ||		\
402 	(ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005)
403 #define HFI_BUFFER_INTERNAL_SCRATCH_2(ver)	\
404 	(((ver) == HFI_VERSION_4XX ||		\
405 	(ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006)
406 #define HFI_BUFFER_EXTRADATA_INPUT(ver)		\
407 	(((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)
408 #define HFI_BUFFER_EXTRADATA_OUTPUT(ver)	\
409 	(((ver) == HFI_VERSION_4XX) ? 0xa : 0x1000003)
410 #define HFI_BUFFER_EXTRADATA_OUTPUT2(ver)	\
411 	(((ver) == HFI_VERSION_4XX) ? 0xb : 0x1000004)
412 #define HFI_BUFFER_TYPE_MAX			11
413 
414 #define HFI_BUFFER_MODE_STATIC			0x1000001
415 #define HFI_BUFFER_MODE_RING			0x1000002
416 #define HFI_BUFFER_MODE_DYNAMIC			0x1000003
417 
418 /*
419  * HFI_PROPERTY_SYS_COMMON_START
420  * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_COMMON_OFFSET + 0x0000
421  */
422 #define HFI_PROPERTY_SYS_DEBUG_CONFIG				0x1
423 #define HFI_PROPERTY_SYS_RESOURCE_OCMEM_REQUIREMENT_INFO	0x2
424 #define HFI_PROPERTY_SYS_CONFIG_VCODEC_CLKFREQ			0x3
425 #define HFI_PROPERTY_SYS_IDLE_INDICATOR				0x4
426 #define HFI_PROPERTY_SYS_CODEC_POWER_PLANE_CTRL			0x5
427 #define HFI_PROPERTY_SYS_IMAGE_VERSION				0x6
428 #define HFI_PROPERTY_SYS_CONFIG_COVERAGE			0x7
429 
430 /*
431  * HFI_PROPERTY_PARAM_COMMON_START
432  * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_COMMON_OFFSET + 0x1000
433  */
434 #define HFI_PROPERTY_PARAM_FRAME_SIZE				0x1001
435 #define HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO	0x1002
436 #define HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT		0x1003
437 #define HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SUPPORTED	0x1004
438 #define HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT		0x1005
439 #define HFI_PROPERTY_PARAM_PROFILE_LEVEL_SUPPORTED		0x1006
440 #define HFI_PROPERTY_PARAM_CAPABILITY_SUPPORTED			0x1007
441 #define HFI_PROPERTY_PARAM_PROPERTIES_SUPPORTED			0x1008
442 #define HFI_PROPERTY_PARAM_CODEC_SUPPORTED			0x1009
443 #define HFI_PROPERTY_PARAM_NAL_STREAM_FORMAT_SUPPORTED		0x100a
444 #define HFI_PROPERTY_PARAM_NAL_STREAM_FORMAT_SELECT		0x100b
445 #define HFI_PROPERTY_PARAM_MULTI_VIEW_FORMAT			0x100c
446 #define HFI_PROPERTY_PARAM_MAX_SEQUENCE_HEADER_SIZE		0x100d
447 #define HFI_PROPERTY_PARAM_CODEC_MASK_SUPPORTED			0x100e
448 #define HFI_PROPERTY_PARAM_MVC_BUFFER_LAYOUT			0x100f
449 #define HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED		0x1010
450 #define HFI_PROPERTY_PARAM_WORK_MODE				0x1015
451 
452 /*
453  * HFI_PROPERTY_CONFIG_COMMON_START
454  * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_COMMON_OFFSET + 0x2000
455  */
456 #define HFI_PROPERTY_CONFIG_FRAME_RATE				0x2001
457 #define HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE			0x2002
458 
459 /*
460  * HFI_PROPERTY_PARAM_VDEC_COMMON_START
461  * HFI_DOMAIN_BASE_VDEC + HFI_ARCH_COMMON_OFFSET + 0x3000
462  */
463 #define HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM			0x1003001
464 #define HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR			0x1003002
465 #define HFI_PROPERTY_PARAM_VDEC_NONCP_OUTPUT2			0x1003003
466 #define HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH			0x1003007
467 #define HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT			0x1003009
468 #define HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE			0x100300a
469 
470 /*
471  * HFI_PROPERTY_CONFIG_VDEC_COMMON_START
472  * HFI_DOMAIN_BASE_VDEC + HFI_ARCH_COMMON_OFFSET + 0x4000
473  */
474 
475 /*
476  * HFI_PROPERTY_PARAM_VENC_COMMON_START
477  * HFI_DOMAIN_BASE_VENC + HFI_ARCH_COMMON_OFFSET + 0x5000
478  */
479 #define HFI_PROPERTY_PARAM_VENC_SLICE_DELIVERY_MODE		0x2005001
480 #define HFI_PROPERTY_PARAM_VENC_H264_ENTROPY_CONTROL		0x2005002
481 #define HFI_PROPERTY_PARAM_VENC_H264_DEBLOCK_CONTROL		0x2005003
482 #define HFI_PROPERTY_PARAM_VENC_RATE_CONTROL			0x2005004
483 #define HFI_PROPERTY_PARAM_VENC_H264_PICORDER_CNT_TYPE		0x2005005
484 #define HFI_PROPERTY_PARAM_VENC_SESSION_QP			0x2005006
485 #define HFI_PROPERTY_PARAM_VENC_MPEG4_AC_PREDICTION		0x2005007
486 #define HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE		0x2005008
487 #define HFI_PROPERTY_PARAM_VENC_MPEG4_TIME_RESOLUTION		0x2005009
488 #define HFI_PROPERTY_PARAM_VENC_MPEG4_SHORT_HEADER		0x200500a
489 #define HFI_PROPERTY_PARAM_VENC_MPEG4_HEADER_EXTENSION		0x200500b
490 #define HFI_PROPERTY_PARAM_VENC_OPEN_GOP			0x200500c
491 #define HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH			0x200500d
492 #define HFI_PROPERTY_PARAM_VENC_MULTI_SLICE_CONTROL		0x200500e
493 #define HFI_PROPERTY_PARAM_VENC_VBV_HRD_BUF_SIZE		0x200500f
494 #define HFI_PROPERTY_PARAM_VENC_QUALITY_VS_SPEED		0x2005010
495 #define HFI_PROPERTY_PARAM_VENC_ADVANCED			0x2005012
496 #define HFI_PROPERTY_PARAM_VENC_H264_SPS_ID			0x2005014
497 #define HFI_PROPERTY_PARAM_VENC_H264_PPS_ID			0x2005015
498 #define HFI_PROPERTY_PARAM_VENC_H264_GENERATE_AUDNAL		0x2005016
499 #define HFI_PROPERTY_PARAM_VENC_ASPECT_RATIO			0x2005017
500 #define HFI_PROPERTY_PARAM_VENC_NUMREF				0x2005018
501 #define HFI_PROPERTY_PARAM_VENC_MULTIREF_P			0x2005019
502 #define HFI_PROPERTY_PARAM_VENC_H264_NAL_SVC_EXT		0x200501b
503 #define HFI_PROPERTY_PARAM_VENC_LTRMODE				0x200501c
504 #define HFI_PROPERTY_PARAM_VENC_VIDEO_FULL_RANGE		0x200501d
505 #define HFI_PROPERTY_PARAM_VENC_H264_VUI_TIMING_INFO		0x200501e
506 #define HFI_PROPERTY_PARAM_VENC_VC1_PERF_CFG			0x200501f
507 #define HFI_PROPERTY_PARAM_VENC_MAX_NUM_B_FRAMES		0x2005020
508 #define HFI_PROPERTY_PARAM_VENC_H264_VUI_BITSTREAM_RESTRC	0x2005021
509 #define HFI_PROPERTY_PARAM_VENC_PRESERVE_TEXT_QUALITY		0x2005023
510 #define HFI_PROPERTY_PARAM_VENC_HIER_P_MAX_NUM_ENH_LAYER	0x2005026
511 #define HFI_PROPERTY_PARAM_VENC_DISABLE_RC_TIMESTAMP		0x2005027
512 #define HFI_PROPERTY_PARAM_VENC_INITIAL_QP			0x2005028
513 #define HFI_PROPERTY_PARAM_VENC_VPX_ERROR_RESILIENCE_MODE	0x2005029
514 #define HFI_PROPERTY_PARAM_VENC_HIER_B_MAX_NUM_ENH_LAYER	0x200502c
515 #define HFI_PROPERTY_PARAM_VENC_HIER_P_HYBRID_MODE		0x200502f
516 #define HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI			0x2005036
517 
518 /*
519  * HFI_PROPERTY_CONFIG_VENC_COMMON_START
520  * HFI_DOMAIN_BASE_VENC + HFI_ARCH_COMMON_OFFSET + 0x6000
521  */
522 #define HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE			0x2006001
523 #define HFI_PROPERTY_CONFIG_VENC_IDR_PERIOD			0x2006002
524 #define HFI_PROPERTY_CONFIG_VENC_INTRA_PERIOD			0x2006003
525 #define HFI_PROPERTY_CONFIG_VENC_REQUEST_SYNC_FRAME		0x2006004
526 #define HFI_PROPERTY_CONFIG_VENC_SLICE_SIZE			0x2006005
527 #define HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE			0x2006007
528 #define HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER	0x2006008
529 #define HFI_PROPERTY_CONFIG_VENC_MARKLTRFRAME			0x2006009
530 #define HFI_PROPERTY_CONFIG_VENC_USELTRFRAME			0x200600a
531 #define HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER		0x200600b
532 #define HFI_PROPERTY_CONFIG_VENC_LTRPERIOD			0x200600c
533 #define HFI_PROPERTY_CONFIG_VENC_PERF_MODE			0x200600e
534 #define HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY			0x2006014
535 
536 /*
537  * HFI_PROPERTY_PARAM_VPE_COMMON_START
538  * HFI_DOMAIN_BASE_VPE + HFI_ARCH_COMMON_OFFSET + 0x7000
539  */
540 
541 /*
542  * HFI_PROPERTY_CONFIG_VPE_COMMON_START
543  * HFI_DOMAIN_BASE_VPE + HFI_ARCH_COMMON_OFFSET + 0x8000
544  */
545 #define HFI_PROPERTY_CONFIG_VPE_DEINTERLACE			0x3008001
546 #define HFI_PROPERTY_CONFIG_VPE_OPERATIONS			0x3008002
547 
548 enum hfi_version {
549 	HFI_VERSION_1XX,
550 	HFI_VERSION_3XX,
551 	HFI_VERSION_4XX,
552 	HFI_VERSION_6XX,
553 };
554 
555 struct hfi_buffer_info {
556 	u32 buffer_addr;
557 	u32 extradata_addr;
558 };
559 
560 struct hfi_bitrate {
561 	u32 bitrate;
562 	u32 layer_id;
563 };
564 
565 #define HFI_CAPABILITY_FRAME_WIDTH			0x01
566 #define HFI_CAPABILITY_FRAME_HEIGHT			0x02
567 #define HFI_CAPABILITY_MBS_PER_FRAME			0x03
568 #define HFI_CAPABILITY_MBS_PER_SECOND			0x04
569 #define HFI_CAPABILITY_FRAMERATE			0x05
570 #define HFI_CAPABILITY_SCALE_X				0x06
571 #define HFI_CAPABILITY_SCALE_Y				0x07
572 #define HFI_CAPABILITY_BITRATE				0x08
573 #define HFI_CAPABILITY_BFRAME				0x09
574 #define HFI_CAPABILITY_PEAKBITRATE			0x0a
575 #define HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS		0x10
576 #define HFI_CAPABILITY_ENC_LTR_COUNT			0x11
577 #define HFI_CAPABILITY_CP_OUTPUT2_THRESH		0x12
578 #define HFI_CAPABILITY_HIER_B_NUM_ENH_LAYERS		0x13
579 #define HFI_CAPABILITY_LCU_SIZE				0x14
580 #define HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS	0x15
581 #define HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE		0x16
582 #define HFI_CAPABILITY_I_FRAME_QP			0x20
583 #define HFI_CAPABILITY_P_FRAME_QP			0x21
584 #define HFI_CAPABILITY_B_FRAME_QP			0x22
585 #define HFI_CAPABILITY_RATE_CONTROL_MODES		0x23
586 #define HFI_CAPABILITY_BLUR_WIDTH			0x24
587 #define HFI_CAPABILITY_BLUR_HEIGHT			0x25
588 #define HFI_CAPABILITY_SLICE_BYTE			0x27
589 #define HFI_CAPABILITY_SLICE_MB				0x28
590 #define HFI_CAPABILITY_MAX_VIDEOCORES			0x2b
591 #define HFI_CAPABILITY_MAX_WORKMODES			0x2c
592 #define HFI_CAPABILITY_ROTATION				0x2f
593 #define HFI_CAPABILITY_COLOR_SPACE_CONVERSION		0x30
594 
595 struct hfi_capability {
596 	u32 capability_type;
597 	u32 min;
598 	u32 max;
599 	u32 step_size;
600 };
601 
602 struct hfi_capabilities {
603 	u32 num_capabilities;
604 	struct hfi_capability data[];
605 };
606 
607 #define HFI_DEBUG_MSG_LOW	0x01
608 #define HFI_DEBUG_MSG_MEDIUM	0x02
609 #define HFI_DEBUG_MSG_HIGH	0x04
610 #define HFI_DEBUG_MSG_ERROR	0x08
611 #define HFI_DEBUG_MSG_FATAL	0x10
612 #define HFI_DEBUG_MSG_PERF	0x20
613 
614 #define HFI_DEBUG_MODE_QUEUE	0x01
615 #define HFI_DEBUG_MODE_QDSS	0x02
616 
617 struct hfi_debug_config {
618 	u32 config;
619 	u32 mode;
620 };
621 
622 struct hfi_enable {
623 	u32 enable;
624 };
625 
626 #define HFI_H264_DB_MODE_DISABLE		0x1
627 #define HFI_H264_DB_MODE_SKIP_SLICE_BOUNDARY	0x2
628 #define HFI_H264_DB_MODE_ALL_BOUNDARY		0x3
629 
630 struct hfi_h264_db_control {
631 	u32 mode;
632 	s32 slice_alpha_offset;
633 	s32 slice_beta_offset;
634 };
635 
636 #define HFI_H264_ENTROPY_CAVLC			0x1
637 #define HFI_H264_ENTROPY_CABAC			0x2
638 
639 #define HFI_H264_CABAC_MODEL_0			0x1
640 #define HFI_H264_CABAC_MODEL_1			0x2
641 #define HFI_H264_CABAC_MODEL_2			0x3
642 
643 struct hfi_h264_entropy_control {
644 	u32 entropy_mode;
645 	u32 cabac_model;
646 };
647 
648 struct hfi_framerate {
649 	u32 buffer_type;
650 	u32 framerate;
651 };
652 
653 #define HFI_INTRA_REFRESH_NONE			0x1
654 #define HFI_INTRA_REFRESH_CYCLIC		0x2
655 #define HFI_INTRA_REFRESH_ADAPTIVE		0x3
656 #define HFI_INTRA_REFRESH_CYCLIC_ADAPTIVE	0x4
657 #define HFI_INTRA_REFRESH_RANDOM		0x5
658 
659 struct hfi_intra_refresh {
660 	u32 mode;
661 	u32 air_mbs;
662 	u32 air_ref;
663 	u32 cir_mbs;
664 };
665 
666 struct hfi_intra_refresh_3x {
667 	u32 mode;
668 	u32 mbs;
669 };
670 
671 struct hfi_idr_period {
672 	u32 idr_period;
673 };
674 
675 struct hfi_operations_type {
676 	u32 rotation;
677 	u32 flip;
678 };
679 
680 struct hfi_max_num_b_frames {
681 	u32 max_num_b_frames;
682 };
683 
684 struct hfi_vc1e_perf_cfg_type {
685 	u32 search_range_x_subsampled[3];
686 	u32 search_range_y_subsampled[3];
687 };
688 
689 /*
690  * 0 - 7bit -> Luma (def: 16)
691  * 8 - 15bit -> Chroma (def: 128)
692  * format is valid up to v4
693  */
694 struct hfi_conceal_color {
695 	u32 conceal_color;
696 };
697 
698 struct hfi_conceal_color_v4 {
699 	u32 conceal_color_8bit;
700 	u32 conceal_color_10bit;
701 };
702 
703 struct hfi_intra_period {
704 	u32 pframes;
705 	u32 bframes;
706 };
707 
708 struct hfi_mpeg4_header_extension {
709 	u32 header_extension;
710 };
711 
712 struct hfi_mpeg4_time_resolution {
713 	u32 time_increment_resolution;
714 };
715 
716 struct hfi_multi_stream {
717 	u32 buffer_type;
718 	u32 enable;
719 	u32 width;
720 	u32 height;
721 };
722 
723 struct hfi_multi_stream_3x {
724 	u32 buffer_type;
725 	u32 enable;
726 };
727 
728 struct hfi_multi_view_format {
729 	u32 views;
730 	u32 view_order[1];
731 };
732 
733 #define HFI_MULTI_SLICE_OFF			0x1
734 #define HFI_MULTI_SLICE_BY_MB_COUNT		0x2
735 #define HFI_MULTI_SLICE_BY_BYTE_COUNT		0x3
736 #define HFI_MULTI_SLICE_GOB			0x4
737 
738 struct hfi_multi_slice_control {
739 	u32 multi_slice;
740 	u32 slice_size;
741 };
742 
743 #define HFI_NAL_FORMAT_STARTCODES		0x01
744 #define HFI_NAL_FORMAT_ONE_NAL_PER_BUFFER	0x02
745 #define HFI_NAL_FORMAT_ONE_BYTE_LENGTH		0x04
746 #define HFI_NAL_FORMAT_TWO_BYTE_LENGTH		0x08
747 #define HFI_NAL_FORMAT_FOUR_BYTE_LENGTH		0x10
748 
749 struct hfi_nal_stream_format {
750 	u32 format;
751 };
752 
753 struct hfi_nal_stream_format_select {
754 	u32 format;
755 };
756 
757 #define HFI_PICTURE_TYPE_I			0x01
758 #define HFI_PICTURE_TYPE_P			0x02
759 #define HFI_PICTURE_TYPE_B			0x04
760 #define HFI_PICTURE_TYPE_IDR			0x08
761 
762 struct hfi_profile_level {
763 	u32 profile;
764 	u32 level;
765 };
766 
767 #define HFI_MAX_PROFILE_COUNT			16
768 
769 struct hfi_profile_level_supported {
770 	u32 profile_count;
771 	struct hfi_profile_level profile_level[];
772 };
773 
774 struct hfi_quality_vs_speed {
775 	u32 quality_vs_speed;
776 };
777 
778 struct hfi_heic_frame_quality {
779 	u32 frame_quality;
780 	u32 reserved[3];
781 };
782 
783 struct hfi_quantization {
784 	u32 qp_i;
785 	u32 qp_p;
786 	u32 qp_b;
787 	u32 layer_id;
788 };
789 
790 struct hfi_initial_quantization {
791 	u32 qp_i;
792 	u32 qp_p;
793 	u32 qp_b;
794 	u32 init_qp_enable;
795 };
796 
797 struct hfi_quantization_range {
798 	u32 min_qp;
799 	u32 max_qp;
800 	u32 layer_id;
801 };
802 
803 #define HFI_LTR_MODE_DISABLE	0x0
804 #define HFI_LTR_MODE_MANUAL	0x1
805 #define HFI_LTR_MODE_PERIODIC	0x2
806 
807 struct hfi_ltr_mode {
808 	u32 ltr_mode;
809 	u32 ltr_count;
810 	u32 trust_mode;
811 };
812 
813 struct hfi_ltr_use {
814 	u32 ref_ltr;
815 	u32 use_constrnt;
816 	u32 frames;
817 };
818 
819 struct hfi_ltr_mark {
820 	u32 mark_frame;
821 };
822 
823 struct hfi_mastering_display_colour_sei_payload {
824 	u32 display_primaries_x[3];
825 	u32 display_primaries_y[3];
826 	u32 white_point_x;
827 	u32 white_point_y;
828 	u32 max_display_mastering_luminance;
829 	u32 min_display_mastering_luminance;
830 };
831 
832 struct hfi_content_light_level_sei_payload {
833 	u32 max_content_light;
834 	u32 max_pic_average_light;
835 };
836 
837 struct hfi_hdr10_pq_sei {
838 	struct hfi_mastering_display_colour_sei_payload mastering;
839 	struct hfi_content_light_level_sei_payload cll;
840 };
841 
842 struct hfi_framesize {
843 	u32 buffer_type;
844 	u32 width;
845 	u32 height;
846 };
847 
848 #define HFI_VENC_PERFMODE_MAX_QUALITY		0x1
849 #define HFI_VENC_PERFMODE_POWER_SAVE		0x2
850 
851 struct hfi_perf_mode {
852 	u32 video_perf_mode;
853 };
854 
855 #define VIDC_CORE_ID_DEFAULT	0
856 #define VIDC_CORE_ID_1		1
857 #define VIDC_CORE_ID_2		2
858 #define VIDC_CORE_ID_3		3
859 
860 struct hfi_videocores_usage_type {
861 	u32 video_core_enable_mask;
862 };
863 
864 #define VIDC_WORK_MODE_1	1
865 #define VIDC_WORK_MODE_2	2
866 
867 struct hfi_video_work_mode {
868 	u32 video_work_mode;
869 };
870 
871 struct hfi_h264_vui_timing_info {
872 	u32 enable;
873 	u32 fixed_framerate;
874 	u32 time_scale;
875 };
876 
877 #define VIDC_BITDEPTH_8		0x00000
878 #define VIDC_BITDEPTH_10	0x20002
879 
880 struct hfi_bit_depth {
881 	u32 buffer_type;
882 	u32 bit_depth;
883 };
884 
885 struct hfi_picture_type {
886 	u32 is_sync_frame;
887 	u32 picture_type;
888 };
889 
890 struct hfi_pic_struct {
891 	u32 progressive_only;
892 };
893 
894 struct hfi_colour_space {
895 	u32 colour_space;
896 };
897 
898 struct hfi_extradata_input_crop {
899 	u32 size;
900 	u32 version;
901 	u32 port_index;
902 	u32 left;
903 	u32 top;
904 	u32 width;
905 	u32 height;
906 };
907 
908 #define HFI_COLOR_FORMAT_MONOCHROME		0x01
909 #define HFI_COLOR_FORMAT_NV12			0x02
910 #define HFI_COLOR_FORMAT_NV21			0x03
911 #define HFI_COLOR_FORMAT_NV12_4x4TILE		0x04
912 #define HFI_COLOR_FORMAT_NV21_4x4TILE		0x05
913 #define HFI_COLOR_FORMAT_YUYV			0x06
914 #define HFI_COLOR_FORMAT_YVYU			0x07
915 #define HFI_COLOR_FORMAT_UYVY			0x08
916 #define HFI_COLOR_FORMAT_VYUY			0x09
917 #define HFI_COLOR_FORMAT_RGB565			0x0a
918 #define HFI_COLOR_FORMAT_BGR565			0x0b
919 #define HFI_COLOR_FORMAT_RGB888			0x0c
920 #define HFI_COLOR_FORMAT_BGR888			0x0d
921 #define HFI_COLOR_FORMAT_YUV444			0x0e
922 #define HFI_COLOR_FORMAT_RGBA8888		0x10
923 
924 #define HFI_COLOR_FORMAT_UBWC_BASE		0x8000
925 #define HFI_COLOR_FORMAT_10_BIT_BASE		0x4000
926 
927 #define HFI_COLOR_FORMAT_YUV420_TP10		0x4002
928 #define HFI_COLOR_FORMAT_P010			0x4003
929 #define HFI_COLOR_FORMAT_NV12_UBWC		0x8002
930 #define HFI_COLOR_FORMAT_YUV420_TP10_UBWC	0xc002
931 #define HFI_COLOR_FORMAT_P010_UBWC		0xc003
932 #define HFI_COLOR_FORMAT_RGBA8888_UBWC		0x8010
933 
934 struct hfi_uncompressed_format_select {
935 	u32 buffer_type;
936 	u32 format;
937 };
938 
939 struct hfi_uncompressed_plane_constraints {
940 	u32 stride_multiples;
941 	u32 max_stride;
942 	u32 min_plane_buffer_height_multiple;
943 	u32 buffer_alignment;
944 };
945 
946 struct hfi_uncompressed_plane_info {
947 	u32 format;
948 	u32 num_planes;
949 	struct hfi_uncompressed_plane_constraints plane_constraints[1];
950 };
951 
952 struct hfi_uncompressed_format_supported {
953 	u32 buffer_type;
954 	u32 format_entries;
955 	struct hfi_uncompressed_plane_info plane_info[1];
956 };
957 
958 struct hfi_uncompressed_plane_actual {
959 	int actual_stride;
960 	u32 actual_plane_buffer_height;
961 };
962 
963 struct hfi_uncompressed_plane_actual_info {
964 	u32 buffer_type;
965 	u32 num_planes;
966 	struct hfi_uncompressed_plane_actual plane_format[2];
967 };
968 
969 struct hfi_uncompressed_plane_actual_constraints_info {
970 	u32 buffer_type;
971 	u32 num_planes;
972 	struct hfi_uncompressed_plane_constraints plane_format[2];
973 };
974 
975 struct hfi_codec_supported {
976 	u32 dec_codecs;
977 	u32 enc_codecs;
978 };
979 
980 struct hfi_properties_supported {
981 	u32 num_properties;
982 	u32 properties[1];
983 };
984 
985 struct hfi_max_sessions_supported {
986 	u32 max_sessions;
987 };
988 
989 #define HFI_MAX_MATRIX_COEFFS	9
990 #define HFI_MAX_BIAS_COEFFS	3
991 #define HFI_MAX_LIMIT_COEFFS	6
992 
993 struct hfi_vpe_color_space_conversion {
994 	u32 csc_matrix[HFI_MAX_MATRIX_COEFFS];
995 	u32 csc_bias[HFI_MAX_BIAS_COEFFS];
996 	u32 csc_limit[HFI_MAX_LIMIT_COEFFS];
997 };
998 
999 #define HFI_ROTATE_NONE		0x1
1000 #define HFI_ROTATE_90		0x2
1001 #define HFI_ROTATE_180		0x3
1002 #define HFI_ROTATE_270		0x4
1003 
1004 #define HFI_FLIP_NONE		0x1
1005 #define HFI_FLIP_HORIZONTAL	0x2
1006 #define HFI_FLIP_VERTICAL	0x3
1007 
1008 struct hfi_operations {
1009 	u32 rotate;
1010 	u32 flip;
1011 };
1012 
1013 #define HFI_RESOURCE_OCMEM	0x1
1014 
1015 struct hfi_resource_ocmem {
1016 	u32 size;
1017 	u32 mem;
1018 };
1019 
1020 struct hfi_resource_ocmem_requirement {
1021 	u32 session_domain;
1022 	u32 width;
1023 	u32 height;
1024 	u32 size;
1025 };
1026 
1027 struct hfi_resource_ocmem_requirement_info {
1028 	u32 num_entries;
1029 	struct hfi_resource_ocmem_requirement requirements[1];
1030 };
1031 
1032 struct hfi_property_sys_image_version_info_type {
1033 	u32 string_size;
1034 	u8  str_image_version[1];
1035 };
1036 
1037 struct hfi_codec_mask_supported {
1038 	u32 codecs;
1039 	u32 video_domains;
1040 };
1041 
1042 struct hfi_seq_header_info {
1043 	u32 max_hader_len;
1044 };
1045 
1046 struct hfi_aspect_ratio {
1047 	u32 aspect_width;
1048 	u32 aspect_height;
1049 };
1050 
1051 #define HFI_MVC_BUFFER_LAYOUT_TOP_BOTTOM	0
1052 #define HFI_MVC_BUFFER_LAYOUT_SIDEBYSIDE	1
1053 #define HFI_MVC_BUFFER_LAYOUT_SEQ		2
1054 
1055 struct hfi_mvc_buffer_layout_descp_type {
1056 	u32 layout_type;
1057 	u32 bright_view_first;
1058 	u32 ngap;
1059 };
1060 
1061 struct hfi_scs_threshold {
1062 	u32 threshold_value;
1063 };
1064 
1065 #define HFI_TEST_SSR_SW_ERR_FATAL	0x1
1066 #define HFI_TEST_SSR_SW_DIV_BY_ZERO	0x2
1067 #define HFI_TEST_SSR_HW_WDOG_IRQ	0x3
1068 
1069 struct hfi_buffer_alloc_mode {
1070 	u32 type;
1071 	u32 mode;
1072 };
1073 
1074 struct hfi_index_extradata_config {
1075 	u32 enable;
1076 	u32 index_extra_data_id;
1077 };
1078 
1079 struct hfi_extradata_header {
1080 	u32 size;
1081 	u32 version;
1082 	u32 port_index;
1083 	u32 type;
1084 	u32 data_size;
1085 	u8 data[1];
1086 };
1087 
1088 struct hfi_batch_info {
1089 	u32 input_batch_count;
1090 	u32 output_batch_count;
1091 };
1092 
1093 struct hfi_buffer_count_actual {
1094 	u32 type;
1095 	u32 count_actual;
1096 };
1097 
1098 struct hfi_buffer_count_actual_4xx {
1099 	u32 type;
1100 	u32 count_actual;
1101 	u32 count_min_host;
1102 };
1103 
1104 struct hfi_buffer_size_actual {
1105 	u32 type;
1106 	u32 size;
1107 };
1108 
1109 struct hfi_buffer_display_hold_count_actual {
1110 	u32 type;
1111 	u32 hold_count;
1112 };
1113 
1114 /* HFI 4XX reorder the fields, use these macros */
1115 #define HFI_BUFREQ_HOLD_COUNT(bufreq, ver)	\
1116 	((ver) == HFI_VERSION_4XX ? 0 : (bufreq)->hold_count)
1117 #define HFI_BUFREQ_COUNT_MIN(bufreq, ver)	\
1118 	((ver) == HFI_VERSION_4XX ? (bufreq)->hold_count : (bufreq)->count_min)
1119 #define HFI_BUFREQ_COUNT_MIN_HOST(bufreq, ver)	\
1120 	((ver) == HFI_VERSION_4XX ? (bufreq)->count_min : 0)
1121 
1122 struct hfi_buffer_requirements {
1123 	u32 type;
1124 	u32 size;
1125 	u32 region_size;
1126 	u32 hold_count;
1127 	u32 count_min;
1128 	u32 count_actual;
1129 	u32 contiguous;
1130 	u32 alignment;
1131 };
1132 
1133 struct hfi_data_payload {
1134 	u32 size;
1135 	u8 data[1];
1136 };
1137 
1138 struct hfi_enable_picture {
1139 	u32 picture_type;
1140 };
1141 
1142 struct hfi_display_picture_buffer_count {
1143 	int enable;
1144 	u32 count;
1145 };
1146 
1147 struct hfi_extra_data_header_config {
1148 	u32 type;
1149 	u32 buffer_type;
1150 	u32 version;
1151 	u32 port_index;
1152 	u32 client_extra_data_id;
1153 };
1154 
1155 struct hfi_interlace_format_supported {
1156 	u32 buffer_type;
1157 	u32 format;
1158 };
1159 
1160 struct hfi_buffer_alloc_mode_supported {
1161 	u32 buffer_type;
1162 	u32 num_entries;
1163 	u32 data[1];
1164 };
1165 
1166 struct hfi_mb_error_map {
1167 	u32 error_map_size;
1168 	u8 error_map[1];
1169 };
1170 
1171 struct hfi_metadata_pass_through {
1172 	int enable;
1173 	u32 size;
1174 };
1175 
1176 struct hfi_multi_view_select {
1177 	u32 view_index;
1178 };
1179 
1180 struct hfi_hybrid_hierp {
1181 	u32 layers;
1182 };
1183 
1184 struct hfi_pkt_hdr {
1185 	u32 size;
1186 	u32 pkt_type;
1187 };
1188 
1189 struct hfi_session_hdr_pkt {
1190 	struct hfi_pkt_hdr hdr;
1191 	u32 session_id;
1192 };
1193 
1194 struct hfi_session_pkt {
1195 	struct hfi_session_hdr_pkt shdr;
1196 };
1197 
1198 #endif
1199