File: GmmInfo.h

package info (click to toggle)
intel-gmmlib 20.4.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,524 kB
  • sloc: cpp: 52,910; ansic: 5,587; makefile: 6
file content (606 lines) | stat: -rw-r--r-- 24,812 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
/*==============================================================================
Copyright(c) 2017 Intel Corporation

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files(the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and / or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
============================================================================*/
#pragma once

// GmmConst.h needed for GMM_MAX_NUMBER_MOCS_INDEXES
#include "GmmConst.h"
#include "../../../Platform/GmmPlatforms.h"

#ifdef GMM_LIB_DLL
#ifdef _WIN32
#define GMM_MUTEX_HANDLE    HANDLE
#else
#include <pthread.h>
#define GMM_MUTEX_HANDLE    pthread_mutex_t
#endif
#endif

// Set packing alignment
#pragma pack(push, 8)

//===========================================================================
// Forward Declaration: Defined in GmmResourceInfoExt.h
//---------------------------------------------------------------------------
struct GMM_CONTEXT_REC;
typedef struct GMM_CONTEXT_REC GMM_CONTEXT;

//===========================================================================
// typedef:
//      GMM_UMD_CONTEXT
//
// Description:
//      Struct defines user mode GMM context.
//----------------------------------------------------------------------------
typedef struct GMM_UMD_CONTEXT_REC
{
    uint32_t   TBD1;
    uint32_t   TBD2;
    uint32_t   TBD3;
} GMM_UMD_CONTEXT;


#if (!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
#include "GmmClientContext.h"
#endif

//===========================================================================
// typedef:
//      GMM_GLOBAL_CONTEXT
//
// Description:
//     Struct contains contexts for user mode and kernel mode. It also contains
//     platform information. This struct is initialized in user mode with
//     GmmInitGlobalContext().
//
//----------------------------------------------------------------------------

#ifdef __cplusplus
#include "GmmMemAllocator.hpp"

namespace GmmLib
{
    class NON_PAGED_SECTION Context : public GmmMemAllocator
    {
    private:
        static int32_t                   RefCount;
        GMM_CLIENT                       ClientType;
        GMM_PLATFORM_INFO_CLASS*         pPlatformInfo;

        GMM_TEXTURE_CALC*                pTextureCalc;
        SKU_FEATURE_TABLE                SkuTable;
        WA_TABLE                         WaTable;
        GT_SYSTEM_INFO                   GtSysInfo;

    #if(defined(__GMM_KMD__))
        GMM_GTT_CONTEXT              GttContext;
    #endif

        GMM_CONTEXT                      *pGmmKmdContext;
        GMM_UMD_CONTEXT                  *pGmmUmdContext;
        void                             *pKmdHwDev;
        void                             *pUmdAdapter;

        GMM_CACHE_POLICY_ELEMENT         CachePolicy[GMM_RESOURCE_USAGE_MAX];
        GMM_CACHE_POLICY_TBL_ELEMENT     CachePolicyTbl[GMM_MAX_NUMBER_MOCS_INDEXES];
        GMM_CACHE_POLICY                 *pGmmCachePolicy;

    #if(defined(__GMM_KMD__))
        uint64_t           IA32ePATTable;
        GMM_PRIVATE_PAT     PrivatePATTable[GMM_NUM_PAT_ENTRIES];
        int32_t                PrivatePATTableMemoryType[GMM_NUM_GFX_PAT_TYPES];
    #endif

        // Padding Percentage limit on 64KB paged resource
        uint32_t               AllowedPaddingFor64KbPagesPercentage;
        uint64_t              InternalGpuVaMax;

#ifdef GMM_LIB_DLL
        // Mutex Object used for synchronization of ProcessSingleton Context
        static GMM_MUTEX_HANDLE           SingletonContextSyncMutex;
#endif

    public :
        //Constructors and destructors
        Context();
        ~Context();

