Planar Surface Redescription and pitch adjustment. (#31)

diff --git a/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp b/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp
index 741e523..3005386 100644
--- a/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp
+++ b/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp
@@ -1231,6 +1231,12 @@
 /////////////////////////////////////////////////////////////////////////////////////
 GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::GetOffset(GMM_REQ_OFFSET_INFO &ReqInfo)
 {
+    GMM_TEXTURE_CALC *pTextureCalc;
+
+    pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf);
+
+    __GMM_ASSERT((pTextureCalc != NULL))
+
     if(Surf.Flags.Info.RedecribedPlanes)
     {
         uint8_t RestoreReqStdLayout = ReqInfo.ReqStdLayout ? 1 : 0;
@@ -1246,6 +1252,7 @@
         if(ReqInfo.ReqStdLayout)
         {
             GMM_REQ_OFFSET_INFO TempReqInfo[GMM_MAX_PLANE] = {0};
+	    GMM_TEXTURE_INFO    TexInfo[GMM_MAX_PLANE];
             uint32_t            Plane, TotalPlanes = GmmLib::Utility::GmmGetNumPlanes(Surf.Format);
 
             // Caller must specify which plane they need the offset into if not
@@ -1262,11 +1269,15 @@
             TempReqInfo[GMM_PLANE_Y].ReqLock = TempReqInfo[GMM_PLANE_Y].ReqRender = 0;
 
             TempReqInfo[GMM_PLANE_V] = TempReqInfo[GMM_PLANE_U] = TempReqInfo[GMM_PLANE_Y];
+            
+	    pTextureCalc->GetRedescribedPlaneParams(&Surf, GMM_PLANE_Y, &TexInfo[GMM_PLANE_Y]);
+            pTextureCalc->GetRedescribedPlaneParams(&Surf, GMM_PLANE_U, &TexInfo[GMM_PLANE_U]);
+            pTextureCalc->GetRedescribedPlaneParams(&Surf, GMM_PLANE_V, &TexInfo[GMM_PLANE_V]);
 
-            if(GMM_SUCCESS != GmmTexGetMipMapOffset(&PlaneSurf[GMM_PLANE_Y], &TempReqInfo[GMM_PLANE_Y]) ||
-               GMM_SUCCESS != GmmTexGetMipMapOffset(&PlaneSurf[GMM_PLANE_U], &TempReqInfo[GMM_PLANE_U]) ||
-               GMM_SUCCESS != GmmTexGetMipMapOffset(&PlaneSurf[GMM_PLANE_V], &TempReqInfo[GMM_PLANE_V]))
-            {
+            if(GMM_SUCCESS != GmmTexGetMipMapOffset(&TexInfo[GMM_PLANE_Y], &TempReqInfo[GMM_PLANE_Y]) ||
+               GMM_SUCCESS != GmmTexGetMipMapOffset(&TexInfo[GMM_PLANE_U], &TempReqInfo[GMM_PLANE_U]) ||
+               GMM_SUCCESS != GmmTexGetMipMapOffset(&TexInfo[GMM_PLANE_V], &TempReqInfo[GMM_PLANE_V]))
+	    {
                 __GMM_ASSERT(0);
                 return GMM_ERROR;
             }
@@ -1295,9 +1306,10 @@
                 {
                     // Find the size of the previous planes and add it to the offset
                     TempReqInfo[Plane].StdLayout.Offset = -1;
-
-                    if(GMM_SUCCESS != GmmTexGetMipMapOffset(&PlaneSurf[Plane], &TempReqInfo[Plane]))
+                
+		    if(GMM_SUCCESS != GmmTexGetMipMapOffset(&TexInfo[Plane], &TempReqInfo[Plane]))
                     {
+                 
                         __GMM_ASSERT(0);
                         return GMM_ERROR;
                     }
@@ -1336,6 +1348,7 @@
     uint8_t                  Success = 1;
     GMM_TEXTURE_INFO *       pTexInfo;
     GMM_TEXTURE_CALC *       pTextureCalc;
+    GMM_TEXTURE_INFO         RedescribedPlaneInfo;
 
     __GMM_ASSERTPTR(pBlt, 0);
 
@@ -1468,13 +1481,15 @@
 
         if(pBlt->Gpu.OffsetY < pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_U])
         {
+	    pTextureCalc->GetRedescribedPlaneParams(pTexInfo, GMM_PLANE_Y, &RedescribedPlaneInfo);
             // Y Plane
-            pTexInfo = &(PlaneSurf[GMM_PLANE_Y]);
+            pTexInfo = &RedescribedPlaneInfo;
         }
         else
         {
             // UV Plane
-            pTexInfo = &(PlaneSurf[GMM_PLANE_U]);
+	    pTextureCalc->GetRedescribedPlaneParams(pTexInfo, GMM_PLANE_U, &RedescribedPlaneInfo);
+            pTexInfo = &RedescribedPlaneInfo;
         }
     }
 
@@ -1869,12 +1884,14 @@
     uint8_t                  WasFinalSpan = 0;
     GMM_TEXTURE_INFO *       pTexInfo;
     GMM_TEXTURE_CALC *       pTextureCalc;
+    GMM_TEXTURE_INFO         RedescribedPlaneInfo;
 
     __GMM_ASSERT(Surf.Flags.Info.StdSwizzle);
 
     pPlatform    = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
     pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf);
 
+    __GMM_ASSERT(pTextureCalc != NULL);
     pTexInfo = &Surf;
 
     if(pMapping->Type == GMM_MAPPING_GEN9_YS_TO_STDSWIZZLE)
@@ -1933,7 +1950,9 @@
                 pMapping->__NextSpan.VirtualOffset  = ReqInfo.Render.Offset64;
             }
 
-            pTexInfo = &PlaneSurf[pMapping->Scratch.Plane];
+	    pTextureCalc->GetRedescribedPlaneParams(pTexInfo, GMM_PLANE_Y, &RedescribedPlaneInfo);
+            pTexInfo = &RedescribedPlaneInfo;
+
         }
 
         // Initialization of Mapping Params...
