amd/addrlib: update to latest version
[mesa.git] / src / amd / addrlib / r800 / egbaddrlib.cpp
index 393557741bcff48ca9f5ca21fe4154a7af66c868..99aa6cf4cdb52affe42cdcdbf57f9dc9a2cea31b 100644 (file)
 /**
 ****************************************************************************************************
 * @file  egbaddrlib.cpp
-* @brief Contains the EgBasedAddrLib class implementation
+* @brief Contains the EgBasedLib class implementation.
 ****************************************************************************************************
 */
 
 #include "egbaddrlib.h"
 
+namespace Addr
+{
+namespace V1
+{
+
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::EgBasedAddrLib
+*   EgBasedLib::EgBasedLib
 *
 *   @brief
 *       Constructor
@@ -44,8 +49,9 @@
 *
 ****************************************************************************************************
 */
-EgBasedAddrLib::EgBasedAddrLib(const AddrClient* pClient) :
-    AddrLib1(pClient),
+EgBasedLib::EgBasedLib(const Client* pClient)
+    :
+    Lib(pClient),
     m_ranks(0),
     m_logicalBanks(0),
     m_bankInterleave(1)
@@ -54,19 +60,19 @@ EgBasedAddrLib::EgBasedAddrLib(const AddrClient* pClient) :
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::~EgBasedAddrLib
+*   EgBasedLib::~EgBasedLib
 *
 *   @brief
 *       Destructor
 ****************************************************************************************************
 */
-EgBasedAddrLib::~EgBasedAddrLib()
+EgBasedLib::~EgBasedLib()
 {
 }
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::DispatchComputeSurfaceInfo
+*   EgBasedLib::DispatchComputeSurfaceInfo
 *
 *   @brief
 *       Compute surface sizes include padded pitch,height,slices,total size in bytes,
@@ -77,7 +83,7 @@ EgBasedAddrLib::~EgBasedAddrLib()
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::DispatchComputeSurfaceInfo(
+BOOL_32 EgBasedLib::DispatchComputeSurfaceInfo(
     const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
     ) const
@@ -198,7 +204,7 @@ BOOL_32 EgBasedAddrLib::DispatchComputeSurfaceInfo(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceInfoLinear
+*   EgBasedLib::ComputeSurfaceInfoLinear
 *
 *   @brief
 *       Compute linear surface sizes include padded pitch, height, slices, total size in
@@ -209,7 +215,7 @@ BOOL_32 EgBasedAddrLib::DispatchComputeSurfaceInfo(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoLinear(
+BOOL_32 EgBasedLib::ComputeSurfaceInfoLinear(
     const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] Input structure
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,   ///< [out] Output structure
     UINT_32                                 padDims ///< [in] Dimensions to padd
@@ -258,7 +264,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoLinear(
                   pOut->pTileInfo,
                   padDims,
                   pIn->mipLevel,
-                  &expPitch, pOut->pitchAlign,
+                  &expPitch, &pOut->pitchAlign,
                   &expHeight, pOut->heightAlign,
                   &expNumSlices, microTileThickness);
 
@@ -279,6 +285,44 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoLinear(
                                                   &expHeight,
                                                   &pOut->heightAlign);
 
+    if ((pIn->pitchAlign != 0) || (pIn->heightAlign != 0))
+    {
+        if (pIn->pitchAlign != 0)
+        {
+           ADDR_ASSERT((pIn->pitchAlign % pOut->pitchAlign) == 0);
+           pOut->pitchAlign = pIn->pitchAlign;
+
+            if (IsPow2(pOut->pitchAlign))
+            {
+                expPitch = PowTwoAlign(expPitch, pOut->pitchAlign);
+            }
+            else
+            {
+                expPitch += pOut->pitchAlign - 1;
+                expPitch /= pOut->pitchAlign;
+                expPitch *= pOut->pitchAlign;
+            }
+        }
+
+        if (pIn->heightAlign != 0)
+        {
+           ADDR_ASSERT((pIn->heightAlign % pOut->heightAlign) == 0);
+           pOut->heightAlign = pIn->heightAlign;
+
+            if (IsPow2(pOut->heightAlign))
+            {
+                expHeight = PowTwoAlign(expHeight, pOut->heightAlign);
+            }
+            else
+            {
+                expHeight += pOut->heightAlign - 1;
+                expHeight /= pOut->heightAlign;
+                expHeight *= pOut->heightAlign;
+            }
+        }
+
+        logicalSliceSize = BITS_TO_BYTES(expPitch * expHeight * pIn->bpp);
+    }
 
     pOut->pitch = expPitch;
     pOut->height = expHeight;
@@ -293,7 +337,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoLinear(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceInfoMicroTiled
+*   EgBasedLib::ComputeSurfaceInfoMicroTiled
 *
 *   @brief
 *       Compute 1D/Micro Tiled surface sizes include padded pitch, height, slices, total
@@ -304,7 +348,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoLinear(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMicroTiled(
+BOOL_32 EgBasedLib::ComputeSurfaceInfoMicroTiled(
     const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] Input structure
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,       ///< [out] Output structure
     UINT_32                                 padDims,    ///< [in] Dimensions to padd
@@ -372,7 +416,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMicroTiled(
                   pOut->pTileInfo,
                   padDims,
                   pIn->mipLevel,
-                  &expPitch, pOut->pitchAlign,
+                  &expPitch, &pOut->pitchAlign,
                   &expHeight, pOut->heightAlign,
                   &expNumSlices, microTileThickness);
 
@@ -403,7 +447,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMicroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceInfoMacroTiled
+*   EgBasedLib::ComputeSurfaceInfoMacroTiled
 *
 *   @brief
 *       Compute 2D/macro tiled surface sizes include padded pitch, height, slices, total
@@ -414,7 +458,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMicroTiled(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
+BOOL_32 EgBasedLib::ComputeSurfaceInfoMacroTiled(
     const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] Input structure
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,       ///< [out] Output structure
     UINT_32                                 padDims,    ///< [in] Dimensions to padd
@@ -445,12 +489,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
                                                pIn->flags,
                                                pIn->mipLevel,
                                                numSamples,
-                                               pOut->pTileInfo,
-                                               &pOut->baseAlign,
-                                               &pOut->pitchAlign,
-                                               &pOut->heightAlign,
-                                               &pOut->blockWidth,
-                                               &pOut->blockHeight);
+                                               pOut);
 
     if (valid)
     {
@@ -503,12 +542,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
                                                        pIn->flags,
                                                        pIn->mipLevel,
                                                        numSamples,
-                                                       pOut->pTileInfo,
-                                                       &pOut->baseAlign,
-                                                       &pOut->pitchAlign,
-                                                       &pOut->heightAlign,
-                                                       &pOut->blockWidth,
-                                                       &pOut->blockHeight);
+                                                       pOut);
         }
 
         //
@@ -521,7 +555,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
                       pOut->pTileInfo,
                       padDims,
                       pIn->mipLevel,
-                      &paddedPitch, pOut->pitchAlign,
+                      &paddedPitch, &pOut->pitchAlign,
                       &paddedHeight, pOut->heightAlign,
                       &expNumSlices, microTileThickness);
 
@@ -615,7 +649,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceAlignmentsLinear
+*   EgBasedLib::ComputeSurfaceAlignmentsLinear
 *
 *   @brief
 *       Compute linear surface alignment, calculation results are returned through
@@ -625,7 +659,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsLinear(
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsLinear(
     AddrTileMode        tileMode,          ///< [in] tile mode
     UINT_32             bpp,               ///< [in] bits per pixel
     ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
@@ -671,7 +705,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsLinear(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled
+*   EgBasedLib::ComputeSurfaceAlignmentsMicroTiled
 *
 *   @brief
 *       Compute 1D tiled surface alignment, calculation results are returned through
@@ -681,7 +715,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsLinear(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled(
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMicroTiled(
     AddrTileMode        tileMode,          ///< [in] tile mode
     UINT_32             bpp,               ///< [in] bits per pixel
     ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
@@ -705,13 +739,12 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled(
 
     AdjustPitchAlignment(flags, pPitchAlign);
 
-    // ECR#393489
-    // Workaround 2 for 1D tiling -  There is HW bug for Carrizo
+    // Workaround 2 for 1D tiling -  There is HW bug for Carrizo,
     // where it requires the following alignments for 1D tiling.
     if (flags.czDispCompatible && (mipLevel == 0))
     {
         *pBaseAlign  = PowTwoAlign(*pBaseAlign, 4096);                         //Base address MOD 4096 = 0
-        *pPitchAlign = PowTwoAlign(*pPitchAlign, 512 / (BITS_TO_BYTES(bpp))); //(8 lines * pitch * bytes per pixel) MOD 4096 = 0
+        *pPitchAlign = PowTwoAlign(*pPitchAlign, 512 / (BITS_TO_BYTES(bpp)));  //(8 lines * pitch * bytes per pixel) MOD 4096 = 0
     }
     // end Carrizo workaround for 1D tilling
 
@@ -721,7 +754,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlReduceBankWidthHeight
+*   EgBasedLib::HwlReduceBankWidthHeight
 *
 *   @brief
 *       Additional checks, reduce bankHeight/bankWidth if needed and possible
@@ -731,14 +764,14 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::HwlReduceBankWidthHeight(
+BOOL_32 EgBasedLib::HwlReduceBankWidthHeight(
     UINT_32             tileSize,           ///< [in] tile size
     UINT_32             bpp,                ///< [in] bits per pixel
     ADDR_SURFACE_FLAGS  flags,              ///< [in] surface flags
     UINT_32             numSamples,         ///< [in] number of samples
     UINT_32             bankHeightAlign,    ///< [in] bank height alignment
     UINT_32             pipes,              ///< [in] pipes
-    ADDR_TILEINFO*      pTileInfo           ///< [in/out] bank structure.
+    ADDR_TILEINFO*      pTileInfo           ///< [in,out] bank structure.
     ) const
 {
     UINT_32 macroAspectAlign;
@@ -825,7 +858,7 @@ BOOL_32 EgBasedAddrLib::HwlReduceBankWidthHeight(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled
+*   EgBasedLib::ComputeSurfaceAlignmentsMacroTiled
 *
 *   @brief
 *       Compute 2D tiled surface alignment, calculation results are returned through
@@ -835,20 +868,17 @@ BOOL_32 EgBasedAddrLib::HwlReduceBankWidthHeight(
 *       TRUE if no error occurs
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
-    AddrTileMode        tileMode,           ///< [in] tile mode
-    UINT_32             bpp,                ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,              ///< [in] surface flags
-    UINT_32             mipLevel,           ///< [in] mip level
-    UINT_32             numSamples,         ///< [in] number of samples
-    ADDR_TILEINFO*      pTileInfo,          ///< [in/out] bank structure.
-    UINT_32*            pBaseAlign,         ///< [out] base address alignment in bytes
-    UINT_32*            pPitchAlign,        ///< [out] pitch alignment in pixels
-    UINT_32*            pHeightAlign,       ///< [out] height alignment in pixels
-    UINT_32*            pMacroTileWidth,    ///< [out] macro tile width in pixels
-    UINT_32*            pMacroTileHeight    ///< [out] macro tile height in pixels
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMacroTiled(
+    AddrTileMode                      tileMode,           ///< [in] tile mode
+    UINT_32                           bpp,                ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
+    UINT_32                           mipLevel,           ///< [in] mip level
+    UINT_32                           numSamples,         ///< [in] number of samples
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
     ) const
 {
+    ADDR_TILEINFO* pTileInfo = pOut->pTileInfo;
+
     BOOL_32 valid = SanityCheckMacroTiled(pTileInfo);
 
     if (valid)
@@ -886,19 +916,19 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
         {
             // this restriction is only for mipmap (mipmap's numSamples must be 1)
             macroAspectAlign = Max(1u,
-                               m_pipeInterleaveBytes * m_bankInterleave /
-                               (tileSize * pipes * pTileInfo->bankWidth)
-                               );
+                                   m_pipeInterleaveBytes * m_bankInterleave /
+                                   (tileSize * pipes * pTileInfo->bankWidth)
+                                   );
             pTileInfo->macroAspectRatio = PowTwoAlign(pTileInfo->macroAspectRatio, macroAspectAlign);
         }
 
         valid = HwlReduceBankWidthHeight(tileSize,
-                                      bpp,
-                                      flags,
-                                      numSamples,
-                                      bankHeightAlign,
-                                      pipes,
-                                      pTileInfo);
+                                         bpp,
+                                         flags,
+                                         numSamples,
+                                         bankHeightAlign,
+                                         pipes,
+                                         pTileInfo);
 
         //
         // The required granularity for pitch is the macro tile width.
@@ -906,10 +936,10 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
         macroTileWidth = MicroTileWidth * pTileInfo->bankWidth * pipes *
             pTileInfo->macroAspectRatio;
 
-        *pPitchAlign = macroTileWidth;
-        *pMacroTileWidth = macroTileWidth;
+        pOut->pitchAlign = macroTileWidth;
+        pOut->blockWidth = macroTileWidth;
 
-        AdjustPitchAlignment(flags, pPitchAlign);
+        AdjustPitchAlignment(flags, &pOut->pitchAlign);
 
         //
         // The required granularity for height is the macro tile height.
@@ -917,31 +947,16 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
         macroTileHeight = MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
             pTileInfo->macroAspectRatio;
 
-        *pHeightAlign = macroTileHeight;
-        *pMacroTileHeight = macroTileHeight;
+        pOut->heightAlign = macroTileHeight;
+        pOut->blockHeight = macroTileHeight;
 
         //
         // Compute base alignment
         //
-        *pBaseAlign = pipes *
-            pTileInfo->bankWidth * pTileInfo->banks * pTileInfo->bankHeight * tileSize;
-
-        if ((mipLevel == 0) && (flags.prt) && (m_chipFamily == ADDR_CHIP_FAMILY_SI))
-        {
-            static const UINT_32 PrtTileSize = 0x10000;
-
-            UINT_32 macroTileSize = macroTileWidth * macroTileHeight * numSamples * bpp / 8;
+        pOut->baseAlign =
+            pipes * pTileInfo->bankWidth * pTileInfo->banks * pTileInfo->bankHeight * tileSize;
 
-            if (macroTileSize < PrtTileSize)
-            {
-                UINT_32 numMacroTiles = PrtTileSize / macroTileSize;
-
-                ADDR_ASSERT((PrtTileSize % macroTileSize) == 0);
-
-                *pPitchAlign *= numMacroTiles;
-                *pBaseAlign  *= numMacroTiles;
-            }
-        }
+        HwlComputeSurfaceAlignmentsMacroTiled(tileMode, bpp, flags, mipLevel, numSamples, pOut);
     }
 
     return valid;
@@ -949,7 +964,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::SanityCheckMacroTiled
+*   EgBasedLib::SanityCheckMacroTiled
 *
 *   @brief
 *       Check if macro-tiled parameters are valid
@@ -957,7 +972,7 @@ BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
 *       TRUE if valid
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::SanityCheckMacroTiled(
+BOOL_32 EgBasedLib::SanityCheckMacroTiled(
     ADDR_TILEINFO* pTileInfo   ///< [in] macro-tiled parameters
     ) const
 {
@@ -1054,7 +1069,7 @@ BOOL_32 EgBasedAddrLib::SanityCheckMacroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceMipLevelTileMode
+*   EgBasedLib::ComputeSurfaceMipLevelTileMode
 *
 *   @brief
 *       Compute valid tile mode for surface mipmap sub-levels
@@ -1063,7 +1078,7 @@ BOOL_32 EgBasedAddrLib::SanityCheckMacroTiled(
 *       Suitable tile mode
 ****************************************************************************************************
 */
-AddrTileMode EgBasedAddrLib::ComputeSurfaceMipLevelTileMode(
+AddrTileMode EgBasedLib::ComputeSurfaceMipLevelTileMode(
     AddrTileMode        baseTileMode,   ///< [in] base tile mode
     UINT_32             bpp,            ///< [in] bits per pixels
     UINT_32             pitch,          ///< [in] current level pitch
@@ -1075,6 +1090,8 @@ AddrTileMode EgBasedAddrLib::ComputeSurfaceMipLevelTileMode(
     ADDR_TILEINFO*      pTileInfo       ///< [in] ptr to bank structure
     ) const
 {
+    UINT_64 bytesPerSlice;
+    (void)bytesPerSlice;
     UINT_32 bytesPerTile;
 
     AddrTileMode expTileMode = baseTileMode;
@@ -1084,6 +1101,7 @@ AddrTileMode EgBasedAddrLib::ComputeSurfaceMipLevelTileMode(
     //
     // Compute the size of a slice.
     //
+    bytesPerSlice = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
     bytesPerTile = BITS_TO_BYTES(MicroTilePixels * microTileThickness * NextPow2(bpp) * numSamples);
 
     //
@@ -1146,30 +1164,30 @@ AddrTileMode EgBasedAddrLib::ComputeSurfaceMipLevelTileMode(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlDegradeBaseLevel
+*   EgBasedLib::HwlGetAlignmentInfoMacroTiled
 *   @brief
-*       Check if degrade is needed for base level
+*       Get alignment info for giving tile mode
 *   @return
-*       TRUE if degrade is suggested
+*       TRUE if getting alignment is OK
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::HwlDegradeBaseLevel(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+BOOL_32 EgBasedLib::HwlGetAlignmentInfoMacroTiled(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,             ///< [in] create surface info
+    UINT_32*                               pPitchAlign,     ///< [out] pitch alignment
+    UINT_32*                               pHeightAlign,    ///< [out] height alignment
+    UINT_32*                               pSizeAlign       ///< [out] size alignment
+    ) const
 {
-    BOOL_32 degrade = FALSE;
     BOOL_32 valid = TRUE;
 
     ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
 
-    UINT_32 baseAlign;
-    UINT_32 pitchAlign;
-    UINT_32 heightAlign;
-    UINT_32 macroTileWidth;
-    UINT_32 macroTileHeight;
+    UINT_32 numSamples = (pIn->numFrags == 0) ? pIn->numSamples : pIn->numFrags;
 
     ADDR_ASSERT(pIn->pTileInfo);
     ADDR_TILEINFO tileInfo = *pIn->pTileInfo;
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT out = {0};
+    out.pTileInfo = &tileInfo;
 
     if (UseTileIndex(pIn->tileIndex))
     {
@@ -1182,7 +1200,7 @@ BOOL_32 EgBasedAddrLib::HwlDegradeBaseLevel(
                      pIn->bpp,
                      pIn->width,
                      pIn->height,
-                     pIn->numSamples,
+                     numSamples,
                      &tileInfo,
                      &tileInfo,
                      pIn->tileType,
@@ -1192,45 +1210,22 @@ BOOL_32 EgBasedAddrLib::HwlDegradeBaseLevel(
                                                pIn->bpp,
                                                pIn->flags,
                                                pIn->mipLevel,
-                                               pIn->numSamples,
-                                               &tileInfo,
-                                               &baseAlign,
-                                               &pitchAlign,
-                                               &heightAlign,
-                                               &macroTileWidth,
-                                               &macroTileHeight);
+                                               numSamples,
+                                               &out);
 
     if (valid)
     {
-        degrade = ((pIn->width < macroTileWidth) || (pIn->height < macroTileHeight));
-        // Check whether 2D tiling still has too much footprint
-        if (degrade == FALSE)
-        {
-            // Only check width and height as slices are aligned to thickness
-            UINT_64 unalignedSize = pIn->width * pIn->height;
-
-            UINT_32 alignedPitch = PowTwoAlign(pIn->width, pitchAlign);
-            UINT_32 alignedHeight = PowTwoAlign(pIn->height, heightAlign);
-            UINT_64 alignedSize = alignedPitch * alignedHeight;
-
-            // alignedSize > 1.5 * unalignedSize
-            if (2 * alignedSize > 3 * unalignedSize)
-            {
-                degrade = TRUE;
-            }
-        }
-    }
-    else
-    {
-        degrade = TRUE;
+        *pPitchAlign  = out.pitchAlign;
+        *pHeightAlign = out.heightAlign;
+        *pSizeAlign   = out.baseAlign;
     }
 
-    return degrade;
+    return valid;
 }
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlDegradeThickTileMode
+*   EgBasedLib::HwlDegradeThickTileMode
 *
 *   @brief
 *       Degrades valid tile mode for thick modes if needed
@@ -1239,10 +1234,10 @@ BOOL_32 EgBasedAddrLib::HwlDegradeBaseLevel(
 *       Suitable tile mode
 ****************************************************************************************************
 */
-AddrTileMode EgBasedAddrLib::HwlDegradeThickTileMode(
+AddrTileMode EgBasedLib::HwlDegradeThickTileMode(
     AddrTileMode        baseTileMode,   ///< [in] base tile mode
     UINT_32             numSlices,      ///< [in] current number of slices
-    UINT_32*            pBytesPerTile   ///< [in/out] pointer to bytes per slice
+    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
     ) const
 {
     ADDR_ASSERT(numSlices < Thickness(baseTileMode));
@@ -1303,7 +1298,7 @@ AddrTileMode EgBasedAddrLib::HwlDegradeThickTileMode(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord
+*   EgBasedLib::DispatchComputeSurfaceAddrFromCoord
 *
 *   @brief
 *       Compute surface address from given coord (x, y, slice,sample)
@@ -1312,7 +1307,7 @@ AddrTileMode EgBasedAddrLib::HwlDegradeThickTileMode(
 *       Address in bytes
 ****************************************************************************************************
 */
-UINT_64 EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord(
+UINT_64 EgBasedLib::DispatchComputeSurfaceAddrFromCoord(
     const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
     ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
     ) const
@@ -1336,12 +1331,6 @@ UINT_64 EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord(
     UINT_32*            pBitPosition       = &pOut->bitPosition;
     UINT_64             addr;
 
-#if ADDR_AM_BUILD
-    UINT_32             addr5Bit           = 0;
-    UINT_32             addr5Swizzle       = pIn->addr5Swizzle;
-    BOOL_32             is32ByteTile       = pIn->is32ByteTile;
-#endif
-
     // ADDR_DEPTH_SAMPLE_ORDER = non-disp + depth-sample-order
     if (microTileType == ADDR_DEPTH_SAMPLE_ORDER)
     {
@@ -1446,29 +1435,12 @@ UINT_64 EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord(
             break;
     }
 
-#if ADDR_AM_BUILD
-    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
-    {
-        if (addr5Swizzle && isDepthSampleOrder && is32ByteTile)
-        {
-            UINT_32 tx = x >> 3;
-            UINT_32 ty = y >> 3;
-            UINT_32 tileBits = ((ty&0x3) << 2) | (tx&0x3);
-
-            tileBits = tileBits & addr5Swizzle;
-            addr5Bit = XorReduce(tileBits, 4);
-
-            addr = addr | static_cast<UINT_64>(addr5Bit << 5);
-        }
-    }
-#endif
-
     return addr;
 }
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeMacroTileEquation
+*   EgBasedLib::ComputeMacroTileEquation
 *
 *   @brief
 *       Computes the address equation in macro tile
@@ -1476,7 +1448,7 @@ UINT_64 EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord(
 *       If equation can be computed
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::ComputeMacroTileEquation(
+ADDR_E_RETURNCODE EgBasedLib::ComputeMacroTileEquation(
     UINT_32             log2BytesPP,            ///< [in] log2 of bytes per pixel
     AddrTileMode        tileMode,               ///< [in] tile mode
     AddrTileType        microTileType,          ///< [in] micro tiling type
@@ -1599,7 +1571,7 @@ ADDR_E_RETURNCODE EgBasedAddrLib::ComputeMacroTileEquation(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled
+*   EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
 *
 *   @brief
 *       Computes the surface address and bit position from a
@@ -1608,7 +1580,7 @@ ADDR_E_RETURNCODE EgBasedAddrLib::ComputeMacroTileEquation(
 *       The byte address
 ****************************************************************************************************
 */
-UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMacroTiled(
+UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMacroTiled(
     UINT_32             x,                      ///< [in] x coordinate
     UINT_32             y,                      ///< [in] y coordinate
     UINT_32             slice,                  ///< [in] slice index
@@ -1874,7 +1846,7 @@ UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMacroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled
+*   EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
 *
 *   @brief
 *       Computes the surface address and bit position from a coordinate for 1D tilied
@@ -1883,7 +1855,7 @@ UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMacroTiled(
 *       The byte address
 ****************************************************************************************************
 */
-UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled(
+UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled(
     UINT_32             x,                      ///< [in] x coordinate
     UINT_32             y,                      ///< [in] y coordinate
     UINT_32             slice,                  ///< [in] slice index
@@ -1999,7 +1971,7 @@ UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputePixelCoordFromOffset
+*   EgBasedLib::HwlComputePixelCoordFromOffset
 *
 *   @brief
 *       Compute pixel coordinate from offset inside a micro tile
@@ -2007,7 +1979,7 @@ UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled(
 *       N/A
 ****************************************************************************************************
 */
-VOID EgBasedAddrLib::HwlComputePixelCoordFromOffset(
+VOID EgBasedLib::HwlComputePixelCoordFromOffset(
     UINT_32         offset,             ///< [in] offset inside micro tile in bits
     UINT_32         bpp,                ///< [in] bits per pixel
     UINT_32         numSamples,         ///< [in] number of samples
@@ -2188,7 +2160,7 @@ VOID EgBasedAddrLib::HwlComputePixelCoordFromOffset(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::DispatchComputeSurfaceCoordFromAddrDispatch
+*   EgBasedLib::DispatchComputeSurfaceCoordFromAddrDispatch
 *
 *   @brief
 *       Compute (x,y,slice,sample) coordinates from surface address
@@ -2196,7 +2168,7 @@ VOID EgBasedAddrLib::HwlComputePixelCoordFromOffset(
 *       N/A
 ****************************************************************************************************
 */
-VOID EgBasedAddrLib::DispatchComputeSurfaceCoordFromAddr(
+VOID EgBasedLib::DispatchComputeSurfaceCoordFromAddr(
     const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
     ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
     ) const
@@ -2333,7 +2305,7 @@ VOID EgBasedAddrLib::DispatchComputeSurfaceCoordFromAddr(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceCoordFromAddrMacroTiled
+*   EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled
 *
 *   @brief
 *       Compute surface coordinates from address for macro tiled surface
@@ -2341,7 +2313,7 @@ VOID EgBasedAddrLib::DispatchComputeSurfaceCoordFromAddr(
 *       N/A
 ****************************************************************************************************
 */
-VOID EgBasedAddrLib::ComputeSurfaceCoordFromAddrMacroTiled(
+VOID EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled(
     UINT_64             addr,               ///< [in] byte address
     UINT_32             bitPosition,        ///< [in] bit position
     UINT_32             bpp,                ///< [in] bits per pixel
@@ -2491,7 +2463,7 @@ VOID EgBasedAddrLib::ComputeSurfaceCoordFromAddrMacroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSurfaceCoord2DFromBankPipe
+*   EgBasedLib::ComputeSurfaceCoord2DFromBankPipe
 *
 *   @brief
 *       Compute surface x,y coordinates from bank/pipe info
@@ -2499,7 +2471,7 @@ VOID EgBasedAddrLib::ComputeSurfaceCoordFromAddrMacroTiled(
 *       N/A
 ****************************************************************************************************
 */
-VOID EgBasedAddrLib::ComputeSurfaceCoord2DFromBankPipe(
+VOID EgBasedLib::ComputeSurfaceCoord2DFromBankPipe(
     AddrTileMode        tileMode,   ///< [in] tile mode
     UINT_32             x,          ///< [in] x coordinate
     UINT_32             y,          ///< [in] y coordinate
@@ -2677,14 +2649,14 @@ VOID EgBasedAddrLib::ComputeSurfaceCoord2DFromBankPipe(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlExtractBankPipeSwizzle
+*   EgBasedLib::HwlExtractBankPipeSwizzle
 *   @brief
-*       Entry of EgBasedAddrLib ExtractBankPipeSwizzle
+*       Entry of EgBasedLib ExtractBankPipeSwizzle
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlExtractBankPipeSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlExtractBankPipeSwizzle(
     const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,   ///< [in] input structure
     ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut   ///< [out] output structure
     ) const
@@ -2700,14 +2672,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlExtractBankPipeSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlCombineBankPipeSwizzle
+*   EgBasedLib::HwlCombineBankPipeSwizzle
 *   @brief
 *       Combine bank/pipe swizzle
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlCombineBankPipeSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlCombineBankPipeSwizzle(
     UINT_32         bankSwizzle,    ///< [in] bank swizzle
     UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
     ADDR_TILEINFO*  pTileInfo,      ///< [in] tile info
@@ -2731,14 +2703,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlCombineBankPipeSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeBaseSwizzle
+*   EgBasedLib::HwlComputeBaseSwizzle
 *   @brief
 *       Compute base swizzle
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeBaseSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeBaseSwizzle(
     const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
     ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut
     ) const
@@ -2758,6 +2730,8 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeBaseSwizzle(
         { 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 }, // ADDR_SURF_16_BANK
     };
 
+    UINT_32 pipes = HwlGetPipes(pTileInfo);
+    (void)pipes;
     UINT_32 banks = pTileInfo ? pTileInfo->banks : 2;
     UINT_32 hwNumBanks;
 
@@ -2806,14 +2780,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeBaseSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ExtractBankPipeSwizzle
+*   EgBasedLib::ExtractBankPipeSwizzle
 *   @brief
 *       Extract bank/pipe swizzle from base256b
 *   @return
 *       N/A
 ****************************************************************************************************
 */
-VOID EgBasedAddrLib::ExtractBankPipeSwizzle(
+VOID EgBasedLib::ExtractBankPipeSwizzle(
     UINT_32         base256b,       ///< [in] input base256b register value
     ADDR_TILEINFO*  pTileInfo,      ///< [in] 2D tile parameters. Client must provide all data
     UINT_32*        pBankSwizzle,   ///< [out] bank swizzle
@@ -2844,14 +2818,14 @@ VOID EgBasedAddrLib::ExtractBankPipeSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::GetBankPipeSwizzle
+*   EgBasedLib::GetBankPipeSwizzle
 *   @brief
 *       Combine bank/pipe swizzle
 *   @return
 *       Base256b bits (only filled bank/pipe bits)
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::GetBankPipeSwizzle(
+UINT_32 EgBasedLib::GetBankPipeSwizzle(
     UINT_32         bankSwizzle,    ///< [in] bank swizzle
     UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
     UINT_64         baseAddr,       ///< [in] base address
@@ -2870,14 +2844,14 @@ UINT_32 EgBasedAddrLib::GetBankPipeSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeSliceTileSwizzle
+*   EgBasedLib::ComputeSliceTileSwizzle
 *   @brief
 *       Compute cubemap/3d texture faces/slices tile swizzle
 *   @return
 *       Tile swizzle
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputeSliceTileSwizzle(
+UINT_32 EgBasedLib::ComputeSliceTileSwizzle(
     AddrTileMode        tileMode,       ///< [in] Tile mode
     UINT_32             baseSwizzle,    ///< [in] Base swizzle
     UINT_32             slice,          ///< [in] Slice index, Cubemap face index, 0 means +X
@@ -2935,7 +2909,7 @@ UINT_32 EgBasedAddrLib::ComputeSliceTileSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeQbStereoRightSwizzle
+*   EgBasedLib::HwlComputeQbStereoRightSwizzle
 *
 *   @brief
 *       Compute right eye swizzle
@@ -2943,7 +2917,7 @@ UINT_32 EgBasedAddrLib::ComputeSliceTileSwizzle(
 *       swizzle
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::HwlComputeQbStereoRightSwizzle(
+UINT_32 EgBasedLib::HwlComputeQbStereoRightSwizzle(
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo  ///< [in] Surface info, must be valid
     ) const
 {
@@ -2967,7 +2941,7 @@ UINT_32 EgBasedAddrLib::HwlComputeQbStereoRightSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeBankFromCoord
+*   EgBasedLib::ComputeBankFromCoord
 *
 *   @brief
 *       Compute bank number from coordinates
@@ -2975,7 +2949,7 @@ UINT_32 EgBasedAddrLib::HwlComputeQbStereoRightSwizzle(
 *       Bank number
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputeBankFromCoord(
+UINT_32 EgBasedLib::ComputeBankFromCoord(
     UINT_32         x,              ///< [in] x coordinate
     UINT_32         y,              ///< [in] y coordinate
     UINT_32         slice,          ///< [in] slice index
@@ -3099,7 +3073,7 @@ UINT_32 EgBasedAddrLib::ComputeBankFromCoord(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeBankFromAddr
+*   EgBasedLib::ComputeBankFromAddr
 *
 *   @brief
 *       Compute the bank number from an address
@@ -3107,7 +3081,7 @@ UINT_32 EgBasedAddrLib::ComputeBankFromCoord(
 *       Bank number
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputeBankFromAddr(
+UINT_32 EgBasedLib::ComputeBankFromAddr(
     UINT_64 addr,       ///< [in] address
     UINT_32 numBanks,   ///< [in] number of banks
     UINT_32 numPipes    ///< [in] number of pipes
@@ -3132,7 +3106,7 @@ UINT_32 EgBasedAddrLib::ComputeBankFromAddr(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputePipeRotation
+*   EgBasedLib::ComputePipeRotation
 *
 *   @brief
 *       Compute pipe rotation value
@@ -3140,7 +3114,7 @@ UINT_32 EgBasedAddrLib::ComputeBankFromAddr(
 *       Pipe rotation
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputePipeRotation(
+UINT_32 EgBasedLib::ComputePipeRotation(
     AddrTileMode tileMode,  ///< [in] tile mode
     UINT_32      numPipes   ///< [in] number of pipes
     ) const
@@ -3167,7 +3141,7 @@ UINT_32 EgBasedAddrLib::ComputePipeRotation(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeBankRotation
+*   EgBasedLib::ComputeBankRotation
 *
 *   @brief
 *       Compute bank rotation value
@@ -3175,7 +3149,7 @@ UINT_32 EgBasedAddrLib::ComputePipeRotation(
 *       Bank rotation
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputeBankRotation(
+UINT_32 EgBasedLib::ComputeBankRotation(
     AddrTileMode tileMode,  ///< [in] tile mode
     UINT_32      numBanks,  ///< [in] number of banks
     UINT_32      numPipes   ///< [in] number of pipes
@@ -3210,7 +3184,7 @@ UINT_32 EgBasedAddrLib::ComputeBankRotation(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeHtileBytes
+*   EgBasedLib::ComputeHtileBytes
 *
 *   @brief
 *       Compute htile size in bytes
@@ -3219,7 +3193,7 @@ UINT_32 EgBasedAddrLib::ComputeBankRotation(
 *       Htile size in bytes
 ****************************************************************************************************
 */
-UINT_64 EgBasedAddrLib::ComputeHtileBytes(
+UINT_64 EgBasedLib::ComputeHtileBytes(
     UINT_32 pitch,        ///< [in] pitch
     UINT_32 height,       ///< [in] height
     UINT_32 bpp,          ///< [in] bits per pixel
@@ -3253,7 +3227,7 @@ UINT_64 EgBasedAddrLib::ComputeHtileBytes(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::DispatchComputeFmaskInfo
+*   EgBasedLib::DispatchComputeFmaskInfo
 *
 *   @brief
 *       Compute fmask sizes include padded pitch, height, slices, total size in bytes,
@@ -3264,7 +3238,7 @@ UINT_64 EgBasedAddrLib::ComputeHtileBytes(
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::DispatchComputeFmaskInfo(
+ADDR_E_RETURNCODE EgBasedLib::DispatchComputeFmaskInfo(
     const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
     ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut)  ///< [out] output structure
 {
@@ -3330,14 +3304,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::DispatchComputeFmaskInfo(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlFmaskSurfaceInfo
+*   EgBasedLib::HwlFmaskSurfaceInfo
 *   @brief
-*       Entry of EgBasedAddrLib ComputeFmaskInfo
+*       Entry of EgBasedLib ComputeFmaskInfo
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskInfo(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskInfo(
     const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
     ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut   ///< [out] output structure
     )
@@ -3372,668 +3346,45 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskInfo(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeFmaskAddrFromCoord
+*   EgBasedLib::HwlComputeFmaskAddrFromCoord
 *   @brief
-*       Entry of EgBasedAddrLib ComputeFmaskAddrFromCoord
+*       Entry of EgBasedLib ComputeFmaskAddrFromCoord
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskAddrFromCoord(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskAddrFromCoord(
     const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
     ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
     ) const
 {
     ADDR_E_RETURNCODE retCode = ADDR_OK;
 
-#if ADDR_AM_BUILD
-    if ((pIn->x > pIn->pitch)               ||
-        (pIn->y > pIn->height)              ||
-        (pIn->numSamples > m_maxSamples)    ||
-        (pIn->sample >= m_maxSamples))
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        pOut->addr = DispatchComputeFmaskAddrFromCoord(pIn, pOut);
-    }
-#endif
-
     return retCode;
 }
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeFmaskCoordFromAddr
+*   EgBasedLib::HwlComputeFmaskCoordFromAddr
 *   @brief
-*       Entry of EgBasedAddrLib ComputeFmaskCoordFromAddr
+*       Entry of EgBasedLib ComputeFmaskCoordFromAddr
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskCoordFromAddr(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskCoordFromAddr(
     const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
     ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
     ) const
 {
     ADDR_E_RETURNCODE retCode = ADDR_OK;
 
-#if ADDR_AM_BUILD
-    if ((pIn->bitPosition >= 8) ||
-        (pIn->numSamples > m_maxSamples))
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        DispatchComputeFmaskCoordFromAddr(pIn, pOut);
-    }
-#endif
-
     return retCode;
 }
 
-#if ADDR_AM_BUILD
-/**
-****************************************************************************************************
-*   EgBasedAddrLib::DispatchComputeFmaskAddrFromCoord
-*
-*   @brief
-*       Computes the FMASK address and bit position from a coordinate.
-*   @return
-*       The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedAddrLib::DispatchComputeFmaskAddrFromCoord(
-    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    UINT_32             x                 = pIn->x;
-    UINT_32             y                 = pIn->y;
-    UINT_32             slice             = pIn->slice;
-    UINT_32             sample            = pIn->sample;
-    UINT_32             plane             = pIn->plane;
-    UINT_32             pitch             = pIn->pitch;
-    UINT_32             height            = pIn->height;
-    UINT_32             numSamples        = pIn->numSamples;
-    AddrTileMode        tileMode          = pIn->tileMode;
-    BOOL_32             ignoreSE          = pIn->ignoreSE;
-    ADDR_TILEINFO*      pTileInfo         = pIn->pTileInfo;
-    BOOL_32             resolved          = pIn->resolved;
-
-    UINT_32* pBitPosition = &pOut->bitPosition;
-    UINT_64 addr          = 0;
-
-    ADDR_ASSERT(numSamples > 1);
-    ADDR_ASSERT(Thickness(tileMode) == 1);
-
-    switch (tileMode)
-    {
-        case ADDR_TM_1D_TILED_THIN1:
-            addr = ComputeFmaskAddrFromCoordMicroTiled(x,
-                                                       y,
-                                                       slice,
-                                                       sample,
-                                                       plane,
-                                                       pitch,
-                                                       height,
-                                                       numSamples,
-                                                       tileMode,
-                                                       resolved,
-                                                       pBitPosition);
-            break;
-        case ADDR_TM_2D_TILED_THIN1: //fall through
-        case ADDR_TM_3D_TILED_THIN1:
-            UINT_32 pipeSwizzle;
-            UINT_32 bankSwizzle;
-
-            if (m_configFlags.useCombinedSwizzle)
-            {
-                ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
-                                       &bankSwizzle, &pipeSwizzle);
-            }
-            else
-            {
-                pipeSwizzle = pIn->pipeSwizzle;
-                bankSwizzle = pIn->bankSwizzle;
-            }
-
-            addr = ComputeFmaskAddrFromCoordMacroTiled(x,
-                                                       y,
-                                                       slice,
-                                                       sample,
-                                                       plane,
-                                                       pitch,
-                                                       height,
-                                                       numSamples,
-                                                       tileMode,
-                                                       pipeSwizzle,
-                                                       bankSwizzle,
-                                                       ignoreSE,
-                                                       pTileInfo,
-                                                       resolved,
-                                                       pBitPosition);
-            break;
-        default:
-            *pBitPosition = 0;
-            break;
-    }
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedAddrLib::ComputeFmaskAddrFromCoordMicroTiled
-*
-*   @brief
-*       Computes the FMASK address and bit position from a coordinate for 1D tilied (micro
-*       tiled)
-*   @return
-*       The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedAddrLib::ComputeFmaskAddrFromCoordMicroTiled(
-    UINT_32             x,              ///< [in] x coordinate
-    UINT_32             y,              ///< [in] y coordinate
-    UINT_32             slice,          ///< [in] slice index
-    UINT_32             sample,         ///< [in] sample number
-    UINT_32             plane,          ///< [in] plane number
-    UINT_32             pitch,          ///< [in] surface pitch in pixels
-    UINT_32             height,         ///< [in] surface height in pixels
-    UINT_32             numSamples,     ///< [in] number of samples
-    AddrTileMode        tileMode,       ///< [in] tile mode
-    BOOL_32             resolved,       ///< [in] TRUE if this is for resolved fmask
-    UINT_32*            pBitPosition    ///< [out] pointer to returned bit position
-    ) const
-{
-    UINT_64 addr = 0;
-    UINT_32 effectiveBpp;
-    UINT_32 effectiveSamples;
-
-    //
-    // 2xAA use the same layout as 4xAA
-    //
-    if (numSamples == 2)
-    {
-        numSamples = 4;
-    }
-
-    //
-    // Compute the number of planes.
-    //
-    if (resolved == FALSE)
-    {
-        effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
-        effectiveBpp = numSamples;
-
-        //
-        // Compute the address just like a color surface with numSamples bits per element and
-        // numPlanes samples.
-        //
-        addr = ComputeSurfaceAddrFromCoordMicroTiled(x,
-                                                     y,
-                                                     slice,
-                                                     plane, // sample
-                                                     effectiveBpp,
-                                                     pitch,
-                                                     height,
-                                                     effectiveSamples,
-                                                     tileMode,
-                                                     ADDR_NON_DISPLAYABLE,
-                                                     FALSE,
-                                                     pBitPosition);
-
-        //
-        // Compute the real bit position. Each (sample, plane) is stored with one bit per sample.
-        //
-
-        //
-        // Compute the pixel index with in the micro tile
-        //
-        UINT_32 pixelIndex = ComputePixelIndexWithinMicroTile(x % 8,
-                                                              y % 8,
-                                                              slice,
-                                                              1,
-                                                              tileMode,
-                                                              ADDR_NON_DISPLAYABLE);
-
-        *pBitPosition = ((pixelIndex * numSamples) + sample) & (BITS_PER_BYTE-1);
-
-        UINT_64 bitAddr = BYTES_TO_BITS(addr) + *pBitPosition;
-
-        addr = bitAddr / 8;
-    }
-    else
-    {
-        effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
-        effectiveSamples = 1;
-
-        //
-        // Compute the address just like a color surface with numSamples bits per element and
-        // numPlanes samples.
-        //
-        addr = ComputeSurfaceAddrFromCoordMicroTiled(x,
-                                                     y,
-                                                     slice,
-                                                     sample,
-                                                     effectiveBpp,
-                                                     pitch,
-                                                     height,
-                                                     effectiveSamples,
-                                                     tileMode,
-                                                     ADDR_NON_DISPLAYABLE,
-                                                     TRUE,
-                                                     pBitPosition);
-    }
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedAddrLib::ComputeFmaskAddrFromCoordMacroTiled
-*
-*   @brief
-*       Computes the FMASK address and bit position from a coordinate for 2D tilied (macro
-*       tiled)
-*   @return
-*       The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedAddrLib::ComputeFmaskAddrFromCoordMacroTiled(
-    UINT_32             x,              ///< [in] x coordinate
-    UINT_32             y,              ///< [in] y coordinate
-    UINT_32             slice,          ///< [in] slice index
-    UINT_32             sample,         ///< [in] sample number
-    UINT_32             plane,          ///< [in] plane number
-    UINT_32             pitch,          ///< [in] surface pitch in pixels
-    UINT_32             height,         ///< [in] surface height in pixels
-    UINT_32             numSamples,     ///< [in] number of samples
-    AddrTileMode        tileMode,       ///< [in] tile mode
-    UINT_32             pipeSwizzle,    ///< [in] pipe swizzle
-    UINT_32             bankSwizzle,    ///< [in] bank swizzle
-    BOOL_32             ignoreSE,       ///< [in] TRUE if ignore shader engine
-    ADDR_TILEINFO*      pTileInfo,      ///< [in] bank structure.**All fields to be valid on entry**
-    BOOL_32             resolved,       ///< [in] TRUE if this is for resolved fmask
-    UINT_32*            pBitPosition    ///< [out] pointer to returned bit position
-    ) const
-{
-    UINT_64 addr = 0;
-    UINT_32 effectiveBpp;
-    UINT_32 effectiveSamples;
-
-    //
-    // 2xAA use the same layout as 4xAA
-    //
-    if (numSamples == 2)
-    {
-        numSamples = 4;
-    }
-
-    //
-    // Compute the number of planes.
-    //
-    if (resolved == FALSE)
-    {
-        effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
-        effectiveBpp = numSamples;
-
-        //
-        // Compute the address just like a color surface with numSamples bits per element and
-        // numPlanes samples.
-        //
-        addr = ComputeSurfaceAddrFromCoordMacroTiled(x,
-                                                     y,
-                                                     slice,
-                                                     plane, // sample
-                                                     effectiveBpp,
-                                                     pitch,
-                                                     height,
-                                                     effectiveSamples,
-                                                     tileMode,
-                                                     ADDR_NON_DISPLAYABLE,// isdisp
-                                                     ignoreSE,// ignore_shader
-                                                     FALSE,// depth_sample_order
-                                                     pipeSwizzle,
-                                                     bankSwizzle,
-                                                     pTileInfo,
-                                                     pBitPosition);
-
-        //
-        // Compute the real bit position. Each (sample, plane) is stored with one bit per sample.
-        //
-
-
-        //
-        // Compute the pixel index with in the micro tile
-        //
-        UINT_32 pixelIndex = ComputePixelIndexWithinMicroTile(x ,
-                                                              y ,
-                                                              slice,
-                                                              effectiveBpp,
-                                                              tileMode,
-                                                              ADDR_NON_DISPLAYABLE);
-
-        *pBitPosition = ((pixelIndex * numSamples) + sample) & (BITS_PER_BYTE-1);
-
-        UINT_64 bitAddr = BYTES_TO_BITS(addr) + *pBitPosition;
-
-        addr = bitAddr / 8;
-
-    }
-    else
-    {
-        effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
-        effectiveSamples = 1;
-
-        //
-        // Compute the address just like a color surface with numSamples bits per element and
-        // numPlanes samples.
-        //
-        addr = ComputeSurfaceAddrFromCoordMacroTiled(x,
-                                                     y,
-                                                     slice,
-                                                     sample,
-                                                     effectiveBpp,
-                                                     pitch,
-                                                     height,
-                                                     effectiveSamples,
-                                                     tileMode,
-                                                     ADDR_NON_DISPLAYABLE,
-                                                     ignoreSE,
-                                                     TRUE,
-                                                     pipeSwizzle,
-                                                     bankSwizzle,
-                                                     pTileInfo,
-                                                     pBitPosition);
-    }
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedAddrLib::ComputeFmaskCoordFromAddrMicroTiled
-*
-*   @brief
-*       Compute (x,y,slice,sample,plane) coordinates from fmask address
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID EgBasedAddrLib::ComputeFmaskCoordFromAddrMicroTiled(
-    UINT_64             addr,       ///< [in] byte address
-    UINT_32             bitPosition,///< [in] bit position
-    UINT_32             pitch,      ///< [in] pitch in pixels
-    UINT_32             height,     ///< [in] height in pixels
-    UINT_32             numSamples, ///< [in] number of samples (of color buffer)
-    AddrTileMode        tileMode,   ///< [in] tile mode
-    BOOL_32             resolved,   ///< [in] TRUE if it is resolved fmask
-    UINT_32*            pX,         ///< [out] X coord
-    UINT_32*            pY,         ///< [out] Y coord
-    UINT_32*            pSlice,     ///< [out] slice index
-    UINT_32*            pSample,    ///< [out] sample index
-    UINT_32*            pPlane      ///< [out] plane index
-    ) const
-{
-    UINT_32 effectiveBpp;
-    UINT_32 effectiveSamples;
-
-    // 2xAA use the same layout as 4xAA
-    if (numSamples == 2)
-    {
-        numSamples = 4;
-    }
-
-    if (resolved == FALSE)
-    {
-        effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
-        effectiveBpp  = numSamples;
-
-        ComputeSurfaceCoordFromAddrMicroTiled(addr,
-                                              bitPosition,
-                                              effectiveBpp,
-                                              pitch,
-                                              height,
-                                              effectiveSamples,
-                                              tileMode,
-                                              0, // tileBase
-                                              0, // compBits
-                                              pX,
-                                              pY,
-                                              pSlice,
-                                              pPlane,
-                                              ADDR_NON_DISPLAYABLE, // microTileType
-                                              FALSE  // isDepthSampleOrder
-                                              );
-
-
-        if ( pSample )
-        {
-            *pSample = bitPosition % numSamples;
-        }
-    }
-    else
-    {
-        effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
-        effectiveSamples = 1;
-
-        ComputeSurfaceCoordFromAddrMicroTiled(addr,
-                                              bitPosition,
-                                              effectiveBpp,
-                                              pitch,
-                                              height,
-                                              effectiveSamples,
-                                              tileMode,
-                                              0,     // tileBase
-                                              0,     // compBits
-                                              pX,
-                                              pY,
-                                              pSlice,
-                                              pSample,
-                                              ADDR_NON_DISPLAYABLE, // microTileType
-                                              TRUE   // isDepthSampleOrder
-                                              );
-    }
-}
-
-/**
-****************************************************************************************************
-*   EgBasedAddrLib::ComputeFmaskCoordFromAddrMacroTiled
-*
-*   @brief
-*       Compute (x,y,slice,sample,plane) coordinates from
-*       fmask address
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID EgBasedAddrLib::ComputeFmaskCoordFromAddrMacroTiled(
-    UINT_64             addr,       ///< [in] byte address
-    UINT_32             bitPosition,///< [in] bit position
-    UINT_32             pitch,      ///< [in] pitch in pixels
-    UINT_32             height,     ///< [in] height in pixels
-    UINT_32             numSamples, ///< [in] number of samples (of color buffer)
-    AddrTileMode        tileMode,   ///< [in] tile mode
-    UINT_32             pipeSwizzle,///< [in] pipe swizzle
-    UINT_32             bankSwizzle,///< [in] bank swizzle
-    BOOL_32             ignoreSE,   ///< [in] TRUE if ignore shader engine
-    ADDR_TILEINFO*      pTileInfo,  ///< [in] bank structure. **All fields to be valid on entry**
-    BOOL_32             resolved,   ///< [in] TRUE if it is resolved fmask
-    UINT_32*            pX,         ///< [out] X coord
-    UINT_32*            pY,         ///< [out] Y coord
-    UINT_32*            pSlice,     ///< [out] slice index
-    UINT_32*            pSample,    ///< [out] sample index
-    UINT_32*            pPlane      ///< [out] plane index
-    ) const
-{
-    UINT_32 effectiveBpp;
-    UINT_32 effectiveSamples;
-
-    // 2xAA use the same layout as 4xAA
-    if (numSamples == 2)
-    {
-        numSamples = 4;
-    }
-
-    //
-    // Compute the number of planes.
-    //
-    if (resolved == FALSE)
-    {
-        effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
-        effectiveBpp  = numSamples;
-
-        ComputeSurfaceCoordFromAddrMacroTiled(addr,
-                                              bitPosition,
-                                              effectiveBpp,
-                                              pitch,
-                                              height,
-                                              effectiveSamples,
-                                              tileMode,
-                                              0, // No tileBase
-                                              0, // No compBits
-                                              ADDR_NON_DISPLAYABLE,
-                                              ignoreSE,
-                                              FALSE,
-                                              pipeSwizzle,
-                                              bankSwizzle,
-                                              pTileInfo,
-                                              pX,
-                                              pY,
-                                              pSlice,
-                                              pPlane);
-
-        if (pSample)
-        {
-            *pSample = bitPosition % numSamples;
-        }
-    }
-    else
-    {
-        effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
-        effectiveSamples = 1;
-
-        ComputeSurfaceCoordFromAddrMacroTiled(addr,
-                                              bitPosition,
-                                              effectiveBpp,
-                                              pitch,
-                                              height,
-                                              effectiveSamples,
-                                              tileMode,
-                                              0, // No tileBase
-                                              0, // No compBits
-                                              ADDR_NON_DISPLAYABLE,
-                                              ignoreSE,
-                                              TRUE,
-                                              pipeSwizzle,
-                                              bankSwizzle,
-                                              pTileInfo,
-                                              pX,
-                                              pY,
-                                              pSlice,
-                                              pSample);
-    }
-}
-
-/**
-****************************************************************************************************
-*   EgBasedAddrLib::DispatchComputeFmaskCoordFromAddr
-*
-*   @brief
-*       Compute (x,y,slice,sample,plane) coordinates from
-*       fmask address
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID EgBasedAddrLib::DispatchComputeFmaskCoordFromAddr(
-    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    UINT_64             addr              = pIn->addr;
-    UINT_32             bitPosition       = pIn->bitPosition;
-    UINT_32             pitch             = pIn->pitch;
-    UINT_32             height            = pIn->height;
-    UINT_32             numSamples        = pIn->numSamples;
-    AddrTileMode        tileMode          = pIn->tileMode;
-    BOOL_32             ignoreSE          = pIn->ignoreSE;
-    ADDR_TILEINFO*      pTileInfo         = pIn->pTileInfo;
-    BOOL_32             resolved          = pIn->resolved;
-
-    UINT_32*            pX      = &pOut->x;
-    UINT_32*            pY      = &pOut->y;
-    UINT_32*            pSlice  = &pOut->slice;
-    UINT_32*            pSample = &pOut->sample;
-    UINT_32*            pPlane  = &pOut->plane;
-
-    switch (tileMode)
-    {
-        case ADDR_TM_1D_TILED_THIN1:
-            ComputeFmaskCoordFromAddrMicroTiled(addr,
-                                                bitPosition,
-                                                pitch,
-                                                height,
-                                                numSamples,
-                                                tileMode,
-                                                resolved,
-                                                pX,
-                                                pY,
-                                                pSlice,
-                                                pSample,
-                                                pPlane);
-            break;
-        case ADDR_TM_2D_TILED_THIN1://fall through
-        case ADDR_TM_3D_TILED_THIN1:
-            UINT_32 pipeSwizzle;
-            UINT_32 bankSwizzle;
-
-            if (m_configFlags.useCombinedSwizzle)
-            {
-                ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
-                                       &bankSwizzle, &pipeSwizzle);
-            }
-            else
-            {
-                pipeSwizzle = pIn->pipeSwizzle;
-                bankSwizzle = pIn->bankSwizzle;
-            }
-
-            ComputeFmaskCoordFromAddrMacroTiled(addr,
-                                                bitPosition,
-                                                pitch,
-                                                height,
-                                                numSamples,
-                                                tileMode,
-                                                pipeSwizzle,
-                                                bankSwizzle,
-                                                ignoreSE,
-                                                pTileInfo,
-                                                resolved,
-                                                pX,
-                                                pY,
-                                                pSlice,
-                                                pSample,
-                                                pPlane);
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-            break;
-
-    }
-}
-#endif
-
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeFmaskNumPlanesFromNumSamples
+*   EgBasedLib::ComputeFmaskNumPlanesFromNumSamples
 *
 *   @brief
 *       Compute fmask number of planes from number of samples
@@ -4042,7 +3393,7 @@ VOID EgBasedAddrLib::DispatchComputeFmaskCoordFromAddr(
 *       Number of planes
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputeFmaskNumPlanesFromNumSamples(
+UINT_32 EgBasedLib::ComputeFmaskNumPlanesFromNumSamples(
     UINT_32 numSamples)     ///< [in] number of samples
 {
     UINT_32 numPlanes;
@@ -4078,7 +3429,7 @@ UINT_32 EgBasedAddrLib::ComputeFmaskNumPlanesFromNumSamples(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::ComputeFmaskResolvedBppFromNumSamples
+*   EgBasedLib::ComputeFmaskResolvedBppFromNumSamples
 *
 *   @brief
 *       Compute resolved fmask effective bpp based on number of samples
@@ -4087,7 +3438,7 @@ UINT_32 EgBasedAddrLib::ComputeFmaskNumPlanesFromNumSamples(
 *       bpp
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::ComputeFmaskResolvedBppFromNumSamples(
+UINT_32 EgBasedLib::ComputeFmaskResolvedBppFromNumSamples(
     UINT_32 numSamples)     ///< number of samples
 {
     UINT_32 bpp;
@@ -4123,7 +3474,7 @@ UINT_32 EgBasedAddrLib::ComputeFmaskResolvedBppFromNumSamples(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::IsTileInfoAllZero
+*   EgBasedLib::IsTileInfoAllZero
 *
 *   @brief
 *       Return TRUE if all field are zero
@@ -4131,8 +3482,8 @@ UINT_32 EgBasedAddrLib::ComputeFmaskResolvedBppFromNumSamples(
 *       Since NULL input is consider to be all zero
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::IsTileInfoAllZero(
-    ADDR_TILEINFO* pTileInfo)
+BOOL_32 EgBasedLib::IsTileInfoAllZero(
+    const ADDR_TILEINFO* pTileInfo)
 {
     BOOL_32 allZero = TRUE;
 
@@ -4155,7 +3506,7 @@ BOOL_32 EgBasedAddrLib::IsTileInfoAllZero(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlTileInfoEqual
+*   EgBasedLib::HwlTileInfoEqual
 *
 *   @brief
 *       Return TRUE if all field are equal
@@ -4163,7 +3514,7 @@ BOOL_32 EgBasedAddrLib::IsTileInfoAllZero(
 *       Only takes care of current HWL's data
 ****************************************************************************************************
 */
-BOOL_32 EgBasedAddrLib::HwlTileInfoEqual(
+BOOL_32 EgBasedLib::HwlTileInfoEqual(
     const ADDR_TILEINFO* pLeft, ///<[in] Left compare operand
     const ADDR_TILEINFO* pRight ///<[in] Right compare operand
     ) const
@@ -4184,14 +3535,14 @@ BOOL_32 EgBasedAddrLib::HwlTileInfoEqual(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlConvertTileInfoToHW
+*   EgBasedLib::HwlConvertTileInfoToHW
 *   @brief
-*       Entry of EgBasedAddrLib ConvertTileInfoToHW
+*       Entry of EgBasedLib ConvertTileInfoToHW
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlConvertTileInfoToHW(
+ADDR_E_RETURNCODE EgBasedLib::HwlConvertTileInfoToHW(
     const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
     ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
     ) const
@@ -4452,14 +3803,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlConvertTileInfoToHW(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeSurfaceInfo
+*   EgBasedLib::HwlComputeSurfaceInfo
 *   @brief
-*       Entry of EgBasedAddrLib ComputeSurfaceInfo
+*       Entry of EgBasedLib ComputeSurfaceInfo
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceInfo(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceInfo(
     const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
     ) const
@@ -4539,14 +3890,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceInfo(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeSurfaceAddrFromCoord
+*   EgBasedLib::HwlComputeSurfaceAddrFromCoord
 *   @brief
-*       Entry of EgBasedAddrLib ComputeSurfaceAddrFromCoord
+*       Entry of EgBasedLib ComputeSurfaceAddrFromCoord
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceAddrFromCoord(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceAddrFromCoord(
     const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
     ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
     ) const
@@ -4572,14 +3923,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceAddrFromCoord(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeSurfaceCoordFromAddr
+*   EgBasedLib::HwlComputeSurfaceCoordFromAddr
 *   @brief
-*       Entry of EgBasedAddrLib ComputeSurfaceCoordFromAddr
+*       Entry of EgBasedLib ComputeSurfaceCoordFromAddr
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceCoordFromAddr(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceCoordFromAddr(
     const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
     ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
     ) const
@@ -4600,14 +3951,14 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceCoordFromAddr(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeSliceTileSwizzle
+*   EgBasedLib::HwlComputeSliceTileSwizzle
 *   @brief
-*       Entry of EgBasedAddrLib ComputeSurfaceCoordFromAddr
+*       Entry of EgBasedLib ComputeSurfaceCoordFromAddr
 *   @return
 *       ADDR_E_RETURNCODE
 ****************************************************************************************************
 */
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSliceTileSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSliceTileSwizzle(
     const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,    ///< [in] input structure
     ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut    ///< [out] output structure
     ) const
@@ -4633,7 +3984,7 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSliceTileSwizzle(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeHtileBpp
+*   EgBasedLib::HwlComputeHtileBpp
 *
 *   @brief
 *       Compute htile bpp
@@ -4642,7 +3993,7 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSliceTileSwizzle(
 *       Htile bpp
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::HwlComputeHtileBpp(
+UINT_32 EgBasedLib::HwlComputeHtileBpp(
     BOOL_32 isWidth8,   ///< [in] TRUE if block width is 8
     BOOL_32 isHeight8   ///< [in] TRUE if block height is 8
     ) const
@@ -4654,7 +4005,7 @@ UINT_32 EgBasedAddrLib::HwlComputeHtileBpp(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlComputeHtileBaseAlign
+*   EgBasedLib::HwlComputeHtileBaseAlign
 *
 *   @brief
 *       Compute htile base alignment
@@ -4663,7 +4014,7 @@ UINT_32 EgBasedAddrLib::HwlComputeHtileBpp(
 *       Htile base alignment
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::HwlComputeHtileBaseAlign(
+UINT_32 EgBasedLib::HwlComputeHtileBaseAlign(
     BOOL_32         isTcCompatible, ///< [in] if TC compatible
     BOOL_32         isLinear,       ///< [in] if it is linear mode
     ADDR_TILEINFO*  pTileInfo       ///< [in] Tile info
@@ -4685,7 +4036,7 @@ UINT_32 EgBasedAddrLib::HwlComputeHtileBaseAlign(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlGetPitchAlignmentMicroTiled
+*   EgBasedLib::HwlGetPitchAlignmentMicroTiled
 *
 *   @brief
 *       Compute 1D tiled surface pitch alignment, calculation results are returned through
@@ -4695,7 +4046,7 @@ UINT_32 EgBasedAddrLib::HwlComputeHtileBaseAlign(
 *       pitch alignment
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::HwlGetPitchAlignmentMicroTiled(
+UINT_32 EgBasedLib::HwlGetPitchAlignmentMicroTiled(
     AddrTileMode        tileMode,          ///< [in] tile mode
     UINT_32             bpp,               ///< [in] bits per pixel
     ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
@@ -4734,7 +4085,7 @@ UINT_32 EgBasedAddrLib::HwlGetPitchAlignmentMicroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled
+*   EgBasedLib::HwlGetSizeAdjustmentMicroTiled
 *
 *   @brief
 *       Adjust 1D tiled surface pitch and slice size
@@ -4743,15 +4094,15 @@ UINT_32 EgBasedAddrLib::HwlGetPitchAlignmentMicroTiled(
 *       Logical slice size in bytes
 ****************************************************************************************************
 */
-UINT_64 EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled(
+UINT_64 EgBasedLib::HwlGetSizeAdjustmentMicroTiled(
     UINT_32             thickness,      ///< [in] thickness
     UINT_32             bpp,            ///< [in] bits per pixel
     ADDR_SURFACE_FLAGS  flags,          ///< [in] surface flags
     UINT_32             numSamples,     ///< [in] number of samples
     UINT_32             baseAlign,      ///< [in] base alignment
     UINT_32             pitchAlign,     ///< [in] pitch alignment
-    UINT_32*            pPitch,         ///< [in/out] pointer to pitch
-    UINT_32*            pHeight         ///< [in/out] pointer to height
+    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
+    UINT_32*            pHeight         ///< [in,out] pointer to height
     ) const
 {
     UINT_64 logicalSliceSize;
@@ -4776,7 +4127,7 @@ UINT_64 EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled(
 
 /**
 ****************************************************************************************************
-*   EgBasedAddrLib::HwlStereoCheckRightOffsetPadding
+*   EgBasedLib::HwlStereoCheckRightOffsetPadding
 *
 *   @brief
 *       check if the height needs extra padding for stereo right eye offset, to avoid swizzling
@@ -4786,7 +4137,7 @@ UINT_64 EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled(
 *
 ****************************************************************************************************
 */
-UINT_32 EgBasedAddrLib::HwlStereoCheckRightOffsetPadding(
+UINT_32 EgBasedLib::HwlStereoCheckRightOffsetPadding(
     ADDR_TILEINFO* pTileInfo    ///< Tiling info
     ) const
 {
@@ -4809,3 +4160,5 @@ UINT_32 EgBasedAddrLib::HwlStereoCheckRightOffsetPadding(
     return stereoHeightAlign;
 }
 
+} // V1
+} // Addr