        static int32_t IncrementRefCount()  // Returns the current RefCount and then increment it
        {
#if defined(_WIN32)
            return(InterlockedIncrement((LONG *)&RefCount) - 1);  //InterLockedIncrement() returns incremented value
#elif defined(__linux__)
            return(__sync_fetch_and_add(&RefCount, 1));
#endif
        }

        static int32_t DecrementRefCount()
        {
            int CurrentValue = 0;
            int TargetValue = 0;
            do
            {
                CurrentValue = RefCount;
                if (CurrentValue > 0)
                {
                    TargetValue = CurrentValue - 1;
                }
                else
                {
                    break;
                }
#if defined(_WIN32)
            } while (!(InterlockedCompareExchange((LONG *)&RefCount, TargetValue, CurrentValue) == CurrentValue));
#elif defined(__linux__)
            } while (!__sync_bool_compare_and_swap(&RefCount, CurrentValue, TargetValue));
#endif

            return TargetValue;
        }

        GMM_STATUS GMM_STDCALL InitContext(
                                    const PLATFORM& Platform,
                                    const SKU_FEATURE_TABLE* pSkuTable,
                                    const WA_TABLE* pWaTable,
                                    const GT_SYSTEM_INFO* pGtSysInfo,
                                    GMM_CLIENT ClientType);

        void GMM_STDCALL DestroyContext();

#if (!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
        GMM_CLIENT_CONTEXT *pGmmGlobalClientContext;
#endif