diff --git a/Source/GmmLib/Texture/GmmGen10Texture.cpp b/Source/GmmLib/Texture/GmmGen10Texture.cpp
index e8dbb5c..402e412 100644
--- a/Source/GmmLib/Texture/GmmGen10Texture.cpp
+++ b/Source/GmmLib/Texture/GmmGen10Texture.cpp
@@ -898,6 +898,14 @@
             pTexInfo->Flags.Gpu.MMC = 0;
         }
     }
+    
+    if(pTexInfo->Flags.Info.RedecribedPlanes)
+    {
+        if(false == RedescribeTexturePlanes(pTexInfo, &WidthBytesPhysical))
+        {
+            __GMM_ASSERT(FALSE);
+        }
+    }
 
     if((Status = // <-- Note assignment.
         FillTexPitchAndSize(
diff --git a/Source/GmmLib/Texture/GmmGen11Texture.cpp b/Source/GmmLib/Texture/GmmGen11Texture.cpp
index cd1bbdb..474dfd7 100644
--- a/Source/GmmLib/Texture/GmmGen11Texture.cpp
+++ b/Source/GmmLib/Texture/GmmGen11Texture.cpp
@@ -1086,6 +1086,14 @@
         }
     }
 
+    if(pTexInfo->Flags.Info.RedecribedPlanes)
+    {
+        if(false == RedescribeTexturePlanes(pTexInfo, &WidthBytesPhysical))
+        {
+            __GMM_ASSERT(FALSE);
+        }
+    }
+
     if((Status = // <-- Note assignment.
         FillTexPitchAndSize(
         pTexInfo, WidthBytesPhysical, Height, pRestrictions)) == GMM_SUCCESS)
diff --git a/Source/GmmLib/Texture/GmmGen12Texture.cpp b/Source/GmmLib/Texture/GmmGen12Texture.cpp
index f9c444d..65fc7e5 100644
--- a/Source/GmmLib/Texture/GmmGen12Texture.cpp
+++ b/Source/GmmLib/Texture/GmmGen12Texture.cpp
@@ -923,7 +923,15 @@
 
         Height = YHeight + VHeight;
     }
