• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2007-2019 Advanced Micro Devices, Inc.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sub license, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16  * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
17  * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  */
26 
27 /**
28 ****************************************************************************************************
29 * @file  addrtypes.h
30 * @brief Contains the helper function and constants
31 ****************************************************************************************************
32 */
33 #ifndef __ADDR_TYPES_H__
34 #define __ADDR_TYPES_H__
35 
36 #if defined(__APPLE__) && !defined(HAVE_TSERVER)
37 // External definitions header maintained by Apple driver team, but not for diag team under Mac.
38 // Helps address compilation issues & reduces code covered by NDA
39 #include "addrExtDef.h"
40 
41 #else
42 
43 // Windows and/or Linux
44 #if !defined(VOID)
45 typedef void           VOID;
46 #endif
47 
48 #if !defined(FLOAT)
49 typedef float          FLOAT;
50 #endif
51 
52 #if !defined(CHAR)
53 typedef char           CHAR;
54 #endif
55 
56 #if !defined(INT)
57 typedef int            INT;
58 #endif
59 
60 #include <stdarg.h> // va_list...etc need this header
61 
62 #endif // defined (__APPLE__) && !defined(HAVE_TSERVER)
63 
64 /**
65 ****************************************************************************************************
66 *   Calling conventions
67 ****************************************************************************************************
68 */
69 #ifndef ADDR_CDECL
70     #if defined(__GNUC__)
71         #define ADDR_CDECL __attribute__((cdecl))
72     #else
73         #define ADDR_CDECL __cdecl
74     #endif
75 #endif
76 
77 #ifndef ADDR_STDCALL
78     #if defined(__GNUC__)
79         #if defined(__amd64__) || defined(__x86_64__)
80             #define ADDR_STDCALL
81         #else
82             #define ADDR_STDCALL __attribute__((stdcall))
83         #endif
84     #else
85         #define ADDR_STDCALL __stdcall
86     #endif
87 #endif
88 
89 #ifndef ADDR_FASTCALL
90     #if defined(__GNUC__)
91         // We don't care about the performance of call instructions in addrlib
92         #define ADDR_FASTCALL
93     #else
94         #define ADDR_FASTCALL __fastcall
95     #endif
96 #endif
97 
98 #ifndef GC_CDECL
99     #define GC_CDECL  ADDR_CDECL
100 #endif
101 
102 #ifndef GC_STDCALL
103     #define GC_STDCALL  ADDR_STDCALL
104 #endif
105 
106 #ifndef GC_FASTCALL
107     #define GC_FASTCALL  ADDR_FASTCALL
108 #endif
109 
110 
111 #if defined(__GNUC__)
112     #define ADDR_INLINE static inline   // inline needs to be static to link
113 #else
114     // win32, win64, other platforms
115     #define ADDR_INLINE   __inline
116 #endif // #if defined(__GNUC__)
117 
118 #define ADDR_API ADDR_FASTCALL //default call convention is fast call
119 
120 /**
121 ****************************************************************************************************
122 * Global defines used by other modules
123 ****************************************************************************************************
124 */
125 #if !defined(TILEINDEX_INVALID)
126 #define TILEINDEX_INVALID                -1
127 #endif
128 
129 #if !defined(TILEINDEX_LINEAR_GENERAL)
130 #define TILEINDEX_LINEAR_GENERAL         -2
131 #endif
132 
133 #if !defined(TILEINDEX_LINEAR_ALIGNED)
134 #define TILEINDEX_LINEAR_ALIGNED          8
135 #endif
136 
137 /**
138 ****************************************************************************************************
139 * Return codes
140 ****************************************************************************************************
141 */
142 typedef enum _ADDR_E_RETURNCODE
143 {
144     // General Return
145     ADDR_OK    = 0,
146     ADDR_ERROR = 1,
147 
148     // Specific Errors
149     ADDR_OUTOFMEMORY,
150     ADDR_INVALIDPARAMS,
151     ADDR_NOTSUPPORTED,
152     ADDR_NOTIMPLEMENTED,
153     ADDR_PARAMSIZEMISMATCH,
154     ADDR_INVALIDGBREGVALUES,
155 
156 } ADDR_E_RETURNCODE;
157 
158 /**
159 ****************************************************************************************************
160 * @brief
161 *   Neutral enums that define tile modes for all H/W
162 * @note
163 *   R600/R800 tiling mode can be cast to hw enums directly but never cast into HW enum from
164 *   ADDR_TM_2D_TILED_XTHICK
165 *
166 ****************************************************************************************************
167 */
168 typedef enum _AddrTileMode
169 {
170     ADDR_TM_LINEAR_GENERAL      = 0,    ///< Least restrictions, pitch: multiple of 8 if not buffer
171     ADDR_TM_LINEAR_ALIGNED      = 1,    ///< Requests pitch or slice to be multiple of 64 pixels
172     ADDR_TM_1D_TILED_THIN1      = 2,    ///< Linear array of 8x8 tiles
173     ADDR_TM_1D_TILED_THICK      = 3,    ///< Linear array of 8x8x4 tiles
174     ADDR_TM_2D_TILED_THIN1      = 4,    ///< A set of macro tiles consist of 8x8 tiles
175     ADDR_TM_2D_TILED_THIN2      = 5,    ///< 600 HWL only, macro tile ratio is 1:4
176     ADDR_TM_2D_TILED_THIN4      = 6,    ///< 600 HWL only, macro tile ratio is 1:16
177     ADDR_TM_2D_TILED_THICK      = 7,    ///< A set of macro tiles consist of 8x8x4 tiles
178     ADDR_TM_2B_TILED_THIN1      = 8,    ///< 600 HWL only, with bank swap
179     ADDR_TM_2B_TILED_THIN2      = 9,    ///< 600 HWL only, with bank swap and ratio is 1:4
180     ADDR_TM_2B_TILED_THIN4      = 10,   ///< 600 HWL only, with bank swap and ratio is 1:16
181     ADDR_TM_2B_TILED_THICK      = 11,   ///< 600 HWL only, with bank swap, consists of 8x8x4 tiles
182     ADDR_TM_3D_TILED_THIN1      = 12,   ///< Macro tiling w/ pipe rotation between slices
183     ADDR_TM_3D_TILED_THICK      = 13,   ///< Macro tiling w/ pipe rotation bwtween slices, thick
184     ADDR_TM_3B_TILED_THIN1      = 14,   ///< 600 HWL only, with bank swap
185     ADDR_TM_3B_TILED_THICK      = 15,   ///< 600 HWL only, with bank swap, thick
186     ADDR_TM_2D_TILED_XTHICK     = 16,   ///< Tile is 8x8x8, valid from NI
187     ADDR_TM_3D_TILED_XTHICK     = 17,   ///< Tile is 8x8x8, valid from NI
188     ADDR_TM_POWER_SAVE          = 18,   ///< Power save mode, only used by KMD on NI
189     ADDR_TM_PRT_TILED_THIN1     = 19,   ///< No bank/pipe rotation or hashing beyond macrotile size
190     ADDR_TM_PRT_2D_TILED_THIN1  = 20,   ///< Same as 2D_TILED_THIN1, PRT only
191     ADDR_TM_PRT_3D_TILED_THIN1  = 21,   ///< Same as 3D_TILED_THIN1, PRT only
192     ADDR_TM_PRT_TILED_THICK     = 22,   ///< No bank/pipe rotation or hashing beyond macrotile size
193     ADDR_TM_PRT_2D_TILED_THICK  = 23,   ///< Same as 2D_TILED_THICK, PRT only
194     ADDR_TM_PRT_3D_TILED_THICK  = 24,   ///< Same as 3D_TILED_THICK, PRT only
195     ADDR_TM_UNKNOWN             = 25,   ///< Unkown tile mode, should be decided by address lib
196     ADDR_TM_COUNT               = 26,   ///< Must be the value of the last tile mode
197 } AddrTileMode;
198 
199 /**
200 ****************************************************************************************************
201 * @brief
202 *   Neutral enums that define swizzle modes for Gfx9+ ASIC
203 * @note
204 *
205 *   ADDR_SW_LINEAR linear aligned addressing mode, for 1D/2D/3D resource
206 *   ADDR_SW_256B_* addressing block aligned size is 256B, for 2D resource
207 *   ADDR_SW_4KB_*  addressing block aligned size is 4KB, for 2D/3D resource
208 *   ADDR_SW_64KB_* addressing block aligned size is 64KB, for 1D/2D/3D resource
209 *   ADDR_SW_VAR_*  addressing block aligned size is ASIC specific
210 *
211 *   ADDR_SW_*_Z    For GFX9:
212                    - for 2D resource, represents Z-order swizzle mode for depth/stencil/FMask
213                    - for 3D resource, represents a swizzle mode similar to legacy thick tile mode
214                    For GFX10:
215                    - represents Z-order swizzle mode for depth/stencil/FMask
216 *   ADDR_SW_*_S    For GFX9+:
217                    - represents standard swizzle mode defined by MS
218 *   ADDR_SW_*_D    For GFX9:
219                    - for 2D resource, represents a swizzle mode for displayable resource
220 *                  - for 3D resource, represents a swizzle mode which places each slice in order & pixel
221                    For GFX10:
222                    - for 2D resource, represents a swizzle mode for displayable resource
223                    - for 3D resource, represents a swizzle mode similar to legacy thick tile mode
224                    within slice is placed as 2D ADDR_SW_*_S. Don't use this combination if possible!
225 *   ADDR_SW_*_R    For GFX9:
226                    - 2D resource only, represents a swizzle mode for rotated displayable resource
227                    For GFX10:
228                    - represents a swizzle mode for render target resource
229 *
230 ****************************************************************************************************
231 */
232 typedef enum _AddrSwizzleMode
233 {
234     ADDR_SW_LINEAR          = 0,
235     ADDR_SW_256B_S          = 1,
236     ADDR_SW_256B_D          = 2,
237     ADDR_SW_256B_R          = 3,
238     ADDR_SW_4KB_Z           = 4,
239     ADDR_SW_4KB_S           = 5,
240     ADDR_SW_4KB_D           = 6,
241     ADDR_SW_4KB_R           = 7,
242     ADDR_SW_64KB_Z          = 8,
243     ADDR_SW_64KB_S          = 9,
244     ADDR_SW_64KB_D          = 10,
245     ADDR_SW_64KB_R          = 11,
246     ADDR_SW_MISCDEF12       = 12,
247     ADDR_SW_MISCDEF13       = 13,
248     ADDR_SW_MISCDEF14       = 14,
249     ADDR_SW_MISCDEF15       = 15,
250     ADDR_SW_64KB_Z_T        = 16,
251     ADDR_SW_64KB_S_T        = 17,
252     ADDR_SW_64KB_D_T        = 18,
253     ADDR_SW_64KB_R_T        = 19,
254     ADDR_SW_4KB_Z_X         = 20,
255     ADDR_SW_4KB_S_X         = 21,
256     ADDR_SW_4KB_D_X         = 22,
257     ADDR_SW_4KB_R_X         = 23,
258     ADDR_SW_64KB_Z_X        = 24,
259     ADDR_SW_64KB_S_X        = 25,
260     ADDR_SW_64KB_D_X        = 26,
261     ADDR_SW_64KB_R_X        = 27,
262     ADDR_SW_MISCDEF28       = 28,
263     ADDR_SW_MISCDEF29       = 29,
264     ADDR_SW_MISCDEF30       = 30,
265     ADDR_SW_MISCDEF31       = 31,
266     ADDR_SW_LINEAR_GENERAL  = 32,
267     ADDR_SW_MAX_TYPE        = 33,
268 
269     ADDR_SW_RESERVED0       = ADDR_SW_MISCDEF12,
270     ADDR_SW_RESERVED1       = ADDR_SW_MISCDEF13,
271     ADDR_SW_RESERVED2       = ADDR_SW_MISCDEF14,
272     ADDR_SW_RESERVED3       = ADDR_SW_MISCDEF15,
273     ADDR_SW_RESERVED4       = ADDR_SW_MISCDEF29,
274     ADDR_SW_RESERVED5       = ADDR_SW_MISCDEF30,
275 
276     ADDR_SW_VAR_Z_X         = ADDR_SW_MISCDEF28,
277     ADDR_SW_VAR_R_X         = ADDR_SW_MISCDEF31,
278 
279 } AddrSwizzleMode;
280 
281 /**
282 ****************************************************************************************************
283 * @brief
284 *   Neutral enums that define image type
285 * @note
286 *   this is new for address library interface version 2
287 *
288 ****************************************************************************************************
289 */
290 typedef enum _AddrResourceType
291 {
292     ADDR_RSRC_TEX_1D = 0,
293     ADDR_RSRC_TEX_2D = 1,
294     ADDR_RSRC_TEX_3D = 2,
295     ADDR_RSRC_MAX_TYPE = 3,
296 } AddrResourceType;
297 
298 /**
299 ****************************************************************************************************
300 * @brief
301 *   Neutral enums that define resource heap location
302 * @note
303 *   this is new for address library interface version 2
304 *
305 ****************************************************************************************************
306 */
307 typedef enum _AddrResrouceLocation
308 {
309     ADDR_RSRC_LOC_UNDEF  = 0,   // Resource heap is undefined/unknown
310     ADDR_RSRC_LOC_LOCAL  = 1,   // CPU visable and CPU invisable local heap
311     ADDR_RSRC_LOC_USWC   = 2,   // CPU write-combined non-cached nonlocal heap
312     ADDR_RSRC_LOC_CACHED = 3,   // CPU cached nonlocal heap
313     ADDR_RSRC_LOC_INVIS  = 4,   // CPU invisable local heap only
314     ADDR_RSRC_LOC_MAX_TYPE = 5,
315 } AddrResrouceLocation;
316 
317 /**
318 ****************************************************************************************************
319 * @brief
320 *   Neutral enums that define resource basic swizzle mode
321 * @note
322 *   this is new for address library interface version 2
323 *
324 ****************************************************************************************************
325 */
326 typedef enum _AddrSwType
327 {
328     ADDR_SW_Z  = 0,   // Resource basic swizzle mode is ZOrder
329     ADDR_SW_S  = 1,   // Resource basic swizzle mode is Standard
330     ADDR_SW_D  = 2,   // Resource basic swizzle mode is Display
331     ADDR_SW_R  = 3,   // Resource basic swizzle mode is Rotated/Render optimized
332     ADDR_SW_L  = 4,   // Resource basic swizzle mode is Linear
333     ADDR_SW_MAX_SWTYPE
334 } AddrSwType;
335 
336 /**
337 ****************************************************************************************************
338 * @brief
339 *   Neutral enums that define mipmap major mode
340 * @note
341 *   this is new for address library interface version 2
342 *
343 ****************************************************************************************************
344 */
345 typedef enum _AddrMajorMode
346 {
347     ADDR_MAJOR_X = 0,
348     ADDR_MAJOR_Y = 1,
349     ADDR_MAJOR_Z = 2,
350     ADDR_MAJOR_MAX_TYPE = 3,
351 } AddrMajorMode;
352 
353 /**
354 ****************************************************************************************************
355 *   AddrFormat
356 *
357 *   @brief
358 *       Neutral enum for SurfaceFormat
359 *
360 ****************************************************************************************************
361 */
362 typedef enum _AddrFormat {
363     ADDR_FMT_INVALID                              = 0x00000000,
364     ADDR_FMT_8                                    = 0x00000001,
365     ADDR_FMT_4_4                                  = 0x00000002,
366     ADDR_FMT_3_3_2                                = 0x00000003,
367     ADDR_FMT_RESERVED_4                           = 0x00000004,
368     ADDR_FMT_16                                   = 0x00000005,
369     ADDR_FMT_16_FLOAT                             = ADDR_FMT_16,
370     ADDR_FMT_8_8                                  = 0x00000007,
371     ADDR_FMT_5_6_5                                = 0x00000008,
372     ADDR_FMT_6_5_5                                = 0x00000009,
373     ADDR_FMT_1_5_5_5                              = 0x0000000a,
374     ADDR_FMT_4_4_4_4                              = 0x0000000b,
375     ADDR_FMT_5_5_5_1                              = 0x0000000c,
376     ADDR_FMT_32                                   = 0x0000000d,
377     ADDR_FMT_32_FLOAT                             = ADDR_FMT_32,
378     ADDR_FMT_16_16                                = 0x0000000f,
379     ADDR_FMT_16_16_FLOAT                          = ADDR_FMT_16_16,
380     ADDR_FMT_8_24                                 = 0x00000011,
381     ADDR_FMT_8_24_FLOAT                           = ADDR_FMT_8_24,
382     ADDR_FMT_24_8                                 = 0x00000013,
383     ADDR_FMT_24_8_FLOAT                           = ADDR_FMT_24_8,
384     ADDR_FMT_10_11_11                             = 0x00000015,
385     ADDR_FMT_10_11_11_FLOAT                       = ADDR_FMT_10_11_11,
386     ADDR_FMT_11_11_10                             = 0x00000017,
387     ADDR_FMT_11_11_10_FLOAT                       = ADDR_FMT_11_11_10,
388     ADDR_FMT_2_10_10_10                           = 0x00000019,
389     ADDR_FMT_8_8_8_8                              = 0x0000001a,
390     ADDR_FMT_10_10_10_2                           = 0x0000001b,
391     ADDR_FMT_X24_8_32_FLOAT                       = 0x0000001c,
392     ADDR_FMT_32_32                                = 0x0000001d,
393     ADDR_FMT_32_32_FLOAT                          = ADDR_FMT_32_32,
394     ADDR_FMT_16_16_16_16                          = 0x0000001f,
395     ADDR_FMT_16_16_16_16_FLOAT                    = ADDR_FMT_16_16_16_16,
396     ADDR_FMT_RESERVED_33                          = 0x00000021,
397     ADDR_FMT_32_32_32_32                          = 0x00000022,
398     ADDR_FMT_32_32_32_32_FLOAT                    = ADDR_FMT_32_32_32_32,
399     ADDR_FMT_RESERVED_36                          = 0x00000024,
400     ADDR_FMT_1                                    = 0x00000025,
401     ADDR_FMT_1_REVERSED                           = 0x00000026,
402     ADDR_FMT_GB_GR                                = 0x00000027,
403     ADDR_FMT_BG_RG                                = 0x00000028,
404     ADDR_FMT_32_AS_8                              = 0x00000029,
405     ADDR_FMT_32_AS_8_8                            = 0x0000002a,
406     ADDR_FMT_5_9_9_9_SHAREDEXP                    = 0x0000002b,
407     ADDR_FMT_8_8_8                                = 0x0000002c,
408     ADDR_FMT_16_16_16                             = 0x0000002d,
409     ADDR_FMT_16_16_16_FLOAT                       = ADDR_FMT_16_16_16,
410     ADDR_FMT_32_32_32                             = 0x0000002f,
411     ADDR_FMT_32_32_32_FLOAT                       = ADDR_FMT_32_32_32,
412     ADDR_FMT_BC1                                  = 0x00000031,
413     ADDR_FMT_BC2                                  = 0x00000032,
414     ADDR_FMT_BC3                                  = 0x00000033,
415     ADDR_FMT_BC4                                  = 0x00000034,
416     ADDR_FMT_BC5                                  = 0x00000035,
417     ADDR_FMT_BC6                                  = 0x00000036,
418     ADDR_FMT_BC7                                  = 0x00000037,
419     ADDR_FMT_32_AS_32_32_32_32                    = 0x00000038,
420     ADDR_FMT_APC3                                 = 0x00000039,
421     ADDR_FMT_APC4                                 = 0x0000003a,
422     ADDR_FMT_APC5                                 = 0x0000003b,
423     ADDR_FMT_APC6                                 = 0x0000003c,
424     ADDR_FMT_APC7                                 = 0x0000003d,
425     ADDR_FMT_CTX1                                 = 0x0000003e,
426     ADDR_FMT_RESERVED_63                          = 0x0000003f,
427     ADDR_FMT_ASTC_4x4                             = 0x00000040,
428     ADDR_FMT_ASTC_5x4                             = 0x00000041,
429     ADDR_FMT_ASTC_5x5                             = 0x00000042,
430     ADDR_FMT_ASTC_6x5                             = 0x00000043,
431     ADDR_FMT_ASTC_6x6                             = 0x00000044,
432     ADDR_FMT_ASTC_8x5                             = 0x00000045,
433     ADDR_FMT_ASTC_8x6                             = 0x00000046,
434     ADDR_FMT_ASTC_8x8                             = 0x00000047,
435     ADDR_FMT_ASTC_10x5                            = 0x00000048,
436     ADDR_FMT_ASTC_10x6                            = 0x00000049,
437     ADDR_FMT_ASTC_10x8                            = 0x0000004a,
438     ADDR_FMT_ASTC_10x10                           = 0x0000004b,
439     ADDR_FMT_ASTC_12x10                           = 0x0000004c,
440     ADDR_FMT_ASTC_12x12                           = 0x0000004d,
441     ADDR_FMT_ETC2_64BPP                           = 0x0000004e,
442     ADDR_FMT_ETC2_128BPP                          = 0x0000004f,
443 } AddrFormat;
444 
445 /**
446 ****************************************************************************************************
447 *   AddrDepthFormat
448 *
449 *   @brief
450 *       Neutral enum for addrFlt32ToDepthPixel
451 *
452 ****************************************************************************************************
453 */
454 typedef enum _AddrDepthFormat
455 {
456     ADDR_DEPTH_INVALID                            = 0x00000000,
457     ADDR_DEPTH_16                                 = 0x00000001,
458     ADDR_DEPTH_X8_24                              = 0x00000002,
459     ADDR_DEPTH_8_24                               = 0x00000003,
460     ADDR_DEPTH_X8_24_FLOAT                        = 0x00000004,
461     ADDR_DEPTH_8_24_FLOAT                         = 0x00000005,
462     ADDR_DEPTH_32_FLOAT                           = 0x00000006,
463     ADDR_DEPTH_X24_8_32_FLOAT                     = 0x00000007,
464 
465 } AddrDepthFormat;
466 
467 /**
468 ****************************************************************************************************
469 *   AddrColorFormat
470 *
471 *   @brief
472 *       Neutral enum for ColorFormat
473 *
474 ****************************************************************************************************
475 */
476 typedef enum _AddrColorFormat
477 {
478     ADDR_COLOR_INVALID                            = 0x00000000,
479     ADDR_COLOR_8                                  = 0x00000001,
480     ADDR_COLOR_4_4                                = 0x00000002,
481     ADDR_COLOR_3_3_2                              = 0x00000003,
482     ADDR_COLOR_RESERVED_4                         = 0x00000004,
483     ADDR_COLOR_16                                 = 0x00000005,
484     ADDR_COLOR_16_FLOAT                           = 0x00000006,
485     ADDR_COLOR_8_8                                = 0x00000007,
486     ADDR_COLOR_5_6_5                              = 0x00000008,
487     ADDR_COLOR_6_5_5                              = 0x00000009,
488     ADDR_COLOR_1_5_5_5                            = 0x0000000a,
489     ADDR_COLOR_4_4_4_4                            = 0x0000000b,
490     ADDR_COLOR_5_5_5_1                            = 0x0000000c,
491     ADDR_COLOR_32                                 = 0x0000000d,
492     ADDR_COLOR_32_FLOAT                           = 0x0000000e,
493     ADDR_COLOR_16_16                              = 0x0000000f,
494     ADDR_COLOR_16_16_FLOAT                        = 0x00000010,
495     ADDR_COLOR_8_24                               = 0x00000011,
496     ADDR_COLOR_8_24_FLOAT                         = 0x00000012,
497     ADDR_COLOR_24_8                               = 0x00000013,
498     ADDR_COLOR_24_8_FLOAT                         = 0x00000014,
499     ADDR_COLOR_10_11_11                           = 0x00000015,
500     ADDR_COLOR_10_11_11_FLOAT                     = 0x00000016,
501     ADDR_COLOR_11_11_10                           = 0x00000017,
502     ADDR_COLOR_11_11_10_FLOAT                     = 0x00000018,
503     ADDR_COLOR_2_10_10_10                         = 0x00000019,
504     ADDR_COLOR_8_8_8_8                            = 0x0000001a,
505     ADDR_COLOR_10_10_10_2                         = 0x0000001b,
506     ADDR_COLOR_X24_8_32_FLOAT                     = 0x0000001c,
507     ADDR_COLOR_32_32                              = 0x0000001d,
508     ADDR_COLOR_32_32_FLOAT                        = 0x0000001e,
509     ADDR_COLOR_16_16_16_16                        = 0x0000001f,
510     ADDR_COLOR_16_16_16_16_FLOAT                  = 0x00000020,
511     ADDR_COLOR_RESERVED_33                        = 0x00000021,
512     ADDR_COLOR_32_32_32_32                        = 0x00000022,
513     ADDR_COLOR_32_32_32_32_FLOAT                  = 0x00000023,
514 } AddrColorFormat;
515 
516 /**
517 ****************************************************************************************************
518 *   AddrSurfaceNumber
519 *
520 *   @brief
521 *       Neutral enum for SurfaceNumber
522 *
523 ****************************************************************************************************
524 */
525 typedef enum _AddrSurfaceNumber {
526     ADDR_NUMBER_UNORM                             = 0x00000000,
527     ADDR_NUMBER_SNORM                             = 0x00000001,
528     ADDR_NUMBER_USCALED                           = 0x00000002,
529     ADDR_NUMBER_SSCALED                           = 0x00000003,
530     ADDR_NUMBER_UINT                              = 0x00000004,
531     ADDR_NUMBER_SINT                              = 0x00000005,
532     ADDR_NUMBER_SRGB                              = 0x00000006,
533     ADDR_NUMBER_FLOAT                             = 0x00000007,
534 } AddrSurfaceNumber;
535 
536 /**
537 ****************************************************************************************************
538 *   AddrSurfaceSwap
539 *
540 *   @brief
541 *       Neutral enum for SurfaceSwap
542 *
543 ****************************************************************************************************
544 */
545 typedef enum _AddrSurfaceSwap {
546     ADDR_SWAP_STD                                 = 0x00000000,
547     ADDR_SWAP_ALT                                 = 0x00000001,
548     ADDR_SWAP_STD_REV                             = 0x00000002,
549     ADDR_SWAP_ALT_REV                             = 0x00000003,
550 } AddrSurfaceSwap;
551 
552 /**
553 ****************************************************************************************************
554 *   AddrHtileBlockSize
555 *
556 *   @brief
557 *       Size of HTILE blocks, valid values are 4 or 8 for now
558 ****************************************************************************************************
559 */
560 typedef enum _AddrHtileBlockSize
561 {
562     ADDR_HTILE_BLOCKSIZE_4 = 4,
563     ADDR_HTILE_BLOCKSIZE_8 = 8,
564 } AddrHtileBlockSize;
565 
566 
567 /**
568 ****************************************************************************************************
569 *   AddrPipeCfg
570 *
571 *   @brief
572 *       The pipe configuration field specifies both the number of pipes and
573 *       how pipes are interleaved on the surface.
574 *       The expression of number of pipes, the shader engine tile size, and packer tile size
575 *       is encoded in a PIPE_CONFIG register field.
576 *       In general the number of pipes usually matches the number of memory channels of the
577 *       hardware configuration.
578 *       For hw configurations w/ non-pow2 memory number of memory channels, it usually matches
579 *       the number of ROP units(? TODO: which registers??)
580 *       The enum value = hw enum + 1 which is to reserve 0 for requesting default.
581 ****************************************************************************************************
582 */
583 typedef enum _AddrPipeCfg
584 {
585     ADDR_PIPECFG_INVALID              = 0,
586     ADDR_PIPECFG_P2                   = 1, /// 2 pipes,
587     ADDR_PIPECFG_P4_8x16              = 5, /// 4 pipes,
588     ADDR_PIPECFG_P4_16x16             = 6,
589     ADDR_PIPECFG_P4_16x32             = 7,
590     ADDR_PIPECFG_P4_32x32             = 8,
591     ADDR_PIPECFG_P8_16x16_8x16        = 9, /// 8 pipes
592     ADDR_PIPECFG_P8_16x32_8x16        = 10,
593     ADDR_PIPECFG_P8_32x32_8x16        = 11,
594     ADDR_PIPECFG_P8_16x32_16x16       = 12,
595     ADDR_PIPECFG_P8_32x32_16x16       = 13,
596     ADDR_PIPECFG_P8_32x32_16x32       = 14,
597     ADDR_PIPECFG_P8_32x64_32x32       = 15,
598     ADDR_PIPECFG_P16_32x32_8x16       = 17, /// 16 pipes
599     ADDR_PIPECFG_P16_32x32_16x16      = 18,
600     ADDR_PIPECFG_UNUSED               = 19,
601     ADDR_PIPECFG_MAX                  = 20,
602 } AddrPipeCfg;
603 
604 /**
605 ****************************************************************************************************
606 * AddrTileType
607 *
608 *   @brief
609 *       Neutral enums that specifies micro tile type (MICRO_TILE_MODE)
610 ****************************************************************************************************
611 */
612 typedef enum _AddrTileType
613 {
614     ADDR_DISPLAYABLE        = 0,    ///< Displayable tiling
615     ADDR_NON_DISPLAYABLE    = 1,    ///< Non-displayable tiling, a.k.a thin micro tiling
616     ADDR_DEPTH_SAMPLE_ORDER = 2,    ///< Same as non-displayable plus depth-sample-order
617     ADDR_ROTATED            = 3,    ///< Rotated displayable tiling
618     ADDR_THICK              = 4,    ///< Thick micro-tiling, only valid for THICK and XTHICK
619 } AddrTileType;
620 
621 ////////////////////////////////////////////////////////////////////////////////////////////////////
622 //
623 //  Type definitions: short system-independent names for address library types
624 //
625 ////////////////////////////////////////////////////////////////////////////////////////////////////
626 
627 #if !defined(__APPLE__) || defined(HAVE_TSERVER)
628 
629 #ifndef BOOL_32        // no bool type in C
630 /// @brief Boolean type, since none is defined in C
631 /// @ingroup type
632 #define BOOL_32 int
633 #endif
634 
635 #ifndef INT_32
636 #define INT_32  int
637 #endif
638 
639 #ifndef UINT_32
640 #define UINT_32 unsigned int
641 #endif
642 
643 #ifndef INT_16
644 #define INT_16  short
645 #endif
646 
647 #ifndef UINT_16
648 #define UINT_16 unsigned short
649 #endif
650 
651 #ifndef INT_8
652 #define INT_8   char
653 #endif
654 
655 #ifndef UINT_8
656 #define UINT_8  unsigned char
657 #endif
658 
659 #ifndef NULL
660 #define NULL 0
661 #endif
662 
663 #ifndef TRUE
664 #define TRUE 1
665 #endif
666 
667 #ifndef FALSE
668 #define FALSE 0
669 #endif
670 
671 //
672 //  64-bit integer types depend on the compiler
673 //
674 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
675 #define INT_64   long long
676 #define UINT_64  unsigned long long
677 
678 #elif defined( _WIN32 )
679 #define INT_64   __int64
680 #define UINT_64  unsigned __int64
681 
682 #else
683 #error Unsupported compiler and/or operating system for 64-bit integers
684 
685 /// @brief 64-bit signed integer type (compiler dependent)
686 /// @ingroup type
687 ///
688 /// The addrlib defines a 64-bit signed integer type for either
689 /// Gnu/Watcom compilers (which use the first syntax) or for
690 /// the Windows VCC compiler (which uses the second syntax).
691 #define INT_64  long long OR __int64
692 
693 /// @brief 64-bit unsigned integer type (compiler dependent)
694 /// @ingroup type
695 ///
696 /// The addrlib defines a 64-bit unsigned integer type for either
697 /// Gnu/Watcom compilers (which use the first syntax) or for
698 /// the Windows VCC compiler (which uses the second syntax).
699 ///
700 #define UINT_64  unsigned long long OR unsigned __int64
701 #endif
702 
703 #endif // #if !defined(__APPLE__) || defined(HAVE_TSERVER)
704 
705 //  ADDR64X is used to print addresses in hex form on both Windows and Linux
706 //
707 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
708 #define ADDR64X "llx"
709 #define ADDR64D "lld"
710 
711 #elif defined( _WIN32 )
712 #define ADDR64X "I64x"
713 #define ADDR64D "I64d"
714 
715 #else
716 #error Unsupported compiler and/or operating system for 64-bit integers
717 
718 /// @brief Addrlib device address 64-bit printf tag  (compiler dependent)
719 /// @ingroup type
720 ///
721 /// This allows printf to display an ADDR_64 for either the Windows VCC compiler
722 /// (which used this value) or the Gnu/Watcom compilers (which use "llx".
723 /// An example of use is printf("addr 0x%"ADDR64X"\n", address);
724 ///
725 #define ADDR64X "llx" OR "I64x"
726 #define ADDR64D "lld" OR "I64d"
727 #endif
728 
729 
730 /// @brief Union for storing a 32-bit float or 32-bit integer
731 /// @ingroup type
732 ///
733 /// This union provides a simple way to convert between a 32-bit float
734 /// and a 32-bit integer. It also prevents the compiler from producing
735 /// code that alters NaN values when assiging or coying floats.
736 /// Therefore, all address library routines that pass or return 32-bit
737 /// floating point data do so by passing or returning a FLT_32.
738 ///
739 typedef union {
740     INT_32   i;
741     UINT_32  u;
742     float    f;
743 } ADDR_FLT_32;
744 
745 
746 ////////////////////////////////////////////////////////////////////////////////////////////////////
747 //
748 //  Macros for controlling linking and building on multiple systems
749 //
750 ////////////////////////////////////////////////////////////////////////////////////////////////////
751 #if defined(_MSC_VER)
752 #if defined(va_copy)
753 #undef va_copy  //redefine va_copy to support VC2013
754 #endif
755 #endif
756 
757 #if !defined(va_copy)
758 #define va_copy(dst, src) \
759     ((void) memcpy(&(dst), &(src), sizeof(va_list)))
760 #endif
761 
762 #endif // __ADDR_TYPES_H__
763 
764