xref: /aosp_15_r20/external/gmmlib/Source/GmmLib/inc/External/Common/GmmCommonExt.h (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 /*==============================================================================
2 Copyright(c) 2017 Intel Corporation
3 
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files(the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and / or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21 ============================================================================*/
22 
23 #pragma once
24 
25 //===========================================================================
26 // Macros to be defined for GMM Lib DLL
27 //===========================================================================
28 #ifdef GMM_LIB_DLL                                      /* To be defined by Clients if GMMlib needs to be in DLL/so */
29 
30 #define GMM_INLINE_VIRTUAL              virtual
31 
32 #define GMM_VIRTUAL                     virtual
33 
34 #define GMM_INLINE_EXPORTED                                            /* Macro To avoid inlining of exported member functions in Client’s code in DLL mode*/
35 
36 #define GMM_LIB_DLL_MA                  1               // Macro to indicate whether GMM Lib DLL is Multi-Adapter capable. Todo: Make this a build macro
37 
38 #ifdef _WIN32
39 
40     #ifdef GMM_LIB_DLL_EXPORTS
41         #define GMM_LIB_API                     __declspec(dllexport)   /* Macro to define GMM Lib DLL exports */
42     #else
43         #define GMM_LIB_API                     __declspec(dllimport)       /* Macro to define GMM Lib DLL imports */
44     #endif  /* GMM_LIB_DLL_EXPORTS */
45 
46 #define GMM_LIB_API_CONSTRUCTOR
47 #define GMM_LIB_API_DESTRUCTOR
48 
49 #else // Linux
50     #ifdef GMM_LIB_DLL_EXPORTS
51         #define GMM_LIB_API                     __attribute__ ((visibility ("default")))
52     #else
53         #define GMM_LIB_API
54     #endif
55 
56 #define GMM_LIB_API_CONSTRUCTOR             __attribute__((constructor))
57 #define GMM_LIB_API_DESTRUCTOR              __attribute__((destructor))
58 
59 #endif
60 
61 #else // !GMM_LIB_DLL
62 
63 #define GMM_INLINE_VIRTUAL
64 #define GMM_VIRTUAL
65 #define GMM_LIB_API
66 #define GMM_INLINE_EXPORTED __inline
67 
68 #endif  /* GMM_LIB_DLL */
69 
70 
71 #define INCLUDE_CpuSwizzleBlt_c_AS_HEADER
72 #include "../../../Utility/CpuSwizzleBlt/CpuSwizzleBlt.c"
73 extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_8bpp;
74 extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_16_32bpp;
75 extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_64_128bpp;
76 
77 // Set packing alignment
78 #pragma pack(push, 8)
79 
80 #if defined(__ARM_ARCH)
81 #define GMM_STDCALL            // GMM function calling convention
82 #else
83 #define GMM_STDCALL             __stdcall   // GMM function calling convention
84 #endif
85 #define GMM_NO_FENCE_REG        0xDEADBEEF
86 #define GMM_MAX_DISPLAYS        3
87 
88 #if defined __linux__
89 typedef void* HANDLE;
90 #endif
91 
92 //===========================================================================
93 // typedef:
94 //      GMM_GFX_ADDRESS/etc.
95 //
96 // Description:
97 //     The GMM GfxAddr/Size and related types and casting functions.
98 //----------------------------------------------------------------------------
99 // Always use x64 (D3D11.2 Tiled Resources needs >32 bit gfx address space)
100 typedef uint64_t  GMM_GFX_ADDRESS, GMM_GFX_SIZE_T, GMM_VOIDPTR64;
101 #define GMM_GFX_ADDRESS_MAX ((GMM_GFX_ADDRESS) 0xffffffffffffffff)
102 
103 typedef uint32_t GMM_GLOBAL_GFX_ADDRESS, GMM_GLOBAL_GFX_SIZE_T;
104 #define GMM_GLOBAL_GFX_ADDRESS_MAX ((GMM_GLOBAL_GFX_ADDRESS) 0xffffffff)
105 
106 #ifdef _DEBUG
107     #define GMM_GFX_ADDRESS_CAST(x)     \
108     (                                   \
109         ((x) <= GMM_GFX_ADDRESS_MAX) ?  \
110             1 : __debugbreak(),         \
111         (GMM_GFX_ADDRESS)(x)            \
112     )
113     #define GMM_GFX_SIZE_T_CAST GMM_GFX_ADDRESS_CAST
114 
115     #define GMM_GLOBAL_GFX_ADDRESS_CAST(x)      \
116     (                                           \
117         ((x) <= GMM_GLOBAL_GFX_ADDRESS_MAX) ?   \
118             1 : __debugbreak(),                 \
119         (GMM_GLOBAL_GFX_ADDRESS)(x)             \
120     )
121     #define GMM_GLOBAL_GFX_SIZE_T_CAST GMM_GLOBAL_GFX_ADDRESS_CAST
122 #else
123     #define GMM_GFX_ADDRESS_CAST(x)         ((GMM_GFX_ADDRESS)(x))
124     #define GMM_GFX_SIZE_T_CAST(x)          ((GMM_GFX_SIZE_T)(x))
125     #define GMM_GLOBAL_GFX_ADDRESS_CAST(x)  ((GMM_GLOBAL_GFX_ADDRESS)(x))
126     #define GMM_GLOBAL_GFX_SIZE_T_CAST(x)   ((GMM_GLOBAL_GFX_SIZE_T)(x))
127 #endif
128 
129 #define GMM_GFX_ADDRESS_CANONIZE(a)     (((int64_t)(a) << (64 - 48)) >> (64 - 48)) // TODO(Minor): When GMM adds platform-dependent VA size caps, change from 48.
130 #define GMM_GFX_ADDRESS_DECANONIZE(a)   ((uint64_t)(a) & (((uint64_t) 1 << 48) - 1)) // "
131 
132 #define GMM_GFX_PLATFORM_VA_SIZE(pClientContext)        (((pClientContext)->GetLibContext()->GetSkuTable().Ftr57bGPUAddressing) ? 57 : 48)
133 #define VASize(pCC)                                     GMM_GFX_PLATFORM_VA_SIZE(pCC)
134 
135 #define GMM_BIT_RANGE(endbit, startbit) ((endbit) - (startbit) + 1)
136 #define GMM_BIT(bit)                    (1)
137 
138 #define GMM_GET_PTE_BITS_FROM_PAT_IDX(idx)         ((((idx)&__BIT(4))   ? __BIT64(61)   : 0) |  \
139                                                     (((idx)&__BIT(3))   ? __BIT64(62)   : 0) |  \
140                                                     (((idx)&__BIT(2))   ? __BIT64(7)    : 0) |  \
141                                                     (((idx)&__BIT(1))   ? __BIT64(4)    : 0) |  \
142                                                     (((idx)&__BIT(0))   ? __BIT64(3)    : 0) )
143 
144 #define GMM_GET_PAT_IDX_FROM_PTE_BITS(Entry)       ((((Entry) & __BIT64(61))    ? __BIT(4) : 0) |  \
145                                                     (((Entry) & __BIT64(62))    ? __BIT(3) : 0) |  \
146                                                     (((Entry) & __BIT64(7))     ? __BIT(2) : 0) |  \
147                                                     (((Entry) & __BIT64(4))     ? __BIT(1) : 0) |  \
148                                                     (((Entry) & __BIT64(3))     ? __BIT(0) : 0) )
149 
150 #define GMM_GET_PAT_IDX_FROM_PTE_BITS_GGTT(Entry)  ((((Entry) & __BIT64(53))    ? __BIT(1) : 0) | \
151                                                     (((Entry) & __BIT64(52))    ? __BIT(0) : 0) )
152 
153 #define GMM_GET_PTE_BITS_FROM_PAT_IDX(idx)         ((((idx)&__BIT(4))   ? __BIT64(61)   : 0) |  \
154                                                     (((idx)&__BIT(3))   ? __BIT64(62)   : 0) |  \
155                                                     (((idx)&__BIT(2))   ? __BIT64(7)    : 0) |  \
156                                                     (((idx)&__BIT(1))   ? __BIT64(4)    : 0) |  \
157                                                     (((idx)&__BIT(0))   ? __BIT64(3)    : 0) )
158 
159 #define GMM_GET_PTE_BITS_FROM_PAT_IDX_LEAF_PD(idx) ((((idx)&__BIT(4))   ? __BIT64(61)   : 0) |  \
160                                                     (((idx)&__BIT(3))   ? __BIT64(62)   : 0) |  \
161                                                     (((idx)&__BIT(2))   ? __BIT64(12)   : 0) |  \
162                                                     (((idx)&__BIT(1))   ? __BIT64(4)    : 0) |  \
163                                                     (((idx)&__BIT(0))   ? __BIT64(3)    : 0) )
164 
165 #define GMM_GET_PTE_BITS_FROM_PAT_IDX_GGTT(idx)    ((((idx)&__BIT(1))   ? __BIT64(53)   : 0) |  \
166                                                     (((idx)&__BIT(0))   ? __BIT64(52)   : 0) )
167 //===========================================================================
168 // typedef:
169 //      GMM_STATUS_ENUM
170 //
171 // Description:
172 //     Decribes GMM lib function return values
173 //----------------------------------------------------------------------------
174 typedef enum GMM_STATUS_ENUM
175 {
176     GMM_SUCCESS,
177     GMM_ERROR,
178     GMM_INVALIDPARAM,
179     GMM_OUT_OF_MEMORY,
180 } GMM_STATUS;
181 
182 //===========================================================================
183 // typedef:
184 //      GMM_CLIENT
185 //
186 // Description:
187 //     Decribes who is linking GMM lib. Allow Kernel mode driver to detect
188 //     origin of resource allocations.
189 //----------------------------------------------------------------------------
190 typedef enum GMM_CLIENT_ENUM
191 {
192     GMM_KMD_VISTA = 0,
193     GMM_OGL_VISTA = 1,
194     GMM_D3D9_VISTA = 2,
195     GMM_D3D10_VISTA = 3,
196     GMM_XP = 4,
197     GMM_D3D12_VISTA = 5,
198     GMM_OCL_VISTA = 6,
199     GMM_VK_VISTA = 7,
200     GMM_EXCITE_VISTA = 8,
201     GMM_UNDEFINED_CLIENT = 9,
202 }GMM_CLIENT;
203 
204 // Macros related to GMM_CLIENT Enum
205 #define USE_KMT_API(ClientType)         ((ClientType == GMM_OGL_VISTA) || (ClientType == GMM_OCL_VISTA) || (ClientType == GMM_VK_VISTA) || (ClientType == GMM_EXCITE_VISTA))
206 #define USE_DX12_API(ClientType)        (ClientType == GMM_D3D12_VISTA)
207 #define USE_DX10_API(ClientType)        (ClientType == GMM_D3D10_VISTA)
208 #define USE_DX_API(ClientType)          ((ClientType == GMM_D3D12_VISTA) || (ClientType == GMM_D3D10_VISTA) || (ClientType == GMM_D3D9_VISTA))
209 
210 #define GET_GMM_CLIENT_TYPE(pContext, ClientType)   \
211 if(pContext)                                        \
212 {                                                   \
213     ClientType = ((GmmClientContext*)pContext)->GetClientType();         \
214 }                                                   \
215 else                                                \
216 {                                                   \
217     ClientType = GMM_UNDEFINED_CLIENT;              \
218 }                                                   \
219 
220 #define GET_RES_CLIENT_TYPE(pResourceInfo, ClientType)  \
221 if(pResourceInfo)                                       \
222 {                                                       \
223     ClientType = (pResourceInfo)->GetClientType();      \
224 }                                                       \
225 else                                                    \
226 {                                                       \
227     ClientType = GMM_UNDEFINED_CLIENT;                  \
228 }                                                       \
229 
230 //===========================================================================
231 // typedef:
232 //     GMM_TEXTURE_LAYOUT
233 //
234 // Description:
235 //     This enum details HW tile walk (i.e. X or Y walk)
236 //---------------------------------------------------------------------------
237 typedef enum GMM_TEXTURE_LAYOUT_REC
238 {
239     GMM_2D_LAYOUT_BELOW = 0, // <- This should stay zero to be the default for all surfaces (including 3D, etc), since texture layout can be queried for 3D/etc surfaces. TODO: Is that querying proper behavior?!
240     GMM_2D_LAYOUT_RIGHT = 1,
241 }GMM_TEXTURE_LAYOUT;
242 
243 //===========================================================================
244 // typedef:
245 //     GMM_TILE_TYPE_ENUM
246 //
247 // Description:
248 //     This enum details tile walk (i.e. X or Y walk, or not tiled)
249 //---------------------------------------------------------------------------
250 typedef enum GMM_TILE_TYPE_ENUM
251 {
252     GMM_TILED_X,
253     GMM_TILED_Y,
254     GMM_TILED_W,
255     GMM_NOT_TILED,
256     GMM_TILED_4,
257     GMM_TILED_64
258 }GMM_TILE_TYPE;
259 
260 //===========================================================================
261 // typedef:
262 //     GMM_E2E_COMPRESSION_TYPE_ENUM
263 //
264 // Description:
265 //     This enum details compression type (i.e. render or media compressed, or uncompressed )
266 //---------------------------------------------------------------------------
267 typedef enum GMM_E2E_COMPRESSION_TYPE_ENUM
268 {
269     GMM_UNCOMPRESSED,
270     GMM_RENDER_COMPRESSED,
271     GMM_MEDIA_COMPRESSED
272 }GMM_E2E_COMPRESSION_TYPE;
273 
274 //===========================================================================
275 // typedef:
276 //     GMM_CPU_CACHE_TYPE_ENUM
277 //
278 // Description:
279 //     This enum details the type of cacheable attributes for the memory
280 //---------------------------------------------------------------------------
281 typedef enum GMM_CPU_CACHE_TYPE_ENUM
282 {
283     GMM_NOTCACHEABLE,
284     GMM_CACHEABLE
285 }GMM_CPU_CACHE_TYPE;
286 
287 //===========================================================================
288 // typedef:
289 //     GMM_GPU_CACHE_SETTINGS
290 //
291 // Description:
292 //     This struct details the type of cacheable attributes for the memory
293 //---------------------------------------------------------------------------
294 typedef struct GMM_GPU_CACHE_SETTINGS_REC
295 {
296     uint32_t ELLC           : 1; // Gen7.5+
297     uint32_t Age            : 2; // Gen7.5+
298     uint32_t WriteThrough   : 1; // Gen7.5+
299     uint32_t GFDT           : 1; // Gen6,7 (Graphics Flush Data Type)
300     uint32_t L3             : 1; // Gen7+
301     uint32_t LLC            : 1; // Gen6+
302     uint32_t UsePteSettings : 1; // Gen6+
303 }GMM_GPU_CACHE_SETTINGS;
304 
305 //===========================================================================
306 // typedef:
307 //     GMM_CACHE_SIZE
308 //
309 // Description:
310 //     This struct details the size of the L3 and EDram caches
311 //---------------------------------------------------------------------------
312 typedef struct GMM_CACHE_SIZES_REC
313 {
314     GMM_GFX_SIZE_T TotalL3Cache;  // L3 Cache Size in Bytes
315     GMM_GFX_SIZE_T TotalLLCCache; // LLC Cache Size in Bytes
316     GMM_GFX_SIZE_T TotalEDRAM;    // eDRAM Size in Bytes
317 } GMM_CACHE_SIZES;
318 
319 //------------------------------------------------------------------------
320 // GMM Legacy Flags
321 //------------------------------------------------------------------------
322 
323 // GMM_TILE_W & GMM_TILE_X & GMM_TILE_Y are for internal use. Clients should use GMM_TILE_TYPE_ENUM
324 #define GMM_TILE_W               (__BIT(1))     // Tile W type
325 #define GMM_TILE_X               (__BIT(2))     // Tile X type
326 #define GMM_TILE_Y               (__BIT(3))     // Tile Y type
327 
328 #if !defined(GHAL3D_ULT)
329 #define GMM_LINEAR               (__BIT(4))     // Linear type
330 #define GMM_TILED                (GMM_TILE_W | GMM_TILE_X | GMM_TILE_Y) // Tiled bit
331 #endif
332 #define GMM_HEAP_EXTERNAL_SYNC   (__BIT(7))     // Indicates GMM_HEAP should not use its internal sync protection.
333 #define GMM_UTILIZEFENCE         (__BIT(8))
334 #define GMM_NOT_OS_ADDR          0xA1B3C5D7
335 
336 //===========================================================================
337 // typedef:
338 //     GMM_TILE_INFO
339 //
340 // Description:
341 //     This structure represents a tile type
342 //--------------------------------------------------------------------------
343 typedef struct GMM_TILE_INFO_REC
344 {
345     uint32_t   LogicalTileWidth;       // width of tile in bytes
346     uint32_t   LogicalTileHeight;      // Height of tile in rows [texels]
347     uint32_t   LogicalTileDepth;       // Depth of tile
348     uint32_t   LogicalSize;            // Size of the tile in bytes
349     uint32_t   MaxPitch;               // Maximum pitch in bytes
350     uint32_t   MaxMipTailStartWidth;   // Max mip tail start width in pixels
351     uint32_t   MaxMipTailStartHeight;  // Max mip tail start height in rows
352     uint32_t   MaxMipTailStartDepth;   // Max mip tail start depth in slices
353 } GMM_TILE_INFO;
354 
355 //===========================================================================
356 // typedef:
357 //        GMM_CUBE_FACE_REC
358 //
359 // Description:
360 //     ENUM detailing cube map faces
361 //---------------------------------------------------------------------------
362 typedef enum GMM_CUBE_FACE_ENUM
363 {
364    __GMM_CUBE_FACE_POS_X,
365    __GMM_CUBE_FACE_NEG_X,
366    __GMM_CUBE_FACE_POS_Y,
367    __GMM_CUBE_FACE_NEG_Y,
368    __GMM_CUBE_FACE_POS_Z,
369    __GMM_CUBE_FACE_NEG_Z,
370    __GMM_MAX_CUBE_FACE,
371    __GMM_NO_CUBE_MAP,
372 } GMM_CUBE_FACE_ENUM;
373 
374 //===========================================================================
375 // typedef:
376 //        GMM_YUV_PLANE_REC
377 //
378 // Description:
379 //
380 //--------------------------------------------------------------------------
381 typedef enum GMM_YUV_PLANE_ENUM
382 {
383     GMM_NO_PLANE     = 0,
384     GMM_PLANE_Y      = 1,
385     GMM_PLANE_U      = 2,
386     GMM_PLANE_V      = 3,
387     GMM_MAX_PLANE    = 4,
388     // GmmLib internal use only
389     GMM_PLANE_3D_Y0  = 0,
390     GMM_PLANE_3D_Y1  = 1,
391     GMM_PLANE_3D_UV0 = 2,
392     GMM_PLANE_3D_UV1 = 3
393     // No internal use >= GMM_MAX_PLANE!
394 }GMM_YUV_PLANE;
395 
396 //      GMM_RESOURCE_FORMAT
397 //
398 // Description:
399 //      Enumeration of GMM supported resource formats.
400 //---------------------------------------------------------------------------
401 typedef enum GMM_RESOURCE_FORMAT_ENUM
402 {
403     GMM_FORMAT_INVALID = 0, // <-- This stays zero! (For boolean and valid range checks.)
404 
405     #define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, SSCompressionFmt, Availability) \
406         GMM_FORMAT_##Name, \
407         GMM_FORMAT_##Name##_TYPE = GMM_FORMAT_##Name, // TODO(Minor): Remove _TYPE suffix from every GMM_FORMAT_ reference throughout driver and delete this aliasing. (And remove the \ from the line above.)
408     #include "GmmFormatTable.h"
409 
410     GMM_RESOURCE_FORMATS
411 } GMM_RESOURCE_FORMAT;
412 C_ASSERT(GMM_FORMAT_INVALID == 0); // GMM_FORMAT_INVALID needs to stay zero--How did it end-up not...?
413 // Legacy GMM Aliases...
414 #define GMM_FORMAT_UYVY     GMM_FORMAT_YCRCB_SWAPY
415 #define GMM_FORMAT_VYUY     GMM_FORMAT_YCRCB_SWAPUVY
416 #define GMM_FORMAT_YUY2     GMM_FORMAT_YCRCB_NORMAL
417 #define GMM_FORMAT_YVYU     GMM_FORMAT_YCRCB_SWAPUV
418 #define GMM_UNIFIED_CMF_INVALID 0xD
419 
420 //===========================================================================
421 // typedef:
422 //      GMM_SURFACESTATE_FORMAT
423 //
424 // Description:
425 //      Enumeration of RCS SURFACE_STATE.Formats.
426 //---------------------------------------------------------------------------
427 typedef enum GMM_SURFACESTATE_FORMAT_ENUM
428 {
429     GMM_SURFACESTATE_FORMAT_INVALID = -1, // Can't use zero since that's an actual enum value.
430 
431     #define GMM_FORMAT_INCLUDE_SURFACESTATE_FORMATS_ONLY
432     #define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, SSCompressionFmt, Availability) \
433         GMM_SURFACESTATE_FORMAT_##Name = RcsSurfaceFormat,
434     #include "GmmFormatTable.h"
435 } GMM_SURFACESTATE_FORMAT;
436 
437 typedef enum GMM_E2ECOMP_FORMAT_ENUM
438 {
439     GMM_E2ECOMP_FORMAT_INVALID = 0,
440     GMM_E2ECOMP_FORMAT_ML8     = GMM_E2ECOMP_FORMAT_INVALID,
441     GMM_E2ECOMP_FORMAT_RGB64, //1h - Reserved
442     GMM_E2ECOMP_FORMAT_RGB32, //2h - Reserved
443 
444     GMM_E2ECOMP_MIN_FORMAT = GMM_E2ECOMP_FORMAT_RGB32,
445 
446     GMM_E2ECOMP_FORMAT_YUY2,       //3h
447 
448     GMM_E2ECOMP_FORMAT_Y410,       //4h
449 
450     GMM_E2ECOMP_FORMAT_Y210,       //5h
451     GMM_E2ECOMP_FORMAT_Y216 = GMM_E2ECOMP_FORMAT_Y210,
452 
453     GMM_E2ECOMP_FORMAT_Y416,       //6h
454     GMM_E2ECOMP_FORMAT_P010,       //7h
455     GMM_E2ECOMP_FORMAT_P010_L = GMM_E2ECOMP_FORMAT_P010,
456     GMM_E2ECOMP_FORMAT_P010_C = GMM_E2ECOMP_FORMAT_P010,
457     GMM_E2ECOMP_FORMAT_P016,       //8h
458     GMM_E2ECOMP_FORMAT_P016_L = GMM_E2ECOMP_FORMAT_P016,
459     GMM_E2ECOMP_FORMAT_P016_C = GMM_E2ECOMP_FORMAT_P016,
460     GMM_E2ECOMP_FORMAT_AYUV,       //9h
461 
462     GMM_E2ECOMP_FORMAT_ARGB8b,     //Ah
463     GMM_E2ECOMP_FORMAT_RGB5A1 = GMM_E2ECOMP_FORMAT_ARGB8b,
464     GMM_E2ECOMP_FORMAT_RGBA4 = GMM_E2ECOMP_FORMAT_ARGB8b,
465     GMM_E2ECOMP_FORMAT_B5G6R5 = GMM_E2ECOMP_FORMAT_ARGB8b,
466 
467     GMM_E2ECOMP_FORMAT_SWAPY,      //Bh
468     GMM_E2ECOMP_FORMAT_SWAPUV,     //Ch
469     GMM_E2ECOMP_FORMAT_SWAPUVY,    //Dh
470     GMM_E2ECOMP_FORMAT_YCRCB_SWAPUV = GMM_E2ECOMP_FORMAT_SWAPY,
471     GMM_E2ECOMP_FORMAT_YCRCB_SWAPUVY = GMM_E2ECOMP_FORMAT_SWAPUV,
472     GMM_E2ECOMP_FORMAT_YCRCB_SWAPY = GMM_E2ECOMP_FORMAT_SWAPUVY,
473 
474     GMM_E2ECOMP_FORMAT_RGB10b,     //Eh  --Which media format is it?
475     GMM_E2ECOMP_FORMAT_NV12,       //Fh
476     GMM_E2ECOMP_FORMAT_NV12_L = GMM_E2ECOMP_FORMAT_NV12,
477     GMM_E2ECOMP_FORMAT_NV12_C = GMM_E2ECOMP_FORMAT_NV12,
478 
479     GMM_E2ECOMP_FORMAT_RGBAFLOAT16,            //0x10h
480 
481     GMM_E2ECOMP_FORMAT_R32G32B32A32_FLOAT,     //0x11h
482     GMM_E2ECOMP_FORMAT_R32G32B32A32_SINT,      //0x12h
483     GMM_E2ECOMP_FORMAT_R32G32B32A32_UINT,      //0x13h
484     GMM_E2ECOMP_FORMAT_R16G16B16A16_UNORM,     //0x14h
485     GMM_E2ECOMP_FORMAT_R16G16B16A16_SNORM,     //0x15h
486     GMM_E2ECOMP_FORMAT_R16G16B16A16_SINT,      //0x16h
487     GMM_E2ECOMP_FORMAT_R16G16B16A16_UINT,      //0x17h
488 
489     GMM_E2ECOMP_FORMAT_R10G10B10A2_UNORM,      //0x18h
490     GMM_E2ECOMP_FORMAT_RGB10A2 = GMM_E2ECOMP_FORMAT_R10G10B10A2_UNORM,
491 
492     GMM_E2ECOMP_FORMAT_R10G10B10FLOAT_A2_UNORM,    //0x19h
493     GMM_E2ECOMP_FORMAT_R10G10B10A2_UINT,       //0x1Ah
494     GMM_E2ECOMP_FORMAT_R8G8B8A8_SNORM,         //0x1Bh
495     GMM_E2ECOMP_FORMAT_R8G8B8A8_SINT,          //0x1Ch
496     GMM_E2ECOMP_FORMAT_R8G8B8A8_UINT,          //0x1Dh
497 
498     GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,        //0x1Eh
499     GMM_E2ECOMP_FORMAT_RG11B10 = GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,
500 
501     GMM_E2ECOMP_MAX_FORMAT = GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,    //should always be equal to last format encoding
502 
503     GMM_E2ECOMP_FORMAT_RGBA = GMM_E2ECOMP_FORMAT_INVALID,
504     GMM_E2ECOMP_FORMAT_R = GMM_E2ECOMP_FORMAT_INVALID,
505     GMM_E2ECOMP_FORMAT_RG = GMM_E2ECOMP_FORMAT_INVALID,
506     GMM_E2ECOMP_FORMAT_D    = GMM_E2ECOMP_FORMAT_INVALID,
507 
508 } GMM_E2ECOMP_FORMAT;
509 
510 //===========================================================================
511 // typedef:
512 //     GMM_TILE_WALK
513 //
514 // Description:
515 //     This enum details HW tile walk (i.e. X or Y walk), used to program the
516 //     hardware.
517 //---------------------------------------------------------------------------
518 typedef enum GMM_TILE_WALK_REC
519 {
520     GMM_HW_TILED_X_WALK     = 0,
521     GMM_HW_TILED_Y_WALK     = 1,
522     GMM_HW_TILED_W_WALK     = 2,
523     GMM_HW_TILED_YF_WALK    = 3,
524     GMM_HW_TILED_YS_WALK    = 4,
525     GMM_HW_TILED_4_WALK     = 5,
526     GMM_HW_TILED_64_WALK    = 6,
527     GMM_HW_NOT_TILED        = 7
528 } GMM_TILE_WALK;
529 
530 //===========================================================================
531 // typedef:
532 //      GMM_DISPLAY_FRAME_ENUM
533 //
534 // Description:
535 //      This enum details the type of display frame (for S3D resources).
536 //---------------------------------------------------------------------------
537 typedef enum GMM_DISPLAY_FRAME_ENUM
538 {
539     GMM_DISPLAY_BASE        = 0,   // Legacy non-S3D display resource
540     GMM_DISPLAY_L           = GMM_DISPLAY_BASE,
541     GMM_DISPLAY_R           = 1,
542     GMM_DISPLAY_BLANK_AREA  = 2,
543     GMM_DISPLAY_FRAME_MAX
544 } GMM_DISPLAY_FRAME;
545 
546 //===========================================================================
547 // typedef:
548 //        GMM_REQ_OFFSET_INFO
549 //
550 // Description:
551 //     This structure is used to request offset information to a surface mip
552 //     level or video plane.
553 //---------------------------------------------------------------------------
554 typedef struct GMM_REQ_OFFSET_INFO_REC
555 {
556     uint32_t               ReqRender       :1;
557     uint32_t               ReqLock         :1;
558     uint32_t               ReqStdLayout    :1;
559     uint32_t               Reserved        :29;
560 
561     uint32_t               ArrayIndex;
562     uint32_t               MipLevel;
563     uint32_t               Slice;
564     GMM_CUBE_FACE_ENUM  CubeFace;
565     GMM_YUV_PLANE       Plane;
566 
567     GMM_DISPLAY_FRAME   Frame;
568 
569     struct
570     {
571         union
572         {
573             uint32_t               Offset;
574             GMM_GFX_SIZE_T      Offset64;
575         };
576         uint32_t               Pitch;
577         union
578         {
579             uint32_t               Mip0SlicePitch;
580             uint32_t               Gen9PlusSlicePitch;
581         };
582     }                   Lock;
583 
584     struct
585     {
586         union
587         {
588             uint32_t               Offset;
589             GMM_GFX_SIZE_T      Offset64;
590         };
591         uint32_t               XOffset;
592         uint32_t               YOffset;
593         uint32_t               ZOffset;
594     }                   Render;
595 
596     struct
597     {
598         GMM_GFX_SIZE_T      Offset;
599         GMM_GFX_SIZE_T      TileRowPitch;
600         GMM_GFX_SIZE_T      TileDepthPitch;
601     }                   StdLayout;
602 
603 }GMM_REQ_OFFSET_INFO;
604 
605 //===========================================================================
606 // typedef:
607 //     GMM_HW_COMMAND_STREAMER
608 //
609 // Description: Enumeration to allow callers to specify a command streamer.
610 //
611 //---------------------------------------------------------------------------
612 typedef enum GMM_HW_COMMAND_STREAMER_ENUM
613 {
614     GMM_HW_COMMAND_STREAMER_NULL = 0, // <-- This stays zero.
615     GMM_CS,      // Render Command Streamer
616     GMM_BCS,     // Blitter (BLT) Command Streamer
617     GMM_VCS,     // Video Codec (MFX) Command Streamer
618     GMM_VECS,    // Video Enhancement (VEBOX) Command Streamer
619     GMM_VCS2,    // Video Codec (MFX) Command Streamer 2
620     GMM_COMPUTE, // Compute Only Command Streamer
621     GMM_PICS,    // Pinning Command Streamer
622     GMM_CAPTURE, // Capture Command Streamer
623     GMM_HW_COMMAND_STREAMERS // <-- This stays last.
624 } GMM_HW_COMMAND_STREAMER;
625 
626 // Reset packing alignment to project default
627 #pragma pack(pop)
628 
629 //===========================================================================
630 // typedef:
631 //        GMM_RESOURCE_TYPE
632 //
633 // Description:
634 //     This enum describe type of resource requested
635 //---------------------------------------------------------------------------
636 typedef enum GMM_RESOURCE_TYPE_ENUM
637 {
638     RESOURCE_INVALID,
639 
640     // User-mode use
641     RESOURCE_1D,
642     RESOURCE_2D,
643     RESOURCE_3D,
644     RESOURCE_CUBE,
645     RESOURCE_SCRATCH,
646     RESOURCE_BUFFER,
647 
648     //Kernel-mode use only
649     RESOURCE_KMD_CHECK_START,
650     RESOURCE_PRIMARY,
651     RESOURCE_SHADOW,
652     RESOURCE_STAGING,
653     RESOURCE_CURSOR,
654     RESOURCE_FBC,
655     RESOURCE_PWR_CONTEXT,
656     RESOURCE_PERF_DATA_QUEUE,
657     RESOURCE_KMD_BUFFER,
658     RESOURCE_HW_CONTEXT,
659     RESOURCE_TAG_PAGE,
660     RESOURCE_NNDI,
661     RESOURCE_HARDWARE_MBM,
662     RESOURCE_OVERLAY_DMA,
663     RESOURCE_OVERLAY_INTERMEDIATE_SURFACE,
664     RESOURCE_GTT_TRANSFER_REGION,
665     RESOURCE_GLOBAL_BUFFER,
666     RESOURCE_GDI,
667     RESOURCE_NULL_CONTEXT_INDIRECT_STATE,
668     RESOURCE_GFX_CLIENT_BUFFER,
669     RESOURCE_KMD_CHECK_END,
670     RESOURCE_SEGMENT,
671     RESOURCE_IFFS_MAPTOGTT,
672 #if _WIN32
673     RESOURCE_WGBOX_ENCODE_STATE,
674     RESOURCE_WGBOX_ENCODE_DISPLAY,
675     RESOURCE_WGBOX_ENCODE_REFERENCE,
676     RESOURCE_WGBOX_ENCODE_TFD,
677 #endif
678     // only used for allocation of context specific SVM Present kernels buffer
679     RESOURCE_SVM_KERNELS_BUFFER,
680 
681     GMM_MAX_HW_RESOURCE_TYPE
682 } GMM_RESOURCE_TYPE;
683 
684