-
+    
+    if(pTexInfo->Flags.Info.RedecribedPlanes)
+    {
+        if(false == RedescribeTexturePlanes(pTexInfo, &WidthBytesPhysical))
+        {
+            __GMM_ASSERT(FALSE);
+        }
+    }
+    
     if((Status = // <-- Note assignment.
         FillTexPitchAndSize(
         pTexInfo, WidthBytesPhysical, Height, pRestrictions)) == GMM_SUCCESS)
diff --git a/Source/GmmLib/Texture/GmmTexture.cpp b/Source/GmmLib/Texture/GmmTexture.cpp
index a421766..c7143b5 100644
--- a/Source/GmmLib/Texture/GmmTexture.cpp
+++ b/Source/GmmLib/Texture/GmmTexture.cpp
@@ -629,3 +629,200 @@
     *pRowFactor = 0;
     return false;
 }
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// This function redescribes WidthBytesPhysical of main surface as per UV plane bpp and tilemode
+///
+/// @return     ::bool
+/////////////////////////////////////////////////////////////////////////////////////
+bool GmmLib::GmmTextureCalc::RedescribeTexturePlanes(GMM_TEXTURE_INFO *pTexInfo, uint32_t *pWidthBytesPhysical)
+{
+    GMM_STATUS               Status = GMM_SUCCESS;
+    GMM_TEXTURE_INFO         TexInfoUVPlane;
+    const GMM_PLATFORM_INFO *pPlatform = GMM_OVERRIDE_PLATFORM_INFO(pTexInfo);
+
+    __GMM_ASSERT(pTexInfo);
+    __GMM_ASSERT(pTexInfo->Flags.Info.RedecribedPlanes);
+    __GMM_ASSERT(pWidthBytesPhysical);
+
+    TexInfoUVPlane = *pTexInfo;
+#ifdef _WIN32
+    memcpy_s(&TexInfoUVPlane, sizeof(GMM_TEXTURE_INFO), pTexInfo, sizeof(GMM_TEXTURE_INFO));
+#else
+    memcpy(&TexInfoUVPlane, pTexInfo, sizeof(GMM_TEXTURE_INFO));
+#endif // _WIN32
+
+
+    if(GmmIsUVPacked(pTexInfo->Format))
+    {
+        // UV packed resources must have two seperate
+        // tiling modes per plane, due to the packed
+        // UV plane having twice the bits per pixel
+        // as the Y plane.
+        switch(pTexInfo->Format)
+        {
+            case GMM_FORMAT_NV12:
+            case GMM_FORMAT_NV21:
+            case GMM_FORMAT_P208:
+                TexInfoUVPlane.BitsPerPixel = 16; // Redescribe bpp to 16 from 8
+                break;
+            case GMM_FORMAT_P010:
+            case GMM_FORMAT_P012:
+            case GMM_FORMAT_P016:
+            case GMM_FORMAT_P216:
+                TexInfoUVPlane.BitsPerPixel = 32;
+                break;
+            default:
+                GMM_ASSERTDPF(0, "Unsupported format/pixel size combo!");
+                Status = GMM_INVALIDPARAM;
+                goto ERROR_CASE;
+                break;
+        }
+    }
+    else
+    {
+        // Non-UV packed surfaces, TileMode and bpp of each plane is same as that of pTexInfo
+    }
+
+    SetTileMode(&TexInfoUVPlane);
+    *pWidthBytesPhysical = GFX_ALIGN(*pWidthBytesPhysical, pPlatform->TileInfo[TexInfoUVPlane.TileMode].LogicalTileWidth);
+
+ERROR_CASE:
+    return (Status == GMM_SUCCESS) ? true : false;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// This function returns per plane redescribed parameters (pRedescribedTexInfo: fmt, tilemode,bpp, width, height, size) when main surface pTexInfo is passed
+///
+/// @return     ::bool
+/////////////////////////////////////////////////////////////////////////////////////
+bool GmmLib::GmmTextureCalc::GetRedescribedPlaneParams(GMM_TEXTURE_INFO *pTexInfo, GMM_YUV_PLANE PlaneType, GMM_TEXTURE_INFO *pRedescribedTexInfo)
+{
+    GMM_STATUS               Status = GMM_SUCCESS;
+    GMM_TEXTURE_INFO         TexInfoUVPlane;
+    const GMM_PLATFORM_INFO *pPlatform = GMM_OVERRIDE_PLATFORM_INFO(pTexInfo);
+
+    __GMM_ASSERT(pTexInfo);
+    __GMM_ASSERT(pTexInfo->Flags.Info.RedecribedPlanes);
+    __GMM_ASSERT(pRedescribedTexInfo);
+
+    *pRedescribedTexInfo                             = *pTexInfo;
+    pRedescribedTexInfo->Flags.Info.RedecribedPlanes = 0;
+#ifdef _WIN32
+    memcpy_s(&TexInfoUVPlane, sizeof(GMM_TEXTURE_INFO), pTexInfo, sizeof(GMM_TEXTURE_INFO));
+#else
+    memcpy(&TexInfoUVPlane, pTexInfo, sizeof(GMM_TEXTURE_INFO));
+#endif // _WIN32
+
+    if(GmmIsUVPacked(pTexInfo->Format))
+    {
+        // UV packed resources must have two seperate
+        // tiling modes per plane, due to the packed
+        // UV plane having twice the bits per pixel
+        // as the Y plane.
+        if((PlaneType == GMM_PLANE_U) || (PlaneType == GMM_PLANE_V))
+        {
+            switch(pTexInfo->Format)
+            {
+                // GMM_FORMAT_NV11  :                               linear format, no tiling supported, hence no redescription supported
+                case GMM_FORMAT_NV12:
+                case GMM_FORMAT_NV21:
+                    pRedescribedTexInfo->BitsPerPixel = 16;
+                    pRedescribedTexInfo->BaseWidth    = GFX_CEIL_DIV(pTexInfo->BaseWidth, 2);
+                    pRedescribedTexInfo->BaseHeight   = GFX_CEIL_DIV(pTexInfo->BaseHeight, 2);
+                    break;
+                case GMM_FORMAT_P208:
+                    pRedescribedTexInfo->BitsPerPixel = 16;
+                    pRedescribedTexInfo->BaseWidth    = GFX_CEIL_DIV(pTexInfo->BaseWidth, 2);
+                    // same base height as main surface
+                    break;
+                case GMM_FORMAT_P010:
+                case GMM_FORMAT_P012:
+                case GMM_FORMAT_P016:
+                    pRedescribedTexInfo->BitsPerPixel = 32;
+                    pRedescribedTexInfo->BaseWidth    = GFX_CEIL_DIV(pTexInfo->BaseWidth, 2);
+                    pRedescribedTexInfo->BaseHeight   = GFX_CEIL_DIV(pTexInfo->BaseHeight, 2);
+                    break;
+                case GMM_FORMAT_P216:
+                    pRedescribedTexInfo->BitsPerPixel = 32;
+                    pRedescribedTexInfo->BaseWidth    = GFX_CEIL_DIV(pTexInfo->BaseWidth, 2);
+                    // same base height as main surface
+                    break;
+                default:
+                    GMM_ASSERTDPF(0, "Unsupported format/pixel size combo!");
+                    Status = GMM_INVALIDPARAM;
+                    goto ERROR_CASE;
+                    break;
+            }
+        }
+    }
+    else
+    {
+        // Non-UV packed surfaces TileMode of each plane is same as that of pTexInfo
+        if((PlaneType == GMM_PLANE_U) || (PlaneType == GMM_PLANE_V))
+        { // Non-UV packed surfaces only require the plane descriptors have proper height and width for each plane
+            switch(pTexInfo->Format)
+            {
+                case GMM_FORMAT_IMC1:
+                case GMM_FORMAT_IMC2:
+                case GMM_FORMAT_IMC3:
+                case GMM_FORMAT_IMC4:
+                case GMM_FORMAT_MFX_JPEG_YUV420:
+                    pRedescribedTexInfo->BaseWidth  = GFX_CEIL_DIV(pTexInfo->BaseWidth, 2);
+                    pRedescribedTexInfo->BaseHeight = GFX_CEIL_DIV(pTexInfo->BaseHeight, 2);
+                    break;
+                case GMM_FORMAT_MFX_JPEG_YUV422V:
+                    pRedescribedTexInfo->BaseHeight = GFX_CEIL_DIV(pTexInfo->BaseHeight, 2);
+                    break;
+                case GMM_FORMAT_MFX_JPEG_YUV411R_TYPE:
+                    pRedescribedTexInfo->BaseHeight = GFX_CEIL_DIV(pTexInfo->BaseHeight, 4);
+                    break;
+                case GMM_FORMAT_MFX_JPEG_YUV411:
+                    pRedescribedTexInfo->BaseWidth = GFX_CEIL_DIV(pTexInfo->BaseWidth, 4);
+                    break;
+                case GMM_FORMAT_MFX_JPEG_YUV422H:
+                    pRedescribedTexInfo->BaseWidth = GFX_CEIL_DIV(pTexInfo->BaseWidth, 2);
+                    break;
+                default:
+                    GMM_ASSERTDPF(0, "Unsupported format/pixel size combo!");
+                    Status = GMM_INVALIDPARAM;
+                    goto ERROR_CASE;
+                    break;
+            }
+        }
+    }
+
+    SetTileMode(pRedescribedTexInfo);
+    switch(pRedescribedTexInfo->BitsPerPixel)
+    {
+        case 8:
+            pRedescribedTexInfo->Format = GMM_FORMAT_R8_UINT;
+            break;
+        case 16:
+            pRedescribedTexInfo->Format = GMM_FORMAT_R16_UINT;
+            break;
+        case 32:
+            pRedescribedTexInfo->Format = GMM_FORMAT_R32_UINT;
+            break;
+        default:
+            GMM_ASSERTDPF(0, "Unsupported format/pixel size combo!");
+            Status = GMM_INVALIDPARAM;
+            goto ERROR_CASE;
+            break;
+    }
+    if(pTexInfo->ArraySize > 1)
+    {
+        pRedescribedTexInfo->OffsetInfo.Plane.ArrayQPitch = 0; // no longer a planar format on redescription
+        pRedescribedTexInfo->Alignment.QPitch             = GFX_ALIGN(pRedescribedTexInfo->BaseHeight, pTexInfo->Alignment.VAlign);
+        pRedescribedTexInfo->OffsetInfo.Texture2DOffsetInfo.ArrayQPitchRender =
+        pRedescribedTexInfo->OffsetInfo.Texture2DOffsetInfo.ArrayQPitchLock = pRedescribedTexInfo->Alignment.QPitch * pTexInfo->Pitch;
+        pRedescribedTexInfo->Size                                           = pRedescribedTexInfo->Alignment.QPitch * pTexInfo->Pitch * pTexInfo->ArraySize;
+    }
+    else
+    {
+        pRedescribedTexInfo->Size = (GFX_ALIGN(pRedescribedTexInfo->BaseHeight, pTexInfo->Alignment.VAlign)) * pTexInfo->Pitch;
+    }
+
+ERROR_CASE:
+    return (Status == GMM_SUCCESS) ? true : false;
+}
diff --git a/Source/GmmLib/Texture/GmmTextureAlloc.cpp b/Source/GmmLib/Texture/GmmTextureAlloc.cpp
index a836b02..2e3e128 100644
--- a/Source/GmmLib/Texture/GmmTextureAlloc.cpp
+++ b/Source/GmmLib/Texture/GmmTextureAlloc.cpp
@@ -1366,6 +1366,14 @@
         }
     }
 
