Use exported APIs from ClientContext

[CP] dynamic gmm header file change copy from CL793947

Because certain ResourceInfo exported APIs are inlined,
GmmLib is accidently exposing internal functions/class members.
This is causing build issues with unresolved symbols when clients switch to dynamic linking.

Fix is to use ClientContext exported APIs for UMD clients.

Change-Id: I58db29d2f31c3f2586de80369f5ed085e14f06be
Signed-off-by: drprajap <dimpalben.r.prajapati@intel.com>
diff --git a/Source/GmmLib/inc/External/Common/GmmInfo.h b/Source/GmmLib/inc/External/Common/GmmInfo.h
index a1cd73a..3aec4c6 100644
--- a/Source/GmmLib/inc/External/Common/GmmInfo.h
+++ b/Source/GmmLib/inc/External/Common/GmmInfo.h
@@ -593,7 +593,13 @@
     #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)
-
-
+#pragma pack(pop)
\ No newline at end of file
diff --git a/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h b/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h
index a2ec19e..a3e83cf 100644
--- a/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h
+++ b/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h
@@ -388,11 +388,11 @@
             {
                 const GMM_PLATFORM_INFO   *pPlatform;
 
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                 pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
 
                 if (Surf.Flags.Gpu.UnifiedAuxSurface)
                 {
-                    if (GmmIsPlanar(Surf.Format))
+                    if (GMM_IS_PLANAR(Surf.Format))
                     {
                         return static_cast<uint32_t>(AuxSurf.OffsetInfo.Plane.ArrayQPitch);
                     }
@@ -421,10 +421,10 @@
                 uint32_t               QPitch;
                 const GMM_PLATFORM_INFO   *pPlatform;
 
-                __GMM_ASSERT(GmmIsPlanar(Surf.Format));
+                __GMM_ASSERT(GMM_IS_PLANAR(Surf.Format));
                 GMM_UNREFERENCED_LOCAL_VARIABLE(Plane);
 
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
                 __GMM_ASSERT(GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN8_CORE);
 
                 QPitch = static_cast<uint32_t>(Surf.OffsetInfo.Plane.ArrayQPitch / Surf.Pitch);
@@ -466,7 +466,7 @@
                 TileMode = Surf.TileMode;
                 __GMM_ASSERT(TileMode < GMM_TILE_MODES);
 
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                 pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
                 if (pPlatform->TileInfo[TileMode].LogicalTileWidth != 0)
                 {
                     // In case of Depth/Stencil buffer MSAA TileYs surface, the LogicalTileWidth/Height is smaller than non-MSAA ones
@@ -524,7 +524,7 @@
 
                 __GMM_ASSERT(!AuxSurf.Flags.Info.Linear);
 
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&AuxSurf);
+                 pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&AuxSurf);
 
                 if (Surf.Flags.Gpu.UnifiedAuxSurface)
                 {
@@ -742,7 +742,7 @@
                 GMM_GFX_SIZE_T Offset = 0;
 
                 __GMM_ASSERT(ArrayIndex < Surf.ArraySize);
-                __GMM_ASSERT(GmmIsPlanar(Surf.Format));
+                __GMM_ASSERT(GMM_IS_PLANAR(Surf.Format));
 
                 if (Surf.Flags.Gpu.UnifiedAuxSurface)
                 {
@@ -786,7 +786,7 @@
             {
                 const __GMM_PLATFORM_RESOURCE   *pPlatformResource;
                 uint32_t HAlign;
-                pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                pPlatformResource = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
 
                 if ((GFX_GET_CURRENT_RENDERCORE(pPlatformResource->Platform) >= IGFX_GEN9_CORE) &&
                     !(Surf.Flags.Info.TiledYf || Surf.Flags.Info.TiledYs))
@@ -809,7 +809,7 @@
             {
                 const __GMM_PLATFORM_RESOURCE   *pPlatformResource;
                 uint32_t VAlign;
-                pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                pPlatformResource = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
 
                 if ((GFX_GET_CURRENT_RENDERCORE(pPlatformResource->Platform) >= IGFX_GEN9_CORE) &&
                     !(GetResFlags().Info.TiledYf || GetResFlags().Info.TiledYs))
@@ -976,7 +976,7 @@
             /////////////////////////////////////////////////////////////////////////////////////
             GMM_INLINE_VIRTUAL GMM_INLINE_EXPORTED uint32_t  GMM_STDCALL GetMaxGpuVirtualAddressBits()
             {
-                const GMM_PLATFORM_INFO *pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                 const GMM_PLATFORM_INFO *pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
                 __GMM_ASSERTPTR(pPlatform, 0);
 
                 return pPlatform->MaxGpuVirtualAddressBitsPerResource;
@@ -991,7 +991,7 @@
             {
                 GMM_GFX_SIZE_T Offset = 0;
                 const GMM_PLATFORM_INFO *pPlatform;
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
                 if (Surf.Flags.Gpu.UnifiedAuxSurface)
                 {
                     if ((GmmAuxType == GMM_AUX_CCS) || (GmmAuxType == GMM_AUX_SURF) || (GmmAuxType == GMM_AUX_Y_CCS)
@@ -1258,7 +1258,7 @@
                 uint32_t               HAlign;
                 const GMM_PLATFORM_INFO   *pPlatform;
 
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
 
                 if (GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN8_CORE)
                 {
@@ -1299,7 +1299,7 @@
                 uint32_t               VAlign;
                 const GMM_PLATFORM_INFO   *pPlatform;
 
-                pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
+                 pPlatform = (GMM_PLATFORM_INFO *)GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(&Surf);
 
                 if (GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN8_CORE)
                 {