        //Inline functions
        /////////////////////////////////////////////////////////////////////////
        /// Returns the client type e.g. DX, OCL, OGL etc.
        /// @return   client type
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CLIENT  GMM_STDCALL  GetClientType()
        {
            return (ClientType);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the PlatformInfo
        /// @return   PlatformInfo
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_PLATFORM_INFO&  GMM_STDCALL  GetPlatformInfo()
        {
            return (const_cast<GMM_PLATFORM_INFO&>(pPlatformInfo->GetData()));
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the cache policy element array ptr
        /// @return   const cache policy elment ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CACHE_POLICY_ELEMENT*  GMM_STDCALL GetCachePolicyUsage()
        {
            return (&CachePolicy[0]);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the cache policy tlb element array ptr
        /// @return   const cache policy elment ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CACHE_POLICY_TBL_ELEMENT*  GMM_STDCALL GetCachePolicyTlbElement()
        {
            return (&CachePolicyTbl[0]);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the texture calculation object ptr
        /// @return   TextureCalc ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_TEXTURE_CALC* GMM_STDCALL GetTextureCalc()
        {
            return (pTextureCalc);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the platform info class object ptr
        /// @return   PlatformInfo class object ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_PLATFORM_INFO_CLASS* GMM_STDCALL GetPlatformInfoObj()
        {
            return (pPlatformInfo);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the cache policy object ptr
        /// @return   TextureCalc ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CACHE_POLICY* GMM_STDCALL GetCachePolicyObj()
        {
            return (pGmmCachePolicy);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the sku table ptr
        /// @return   const SkuTable ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE const SKU_FEATURE_TABLE& GMM_STDCALL GetSkuTable()
        {
            return (SkuTable);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the Wa table ptr
        /// @return    WaTable ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE const WA_TABLE& GMM_STDCALL GetWaTable()
        {
            return (WaTable);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the GT system info ptr
        /// @return   const GtSysInfo ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE const GT_SYSTEM_INFO* GMM_STDCALL GetGtSysInfoPtr()
        {
            return (&GtSysInfo);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the GT system info ptr
        /// @return   GtSysInfo ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GT_SYSTEM_INFO* GMM_STDCALL GetGtSysInfo()
        {
            return (&GtSysInfo);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns Cache policy element for a given usage type
        /// @return   cache policy element
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CACHE_POLICY_ELEMENT GetCachePolicyElement(GMM_RESOURCE_USAGE_TYPE Usage)
        {
            return (CachePolicy[Usage]);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Get padding percentage limit for 64kb pages
        /////////////////////////////////////////////////////////////////////////
        uint32_t GetAllowedPaddingFor64KbPagesPercentage()
        {
            return (AllowedPaddingFor64KbPagesPercentage);
        }

        uint64_t& GetInternalGpuVaRangeLimit()
        {
            return InternalGpuVaMax;
        }

    #ifdef GMM_LIB_DLL
        #ifdef _WIN32
            // ProcessHeapVA Singleton HeapObj
            GMM_HEAP            *pHeapObj;
            uint32_t            ProcessHeapCounter;
            // ProcessVA Partition Address space
            GMM_GFX_PARTITIONING ProcessVA;
            uint32_t            ProcessVACounter;

            /////////////////////////////////////////////////////////////////////////
            /// Get ProcessHeapVA Singleton HeapObj
            /////////////////////////////////////////////////////////////////////////
            GMM_HEAP* GetSharedHeapObject();

            /////////////////////////////////////////////////////////////////////////
            /// Set ProcessHeapVA Singleton HeapObj
            /////////////////////////////////////////////////////////////////////////
            uint32_t SetSharedHeapObject(GMM_HEAP **pProcessHeapObj);

            /////////////////////////////////////////////////////////////////////////
            /// Get or Sets ProcessGfxPartition VA
            /////////////////////////////////////////////////////////////////////////
            void GetProcessGfxPartition(GMM_GFX_PARTITIONING* pProcessVA);

            /////////////////////////////////////////////////////////////////////////
            /// Get or Sets ProcessGfxPartition VA
            /////////////////////////////////////////////////////////////////////////
            void SetProcessGfxPartition(GMM_GFX_PARTITIONING* pProcessVA);

            /////////////////////////////////////////////////////////////////////////
            /// Destroy Sync Mutex created for Singleton Context access
            /////////////////////////////////////////////////////////////////////////
            static void   DestroySingletonContextSyncMutex()
            {
                if (SingletonContextSyncMutex)
                {
                    ::CloseHandle(SingletonContextSyncMutex);
                    SingletonContextSyncMutex = NULL;
                }
            }

            /////////////////////////////////////////////////////////////////////////
            /// Acquire Sync Mutex for Singleton Context access
            /////////////////////////////////////////////////////////////////////////
            static GMM_STATUS   LockSingletonContextSyncMutex()
            {
                if (SingletonContextSyncMutex)
                {
                    while (WAIT_OBJECT_0 != ::WaitForSingleObject(SingletonContextSyncMutex, INFINITE));
                    return GMM_SUCCESS;
                }
                else
                {
                    return GMM_ERROR;
                }
            }

            /////////////////////////////////////////////////////////////////////////
            /// Release Sync Mutex for Singleton Context access
            /////////////////////////////////////////////////////////////////////////
            static GMM_STATUS   UnlockSingletonContextSyncMutex()
            {
                if (SingletonContextSyncMutex)
                {
                    ::ReleaseMutex(SingletonContextSyncMutex);
                    return GMM_SUCCESS;
                }
                else
                {
                    return GMM_ERROR;
                }
            }

        #else // Non Win OS

            /////////////////////////////////////////////////////////////////////////
            /// Destroy Sync Mutex created for Singleton Context access
            /////////////////////////////////////////////////////////////////////////
            static void   DestroySingletonContextSyncMutex()
            {
                pthread_mutex_destroy(&SingletonContextSyncMutex);
            }

            /////////////////////////////////////////////////////////////////////////
            /// Acquire Sync Mutex for Singleton Context access
            /////////////////////////////////////////////////////////////////////////
            static GMM_STATUS   LockSingletonContextSyncMutex()
            {
                pthread_mutex_lock(&SingletonContextSyncMutex);
                return GMM_SUCCESS;
            }

            /////////////////////////////////////////////////////////////////////////
            /// Release Sync Mutex for Singleton Context access
            /////////////////////////////////////////////////////////////////////////
            static GMM_STATUS   UnlockSingletonContextSyncMutex()
            {
                pthread_mutex_unlock(&SingletonContextSyncMutex);
                return GMM_SUCCESS;
            }

        #endif // _WIN32

    #endif // GMM_LIB_DLL

        // KMD specific inline functions
    #ifdef __GMM_KMD__

        /////////////////////////////////////////////////////////////////////////
        /// Returns private PAT table memory type for a given PAT type
        /// @return   PAT Memory type
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE int32_t  GMM_STDCALL GetPrivatePATTableMemoryType(GMM_GFX_PAT_TYPE PatType)
        {
            return (PrivatePATTableMemoryType[PatType]);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns private PAT table memory type array ptr
        /// @return   PAT Memory type array ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE int32_t*  GMM_STDCALL GetPrivatePATTableMemoryType()
        {
            return (PrivatePATTableMemoryType);
        }


        /////////////////////////////////////////////////////////////////////////
        /// Returns private PAT table array ptr
        /// @return   PAT array ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_PRIVATE_PAT* GMM_STDCALL  GetPrivatePATTable()
        {
            return (PrivatePATTable);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns private PAT table entry for a given PAT index
        /// @return   PAT entry
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_PRIVATE_PAT GMM_STDCALL  GetPrivatePATEntry(uint32_t  PatIndex)
        {
            return (PrivatePATTable[PatIndex]);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns gmm kmd context ptr
        /// @return   GmmKmdContext ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CONTEXT* GetGmmKmdContext()
        {
            return (pGmmKmdContext);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Sets gmm kmd context ptr
        /// @return   GmmKmdContext ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE void SetGmmKmdContext(GMM_CONTEXT *pGmmKmdContext)
        {
            this->pGmmKmdContext = pGmmKmdContext;
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns gtt context ptr
        /// @return   GttContext ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_GTT_CONTEXT* GetGttContext()
        {
            return (&GttContext);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns Cache policy tbl element for a given usage type
        /// @return   cache policy tbl element
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_CACHE_POLICY_TBL_ELEMENT GetCachePolicyTblElement(GMM_RESOURCE_USAGE_TYPE Usage)
        {
            return (CachePolicyTbl[Usage]);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Resets  the sku Table after  GmmInitContext() could have changed them
        /// since original latching
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE void SetSkuTable(SKU_FEATURE_TABLE SkuTable)
        {
            this->SkuTable = SkuTable;
        }

        /////////////////////////////////////////////////////////////////////////
        /// Resets  the Wa Table after  GmmInitContext() could have changed them
        /// since original latching
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE void SetWaTable(WA_TABLE WaTable)
        {
            this->WaTable = WaTable;
        }

    #if(_DEBUG || _RELEASE_INTERNAL)

        /////////////////////////////////////////////////////////////////////////
        /// Returns the override platform info class object ptr
        /// @return   PlatformInfo class object ptr
        /////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_PLATFORM_INFO_CLASS* GMM_STDCALL GetOverridePlatformInfoObj()
        {
            return (Override.pPlatformInfo);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the override Platform info ptr to kmd
        /// @return   override PlatformInfo ref
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_PLATFORM_INFO& GMM_STDCALL GetOverridePlatformInfo()
        {
            return (const_cast<GMM_PLATFORM_INFO&>(Override.pPlatformInfo->GetData()));
        }

        /////////////////////////////////////////////////////////////////////////
        /// Set the override platform info calc ptr
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE void SetOverridePlatformInfoObj(GMM_PLATFORM_INFO_CLASS *pPlatformInfoObj)
        {
            Override.pPlatformInfo = pPlatformInfoObj;
        }

        /////////////////////////////////////////////////////////////////////////
        /// Returns the override Texture calc ptr to kmd
        /// @return   override Texture calc ptr
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE GMM_TEXTURE_CALC* GetOverrideTextureCalc()
        {
            return (Override.pTextureCalc);
        }

        /////////////////////////////////////////////////////////////////////////
        /// Set the override Texture calc ptr
        ////////////////////////////////////////////////////////////////////////
        GMM_INLINE void SetOverrideTextureCalc(GMM_TEXTURE_CALC *pTextureCalc)
        {
            Override.pTextureCalc = pTextureCalc;
        }
    #endif


    #endif
    private: 
        void GMM_STDCALL OverrideSkuWa();
    };
} //namespace

typedef GmmLib::Context GMM_GLOBAL_CONTEXT;

#else
struct GmmLibContext;
typedef struct GmmLibContext GMM_GLOBAL_CONTEXT;
#endif


#ifdef __GMM_KMD__
void GMM_STDCALL GmmLinkKmdContextToGlobalInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_CONTEXT *pGmmKmdContext);
#endif /*__GMM_KMD__*/


//Declare all  GMM global context C interfaces.
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/

    const GMM_PLATFORM_INFO* GMM_STDCALL GmmGetPlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    const GMM_CACHE_POLICY_ELEMENT* GmmGetCachePolicyUsage(GMM_GLOBAL_CONTEXT *pGmmLibContext);
          GMM_TEXTURE_CALC*         GmmGetTextureCalc(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    const SKU_FEATURE_TABLE*        GmmGetSkuTable(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    const WA_TABLE*                 GmmGetWaTable(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    const GT_SYSTEM_INFO*           GmmGetGtSysInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);

#ifdef __GMM_KMD__
    int32_t             GmmGetPrivatePATTableMemoryType(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_GFX_PAT_TYPE PatType);
    GMM_PRIVATE_PAT     GmmGetPrivatePATEntry(GMM_GLOBAL_CONTEXT *pGmmLibContext, uint32_t  PatIndex);
    GMM_CONTEXT*        GmmGetGmmKmdContext(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    GMM_GTT_CONTEXT*    GmmGetGttContext(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    GMM_CACHE_POLICY_TBL_ELEMENT GmmGetCachePolicyTblElement(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
    GMM_CACHE_POLICY_ELEMENT GmmGetCachePolicyElement(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
    void                GmmSetSkuTable(GMM_GLOBAL_CONTEXT *pGmmLibContext, SKU_FEATURE_TABLE SkuTable);
    void                GmmSetWaTable(GMM_GLOBAL_CONTEXT *pGmmLibContext, WA_TABLE WaTable);
    GMM_PLATFORM_INFO*  GmmKmdGetPlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);

#if(_DEBUG || _RELEASE_INTERNAL)
    const GMM_PLATFORM_INFO* GmmGetOverridePlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);
    GMM_TEXTURE_CALC*   GmmGetOverrideTextureCalc(GMM_GLOBAL_CONTEXT *pGmmLibContext);
#endif

#endif

#ifdef __cplusplus
}
#endif /*__cplusplus*/

    #define GMM_OVERRIDE_PLATFORM_INFO(pTexInfo)    (GmmGetPlatformInfo(pGmmGlobalContext))
    #define GMM_OVERRIDE_TEXTURE_CALC(pTexInfo)     (GmmGetTextureCalc(pGmmGlobalContext))

#ifdef __GMM_KMD__
    #define GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(pTexInfo)    GMM_OVERRIDE_PLATFORM_INFO(pTexInfo)
    #define GMM_IS_PLANAR(Format)                            GmmIsPlanar(Format)
#else
    #define GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(pTexInfo)    (&pClientContext->GetPlatformInfo())
    #define GMM_IS_PLANAR(Format)                            (pClientContext->IsPlanar(Format))
#endif

// Reset packing alignment to project default
#pragma pack(pop)