+    if(pTexInfo->Flags.Info.RedecribedPlanes)
+    {
+        if(false == RedescribeTexturePlanes(pTexInfo, &WidthBytesPhysical))
+        {
+            __GMM_ASSERT(FALSE);
+        }
+    }
+
     if((Status = // <-- Note assignment.
         FillTexPitchAndSize(
         pTexInfo, WidthBytesPhysical, Height, pRestrictions)) == GMM_SUCCESS)
diff --git a/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp b/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp
index 7e9242a..213a164 100644
--- a/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp
+++ b/Source/GmmLib/ULT/GmmGen12dGPUResourceULT.cpp
@@ -971,7 +971,7 @@
 }
 
 /// @brief ULT for Planar Ys Compressed resource
-TEST_F(CTestGen12dGPUResource, DISABLED_TestPlanarYsCompressedResource)
+TEST_F(CTestGen12dGPUResource, TestPlanarTile64CompressedResource)
 {
     const TEST_TILE_TYPE TileTypeSupported = {TEST_TILEYS};
 
@@ -986,10 +986,10 @@
     //gmmParams.Flags.Gpu.CCS = 1;
     gmmParams.Flags.Gpu.UnifiedAuxSurface = 1;
     gmmParams.Flags.Info.MediaCompressed  = 1;
-    gmmParams.BaseWidth64                 = 0x100;
-    gmmParams.BaseHeight                  = 0x50;
+    gmmParams.BaseWidth64                 = 0x64;
+    gmmParams.BaseHeight                  = 0x64;
     gmmParams.Depth                       = 0x1;
-    SetTileFlag(gmmParams, TEST_TILEYS); // TileYS only
+    gmmParams.ArraySize                   = 2;
 
     GMM_RESOURCE_FORMAT Format[4] = {GMM_FORMAT_NV12, GMM_FORMAT_NV21, GMM_FORMAT_P010, GMM_FORMAT_P016};
     for(auto fmt : Format)
@@ -997,7 +997,7 @@
         gmmParams.Format = fmt; // 8bpp(NV12) , P016 (16bpp), P010 (16bpp), NV21(8bpp)
 
         TEST_BPP Ybpp, UVbpp;
-        //Yf/Ys could be accessed on CPU/app where UV plane bpp is double
+        //could be accessed on CPU/app where UV plane bpp is double
         switch(pGmmULTClientContext->GetPlatformInfo().FormatTable[gmmParams.Format].Element.BitsPer)
         {
             case 8:
@@ -1013,63 +1013,26 @@
         }
 
         gmmParams.Flags.Gpu.UnifiedAuxSurface = 1;
-        GMM_TILE_MODE TileMode                = DEFINE_TILE(YS_2D, Ybpp);
 
         GMM_RESOURCE_INFO *ResourceInfo;
         ResourceInfo = pGmmULTClientContext->CreateResInfoObject(&gmmParams);
-
-        //Redescribed Pitch isn't modified unless Y, UV pitch differ
-        //But, original Pitch is padded to have even Tile, hence use Ybpp ExpectedPitch
-        //to verify Pitch, but redescribed pitch to verify size
-        uint32_t ExpectedPitch    = GMM_ULT_ALIGN(gmmParams.BaseWidth64 * (int)pow(2.0, Ybpp), TileSize[Ybpp][0]);
-        uint32_t RedescribedPitch = GMM_ULT_ALIGN(gmmParams.BaseWidth64 / 2 * (int)pow(2.0, UVbpp), TileSize[UVbpp][0]);
-
-        if(ExpectedPitch != RedescribedPitch)
-        {
-            ExpectedPitch = RedescribedPitch;
-        }
-        else
-        {
-            //ExpectedPitch = GMM_ULT_ALIGN(ExpectedPitch, 2 * TileSize[Ybpp][0]); //pad to even tile
-            //ExpectedPitch = GMM_ULT_ALIGN(ExpectedPitch, (2 * TileSize[UVbpp][0]/ (int)pow(2.0, UVbpp))); //pad to even tile
-        }
-
-        VerifyResourcePitch<true>(ResourceInfo, ExpectedPitch);
-        VerifyResourcePitchInTiles<true>(ResourceInfo, ExpectedPitch / TileSize[Ybpp][0]);
-
-        int YSizeInTiles = (GMM_ULT_ALIGN(gmmParams.BaseHeight, TileSize[Ybpp][1]) / TileSize[Ybpp][1]) *
-                           RedescribedPitch / TileSize[Ybpp][0];
-        int UVSizeInTiles = (GMM_ULT_ALIGN(gmmParams.BaseHeight / 2, TileSize[UVbpp][1]) / TileSize[UVbpp][1]) *
-                            RedescribedPitch / TileSize[UVbpp][0];
-        VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(64) * (YSizeInTiles + UVSizeInTiles));
-        VerifyResourceHAlign<true>(ResourceInfo, TileSize[UVbpp][0] / pow(2.0, UVbpp)); // For Yf/Ys planar redescription causes UV width, Y height alignment
-        VerifyResourceVAlign<true>(ResourceInfo, TileSize[Ybpp][1]);
-        VerifyResourceQPitch<false>(ResourceInfo, 0); // N/A for non-mipped surface
-
-        //test main surface base alignment is 16KB
-        //For Yf test main surface pitch is 4-tileYF aligned
-        EXPECT_EQ(GMM_KBYTE(64), ResourceInfo->GetBaseAlignment());
-        //EXPECT_EQ(0, ResourceInfo->GetRenderPitchTiles() % 4);   // Check on YF only
-
-        if(const_cast<SKU_FEATURE_TABLE &>(pGfxAdapterInfo->SkuTable).FtrLinearCCS)
-        {
-            EXPECT_EQ(0, ResourceInfo->GetUnifiedAuxSurfaceOffset(GMM_AUX_CCS) % PAGE_SIZE);
-            EXPECT_EQ(0, ResourceInfo->GetUnifiedAuxSurfaceOffset(GMM_AUX_UV_CCS) % PAGE_SIZE);
-            EXPECT_GE(ResourceInfo->GetSizeAuxSurface(GMM_AUX_CCS), ResourceInfo->GetSizeMainSurface() >> 8);
-        }
-
-        EXPECT_EQ(GMM_KBYTE(4) * 2, ResourceInfo->GetSizeAuxSurface(GMM_AUX_CCS)); // Y and UV Aux are on separate tiles
-
-        { //separate Aux
-            gmmParams.Flags.Gpu.UnifiedAuxSurface = 0;
-
-            GMM_RESOURCE_INFO *AuxResourceInfo;
-            AuxResourceInfo = pGmmULTClientContext->CreateResInfoObject(&gmmParams);
-
-            EXPECT_EQ(ResourceInfo->GetSizeAuxSurface(GMM_AUX_CCS), AuxResourceInfo->GetSizeSurface());
-
-            pGmmULTClientContext->DestroyResInfoObject(AuxResourceInfo);
-        }
+	
+	GMM_REQ_OFFSET_INFO OffsetInfo = {};
+        OffsetInfo.ReqLock             = 1;
+        OffsetInfo.ReqRender           = 1;
+        OffsetInfo.Plane               = GMM_PLANE_Y;
+        OffsetInfo.ArrayIndex          = 1;
+        OffsetInfo.ReqStdLayout        = 0;
+        ResourceInfo->GetOffset(OffsetInfo);
+         
+	// ToDo: add verification
+        //{ //separate Aux
+        //    gmmParams.Flags.Gpu.UnifiedAuxSurface = 0;
+	//    GMM_RESOURCE_INFO *AuxResourceInfo;
+        //    AuxResourceInfo = pGmmULTClientContext->CreateResInfoObject(&gmmParams);
+        //    EXPECT_EQ(ResourceInfo->GetSizeAuxSurface(GMM_AUX_CCS), AuxResourceInfo->GetSizeSurface());
+        //    pGmmULTClientContext->DestroyResInfoObject(AuxResourceInfo);
+        //}
         pGmmULTClientContext->DestroyResInfoObject(ResourceInfo);
     }
 }
diff --git a/Source/GmmLib/inc/Internal/Common/Texture/GmmTextureCalc.h b/Source/GmmLib/inc/Internal/Common/Texture/GmmTextureCalc.h
index b31a065..46c8583 100644
--- a/Source/GmmLib/inc/Internal/Common/Texture/GmmTextureCalc.h
+++ b/Source/GmmLib/inc/Internal/Common/Texture/GmmTextureCalc.h
@@ -369,8 +369,12 @@
                                                                 GMM_GFX_SIZE_T &WidthBytesPhysical,
                                                                 GMM_GFX_SIZE_T &WidthBytesLock);
             GMM_STATUS MSAACompression(GMM_TEXTURE_INFO *pTexInfo);
+	    
+	    bool RedescribeTexturePlanes(GMM_TEXTURE_INFO *pTexInfo, uint32_t *pWidthBytesPhysical);
+	    
+	    bool GetRedescribedPlaneParams(GMM_TEXTURE_INFO *pTexInfo, GMM_YUV_PLANE PlaneType, GMM_TEXTURE_INFO *pRedescribedTexInfo);
 
-            /* inline functions */
+	    /* inline functions */
     };
 
 }