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 #define GMM_STDCALL             __stdcall   // GMM function calling convention
81 #define GMM_NO_FENCE_REG        0xDEADBEEF
82 #define GMM_MAX_DISPLAYS        3
83 
84 #ifndef _WIN32
85 typedef void* HANDLE;
86 #endif
87 
88 //===========================================================================
89 // typedef:
90 //      GMM_GFX_ADDRESS/etc.
91 //
92 // Description:
93 //     The GMM GfxAddr/Size and related types and casting functions.
94 //----------------------------------------------------------------------------
95 // Always use x64 (D3D11.2 Tiled Resources needs >32 bit gfx address space)
96 typedef uint64_t  GMM_GFX_ADDRESS, GMM_GFX_SIZE_T, GMM_VOIDPTR64;
97 #define GMM_GFX_ADDRESS_MAX ((GMM_GFX_ADDRESS) 0xffffffffffffffff)
98 
99 typedef uint32_t GMM_GLOBAL_GFX_ADDRESS, GMM_GLOBAL_GFX_SIZE_T;
100 #define GMM_GLOBAL_GFX_ADDRESS_MAX ((GMM_GLOBAL_GFX_ADDRESS) 0xffffffff)
101 
102 #ifdef _DEBUG
103     #define GMM_GFX_ADDRESS_CAST(x)     \
104     (                                   \
105         ((x) <= GMM_GFX_ADDRESS_MAX) ?  \
106             1 : __debugbreak(),         \
107         (GMM_GFX_ADDRESS)(x)            \
108     )
109     #define GMM_GFX_SIZE_T_CAST GMM_GFX_ADDRESS_CAST
110 
111     #define GMM_GLOBAL_GFX_ADDRESS_CAST(x)      \
112     (                                           \
113         ((x) <= GMM_GLOBAL_GFX_ADDRESS_MAX) ?   \
114             1 : __debugbreak(),                 \
115         (GMM_GLOBAL_GFX_ADDRESS)(x)             \
116     )
117     #define GMM_GLOBAL_GFX_SIZE_T_CAST GMM_GLOBAL_GFX_ADDRESS_CAST
118 #else
119     #define GMM_GFX_ADDRESS_CAST(x)         ((GMM_GFX_ADDRESS)(x))
120     #define GMM_GFX_SIZE_T_CAST(x)          ((GMM_GFX_SIZE_T)(x))
121     #define GMM_GLOBAL_GFX_ADDRESS_CAST(x)  ((GMM_GLOBAL_GFX_ADDRESS)(x))
122     #define GMM_GLOBAL_GFX_SIZE_T_CAST(x)   ((GMM_GLOBAL_GFX_SIZE_T)(x))
123 #endif
124 
125 
126 #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.
127 #define GMM_GFX_ADDRESS_DECANONIZE(a)   ((uint64_t)(a) & (((uint64_t) 1 << 48) - 1)) // "
128 
129 #define GMM_GFX_PLATFORM_VA_SIZE(pClientContext)        (((pClientContext)->GetLibContext()->GetSkuTable().Ftr57bGPUAddressing) ? 57 : 48)
130 #define VASize(pCC)                                     GMM_GFX_PLATFORM_VA_SIZE(pCC)
131 
132 #define GMM_BIT_RANGE(endbit, startbit)     ((endbit)-(startbit)+1)
133 #define GMM_BIT(bit)                        (1)
134 
135 //===========================================================================
136 // typedef:
137 //      GMM_STATUS_ENUM
138 //
139 // Description:
140 //     Decribes GMM lib function return values
141 //----------------------------------------------------------------------------
142 typedef enum GMM_STATUS_ENUM
143 {
144     GMM_SUCCESS,
145     GMM_ERROR,
146     GMM_INVALIDPARAM,
147     GMM_OUT_OF_MEMORY,
148 } GMM_STATUS;
149 
150 //===========================================================================
151 // typedef:
152 //      GMM_CLIENT
153 //
154 // Description:
155 //     Decribes who is linking GMM lib. Allow Kernel mode driver to detect
156 //     origin of resource allocations.
157 //----------------------------------------------------------------------------
158 typedef enum GMM_CLIENT_ENUM
159 {
160     GMM_KMD_VISTA = 0,
161     GMM_OGL_VISTA = 1,
162     GMM_D3D9_VISTA = 2,
163     GMM_D3D10_VISTA = 3,
164     GMM_XP = 4,
165     GMM_D3D12_VISTA = 5,
166     GMM_OCL_VISTA = 6,
167     GMM_VK_VISTA = 7,
168     GMM_EXCITE_VISTA = 8,
169     GMM_UNDEFINED_CLIENT = 9,
170 }GMM_CLIENT;
171 
172 // Macros related to GMM_CLIENT Enum
173 #define USE_KMT_API(ClientType)         ((ClientType == GMM_OGL_VISTA) || (ClientType == GMM_OCL_VISTA) || (ClientType == GMM_VK_VISTA) || (ClientType == GMM_EXCITE_VISTA))
174 #define USE_DX12_API(ClientType)        (ClientType == GMM_D3D12_VISTA)
175 #define USE_DX10_API(ClientType)        (ClientType == GMM_D3D10_VISTA)
176 #define USE_DX_API(ClientType)          ((ClientType == GMM_D3D12_VISTA) || (ClientType == GMM_D3D10_VISTA) || (ClientType == GMM_D3D9_VISTA))
177 
178 #define GET_GMM_CLIENT_TYPE(pContext, ClientType)   \
179 if(pContext)                                        \
180 {                                                   \
181     ClientType = ((GmmClientContext*)pContext)->GetClientType();         \
182 }                                                   \
183 else                                                \
184 {                                                   \
185     ClientType = GMM_UNDEFINED_CLIENT;              \
186 }                                                   \
187 
188 #define GET_RES_CLIENT_TYPE(pResourceInfo, ClientType)  \
189 if(pResourceInfo)                                       \
190 {                                                       \
191     ClientType = (pResourceInfo)->GetClientType();      \
192 }                                                       \
193 else                                                    \
194 {                                                       \
195     ClientType = GMM_UNDEFINED_CLIENT;                  \
196 }                                                       \
197 
198 //===========================================================================
199 // typedef:
200 //     GMM_TEXTURE_LAYOUT
201 //
202 // Description:
203 //     This enum details HW tile walk (i.e. X or Y walk)
204 //---------------------------------------------------------------------------
205 typedef enum GMM_TEXTURE_LAYOUT_REC
206 {
207     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?!
208     GMM_2D_LAYOUT_RIGHT = 1,
209 }GMM_TEXTURE_LAYOUT;
210 
211 //===========================================================================
212 // typedef:
213 //     GMM_TILE_TYPE_ENUM
214 //
215 // Description:
216 //     This enum details tile walk (i.e. X or Y walk, or not tiled)
217 //---------------------------------------------------------------------------
218 typedef enum GMM_TILE_TYPE_ENUM
219 {
220     GMM_TILED_X,
221     GMM_TILED_Y,
222     GMM_TILED_W,
223     GMM_NOT_TILED,
224     GMM_TILED_4,
225     GMM_TILED_64
226 }GMM_TILE_TYPE;
227 
228 //===========================================================================
229 // typedef:
230 //     GMM_E2E_COMPRESSION_TYPE_ENUM
231 //
232 // Description:
233 //     This enum details compression type (i.e. render or media compressed, or uncompressed )
234 //---------------------------------------------------------------------------
235 typedef enum GMM_E2E_COMPRESSION_TYPE_ENUM
236 {
237     GMM_UNCOMPRESSED,
238     GMM_RENDER_COMPRESSED,
239     GMM_MEDIA_COMPRESSED
240 }GMM_E2E_COMPRESSION_TYPE;
241 
242 //===========================================================================
243 // typedef:
244 //     GMM_CPU_CACHE_TYPE_ENUM
245 //
246 // Description:
247 //     This enum details the type of cacheable attributes for the memory
248 //---------------------------------------------------------------------------
249 typedef enum GMM_CPU_CACHE_TYPE_ENUM
250 {
251     GMM_NOTCACHEABLE,
252     GMM_CACHEABLE
253 }GMM_CPU_CACHE_TYPE;
254 
255 //===========================================================================
256 // typedef:
257 //     GMM_GPU_CACHE_SETTINGS
258 //
259 // Description:
260 //     This struct details the type of cacheable attributes for the memory
261 //---------------------------------------------------------------------------
262 typedef struct GMM_GPU_CACHE_SETTINGS_REC
263 {
264     uint32_t ELLC           : 1; // Gen7.5+
265     uint32_t Age            : 2; // Gen7.5+
266     uint32_t WriteThrough   : 1; // Gen7.5+
267     uint32_t GFDT           : 1; // Gen6,7 (Graphics Flush Data Type)
268     uint32_t L3             : 1; // Gen7+
269     uint32_t LLC            : 1; // Gen6+
270     uint32_t UsePteSettings : 1; // Gen6+
271 }GMM_GPU_CACHE_SETTINGS;
272 
273 //===========================================================================
274 // typedef:
275 //     GMM_CACHE_SIZE
276 //
277 // Description:
278 //     This struct details the size of the L3 and EDram caches
279 //---------------------------------------------------------------------------
280 typedef struct GMM_CACHE_SIZES_REC
281 {
282     GMM_GFX_SIZE_T TotalL3Cache;  // L3 Cache Size in Bytes
283     GMM_GFX_SIZE_T TotalLLCCache; // LLC Cache Size in Bytes
284     GMM_GFX_SIZE_T TotalEDRAM;    // eDRAM Size in Bytes
285 } GMM_CACHE_SIZES;
286 
287 //------------------------------------------------------------------------
288 // GMM Legacy Flags
289 //------------------------------------------------------------------------
290 
291 // GMM_TILE_W & GMM_TILE_X & GMM_TILE_Y are for internal use. Clients should use GMM_TILE_TYPE_ENUM
292 #define GMM_TILE_W               (__BIT(1))     // Tile W type
293 #define GMM_TILE_X               (__BIT(2))     // Tile X type
294 #define GMM_TILE_Y               (__BIT(3))     // Tile Y type
295 
296 #if !defined(GHAL3D_ULT)
297 #define GMM_LINEAR               (__BIT(4))     // Linear type
298 #define GMM_TILED                (GMM_TILE_W | GMM_TILE_X | GMM_TILE_Y) // Tiled bit
299 #endif
300 #define GMM_HEAP_EXTERNAL_SYNC   (__BIT(7))     // Indicates GMM_HEAP should not use its internal sync protection.
301 #define GMM_UTILIZEFENCE         (__BIT(8))
302 #define GMM_NOT_OS_ADDR          0xA1B3C5D7
303 
304 //===========================================================================
305 // typedef:
306 //     GMM_TILE_INFO
307 //
308 // Description:
309 //     This structure represents a tile type
310 //--------------------------------------------------------------------------
311 typedef struct GMM_TILE_INFO_REC
312 {
313     uint32_t   LogicalTileWidth;       // width of tile in bytes
314     uint32_t   LogicalTileHeight;      // Height of tile in rows [texels]
315     uint32_t   LogicalTileDepth;       // Depth of tile
316     uint32_t   LogicalSize;            // Size of the tile in bytes
317     uint32_t   MaxPitch;               // Maximum pitch in bytes
318     uint32_t   MaxMipTailStartWidth;   // Max mip tail start width in pixels
319     uint32_t   MaxMipTailStartHeight;  // Max mip tail start height in rows
320     uint32_t   MaxMipTailStartDepth;   // Max mip tail start depth in slices
321 } GMM_TILE_INFO;
322 
323 //===========================================================================
324 // typedef:
325 //        GMM_CUBE_FACE_REC
326 //
327 // Description:
328 //     ENUM detailing cube map faces
329 //---------------------------------------------------------------------------
330 typedef enum GMM_CUBE_FACE_ENUM
331 {
332    __GMM_CUBE_FACE_POS_X,
333    __GMM_CUBE_FACE_NEG_X,
334    __GMM_CUBE_FACE_POS_Y,
335    __GMM_CUBE_FACE_NEG_Y,
336    __GMM_CUBE_FACE_POS_Z,
337    __GMM_CUBE_FACE_NEG_Z,
338    __GMM_MAX_CUBE_FACE,
339    __GMM_NO_CUBE_MAP,
340 } GMM_CUBE_FACE_ENUM;
341 
342 //===========================================================================
343 // typedef:
344 //        GMM_YUV_PLANE_REC
345 //
346 // Description:
347 //
348 //--------------------------------------------------------------------------
349 typedef enum GMM_YUV_PLANE_ENUM
350 {
351     GMM_NO_PLANE     = 0,
352     GMM_PLANE_Y      = 1,
353     GMM_PLANE_U      = 2,
354     GMM_PLANE_V      = 3,
355     GMM_MAX_PLANE    = 4,
356     // GmmLib internal use only
357     GMM_PLANE_3D_Y0  = 0,
358     GMM_PLANE_3D_Y1  = 1,
359     GMM_PLANE_3D_UV0 = 2,
360     GMM_PLANE_3D_UV1 = 3
361     // No internal use >= GMM_MAX_PLANE!
362 }GMM_YUV_PLANE;
363 
364 //      GMM_RESOURCE_FORMAT
365 //
366 // Description:
367 //      Enumeration of GMM supported resource formats.
368 //---------------------------------------------------------------------------
369 typedef enum GMM_RESOURCE_FORMAT_ENUM
370 {
371     GMM_FORMAT_INVALID = 0, // <-- This stays zero! (For boolean and valid range checks.)
372 
373     #define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, SSCompressionFmt, Availability) \
374         GMM_FORMAT_##Name, \
375         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.)
376     #include "GmmFormatTable.h"
377 
378     GMM_RESOURCE_FORMATS
379 } GMM_RESOURCE_FORMAT;
380 C_ASSERT(GMM_FORMAT_INVALID == 0); // GMM_FORMAT_INVALID needs to stay zero--How did it end-up not...?
381 // Legacy GMM Aliases...
382 #define GMM_FORMAT_UYVY     GMM_FORMAT_YCRCB_SWAPY
383 #define GMM_FORMAT_VYUY     GMM_FORMAT_YCRCB_SWAPUVY
384 #define GMM_FORMAT_YUY2     GMM_FORMAT_YCRCB_NORMAL
385 #define GMM_FORMAT_YVYU     GMM_FORMAT_YCRCB_SWAPUV
386 
387 
388 //===========================================================================
389 // typedef:
390 //      GMM_SURFACESTATE_FORMAT
391 //
392 // Description:
393 //      Enumeration of RCS SURFACE_STATE.Formats.
394 //---------------------------------------------------------------------------
395 typedef enum GMM_SURFACESTATE_FORMAT_ENUM
396 {
397     GMM_SURFACESTATE_FORMAT_INVALID = -1, // Can't use zero since that's an actual enum value.
398 
399     #define GMM_FORMAT_INCLUDE_SURFACESTATE_FORMATS_ONLY
400     #define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, SSCompressionFmt, Availability) \
401         GMM_SURFACESTATE_FORMAT_##Name = RcsSurfaceFormat,
402     #include "GmmFormatTable.h"
403 } GMM_SURFACESTATE_FORMAT;
404 
405 typedef enum GMM_E2ECOMP_FORMAT_ENUM
406 {
407     GMM_E2ECOMP_FORMAT_INVALID = 0,
408     GMM_E2ECOMP_FORMAT_RGB64,       //1h - Reserved
409     GMM_E2ECOMP_FORMAT_RGB32,       //2h - Reserved
410 
411     GMM_E2ECOMP_MIN_FORMAT = GMM_E2ECOMP_FORMAT_RGB32,
412 
413     GMM_E2ECOMP_FORMAT_YUY2,       //3h
414 
415     GMM_E2ECOMP_FORMAT_Y410,       //4h
416 
417     GMM_E2ECOMP_FORMAT_Y210,       //5h
418     GMM_E2ECOMP_FORMAT_Y216 = GMM_E2ECOMP_FORMAT_Y210,
419 
420     GMM_E2ECOMP_FORMAT_Y416,       //6h
421     GMM_E2ECOMP_FORMAT_P010,       //7h
422     GMM_E2ECOMP_FORMAT_P016,       //8h
423     GMM_E2ECOMP_FORMAT_AYUV,       //9h
424 
425     GMM_E2ECOMP_FORMAT_ARGB8b,     //Ah
426     GMM_E2ECOMP_FORMAT_RGB5A1 = GMM_E2ECOMP_FORMAT_ARGB8b,
427     GMM_E2ECOMP_FORMAT_RGBA4 = GMM_E2ECOMP_FORMAT_ARGB8b,
428     GMM_E2ECOMP_FORMAT_B5G6R5 = GMM_E2ECOMP_FORMAT_ARGB8b,
429 
430     GMM_E2ECOMP_FORMAT_SWAPY,      //Bh
431     GMM_E2ECOMP_FORMAT_SWAPUV,     //Ch
432     GMM_E2ECOMP_FORMAT_SWAPUVY,    //Dh
433     GMM_E2ECOMP_FORMAT_YCRCB_SWAPUV = GMM_E2ECOMP_FORMAT_SWAPY,
434     GMM_E2ECOMP_FORMAT_YCRCB_SWAPUVY = GMM_E2ECOMP_FORMAT_SWAPUV,
435     GMM_E2ECOMP_FORMAT_YCRCB_SWAPY = GMM_E2ECOMP_FORMAT_SWAPUVY,
436 
437     GMM_E2ECOMP_FORMAT_RGB10b,     //Eh  --Which media format is it?
438     GMM_E2ECOMP_FORMAT_NV12,       //Fh
439 
440     GMM_E2ECOMP_FORMAT_RGBAFLOAT16,            //0x10h
441 
442     GMM_E2ECOMP_FORMAT_R32G32B32A32_FLOAT,     //0x11h
443     GMM_E2ECOMP_FORMAT_R32G32B32A32_SINT,      //0x12h
444     GMM_E2ECOMP_FORMAT_R32G32B32A32_UINT,      //0x13h
445     GMM_E2ECOMP_FORMAT_R16G16B16A16_UNORM,     //0x14h
446     GMM_E2ECOMP_FORMAT_R16G16B16A16_SNORM,     //0x15h
447     GMM_E2ECOMP_FORMAT_R16G16B16A16_SINT,      //0x16h
448     GMM_E2ECOMP_FORMAT_R16G16B16A16_UINT,      //0x17h
449 
450     GMM_E2ECOMP_FORMAT_R10G10B10A2_UNORM,      //0x18h
451     GMM_E2ECOMP_FORMAT_RGB10A2 = GMM_E2ECOMP_FORMAT_R10G10B10A2_UNORM,
452 
453     GMM_E2ECOMP_FORMAT_R10G10B10FLOAT_A2_UNORM,    //0x19h
454     GMM_E2ECOMP_FORMAT_R10G10B10A2_UINT,       //0x1Ah
455     GMM_E2ECOMP_FORMAT_R8G8B8A8_SNORM,         //0x1Bh
456     GMM_E2ECOMP_FORMAT_R8G8B8A8_SINT,          //0x1Ch
457     GMM_E2ECOMP_FORMAT_R8G8B8A8_UINT,          //0x1Dh
458 
459     GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,        //0x1Eh
460     GMM_E2ECOMP_FORMAT_RG11B10 = GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,
461 
462     GMM_E2ECOMP_MAX_FORMAT = GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,    //should always be equal to last format encoding
463 
464     GMM_E2ECOMP_FORMAT_RGBA = GMM_E2ECOMP_FORMAT_INVALID,
465     GMM_E2ECOMP_FORMAT_R = GMM_E2ECOMP_FORMAT_INVALID,
466     GMM_E2ECOMP_FORMAT_RG = GMM_E2ECOMP_FORMAT_INVALID,
467 
468 } GMM_E2ECOMP_FORMAT;
469 
470 //===========================================================================
471 // typedef:
472 //     GMM_TILE_WALK
473 //
474 // Description:
475 //     This enum details HW tile walk (i.e. X or Y walk), used to program the
476 //     hardware.
477 //---------------------------------------------------------------------------
478 typedef enum GMM_TILE_WALK_REC
479 {
480     GMM_HW_TILED_X_WALK     = 0,
481     GMM_HW_TILED_Y_WALK     = 1,
482     GMM_HW_TILED_W_WALK     = 2,
483     GMM_HW_TILED_YF_WALK    = 3,
484     GMM_HW_TILED_YS_WALK    = 4,
485     GMM_HW_TILED_4_WALK     = 5,
486     GMM_HW_TILED_64_WALK    = 6,
487     GMM_HW_NOT_TILED        = 7
488 } GMM_TILE_WALK;
489 
490 //===========================================================================
491 // typedef:
492 //      GMM_DISPLAY_FRAME_ENUM
493 //
494 // Description:
495 //      This enum details the type of display frame (for S3D resources).
496 //---------------------------------------------------------------------------
497 typedef enum GMM_DISPLAY_FRAME_ENUM
498 {
499     GMM_DISPLAY_BASE        = 0,   // Legacy non-S3D display resource
500     GMM_DISPLAY_L           = GMM_DISPLAY_BASE,
501     GMM_DISPLAY_R           = 1,
502     GMM_DISPLAY_BLANK_AREA  = 2,
503     GMM_DISPLAY_FRAME_MAX
504 } GMM_DISPLAY_FRAME;
505 
506 //===========================================================================
507 // typedef:
508 //        GMM_REQ_OFFSET_INFO
509 //
510 // Description:
511 //     This structure is used to request offset information to a surface mip
512 //     level or video plane.
513 //---------------------------------------------------------------------------
514 typedef struct GMM_REQ_OFFSET_INFO_REC
515 {
516     uint32_t               ReqRender       :1;
517     uint32_t               ReqLock         :1;
518     uint32_t               ReqStdLayout    :1;
519     uint32_t               Reserved        :29;
520 
521     uint32_t               ArrayIndex;
522     uint32_t               MipLevel;
523     uint32_t               Slice;
524     GMM_CUBE_FACE_ENUM  CubeFace;
525     GMM_YUV_PLANE       Plane;
526 
527     GMM_DISPLAY_FRAME   Frame;
528 
529     struct
530     {
531         union
532         {
533             uint32_t               Offset;
534             GMM_GFX_SIZE_T      Offset64;
535         };
536         uint32_t               Pitch;
537         union
538         {
539             uint32_t               Mip0SlicePitch;
540             uint32_t               Gen9PlusSlicePitch;
541         };
542     }                   Lock;
543 
544     struct
545     {
546         union
547         {
548             uint32_t               Offset;
549             GMM_GFX_SIZE_T      Offset64;
550         };
551         uint32_t               XOffset;
552         uint32_t               YOffset;
553         uint32_t               ZOffset;
554     }                   Render;
555 
556     struct
557     {
558         GMM_GFX_SIZE_T      Offset;
559         GMM_GFX_SIZE_T      TileRowPitch;
560         GMM_GFX_SIZE_T      TileDepthPitch;
561     }                   StdLayout;
562 
563 }GMM_REQ_OFFSET_INFO;
564 
565 //===========================================================================
566 // typedef:
567 //     GMM_HW_COMMAND_STREAMER
568 //
569 // Description: Enumeration to allow callers to specify a command streamer.
570 //
571 //---------------------------------------------------------------------------
572 typedef enum GMM_HW_COMMAND_STREAMER_ENUM
573 {
574     GMM_HW_COMMAND_STREAMER_NULL = 0, // <-- This stays zero.
575     GMM_CS,      // Render Command Streamer
576     GMM_BCS,     // Blitter (BLT) Command Streamer
577     GMM_VCS,     // Video Codec (MFX) Command Streamer
578     GMM_VECS,    // Video Enhancement (VEBOX) Command Streamer
579     GMM_VCS2,    // Video Codec (MFX) Command Streamer 2
580     GMM_COMPUTE, // Compute Only Command Streamer
581     GMM_PICS,    // Pinning Command Streamer
582     GMM_CAPTURE, // Capture Command Streamer
583     GMM_HW_COMMAND_STREAMERS // <-- This stays last.
584 } GMM_HW_COMMAND_STREAMER;
585 
586 // Reset packing alignment to project default
587 #pragma pack(pop)
588 
589 //===========================================================================
590 // typedef:
591 //        GMM_RESOURCE_TYPE
592 //
593 // Description:
594 //     This enum describe type of resource requested
595 //---------------------------------------------------------------------------
596 typedef enum GMM_RESOURCE_TYPE_ENUM
597 {
598     RESOURCE_INVALID,
599 
600     // User-mode use
601     RESOURCE_1D,
602     RESOURCE_2D,
603     RESOURCE_3D,
604     RESOURCE_CUBE,
605     RESOURCE_SCRATCH,
606     RESOURCE_BUFFER,
607 
608     //Kernel-mode use only
609     RESOURCE_KMD_CHECK_START,
610     RESOURCE_PRIMARY,
611     RESOURCE_SHADOW,
612     RESOURCE_STAGING,
613     RESOURCE_CURSOR,
614     RESOURCE_FBC,
615     RESOURCE_PWR_CONTEXT,
616     RESOURCE_PERF_DATA_QUEUE,
617     RESOURCE_KMD_BUFFER,
618     RESOURCE_HW_CONTEXT,
619     RESOURCE_TAG_PAGE,
620     RESOURCE_NNDI,
621     RESOURCE_HARDWARE_MBM,
622     RESOURCE_OVERLAY_DMA,
623     RESOURCE_OVERLAY_INTERMEDIATE_SURFACE,
624     RESOURCE_GTT_TRANSFER_REGION,
625     RESOURCE_GLOBAL_BUFFER,
626     RESOURCE_GDI,
627     RESOURCE_NULL_CONTEXT_INDIRECT_STATE,
628     RESOURCE_GFX_CLIENT_BUFFER,
629     RESOURCE_KMD_CHECK_END,
630     RESOURCE_SEGMENT,
631     RESOURCE_IFFS_MAPTOGTT,
632 #if _WIN32
633     RESOURCE_WGBOX_ENCODE_STATE,
634     RESOURCE_WGBOX_ENCODE_DISPLAY,
635     RESOURCE_WGBOX_ENCODE_REFERENCE,
636     RESOURCE_WGBOX_ENCODE_TFD,
637 #endif
638     // only used for allocation of context specific SVM Present kernels buffer
639     RESOURCE_SVM_KERNELS_BUFFER,
640 
641     GMM_MAX_HW_RESOURCE_TYPE
642 } GMM_RESOURCE_TYPE;
643