amd/addrlib: import gfx9 support
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 6 Oct 2016 16:55:25 +0000 (18:55 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 30 Mar 2017 12:44:33 +0000 (14:44 +0200)
19 files changed:
src/amd/Makefile.addrlib.am
src/amd/Makefile.sources
src/amd/addrlib/addrinterface.cpp
src/amd/addrlib/addrinterface.h
src/amd/addrlib/addrtypes.h
src/amd/addrlib/core/addrcommon.h
src/amd/addrlib/core/addrlib.cpp
src/amd/addrlib/core/addrlib.h
src/amd/addrlib/core/addrlib2.cpp [new file with mode: 0644]
src/amd/addrlib/core/addrlib2.h [new file with mode: 0644]
src/amd/addrlib/gfx9/chip/gfx9_enum.h [new file with mode: 0644]
src/amd/addrlib/gfx9/coord.cpp [new file with mode: 0644]
src/amd/addrlib/gfx9/coord.h [new file with mode: 0644]
src/amd/addrlib/gfx9/gfx9addrlib.cpp [new file with mode: 0644]
src/amd/addrlib/gfx9/gfx9addrlib.h [new file with mode: 0644]
src/amd/addrlib/gfx9/rbmap.cpp [new file with mode: 0644]
src/amd/addrlib/gfx9/rbmap.h [new file with mode: 0644]
src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h [new file with mode: 0644]
src/amd/common/amdgpu_id.h

index 64823fcdf16106fccdc6469460430756ffa90eaa..46689637f9b1f49fcbdc2ebdb6c5f6b917e3dc59 100644 (file)
@@ -26,7 +26,9 @@ addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
        -I$(srcdir)/common \
        -I$(srcdir)/addrlib \
        -I$(srcdir)/addrlib/core \
+       -I$(srcdir)/addrlib/inc/chip/gfx9 \
        -I$(srcdir)/addrlib/inc/chip/r800 \
+       -I$(srcdir)/addrlib/gfx9/chip \
        -I$(srcdir)/addrlib/r800/chip \
        -DBRAHMA_BUILD=1
 
index 1ca443289c0ed780cd747e84ca4c75f00ea1a070..05e66d4305458fc3ce31df1022d1b2835a8a5996 100644 (file)
@@ -16,8 +16,16 @@ ADDRLIB_FILES = \
        addrlib/core/addrlib.h \
        addrlib/core/addrlib1.cpp \
        addrlib/core/addrlib1.h \
+       addrlib/core/addrlib2.cpp \
+       addrlib/core/addrlib2.h \
        addrlib/core/addrobject.cpp \
        addrlib/core/addrobject.h \
+       addrlib/gfx9/coord.cpp \
+       addrlib/gfx9/coord.h \
+       addrlib/gfx9/gfx9addrlib.cpp \
+       addrlib/gfx9/gfx9addrlib.h \
+       addrlib/gfx9/rbmap.cpp \
+       addrlib/gfx9/rbmap.h \
        addrlib/inc/chip/r800/si_gb_reg.h \
        addrlib/inc/lnx_common_defs.h \
        addrlib/r800/chip/si_ci_vi_merged_enum.h \
index 571a0768490723afb9d7b4eddafbbb42095b3e0c..12985fc37b655e1e25ba64ced5acefd41b5dfae5 100644 (file)
@@ -32,6 +32,7 @@
 */
 #include "addrinterface.h"
 #include "addrlib1.h"
+#include "addrlib2.h"
 
 #include "addrcommon.h"
 
@@ -1070,3 +1071,517 @@ ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
 
     return returnCode;
 }
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                    Surface functions for Addr2
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSurfaceInfo
+*
+*   @brief
+*       Calculate surface width/height/depth/alignments and suitable tiling mode
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceInfo(
+    ADDR_HANDLE                                hLib, ///< address lib handle
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT*    pIn,  ///< [in] surface information
+    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*         pOut) ///< [out] surface parameters and alignments
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSurfaceInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSurfaceAddrFromCoord
+*
+*   @brief
+*       Compute surface address according to coordinates
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceAddrFromCoord(
+    ADDR_HANDLE                                         hLib, ///< address lib handle
+    const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT*    pIn,  ///< [in] surface info and coordinates
+    ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*         pOut) ///< [out] surface address
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSurfaceAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSurfaceCoordFromAddr
+*
+*   @brief
+*       Compute coordinates according to surface address
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceCoordFromAddr(
+    ADDR_HANDLE                                         hLib, ///< address lib handle
+    const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT*    pIn,  ///< [in] surface info and address
+    ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*         pOut) ///< [out] coordinates
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSurfaceCoordFromAddr(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                   HTile functions for Addr2
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Addr2ComputeHtileInfo
+*
+*   @brief
+*       Compute Htile pitch, height, base alignment and size in bytes
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileInfo(
+    ADDR_HANDLE                              hLib, ///< address lib handle
+    const ADDR2_COMPUTE_HTILE_INFO_INPUT*    pIn,  ///< [in] Htile information
+    ADDR2_COMPUTE_HTILE_INFO_OUTPUT*         pOut) ///< [out] Htile pitch, height and size in bytes
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeHtileInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeHtileAddrFromCoord
+*
+*   @brief
+*       Compute Htile address according to coordinates (of depth buffer)
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileAddrFromCoord(
+    ADDR_HANDLE                                       hLib, ///< address lib handle
+    const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*    pIn,  ///< [in] Htile info and coordinates
+    ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*         pOut) ///< [out] Htile address
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeHtileAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeHtileCoordFromAddr
+*
+*   @brief
+*       Compute coordinates within depth buffer (1st pixel of a micro tile) according to
+*       Htile address
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileCoordFromAddr(
+    ADDR_HANDLE                                       hLib, ///< address lib handle
+    const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*    pIn,  ///< [in] Htile info and address
+    ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*         pOut) ///< [out] Htile coordinates
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeHtileCoordFromAddr(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     C-mask functions for Addr2
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Addr2ComputeCmaskInfo
+*
+*   @brief
+*       Compute Cmask pitch, height, base alignment and size in bytes from color buffer
+*       info
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskInfo(
+    ADDR_HANDLE                              hLib, ///< address lib handle
+    const ADDR2_COMPUTE_CMASK_INFO_INPUT*    pIn,  ///< [in] Cmask pitch and height
+    ADDR2_COMPUTE_CMASK_INFO_OUTPUT*         pOut) ///< [out] Cmask pitch, height and size in bytes
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeCmaskInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Compute Cmask address according to coordinates (of MSAA color buffer)
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskAddrFromCoord(
+    ADDR_HANDLE                                       hLib, ///< address lib handle
+    const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*    pIn,  ///< [in] Cmask info and coordinates
+    ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*         pOut) ///< [out] Cmask address
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeCmaskAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeCmaskCoordFromAddr
+*
+*   @brief
+*       Compute coordinates within color buffer (1st pixel of a micro tile) according to
+*       Cmask address
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskCoordFromAddr(
+    ADDR_HANDLE                                       hLib, ///< address lib handle
+    const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT*    pIn,  ///< [in] Cmask info and address
+    ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*         pOut) ///< [out] Cmask coordinates
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeCmaskCoordFromAddr(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     F-mask functions for Addr2
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Addr2ComputeFmaskInfo
+*
+*   @brief
+*       Compute Fmask pitch/height/depth/alignments and size in bytes
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskInfo(
+    ADDR_HANDLE                              hLib, ///< address lib handle
+    const ADDR2_COMPUTE_FMASK_INFO_INPUT*    pIn,  ///< [in] Fmask information
+    ADDR2_COMPUTE_FMASK_INFO_OUTPUT*         pOut) ///< [out] Fmask pitch and height
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeFmaskInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeFmaskAddrFromCoord
+*
+*   @brief
+*       Compute Fmask address according to coordinates (x,y,slice,sample,plane)
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskAddrFromCoord(
+    ADDR_HANDLE                                       hLib, ///< address lib handle
+    const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*    pIn,  ///< [in] Fmask info and coordinates
+    ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*         pOut) ///< [out] Fmask address
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeFmaskAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+/**
+****************************************************************************************************
+*   Addr2ComputeFmaskCoordFromAddr
+*
+*   @brief
+*       Compute coordinates (x,y,slice,sample,plane) according to Fmask address
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskCoordFromAddr(
+    ADDR_HANDLE                                       hLib, ///< address lib handle
+    const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT*    pIn,  ///< [in] Fmask info and address
+    ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*         pOut) ///< [out] Fmask coordinates
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeFmaskCoordFromAddr(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     DCC key functions for Addr2
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Addr2ComputeDccInfo
+*
+*   @brief
+*       Compute DCC key size, base alignment based on color surface size, tile info or tile index
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccInfo(
+    ADDR_HANDLE                           hLib,   ///< handle of addrlib
+    const ADDR2_COMPUTE_DCCINFO_INPUT*    pIn,    ///< [in] input
+    ADDR2_COMPUTE_DCCINFO_OUTPUT*         pOut)   ///< [out] output
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeDccInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Addr2ComputePipeBankXor
+*
+*   @brief
+*       Calculate a valid bank pipe xor value for client to use.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputePipeBankXor(
+    ADDR_HANDLE                            hLib, ///< handle of addrlib
+    const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,  ///< [in] input
+    ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) ///< [out] output
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputePipeBankXor(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Addr2GetPreferredSurfaceSetting
+*
+*   @brief
+*       Suggest a preferred setting for client driver to program HW register
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting(
+    ADDR_HANDLE                                   hLib, ///< handle of addrlib
+    const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,  ///< [in] input
+    ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) ///< [out] output
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->Addr2GetPreferredSurfaceSetting(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
index cfd24763819233f8d53705f3936249a366806042..15115d6e3328e80106578f5620d2d05f06b1f250 100644 (file)
@@ -347,6 +347,9 @@ typedef struct _ADDR_REGISTER_VALUE
                                  ///< CI registers-------------------------------------------------
     const UINT_32* pMacroTileConfig;    ///< Global macro tile mode table
     UINT_32  noOfMacroEntries;   ///< Number of entries in pMacroTileConfig
+
+                                 ///< GFX9 HW parameters
+    UINT_32  blockVarSizeLog2;   ///< SW_VAR_* block size
 } ADDR_REGISTER_VALUE;
 
 /**
@@ -2316,10 +2319,1161 @@ ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
     ADDR_HANDLE                     hLib,
     ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut);
 
-#if defined(__cplusplus)
-}
-#endif
 
-#endif // __ADDR_INTERFACE_H__
+
+/**
+****************************************************************************************************
+*                                Address library interface version 2
+*                                    available from Gfx9 hardware
+****************************************************************************************************
+*     Addr2ComputeSurfaceInfo()
+*     Addr2ComputeSurfaceAddrFromCoord()
+*     Addr2ComputeSurfaceCoordFromAddr()
+
+*     Addr2ComputeHtileInfo()
+*     Addr2ComputeHtileAddrFromCoord()
+*     Addr2ComputeHtileCoordFromAddr()
+*
+*     Addr2ComputeCmaskInfo()
+*     Addr2ComputeCmaskAddrFromCoord()
+*     Addr2ComputeCmaskCoordFromAddr()
+*
+*     Addr2ComputeFmaskInfo()
+*     Addr2ComputeFmaskAddrFromCoord()
+*     Addr2ComputeFmaskCoordFromAddr()
+*
+*     Addr2ComputeDccInfo()
+*
+**/
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                    Surface functions for Gfx9
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR2_SURFACE_FLAGS
+*
+*   @brief
+*       Surface flags
+****************************************************************************************************
+*/
+typedef union _ADDR2_SURFACE_FLAGS
+{
+    struct
+    {
+        UINT_32 color         :  1; ///< This resource is a color buffer, can be used with RTV
+        UINT_32 depth         :  1; ///< Thie resource is a depth buffer, can be used with DSV
+        UINT_32 stencil       :  1; ///< Thie resource is a stencil buffer, can be used with DSV
+        UINT_32 fmask         :  1; ///< This is an fmask surface
+        UINT_32 overlay       :  1; ///< This is an overlay surface
+        UINT_32 display       :  1; ///< This resource is displable, can be used with DRV
+        UINT_32 prt           :  1; ///< This is a partially resident texture
+        UINT_32 qbStereo      :  1; ///< This is a quad buffer stereo surface
+        UINT_32 interleaved   :  1; ///< Special flag for interleaved YUV surface padding
+        UINT_32 texture       :  1; ///< This resource can be used with SRV
+        UINT_32 unordered     :  1; ///< This resource can be used with UAV
+        UINT_32 rotated       :  1; ///< This resource is rotated and displable
+        UINT_32 needEquation  :  1; ///< This resource needs equation to be generated if possible
+        UINT_32 opt4space     :  1; ///< This resource should be optimized for space
+        UINT_32 minimizeAlign :  1; ///< This resource should use minimum alignment
+        UINT_32 reserved      : 17; ///< Reserved bits
+    };
+
+    UINT_32 value;
+} ADDR2_SURFACE_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SURFACE_INFO_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeSurfaceInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SURFACE_INFO_INPUT
+{
+    UINT_32               size;              ///< Size of this structure in bytes
+
+    ADDR2_SURFACE_FLAGS   flags;             ///< Surface flags
+    AddrSwizzleMode       swizzleMode;       ///< Swizzle Mode for Gfx9
+    AddrResourceType      resourceType;      ///< Surface type
+    AddrFormat            format;            ///< Surface format
+    UINT_32               bpp;               ///< bits per pixel
+    UINT_32               width;             ///< Width (of mip0), in pixels
+    UINT_32               height;            ///< Height (of mip0), in pixels
+    UINT_32               numSlices;         ///< Number surface slice/depth (of mip0),
+    UINT_32               numMipLevels;      ///< Total mipmap levels.
+    UINT_32               numSamples;        ///< Number of samples
+    UINT_32               numFrags;          ///< Number of fragments, leave it zero or the same as
+                                             ///  number of samples for normal AA; Set it to the
+                                             ///  number of fragments for EQAA
+    UINT_32               pitchInElement;    ///< Pitch in elements (blocks for compressed formats)
+    UINT_32               sliceAlign;        ///< Required slice size in bytes
+} ADDR2_COMPUTE_SURFACE_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_MIP_INFO
+*
+*   @brief
+*       Structure that contains information for mip level
+*
+****************************************************************************************************
+*/
+typedef struct _ADDR2_MIP_INFO
+{
+    UINT_32             pitch;              ///< Pitch in elements
+    UINT_32             height;             ///< Padded height in elements
+    UINT_32             depth;              ///< Padded depth
+    UINT_32             offset;             ///< Offset in bytes from mip base
+
+    UINT_32             equationIndex;      ///< Equation index in the equation table
+    UINT_32             mipOffsetXBytes;    ///< Mip start position offset in byte in X direction
+    UINT_32             mipOffsetYPixel;    ///< Mip start position offset in pixel in Y direction
+    UINT_32             mipOffsetZPixel;    ///< Mip start position offset in pixel in Z direction
+    UINT_32             postSwizzleOffset;  ///< Offset which is used to be added directly onto
+                                            ///  the address calculated by equation
+} ADDR2_MIP_INFO;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SURFACE_INFO_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeSurfInfo
+*   @note
+        Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch
+        Pixel: Original pixel
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SURFACE_INFO_OUTPUT
+{
+    UINT_32             size;                 ///< Size of this structure in bytes
+
+    UINT_32             pitch;                ///< Pitch in elements (blocks for compressed formats)
+    UINT_32             height;               ///< Padded height (of mip0) in elements
+    UINT_32             numSlices;            ///< Padded depth for 3d resource
+                                              ///< or padded number of slices for 2d array resource
+    UINT_32             mipChainPitch;        ///< Pitch (of total mip chain) in elements
+    UINT_32             mipChainHeight;       ///< Padded height (of total mip chain) in elements
+    UINT_32             mipChainSlice;        ///< Padded depth (of total mip chain)
+    UINT_32             sliceSize;            ///< Slice (total mip chain) size in bytes
+    UINT_64             surfSize;             ///< Surface (total mip chain) size in bytes
+    UINT_32             baseAlign;            ///< Base address alignment
+    UINT_32             bpp;                  ///< Bits per elements
+                                              ///  (e.g. blocks for BCn, 1/3 for 96bit)
+    UINT_32             pixelMipChainPitch;   ///< Mip chain pitch in original pixels
+    UINT_32             pixelMipChainHeight;  ///< Mip chain height in original pixels
+    UINT_32             pixelPitch;           ///< Pitch in original pixels
+    UINT_32             pixelHeight;          ///< Height in original pixels
+    UINT_32             pixelBits;            ///< Original bits per pixel, passed from input
+
+    UINT_32             blockWidth;           ///< Width in element inside one block
+    UINT_32             blockHeight;          ///< Height in element inside one block
+    UINT_32             blockSlices;          ///< Slice number inside one block
+                                              ///< Prt tile is one block, its width/height/slice
+                                              ///< equals to blcok width/height/slice
+
+    BOOL_32             epitchIsHeight;       ///< Whether to use height to program epitch register
+    /// Stereo info
+    ADDR_QBSTEREOINFO*  pStereoInfo;          ///< Stereo info, needed if qbStereo flag is TRUE
+    /// Mip info
+    ADDR2_MIP_INFO*     pMipInfo;             ///< Pointer to mip information array
+                                              ///  if it is not NULL, the array is assumed to
+                                              ///  contain numMipLevels entries
+
+    UINT_32             equationIndex;        ///< Equation index in the equation table of mip0
+    BOOL_32             firstMipInTail;       ///< If whole mipchain falls into mip tail block
+} ADDR2_COMPUTE_SURFACE_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSurfaceInfo
+*
+*   @brief
+*       Compute surface width/height/slices/alignments and suitable tiling mode
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceInfo(
+    ADDR_HANDLE                                hLib,
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT*    pIn,
+    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeSurfaceAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
+{
+    UINT_32             size;            ///< Size of this structure in bytes
+
+    UINT_32             x;               ///< X coordinate
+    UINT_32             y;               ///< Y coordinate
+    UINT_32             slice;           ///< Slice index
+    UINT_32             sample;          ///< Sample index, use fragment index for EQAA
+    UINT_32             mipId;           ///< the mip ID in mip chain
+
+    AddrSwizzleMode     swizzleMode;     ///< Swizzle mode for Gfx9
+    ADDR2_SURFACE_FLAGS flags;           ///< Surface flags
+    AddrResourceType    resourceType;    ///< Surface type
+    UINT_32             bpp;             ///< Bits per pixel
+    UINT_32             unalignedWidth;  ///< Surface original width (of mip0)
+    UINT_32             unalignedHeight; ///< Surface original height (of mip0)
+    UINT_32             numSlices;       ///< Surface original slices (of mip0)
+    UINT_32             numMipLevels;    ///< Total mipmap levels
+    UINT_32             numSamples;      ///< Number of samples
+    UINT_32             numFrags;        ///< Number of fragments, leave it zero or the same as
+                                         ///  number of samples for normal AA; Set it to the
+                                         ///  number of fragments for EQAA
+
+    UINT_32             pipeBankXor;     ///< Combined swizzle used to do bank/pipe rotation
+    UINT_32             pitchInElement;  ///< Pitch in elements (blocks for compressed formats)
+} ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeSurfaceAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
+{
+    UINT_32    size;             ///< Size of this structure in bytes
+
+    UINT_64    addr;             ///< Byte address
+    UINT_32    bitPosition;      ///< Bit position within surfaceAddr, 0-7.
+                                 ///  For surface bpp < 8, e.g. FMT_1.
+    UINT_32    prtBlockIndex;    ///< Index of a PRT tile (64K block)
+} ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSurfaceAddrFromCoord
+*
+*   @brief
+*       Compute surface address from a given coordinate.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceAddrFromCoord(
+    ADDR_HANDLE                                         hLib,
+    const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT*    pIn,
+    ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeSurfaceCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT
+{
+    UINT_32             size;            ///< Size of this structure in bytes
+
+    UINT_64             addr;            ///< Address in bytes
+    UINT_32             bitPosition;     ///< Bit position in addr. 0-7. for surface bpp < 8,
+                                         ///  e.g. FMT_1;
+
+    AddrSwizzleMode     swizzleMode;     ///< Swizzle mode for Gfx9
+    ADDR2_SURFACE_FLAGS flags;           ///< Surface flags
+    AddrResourceType    resourceType;    ///< Surface type
+    UINT_32             bpp;             ///< Bits per pixel
+    UINT_32             unalignedWidth;  ///< Surface original width (of mip0)
+    UINT_32             unalignedHeight; ///< Surface original height (of mip0)
+    UINT_32             numSlices;       ///< Surface original slices (of mip0)
+    UINT_32             numMipLevels;    ///< Total mipmap levels.
+    UINT_32             numSamples;      ///< Number of samples
+    UINT_32             numFrags;        ///< Number of fragments, leave it zero or the same as
+                                         ///  number of samples for normal AA; Set it to the
+                                         ///  number of fragments for EQAA
+
+    UINT_32             pipeBankXor;     ///< Combined swizzle used to do bank/pipe rotation
+    UINT_32             pitchInElement;  ///< Pitch in elements (blocks for compressed formats)
+} ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeSurfaceCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
+{
+    UINT_32    size;       ///< Size of this structure in bytes
+
+    UINT_32    x;          ///< X coordinate
+    UINT_32    y;          ///< Y coordinate
+    UINT_32    slice;      ///< Index of slices
+    UINT_32    sample;     ///< Index of samples, means fragment index for EQAA
+    UINT_32    mipId;      ///< mipmap level id
+} ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSurfaceCoordFromAddr
+*
+*   @brief
+*       Compute coordinate from a given surface address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceCoordFromAddr(
+    ADDR_HANDLE                                         hLib,
+    const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT*    pIn,
+    ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*         pOut);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                   HTile functions for Gfx9
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR2_META_FLAGS
+*
+*   @brief
+*       Metadata flags
+****************************************************************************************************
+*/
+typedef union _ADDR2_META_FLAGS
+{
+    struct
+    {
+        UINT_32 pipeAligned :  1;    ///< if Metadata being pipe aligned
+        UINT_32 rbAligned   :  1;    ///< if Metadata being RB aligned
+        UINT_32 linear      :  1;    ///< if Metadata linear, GFX9 does not suppord this!
+        UINT_32 reserved    : 29;    ///< Reserved bits
+    };
+
+    UINT_32 value;
+} ADDR2_META_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR2_META_MIP_INFO
+*
+*   @brief
+*       Structure to store per mip metadata information
+****************************************************************************************************
+*/
+typedef struct _ADDR2_META_MIP_INFO
+{
+    BOOL_32    inMiptail;
+    UINT_32    startX;
+    UINT_32    startY;
+    UINT_32    startZ;
+    UINT_32    width;
+    UINT_32    height;
+    UINT_32    depth;
+} ADDR2_META_MIP_INFO;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_HTILE_INFO_INPUT
+*
+*   @brief
+*       Input structure of Addr2ComputeHtileInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_HTILE_INFO_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+
+    ADDR2_META_FLAGS    hTileFlags;         ///< HTILE flags
+    ADDR2_SURFACE_FLAGS depthFlags;         ///< Depth surface flags
+    AddrSwizzleMode     swizzleMode;        ///< Depth surface swizzle mode
+    UINT_32             unalignedWidth;     ///< Depth surface original width (of mip0)
+    UINT_32             unalignedHeight;    ///< Depth surface original height (of mip0)
+    UINT_32             numSlices;          ///< Number of slices of depth surface (of mip0)
+    UINT_32             numMipLevels;       ///< Total mipmap levels of color surface
+} ADDR2_COMPUTE_HTILE_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_HTILE_INFO_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2ComputeHtileInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_HTILE_INFO_OUTPUT
+{
+    UINT_32    size;                ///< Size of this structure in bytes
+
+    UINT_32    pitch;               ///< Pitch in pixels of depth buffer represented in this
+                                    ///  HTile buffer. This might be larger than original depth
+                                    ///  buffer pitch when called with an unaligned pitch.
+    UINT_32    height;              ///< Height in pixels, as above
+    UINT_32    baseAlign;           ///< Base alignment
+    UINT_32    sliceSize;           ///< Slice size, in bytes.
+    UINT_32    htileBytes;          ///< Size of HTILE buffer, in bytes
+    UINT_32    metaBlkWidth;        ///< Meta block width
+    UINT_32    metaBlkHeight;       ///< Meta block height
+    UINT_32    metaBlkNumPerSlice;  ///< Number of metablock within one slice
+
+    ADDR2_META_MIP_INFO* pMipInfo;  ///< HTILE mip information
+} ADDR2_COMPUTE_HTILE_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeHtileInfo
+*
+*   @brief
+*       Compute Htile pitch, height, base alignment and size in bytes
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileInfo(
+    ADDR_HANDLE                              hLib,
+    const ADDR2_COMPUTE_HTILE_INFO_INPUT*    pIn,
+    ADDR2_COMPUTE_HTILE_INFO_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeHtileAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
+{
+    UINT_32             size;                ///< Size of this structure in bytes
+
+    UINT_32             x;                   ///< X coordinate
+    UINT_32             y;                   ///< Y coordinate
+    UINT_32             slice;               ///< Index of slices
+    UINT_32             mipId;               ///< mipmap level id
+
+    ADDR2_META_FLAGS    hTileFlags;          ///< HTILE flags
+    ADDR2_SURFACE_FLAGS depthflags;          ///< Depth surface flags
+    AddrSwizzleMode     swizzleMode;         ///< Depth surface swizzle mode
+    UINT_32             bpp;                 ///< Depth surface bits per pixel
+    UINT_32             unalignedWidth;      ///< Depth surface original width (of mip0)
+    UINT_32             unalignedHeight;     ///< Depth surface original height (of mip0)
+    UINT_32             numSlices;           ///< Depth surface original depth (of mip0)
+    UINT_32             numMipLevels;        ///< Depth surface total mipmap levels
+    UINT_32             numSamples;          ///< Depth surface number of samples
+    UINT_32             pipeXor;             ///< Pipe xor setting
+} ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeHtileAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
+{
+    UINT_32    size;    ///< Size of this structure in bytes
+
+    UINT_64    addr;    ///< Address in bytes
+} ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeHtileAddrFromCoord
+*
+*   @brief
+*       Compute Htile address according to coordinates (of depth buffer)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileAddrFromCoord(
+    ADDR_HANDLE                                       hLib,
+    const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*    pIn,
+    ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeHtileCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT
+{
+    UINT_32             size;                ///< Size of this structure in bytes
+
+    UINT_64             addr;                ///< Address
+
+    ADDR2_META_FLAGS    hTileFlags;          ///< HTILE flags
+    ADDR2_SURFACE_FLAGS depthFlags;          ///< Depth surface flags
+    AddrSwizzleMode     swizzleMode;         ///< Depth surface swizzle mode
+    UINT_32             bpp;                 ///< Depth surface bits per pixel
+    UINT_32             unalignedWidth;      ///< Depth surface original width (of mip0)
+    UINT_32             unalignedHeight;     ///< Depth surface original height (of mip0)
+    UINT_32             numSlices;           ///< Depth surface original depth (of mip0)
+    UINT_32             numMipLevels;        ///< Depth surface total mipmap levels
+    UINT_32             numSamples;          ///< Depth surface number of samples
+    UINT_32             pipeXor;             ///< Pipe xor setting
+} ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeHtileCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
+{
+    UINT_32    size;        ///< Size of this structure in bytes
+
+    UINT_32    x;           ///< X coordinate
+    UINT_32    y;           ///< Y coordinate
+    UINT_32    slice;       ///< Index of slices
+    UINT_32    mipId;       ///< mipmap level id
+} ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeHtileCoordFromAddr
+*
+*   @brief
+*       Compute coordinates within depth buffer (1st pixel of a micro tile) according to
+*       Htile address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileCoordFromAddr(
+    ADDR_HANDLE                                       hLib,
+    const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*    pIn,
+    ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*         pOut);
 
 
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     C-mask functions for Gfx9
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_CMASK_INFO_INPUT
+*
+*   @brief
+*       Input structure of Addr2ComputeCmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_CMASKINFO_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+
+    ADDR2_META_FLAGS    cMaskFlags;         ///< CMASK flags
+    ADDR2_SURFACE_FLAGS colorFlags;         ///< Color surface flags
+    AddrResourceType    resourceType;       ///< Color surface type
+    AddrSwizzleMode     swizzleMode;        ///< FMask surface swizzle mode
+    UINT_32             unalignedWidth;     ///< Color surface original width
+    UINT_32             unalignedHeight;    ///< Color surface original height
+    UINT_32             numSlices;          ///< Number of slices of color buffer
+} ADDR2_COMPUTE_CMASK_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_CMASK_INFO_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2ComputeCmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_CMASK_INFO_OUTPUT
+{
+    UINT_32    size;          ///< Size of this structure in bytes
+
+    UINT_32    pitch;         ///< Pitch in pixels of color buffer which
+                              ///  this Cmask matches. The size might be larger than
+                              ///  original color buffer pitch when called with
+                              ///  an unaligned pitch.
+    UINT_32    height;        ///< Height in pixels, as above
+    UINT_32    baseAlign;     ///< Base alignment
+    UINT_32    sliceSize;     ///< Slice size, in bytes.
+    UINT_32    cmaskBytes;    ///< Size in bytes of CMask buffer
+    UINT_32    metaBlkWidth;  ///< Meta block width
+    UINT_32    metaBlkHeight; ///< Meta block height
+
+    UINT_32    metaBlkNumPerSlice; ///< Number of metablock within one slice
+} ADDR2_COMPUTE_CMASK_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeCmaskInfo
+*
+*   @brief
+*       Compute Cmask pitch, height, base alignment and size in bytes from color buffer
+*       info
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskInfo(
+    ADDR_HANDLE                              hLib,
+    const ADDR2_COMPUTE_CMASK_INFO_INPUT*    pIn,
+    ADDR2_COMPUTE_CMASK_INFO_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeCmaskAddrFromCoord
+*
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
+{
+    UINT_32             size;                ///< Size of this structure in bytes
+
+    UINT_32             x;                   ///< X coordinate
+    UINT_32             y;                   ///< Y coordinate
+    UINT_32             slice;               ///< Index of slices
+
+    ADDR2_META_FLAGS    cMaskFlags;          ///< CMASK flags
+    ADDR2_SURFACE_FLAGS colorFlags;          ///< Color surface flags
+    AddrResourceType    resourceType;        ///< Color surface type
+    AddrSwizzleMode     swizzleMode;         ///< FMask surface swizzle mode
+
+    UINT_32             unalignedWidth;      ///< Color surface original width (of mip0)
+    UINT_32             unalignedHeight;     ///< Color surface original height (of mip0)
+    UINT_32             numSlices;           ///< Color surface original slices (of mip0)
+
+    UINT_32             numSamples;          ///< Color surfae sample number
+    UINT_32             numFrags;            ///< Color surface fragment number
+
+    UINT_32             pipeXor;             ///< pipe Xor setting
+} ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeCmaskAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
+{
+    UINT_32    size;           ///< Size of this structure in bytes
+
+    UINT_64    addr;           ///< CMASK address in bytes
+    UINT_32    bitPosition;    ///< Bit position within addr, 0 or 4
+} ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Compute Cmask address according to coordinates (of MSAA color buffer)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskAddrFromCoord(
+    ADDR_HANDLE                                      hLib,
+    const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,
+    ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeCmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT
+{
+    UINT_32             size;                ///< Size of this structure in bytes
+
+    UINT_64             addr;                ///< CMASK address in bytes
+    UINT_32             bitPosition;         ///< Bit position within addr, 0 or 4
+
+    ADDR2_META_FLAGS    cMaskFlags;          ///< CMASK flags
+    ADDR2_SURFACE_FLAGS colorFlags;          ///< Color surface flags
+    AddrResourceType    resourceType;        ///< Color surface type
+    AddrSwizzleMode     swizzleMode;         ///< FMask surface swizzle mode
+
+    UINT_32             unalignedWidth;      ///< Color surface original width (of mip0)
+    UINT_32             unalignedHeight;     ///< Color surface original height (of mip0)
+    UINT_32             numSlices;           ///< Color surface original slices (of mip0)
+    UINT_32             numMipLevels;        ///< Color surface total mipmap levels.
+} ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeCmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
+{
+    UINT_32    size;        ///< Size of this structure in bytes
+
+    UINT_32    x;           ///< X coordinate
+    UINT_32    y;           ///< Y coordinate
+    UINT_32    slice;       ///< Index of slices
+    UINT_32    mipId;       ///< mipmap level id
+} ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeCmaskCoordFromAddr
+*
+*   @brief
+*       Compute coordinates within color buffer (1st pixel of a micro tile) according to
+*       Cmask address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskCoordFromAddr(
+    ADDR_HANDLE                                       hLib,
+    const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT*    pIn,
+    ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*         pOut);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     F-mask functions for Gfx9
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR2_FMASK_FLAGS
+*
+*   @brief
+*       FMASK flags
+****************************************************************************************************
+*/
+typedef union _ADDR2_FMASK_FLAGS
+{
+    struct
+    {
+        UINT_32 resolved :  1;    ///< TRUE if this is a resolved fmask, used by H/W clients
+                                  ///  by H/W clients. S/W should always set it to FALSE.
+        UINT_32 reserved : 31;    ///< Reserved for future use.
+    };
+
+    UINT_32 value;
+} ADDR2_FMASK_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_FMASK_INFO_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeFmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_FMASK_INFO_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+
+    AddrSwizzleMode     swizzleMode;        ///< FMask surface swizzle mode
+    UINT_32             unalignedWidth;     ///< Color surface original width
+    UINT_32             unalignedHeight;    ///< Color surface original height
+    UINT_32             numSlices;          ///< Number of slices/depth
+    UINT_32             numSamples;         ///< Number of samples
+    UINT_32             numFrags;           ///< Number of fragments, leave it zero or the same as
+                                            ///  number of samples for normal AA; Set it to the
+                                            ///  number of fragments for EQAA
+    ADDR2_FMASK_FLAGS   fMaskFlags;         ///< FMASK flags
+} ADDR2_COMPUTE_FMASK_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_FMASK_INFO_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeFmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_FMASK_INFO_OUTPUT
+{
+    UINT_32    size;           ///< Size of this structure in bytes
+
+    UINT_32    pitch;          ///< Pitch of fmask in pixels
+    UINT_32    height;         ///< Height of fmask in pixels
+    UINT_32    baseAlign;      ///< Base alignment
+    UINT_32    numSlices;      ///< Slices of fmask
+    UINT_32    fmaskBytes;     ///< Size of fmask in bytes
+    UINT_32    bpp;            ///< Bits per pixel of FMASK is: number of bit planes
+    UINT_32    numSamples;     ///< Number of samples
+    UINT_32    sliceSize;      ///< Size of slice in bytes
+} ADDR2_COMPUTE_FMASK_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeFmaskInfo
+*
+*   @brief
+*       Compute Fmask pitch/height/slices/alignments and size in bytes
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskInfo(
+    ADDR_HANDLE                              hLib,
+    const ADDR2_COMPUTE_FMASK_INFO_INPUT*    pIn,
+    ADDR2_COMPUTE_FMASK_INFO_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeFmaskAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
+{
+    UINT_32            size;               ///< Size of this structure in bytes
+
+    AddrSwizzleMode    swizzleMode;        ///< FMask surface swizzle mode
+    UINT_32            x;                  ///< X coordinate
+    UINT_32            y;                  ///< Y coordinate
+    UINT_32            slice;              ///< Slice index
+    UINT_32            sample;             ///< Sample index (fragment index for EQAA)
+    UINT_32            plane;              ///< Plane number
+
+    UINT_32            unalignedWidth;     ///< Color surface original width
+    UINT_32            unalignedHeight;    ///< Color surface original height
+    UINT_32            numSamples;         ///< Number of samples
+    UINT_32            numFrags;           ///< Number of fragments, leave it zero or the same as
+                                   ///  number of samples for normal AA; Set it to the
+                                   ///  number of fragments for EQAA
+    UINT_32            tileSwizzle;        ///< Combined swizzle used to do bank/pipe rotation
+
+    ADDR2_FMASK_FLAGS  fMaskFlags; ///< FMASK flags
+} ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeFmaskAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
+{
+    UINT_32    size;           ///< Size of this structure in bytes
+
+    UINT_64    addr;           ///< Fmask address
+    UINT_32    bitPosition;    ///< Bit position within fmaskAddr, 0-7.
+} ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeFmaskAddrFromCoord
+*
+*   @brief
+*       Compute Fmask address according to coordinates (x,y,slice,sample,plane)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskAddrFromCoord(
+    ADDR_HANDLE                                       hLib,
+    const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*    pIn,
+    ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*         pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeFmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT
+{
+    UINT_32            size;               ///< Size of this structure in bytes
+
+    UINT_64            addr;               ///< Address
+    UINT_32            bitPosition;        ///< Bit position within addr, 0-7.
+    AddrSwizzleMode    swizzleMode;        ///< FMask surface swizzle mode
+
+    UINT_32            unalignedWidth;     ///< Color surface original width
+    UINT_32            unalignedHeight;    ///< Color surface original height
+    UINT_32            numSamples;         ///< Number of samples
+    UINT_32            numFrags;           ///< Number of fragments
+
+    UINT_32            tileSwizzle;        ///< Combined swizzle used to do bank/pipe rotation
+
+    ADDR2_FMASK_FLAGS  fMaskFlags; ///< FMASK flags
+} ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeFmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
+{
+    UINT_32    size;      ///< Size of this structure in bytes
+
+    UINT_32    x;         ///< X coordinate
+    UINT_32    y;         ///< Y coordinate
+    UINT_32    slice;     ///< Slice index
+    UINT_32    sample;    ///< Sample index (fragment index for EQAA)
+    UINT_32    plane;     ///< Plane number
+} ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeFmaskCoordFromAddr
+*
+*   @brief
+*       Compute FMASK coordinate from an given address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskCoordFromAddr(
+    ADDR_HANDLE                                       hLib,
+    const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT*    pIn,
+    ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*         pOut);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     DCC key functions for Gfx9
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   _ADDR2_COMPUTE_DCCINFO_INPUT
+*
+*   @brief
+*       Input structure of Addr2ComputeDccInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_DCCINFO_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+
+    ADDR2_META_FLAGS    dccKeyFlags;        ///< DCC key flags
+    ADDR2_SURFACE_FLAGS colorFlags;         ///< Color surface flags
+    AddrResourceType    resourceType;       ///< Color surface type
+    AddrSwizzleMode     swizzleMode;        ///< Color surface swizzle mode
+    UINT_32             bpp;                ///< bits per pixel
+    UINT_32             unalignedWidth;     ///< Color surface original width (of mip0)
+    UINT_32             unalignedHeight;    ///< Color surface original height (of mip0)
+    UINT_32             numSlices;          ///< Number of slices, of color surface (of mip0)
+    UINT_32             numFrags;           ///< Fragment number of color surface
+    UINT_32             numMipLevels;       ///< Total mipmap levels of color surface
+    UINT_32             dataSurfaceSize;    ///< The padded size of all slices and mip levels
+                                            ///< useful in meta linear case
+} ADDR2_COMPUTE_DCCINFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_DCCINFO_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2ComputeDccInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_DCCINFO_OUTPUT
+{
+    UINT_32    size;               ///< Size of this structure in bytes
+
+    UINT_32    dccRamBaseAlign;    ///< Base alignment of dcc key
+    UINT_32    dccRamSize;         ///< Size of dcc key
+
+    UINT_32    pitch;              ///< DCC surface mip chain pitch
+    UINT_32    height;             ///< DCC surface mip chain height
+    UINT_32    depth;              ///< DCC surface mip chain depth
+
+    UINT_32    compressBlkWidth;   ///< DCC compress block width
+    UINT_32    compressBlkHeight;  ///< DCC compress block height
+    UINT_32    compressBlkDepth;   ///< DCC compress block depth
+
+    UINT_32    metaBlkWidth;       ///< DCC meta block width
+    UINT_32    metaBlkHeight;      ///< DCC meta block height
+    UINT_32    metaBlkDepth;       ///< DCC meta block depth
+
+    UINT_32    fastClearSizePerSlice;   ///< Size of DCC within a slice should be fast cleared
+    UINT_32    metaBlkNumPerSlice;      ///< Number of metablock within one slice
+
+    ADDR2_META_MIP_INFO* pMipInfo;      ///< DCC mip information
+} ADDR2_COMPUTE_DCCINFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeDccInfo
+*
+*   @brief
+*       Compute DCC key size, base alignment
+*       info
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccInfo(
+    ADDR_HANDLE                           hLib,
+    const ADDR2_COMPUTE_DCCINFO_INPUT*    pIn,
+    ADDR2_COMPUTE_DCCINFO_OUTPUT*         pOut);
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     Misc functions for Gfx9
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_PIPEBANKXOR_INPUT
+*
+*   @brief
+*       Input structure of Addr2ComputePipebankXor
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_PIPEBANKXOR_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    UINT_32             surfIndex;          ///< Input surface index
+    ADDR2_SURFACE_FLAGS flags;              ///< Surface flag
+    AddrSwizzleMode     swizzleMode;        ///< Surface swizzle mode
+    AddrResourceType    resourceType;       ///< Surface resource type
+} ADDR2_COMPUTE_PIPEBANKXOR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2ComputePipebankXor
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    UINT_32             pipeBankXor;        ///< Pipe bank xor
+} ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputePipeBankXor
+*
+*   @brief
+*       Calculate a valid bank pipe xor value for client to use.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputePipeBankXor(
+    ADDR_HANDLE                            hLib,
+    const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+    ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut);
+
+
+
+/**
+****************************************************************************************************
+*   ADDR2_BLOCK_SET
+*
+*   @brief
+*       Bit field that define block type
+****************************************************************************************************
+*/
+typedef union _ADDR2_BLOCK_SET
+{
+    struct
+    {
+        UINT_32 micro       : 1;   // 256B block for 2D resource
+        UINT_32 macro4KB    : 1;   // 4KB for 2D/3D resource
+        UINT_32 macro64KB   : 1;   // 64KB for 2D/3D resource
+        UINT_32 var         : 1;   // VAR block
+        UINT_32 linear      : 1;   // Linear block
+        UINT_32 reserved    : 27;
+    };
+
+    UINT_32 value;
+} ADDR2_BLOCK_SET;
+
+/**
+****************************************************************************************************
+*   ADDR2_GET_PREFERRED_SURF_SETTING_INPUT
+*
+*   @brief
+*       Input structure of Addr2GetPreferredSurfaceSetting
+****************************************************************************************************
+*/
+typedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_INPUT
+{
+    UINT_32               size;              ///< Size of this structure in bytes
+
+    ADDR2_SURFACE_FLAGS   flags;             ///< Surface flags
+    AddrResourceType      resourceType;      ///< Surface type
+    AddrFormat            format;            ///< Surface format
+    AddrResrouceLocation  resourceLoction;   ///< Surface heap choice
+    ADDR2_BLOCK_SET       forbiddenBlock;    ///< Client can use it to disable some block setting
+                                             ///< such as linear for DXTn, tiled for YUV
+    BOOL_32               noXor;             ///< Do not use xor mode for this resource
+    UINT_32               bpp;               ///< bits per pixel
+    UINT_32               width;             ///< Width (of mip0), in pixels
+    UINT_32               height;            ///< Height (of mip0), in pixels
+    UINT_32               numSlices;         ///< Number surface slice/depth (of mip0),
+    UINT_32               numMipLevels;      ///< Total mipmap levels.
+    UINT_32               numSamples;        ///< Number of samples
+    UINT_32               numFrags;          ///< Number of fragments, leave it zero or the same as
+                                             ///  number of samples for normal AA; Set it to the
+                                             ///  number of fragments for EQAA
+    UINT_32               maxAlign;          ///< maximum base/size alignment requested by client
+} ADDR2_GET_PREFERRED_SURF_SETTING_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2GetPreferredSurfaceSetting
+****************************************************************************************************
+*/
+typedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
+{
+    UINT_32               size;              ///< Size of this structure in bytes
+
+    AddrSwizzleMode       swizzleMode;       ///< Suggested swizzle mode to be used
+    AddrResourceType      resourceType;      ///< Suggested resource type to program HW
+    ADDR2_BLOCK_SET       validBlockSet;     ///< Valid block type bit conbination
+    BOOL_32               canXor;            ///< If client can use xor on a valid macro block type
+} ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2GetPreferredSurfaceSetting
+*
+*   @brief
+*       Suggest a preferred setting for client driver to program HW register
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting(
+    ADDR_HANDLE                                   hLib,
+    const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+    ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // __ADDR_INTERFACE_H__
index b90f420cba15499fec23ca047fdb82383b99f240..f8f96d54a10a18821791436b9b46b62617329d92 100644 (file)
@@ -199,6 +199,142 @@ typedef enum _AddrTileMode
     ADDR_TM_COUNT               = 26,   ///< Must be the value of the last tile mode
 } AddrTileMode;
 
+/**
+****************************************************************************************************
+* @brief
+*   Neutral enums that define swizzle modes for Gfx9 ASIC
+* @note
+*
+*   ADDR_SW_LINEAR linear aligned addressing mode, for 1D/2D/3D resouce
+*   ADDR_SW_256B_* addressing block aligned size is 256B, for 2D/3D resouce
+*   ADDR_SW_4KB_*  addressing block aligned size is 4KB, for 2D/3D resouce
+*   ADDR_SW_64KB_* addressing block aligned size is 64KB, for 2D/3D resouce
+*   ADDR_SW_VAR_*  addressing block aligned size is ASIC specific, for 2D/3D resouce
+*
+*   ADDR_SW_*_Z    For 2D resouce, represents Z-order swizzle mode for depth/stencil/FMask
+                   For 3D resouce, represents a swizzle mode similar to legacy thick tile mode
+*   ADDR_SW_*_S    represents standard swizzle mode defined by MS
+*   ADDR_SW_*_D    For 2D resouce, represents a swizzle mode for displayable resource
+*                  For 3D resouce, represents a swizzle mode which places each slice in order & pixel
+                   within slice is placed as 2D ADDR_SW_*_S. Don't use this combination if possible!
+*   ADDR_SW_*_R    For 2D resouce only, represents a swizzle mode for rotated displayable resource
+*
+****************************************************************************************************
+*/
+typedef enum _AddrSwizzleMode
+{
+    ADDR_SW_LINEAR          = 0,
+    ADDR_SW_256B_S          = 1,
+    ADDR_SW_256B_D          = 2,
+    ADDR_SW_256B_R          = 3,
+    ADDR_SW_4KB_Z           = 4,
+    ADDR_SW_4KB_S           = 5,
+    ADDR_SW_4KB_D           = 6,
+    ADDR_SW_4KB_R           = 7,
+    ADDR_SW_64KB_Z          = 8,
+    ADDR_SW_64KB_S          = 9,
+    ADDR_SW_64KB_D          = 10,
+    ADDR_SW_64KB_R          = 11,
+    ADDR_SW_VAR_Z           = 12,
+    ADDR_SW_VAR_S           = 13,
+    ADDR_SW_VAR_D           = 14,
+    ADDR_SW_VAR_R           = 15,
+    ADDR_SW_64KB_Z_T        = 16,
+    ADDR_SW_64KB_S_T        = 17,
+    ADDR_SW_64KB_D_T        = 18,
+    ADDR_SW_64KB_R_T        = 19,
+    ADDR_SW_4KB_Z_X         = 20,
+    ADDR_SW_4KB_S_X         = 21,
+    ADDR_SW_4KB_D_X         = 22,
+    ADDR_SW_4KB_R_X         = 23,
+    ADDR_SW_64KB_Z_X        = 24,
+    ADDR_SW_64KB_S_X        = 25,
+    ADDR_SW_64KB_D_X        = 26,
+    ADDR_SW_64KB_R_X        = 27,
+    ADDR_SW_VAR_Z_X         = 28,
+    ADDR_SW_VAR_S_X         = 29,
+    ADDR_SW_VAR_D_X         = 30,
+    ADDR_SW_VAR_R_X         = 31,
+    ADDR_SW_LINEAR_GENERAL  = 32,
+    ADDR_SW_MAX_TYPE        = 33,
+
+    // Used for represent block with identical size
+    ADDR_SW_256B            = ADDR_SW_256B_S,
+    ADDR_SW_4KB             = ADDR_SW_4KB_S_X,
+    ADDR_SW_64KB            = ADDR_SW_64KB_S_X,
+    ADDR_SW_VAR             = ADDR_SW_VAR_S_X,
+} AddrSwizzleMode;
+
+/**
+****************************************************************************************************
+* @brief
+*   Neutral enums that define image type
+* @note
+*   this is new for address library interface version 2
+*
+****************************************************************************************************
+*/
+typedef enum _AddrResourceType
+{
+    ADDR_RSRC_TEX_1D = 0,
+    ADDR_RSRC_TEX_2D = 1,
+    ADDR_RSRC_TEX_3D = 2,
+    ADDR_RSRC_MAX_TYPE = 3,
+} AddrResourceType;
+
+/**
+****************************************************************************************************
+* @brief
+*   Neutral enums that define resource heap location
+* @note
+*   this is new for address library interface version 2
+*
+****************************************************************************************************
+*/
+typedef enum _AddrResrouceLocation
+{
+    ADDR_RSRC_LOC_UNDEF  = 0,   // Resource heap is undefined/unknown
+    ADDR_RSRC_LOC_LOCAL  = 1,   // CPU visable and CPU invisable local heap
+    ADDR_RSRC_LOC_USWC   = 2,   // CPU write-combined non-cached nonlocal heap
+    ADDR_RSRC_LOC_CACHED = 3,   // CPU cached nonlocal heap
+    ADDR_RSRC_LOC_INVIS  = 4,   // CPU invisable local heap only
+    ADDR_RSRC_LOC_MAX_TYPE = 5,
+} AddrResrouceLocation;
+
+/**
+****************************************************************************************************
+* @brief
+*   Neutral enums that define resource basic swizzle mode
+* @note
+*   this is new for address library interface version 2
+*
+****************************************************************************************************
+*/
+typedef enum _AddrSwType
+{
+    ADDR_SW_Z  = 0,   // Resource basic swizzle mode is ZOrder
+    ADDR_SW_S  = 1,   // Resource basic swizzle mode is Standard
+    ADDR_SW_D  = 2,   // Resource basic swizzle mode is Display
+    ADDR_SW_R  = 3,   // Resource basic swizzle mode is Rotated
+} AddrSwType;
+
+/**
+****************************************************************************************************
+* @brief
+*   Neutral enums that define mipmap major mode
+* @note
+*   this is new for address library interface version 2
+*
+****************************************************************************************************
+*/
+typedef enum _AddrMajorMode
+{
+    ADDR_MAJOR_X = 0,
+    ADDR_MAJOR_Y = 1,
+    ADDR_MAJOR_Z = 2,
+    ADDR_MAJOR_MAX_TYPE = 3,
+} AddrMajorMode;
+
 /**
 ****************************************************************************************************
 *   AddrFormat
index 664ab6c81b6e8c2ccc72c3cfbf262440419fa69d..7645c505c45ca2cc25603525cf264c7786f9ef15 100644 (file)
@@ -210,6 +210,7 @@ enum LibClass
     R800_ADDRLIB = 0x8,
     SI_ADDRLIB   = 0xa,
     CI_ADDRLIB   = 0xb,
+    AI_ADDRLIB   = 0xd,
 };
 
 /**
@@ -231,6 +232,7 @@ enum ChipFamily
     ADDR_CHIP_FAMILY_SI,
     ADDR_CHIP_FAMILY_CI,
     ADDR_CHIP_FAMILY_VI,
+    ADDR_CHIP_FAMILY_AI,
 };
 
 /**
@@ -582,12 +584,233 @@ static inline VOID SafeAssign(
     }
 }
 
+/**
+****************************************************************************************************
+*   RoundHalf
+*
+*   @brief
+*       return (x + 1) / 2
+****************************************************************************************************
+*/
+static inline UINT_32 RoundHalf(
+    UINT_32     x)     ///< [in] input value
+{
+    ADDR_ASSERT(x != 0);
+
+#if 1
+    return (x >> 1) + (x & 1);
+#else
+    return (x + 1) >> 1;
+#endif
+}
+
+/**
+****************************************************************************************************
+*   SumGeo
+*
+*   @brief
+*       Calculate sum of a geometric progression whose ratio is 1/2
+****************************************************************************************************
+*/
+static inline UINT_32 SumGeo(
+    UINT_32     base,   ///< [in] First term in the geometric progression
+    UINT_32     num)    ///< [in] Number of terms to be added into sum
+{
+    ADDR_ASSERT(base > 0);
+
+    UINT_32 sum = 0;
+    UINT_32 i = 0;
+    for (; (i < num) && (base > 1); i++)
+    {
+        sum += base;
+        base = RoundHalf(base);
+    }
+    sum += num - i;
+
+    return sum;
+}
+
+/**
+****************************************************************************************************
+*   GetBit
+*
+*   @brief
+*       Extract bit N value (0 or 1) of a UINT32 value.
+****************************************************************************************************
+*/
+static inline UINT_32 GetBit(
+    UINT_32     u32,   ///< [in] UINT32 value
+    UINT_32     pos)   ///< [in] bit position from LSB, valid range is [0..31]
+{
+    ADDR_ASSERT(pos <= 31);
+
+    return (u32 >> pos) & 0x1;
+}
+
+/**
+****************************************************************************************************
+*   GetBits
+*
+*   @brief
+*       Copy 'bitsNum' bits from src start from srcStartPos into destination from dstStartPos
+*       srcStartPos: 0~31 for UINT_32
+*       bitsNum    : 1~32 for UINT_32
+*       srcStartPos: 0~31 for UINT_32
+*                                                                 src start position
+*                                                                          |
+*       src : b[31] b[30] b[29] ... ... ... ... ... ... ... ... b[end]..b[beg] ... b[1] b[0]
+*                                   || Bits num || copy length  || Bits num ||
+*       dst : b[31] b[30] b[29] ... b[end]..b[beg] ... ... ... ... ... ... ... ... b[1] b[0]
+*                                              |
+*                                     dst start position
+****************************************************************************************************
+*/
+static inline UINT_32 GetBits(
+    UINT_32 src,
+    UINT_32 srcStartPos,
+    UINT_32 bitsNum,
+    UINT_32 dstStartPos)
+{
+    ADDR_ASSERT((srcStartPos < 32) && (dstStartPos < 32) && (bitsNum > 0));
+    ADDR_ASSERT((bitsNum + dstStartPos <= 32) && (bitsNum + srcStartPos <= 32));
+
+    return ((src >> srcStartPos) << (32 - bitsNum)) >> (32 - bitsNum - dstStartPos);
+}
+
+/**
+****************************************************************************************************
+*   MortonGen2d
+*
+*   @brief
+*       Generate 2D Morton interleave code with num lowest bits in each channel
+****************************************************************************************************
+*/
+static inline UINT_32 MortonGen2d(
+    UINT_32     x,     ///< [in] First channel
+    UINT_32     y,     ///< [in] Second channel
+    UINT_32     num)   ///< [in] Number of bits extracted from each channel
+{
+    UINT_32 mort = 0;
+
+    for (UINT_32 i = 0; i < num; i++)
+    {
+        mort |= (GetBit(y, i) << (2 * i));
+        mort |= (GetBit(x, i) << (2 * i + 1));
+    }
+
+    return mort;
+}
+
+/**
+****************************************************************************************************
+*   MortonGen3d
+*
+*   @brief
+*       Generate 3D Morton interleave code with num lowest bits in each channel
+****************************************************************************************************
+*/
+static inline UINT_32 MortonGen3d(
+    UINT_32     x,     ///< [in] First channel
+    UINT_32     y,     ///< [in] Second channel
+    UINT_32     z,     ///< [in] Third channel
+    UINT_32     num)   ///< [in] Number of bits extracted from each channel
+{
+    UINT_32 mort = 0;
+
+    for (UINT_32 i = 0; i < num; i++)
+    {
+        mort |= (GetBit(z, i) << (3 * i));
+        mort |= (GetBit(y, i) << (3 * i + 1));
+        mort |= (GetBit(x, i) << (3 * i + 2));
+    }
+
+    return mort;
+}
+
+/**
+****************************************************************************************************
+*   ReverseBitVector
+*
+*   @brief
+*       Return reversed lowest num bits of v
+****************************************************************************************************
+*/
+static inline UINT_32 ReverseBitVector(
+    UINT_32     v,     ///< [in] Reverse operation base value
+    UINT_32     num)   ///< [in] Number of bits used in reverse operation
+{
+    UINT_32 reverse = 0;
+
+    for (UINT_32 i = 0; i < num; i++)
+    {
+        reverse |= (GetBit(v, num - 1 - i) << i);
+    }
+
+    return reverse;
+}
+
+/**
+****************************************************************************************************
+*   FoldXor2d
+*
+*   @brief
+*       Xor bit vector v[num-1]v[num-2]...v[1]v[0] with v[num]v[num+1]...v[2*num-2]v[2*num-1]
+****************************************************************************************************
+*/
+static inline UINT_32 FoldXor2d(
+    UINT_32     v,     ///< [in] Xor operation base value
+    UINT_32     num)   ///< [in] Number of bits used in fold xor operation
+{
+    return (v & ((1 << num) - 1)) ^ ReverseBitVector(v >> num, num);
+}
+
+/**
+****************************************************************************************************
+*   DeMort
+*
+*   @brief
+*       Return v[0] | v[2] | v[4] | v[6]... | v[2*num - 2]
+****************************************************************************************************
+*/
+static inline UINT_32 DeMort(
+    UINT_32     v,     ///< [in] DeMort operation base value
+    UINT_32     num)   ///< [in] Number of bits used in fold DeMort operation
+{
+    UINT_32 d = 0;
+
+    for (UINT_32 i = 0; i < num; i++)
+    {
+        d |= ((v & (1 << (i << 1))) >> i);
+    }
+
+    return d;
+}
+
+/**
+****************************************************************************************************
+*   FoldXor3d
+*
+*   @brief
+*       v[0]...v[num-1] ^ v[3*num-1]v[3*num-3]...v[num+2]v[num] ^ v[3*num-2]...v[num+1]v[num-1]
+****************************************************************************************************
+*/
+static inline UINT_32 FoldXor3d(
+    UINT_32     v,     ///< [in] Xor operation base value
+    UINT_32     num)   ///< [in] Number of bits used in fold xor operation
+{
+    UINT_32 t = v & ((1 << num) - 1);
+    t ^= ReverseBitVector(DeMort(v >> num, num), num);
+    t ^= ReverseBitVector(DeMort(v >> (num + 1), num), num);
+
+    return t;
+}
+
 /**
 ****************************************************************************************************
 *   InitChannel
 *
 *   @brief
-*       Get channel initialization value
+*       Set channel initialization value via a return value
 ****************************************************************************************************
 */
 static inline ADDR_CHANNEL_SETTING InitChannel(
@@ -603,6 +826,69 @@ static inline ADDR_CHANNEL_SETTING InitChannel(
     return t;
 }
 
+/**
+****************************************************************************************************
+*   InitChannel
+*
+*   @brief
+*       Set channel initialization value via channel pointer
+****************************************************************************************************
+*/
+static inline VOID InitChannel(
+    UINT_32     valid,              ///< [in] valid setting
+    UINT_32     channel,            ///< [in] channel setting
+    UINT_32     index,              ///< [in] index setting
+    ADDR_CHANNEL_SETTING *pChanSet) ///< [out] channel setting to be initialized
+{
+    pChanSet->valid = valid;
+    pChanSet->channel = channel;
+    pChanSet->index = index;
+}
+
+
+/**
+****************************************************************************************************
+*   InitChannel
+*
+*   @brief
+*       Set channel initialization value via another channel
+****************************************************************************************************
+*/
+static inline VOID InitChannel(
+    ADDR_CHANNEL_SETTING *pChanDst, ///< [in] channel setting to be copied from
+    ADDR_CHANNEL_SETTING *pChanSrc) ///< [out] channel setting to be initialized
+{
+    pChanDst->valid = pChanSrc->valid;
+    pChanDst->channel = pChanSrc->channel;
+    pChanDst->index = pChanSrc->channel;
+}
+
+/**
+****************************************************************************************************
+*   GetMaxValidChannelIndex
+*
+*   @brief
+*       Get max valid index for a specific channel
+****************************************************************************************************
+*/
+static inline UINT_32 GetMaxValidChannelIndex(
+    ADDR_CHANNEL_SETTING *pChanSet, ///< [in] channel setting to be initialized
+    UINT_32     searchCount,        ///< [in] number of channel setting to be searched
+    UINT_32     channel)            ///< [in] channel to be searched
+{
+    UINT_32 index = 0;
+
+    for (UINT_32 i = 0; i < searchCount; i++)
+    {
+        if (pChanSet[i].valid && (pChanSet[i].channel == channel))
+        {
+            index = Max(index, static_cast<UINT_32>(pChanSet[i].index));
+        }
+    }
+
+    return index;
+}
+
 } // Addr
 
 #endif // __ADDR_COMMON_H__
index 9af742f15fa533970d68ca7e82b17254854c884c..b86fd811dfbe0c1b6f4be00b2ed73525481efca2 100644 (file)
@@ -217,6 +217,9 @@ ADDR_E_RETURNCODE Lib::Create(
                         break;
                 }
                 break;
+            case CIASICIDGFXENGINE_ARCTICISLAND:
+                pLib = Gfx9HwlInit(&client);
+                break;
             default:
                 ADDR_ASSERT_ALWAYS();
                 break;
index e5d4c57e8578564b306788b5cbcfc724a6887dc4..03d85003e85022bd082f7155591786db606dad73 100644 (file)
 #define CIASICIDGFXENGINE_SOUTHERNISLAND 0x0000000A
 #endif
 
+#ifndef CIASICIDGFXENGINE_ARCTICISLAND
+#define CIASICIDGFXENGINE_ARCTICISLAND 0x0000000D
+#endif
+
 namespace Addr
 {
 
@@ -68,6 +72,8 @@ enum PipeInterleave
 {
     ADDR_PIPEINTERLEAVE_256B = 256,
     ADDR_PIPEINTERLEAVE_512B = 512,
+    ADDR_PIPEINTERLEAVE_1KB  = 1024,
+    ADDR_PIPEINTERLEAVE_2KB  = 2048,
 };
 
 /**
@@ -257,6 +263,7 @@ private:
 
 Lib* SiHwlInit  (const Client* pClient);
 Lib* CiHwlInit  (const Client* pClient);
+Lib* Gfx9HwlInit(const Client* pClient);
 
 } // Addr
 
diff --git a/src/amd/addrlib/core/addrlib2.cpp b/src/amd/addrlib/core/addrlib2.cpp
new file mode 100644 (file)
index 0000000..4497b6f
--- /dev/null
@@ -0,0 +1,3266 @@
+/*
+ * Copyright © 2017 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+
+/**
+****************************************************************************************************
+* @file  addrlib2.cpp
+* @brief Contains the implementation for the AddrLib2 base class.
+****************************************************************************************************
+*/
+
+#include "addrinterface.h"
+#include "addrlib2.h"
+#include "addrcommon.h"
+
+namespace Addr
+{
+namespace V2
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Static Const Member
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const SwizzleModeFlags Lib::SwizzleModeTable[ADDR_SW_MAX_TYPE] =
+{//Linear 256B  4KB  64KB   Var    Z    Std   Disp  Rot   XOR    T
+    {1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0},//ADDR_SW_LINEAR
+    {0,    1,    0,    0,    0,    0,    1,    0,    0,    0,    0},//ADDR_SW_256B_S
+    {0,    1,    0,    0,    0,    0,    0,    1,    0,    0,    0},//ADDR_SW_256B_D
+    {0,    1,    0,    0,    0,    0,    0,    0,    1,    0,    0},//ADDR_SW_256B_R
+
+    {0,    0,    1,    0,    0,    1,    0,    0,    0,    0,    0},//ADDR_SW_4KB_Z
+    {0,    0,    1,    0,    0,    0,    1,    0,    0,    0,    0},//ADDR_SW_4KB_S
+    {0,    0,    1,    0,    0,    0,    0,    1,    0,    0,    0},//ADDR_SW_4KB_D
+    {0,    0,    1,    0,    0,    0,    0,    0,    1,    0,    0},//ADDR_SW_4KB_R
+
+    {0,    0,    0,    1,    0,    1,    0,    0,    0,    0,    0},//ADDR_SW_64KB_Z
+    {0,    0,    0,    1,    0,    0,    1,    0,    0,    0,    0},//ADDR_SW_64KB_S
+    {0,    0,    0,    1,    0,    0,    0,    1,    0,    0,    0},//ADDR_SW_64KB_D
+    {0,    0,    0,    1,    0,    0,    0,    0,    1,    0,    0},//ADDR_SW_64KB_R
+
+    {0,    0,    0,    0,    1,    1,    0,    0,    0,    0,    0},//ADDR_SW_VAR_Z
+    {0,    0,    0,    0,    1,    0,    1,    0,    0,    0,    0},//ADDR_SW_VAR_S
+    {0,    0,    0,    0,    1,    0,    0,    1,    0,    0,    0},//ADDR_SW_VAR_D
+    {0,    0,    0,    0,    1,    0,    0,    0,    1,    0,    0},//ADDR_SW_VAR_R
+
+    {0,    0,    0,    1,    0,    1,    0,    0,    0,    1,    1},//ADDR_SW_64KB_Z_T
+    {0,    0,    0,    1,    0,    0,    1,    0,    0,    1,    1},//ADDR_SW_64KB_S_T
+    {0,    0,    0,    1,    0,    0,    0,    1,    0,    1,    1},//ADDR_SW_64KB_D_T
+    {0,    0,    0,    1,    0,    0,    0,    0,    1,    1,    1},//ADDR_SW_64KB_R_T
+
+    {0,    0,    1,    0,    0,    1,    0,    0,    0,    1,    0},//ADDR_SW_4KB_Z_x
+    {0,    0,    1,    0,    0,    0,    1,    0,    0,    1,    0},//ADDR_SW_4KB_S_x
+    {0,    0,    1,    0,    0,    0,    0,    1,    0,    1,    0},//ADDR_SW_4KB_D_x
+    {0,    0,    1,    0,    0,    0,    0,    0,    1,    1,    0},//ADDR_SW_4KB_R_x
+
+    {0,    0,    0,    1,    0,    1,    0,    0,    0,    1,    0},//ADDR_SW_64KB_Z_X
+    {0,    0,    0,    1,    0,    0,    1,    0,    0,    1,    0},//ADDR_SW_64KB_S_X
+    {0,    0,    0,    1,    0,    0,    0,    1,    0,    1,    0},//ADDR_SW_64KB_D_X
+    {0,    0,    0,    1,    0,    0,    0,    0,    1,    1,    0},//ADDR_SW_64KB_R_X
+
+    {0,    0,    0,    0,    1,    1,    0,    0,    0,    1,    0},//ADDR_SW_VAR_Z_X
+    {0,    0,    0,    0,    1,    0,    1,    0,    0,    1,    0},//ADDR_SW_VAR_S_X
+    {0,    0,    0,    0,    1,    0,    0,    1,    0,    1,    0},//ADDR_SW_VAR_D_X
+    {0,    0,    0,    0,    1,    0,    0,    0,    1,    1,    0},//ADDR_SW_VAR_R_X
+    {1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0},//ADDR_SW_LINEAR_GENERAL
+};
+
+const Dim2d Lib::Block256b[] = {{16, 16}, {16, 8}, {8, 8}, {8, 4}, {4, 4}};
+
+const Dim3d Lib::Block1kb[] = {{16, 8, 8}, {8, 8, 8}, {8, 8, 4}, {8, 4, 4}, {4, 4, 4}};
+
+const Dim2d Lib::CompressBlock2d[] = {{16, 16}, {16, 8}, {8, 8}, {8, 4}, {4, 4}};
+
+const Dim3d Lib::CompressBlock3dS[] = {{16, 4, 4}, {8, 4, 4}, {4, 4, 4}, {2, 4, 4}, {1, 4, 4}};
+
+const Dim3d Lib::CompressBlock3dZ[] = {{8, 4, 8}, {4, 4, 8}, {4, 4, 4}, {4, 2, 4}, {2, 2, 4}};
+
+const UINT_32 Lib::MaxMacroBits = 20;
+
+const UINT_32 Lib::MipTailOffset[] = {2048, 1024, 512, 256, 128, 64, 32, 16,
+                                      8, 6, 5, 4, 3, 2, 1, 0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Constructor/Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::Lib
+*
+*   @brief
+*       Constructor for the Addr::V2::Lib class
+*
+****************************************************************************************************
+*/
+Lib::Lib()
+    :
+    Addr::Lib()
+{
+}
+
+/**
+****************************************************************************************************
+*   Lib::Lib
+*
+*   @brief
+*       Constructor for the AddrLib2 class with hClient as parameter
+*
+****************************************************************************************************
+*/
+Lib::Lib(const Client* pClient)
+    :
+    Addr::Lib(pClient)
+{
+}
+
+/**
+****************************************************************************************************
+*   Lib::~Lib
+*
+*   @brief
+*       Destructor for the AddrLib2 class
+*
+****************************************************************************************************
+*/
+Lib::~Lib()
+{
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetLib
+*
+*   @brief
+*       Get Addr::V2::Lib pointer
+*
+*   @return
+*      An Addr::V2::Lib class pointer
+****************************************************************************************************
+*/
+Lib* Lib::GetLib(
+    ADDR_HANDLE hLib)   ///< [in] handle of ADDR_HANDLE
+{
+    Addr::Lib* pAddrLib = Addr::Lib::GetLib(hLib);
+    if ((pAddrLib != NULL) &&
+        (pAddrLib->GetChipFamily() <= ADDR_CHIP_FAMILY_VI))
+    {
+        // only valid and GFX9+ AISC can use AddrLib2 function.
+        ADDR_ASSERT_ALWAYS();
+        hLib = NULL;
+    }
+    return static_cast<Lib*>(hLib);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Surface Methods
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeSurfaceInfo.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceInfo(
+     const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR2_COMPUTE_SURFACE_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR2_COMPUTE_SURFACE_INFO_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    // Adjust coming parameters.
+    ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
+    localIn.width = Max(pIn->width, 1u);
+    localIn.height = Max(pIn->height, 1u);
+    localIn.numMipLevels = Max(pIn->numMipLevels, 1u);
+    localIn.numSlices = Max(pIn->numSlices, 1u);
+    localIn.numSamples = Max(pIn->numSamples, 1u);
+    localIn.numFrags = (localIn.numFrags == 0) ? localIn.numSamples : pIn->numFrags;
+
+    UINT_32  expandX  = 1;
+    UINT_32  expandY  = 1;
+    ElemMode elemMode = ADDR_UNCOMPRESSED;
+
+    if (returnCode == ADDR_OK)
+    {
+        // Set format to INVALID will skip this conversion
+        if (localIn.format != ADDR_FMT_INVALID)
+        {
+            // Get compression/expansion factors and element mode which indicates compression/expansion
+            localIn.bpp = GetElemLib()->GetBitsPerPixel(localIn.format,
+                                                        &elemMode,
+                                                        &expandX,
+                                                        &expandY);
+
+            // Special flag for 96 bit surface. 96 (or 48 if we support) bit surface's width is
+            // pre-multiplied by 3 and bpp is divided by 3. So pitch alignment for linear-
+            // aligned does not meet 64-pixel in real. We keep special handling in hwl since hw
+            // restrictions are different.
+            // Also Mip 1+ needs an element pitch of 32 bits so we do not need this workaround
+            // but we use this flag to skip RestoreSurfaceInfo below
+
+            if ((elemMode == ADDR_EXPANDED) && (expandX > 1))
+            {
+                ADDR_ASSERT((localIn.swizzleMode == ADDR_SW_LINEAR) || (localIn.height == 1));
+            }
+
+            UINT_32 basePitch = 0;
+            GetElemLib()->AdjustSurfaceInfo(elemMode,
+                                            expandX,
+                                            expandY,
+                                            &localIn.bpp,
+                                            &basePitch,
+                                            &localIn.width,
+                                            &localIn.height);
+
+            // Overwrite these parameters if we have a valid format
+        }
+
+        if (localIn.bpp != 0)
+        {
+            localIn.width  = Max(localIn.width, 1u);
+            localIn.height = Max(localIn.height, 1u);
+        }
+        else // Rule out some invalid parameters
+        {
+            ADDR_ASSERT_ALWAYS();
+
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        returnCode = ComputeSurfaceInfoSanityCheck(&localIn);
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        VerifyMipLevelInfo(pIn);
+
+        if (IsLinear(pIn->swizzleMode))
+        {
+            // linear mode
+            returnCode = ComputeSurfaceInfoLinear(&localIn, pOut);
+        }
+        else
+        {
+            // tiled mode
+            returnCode = ComputeSurfaceInfoTiled(&localIn, pOut);
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->bpp = localIn.bpp;
+            pOut->pixelPitch = pOut->pitch;
+            pOut->pixelHeight = pOut->height;
+            pOut->pixelMipChainPitch = pOut->mipChainPitch;
+            pOut->pixelMipChainHeight = pOut->mipChainHeight;
+            pOut->pixelBits = localIn.bpp;
+
+            if (localIn.format != ADDR_FMT_INVALID)
+            {
+                UINT_32 pixelBits = pOut->pixelBits;
+
+                GetElemLib()->RestoreSurfaceInfo(elemMode,
+                                                 expandX,
+                                                 expandY,
+                                                 &pOut->pixelBits,
+                                                 &pOut->pixelPitch,
+                                                 &pOut->pixelHeight);
+
+                GetElemLib()->RestoreSurfaceInfo(elemMode,
+                                                 expandX,
+                                                 expandY,
+                                                 &pixelBits,
+                                                 &pOut->pixelMipChainPitch,
+                                                 &pOut->pixelMipChainHeight);
+            }
+
+            if (localIn.flags.needEquation && (Log2(localIn.numFrags) == 0))
+            {
+                pOut->equationIndex = GetEquationIndex(&localIn, pOut);
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeSurfaceInfo.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceAddrFromCoord(
+    const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT)) ||
+            (pOut->size != sizeof(ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT localIn = *pIn;
+    localIn.unalignedWidth = Max(pIn->unalignedWidth, 1u);
+    localIn.unalignedHeight = Max(pIn->unalignedHeight, 1u);
+    localIn.numMipLevels = Max(pIn->numMipLevels, 1u);
+    localIn.numSlices = Max(pIn->numSlices, 1u);
+    localIn.numSamples = Max(pIn->numSamples, 1u);
+    localIn.numFrags = Max(pIn->numFrags, 1u);
+
+    if ((localIn.bpp < 8)        ||
+        (localIn.bpp > 128)      ||
+        ((localIn.bpp % 8) != 0) ||
+        (localIn.sample >= localIn.numSamples)  ||
+        (localIn.slice >= localIn.numSlices)    ||
+        (localIn.mipId >= localIn.numMipLevels) ||
+        (IsTex3d(localIn.resourceType) &&
+         (Valid3DMipSliceIdConstraint(localIn.numSlices, localIn.mipId, localIn.slice) == FALSE)))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        if (IsLinear(localIn.swizzleMode))
+        {
+            returnCode = ComputeSurfaceAddrFromCoordLinear(&localIn, pOut);
+        }
+        else
+        {
+            returnCode = ComputeSurfaceAddrFromCoordTiled(&localIn, pOut);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceCoordFromAddr
+*
+*   @brief
+*       Interface function stub of ComputeSurfaceCoordFromAddr.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceCoordFromAddr(
+    const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT)) ||
+            (pOut->size != sizeof(ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if ((pIn->bpp < 8)        ||
+        (pIn->bpp > 128)      ||
+        ((pIn->bpp % 8) != 0) ||
+        (pIn->bitPosition >= 8))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        if (IsLinear(pIn->swizzleMode))
+        {
+            returnCode = ComputeSurfaceCoordFromAddrLinear(pIn, pOut);
+        }
+        else
+        {
+            returnCode = ComputeSurfaceCoordFromAddrTiled(pIn, pOut);
+        }
+    }
+
+    return returnCode;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               CMASK/HTILE
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeHtilenfo
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeHtileInfo(
+    const ADDR2_COMPUTE_HTILE_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_HTILE_INFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_HTILE_INFO_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_HTILE_INFO_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeHtileInfo(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeHtileAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeHtileAddrFromCoord(
+    const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeHtileAddrFromCoord(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileCoordFromAddr
+*
+*   @brief
+*       Interface function stub of AddrComputeHtileCoordFromAddr
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeHtileCoordFromAddr(
+    const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeHtileCoordFromAddr(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskInfo
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskInfo(
+    const ADDR2_COMPUTE_CMASK_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_CMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_CMASK_INFO_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_CMASK_INFO_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else if (pIn->cMaskFlags.linear)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeCmaskInfo(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskAddrFromCoord(
+    const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeCmaskAddrFromCoord(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskCoordFromAddr
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskCoordFromAddr
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskCoordFromAddr(
+    const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_NOTIMPLEMENTED;
+
+    ADDR_NOT_IMPLEMENTED();
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeFmaskInfo
+*
+*   @brief
+*       Interface function stub of ComputeFmaskInfo.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeFmaskInfo(
+    const ADDR2_COMPUTE_FMASK_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_FMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
+    )
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    BOOL_32 valid = (IsZOrderSwizzle(pIn->swizzleMode) == TRUE) &&
+                    ((pIn->numSamples > 0) || (pIn->numFrags > 0));
+
+    if (GetFillSizeFieldsFlags())
+    {
+        if ((pIn->size != sizeof(ADDR2_COMPUTE_FMASK_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR2_COMPUTE_FMASK_INFO_OUTPUT)))
+        {
+            valid = FALSE;
+        }
+    }
+
+    if (valid == FALSE)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        ADDR2_COMPUTE_SURFACE_INFO_INPUT  localIn = {0};
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {0};
+
+        localIn.size = sizeof(ADDR2_COMPUTE_SURFACE_INFO_INPUT);
+        localOut.size = sizeof(ADDR2_COMPUTE_SURFACE_INFO_OUTPUT);
+
+        localIn.swizzleMode  = pIn->swizzleMode;
+        localIn.numSlices    = Max(pIn->numSlices, 1u);
+        localIn.width        = Max(pIn->unalignedWidth, 1u);
+        localIn.height       = Max(pIn->unalignedHeight, 1u);
+        localIn.bpp          = GetFmaskBpp(pIn->numSamples, pIn->numFrags);
+        localIn.flags.fmask  = 1;
+        localIn.numFrags     = 1;
+        localIn.numSamples   = 1;
+        localIn.resourceType = ADDR_RSRC_TEX_2D;
+
+        if (localIn.bpp == 8)
+        {
+            localIn.format = ADDR_FMT_8;
+        }
+        else if (localIn.bpp == 16)
+        {
+            localIn.format = ADDR_FMT_16;
+        }
+        else if (localIn.bpp == 32)
+        {
+            localIn.format = ADDR_FMT_32;
+        }
+        else
+        {
+            localIn.format = ADDR_FMT_32_32;
+        }
+
+        returnCode = ComputeSurfaceInfo(&localIn, &localOut);
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->pitch      = localOut.pitch;
+            pOut->height     = localOut.height;
+            pOut->baseAlign  = localOut.baseAlign;
+            pOut->numSlices  = localOut.numSlices;
+            pOut->fmaskBytes = static_cast<UINT_32>(localOut.surfSize);
+            pOut->sliceSize  = localOut.sliceSize;
+            pOut->bpp        = localIn.bpp;
+            pOut->numSamples = 1;
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeFmaskAddrFromCoord
+*
+*   @brief
+*       Interface function stub of ComputeFmaskAddrFromCoord.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeFmaskAddrFromCoord(
+    const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_NOTIMPLEMENTED;
+
+    ADDR_NOT_IMPLEMENTED();
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeFmaskCoordFromAddr
+*
+*   @brief
+*       Interface function stub of ComputeFmaskAddrFromCoord.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeFmaskCoordFromAddr(
+    const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT*  pIn,     ///< [in] input structure
+    ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*       pOut     ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_NOTIMPLEMENTED;
+
+    ADDR_NOT_IMPLEMENTED();
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMetaMiptailInfo
+*
+*   @brief
+*       Get mip tail coordinate information.
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID Lib::GetMetaMiptailInfo(
+    ADDR2_META_MIP_INFO*    pInfo,          ///< [out] output structure to store per mip coord
+    Dim3d                   mipCoord,       ///< [in] mip tail base coord
+    UINT_32                 numMipInTail,   ///< [in] number of mips in tail
+    Dim3d*                  pMetaBlkDim     ///< [in] meta block width/height/depth
+    ) const
+{
+    BOOL_32 isThick = (pMetaBlkDim->d > 1);
+    UINT_32 mipWidth  = pMetaBlkDim->w;
+    UINT_32 mipHeight = pMetaBlkDim->h >> 1;
+    UINT_32 mipDepth  = pMetaBlkDim->d;
+    UINT_32 minInc;
+
+    if (isThick)
+    {
+        minInc = (pMetaBlkDim->h >= 512) ? 128 : ((pMetaBlkDim->h == 256) ? 64 : 32);
+    }
+    else if (pMetaBlkDim->h >= 1024)
+    {
+        minInc = 256;
+    }
+    else if (pMetaBlkDim->h == 512)
+    {
+        minInc = 128;
+    }
+    else
+    {
+        minInc = 64;
+    }
+
+    UINT_32 blk32MipId = 0xFFFFFFFF;
+
+    for (UINT_32 mip = 0; mip < numMipInTail; mip++)
+    {
+        pInfo[mip].inMiptail = TRUE;
+        pInfo[mip].startX = mipCoord.w;
+        pInfo[mip].startY = mipCoord.h;
+        pInfo[mip].startZ = mipCoord.d;
+        pInfo[mip].width = mipWidth;
+        pInfo[mip].height = mipHeight;
+        pInfo[mip].depth = mipDepth;
+
+        if (mipWidth <= 32)
+        {
+            if (blk32MipId == 0xFFFFFFFF)
+            {
+                blk32MipId = mip;
+            }
+
+            mipCoord.w = pInfo[blk32MipId].startX;
+            mipCoord.h = pInfo[blk32MipId].startY;
+            mipCoord.d = pInfo[blk32MipId].startZ;
+
+            switch (mip - blk32MipId)
+            {
+                case 0:
+                    mipCoord.w += 32;       // 16x16
+                    break;
+                case 1:
+                    mipCoord.h += 32;       // 8x8
+                    break;
+                case 2:
+                    mipCoord.h += 32;       // 4x4
+                    mipCoord.w += 16;
+                    break;
+                case 3:
+                    mipCoord.h += 32;       // 2x2
+                    mipCoord.w += 32;
+                    break;
+                case 4:
+                    mipCoord.h += 32;       // 1x1
+                    mipCoord.w += 48;
+                    break;
+                // The following are for BC/ASTC formats
+                case 5:
+                    mipCoord.h += 48;       // 1/2 x 1/2
+                    break;
+                case 6:
+                    mipCoord.h += 48;       // 1/4 x 1/4
+                    mipCoord.w += 16;
+                    break;
+                case 7:
+                    mipCoord.h += 48;       // 1/8 x 1/8
+                    mipCoord.w += 32;
+                    break;
+                case 8:
+                    mipCoord.h += 48;       // 1/16 x 1/16
+                    mipCoord.w += 48;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    break;
+            }
+
+            mipWidth = ((mip - blk32MipId) == 0) ? 16 : 8;
+            mipHeight = mipWidth;
+
+            if (isThick)
+            {
+                mipDepth = mipWidth;
+            }
+        }
+        else
+        {
+            if (mipWidth <= minInc)
+            {
+                // if we're below the minimal increment...
+                if (isThick)
+                {
+                    // For 3d, just go in z direction
+                    mipCoord.d += mipDepth;
+                }
+                else
+                {
+                    // For 2d, first go across, then down
+                    if ((mipWidth * 2) == minInc)
+                    {
+                        // if we're 2 mips below, that's when we go back in x, and down in y
+                        mipCoord.w -= minInc;
+                        mipCoord.h += minInc;
+                    }
+                    else
+                    {
+                        // otherwise, just go across in x
+                        mipCoord.w += minInc;
+                    }
+                }
+            }
+            else
+            {
+                // On even mip, go down, otherwise, go across
+                if (mip & 1)
+                {
+                    mipCoord.w += mipWidth;
+                }
+                else
+                {
+                    mipCoord.h += mipHeight;
+                }
+            }
+            // Divide the width by 2
+            mipWidth >>= 1;
+            // After the first mip in tail, the mip is always a square
+            mipHeight = mipWidth;
+            // ...or for 3d, a cube
+            if (isThick)
+            {
+                mipDepth = mipWidth;
+            }
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeDccInfo
+*
+*   @brief
+*       Interface function to compute DCC key info
+*
+*   @return
+*       return code of HwlComputeDccInfo
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeDccInfo(
+    const ADDR2_COMPUTE_DCCINFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_DCCINFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_DCCINFO_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_DCCINFO_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeDccInfo(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputePipeBankXor
+*
+*   @brief
+*       Interface function stub of Addr2ComputePipeBankXor.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputePipeBankXor(
+    const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+    ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut)
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_PIPEBANKXOR_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
+        UINT_32 pipeBits = GetPipeXorBits(macroBlockBits);
+        UINT_32 bankBits = GetBankXorBits(macroBlockBits);
+        UINT_32 pipeXor = 0;
+        UINT_32 bankXor = 0;
+
+        if (bankBits > 0)
+        {
+            UINT_32 bankMask = (1 << bankBits) - 1;
+            UINT_32 bankIncrease = (1 << (bankBits - 1)) - 1;
+            bankIncrease = (bankIncrease == 0) ? 1 : bankIncrease;
+            bankXor = ((pIn->surfIndex & bankMask) * bankIncrease) & bankMask;
+        }
+
+        if (pipeBits > 0)
+        {
+            UINT_32 pipeMask = (1 << pipeBits) - 1;
+            UINT_32 pipeIncrease = ((1 << (pipeBits - 1)) + 1) & pipeMask;
+            pipeIncrease = (pipeIncrease == 0) ? 1 : pipeIncrease;
+            pipeXor = ((pIn->surfIndex & pipeMask) * pipeIncrease) & pipeMask;
+        }
+
+        // Todo - pOut->pipeBankXor = pOut->pipeBankXor << (PipeInterleaveLog2 - 8)
+        pOut->pipeBankXor = (bankXor << pipeBits) | pipeXor;
+
+        returnCode = ADDR_OK;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ExtractPipeBankXor
+*
+*   @brief
+*       Internal function to extract bank and pipe xor bits from combined xor bits.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ExtractPipeBankXor(
+    UINT_32  pipeBankXor,
+    UINT_32  bankBits,
+    UINT_32  pipeBits,
+    UINT_32* pBankX,
+    UINT_32* pPipeX)
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if (pipeBankXor < (1u << (pipeBits + bankBits)))
+    {
+        *pPipeX = pipeBankXor % (1 << pipeBits);
+        *pBankX = pipeBankXor >> pipeBits;
+        returnCode = ADDR_OK;
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfoSanityCheck
+*
+*   @brief
+*       Internal function to do basic sanity check before compute surface info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceInfoSanityCheck(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT*  pIn   ///< [in] input structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    BOOL_32 invalid = FALSE;
+
+    if ((pIn->bpp > 128) || (pIn->width == 0) || (pIn->numFrags > 8) || (pIn->numSamples > 16))
+    {
+        invalid = TRUE;
+    }
+    else if ((pIn->swizzleMode >= ADDR_SW_MAX_TYPE)    ||
+             (pIn->resourceType >= ADDR_RSRC_MAX_TYPE))
+    {
+        invalid = TRUE;
+    }
+
+    BOOL_32 mipmap = (pIn->numMipLevels > 1);
+    BOOL_32 msaa   = (pIn->numFrags > 1);
+
+    ADDR2_SURFACE_FLAGS flags = pIn->flags;
+    BOOL_32 zbuffer = (flags.depth || flags.stencil);
+    BOOL_32 color   = flags.color;
+    BOOL_32 display = flags.display || flags.rotated;
+
+    AddrResourceType rsrcType = pIn->resourceType;
+    BOOL_32 tex3d = IsTex3d(rsrcType);
+
+    AddrSwizzleMode swizzle = pIn->swizzleMode;
+    BOOL_32 linear  = IsLinear(swizzle);
+    BOOL_32 blk256B = IsBlock256b(swizzle);
+    BOOL_32 blkVar = IsBlockVariable(swizzle);
+    BOOL_32 isNonPrtXor = IsNonPrtXor(swizzle);
+    BOOL_32 prt = pIn->flags.prt;
+
+    if (invalid == FALSE)
+    {
+        if ((pIn->numFrags > 1) &&
+            (GetBlockSize(swizzle) < (m_pipeInterleaveBytes * pIn->numFrags)))
+        {
+            // MSAA surface must have blk_bytes/pipe_interleave >= num_samples
+            invalid = TRUE;
+        }
+    }
+
+    if (invalid == FALSE)
+    {
+        switch (rsrcType)
+        {
+            case ADDR_RSRC_TEX_1D:
+                invalid = msaa || zbuffer || display || (linear == FALSE);
+                break;
+            case ADDR_RSRC_TEX_2D:
+                invalid = msaa && mipmap;
+                break;
+            case ADDR_RSRC_TEX_3D:
+                invalid = msaa || zbuffer || display;
+                break;
+            default:
+                invalid = TRUE;
+                break;
+        }
+    }
+
+    if (invalid == FALSE)
+    {
+        if (display)
+        {
+            invalid = (IsValidDisplaySwizzleMode(pIn) == FALSE);
+        }
+    }
+
+    if (invalid == FALSE)
+    {
+        if (linear)
+        {
+            invalid = prt || zbuffer || msaa || (pIn->bpp == 0) || ((pIn->bpp % 8) != 0);
+        }
+        else
+        {
+            if (blk256B || blkVar || isNonPrtXor)
+            {
+                invalid = prt;
+                if (blk256B)
+                {
+                    invalid = invalid || zbuffer || tex3d || mipmap || msaa;
+                }
+            }
+
+            if (invalid == FALSE)
+            {
+                if (IsZOrderSwizzle(swizzle))
+                {
+                    invalid = color && msaa;
+                }
+                else if (IsStandardSwizzle(rsrcType, swizzle))
+                {
+                    invalid = zbuffer;
+                }
+                else if (IsDisplaySwizzle(rsrcType, swizzle))
+                {
+                    invalid = zbuffer;
+                }
+                else if (IsRotateSwizzle(swizzle))
+                {
+                    invalid = zbuffer || (pIn->bpp > 64);
+                }
+                else
+                {
+                    ADDR_ASSERT(!"invalid swizzle mode");
+                    invalid = TRUE;
+                }
+            }
+        }
+    }
+
+    if (invalid)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ApplyCustomizedPitchHeight
+*
+*   @brief
+*       Helper function to override hw required row pitch/slice pitch by customrized one
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ApplyCustomizedPitchHeight(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input structure
+    UINT_32  elementBytes,                          ///< [in] element bytes per element
+    UINT_32  widthAlignInElement,                   ///< [in] pitch alignment in element
+    UINT_32* pPitch,                                ///< [in/out] pitch
+    UINT_32* pHeight                                ///< [in/out] height
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pIn->numMipLevels <= 1)
+    {
+        if (pIn->pitchInElement > 0)
+        {
+            if ((pIn->pitchInElement % widthAlignInElement) != 0)
+            {
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else if (pIn->pitchInElement < (*pPitch))
+            {
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else
+            {
+                *pPitch = pIn->pitchInElement;
+            }
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (pIn->sliceAlign > 0)
+            {
+                UINT_32 customizedHeight = pIn->sliceAlign / elementBytes / (*pPitch);
+
+                if (customizedHeight * elementBytes * (*pPitch) != pIn->sliceAlign)
+                {
+                    returnCode = ADDR_INVALIDPARAMS;
+                }
+                else if ((pIn->numSlices > 1) && ((*pHeight) != customizedHeight))
+                {
+                    returnCode = ADDR_INVALIDPARAMS;
+                }
+                else
+                {
+                    *pHeight = customizedHeight;
+                }
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfoLinear
+*
+*   @brief
+*       Internal function to calculate alignment for linear swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceInfoLinear(
+     const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    UINT_32 pitch = 0;
+    UINT_32 actualHeight = 0;
+    UINT_32 elementBytes = pIn->bpp >> 3;
+
+    if (IsTex1d(pIn->resourceType))
+    {
+        if (pIn->height > 1)
+        {
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+        else
+        {
+            const UINT_32 widthAlignInElement = 256 / elementBytes;
+            pitch = PowTwoAlign(pIn->width, widthAlignInElement);
+            actualHeight = pIn->numMipLevels;
+            returnCode = ApplyCustomizedPitchHeight(pIn, elementBytes, widthAlignInElement,
+                                                    &pitch, &actualHeight);
+
+            if (returnCode == ADDR_OK)
+            {
+                if (pOut->pMipInfo != NULL)
+                {
+                    for (UINT_32 i = 0; i < pIn->numMipLevels; i++)
+                    {
+                        pOut->pMipInfo[i].offset = pitch * elementBytes * i;
+                        pOut->pMipInfo[i].pitch = pitch;
+                        pOut->pMipInfo[i].height = 1;
+                        pOut->pMipInfo[i].depth = 1;
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        returnCode = ComputeSurfaceLinearPadding(pIn, &pitch, &actualHeight, pOut->pMipInfo);
+    }
+
+    if ((pitch == 0) || (actualHeight == 0))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        pOut->pitch = pitch;
+        pOut->height = pIn->height;
+        pOut->numSlices = pIn->numSlices;
+        pOut->mipChainPitch = pitch;
+        pOut->mipChainHeight = actualHeight;
+        pOut->mipChainSlice = pOut->numSlices;
+        pOut->epitchIsHeight = (pIn->numMipLevels > 1) ? TRUE : FALSE;
+        pOut->sliceSize = pOut->pitch * actualHeight * elementBytes;
+        pOut->surfSize = pOut->sliceSize * pOut->numSlices;
+        pOut->baseAlign = (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL) ? (pIn->bpp / 8) : 256;
+        pOut->blockWidth = (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL) ? 1 : (256 * 8 / pIn->bpp);
+        pOut->blockHeight = 1;
+        pOut->blockSlices = 1;
+    }
+
+    // Post calculation validate
+    ADDR_ASSERT((pOut->sliceSize > 0));
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfoTiled
+*
+*   @brief
+*       Internal function to calculate alignment for tiled swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceInfoTiled(
+     const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ComputeBlockDimensionForSurf(&pOut->blockWidth,
+                                                                &pOut->blockHeight,
+                                                                &pOut->blockSlices,
+                                                                pIn->bpp,
+                                                                pIn->numFrags,
+                                                                pIn->resourceType,
+                                                                pIn->swizzleMode);
+
+    if (returnCode == ADDR_OK)
+    {
+        const UINT_32 widthAlignInElement = pOut->blockWidth;
+
+        pOut->pitch = PowTwoAlign(pIn->width, widthAlignInElement);
+
+        if ((pIn->numMipLevels <= 1) && (pIn->pitchInElement > 0))
+        {
+            if ((pIn->pitchInElement % widthAlignInElement) != 0)
+            {
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else if (pIn->pitchInElement < pOut->pitch)
+            {
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else
+            {
+                pOut->pitch = pIn->pitchInElement;
+            }
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->height = PowTwoAlign(pIn->height, pOut->blockHeight);
+            pOut->numSlices = PowTwoAlign(pIn->numSlices, pOut->blockSlices);
+
+            pOut->epitchIsHeight = FALSE;
+            pOut->firstMipInTail = FALSE;
+
+            pOut->mipChainPitch  = pOut->pitch;
+            pOut->mipChainHeight = pOut->height;
+            pOut->mipChainSlice  = pOut->numSlices;
+
+            if (pIn->numMipLevels > 1)
+            {
+                UINT_32 numMipLevel;
+                ADDR2_MIP_INFO *pMipInfo;
+                ADDR2_MIP_INFO mipInfo[4];
+
+                if (pOut->pMipInfo != NULL)
+                {
+                    pMipInfo = pOut->pMipInfo;
+                    numMipLevel = pIn->numMipLevels;
+                }
+                else
+                {
+                    pMipInfo = mipInfo;
+                    numMipLevel = Min(pIn->numMipLevels, 4u);
+                }
+
+                UINT_32 endingMip = GetMipChainInfo(pIn->resourceType,
+                                                    pIn->swizzleMode,
+                                                    pIn->bpp,
+                                                    pIn->width,
+                                                    pIn->height,
+                                                    pIn->numSlices,
+                                                    pOut->blockWidth,
+                                                    pOut->blockHeight,
+                                                    pOut->blockSlices,
+                                                    numMipLevel,
+                                                    pMipInfo);
+
+                if (endingMip == 0)
+                {
+                    pOut->epitchIsHeight = TRUE;
+                    pOut->pitch          = pMipInfo[0].pitch;
+                    pOut->height         = pMipInfo[0].height;
+                    pOut->numSlices      = pMipInfo[0].depth;
+                    pOut->firstMipInTail = TRUE;
+                }
+                else
+                {
+                    UINT_32 mip0WidthInBlk = pOut->pitch / pOut->blockWidth;
+                    UINT_32 mip0HeightInBlk = pOut->height / pOut->blockHeight;
+
+                    AddrMajorMode majorMode = GetMajorMode(pIn->resourceType,
+                                                           pIn->swizzleMode,
+                                                           mip0WidthInBlk,
+                                                           mip0HeightInBlk,
+                                                           pOut->numSlices / pOut->blockSlices);
+                    if (majorMode == ADDR_MAJOR_Y)
+                    {
+                        UINT_32 mip1WidthInBlk = RoundHalf(mip0WidthInBlk);
+
+                        if ((mip1WidthInBlk == 1) && (endingMip > 2))
+                        {
+                            mip1WidthInBlk++;
+                        }
+
+                        pOut->mipChainPitch += (mip1WidthInBlk * pOut->blockWidth);
+
+                        pOut->epitchIsHeight = FALSE;
+                    }
+                    else
+                    {
+                        UINT_32 mip1HeightInBlk = RoundHalf(mip0HeightInBlk);
+
+                        if ((mip1HeightInBlk == 1) && (endingMip > 2))
+                        {
+                            mip1HeightInBlk++;
+                        }
+
+                        pOut->mipChainHeight += (mip1HeightInBlk * pOut->blockHeight);
+
+                        pOut->epitchIsHeight = TRUE;
+                    }
+                }
+            }
+            else if (pOut->pMipInfo != NULL)
+            {
+                pOut->pMipInfo[0].pitch = pOut->pitch;
+                pOut->pMipInfo[0].height = pOut->height;
+                pOut->pMipInfo[0].depth = IsTex3d(pIn->resourceType)? pOut->numSlices : 1;
+                pOut->pMipInfo[0].offset = 0;
+            }
+
+            pOut->sliceSize = pOut->mipChainPitch *pOut->mipChainHeight *
+                              (pIn->bpp >> 3) * pIn->numFrags;
+            pOut->surfSize = pOut->sliceSize * pOut->mipChainSlice;
+            pOut->baseAlign = ComputeSurfaceBaseAlign(pIn->swizzleMode);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceAddrFromCoordLinear
+*
+*   @brief
+*       Internal function to calculate address from coord for linear swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceAddrFromCoordLinear(
+     const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+    BOOL_32 valid = (pIn->numSamples <= 1) && (pIn->numFrags <= 1) && (pIn->pipeBankXor == 0);
+
+    if (valid)
+    {
+        if (IsTex1d(pIn->resourceType))
+        {
+            valid = (pIn->y == 0);
+        }
+    }
+
+    if (valid)
+    {
+        ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0};
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {0};
+        localIn.bpp = pIn->bpp;
+        localIn.width = Max(pIn->unalignedWidth, 1u);
+        localIn.height = Max(pIn->unalignedHeight, 1u);
+        localIn.numSlices = Max(pIn->numSlices, 1u);
+        localIn.numMipLevels = Max(pIn->numMipLevels, 1u);
+        localIn.resourceType = pIn->resourceType;
+        if (localIn.numMipLevels <= 1)
+        {
+            localIn.pitchInElement = pIn->pitchInElement;
+        }
+        returnCode = ComputeSurfaceInfoLinear(&localIn, &localOut);
+
+        if (returnCode == ADDR_OK)
+        {
+            UINT_32 elementBytes = pIn->bpp >> 3;
+            UINT_64 sliceOffsetInSurf = static_cast<UINT_64>(pIn->slice) * localOut.sliceSize;
+            UINT_64 mipOffsetInSlice = 0;
+            UINT_64 offsetInMip = 0;
+
+            if (IsTex1d(pIn->resourceType))
+            {
+                offsetInMip = static_cast<UINT_64>(pIn->x) * elementBytes;
+                mipOffsetInSlice = static_cast<UINT_64>(pIn->mipId) * localOut.pitch * elementBytes;
+            }
+            else
+            {
+                UINT_64 mipStartHeight = SumGeo(localIn.height, pIn->mipId);
+                mipOffsetInSlice = static_cast<UINT_64>(mipStartHeight) * localOut.pitch * elementBytes;
+                offsetInMip = (pIn->y * localOut.pitch + pIn->x) * elementBytes;
+            }
+
+            pOut->addr = sliceOffsetInSurf + mipOffsetInSlice + offsetInMip;
+            pOut->bitPosition = 0;
+        }
+        else
+        {
+            valid = FALSE;
+        }
+    }
+
+    if (valid == FALSE)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceAddrFromCoordTiled
+*
+*   @brief
+*       Internal function to calculate address from coord for tiled swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceAddrFromCoordTiled(
+     const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0};
+    localIn.swizzleMode  = pIn->swizzleMode;
+    localIn.flags        = pIn->flags;
+    localIn.resourceType = pIn->resourceType;
+    localIn.bpp          = pIn->bpp;
+    localIn.width        = Max(pIn->unalignedWidth, 1u);
+    localIn.height       = Max(pIn->unalignedHeight, 1u);
+    localIn.numSlices    = Max(pIn->numSlices, 1u);
+    localIn.numMipLevels = Max(pIn->numMipLevels, 1u);
+    if (localIn.numMipLevels <= 1)
+    {
+        localIn.pitchInElement = pIn->pitchInElement;
+    }
+
+    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {0};
+    ADDR_E_RETURNCODE returnCode = ComputeSurfaceInfoTiled(&localIn, &localOut);
+
+    BOOL_32 valid = (returnCode == ADDR_OK) &&
+                    (IsThin(pIn->resourceType, pIn->swizzleMode) ||
+                     IsThick(pIn->resourceType, pIn->swizzleMode)) &&
+                    ((pIn->pipeBankXor == 0) || (IsXor(pIn->swizzleMode)));
+
+    if (valid)
+    {
+        Dim3d mipStartPos = {0};
+        UINT_32 mipTailOffset = 0;
+
+        if (pIn->numMipLevels > 1)
+        {
+            // Mip-map chain cannot be MSAA surface
+            ADDR_ASSERT((pIn->numSamples <= 1) && (pIn->numFrags<= 1));
+
+            mipStartPos = GetMipStartPos(pIn->resourceType,
+                                         pIn->swizzleMode,
+                                         localOut.pitch,
+                                         localOut.height,
+                                         localOut.numSlices,
+                                         localOut.blockWidth,
+                                         localOut.blockHeight,
+                                         localOut.blockSlices,
+                                         pIn->mipId,
+                                         &mipTailOffset);
+        }
+
+        UINT_32 interleaveOffset = 0;
+        UINT_32 pipeBits = 0;
+        UINT_32 pipeXor = 0;
+        UINT_32 bankBits = 0;
+        UINT_32 bankXor = 0;
+
+        if (IsThin(pIn->resourceType, pIn->swizzleMode))
+        {
+            UINT_32 blockOffset = 0;
+            UINT_32 log2blkSize = GetBlockSizeLog2(pIn->swizzleMode);
+            UINT_32 log2ElementBytes = Log2(pIn->bpp >> 3);
+
+            if (IsZOrderSwizzle(pIn->swizzleMode))
+            {
+                // Morton generation
+                if ((log2ElementBytes == 0) || (log2ElementBytes == 2))
+                {
+                    UINT_32 totalLowBits = 6 - log2ElementBytes;
+                    UINT_32 mortBits = totalLowBits / 2;
+                    UINT_32 lowBitsValue = MortonGen2d(pIn->y, pIn->x, mortBits);
+                    // Are 9 bits enough?
+                    UINT_32 highBitsValue =
+                        MortonGen2d(pIn->x >> mortBits, pIn->y >> mortBits, 9) << totalLowBits;
+                    blockOffset = lowBitsValue | highBitsValue;
+                    ADDR_ASSERT(blockOffset == lowBitsValue + highBitsValue);
+                }
+                else
+                {
+                    blockOffset = MortonGen2d(pIn->y, pIn->x, 13);
+                }
+
+                // Fill LSBs with sample bits
+                if (pIn->numSamples > 1)
+                {
+                    blockOffset *= pIn->numSamples;
+                    blockOffset |= pIn->sample;
+                }
+
+                // Shift according to BytesPP
+                blockOffset <<= log2ElementBytes;
+            }
+            else
+            {
+                // Micro block offset
+                UINT_32 microBlockOffset = ComputeSurface2DMicroBlockOffset(pIn);
+                blockOffset = microBlockOffset;
+
+                // Micro block dimension
+                ADDR_ASSERT(log2ElementBytes < sizeof(Block256b) / sizeof(Block256b[0]));
+                Dim2d microBlockDim = Block256b[log2ElementBytes];
+                // Morton generation, does 12 bit enough?
+                blockOffset |=
+                    MortonGen2d((pIn->x / microBlockDim.w), (pIn->y / microBlockDim.h), 12) << 8;
+
+                // Sample bits start location
+                UINT_32 sampleStart = log2blkSize - Log2(pIn->numSamples);
+                // Join sample bits information to the highest Macro block bits
+                if (IsNonPrtXor(pIn->swizzleMode))
+                {
+                    // Non-prt-Xor : xor highest Macro block bits with sample bits
+                    blockOffset = blockOffset ^ (pIn->sample << sampleStart);
+                }
+                else
+                {
+                    // Non-Xor or prt-Xor: replace highest Macro block bits with sample bits
+                    // after this op, the blockOffset only contains log2 Macro block size bits
+                    blockOffset %= (1 << sampleStart);
+                    blockOffset |= (pIn->sample << sampleStart);
+                    ADDR_ASSERT((blockOffset >> log2blkSize) == 0);
+                }
+            }
+
+            if (IsXor(pIn->swizzleMode))
+            {
+                // Mask off bits above Macro block bits to keep page synonyms working for prt
+                if (IsPrt(pIn->swizzleMode))
+                {
+                    blockOffset &= ((1 << log2blkSize) - 1);
+                }
+
+                // Preserve offset inside pipe interleave
+                interleaveOffset = blockOffset & ((1 << m_pipeInterleaveLog2) - 1);
+                blockOffset >>= m_pipeInterleaveLog2;
+
+                // Pipe/Se xor bits
+                pipeBits = GetPipeXorBits(log2blkSize);
+                // Pipe xor
+                pipeXor = FoldXor2d(blockOffset, pipeBits);
+                blockOffset >>= pipeBits;
+
+                // Bank xor bits
+                bankBits = GetBankXorBits(log2blkSize);
+                // Bank Xor
+                bankXor = FoldXor2d(blockOffset, bankBits);
+                blockOffset >>= bankBits;
+
+                // Put all the part back together
+                blockOffset <<= bankBits;
+                blockOffset |= bankXor;
+                blockOffset <<= pipeBits;
+                blockOffset |= pipeXor;
+                blockOffset <<= m_pipeInterleaveLog2;
+                blockOffset |= interleaveOffset;
+            }
+
+            ADDR_ASSERT((blockOffset | mipTailOffset) == (blockOffset + mipTailOffset));
+            blockOffset |= mipTailOffset;
+
+            if (IsNonPrtXor(pIn->swizzleMode) && (pIn->numSamples <= 1))
+            {
+                // Apply slice xor if not MSAA/PRT
+                blockOffset ^= (ReverseBitVector(pIn->slice, pipeBits) << m_pipeInterleaveLog2);
+                blockOffset ^= (ReverseBitVector(pIn->slice >> pipeBits, bankBits) <<
+                                (m_pipeInterleaveLog2 + pipeBits));
+            }
+
+            returnCode = ApplyCustomerPipeBankXor(pIn->swizzleMode, pIn->pipeBankXor,
+                                                  bankBits, pipeBits, &blockOffset);
+
+            blockOffset %= (1 << log2blkSize);
+
+            UINT_32 pitchInMacroBlock = localOut.mipChainPitch / localOut.blockWidth;
+            UINT_32 paddedHeightInMacroBlock = localOut.mipChainHeight / localOut.blockHeight;
+            UINT_32 sliceSizeInMacroBlock = pitchInMacroBlock * paddedHeightInMacroBlock;
+            UINT_32 macroBlockIndex =
+                (pIn->slice + mipStartPos.d) * sliceSizeInMacroBlock +
+                ((pIn->y / localOut.blockHeight) + mipStartPos.h) * pitchInMacroBlock +
+                ((pIn->x / localOut.blockWidth) + mipStartPos.w);
+
+            UINT_64 macroBlockOffset = (static_cast<UINT_64>(macroBlockIndex) <<
+                                       GetBlockSizeLog2(pIn->swizzleMode));
+
+            pOut->addr = blockOffset | macroBlockOffset;
+        }
+        else
+        {
+            UINT_32 log2blkSize = GetBlockSizeLog2(pIn->swizzleMode);
+            UINT_32 log2ElementBytes = Log2(pIn->bpp >> 3);
+
+            Dim3d microBlockDim = Block1kb[log2ElementBytes];
+
+            UINT_32 blockOffset = MortonGen3d((pIn->x / microBlockDim.w),
+                                              (pIn->y / microBlockDim.h),
+                                              (pIn->slice / microBlockDim.d),
+                                              8);
+
+            blockOffset <<= 10;
+            blockOffset |= ComputeSurface3DMicroBlockOffset(pIn);
+
+            if (IsXor(pIn->swizzleMode))
+            {
+                // Mask off bits above Macro block bits to keep page synonyms working for prt
+                if (IsPrt(pIn->swizzleMode))
+                {
+                    blockOffset &= ((1 << log2blkSize) - 1);
+                }
+
+                // Preserve offset inside pipe interleave
+                interleaveOffset = blockOffset & ((1 << m_pipeInterleaveLog2) - 1);
+                blockOffset >>= m_pipeInterleaveLog2;
+
+                // Pipe/Se xor bits
+                pipeBits = GetPipeXorBits(log2blkSize);
+                // Pipe xor
+                pipeXor = FoldXor3d(blockOffset, pipeBits);
+                blockOffset >>= pipeBits;
+
+                // Bank xor bits
+                bankBits = GetBankXorBits(log2blkSize);
+                // Bank Xor
+                bankXor = FoldXor3d(blockOffset, bankBits);
+                blockOffset >>= bankBits;
+
+                // Put all the part back together
+                blockOffset <<= bankBits;
+                blockOffset |= bankXor;
+                blockOffset <<= pipeBits;
+                blockOffset |= pipeXor;
+                blockOffset <<= m_pipeInterleaveLog2;
+                blockOffset |= interleaveOffset;
+            }
+
+            ADDR_ASSERT((blockOffset | mipTailOffset) == (blockOffset + mipTailOffset));
+            blockOffset |= mipTailOffset;
+
+            returnCode = ApplyCustomerPipeBankXor(pIn->swizzleMode, pIn->pipeBankXor,
+                                                  bankBits, pipeBits, &blockOffset);
+
+            blockOffset %= (1 << log2blkSize);
+
+            UINT_32 xb = (pIn->x + mipStartPos.w) / localOut.blockWidth;
+            UINT_32 yb = (pIn->y + mipStartPos.h) / localOut.blockHeight;
+            UINT_32 zb = (pIn->slice + mipStartPos.d) / localOut.blockSlices;
+
+            UINT_32 pitchInBlock = localOut.mipChainPitch / localOut.blockWidth;
+            UINT_32 sliceSizeInBlock =
+                (localOut.mipChainHeight / localOut.blockHeight) * pitchInBlock;
+            UINT_32 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
+
+            pOut->addr = blockOffset | (blockIndex << log2blkSize);
+        }
+    }
+    else
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceCoordFromAddrLinear
+*
+*   @brief
+*       Internal function to calculate coord from address for linear swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceCoordFromAddrLinear(
+     const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    BOOL_32 valid = (pIn->numSamples <= 1) && (pIn->numFrags <= 1);
+
+    if (valid)
+    {
+        if (IsTex1d(pIn->resourceType))
+        {
+            valid = (pIn->unalignedHeight == 1);
+        }
+    }
+
+    if (valid)
+    {
+        ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0};
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {0};
+        localIn.bpp = pIn->bpp;
+        localIn.width = Max(pIn->unalignedWidth, 1u);
+        localIn.height = Max(pIn->unalignedHeight, 1u);
+        localIn.numSlices = Max(pIn->numSlices, 1u);
+        localIn.numMipLevels = Max(pIn->numMipLevels, 1u);
+        localIn.resourceType = pIn->resourceType;
+        if (localIn.numMipLevels <= 1)
+        {
+            localIn.pitchInElement = pIn->pitchInElement;
+        }
+        returnCode = ComputeSurfaceInfoLinear(&localIn, &localOut);
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->slice = static_cast<UINT_32>(pIn->addr / localOut.sliceSize);
+            pOut->sample = 0;
+
+            UINT_32 offsetInSlice = static_cast<UINT_32>(pIn->addr % localOut.sliceSize);
+            UINT_32 elementBytes = pIn->bpp >> 3;
+            UINT_32 mipOffsetInSlice = 0;
+            UINT_32 mipSize = 0;
+            UINT_32 mipId = 0;
+            for (; mipId < pIn->numMipLevels ; mipId++)
+            {
+                if (IsTex1d(pIn->resourceType))
+                {
+                    mipSize = localOut.pitch * elementBytes;
+                }
+                else
+                {
+                    UINT_32 currentMipHeight = (PowTwoAlign(localIn.height, (1 << mipId))) >> mipId;
+                    mipSize = currentMipHeight * localOut.pitch * elementBytes;
+                }
+
+                if (mipSize == 0)
+                {
+                    valid = FALSE;
+                    break;
+                }
+                else if ((mipSize + mipOffsetInSlice) > offsetInSlice)
+                {
+                    break;
+                }
+                else
+                {
+                    mipOffsetInSlice += mipSize;
+                    if ((mipId == (pIn->numMipLevels - 1)) ||
+                        (mipOffsetInSlice >= localOut.sliceSize))
+                    {
+                        valid = FALSE;
+                    }
+                }
+            }
+
+            if (valid)
+            {
+                pOut->mipId = mipId;
+
+                UINT_32 elemOffsetInMip = (offsetInSlice - mipOffsetInSlice) / elementBytes;
+                if (IsTex1d(pIn->resourceType))
+                {
+                    if (elemOffsetInMip < localOut.pitch)
+                    {
+                        pOut->x = elemOffsetInMip;
+                        pOut->y = 0;
+                    }
+                    else
+                    {
+                        valid = FALSE;
+                    }
+                }
+                else
+                {
+                    pOut->y = elemOffsetInMip / localOut.pitch;
+                    pOut->x = elemOffsetInMip % localOut.pitch;
+                }
+
+                if ((pOut->slice >= pIn->numSlices)    ||
+                    (pOut->mipId >= pIn->numMipLevels) ||
+                    (pOut->x >= Max((pIn->unalignedWidth >> pOut->mipId), 1u))  ||
+                    (pOut->y >= Max((pIn->unalignedHeight >> pOut->mipId), 1u)) ||
+                    (IsTex3d(pIn->resourceType) &&
+                     (FALSE == Valid3DMipSliceIdConstraint(pIn->numSlices,
+                                                           pOut->mipId,
+                                                           pOut->slice))))
+                {
+                    valid = FALSE;
+                }
+            }
+        }
+        else
+        {
+            valid = FALSE;
+        }
+    }
+
+    if (valid == FALSE)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceCoordFromAddrTiled
+*
+*   @brief
+*       Internal function to calculate coord from address for tiled swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceCoordFromAddrTiled(
+     const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
+     ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_NOTIMPLEMENTED;
+
+    ADDR_NOT_IMPLEMENTED();
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfoLinear
+*
+*   @brief
+*       Internal function to calculate padding for linear swizzle 2D/3D surface
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceLinearPadding(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input srtucture
+    UINT_32* pMipmap0PaddedWidth,                   ///< [out] padded width in element
+    UINT_32* pSlice0PaddedHeight,                   ///< [out] padded height for HW
+    ADDR2_MIP_INFO* pMipInfo                        ///< [out] per mip information
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    UINT_32 elementBytes = pIn->bpp >> 3;
+    UINT_32 widthAlignInElement = 0;
+
+    if (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL)
+    {
+        ADDR_ASSERT(pIn->numMipLevels <= 1);
+        ADDR_ASSERT(pIn->numSlices <= 1);
+        widthAlignInElement = 1;
+    }
+    else
+    {
+        widthAlignInElement = (256 / elementBytes);
+    }
+
+    UINT_32 mipChainWidth = PowTwoAlign(pIn->width, widthAlignInElement);
+    UINT_32 slice0PaddedHeight = pIn->height;
+
+    returnCode = ApplyCustomizedPitchHeight(pIn, elementBytes, widthAlignInElement,
+                                            &mipChainWidth, &slice0PaddedHeight);
+
+    if (returnCode == ADDR_OK)
+    {
+        UINT_32 mipChainHeight = 0;
+        UINT_32 mipHeight = pIn->height;
+
+        for (UINT_32 i = 0; i < pIn->numMipLevels; i++)
+        {
+            if (pMipInfo != NULL)
+            {
+                pMipInfo[i].offset = mipChainWidth * mipChainHeight * elementBytes;
+                pMipInfo[i].pitch = mipChainWidth;
+                pMipInfo[i].height = mipHeight;
+                pMipInfo[i].depth = 1;
+            }
+
+            mipChainHeight += mipHeight;
+            mipHeight = RoundHalf(mipHeight);
+            mipHeight = Max(mipHeight, 1u);
+        }
+
+        *pMipmap0PaddedWidth = mipChainWidth;
+        *pSlice0PaddedHeight = (pIn->numMipLevels > 1) ? mipChainHeight : slice0PaddedHeight;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeBlockDimensionForSurf
+*
+*   @brief
+*       Internal function to get block width/height/depth in element from surface input params.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeBlockDimensionForSurf(
+    Dim3d*            pDim,
+    UINT_32           bpp,
+    UINT_32           numSamples,
+    AddrResourceType  resourceType,
+    AddrSwizzleMode   swizzleMode) const
+{
+    return ComputeBlockDimensionForSurf(&pDim->w, &pDim->h, &pDim->d, bpp,
+                                        numSamples, resourceType, swizzleMode);
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeBlockDimensionForSurf
+*
+*   @brief
+*       Internal function to get block width/height/depth in element from surface input params.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeBlockDimensionForSurf(
+    UINT_32*         pWidth,
+    UINT_32*         pHeight,
+    UINT_32*         pDepth,
+    UINT_32          bpp,
+    UINT_32          numSamples,
+    AddrResourceType resourceType,
+    AddrSwizzleMode  swizzleMode) const
+{
+    ADDR_E_RETURNCODE returnCode = ComputeBlockDimension(pWidth,
+                                                         pHeight,
+                                                         pDepth,
+                                                         bpp,
+                                                         resourceType,
+                                                         swizzleMode);
+
+    if ((returnCode == ADDR_OK) && (numSamples > 1) && IsThin(resourceType, swizzleMode))
+    {
+        UINT_32 log2blkSize = GetBlockSizeLog2(swizzleMode);
+        UINT_32 sample = numSamples;
+        UINT_32 log2sample = Log2(sample);
+
+        *pWidth  >>= (log2sample / 2);
+        *pHeight >>= (log2sample / 2);
+
+        if ((log2blkSize % 2) == 0)
+        {
+            *pWidth >>= (sample % 2);
+        }
+        else
+        {
+            *pHeight >>= (sample % 2);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeBlockDimension
+*
+*   @brief
+*       Internal function to get block width/height/depth in element without considering MSAA case
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeBlockDimension(
+    UINT_32*          pWidth,
+    UINT_32*          pHeight,
+    UINT_32*          pDepth,
+    UINT_32           bpp,
+    AddrResourceType  resourceType,
+    AddrSwizzleMode   swizzleMode) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    UINT_32 eleBytes = bpp >> 3;
+    UINT_32 microBlockSizeTableIndex = Log2(eleBytes);
+    UINT_32 log2blkSize = GetBlockSizeLog2(swizzleMode);
+
+    if (IsThin(resourceType, swizzleMode))
+    {
+        if (pDepth != NULL)
+        {
+            *pDepth = 1;
+        }
+
+        UINT_32 log2blkSizeIn256B = log2blkSize - 8;
+        UINT_32 widthAmp  = log2blkSizeIn256B / 2;
+        UINT_32 heightAmp = log2blkSizeIn256B - widthAmp;
+
+        ADDR_ASSERT(microBlockSizeTableIndex < sizeof(Block256b) / sizeof(Block256b[0]));
+
+        *pWidth  = (Block256b[microBlockSizeTableIndex].w << widthAmp);
+        *pHeight = (Block256b[microBlockSizeTableIndex].h << heightAmp);
+    }
+    else if (IsThick(resourceType, swizzleMode))
+    {
+        UINT_32 log2blkSizeIn1KB = log2blkSize - 10;
+        UINT_32 averageAmp = log2blkSizeIn1KB / 3;
+        UINT_32 restAmp = log2blkSizeIn1KB % 3;
+
+        ADDR_ASSERT(microBlockSizeTableIndex < sizeof(Block1kb) / sizeof(Block1kb[0]));
+
+        *pWidth  = Block1kb[microBlockSizeTableIndex].w << averageAmp;
+        *pHeight = Block1kb[microBlockSizeTableIndex].h << (averageAmp + (restAmp / 2));
+        *pDepth  = Block1kb[microBlockSizeTableIndex].d << (averageAmp + ((restAmp != 0) ? 1 : 0));
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMipChainInfo
+*
+*   @brief
+*       Internal function to get out information about mip chain
+*
+*   @return
+*       Smaller value between Id of first mip fitted in mip tail and max Id of mip being created
+****************************************************************************************************
+*/
+UINT_32 Lib::GetMipChainInfo(
+    AddrResourceType  resourceType,
+    AddrSwizzleMode   swizzleMode,
+    UINT_32           bpp,
+    UINT_32           mip0Width,
+    UINT_32           mip0Height,
+    UINT_32           mip0Depth,
+    UINT_32           blockWidth,
+    UINT_32           blockHeight,
+    UINT_32           blockDepth,
+    UINT_32           numMipLevel,
+    ADDR2_MIP_INFO*   pMipInfo) const
+{
+    const Dim3d tailMaxDim =
+        GetMipTailDim(resourceType, swizzleMode, blockWidth, blockHeight, blockDepth);
+
+    UINT_32 mipPitch  = mip0Width;
+    UINT_32 mipHeight = mip0Height;
+    UINT_32 mipDepth  = IsTex3d(resourceType) ? mip0Depth : 1;
+    UINT_32 offset    = 0;
+    UINT_32 endingMip = numMipLevel - 1;
+    BOOL_32 inTail    = FALSE;
+    BOOL_32 finalDim  = FALSE;
+
+    BOOL_32 is3dThick = IsThick(resourceType, swizzleMode);
+    BOOL_32 is3dThin  = IsTex3d(resourceType) && SwizzleModeTable[swizzleMode].isDisp;
+
+    for (UINT_32 mipId = 0; mipId < numMipLevel; mipId++)
+    {
+        if (inTail)
+        {
+            if (finalDim == FALSE)
+            {
+                UINT_32 mipSize;
+
+                if (is3dThick)
+                {
+                    mipSize = mipPitch * mipHeight * mipDepth * (bpp >> 3);
+                }
+                else
+                {
+                    mipSize = mipPitch * mipHeight * (bpp >> 3);
+                }
+
+                if (mipSize <= 256)
+                {
+                    UINT_32 index = Log2(bpp >> 3);
+
+                    if (is3dThick)
+                    {
+                        mipPitch  = CompressBlock3dZ[index].w;
+                        mipHeight = CompressBlock3dZ[index].h;
+                        mipDepth  = CompressBlock3dZ[index].d;
+                    }
+                    else
+                    {
+                        mipPitch  = CompressBlock2d[index].w;
+                        mipHeight = CompressBlock2d[index].h;
+                    }
+
+                    finalDim = TRUE;
+                }
+            }
+        }
+        else
+        {
+            inTail = IsInMipTail(resourceType, swizzleMode, tailMaxDim,
+                                 mipPitch, mipHeight, mipDepth);
+
+            if (inTail)
+            {
+                endingMip = mipId;
+
+                mipPitch  = tailMaxDim.w;
+                mipHeight = tailMaxDim.h;
+
+                if (is3dThick)
+                {
+                    mipDepth = tailMaxDim.d;
+                }
+            }
+            else
+            {
+                mipPitch  = PowTwoAlign(mipPitch,  blockWidth);
+                mipHeight = PowTwoAlign(mipHeight, blockHeight);
+
+                if (is3dThick)
+                {
+                    mipDepth = PowTwoAlign(mipDepth,  blockDepth);
+                }
+            }
+        }
+
+        pMipInfo[mipId].pitch  = mipPitch;
+        pMipInfo[mipId].height = mipHeight;
+        pMipInfo[mipId].depth  = mipDepth;
+        pMipInfo[mipId].offset = offset;
+        offset += (mipPitch * mipHeight * mipDepth * (bpp >> 3));
+
+        if (finalDim)
+        {
+            if (is3dThin)
+            {
+                mipDepth = Max(mipDepth >> 1, 1u);
+            }
+        }
+        else
+        {
+            mipPitch  = Max(mipPitch >> 1, 1u);
+            mipHeight = Max(mipHeight >> 1, 1u);
+
+            if (is3dThick || is3dThin)
+            {
+                mipDepth = Max(mipDepth >> 1, 1u);
+            }
+        }
+    }
+
+    return endingMip;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMipStartPos
+*
+*   @brief
+*       Internal function to get out information about mip logical start position
+*
+*   @return
+*       logical start position in macro block width/heith/depth of one mip level within one slice
+****************************************************************************************************
+*/
+Dim3d Lib::GetMipStartPos(
+    AddrResourceType  resourceType,
+    AddrSwizzleMode   swizzleMode,
+    UINT_32           width,
+    UINT_32           height,
+    UINT_32           depth,
+    UINT_32           blockWidth,
+    UINT_32           blockHeight,
+    UINT_32           blockDepth,
+    UINT_32           mipId,
+    UINT_32*          pMipTailOffset) const
+{
+    Dim3d mipStartPos = {0};
+
+    const Dim3d tailMaxDim =
+        GetMipTailDim(resourceType, swizzleMode, blockWidth, blockHeight, blockDepth);
+
+    // Report mip in tail if Mip0 is already in mip tail
+    BOOL_32 inMipTail = IsInMipTail(resourceType, swizzleMode, tailMaxDim, width, height, depth);
+
+    UINT_32 log2blkSize = GetBlockSizeLog2(swizzleMode);
+
+    if (inMipTail == FALSE)
+    {
+        // Mip 0 dimension, unit in block
+        UINT_32 mipWidthInBlk  = width / blockWidth;
+        UINT_32 mipHeightInBlk = height / blockHeight;
+        UINT_32 mipDepthInBlk  = depth / blockDepth;
+        AddrMajorMode majorMode = GetMajorMode(resourceType,
+                                               swizzleMode,
+                                               mipWidthInBlk,
+                                               mipHeightInBlk,
+                                               mipDepthInBlk);
+
+        UINT_32 endingMip = mipId + 1;
+
+        for (UINT_32 i = 1; i <= mipId; i++)
+        {
+            if ((i == 1) || (i == 3))
+            {
+                if (majorMode == ADDR_MAJOR_Y)
+                {
+                    mipStartPos.w += mipWidthInBlk;
+                }
+                else
+                {
+                    mipStartPos.h += mipHeightInBlk;
+                }
+            }
+            else
+            {
+                if (majorMode == ADDR_MAJOR_X)
+                {
+                   mipStartPos.w += mipWidthInBlk;
+                }
+                else if (majorMode == ADDR_MAJOR_Y)
+                {
+                   mipStartPos.h += mipHeightInBlk;
+                }
+                else
+                {
+                   mipStartPos.d += mipDepthInBlk;
+                }
+            }
+
+            BOOL_32 inTail = FALSE;
+
+            if (IsThick(resourceType, swizzleMode))
+            {
+                UINT_32 dim = log2blkSize % 3;
+
+                if (dim == 0)
+                {
+                    inTail =
+                        (mipWidthInBlk <= 2) && (mipHeightInBlk == 1) && (mipDepthInBlk <= 2);
+                }
+                else if (dim == 1)
+                {
+                    inTail =
+                        (mipWidthInBlk == 1) && (mipHeightInBlk <= 2) && (mipDepthInBlk <= 2);
+                }
+                else
+                {
+                    inTail =
+                        (mipWidthInBlk <= 2) && (mipHeightInBlk <= 2) && (mipDepthInBlk == 1);
+                }
+            }
+            else
+            {
+                if (log2blkSize & 1)
+                {
+                    inTail = (mipWidthInBlk <= 2) && (mipHeightInBlk == 1);
+                }
+                else
+                {
+                    inTail = (mipWidthInBlk == 1) && (mipHeightInBlk <= 2);
+                }
+            }
+
+            if (inTail)
+            {
+                endingMip = i;
+                break;
+            }
+
+            mipWidthInBlk = RoundHalf(mipWidthInBlk);
+            mipHeightInBlk = RoundHalf(mipHeightInBlk);
+            mipDepthInBlk = RoundHalf(mipDepthInBlk);
+        }
+
+        if (mipId >= endingMip)
+        {
+            inMipTail = TRUE;
+            UINT_32 index = mipId - endingMip + MaxMacroBits - log2blkSize;
+            ADDR_ASSERT(index < sizeof(MipTailOffset) / sizeof(UINT_32));
+            *pMipTailOffset = MipTailOffset[index] << 8;
+        }
+    }
+    else
+    {
+        UINT_32 index = mipId + MaxMacroBits - log2blkSize;
+        ADDR_ASSERT(index < sizeof(MipTailOffset) / sizeof(UINT_32));
+        *pMipTailOffset = MipTailOffset[index] << 8;
+    }
+
+    return mipStartPos;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMipTailDim
+*
+*   @brief
+*       Internal function to get out max dimension of first level in mip tail
+*
+*   @return
+*       Max Width/Height/Depth value of the first mip fitted in mip tail
+****************************************************************************************************
+*/
+Dim3d Lib::GetMipTailDim(
+    AddrResourceType  resourceType,
+    AddrSwizzleMode   swizzleMode,
+    UINT_32           blockWidth,
+    UINT_32           blockHeight,
+    UINT_32           blockDepth) const
+{
+    Dim3d out = {blockWidth, blockHeight, blockDepth};
+    UINT_32 log2blkSize = GetBlockSizeLog2(swizzleMode);
+
+    if (IsThick(resourceType, swizzleMode))
+    {
+        UINT_32 dim = log2blkSize % 3;
+
+        if (dim == 0)
+        {
+            out.h >>= 1;
+        }
+        else if (dim == 1)
+        {
+            out.w >>= 1;
+        }
+        else
+        {
+            out.d >>= 1;
+        }
+    }
+    else
+    {
+        if (log2blkSize & 1)
+        {
+            out.h >>= 1;
+        }
+        else
+        {
+            out.w >>= 1;
+        }
+    }
+
+    return out;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurface2DMicroBlockOffset
+*
+*   @brief
+*       Internal function to calculate micro block (256B) offset from coord for 2D resource
+*
+*   @return
+*       micro block (256B) offset for 2D resource
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputeSurface2DMicroBlockOffset(
+    const _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn) const
+{
+    ADDR_ASSERT(IsThin(pIn->resourceType, pIn->swizzleMode));
+
+    UINT_32 log2ElementBytes = Log2(pIn->bpp >> 3);
+    UINT_32 microBlockOffset = 0;
+    if (IsStandardSwizzle(pIn->resourceType, pIn->swizzleMode))
+    {
+        UINT_32 xBits = pIn->x << log2ElementBytes;
+        microBlockOffset = (xBits & 0xf) | ((pIn->y & 0x3) << 4);
+        if (log2ElementBytes < 3)
+        {
+            microBlockOffset |= (pIn->y & 0x4) << 4;
+            if (log2ElementBytes == 0)
+            {
+                microBlockOffset |= (pIn->y & 0x8) << 4;
+            }
+            else
+            {
+                microBlockOffset |= (xBits & 0x10) << 3;
+            }
+        }
+        else
+        {
+            microBlockOffset |= (xBits & 0x30) << 2;
+        }
+    }
+    else if (IsDisplaySwizzle(pIn->resourceType, pIn->swizzleMode))
+    {
+        if (log2ElementBytes == 4)
+        {
+            microBlockOffset = (GetBit(pIn->x, 0) << 4) |
+                               (GetBit(pIn->y, 0) << 5) |
+                               (GetBit(pIn->x, 1) << 6) |
+                               (GetBit(pIn->y, 1) << 7);
+        }
+        else
+        {
+            microBlockOffset = GetBits(pIn->x, 0, 3, log2ElementBytes)     |
+                               GetBits(pIn->y, 1, 2, 3 + log2ElementBytes) |
+                               GetBits(pIn->x, 3, 1, 5 + log2ElementBytes) |
+                               GetBits(pIn->y, 3, 1, 6 + log2ElementBytes);
+            microBlockOffset = GetBits(microBlockOffset, 0, 4, 0) |
+                               (GetBit(pIn->y, 0) << 4) |
+                               GetBits(microBlockOffset, 4, 3, 5);
+        }
+    }
+    else if (IsRotateSwizzle(pIn->swizzleMode))
+    {
+        microBlockOffset = GetBits(pIn->y, 0, 3, log2ElementBytes) |
+                           GetBits(pIn->x, 1, 2, 3 + log2ElementBytes) |
+                           GetBits(pIn->x, 3, 1, 5 + log2ElementBytes) |
+                           GetBits(pIn->y, 3, 1, 6 + log2ElementBytes);
+        microBlockOffset = GetBits(microBlockOffset, 0, 4, 0) |
+                           (GetBit(pIn->x, 0) << 4) |
+                           GetBits(microBlockOffset, 4, 3, 5);
+        if (log2ElementBytes == 3)
+        {
+           microBlockOffset = GetBits(microBlockOffset, 0, 6, 0) |
+                              GetBits(pIn->x, 1, 2, 6);
+        }
+    }
+
+    return microBlockOffset;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurface3DMicroBlockOffset
+*
+*   @brief
+*       Internal function to calculate micro block (1KB) offset from coord for 3D resource
+*
+*   @return
+*       micro block (1KB) offset for 3D resource
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputeSurface3DMicroBlockOffset(
+    const _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn) const
+{
+    ADDR_ASSERT(IsThick(pIn->resourceType, pIn->swizzleMode));
+
+    UINT_32 log2ElementBytes = Log2(pIn->bpp >> 3);
+    UINT_32 microBlockOffset = 0;
+    if (IsStandardSwizzle(pIn->resourceType, pIn->swizzleMode))
+    {
+        if (log2ElementBytes == 0)
+        {
+            microBlockOffset = ((pIn->slice & 4) >> 2) | ((pIn->y & 4) >> 1);
+        }
+        else if (log2ElementBytes == 1)
+        {
+            microBlockOffset = ((pIn->slice & 4) >> 2) | ((pIn->y & 4) >> 1);
+        }
+        else if (log2ElementBytes == 2)
+        {
+            microBlockOffset = ((pIn->y & 4) >> 2) | ((pIn->x & 4) >> 1);
+        }
+        else if (log2ElementBytes == 3)
+        {
+            microBlockOffset = (pIn->x & 6) >> 1;
+        }
+        else
+        {
+            microBlockOffset = pIn->x & 3;
+        }
+
+        microBlockOffset <<= 8;
+
+        UINT_32 xBits = pIn->x << log2ElementBytes;
+        microBlockOffset |= (xBits & 0xf) | ((pIn->y & 0x3) << 4) | ((pIn->slice & 0x3) << 6);
+    }
+    else if (IsZOrderSwizzle(pIn->swizzleMode))
+    {
+        UINT_32 xh, yh, zh;
+
+        if (log2ElementBytes == 0)
+        {
+            microBlockOffset =
+                (pIn->x & 1) | ((pIn->y & 1) << 1) | ((pIn->x & 2) << 1) | ((pIn->y & 2) << 2);
+            microBlockOffset = microBlockOffset | ((pIn->slice & 3) << 4) | ((pIn->x & 4) << 4);
+
+            xh = pIn->x >> 3;
+            yh = pIn->y >> 2;
+            zh = pIn->slice >> 2;
+        }
+        else if (log2ElementBytes == 1)
+        {
+            microBlockOffset =
+                (pIn->x & 1) | ((pIn->y & 1) << 1) | ((pIn->x & 2) << 1) | ((pIn->y & 2) << 2);
+            microBlockOffset = (microBlockOffset << 1) | ((pIn->slice & 3) << 5);
+
+            xh = pIn->x >> 2;
+            yh = pIn->y >> 2;
+            zh = pIn->slice >> 2;
+        }
+        else if (log2ElementBytes == 2)
+        {
+            microBlockOffset =
+                (pIn->x & 1) | ((pIn->y & 1) << 1) | ((pIn->x & 2) << 1) | ((pIn->slice & 1) << 3);
+            microBlockOffset = (microBlockOffset << 2) | ((pIn->y & 2) << 5);
+
+            xh = pIn->x >> 2;
+            yh = pIn->y >> 2;
+            zh = pIn->slice >> 1;
+        }
+        else if (log2ElementBytes == 3)
+        {
+            microBlockOffset =
+                (pIn->x & 1) | ((pIn->y & 1) << 1) | ((pIn->slice & 1) << 2) | ((pIn->x & 2) << 2);
+            microBlockOffset <<= 3;
+
+            xh = pIn->x >> 2;
+            yh = pIn->y >> 1;
+            zh = pIn->slice >> 1;
+        }
+        else
+        {
+            microBlockOffset =
+                (((pIn->x & 1) | ((pIn->y & 1) << 1) | ((pIn->slice & 1) << 2)) << 4);
+
+            xh = pIn->x >> 1;
+            yh = pIn->y >> 1;
+            zh = pIn->slice >> 1;
+        }
+
+        microBlockOffset |= ((MortonGen3d(xh, yh, zh, 1) << 7) & 0x380);
+    }
+
+    return microBlockOffset;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetPipeXorBits
+*
+*   @brief
+*       Internal function to get bits number for pipe/se xor operation
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+UINT_32 Lib::GetPipeXorBits(
+    UINT_32 macroBlockBits) const
+{
+    ADDR_ASSERT(macroBlockBits >= m_pipeInterleaveLog2);
+
+    // Total available xor bits
+    UINT_32 xorBits = macroBlockBits - m_pipeInterleaveLog2;
+
+    // Pipe/Se xor bits
+    UINT_32 pipeBits = Min(xorBits, m_pipesLog2 + m_seLog2);
+
+    return pipeBits;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetBankXorBits
+*
+*   @brief
+*       Internal function to get bits number for pipe/se xor operation
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+UINT_32 Lib::GetBankXorBits(
+    UINT_32 macroBlockBits) const
+{
+    UINT_32 pipeBits = GetPipeXorBits(macroBlockBits);
+
+    // Bank xor bits
+    UINT_32 bankBits = Min(macroBlockBits - pipeBits - m_pipeInterleaveLog2, m_banksLog2);
+
+    return bankBits;
+}
+
+/**
+****************************************************************************************************
+*   Lib::Addr2GetPreferredSurfaceSetting
+*
+*   @brief
+*       Internal function to get suggested surface information for cliet to use
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::Addr2GetPreferredSurfaceSetting(
+    const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+    ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const
+{
+    // Macro define resource block type
+    enum AddrBlockType
+    {
+        AddrBlockMicro     = 0, // Resource uses 256B block
+        AddrBlock4KB       = 1, // Resource uses 4KB block
+        AddrBlock64KB      = 2, // Resource uses 64KB block
+        AddrBlockVar       = 3, // Resource uses var blcok
+        AddrBlockLinear    = 4, // Resource uses linear swizzle mode
+
+        AddrBlockMaxTiledType = AddrBlock64KB + 1,
+    };
+
+    enum AddrBlockSet
+    {
+        AddrBlockSetMicro     = 1 << AddrBlockMicro,
+        AddrBlockSetMacro4KB  = 1 << AddrBlock4KB,
+        AddrBlockSetMacro64KB = 1 << AddrBlock64KB,
+        AddrBlockSetVar       = 1 << AddrBlockVar,
+        AddrBlockSetLinear    = 1 << AddrBlockLinear,
+
+        AddrBlockSetMacro = AddrBlockSetMacro4KB | AddrBlockSetMacro64KB,
+    };
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+    ElemLib*          pElemLib   = GetElemLib();
+
+    // Set format to INVALID will skip this conversion
+    UINT_32 expandX = 1;
+    UINT_32 expandY = 1;
+    UINT_32 bpp = pIn->bpp;
+    if (pIn->format != ADDR_FMT_INVALID)
+    {
+        // Don't care for this case
+        ElemMode elemMode = ADDR_UNCOMPRESSED;
+
+        // Get compression/expansion factors and element mode which indicates compression/expansion
+        bpp = pElemLib->GetBitsPerPixel(pIn->format,
+                                        &elemMode,
+                                        &expandX,
+                                        &expandY);
+    }
+
+    UINT_32 numSamples = Max(pIn->numSamples, 1u);
+    UINT_32 numFrags = (pIn->numFrags == 0) ? numSamples : pIn->numFrags;
+    UINT_32 width = Max(pIn->width / expandX, 1u);
+    UINT_32 height = Max(pIn->height / expandY, 1u);
+    UINT_32 slice = Max(pIn->numSlices, 1u);
+    UINT_32 numMipLevels = Max(pIn->numMipLevels, 1u);
+
+    if (pIn->flags.fmask)
+    {
+        bpp        = GetFmaskBpp(numSamples, numFrags);
+        numFrags   = 1;
+        numSamples = 1;
+        pOut->resourceType = ADDR_RSRC_TEX_2D;
+    }
+    else
+    {
+        // The output may get changed for volume(3D) texture resource in future
+        pOut->resourceType = pIn->resourceType;
+    }
+
+    if (IsTex1d(pOut->resourceType))
+    {
+        pOut->swizzleMode = ADDR_SW_LINEAR;
+        pOut->validBlockSet.value = AddrBlockSetLinear;
+        pOut->canXor = FALSE;
+    }
+    else
+    {
+        ADDR2_BLOCK_SET blockSet;
+        AddrSwType swType;
+
+        blockSet.value = 0;
+
+        BOOL_32 tryPrtXor = pIn->flags.prt;
+
+        // Filter out improper swType and blockSet by HW restriction
+        if (pIn->flags.fmask || pIn->flags.depth || pIn->flags.stencil)
+        {
+            ADDR_ASSERT(IsTex2d(pOut->resourceType));
+            blockSet.value = AddrBlockSetMacro;
+            swType = ADDR_SW_Z;
+        }
+        else if (pElemLib->IsBlockCompressed(pIn->format))
+        {
+            // block compressed formats (BCx, ASTC, ETC2) must be either S or D modes.  Not sure
+            // under what circumstances "_D" would be appropriate as these formats are not
+            // displayable.
+            blockSet.value = AddrBlockSetMacro;
+            swType = ADDR_SW_S;
+        }
+        else if (IsTex3d(pOut->resourceType))
+        {
+            blockSet.value = AddrBlockSetLinear | AddrBlockSetMacro;
+            swType = (slice >= 8) ? ADDR_SW_Z : ADDR_SW_S;
+        }
+        else if (numMipLevels > 1)
+        {
+            ADDR_ASSERT(numFrags == 1);
+            blockSet.value = AddrBlockSetLinear | AddrBlockSetMacro;
+            swType = pIn->flags.display ? ADDR_SW_D : ADDR_SW_S;
+        }
+        else if ((numFrags > 1) || (numSamples > 1))
+        {
+            ADDR_ASSERT(IsTex2d(pOut->resourceType));
+            blockSet.value = AddrBlockSetMacro;
+            swType = pIn->flags.display ? ADDR_SW_D : ADDR_SW_S;
+        }
+        else
+        {
+            ADDR_ASSERT(IsTex2d(pOut->resourceType));
+            blockSet.value = AddrBlockSetLinear | AddrBlockSetMicro | AddrBlockSetMacro;
+            if (pIn->flags.rotated || pIn->flags.display)
+            {
+                swType = pIn->flags.rotated ? ADDR_SW_R : ADDR_SW_D;
+
+                if (IsDce12())
+                {
+                    if (pIn->bpp != 32)
+                    {
+                        blockSet.micro = FALSE;
+                    }
+
+                    // DCE12 does not support display surface to be _T swizzle mode
+                    tryPrtXor = FALSE;
+                }
+                else
+                {
+                    ADDR_NOT_IMPLEMENTED();
+                }
+            }
+            else if (pIn->flags.overlay)
+            {
+                swType = ADDR_SW_D;
+            }
+            else
+            {
+                swType = ADDR_SW_S;
+            }
+        }
+
+        if ((numFrags > 1) &&
+            (GetBlockSize(ADDR_SW_4KB) < (m_pipeInterleaveBytes * numFrags)))
+        {
+            // MSAA surface must have blk_bytes/pipe_interleave >= num_samples
+            blockSet.macro4KB = FALSE;
+        }
+
+        if (pIn->flags.prt)
+        {
+            blockSet.value &= AddrBlock64KB;
+        }
+
+        // Apply customized forbidden setting
+        blockSet.value &= ~pIn->forbiddenBlock.value;
+
+        if (pIn->maxAlign > 0)
+        {
+            if (pIn->maxAlign < GetBlockSize(ADDR_SW_64KB))
+            {
+                blockSet.macro64KB = FALSE;
+            }
+
+            if (pIn->maxAlign < GetBlockSize(ADDR_SW_4KB))
+            {
+                blockSet.macro4KB = FALSE;
+            }
+
+            if (pIn->maxAlign < GetBlockSize(ADDR_SW_256B))
+            {
+                blockSet.micro = FALSE;
+            }
+        }
+
+        Dim3d blkDim[AddrBlockMaxTiledType] = {{0}, {0}, {0}};
+        Dim3d padDim[AddrBlockMaxTiledType] = {{0}, {0}, {0}};
+        UINT_64 padSize[AddrBlockMaxTiledType] = {0};
+
+        if (blockSet.micro)
+        {
+            returnCode = ComputeBlockDimensionForSurf(&blkDim[AddrBlockMicro],
+                                                      bpp,
+                                                      numFrags,
+                                                      pOut->resourceType,
+                                                      ADDR_SW_256B);
+
+            if (returnCode == ADDR_OK)
+            {
+                if ((blkDim[AddrBlockMicro].w >= width) && (blkDim[AddrBlockMicro].h >= height))
+                {
+                    // If one 256B block can contain the surface, don't bother bigger block type
+                    blockSet.macro4KB = FALSE;
+                    blockSet.macro64KB = FALSE;
+                    blockSet.var = FALSE;
+                }
+
+                padSize[AddrBlockMicro] = ComputePadSize(&blkDim[AddrBlockMicro], width, height,
+                                                         slice, &padDim[AddrBlockMicro]);
+            }
+        }
+
+        if ((returnCode == ADDR_OK) && (blockSet.macro4KB))
+        {
+            returnCode = ComputeBlockDimensionForSurf(&blkDim[AddrBlock4KB],
+                                                      bpp,
+                                                      numFrags,
+                                                      pOut->resourceType,
+                                                      ADDR_SW_4KB);
+
+            if (returnCode == ADDR_OK)
+            {
+                padSize[AddrBlock4KB] = ComputePadSize(&blkDim[AddrBlock4KB], width, height,
+                                                       slice, &padDim[AddrBlock4KB]);
+
+                ADDR_ASSERT(padSize[AddrBlock4KB] >= padSize[AddrBlockMicro]);
+            }
+        }
+
+        if ((returnCode == ADDR_OK) && (blockSet.macro64KB))
+        {
+            returnCode = ComputeBlockDimensionForSurf(&blkDim[AddrBlock64KB],
+                                                      bpp,
+                                                      numFrags,
+                                                      pOut->resourceType,
+                                                      ADDR_SW_64KB);
+
+            if (returnCode == ADDR_OK)
+            {
+                padSize[AddrBlock64KB] = ComputePadSize(&blkDim[AddrBlock64KB], width, height,
+                                                        slice, &padDim[AddrBlock64KB]);
+
+                ADDR_ASSERT(padSize[AddrBlock64KB] >= padSize[AddrBlock4KB]);
+                ADDR_ASSERT(padSize[AddrBlock64KB] >= padSize[AddrBlockMicro]);
+
+                if ((padSize[AddrBlock64KB] >= static_cast<UINT_64>(width) * height * slice * 2) &&
+                    ((blockSet.value & ~AddrBlockSetMacro64KB) != 0))
+                {
+                    // If 64KB block waste more than half memory on padding, filter it out from
+                    // candidate list when it is not the only choice left
+                    blockSet.macro64KB = FALSE;
+                }
+            }
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            // Use minimum block type which meets all conditions above if flag minimizeAlign was set
+            if (pIn->flags.minimizeAlign)
+            {
+                // If padded size of 64KB block is larger than padded size of 256B block or 4KB
+                // block, filter out 64KB block from candidate list
+                if (blockSet.macro64KB &&
+                    ((blockSet.micro && (padSize[AddrBlockMicro] < padSize[AddrBlock64KB])) ||
+                     (blockSet.macro4KB && (padSize[AddrBlock4KB] < padSize[AddrBlock64KB]))))
+                {
+                    blockSet.macro64KB = FALSE;
+                }
+
+                // If padded size of 4KB block is larger than padded size of 256B block,
+                // filter out 4KB block from candidate list
+                if (blockSet.macro4KB &&
+                    blockSet.micro &&
+                    (padSize[AddrBlockMicro] < padSize[AddrBlock4KB]))
+                {
+                    blockSet.macro4KB = FALSE;
+                }
+            }
+            // Filter out 64KB/4KB block if a smaller block type has 2/3 or less memory footprint
+            else if (pIn->flags.opt4space)
+            {
+                UINT_64 threshold =
+                    blockSet.micro ?
+                    padSize[AddrBlockMicro] :
+                    (blockSet.macro4KB ? padSize[AddrBlock4KB] : padSize[AddrBlock64KB]);
+
+                threshold += threshold >> 1;
+
+                if (blockSet.macro64KB && (padSize[AddrBlock64KB] > threshold))
+                {
+                    blockSet.macro64KB = FALSE;
+                }
+
+                if (blockSet.macro4KB && (padSize[AddrBlock4KB] > threshold))
+                {
+                    blockSet.macro4KB = FALSE;
+                }
+            }
+
+            if (blockSet.value == 0)
+            {
+                // Bad things happen, client will not get any useful information from AddrLib.
+                // Maybe we should fill in some output earlier instead of outputing nothing?
+                ADDR_ASSERT_ALWAYS();
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else
+            {
+                pOut->validBlockSet = blockSet;
+                pOut->canXor = (pIn->flags.prt == FALSE) &&
+                               (blockSet.macro4KB || blockSet.macro64KB || blockSet.var);
+
+                if (blockSet.macro64KB || blockSet.macro4KB)
+                {
+                    if (swType == ADDR_SW_Z)
+                    {
+                        pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_Z : ADDR_SW_4KB_Z;
+                    }
+                    else if (swType == ADDR_SW_S)
+                    {
+                        pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_S : ADDR_SW_4KB_S;
+                    }
+                    else if (swType == ADDR_SW_D)
+                    {
+                        pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_D : ADDR_SW_4KB_D;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT(swType == ADDR_SW_R);
+                        pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_R : ADDR_SW_4KB_R;
+                    }
+
+                    if (pIn->noXor == FALSE)
+                    {
+                        if (tryPrtXor && blockSet.macro64KB)
+                        {
+                            // Client wants PRTXOR, give back _T swizzle mode if 64KB is available
+                            static const UINT_32 PrtGap = ADDR_SW_64KB_Z_T - ADDR_SW_64KB_Z;
+                            pOut->swizzleMode =
+                                static_cast<AddrSwizzleMode>(pOut->swizzleMode + PrtGap);
+                        }
+                        else if (pOut->canXor)
+                        {
+                            // Client wants XOR and this is allowed, return XOR version swizzle mode
+                            static const UINT_32 XorGap = ADDR_SW_4KB_Z_X - ADDR_SW_4KB_Z;
+                            pOut->swizzleMode =
+                                static_cast<AddrSwizzleMode>(pOut->swizzleMode + XorGap);
+                        }
+                    }
+                }
+                else if (blockSet.var)
+                {
+                    // Designer consider this swizzle is usless for most cases
+                    ADDR_UNHANDLED_CASE();
+                }
+                else if (blockSet.micro)
+                {
+                    if (swType == ADDR_SW_S)
+                    {
+                        pOut->swizzleMode = ADDR_SW_256B_S;
+                    }
+                    else if (swType == ADDR_SW_D)
+                    {
+                        pOut->swizzleMode = ADDR_SW_256B_D;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT(swType == ADDR_SW_R);
+                        pOut->swizzleMode = ADDR_SW_256B_R;
+                    }
+                }
+                else
+                {
+                    ADDR_ASSERT(blockSet.linear);
+                    // Fall into this branch doesn't mean linear is suitable, only no other choices!
+                    pOut->swizzleMode = ADDR_SW_LINEAR;
+                }
+
+#if DEBUG
+                // Post sanity check, at least AddrLib should accept the output generated by its own
+                if (pOut->swizzleMode != ADDR_SW_LINEAR)
+                {
+                    ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0};
+                    localIn.flags = pIn->flags;
+                    localIn.swizzleMode = pOut->swizzleMode;
+                    localIn.resourceType = pOut->resourceType;
+                    localIn.format = pIn->format;
+                    localIn.bpp = bpp;
+                    localIn.width = width;
+                    localIn.height = height;
+                    localIn.numSlices = slice;
+                    localIn.numMipLevels = numMipLevels;
+                    localIn.numSamples = numSamples;
+                    localIn.numFrags = numFrags;
+
+                    ADDR_E_RETURNCODE coherentCheck = ComputeSurfaceInfoSanityCheck(&localIn);
+                    ADDR_ASSERT(coherentCheck == ADDR_OK);
+
+                    // TODO : check all valid block type available in validBlockSet?
+                }
+#endif
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeBlock256Equation
+*
+*   @brief
+*       Compute equation for block 256B
+*
+*   @return
+*       If equation computed successfully
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeBlock256Equation(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode swMode,
+    UINT_32 elementBytesLog2,
+    ADDR_EQUATION* pEquation) const
+{
+    ADDR_E_RETURNCODE ret;
+
+    if (IsBlock256b(swMode))
+    {
+        ret = HwlComputeBlock256Equation(rsrcType, swMode, elementBytesLog2, pEquation);
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        ret = ADDR_INVALIDPARAMS;
+    }
+
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeThinEquation
+*
+*   @brief
+*       Compute equation for 2D/3D resource which use THIN mode
+*
+*   @return
+*       If equation computed successfully
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeThinEquation(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode swMode,
+    UINT_32 elementBytesLog2,
+    ADDR_EQUATION* pEquation) const
+{
+    ADDR_E_RETURNCODE ret;
+
+    if (IsThin(rsrcType, swMode))
+    {
+        ret = HwlComputeThinEquation(rsrcType, swMode, elementBytesLog2, pEquation);
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        ret = ADDR_INVALIDPARAMS;
+    }
+
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeThickEquation
+*
+*   @brief
+*       Compute equation for 3D resource which use THICK mode
+*
+*   @return
+*       If equation computed successfully
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeThickEquation(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode swMode,
+    UINT_32 elementBytesLog2,
+    ADDR_EQUATION* pEquation) const
+{
+    ADDR_E_RETURNCODE ret;
+
+    if (IsThick(rsrcType, swMode))
+    {
+        ret = HwlComputeThickEquation(rsrcType, swMode, elementBytesLog2, pEquation);
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        ret = ADDR_INVALIDPARAMS;
+    }
+
+    return ret;
+}
+
+} // V2
+} // Addr
+
diff --git a/src/amd/addrlib/core/addrlib2.h b/src/amd/addrlib/core/addrlib2.h
new file mode 100644 (file)
index 0000000..2815a69
--- /dev/null
@@ -0,0 +1,797 @@
+/*
+ * Copyright © 2017 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+
+/**
+****************************************************************************************************
+* @file  addrlib2.h
+* @brief Contains the Addr::V2::Lib class definition.
+****************************************************************************************************
+*/
+
+#ifndef __ADDR2_LIB2_H__
+#define __ADDR2_LIB2_H__
+
+#include "addrlib.h"
+
+namespace Addr
+{
+namespace V2
+{
+
+/**
+****************************************************************************************************
+* @brief Flags for SwizzleModeTable
+****************************************************************************************************
+*/
+struct SwizzleModeFlags
+{
+    // Swizzle mode
+    UINT_32 isLinear        : 1;    // Linear
+
+    // Block size
+    UINT_32 is256b          : 1;    // Block size is 256B
+    UINT_32 is4kb           : 1;    // Block size is 4KB
+    UINT_32 is64kb          : 1;    // Block size is 64KB
+    UINT_32 isVar           : 1;    // Block size is variable
+
+    UINT_32 isZ             : 1;    // Z order swizzle mode
+    UINT_32 isStd           : 1;    // Standard swizzle mode
+    UINT_32 isDisp          : 1;    // Display swizzle mode
+    UINT_32 isRot           : 1;    // Rotate swizzle mode
+
+    // XOR mode
+    UINT_32 isXor           : 1;    // XOR after swizzle if set
+
+    UINT_32 isT             : 1;    // T mode
+};
+
+struct Dim2d
+{
+    UINT_32 w;
+    UINT_32 h;
+};
+
+struct Dim3d
+{
+    UINT_32 w;
+    UINT_32 h;
+    UINT_32 d;
+};
+
+/**
+****************************************************************************************************
+* @brief This class contains asic independent address lib functionalities
+****************************************************************************************************
+*/
+class Lib : public Addr::Lib
+{
+public:
+    virtual ~Lib();
+
+    static Lib* GetLib(
+        ADDR_HANDLE hLib);
+
+    //
+    // Interface stubs
+    //
+
+    // For data surface
+    ADDR_E_RETURNCODE ComputeSurfaceInfo(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoord(
+        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddr(
+        const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT*  pIn,
+        ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
+
+    // For HTile
+    ADDR_E_RETURNCODE ComputeHtileInfo(
+        const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeHtileAddrFromCoord(
+        const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
+        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*  pIn,
+        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) const;
+
+    // For CMask
+    ADDR_E_RETURNCODE ComputeCmaskInfo(
+        const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeCmaskAddrFromCoord(
+        const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeCmaskCoordFromAddr(
+        const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT*  pIn,
+        ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) const;
+
+    // For FMask
+    ADDR_E_RETURNCODE ComputeFmaskInfo(
+        const ADDR2_COMPUTE_FMASK_INFO_INPUT*  pIn,
+        ADDR2_COMPUTE_FMASK_INFO_OUTPUT* pOut);
+
+    ADDR_E_RETURNCODE ComputeFmaskAddrFromCoord(
+        const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeFmaskCoordFromAddr(
+        const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT*  pIn,
+        ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
+
+    // For DCC key
+    ADDR_E_RETURNCODE ComputeDccInfo(
+        const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
+        ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut) const;
+
+    // Misc
+    ADDR_E_RETURNCODE ComputePipeBankXor(
+        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut);
+
+    ADDR_E_RETURNCODE Addr2GetPreferredSurfaceSetting(
+        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const;
+
+protected:
+    Lib();  // Constructor is protected
+    Lib(const Client* pClient);
+
+    static const SwizzleModeFlags SwizzleModeTable[ADDR_SW_MAX_TYPE];
+
+    static const Dim2d Block256b[];
+    static const Dim3d Block1kb[];
+
+    static const Dim2d CompressBlock2d[];
+    static const Dim3d CompressBlock3dS[];
+    static const Dim3d CompressBlock3dZ[];
+
+    static const UINT_32 MaxMacroBits;
+    static const UINT_32 MipTailOffset[];
+
+    // Checking block size
+    static BOOL_32 IsBlock256b(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].is256b;
+    }
+
+    static BOOL_32 IsBlock4kb(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].is4kb;
+    }
+
+    static BOOL_32 IsBlock64kb(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].is64kb;
+    }
+
+    static BOOL_32 IsBlockVariable(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isVar;
+    }
+
+    // Checking swizzle mode
+    static BOOL_32 IsLinear(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isLinear;
+    }
+
+    static BOOL_32 IsZOrderSwizzle(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isZ;
+    }
+
+    static BOOL_32 IsStandardSwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isStd ||
+               (IsTex3d(resourceType) && SwizzleModeTable[swizzleMode].isDisp);
+    }
+
+    static BOOL_32 IsDisplaySwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode)
+    {
+        return IsTex2d(resourceType) && SwizzleModeTable[swizzleMode].isDisp;
+    }
+
+    static BOOL_32 IsRotateSwizzle(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isRot;
+    }
+
+    static BOOL_32 IsXor(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isXor;
+    }
+
+    static BOOL_32 IsPrt(AddrSwizzleMode swizzleMode)
+    {
+        return SwizzleModeTable[swizzleMode].isT;
+    }
+
+    static BOOL_32 IsNonPrtXor(AddrSwizzleMode swizzleMode)
+    {
+        return (IsXor(swizzleMode) && (IsPrt(swizzleMode) == FALSE));
+    }
+
+    // Checking resource type
+    static BOOL_32 IsTex1d(AddrResourceType resourceType)
+    {
+        return (resourceType == ADDR_RSRC_TEX_1D);
+    }
+
+    static BOOL_32 IsTex2d(AddrResourceType resourceType)
+    {
+        return (resourceType == ADDR_RSRC_TEX_2D);
+    }
+
+    static BOOL_32 IsTex3d(AddrResourceType resourceType)
+    {
+        return (resourceType == ADDR_RSRC_TEX_3D);
+    }
+
+    static BOOL_32 IsThick(AddrResourceType resourceType, AddrSwizzleMode swizzleMode)
+    {
+        return (IsTex3d(resourceType) &&
+                (SwizzleModeTable[swizzleMode].isZ || SwizzleModeTable[swizzleMode].isStd));
+    }
+
+    static BOOL_32 IsThin(AddrResourceType resourceType, AddrSwizzleMode swizzleMode)
+    {
+        return (IsTex2d(resourceType) ||
+                (IsTex3d(resourceType) && SwizzleModeTable[swizzleMode].isDisp));
+    }
+
+    UINT_32 GetBlockSizeLog2(AddrSwizzleMode swizzleMode) const
+    {
+        UINT_32 blockSizeLog2 = 0;
+
+        if (IsBlock256b(swizzleMode))
+        {
+            blockSizeLog2 = 8;
+        }
+        else if (IsBlock4kb(swizzleMode))
+        {
+            blockSizeLog2 = 12;
+        }
+        else if (IsBlock64kb(swizzleMode))
+        {
+            blockSizeLog2 = 16;
+        }
+        else if (IsBlockVariable(swizzleMode))
+        {
+            blockSizeLog2 = m_blockVarSizeLog2;
+        }
+        else
+        {
+            ADDR_ASSERT_ALWAYS();
+        }
+
+        return blockSizeLog2;
+    }
+
+    UINT_32 GetBlockSize(AddrSwizzleMode swizzleMode) const
+    {
+        return (1 << GetBlockSizeLog2(swizzleMode));
+    }
+
+    static UINT_32 GetFmaskBpp(UINT_32 sample, UINT_32 frag)
+    {
+        sample = (sample == 0) ? 1 : sample;
+        frag = (frag == 0) ? sample : frag;
+
+        UINT_32 fmaskBpp = QLog2(frag);
+
+        if (sample > frag)
+        {
+            fmaskBpp++;
+        }
+
+        if (fmaskBpp == 3)
+        {
+            fmaskBpp = 4;
+        }
+
+        fmaskBpp = Max(8u, fmaskBpp * sample);
+
+        return fmaskBpp;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileInfo(
+        const ADDR2_COMPUTE_HTILE_INFO_INPUT*    pIn,
+        ADDR2_COMPUTE_HTILE_INFO_OUTPUT*         pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskInfo(
+        const ADDR2_COMPUTE_CMASK_INFO_INPUT*    pIn,
+        ADDR2_COMPUTE_CMASK_INFO_OUTPUT*         pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
+        const ADDR2_COMPUTE_DCCINFO_INPUT*    pIn,
+        ADDR2_COMPUTE_DCCINFO_OUTPUT*         pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
+        const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
+        const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
+        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*  pIn,
+        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeBlock256Equation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeThinEquation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeThickEquation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual UINT_32 HwlGetEquationIndex(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_INVALID_EQUATION_INDEX;
+    }
+
+    UINT_32 GetEquationIndex(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const
+    {
+        return HwlGetEquationIndex(pIn, pOut);
+    }
+
+    virtual UINT_32 HwlComputeSurfaceBaseAlign(AddrSwizzleMode swizzleMode) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return 0;
+    }
+
+    UINT_32 ComputeSurfaceBaseAlign(AddrSwizzleMode swizzleMode) const
+    {
+        return HwlComputeSurfaceBaseAlign(swizzleMode);
+    }
+
+    ADDR_E_RETURNCODE ComputeBlock256Equation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const;
+
+    ADDR_E_RETURNCODE ComputeThinEquation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const;
+
+    ADDR_E_RETURNCODE ComputeThickEquation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceInfoSanityCheck(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceInfoLinear(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceLinearPadding(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32* pMipmap0PaddedWidth,
+        UINT_32* pSlice0PaddedHeight,
+        ADDR2_MIP_INFO* pMipInfo = NULL) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceInfoTiled(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoordLinear(
+        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoordTiled(
+        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddrLinear(
+        const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddrTiled(
+        const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut) const;
+
+    UINT_32 ComputeSurface2DMicroBlockOffset(
+        const _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn) const;
+
+    UINT_32 ComputeSurface3DMicroBlockOffset(
+        const _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn) const;
+
+    // Misc
+    ADDR_E_RETURNCODE ComputeBlockDimensionForSurf(
+        Dim3d*            pDim,
+        UINT_32           bpp,
+        UINT_32           numSamples,
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode) const;
+
+    ADDR_E_RETURNCODE ComputeBlockDimensionForSurf(
+        UINT_32*         pWidth,
+        UINT_32*         pHeight,
+        UINT_32*         pDepth,
+        UINT_32          bpp,
+        UINT_32          numSamples,
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const;
+
+    ADDR_E_RETURNCODE ComputeBlockDimension(
+        UINT_32*          pWidth,
+        UINT_32*          pHeight,
+        UINT_32*          pDepth,
+        UINT_32           bpp,
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode) const;
+
+    static UINT_64 ComputePadSize(
+        const Dim3d*      pBlkDim,
+        UINT_32           width,
+        UINT_32           height,
+        UINT_32           numSlices,
+        Dim3d*            pPadDim)
+    {
+        pPadDim->w = PowTwoAlign(width ,pBlkDim->w);
+        pPadDim->h = PowTwoAlign(height ,pBlkDim->h);
+        pPadDim->d = PowTwoAlign(numSlices, pBlkDim->d);
+        return static_cast<UINT_64>(pPadDim->w) * pPadDim->h * pPadDim->d;
+    }
+
+    UINT_32 GetMipChainInfo(
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode,
+        UINT_32           bpp,
+        UINT_32           mip0Width,
+        UINT_32           mip0Height,
+        UINT_32           mip0Depth,
+        UINT_32           blockWidth,
+        UINT_32           blockHeight,
+        UINT_32           blockDepth,
+        UINT_32           numMipLevel,
+        ADDR2_MIP_INFO*   pMipInfo) const;
+
+    VOID GetMetaMiptailInfo(
+        ADDR2_META_MIP_INFO*    pInfo,
+        Dim3d                   mipCoord,
+        UINT_32                 numMipInTail,
+        Dim3d*                  pMetaBlkDim
+    ) const;
+
+    static ADDR_E_RETURNCODE ExtractPipeBankXor(
+        UINT_32  pipeBankXor,
+        UINT_32  bankBits,
+        UINT_32  pipeBits,
+        UINT_32* pBankX,
+        UINT_32* pPipeX);
+
+    static BOOL_32 Valid3DMipSliceIdConstraint(
+        UINT_32 numSlices,
+        UINT_32 mipId,
+        UINT_32 slice)
+    {
+        return (Max((numSlices >> mipId), 1u) > slice);
+    }
+
+    static AddrMajorMode GetMajorMode(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode,
+        UINT_32          mip0WidthInBlk,
+        UINT_32          mip0HeightInBlk,
+        UINT_32          mip0DepthInBlk)
+    {
+        BOOL_32 yMajor = (mip0WidthInBlk < mip0HeightInBlk);
+        BOOL_32 xMajor = (yMajor == FALSE);
+
+        if (IsThick(resourceType, swizzleMode))
+        {
+            yMajor = yMajor && (mip0HeightInBlk >= mip0DepthInBlk);
+            xMajor = xMajor && (mip0WidthInBlk >= mip0DepthInBlk);
+        }
+
+        AddrMajorMode majorMode;
+        if (xMajor)
+        {
+            majorMode = ADDR_MAJOR_X;
+        }
+        else if (yMajor)
+        {
+            majorMode = ADDR_MAJOR_Y;
+        }
+        else
+        {
+            majorMode = ADDR_MAJOR_Z;
+        }
+
+        return majorMode;
+    }
+
+    static Dim3d GetDccCompressBlk(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode,
+        UINT_32          bpp)
+    {
+        UINT_32 index = Log2(bpp >> 3);
+        Dim3d compressBlkDim;
+        if (IsThin(resourceType, swizzleMode))
+        {
+            compressBlkDim.w = CompressBlock2d[index].w;
+            compressBlkDim.h = CompressBlock2d[index].h;
+            compressBlkDim.d = 1;
+        }
+        else if (IsStandardSwizzle(resourceType, swizzleMode))
+        {
+            compressBlkDim = CompressBlock3dS[index];
+        }
+        else
+        {
+            compressBlkDim = CompressBlock3dZ[index];
+        }
+
+        return compressBlkDim;
+    }
+
+    Dim3d GetMipStartPos(
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode,
+        UINT_32           width,
+        UINT_32           height,
+        UINT_32           depth,
+        UINT_32           blockWidth,
+        UINT_32           blockHeight,
+        UINT_32           blockDepth,
+        UINT_32           mipId,
+        UINT_32*          pMipTailOffset) const;
+
+    Dim3d GetMipTailDim(
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode,
+        UINT_32           blockWidth,
+        UINT_32           blockHeight,
+        UINT_32           blockDepth) const;
+
+    static BOOL_32 IsInMipTail(
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode,
+        Dim3d             mipTailDim,
+        UINT_32           width,
+        UINT_32           height,
+        UINT_32           depth)
+    {
+        BOOL_32 inTail = ((width <= mipTailDim.w) &&
+                          (height <= mipTailDim.h) &&
+                          (IsThin(resourceType, swizzleMode) || (depth <= mipTailDim.d)));
+
+        return inTail;
+    }
+
+    static BOOL_32 IsLocalHeap(AddrResrouceLocation resourceType)
+    {
+        return ((resourceType == ADDR_RSRC_LOC_LOCAL) ||
+                (resourceType == ADDR_RSRC_LOC_INVIS));
+    }
+
+    static BOOL_32 IsInvisibleHeap(AddrResrouceLocation resourceType)
+    {
+        return (resourceType == ADDR_RSRC_LOC_INVIS);
+    }
+
+    static BOOL_32 IsNonlocalHeap(AddrResrouceLocation resourceType)
+    {
+        return ((resourceType == ADDR_RSRC_LOC_USWC) ||
+                (resourceType == ADDR_RSRC_LOC_CACHED));
+    }
+
+    UINT_32 GetPipeLog2ForMetaAddressing(BOOL_32 pipeAligned, AddrSwizzleMode swizzleMode) const
+    {
+        UINT_32 numPipeLog2 = pipeAligned ? Min(m_pipesLog2 + m_seLog2, 5u) : 0;
+
+        if (IsXor(swizzleMode))
+        {
+            UINT_32 maxPipeLog2 = GetBlockSizeLog2(swizzleMode) - m_pipeInterleaveLog2;
+
+            numPipeLog2 = Min(numPipeLog2, maxPipeLog2);
+        }
+
+        return numPipeLog2;
+    }
+
+    UINT_32 GetPipeNumForMetaAddressing(BOOL_32 pipeAligned, AddrSwizzleMode swizzleMode) const
+    {
+        return (1 << GetPipeLog2ForMetaAddressing(pipeAligned, swizzleMode));
+    }
+
+    VOID VerifyMipLevelInfo(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+    {
+#if DEBUG
+        if (pIn->numMipLevels > 1)
+        {
+            UINT_32 actualMipLevels = 1;
+            switch (pIn->resourceType)
+            {
+                case ADDR_RSRC_TEX_3D:
+                    // Fall through to share 2D case
+                    actualMipLevels = Max(actualMipLevels, Log2NonPow2(pIn->numSlices) + 1);
+                case ADDR_RSRC_TEX_2D:
+                    // Fall through to share 1D case
+                    actualMipLevels = Max(actualMipLevels, Log2NonPow2(pIn->height) + 1);
+                case ADDR_RSRC_TEX_1D:
+                    // Base 1D case
+                    actualMipLevels = Max(actualMipLevels, Log2NonPow2(pIn->width) + 1);
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    break;
+            }
+            // Client pass wrong number of MipLevels to addrlib and result will be bad.
+            // Not sure if we should fail this calling instead of putting an assertion here.
+            ADDR_ASSERT(actualMipLevels >= pIn->numMipLevels);
+        }
+#endif
+    }
+
+    ADDR_E_RETURNCODE ApplyCustomerPipeBankXor(
+        AddrSwizzleMode swizzleMode,
+        UINT_32         pipeBankXor,
+        UINT_32         bankBits,
+        UINT_32         pipeBits,
+        UINT_32*        pBlockOffset) const
+    {
+        ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+        if (IsXor(swizzleMode))
+        {
+            // Apply driver set bankPipeXor
+            UINT_32 bankX = 0;
+            UINT_32 pipeX = 0;
+            returnCode = ExtractPipeBankXor(pipeBankXor, bankBits, pipeBits, &bankX, &pipeX);
+            *pBlockOffset ^= (pipeX << m_pipeInterleaveLog2);
+            *pBlockOffset ^= (bankX << (m_pipeInterleaveLog2 + pipeBits));
+        }
+
+        return returnCode;
+    }
+
+    UINT_32 GetPipeXorBits(UINT_32 macroBlockBits) const;
+    UINT_32 GetBankXorBits(UINT_32 macroBlockBits) const;
+
+    virtual BOOL_32 HwlIsValidDisplaySwizzleMode(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return FALSE;
+    }
+
+    BOOL_32 IsValidDisplaySwizzleMode(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+    {
+        return HwlIsValidDisplaySwizzleMode(pIn);
+    }
+
+    virtual BOOL_32 HwlIsDce12() const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return FALSE;
+    }
+
+    BOOL_32 IsDce12() const { return HwlIsDce12(); }
+
+    ADDR_E_RETURNCODE ApplyCustomizedPitchHeight(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32  elementBytes,
+        UINT_32  widthAlignInElement,
+        UINT_32* pPitch,
+        UINT_32* pHeight) const;
+
+    UINT_32 m_se;                       ///< Number of shader engine
+    UINT_32 m_rbPerSe;                  ///< Number of render backend per shader engine
+    UINT_32 m_maxCompFrag;              ///< Number of max compressed fragment
+
+    UINT_32 m_banksLog2;                ///< Number of bank Log2
+    UINT_32 m_pipesLog2;                ///< Number of pipe per shader engine Log2
+    UINT_32 m_seLog2;                   ///< Number of shader engine Log2
+    UINT_32 m_rbPerSeLog2;              ///< Number of render backend per shader engine Log2
+    UINT_32 m_maxCompFragLog2;          ///< Number of max compressed fragment Log2
+
+    UINT_32 m_pipeInterleaveLog2;       ///< Log2 of pipe interleave bytes
+
+    UINT_32 m_blockVarSizeLog2;         ///< Log2 of block var size
+
+private:
+    // Disallow the copy constructor
+    Lib(const Lib& a);
+
+    // Disallow the assignment operator
+    Lib& operator=(const Lib& a);
+};
+
+} // V2
+} // Addr
+
+#endif
+
diff --git a/src/amd/addrlib/gfx9/chip/gfx9_enum.h b/src/amd/addrlib/gfx9/chip/gfx9_enum.h
new file mode 100644 (file)
index 0000000..c81101b
--- /dev/null
@@ -0,0 +1,10535 @@
+/*
+ * Copyright © 2017 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+
+#if !defined (_vega10_ENUM_HEADER)
+#define _vega10_ENUM_HEADER
+
+
+#ifndef _DRIVER_BUILD
+#ifndef GL_ZERO
+#define GL__ZERO                      BLEND_ZERO
+#define GL__ONE                       BLEND_ONE
+#define GL__SRC_COLOR                 BLEND_SRC_COLOR
+#define GL__ONE_MINUS_SRC_COLOR       BLEND_ONE_MINUS_SRC_COLOR
+#define GL__DST_COLOR                 BLEND_DST_COLOR
+#define GL__ONE_MINUS_DST_COLOR       BLEND_ONE_MINUS_DST_COLOR
+#define GL__SRC_ALPHA                 BLEND_SRC_ALPHA
+#define GL__ONE_MINUS_SRC_ALPHA       BLEND_ONE_MINUS_SRC_ALPHA
+#define GL__DST_ALPHA                 BLEND_DST_ALPHA
+#define GL__ONE_MINUS_DST_ALPHA       BLEND_ONE_MINUS_DST_ALPHA
+#define GL__SRC_ALPHA_SATURATE        BLEND_SRC_ALPHA_SATURATE
+#define GL__CONSTANT_COLOR            BLEND_CONSTANT_COLOR
+#define GL__ONE_MINUS_CONSTANT_COLOR  BLEND_ONE_MINUS_CONSTANT_COLOR
+#define GL__CONSTANT_ALPHA            BLEND_CONSTANT_ALPHA
+#define GL__ONE_MINUS_CONSTANT_ALPHA  BLEND_ONE_MINUS_CONSTANT_ALPHA
+#endif
+#endif
+
+/*******************************************************
+ * GDS DATA_TYPE Enums
+ *******************************************************/
+
+#ifndef ENUMS_GDS_PERFCOUNT_SELECT_H
+#define ENUMS_GDS_PERFCOUNT_SELECT_H
+typedef enum GDS_PERFCOUNT_SELECT {
+ GDS_PERF_SEL_DS_ADDR_CONFL = 0,
+ GDS_PERF_SEL_DS_BANK_CONFL = 1,
+ GDS_PERF_SEL_WBUF_FLUSH = 2,
+ GDS_PERF_SEL_WR_COMP = 3,
+ GDS_PERF_SEL_WBUF_WR = 4,
+ GDS_PERF_SEL_RBUF_HIT = 5,
+ GDS_PERF_SEL_RBUF_MISS = 6,
+ GDS_PERF_SEL_SE0_SH0_NORET = 7,
+ GDS_PERF_SEL_SE0_SH0_RET = 8,
+ GDS_PERF_SEL_SE0_SH0_ORD_CNT = 9,
+ GDS_PERF_SEL_SE0_SH0_2COMP_REQ = 10,
+ GDS_PERF_SEL_SE0_SH0_ORD_WAVE_VALID = 11,
+ GDS_PERF_SEL_SE0_SH0_GDS_DATA_VALID = 12,
+ GDS_PERF_SEL_SE0_SH0_GDS_STALL_BY_ORD = 13,
+ GDS_PERF_SEL_SE0_SH0_GDS_WR_OP = 14,
+ GDS_PERF_SEL_SE0_SH0_GDS_RD_OP = 15,
+ GDS_PERF_SEL_SE0_SH0_GDS_ATOM_OP = 16,
+ GDS_PERF_SEL_SE0_SH0_GDS_REL_OP = 17,
+ GDS_PERF_SEL_SE0_SH0_GDS_CMPXCH_OP = 18,
+ GDS_PERF_SEL_SE0_SH0_GDS_BYTE_OP = 19,
+ GDS_PERF_SEL_SE0_SH0_GDS_SHORT_OP = 20,
+ GDS_PERF_SEL_SE0_SH1_NORET = 21,
+ GDS_PERF_SEL_SE0_SH1_RET = 22,
+ GDS_PERF_SEL_SE0_SH1_ORD_CNT = 23,
+ GDS_PERF_SEL_SE0_SH1_2COMP_REQ = 24,
+ GDS_PERF_SEL_SE0_SH1_ORD_WAVE_VALID = 25,
+ GDS_PERF_SEL_SE0_SH1_GDS_DATA_VALID = 26,
+ GDS_PERF_SEL_SE0_SH1_GDS_STALL_BY_ORD = 27,
+ GDS_PERF_SEL_SE0_SH1_GDS_WR_OP = 28,
+ GDS_PERF_SEL_SE0_SH1_GDS_RD_OP = 29,
+ GDS_PERF_SEL_SE0_SH1_GDS_ATOM_OP = 30,
+ GDS_PERF_SEL_SE0_SH1_GDS_REL_OP = 31,
+ GDS_PERF_SEL_SE0_SH1_GDS_CMPXCH_OP = 32,
+ GDS_PERF_SEL_SE0_SH1_GDS_BYTE_OP = 33,
+ GDS_PERF_SEL_SE0_SH1_GDS_SHORT_OP = 34,
+ GDS_PERF_SEL_SE1_SH0_NORET = 35,
+ GDS_PERF_SEL_SE1_SH0_RET = 36,
+ GDS_PERF_SEL_SE1_SH0_ORD_CNT = 37,
+ GDS_PERF_SEL_SE1_SH0_2COMP_REQ = 38,
+ GDS_PERF_SEL_SE1_SH0_ORD_WAVE_VALID = 39,
+ GDS_PERF_SEL_SE1_SH0_GDS_DATA_VALID = 40,
+ GDS_PERF_SEL_SE1_SH0_GDS_STALL_BY_ORD = 41,
+ GDS_PERF_SEL_SE1_SH0_GDS_WR_OP = 42,
+ GDS_PERF_SEL_SE1_SH0_GDS_RD_OP = 43,
+ GDS_PERF_SEL_SE1_SH0_GDS_ATOM_OP = 44,
+ GDS_PERF_SEL_SE1_SH0_GDS_REL_OP = 45,
+ GDS_PERF_SEL_SE1_SH0_GDS_CMPXCH_OP = 46,
+ GDS_PERF_SEL_SE1_SH0_GDS_BYTE_OP = 47,
+ GDS_PERF_SEL_SE1_SH0_GDS_SHORT_OP = 48,
+ GDS_PERF_SEL_SE1_SH1_NORET = 49,
+ GDS_PERF_SEL_SE1_SH1_RET = 50,
+ GDS_PERF_SEL_SE1_SH1_ORD_CNT = 51,
+ GDS_PERF_SEL_SE1_SH1_2COMP_REQ = 52,
+ GDS_PERF_SEL_SE1_SH1_ORD_WAVE_VALID = 53,
+ GDS_PERF_SEL_SE1_SH1_GDS_DATA_VALID = 54,
+ GDS_PERF_SEL_SE1_SH1_GDS_STALL_BY_ORD = 55,
+ GDS_PERF_SEL_SE1_SH1_GDS_WR_OP = 56,
+ GDS_PERF_SEL_SE1_SH1_GDS_RD_OP = 57,
+ GDS_PERF_SEL_SE1_SH1_GDS_ATOM_OP = 58,
+ GDS_PERF_SEL_SE1_SH1_GDS_REL_OP = 59,
+ GDS_PERF_SEL_SE1_SH1_GDS_CMPXCH_OP = 60,
+ GDS_PERF_SEL_SE1_SH1_GDS_BYTE_OP = 61,
+ GDS_PERF_SEL_SE1_SH1_GDS_SHORT_OP = 62,
+ GDS_PERF_SEL_SE2_SH0_NORET = 63,
+ GDS_PERF_SEL_SE2_SH0_RET = 64,
+ GDS_PERF_SEL_SE2_SH0_ORD_CNT = 65,
+ GDS_PERF_SEL_SE2_SH0_2COMP_REQ = 66,
+ GDS_PERF_SEL_SE2_SH0_ORD_WAVE_VALID = 67,
+ GDS_PERF_SEL_SE2_SH0_GDS_DATA_VALID = 68,
+ GDS_PERF_SEL_SE2_SH0_GDS_STALL_BY_ORD = 69,
+ GDS_PERF_SEL_SE2_SH0_GDS_WR_OP = 70,
+ GDS_PERF_SEL_SE2_SH0_GDS_RD_OP = 71,
+ GDS_PERF_SEL_SE2_SH0_GDS_ATOM_OP = 72,
+ GDS_PERF_SEL_SE2_SH0_GDS_REL_OP = 73,
+ GDS_PERF_SEL_SE2_SH0_GDS_CMPXCH_OP = 74,
+ GDS_PERF_SEL_SE2_SH0_GDS_BYTE_OP = 75,
+ GDS_PERF_SEL_SE2_SH0_GDS_SHORT_OP = 76,
+ GDS_PERF_SEL_SE2_SH1_NORET = 77,
+ GDS_PERF_SEL_SE2_SH1_RET = 78,
+ GDS_PERF_SEL_SE2_SH1_ORD_CNT = 79,
+ GDS_PERF_SEL_SE2_SH1_2COMP_REQ = 80,
+ GDS_PERF_SEL_SE2_SH1_ORD_WAVE_VALID = 81,
+ GDS_PERF_SEL_SE2_SH1_GDS_DATA_VALID = 82,
+ GDS_PERF_SEL_SE2_SH1_GDS_STALL_BY_ORD = 83,
+ GDS_PERF_SEL_SE2_SH1_GDS_WR_OP = 84,
+ GDS_PERF_SEL_SE2_SH1_GDS_RD_OP = 85,
+ GDS_PERF_SEL_SE2_SH1_GDS_ATOM_OP = 86,
+ GDS_PERF_SEL_SE2_SH1_GDS_REL_OP = 87,
+ GDS_PERF_SEL_SE2_SH1_GDS_CMPXCH_OP = 88,
+ GDS_PERF_SEL_SE2_SH1_GDS_BYTE_OP = 89,
+ GDS_PERF_SEL_SE2_SH1_GDS_SHORT_OP = 90,
+ GDS_PERF_SEL_SE3_SH0_NORET = 91,
+ GDS_PERF_SEL_SE3_SH0_RET = 92,
+ GDS_PERF_SEL_SE3_SH0_ORD_CNT = 93,
+ GDS_PERF_SEL_SE3_SH0_2COMP_REQ = 94,
+ GDS_PERF_SEL_SE3_SH0_ORD_WAVE_VALID = 95,
+ GDS_PERF_SEL_SE3_SH0_GDS_DATA_VALID = 96,
+ GDS_PERF_SEL_SE3_SH0_GDS_STALL_BY_ORD = 97,
+ GDS_PERF_SEL_SE3_SH0_GDS_WR_OP = 98,
+ GDS_PERF_SEL_SE3_SH0_GDS_RD_OP = 99,
+ GDS_PERF_SEL_SE3_SH0_GDS_ATOM_OP = 100,
+ GDS_PERF_SEL_SE3_SH0_GDS_REL_OP = 101,
+ GDS_PERF_SEL_SE3_SH0_GDS_CMPXCH_OP = 102,
+ GDS_PERF_SEL_SE3_SH0_GDS_BYTE_OP = 103,
+ GDS_PERF_SEL_SE3_SH0_GDS_SHORT_OP = 104,
+ GDS_PERF_SEL_SE3_SH1_NORET = 105,
+ GDS_PERF_SEL_SE3_SH1_RET = 106,
+ GDS_PERF_SEL_SE3_SH1_ORD_CNT = 107,
+ GDS_PERF_SEL_SE3_SH1_2COMP_REQ = 108,
+ GDS_PERF_SEL_SE3_SH1_ORD_WAVE_VALID = 109,
+ GDS_PERF_SEL_SE3_SH1_GDS_DATA_VALID = 110,
+ GDS_PERF_SEL_SE3_SH1_GDS_STALL_BY_ORD = 111,
+ GDS_PERF_SEL_SE3_SH1_GDS_WR_OP = 112,
+ GDS_PERF_SEL_SE3_SH1_GDS_RD_OP = 113,
+ GDS_PERF_SEL_SE3_SH1_GDS_ATOM_OP = 114,
+ GDS_PERF_SEL_SE3_SH1_GDS_REL_OP = 115,
+ GDS_PERF_SEL_SE3_SH1_GDS_CMPXCH_OP = 116,
+ GDS_PERF_SEL_SE3_SH1_GDS_BYTE_OP = 117,
+ GDS_PERF_SEL_SE3_SH1_GDS_SHORT_OP = 118,
+ GDS_PERF_SEL_GWS_RELEASED = 119,
+ GDS_PERF_SEL_GWS_BYPASS = 120,
+} GDS_PERFCOUNT_SELECT;
+#endif /*ENUMS_GDS_PERFCOUNT_SELECT_H*/
+
+/*******************************************************
+ * Chip Enums
+ *******************************************************/
+
+/*
+ * SurfaceEndian enum
+ */
+
+typedef enum SurfaceEndian {
+ENDIAN_NONE                              = 0x00000000,
+ENDIAN_8IN16                             = 0x00000001,
+ENDIAN_8IN32                             = 0x00000002,
+ENDIAN_8IN64                             = 0x00000003,
+} SurfaceEndian;
+
+/*
+ * ArrayMode enum
+ */
+
+typedef enum ArrayMode {
+ARRAY_LINEAR_GENERAL                     = 0x00000000,
+ARRAY_LINEAR_ALIGNED                     = 0x00000001,
+ARRAY_1D_TILED_THIN1                     = 0x00000002,
+ARRAY_1D_TILED_THICK                     = 0x00000003,
+ARRAY_2D_TILED_THIN1                     = 0x00000004,
+ARRAY_PRT_TILED_THIN1                    = 0x00000005,
+ARRAY_PRT_2D_TILED_THIN1                 = 0x00000006,
+ARRAY_2D_TILED_THICK                     = 0x00000007,
+ARRAY_2D_TILED_XTHICK                    = 0x00000008,
+ARRAY_PRT_TILED_THICK                    = 0x00000009,
+ARRAY_PRT_2D_TILED_THICK                 = 0x0000000a,
+ARRAY_PRT_3D_TILED_THIN1                 = 0x0000000b,
+ARRAY_3D_TILED_THIN1                     = 0x0000000c,
+ARRAY_3D_TILED_THICK                     = 0x0000000d,
+ARRAY_3D_TILED_XTHICK                    = 0x0000000e,
+ARRAY_PRT_3D_TILED_THICK                 = 0x0000000f,
+} ArrayMode;
+
+/*
+ * PipeTiling enum
+ */
+
+typedef enum PipeTiling {
+CONFIG_1_PIPE                            = 0x00000000,
+CONFIG_2_PIPE                            = 0x00000001,
+CONFIG_4_PIPE                            = 0x00000002,
+CONFIG_8_PIPE                            = 0x00000003,
+} PipeTiling;
+
+/*
+ * BankTiling enum
+ */
+
+typedef enum BankTiling {
+CONFIG_4_BANK                            = 0x00000000,
+CONFIG_8_BANK                            = 0x00000001,
+} BankTiling;
+
+/*
+ * GroupInterleave enum
+ */
+
+typedef enum GroupInterleave {
+CONFIG_256B_GROUP                        = 0x00000000,
+CONFIG_512B_GROUP                        = 0x00000001,
+} GroupInterleave;
+
+/*
+ * RowTiling enum
+ */
+
+typedef enum RowTiling {
+CONFIG_1KB_ROW                           = 0x00000000,
+CONFIG_2KB_ROW                           = 0x00000001,
+CONFIG_4KB_ROW                           = 0x00000002,
+CONFIG_8KB_ROW                           = 0x00000003,
+CONFIG_1KB_ROW_OPT                       = 0x00000004,
+CONFIG_2KB_ROW_OPT                       = 0x00000005,
+CONFIG_4KB_ROW_OPT                       = 0x00000006,
+CONFIG_8KB_ROW_OPT                       = 0x00000007,
+} RowTiling;
+
+/*
+ * BankSwapBytes enum
+ */
+
+typedef enum BankSwapBytes {
+CONFIG_128B_SWAPS                        = 0x00000000,
+CONFIG_256B_SWAPS                        = 0x00000001,
+CONFIG_512B_SWAPS                        = 0x00000002,
+CONFIG_1KB_SWAPS                         = 0x00000003,
+} BankSwapBytes;
+
+/*
+ * SampleSplitBytes enum
+ */
+
+typedef enum SampleSplitBytes {
+CONFIG_1KB_SPLIT                         = 0x00000000,
+CONFIG_2KB_SPLIT                         = 0x00000001,
+CONFIG_4KB_SPLIT                         = 0x00000002,
+CONFIG_8KB_SPLIT                         = 0x00000003,
+} SampleSplitBytes;
+
+/*
+ * NumPipes enum
+ */
+
+typedef enum NumPipes {
+ADDR_CONFIG_1_PIPE                       = 0x00000000,
+ADDR_CONFIG_2_PIPE                       = 0x00000001,
+ADDR_CONFIG_4_PIPE                       = 0x00000002,
+ADDR_CONFIG_8_PIPE                       = 0x00000003,
+ADDR_CONFIG_16_PIPE                      = 0x00000004,
+ADDR_CONFIG_32_PIPE                      = 0x00000005,
+} NumPipes;
+
+/*
+ * NumBanksConfig enum
+ */
+
+typedef enum NumBanksConfig {
+ADDR_CONFIG_1_BANK                       = 0x00000000,
+ADDR_CONFIG_2_BANK                       = 0x00000001,
+ADDR_CONFIG_4_BANK                       = 0x00000002,
+ADDR_CONFIG_8_BANK                       = 0x00000003,
+ADDR_CONFIG_16_BANK                      = 0x00000004,
+} NumBanksConfig;
+
+/*
+ * PipeInterleaveSize enum
+ */
+
+typedef enum PipeInterleaveSize {
+ADDR_CONFIG_PIPE_INTERLEAVE_256B         = 0x00000000,
+ADDR_CONFIG_PIPE_INTERLEAVE_512B         = 0x00000001,
+ADDR_CONFIG_PIPE_INTERLEAVE_1KB          = 0x00000002,
+ADDR_CONFIG_PIPE_INTERLEAVE_2KB          = 0x00000003,
+} PipeInterleaveSize;
+
+/*
+ * BankInterleaveSize enum
+ */
+
+typedef enum BankInterleaveSize {
+ADDR_CONFIG_BANK_INTERLEAVE_1            = 0x00000000,
+ADDR_CONFIG_BANK_INTERLEAVE_2            = 0x00000001,
+ADDR_CONFIG_BANK_INTERLEAVE_4            = 0x00000002,
+ADDR_CONFIG_BANK_INTERLEAVE_8            = 0x00000003,
+} BankInterleaveSize;
+
+/*
+ * NumShaderEngines enum
+ */
+
+typedef enum NumShaderEngines {
+ADDR_CONFIG_1_SHADER_ENGINE              = 0x00000000,
+ADDR_CONFIG_2_SHADER_ENGINE              = 0x00000001,
+ADDR_CONFIG_4_SHADER_ENGINE              = 0x00000002,
+ADDR_CONFIG_8_SHADER_ENGINE              = 0x00000003,
+} NumShaderEngines;
+
+/*
+ * NumRbPerShaderEngine enum
+ */
+
+typedef enum NumRbPerShaderEngine {
+ADDR_CONFIG_1_RB_PER_SHADER_ENGINE       = 0x00000000,
+ADDR_CONFIG_2_RB_PER_SHADER_ENGINE       = 0x00000001,
+ADDR_CONFIG_4_RB_PER_SHADER_ENGINE       = 0x00000002,
+} NumRbPerShaderEngine;
+
+/*
+ * NumGPUs enum
+ */
+
+typedef enum NumGPUs {
+ADDR_CONFIG_1_GPU                        = 0x00000000,
+ADDR_CONFIG_2_GPU                        = 0x00000001,
+ADDR_CONFIG_4_GPU                        = 0x00000002,
+ADDR_CONFIG_8_GPU                        = 0x00000003,
+} NumGPUs;
+
+/*
+ * NumMaxCompressedFragments enum
+ */
+
+typedef enum NumMaxCompressedFragments {
+ADDR_CONFIG_1_MAX_COMPRESSED_FRAGMENTS   = 0x00000000,
+ADDR_CONFIG_2_MAX_COMPRESSED_FRAGMENTS   = 0x00000001,
+ADDR_CONFIG_4_MAX_COMPRESSED_FRAGMENTS   = 0x00000002,
+ADDR_CONFIG_8_MAX_COMPRESSED_FRAGMENTS   = 0x00000003,
+} NumMaxCompressedFragments;
+
+/*
+ * ShaderEngineTileSize enum
+ */
+
+typedef enum ShaderEngineTileSize {
+ADDR_CONFIG_SE_TILE_16                   = 0x00000000,
+ADDR_CONFIG_SE_TILE_32                   = 0x00000001,
+} ShaderEngineTileSize;
+
+/*
+ * MultiGPUTileSize enum
+ */
+
+typedef enum MultiGPUTileSize {
+ADDR_CONFIG_GPU_TILE_16                  = 0x00000000,
+ADDR_CONFIG_GPU_TILE_32                  = 0x00000001,
+ADDR_CONFIG_GPU_TILE_64                  = 0x00000002,
+ADDR_CONFIG_GPU_TILE_128                 = 0x00000003,
+} MultiGPUTileSize;
+
+/*
+ * RowSize enum
+ */
+
+typedef enum RowSize {
+ADDR_CONFIG_1KB_ROW                      = 0x00000000,
+ADDR_CONFIG_2KB_ROW                      = 0x00000001,
+ADDR_CONFIG_4KB_ROW                      = 0x00000002,
+} RowSize;
+
+/*
+ * NumLowerPipes enum
+ */
+
+typedef enum NumLowerPipes {
+ADDR_CONFIG_1_LOWER_PIPES                = 0x00000000,
+ADDR_CONFIG_2_LOWER_PIPES                = 0x00000001,
+} NumLowerPipes;
+
+/*
+ * ColorTransform enum
+ */
+
+typedef enum ColorTransform {
+DCC_CT_AUTO                              = 0x00000000,
+DCC_CT_NONE                              = 0x00000001,
+ABGR_TO_A_BG_G_RB                        = 0x00000002,
+BGRA_TO_BG_G_RB_A                        = 0x00000003,
+} ColorTransform;
+
+/*
+ * CompareRef enum
+ */
+
+typedef enum CompareRef {
+REF_NEVER                                = 0x00000000,
+REF_LESS                                 = 0x00000001,
+REF_EQUAL                                = 0x00000002,
+REF_LEQUAL                               = 0x00000003,
+REF_GREATER                              = 0x00000004,
+REF_NOTEQUAL                             = 0x00000005,
+REF_GEQUAL                               = 0x00000006,
+REF_ALWAYS                               = 0x00000007,
+} CompareRef;
+
+/*
+ * ReadSize enum
+ */
+
+typedef enum ReadSize {
+READ_256_BITS                            = 0x00000000,
+READ_512_BITS                            = 0x00000001,
+} ReadSize;
+
+/*
+ * DepthFormat enum
+ */
+
+typedef enum DepthFormat {
+DEPTH_INVALID                            = 0x00000000,
+DEPTH_16                                 = 0x00000001,
+DEPTH_X8_24                              = 0x00000002,
+DEPTH_8_24                               = 0x00000003,
+DEPTH_X8_24_FLOAT                        = 0x00000004,
+DEPTH_8_24_FLOAT                         = 0x00000005,
+DEPTH_32_FLOAT                           = 0x00000006,
+DEPTH_X24_8_32_FLOAT                     = 0x00000007,
+} DepthFormat;
+
+/*
+ * ZFormat enum
+ */
+
+typedef enum ZFormat {
+Z_INVALID                                = 0x00000000,
+Z_16                                     = 0x00000001,
+Z_24                                     = 0x00000002,
+Z_32_FLOAT                               = 0x00000003,
+} ZFormat;
+
+/*
+ * StencilFormat enum
+ */
+
+typedef enum StencilFormat {
+STENCIL_INVALID                          = 0x00000000,
+STENCIL_8                                = 0x00000001,
+} StencilFormat;
+
+/*
+ * CmaskMode enum
+ */
+
+typedef enum CmaskMode {
+CMASK_CLEAR_NONE                         = 0x00000000,
+CMASK_CLEAR_ONE                          = 0x00000001,
+CMASK_CLEAR_ALL                          = 0x00000002,
+CMASK_ANY_EXPANDED                       = 0x00000003,
+CMASK_ALPHA0_FRAG1                       = 0x00000004,
+CMASK_ALPHA0_FRAG2                       = 0x00000005,
+CMASK_ALPHA0_FRAG4                       = 0x00000006,
+CMASK_ALPHA0_FRAGS                       = 0x00000007,
+CMASK_ALPHA1_FRAG1                       = 0x00000008,
+CMASK_ALPHA1_FRAG2                       = 0x00000009,
+CMASK_ALPHA1_FRAG4                       = 0x0000000a,
+CMASK_ALPHA1_FRAGS                       = 0x0000000b,
+CMASK_ALPHAX_FRAG1                       = 0x0000000c,
+CMASK_ALPHAX_FRAG2                       = 0x0000000d,
+CMASK_ALPHAX_FRAG4                       = 0x0000000e,
+CMASK_ALPHAX_FRAGS                       = 0x0000000f,
+} CmaskMode;
+
+/*
+ * QuadExportFormat enum
+ */
+
+typedef enum QuadExportFormat {
+EXPORT_UNUSED                            = 0x00000000,
+EXPORT_32_R                              = 0x00000001,
+EXPORT_32_GR                             = 0x00000002,
+EXPORT_32_AR                             = 0x00000003,
+EXPORT_FP16_ABGR                         = 0x00000004,
+EXPORT_UNSIGNED16_ABGR                   = 0x00000005,
+EXPORT_SIGNED16_ABGR                     = 0x00000006,
+EXPORT_32_ABGR                           = 0x00000007,
+EXPORT_32BPP_8PIX                        = 0x00000008,
+EXPORT_16_16_UNSIGNED_8PIX               = 0x00000009,
+EXPORT_16_16_SIGNED_8PIX                 = 0x0000000a,
+EXPORT_16_16_FLOAT_8PIX                  = 0x0000000b,
+} QuadExportFormat;
+
+/*
+ * QuadExportFormatOld enum
+ */
+
+typedef enum QuadExportFormatOld {
+EXPORT_4P_32BPC_ABGR                     = 0x00000000,
+EXPORT_4P_16BPC_ABGR                     = 0x00000001,
+EXPORT_4P_32BPC_GR                       = 0x00000002,
+EXPORT_4P_32BPC_AR                       = 0x00000003,
+EXPORT_2P_32BPC_ABGR                     = 0x00000004,
+EXPORT_8P_32BPC_R                        = 0x00000005,
+} QuadExportFormatOld;
+
+/*
+ * ColorFormat enum
+ */
+
+typedef enum ColorFormat {
+COLOR_INVALID                            = 0x00000000,
+COLOR_8                                  = 0x00000001,
+COLOR_16                                 = 0x00000002,
+COLOR_8_8                                = 0x00000003,
+COLOR_32                                 = 0x00000004,
+COLOR_16_16                              = 0x00000005,
+COLOR_10_11_11                           = 0x00000006,
+COLOR_11_11_10                           = 0x00000007,
+COLOR_10_10_10_2                         = 0x00000008,
+COLOR_2_10_10_10                         = 0x00000009,
+COLOR_8_8_8_8                            = 0x0000000a,
+COLOR_32_32                              = 0x0000000b,
+COLOR_16_16_16_16                        = 0x0000000c,
+COLOR_RESERVED_13                        = 0x0000000d,
+COLOR_32_32_32_32                        = 0x0000000e,
+COLOR_RESERVED_15                        = 0x0000000f,
+COLOR_5_6_5                              = 0x00000010,
+COLOR_1_5_5_5                            = 0x00000011,
+COLOR_5_5_5_1                            = 0x00000012,
+COLOR_4_4_4_4                            = 0x00000013,
+COLOR_8_24                               = 0x00000014,
+COLOR_24_8                               = 0x00000015,
+COLOR_X24_8_32_FLOAT                     = 0x00000016,
+COLOR_RESERVED_23                        = 0x00000017,
+COLOR_RESERVED_24                        = 0x00000018,
+COLOR_RESERVED_25                        = 0x00000019,
+COLOR_RESERVED_26                        = 0x0000001a,
+COLOR_RESERVED_27                        = 0x0000001b,
+COLOR_RESERVED_28                        = 0x0000001c,
+COLOR_RESERVED_29                        = 0x0000001d,
+COLOR_RESERVED_30                        = 0x0000001e,
+COLOR_2_10_10_10_6E4                     = 0x0000001f,
+} ColorFormat;
+
+/*
+ * SurfaceFormat enum
+ */
+
+typedef enum SurfaceFormat {
+FMT_INVALID                              = 0x00000000,
+FMT_8                                    = 0x00000001,
+FMT_16                                   = 0x00000002,
+FMT_8_8                                  = 0x00000003,
+FMT_32                                   = 0x00000004,
+FMT_16_16                                = 0x00000005,
+FMT_10_11_11                             = 0x00000006,
+FMT_11_11_10                             = 0x00000007,
+FMT_10_10_10_2                           = 0x00000008,
+FMT_2_10_10_10                           = 0x00000009,
+FMT_8_8_8_8                              = 0x0000000a,
+FMT_32_32                                = 0x0000000b,
+FMT_16_16_16_16                          = 0x0000000c,
+FMT_32_32_32                             = 0x0000000d,
+FMT_32_32_32_32                          = 0x0000000e,
+FMT_RESERVED_4                           = 0x0000000f,
+FMT_5_6_5                                = 0x00000010,
+FMT_1_5_5_5                              = 0x00000011,
+FMT_5_5_5_1                              = 0x00000012,
+FMT_4_4_4_4                              = 0x00000013,
+FMT_8_24                                 = 0x00000014,
+FMT_24_8                                 = 0x00000015,
+FMT_X24_8_32_FLOAT                       = 0x00000016,
+FMT_RESERVED_33                          = 0x00000017,
+FMT_11_11_10_FLOAT                       = 0x00000018,
+FMT_16_FLOAT                             = 0x00000019,
+FMT_32_FLOAT                             = 0x0000001a,
+FMT_16_16_FLOAT                          = 0x0000001b,
+FMT_8_24_FLOAT                           = 0x0000001c,
+FMT_24_8_FLOAT                           = 0x0000001d,
+FMT_32_32_FLOAT                          = 0x0000001e,
+FMT_10_11_11_FLOAT                       = 0x0000001f,
+FMT_16_16_16_16_FLOAT                    = 0x00000020,
+FMT_3_3_2                                = 0x00000021,
+FMT_6_5_5                                = 0x00000022,
+FMT_32_32_32_32_FLOAT                    = 0x00000023,
+FMT_RESERVED_36                          = 0x00000024,
+FMT_1                                    = 0x00000025,
+FMT_1_REVERSED                           = 0x00000026,
+FMT_GB_GR                                = 0x00000027,
+FMT_BG_RG                                = 0x00000028,
+FMT_32_AS_8                              = 0x00000029,
+FMT_32_AS_8_8                            = 0x0000002a,
+FMT_5_9_9_9_SHAREDEXP                    = 0x0000002b,
+FMT_8_8_8                                = 0x0000002c,
+FMT_16_16_16                             = 0x0000002d,
+FMT_16_16_16_FLOAT                       = 0x0000002e,
+FMT_4_4                                  = 0x0000002f,
+FMT_32_32_32_FLOAT                       = 0x00000030,
+FMT_BC1                                  = 0x00000031,
+FMT_BC2                                  = 0x00000032,
+FMT_BC3                                  = 0x00000033,
+FMT_BC4                                  = 0x00000034,
+FMT_BC5                                  = 0x00000035,
+FMT_BC6                                  = 0x00000036,
+FMT_BC7                                  = 0x00000037,
+FMT_32_AS_32_32_32_32                    = 0x00000038,
+FMT_APC3                                 = 0x00000039,
+FMT_APC4                                 = 0x0000003a,
+FMT_APC5                                 = 0x0000003b,
+FMT_APC6                                 = 0x0000003c,
+FMT_APC7                                 = 0x0000003d,
+FMT_CTX1                                 = 0x0000003e,
+FMT_RESERVED_63                          = 0x0000003f,
+} SurfaceFormat;
+
+/*
+ * BUF_DATA_FORMAT enum
+ */
+
+typedef enum BUF_DATA_FORMAT {
+BUF_DATA_FORMAT_INVALID                  = 0x00000000,
+BUF_DATA_FORMAT_8                        = 0x00000001,
+BUF_DATA_FORMAT_16                       = 0x00000002,
+BUF_DATA_FORMAT_8_8                      = 0x00000003,
+BUF_DATA_FORMAT_32                       = 0x00000004,
+BUF_DATA_FORMAT_16_16                    = 0x00000005,
+BUF_DATA_FORMAT_10_11_11                 = 0x00000006,
+BUF_DATA_FORMAT_11_11_10                 = 0x00000007,
+BUF_DATA_FORMAT_10_10_10_2               = 0x00000008,
+BUF_DATA_FORMAT_2_10_10_10               = 0x00000009,
+BUF_DATA_FORMAT_8_8_8_8                  = 0x0000000a,
+BUF_DATA_FORMAT_32_32                    = 0x0000000b,
+BUF_DATA_FORMAT_16_16_16_16              = 0x0000000c,
+BUF_DATA_FORMAT_32_32_32                 = 0x0000000d,
+BUF_DATA_FORMAT_32_32_32_32              = 0x0000000e,
+BUF_DATA_FORMAT_RESERVED_15              = 0x0000000f,
+} BUF_DATA_FORMAT;
+
+/*
+ * IMG_DATA_FORMAT enum
+ */
+
+typedef enum IMG_DATA_FORMAT {
+IMG_DATA_FORMAT_INVALID                  = 0x00000000,
+IMG_DATA_FORMAT_8                        = 0x00000001,
+IMG_DATA_FORMAT_16                       = 0x00000002,
+IMG_DATA_FORMAT_8_8                      = 0x00000003,
+IMG_DATA_FORMAT_32                       = 0x00000004,
+IMG_DATA_FORMAT_16_16                    = 0x00000005,
+IMG_DATA_FORMAT_10_11_11                 = 0x00000006,
+IMG_DATA_FORMAT_11_11_10                 = 0x00000007,
+IMG_DATA_FORMAT_10_10_10_2               = 0x00000008,
+IMG_DATA_FORMAT_2_10_10_10               = 0x00000009,
+IMG_DATA_FORMAT_8_8_8_8                  = 0x0000000a,
+IMG_DATA_FORMAT_32_32                    = 0x0000000b,
+IMG_DATA_FORMAT_16_16_16_16              = 0x0000000c,
+IMG_DATA_FORMAT_32_32_32                 = 0x0000000d,
+IMG_DATA_FORMAT_32_32_32_32              = 0x0000000e,
+IMG_DATA_FORMAT_RESERVED_15              = 0x0000000f,
+IMG_DATA_FORMAT_5_6_5                    = 0x00000010,
+IMG_DATA_FORMAT_1_5_5_5                  = 0x00000011,
+IMG_DATA_FORMAT_5_5_5_1                  = 0x00000012,
+IMG_DATA_FORMAT_4_4_4_4                  = 0x00000013,
+IMG_DATA_FORMAT_8_24                     = 0x00000014,
+IMG_DATA_FORMAT_24_8                     = 0x00000015,
+IMG_DATA_FORMAT_X24_8_32                 = 0x00000016,
+IMG_DATA_FORMAT_8_AS_8_8_8_8             = 0x00000017,
+IMG_DATA_FORMAT_ETC2_RGB                 = 0x00000018,
+IMG_DATA_FORMAT_ETC2_RGBA                = 0x00000019,
+IMG_DATA_FORMAT_ETC2_R                   = 0x0000001a,
+IMG_DATA_FORMAT_ETC2_RG                  = 0x0000001b,
+IMG_DATA_FORMAT_ETC2_RGBA1               = 0x0000001c,
+IMG_DATA_FORMAT_RESERVED_29              = 0x0000001d,
+IMG_DATA_FORMAT_RESERVED_30              = 0x0000001e,
+IMG_DATA_FORMAT_6E4                      = 0x0000001f,
+IMG_DATA_FORMAT_GB_GR                    = 0x00000020,
+IMG_DATA_FORMAT_BG_RG                    = 0x00000021,
+IMG_DATA_FORMAT_5_9_9_9                  = 0x00000022,
+IMG_DATA_FORMAT_BC1                      = 0x00000023,
+IMG_DATA_FORMAT_BC2                      = 0x00000024,
+IMG_DATA_FORMAT_BC3                      = 0x00000025,
+IMG_DATA_FORMAT_BC4                      = 0x00000026,
+IMG_DATA_FORMAT_BC5                      = 0x00000027,
+IMG_DATA_FORMAT_BC6                      = 0x00000028,
+IMG_DATA_FORMAT_BC7                      = 0x00000029,
+IMG_DATA_FORMAT_16_AS_32_32              = 0x0000002a,
+IMG_DATA_FORMAT_16_AS_16_16_16_16        = 0x0000002b,
+IMG_DATA_FORMAT_16_AS_32_32_32_32        = 0x0000002c,
+IMG_DATA_FORMAT_FMASK                    = 0x0000002d,
+IMG_DATA_FORMAT_ASTC_2D_LDR              = 0x0000002e,
+IMG_DATA_FORMAT_ASTC_2D_HDR              = 0x0000002f,
+IMG_DATA_FORMAT_ASTC_2D_LDR_SRGB         = 0x00000030,
+IMG_DATA_FORMAT_ASTC_3D_LDR              = 0x00000031,
+IMG_DATA_FORMAT_ASTC_3D_HDR              = 0x00000032,
+IMG_DATA_FORMAT_ASTC_3D_LDR_SRGB         = 0x00000033,
+IMG_DATA_FORMAT_N_IN_16                  = 0x00000034,
+IMG_DATA_FORMAT_N_IN_16_16               = 0x00000035,
+IMG_DATA_FORMAT_N_IN_16_16_16_16         = 0x00000036,
+IMG_DATA_FORMAT_N_IN_16_AS_16_16_16_16   = 0x00000037,
+IMG_DATA_FORMAT_RESERVED_56              = 0x00000038,
+IMG_DATA_FORMAT_4_4                      = 0x00000039,
+IMG_DATA_FORMAT_6_5_5                    = 0x0000003a,
+IMG_DATA_FORMAT_RESERVED_59              = 0x0000003b,
+IMG_DATA_FORMAT_RESERVED_60              = 0x0000003c,
+IMG_DATA_FORMAT_8_AS_32                  = 0x0000003d,
+IMG_DATA_FORMAT_8_AS_32_32               = 0x0000003e,
+IMG_DATA_FORMAT_32_AS_32_32_32_32        = 0x0000003f,
+} IMG_DATA_FORMAT;
+
+/*
+ * BUF_NUM_FORMAT enum
+ */
+
+typedef enum BUF_NUM_FORMAT {
+BUF_NUM_FORMAT_UNORM                     = 0x00000000,
+BUF_NUM_FORMAT_SNORM                     = 0x00000001,
+BUF_NUM_FORMAT_USCALED                   = 0x00000002,
+BUF_NUM_FORMAT_SSCALED                   = 0x00000003,
+BUF_NUM_FORMAT_UINT                      = 0x00000004,
+BUF_NUM_FORMAT_SINT                      = 0x00000005,
+BUF_NUM_FORMAT_UNORM_UINT                = 0x00000006,
+BUF_NUM_FORMAT_FLOAT                     = 0x00000007,
+} BUF_NUM_FORMAT;
+
+/*
+ * IMG_NUM_FORMAT enum
+ */
+
+typedef enum IMG_NUM_FORMAT {
+IMG_NUM_FORMAT_UNORM                     = 0x00000000,
+IMG_NUM_FORMAT_SNORM                     = 0x00000001,
+IMG_NUM_FORMAT_USCALED                   = 0x00000002,
+IMG_NUM_FORMAT_SSCALED                   = 0x00000003,
+IMG_NUM_FORMAT_UINT                      = 0x00000004,
+IMG_NUM_FORMAT_SINT                      = 0x00000005,
+IMG_NUM_FORMAT_UNORM_UINT                = 0x00000006,
+IMG_NUM_FORMAT_FLOAT                     = 0x00000007,
+IMG_NUM_FORMAT_RESERVED_8                = 0x00000008,
+IMG_NUM_FORMAT_SRGB                      = 0x00000009,
+IMG_NUM_FORMAT_RESERVED_10               = 0x0000000a,
+IMG_NUM_FORMAT_RESERVED_11               = 0x0000000b,
+IMG_NUM_FORMAT_RESERVED_12               = 0x0000000c,
+IMG_NUM_FORMAT_RESERVED_13               = 0x0000000d,
+IMG_NUM_FORMAT_RESERVED_14               = 0x0000000e,
+IMG_NUM_FORMAT_RESERVED_15               = 0x0000000f,
+} IMG_NUM_FORMAT;
+
+/*
+ * IMG_NUM_FORMAT_FMASK enum
+ */
+
+typedef enum IMG_NUM_FORMAT_FMASK {
+IMG_NUM_FORMAT_FMASK_8_2_1               = 0x00000000,
+IMG_NUM_FORMAT_FMASK_8_4_1               = 0x00000001,
+IMG_NUM_FORMAT_FMASK_8_8_1               = 0x00000002,
+IMG_NUM_FORMAT_FMASK_8_2_2               = 0x00000003,
+IMG_NUM_FORMAT_FMASK_8_4_2               = 0x00000004,
+IMG_NUM_FORMAT_FMASK_8_4_4               = 0x00000005,
+IMG_NUM_FORMAT_FMASK_16_16_1             = 0x00000006,
+IMG_NUM_FORMAT_FMASK_16_8_2              = 0x00000007,
+IMG_NUM_FORMAT_FMASK_32_16_2             = 0x00000008,
+IMG_NUM_FORMAT_FMASK_32_8_4              = 0x00000009,
+IMG_NUM_FORMAT_FMASK_32_8_8              = 0x0000000a,
+IMG_NUM_FORMAT_FMASK_64_16_4             = 0x0000000b,
+IMG_NUM_FORMAT_FMASK_64_16_8             = 0x0000000c,
+IMG_NUM_FORMAT_FMASK_RESERVED_13         = 0x0000000d,
+IMG_NUM_FORMAT_FMASK_RESERVED_14         = 0x0000000e,
+IMG_NUM_FORMAT_FMASK_RESERVED_15         = 0x0000000f,
+} IMG_NUM_FORMAT_FMASK;
+
+/*
+ * IMG_NUM_FORMAT_N_IN_16 enum
+ */
+
+typedef enum IMG_NUM_FORMAT_N_IN_16 {
+IMG_NUM_FORMAT_N_IN_16_RESERVED_0        = 0x00000000,
+IMG_NUM_FORMAT_N_IN_16_UNORM_10          = 0x00000001,
+IMG_NUM_FORMAT_N_IN_16_UNORM_9           = 0x00000002,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_3        = 0x00000003,
+IMG_NUM_FORMAT_N_IN_16_UINT_10           = 0x00000004,
+IMG_NUM_FORMAT_N_IN_16_UINT_9            = 0x00000005,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_6        = 0x00000006,
+IMG_NUM_FORMAT_N_IN_16_UNORM_UINT_10     = 0x00000007,
+IMG_NUM_FORMAT_N_IN_16_UNORM_UINT_9      = 0x00000008,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_9        = 0x00000009,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_10       = 0x0000000a,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_11       = 0x0000000b,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_12       = 0x0000000c,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_13       = 0x0000000d,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_14       = 0x0000000e,
+IMG_NUM_FORMAT_N_IN_16_RESERVED_15       = 0x0000000f,
+} IMG_NUM_FORMAT_N_IN_16;
+
+/*
+ * IMG_NUM_FORMAT_ASTC_2D enum
+ */
+
+typedef enum IMG_NUM_FORMAT_ASTC_2D {
+IMG_NUM_FORMAT_ASTC_2D_4x4               = 0x00000000,
+IMG_NUM_FORMAT_ASTC_2D_5x4               = 0x00000001,
+IMG_NUM_FORMAT_ASTC_2D_5x5               = 0x00000002,
+IMG_NUM_FORMAT_ASTC_2D_6x5               = 0x00000003,
+IMG_NUM_FORMAT_ASTC_2D_6x6               = 0x00000004,
+IMG_NUM_FORMAT_ASTC_2D_8x5               = 0x00000005,
+IMG_NUM_FORMAT_ASTC_2D_8x6               = 0x00000006,
+IMG_NUM_FORMAT_ASTC_2D_8x8               = 0x00000007,
+IMG_NUM_FORMAT_ASTC_2D_10x5              = 0x00000008,
+IMG_NUM_FORMAT_ASTC_2D_10x6              = 0x00000009,
+IMG_NUM_FORMAT_ASTC_2D_10x8              = 0x0000000a,
+IMG_NUM_FORMAT_ASTC_2D_10x10             = 0x0000000b,
+IMG_NUM_FORMAT_ASTC_2D_12x10             = 0x0000000c,
+IMG_NUM_FORMAT_ASTC_2D_12x12             = 0x0000000d,
+IMG_NUM_FORMAT_ASTC_2D_RESERVED_14       = 0x0000000e,
+IMG_NUM_FORMAT_ASTC_2D_RESERVED_15       = 0x0000000f,
+} IMG_NUM_FORMAT_ASTC_2D;
+
+/*
+ * IMG_NUM_FORMAT_ASTC_3D enum
+ */
+
+typedef enum IMG_NUM_FORMAT_ASTC_3D {
+IMG_NUM_FORMAT_ASTC_3D_3x3x3             = 0x00000000,
+IMG_NUM_FORMAT_ASTC_3D_4x3x3             = 0x00000001,
+IMG_NUM_FORMAT_ASTC_3D_4x4x3             = 0x00000002,
+IMG_NUM_FORMAT_ASTC_3D_4x4x4             = 0x00000003,
+IMG_NUM_FORMAT_ASTC_3D_5x4x4             = 0x00000004,
+IMG_NUM_FORMAT_ASTC_3D_5x5x4             = 0x00000005,
+IMG_NUM_FORMAT_ASTC_3D_5x5x5             = 0x00000006,
+IMG_NUM_FORMAT_ASTC_3D_6x5x5             = 0x00000007,
+IMG_NUM_FORMAT_ASTC_3D_6x6x5             = 0x00000008,
+IMG_NUM_FORMAT_ASTC_3D_6x6x6             = 0x00000009,
+IMG_NUM_FORMAT_ASTC_3D_RESERVED_10       = 0x0000000a,
+IMG_NUM_FORMAT_ASTC_3D_RESERVED_11       = 0x0000000b,
+IMG_NUM_FORMAT_ASTC_3D_RESERVED_12       = 0x0000000c,
+IMG_NUM_FORMAT_ASTC_3D_RESERVED_13       = 0x0000000d,
+IMG_NUM_FORMAT_ASTC_3D_RESERVED_14       = 0x0000000e,
+IMG_NUM_FORMAT_ASTC_3D_RESERVED_15       = 0x0000000f,
+} IMG_NUM_FORMAT_ASTC_3D;
+
+/*
+ * TileType enum
+ */
+
+typedef enum TileType {
+ARRAY_COLOR_TILE                         = 0x00000000,
+ARRAY_DEPTH_TILE                         = 0x00000001,
+} TileType;
+
+/*
+ * NonDispTilingOrder enum
+ */
+
+typedef enum NonDispTilingOrder {
+ADDR_SURF_MICRO_TILING_DISPLAY           = 0x00000000,
+ADDR_SURF_MICRO_TILING_NON_DISPLAY       = 0x00000001,
+} NonDispTilingOrder;
+
+/*
+ * MicroTileMode enum
+ */
+
+typedef enum MicroTileMode {
+ADDR_SURF_DISPLAY_MICRO_TILING           = 0x00000000,
+ADDR_SURF_THIN_MICRO_TILING              = 0x00000001,
+ADDR_SURF_DEPTH_MICRO_TILING             = 0x00000002,
+ADDR_SURF_ROTATED_MICRO_TILING           = 0x00000003,
+ADDR_SURF_THICK_MICRO_TILING             = 0x00000004,
+} MicroTileMode;
+
+/*
+ * TileSplit enum
+ */
+
+typedef enum TileSplit {
+ADDR_SURF_TILE_SPLIT_64B                 = 0x00000000,
+ADDR_SURF_TILE_SPLIT_128B                = 0x00000001,
+ADDR_SURF_TILE_SPLIT_256B                = 0x00000002,
+ADDR_SURF_TILE_SPLIT_512B                = 0x00000003,
+ADDR_SURF_TILE_SPLIT_1KB                 = 0x00000004,
+ADDR_SURF_TILE_SPLIT_2KB                 = 0x00000005,
+ADDR_SURF_TILE_SPLIT_4KB                 = 0x00000006,
+} TileSplit;
+
+/*
+ * SampleSplit enum
+ */
+
+typedef enum SampleSplit {
+ADDR_SURF_SAMPLE_SPLIT_1                 = 0x00000000,
+ADDR_SURF_SAMPLE_SPLIT_2                 = 0x00000001,
+ADDR_SURF_SAMPLE_SPLIT_4                 = 0x00000002,
+ADDR_SURF_SAMPLE_SPLIT_8                 = 0x00000003,
+} SampleSplit;
+
+/*
+ * PipeConfig enum
+ */
+
+typedef enum PipeConfig {
+ADDR_SURF_P2                             = 0x00000000,
+ADDR_SURF_P2_RESERVED0                   = 0x00000001,
+ADDR_SURF_P2_RESERVED1                   = 0x00000002,
+ADDR_SURF_P2_RESERVED2                   = 0x00000003,
+ADDR_SURF_P4_8x16                        = 0x00000004,
+ADDR_SURF_P4_16x16                       = 0x00000005,
+ADDR_SURF_P4_16x32                       = 0x00000006,
+ADDR_SURF_P4_32x32                       = 0x00000007,
+ADDR_SURF_P8_16x16_8x16                  = 0x00000008,
+ADDR_SURF_P8_16x32_8x16                  = 0x00000009,
+ADDR_SURF_P8_32x32_8x16                  = 0x0000000a,
+ADDR_SURF_P8_16x32_16x16                 = 0x0000000b,
+ADDR_SURF_P8_32x32_16x16                 = 0x0000000c,
+ADDR_SURF_P8_32x32_16x32                 = 0x0000000d,
+ADDR_SURF_P8_32x64_32x32                 = 0x0000000e,
+ADDR_SURF_P8_RESERVED0                   = 0x0000000f,
+ADDR_SURF_P16_32x32_8x16                 = 0x00000010,
+ADDR_SURF_P16_32x32_16x16                = 0x00000011,
+} PipeConfig;
+
+/*
+ * SeEnable enum
+ */
+
+typedef enum SeEnable {
+ADDR_CONFIG_DISABLE_SE                   = 0x00000000,
+ADDR_CONFIG_ENABLE_SE                    = 0x00000001,
+} SeEnable;
+
+/*
+ * NumBanks enum
+ */
+
+typedef enum NumBanks {
+ADDR_SURF_2_BANK                         = 0x00000000,
+ADDR_SURF_4_BANK                         = 0x00000001,
+ADDR_SURF_8_BANK                         = 0x00000002,
+ADDR_SURF_16_BANK                        = 0x00000003,
+} NumBanks;
+
+/*
+ * BankWidth enum
+ */
+
+typedef enum BankWidth {
+ADDR_SURF_BANK_WIDTH_1                   = 0x00000000,
+ADDR_SURF_BANK_WIDTH_2                   = 0x00000001,
+ADDR_SURF_BANK_WIDTH_4                   = 0x00000002,
+ADDR_SURF_BANK_WIDTH_8                   = 0x00000003,
+} BankWidth;
+
+/*
+ * BankHeight enum
+ */
+
+typedef enum BankHeight {
+ADDR_SURF_BANK_HEIGHT_1                  = 0x00000000,
+ADDR_SURF_BANK_HEIGHT_2                  = 0x00000001,
+ADDR_SURF_BANK_HEIGHT_4                  = 0x00000002,
+ADDR_SURF_BANK_HEIGHT_8                  = 0x00000003,
+} BankHeight;
+
+/*
+ * BankWidthHeight enum
+ */
+
+typedef enum BankWidthHeight {
+ADDR_SURF_BANK_WH_1                      = 0x00000000,
+ADDR_SURF_BANK_WH_2                      = 0x00000001,
+ADDR_SURF_BANK_WH_4                      = 0x00000002,
+ADDR_SURF_BANK_WH_8                      = 0x00000003,
+} BankWidthHeight;
+
+/*
+ * MacroTileAspect enum
+ */
+
+typedef enum MacroTileAspect {
+ADDR_SURF_MACRO_ASPECT_1                 = 0x00000000,
+ADDR_SURF_MACRO_ASPECT_2                 = 0x00000001,
+ADDR_SURF_MACRO_ASPECT_4                 = 0x00000002,
+ADDR_SURF_MACRO_ASPECT_8                 = 0x00000003,
+} MacroTileAspect;
+
+/*
+ * GATCL1RequestType enum
+ */
+
+typedef enum GATCL1RequestType {
+GATCL1_TYPE_NORMAL                       = 0x00000000,
+GATCL1_TYPE_SHOOTDOWN                    = 0x00000001,
+GATCL1_TYPE_BYPASS                       = 0x00000002,
+} GATCL1RequestType;
+
+/*
+ * UTCL1RequestType enum
+ */
+
+typedef enum UTCL1RequestType {
+UTCL1_TYPE_NORMAL                        = 0x00000000,
+UTCL1_TYPE_SHOOTDOWN                     = 0x00000001,
+UTCL1_TYPE_BYPASS                        = 0x00000002,
+} UTCL1RequestType;
+
+/*
+ * UTCL1FaultType enum
+ */
+
+typedef enum UTCL1FaultType {
+UTCL1_XNACK_SUCCESS                      = 0x00000000,
+UTCL1_XNACK_RETRY                        = 0x00000001,
+UTCL1_XNACK_PRT                          = 0x00000002,
+UTCL1_XNACK_NO_RETRY                     = 0x00000003,
+} UTCL1FaultType;
+
+/*
+ * TCC_CACHE_POLICIES enum
+ */
+
+typedef enum TCC_CACHE_POLICIES {
+TCC_CACHE_POLICY_LRU                     = 0x00000000,
+TCC_CACHE_POLICY_STREAM                  = 0x00000001,
+} TCC_CACHE_POLICIES;
+
+/*
+ * MTYPE enum
+ */
+
+typedef enum MTYPE {
+MTYPE_NC                                 = 0x00000000,
+MTYPE_WC                                 = 0x00000001,
+MTYPE_CC                                 = 0x00000002,
+MTYPE_UC                                 = 0x00000003,
+} MTYPE;
+
+/*
+ * RMI_CID enum
+ */
+
+typedef enum RMI_CID {
+RMI_CID_CC                               = 0x00000000,
+RMI_CID_FC                               = 0x00000001,
+RMI_CID_CM                               = 0x00000002,
+RMI_CID_DC                               = 0x00000003,
+RMI_CID_Z                                = 0x00000004,
+RMI_CID_S                                = 0x00000005,
+RMI_CID_TILE                             = 0x00000006,
+RMI_CID_ZPCPSD                           = 0x00000007,
+} RMI_CID;
+
+/*
+ * PERFMON_COUNTER_MODE enum
+ */
+
+typedef enum PERFMON_COUNTER_MODE {
+PERFMON_COUNTER_MODE_ACCUM               = 0x00000000,
+PERFMON_COUNTER_MODE_ACTIVE_CYCLES       = 0x00000001,
+PERFMON_COUNTER_MODE_MAX                 = 0x00000002,
+PERFMON_COUNTER_MODE_DIRTY               = 0x00000003,
+PERFMON_COUNTER_MODE_SAMPLE              = 0x00000004,
+PERFMON_COUNTER_MODE_CYCLES_SINCE_FIRST_EVENT  = 0x00000005,
+PERFMON_COUNTER_MODE_CYCLES_SINCE_LAST_EVENT  = 0x00000006,
+PERFMON_COUNTER_MODE_CYCLES_GE_HI        = 0x00000007,
+PERFMON_COUNTER_MODE_CYCLES_EQ_HI        = 0x00000008,
+PERFMON_COUNTER_MODE_INACTIVE_CYCLES     = 0x00000009,
+PERFMON_COUNTER_MODE_RESERVED            = 0x0000000f,
+} PERFMON_COUNTER_MODE;
+
+/*
+ * PERFMON_SPM_MODE enum
+ */
+
+typedef enum PERFMON_SPM_MODE {
+PERFMON_SPM_MODE_OFF                     = 0x00000000,
+PERFMON_SPM_MODE_16BIT_CLAMP             = 0x00000001,
+PERFMON_SPM_MODE_16BIT_NO_CLAMP          = 0x00000002,
+PERFMON_SPM_MODE_32BIT_CLAMP             = 0x00000003,
+PERFMON_SPM_MODE_32BIT_NO_CLAMP          = 0x00000004,
+PERFMON_SPM_MODE_RESERVED_5              = 0x00000005,
+PERFMON_SPM_MODE_RESERVED_6              = 0x00000006,
+PERFMON_SPM_MODE_RESERVED_7              = 0x00000007,
+PERFMON_SPM_MODE_TEST_MODE_0             = 0x00000008,
+PERFMON_SPM_MODE_TEST_MODE_1             = 0x00000009,
+PERFMON_SPM_MODE_TEST_MODE_2             = 0x0000000a,
+} PERFMON_SPM_MODE;
+
+/*
+ * SurfaceTiling enum
+ */
+
+typedef enum SurfaceTiling {
+ARRAY_LINEAR                             = 0x00000000,
+ARRAY_TILED                              = 0x00000001,
+} SurfaceTiling;
+
+/*
+ * SurfaceArray enum
+ */
+
+typedef enum SurfaceArray {
+ARRAY_1D                                 = 0x00000000,
+ARRAY_2D                                 = 0x00000001,
+ARRAY_3D                                 = 0x00000002,
+ARRAY_3D_SLICE                           = 0x00000003,
+} SurfaceArray;
+
+/*
+ * ColorArray enum
+ */
+
+typedef enum ColorArray {
+ARRAY_2D_ALT_COLOR                       = 0x00000000,
+ARRAY_2D_COLOR                           = 0x00000001,
+ARRAY_3D_SLICE_COLOR                     = 0x00000003,
+} ColorArray;
+
+/*
+ * DepthArray enum
+ */
+
+typedef enum DepthArray {
+ARRAY_2D_ALT_DEPTH                       = 0x00000000,
+ARRAY_2D_DEPTH                           = 0x00000001,
+} DepthArray;
+
+/*
+ * ENUM_NUM_SIMD_PER_CU enum
+ */
+
+typedef enum ENUM_NUM_SIMD_PER_CU {
+NUM_SIMD_PER_CU                          = 0x00000004,
+} ENUM_NUM_SIMD_PER_CU;
+
+/*
+ * DSM_ENABLE_ERROR_INJECT enum
+ */
+
+typedef enum DSM_ENABLE_ERROR_INJECT {
+DSM_ENABLE_ERROR_INJECT_FED_IN           = 0x00000000,
+DSM_ENABLE_ERROR_INJECT_SINGLE           = 0x00000001,
+DSM_ENABLE_ERROR_INJECT_UNCORRECTABLE    = 0x00000002,
+DSM_ENABLE_ERROR_INJECT_UNCORRECTABLE_LIMITED  = 0x00000003,
+} DSM_ENABLE_ERROR_INJECT;
+
+/*
+ * DSM_SELECT_INJECT_DELAY enum
+ */
+
+typedef enum DSM_SELECT_INJECT_DELAY {
+DSM_SELECT_INJECT_DELAY_NO_DELAY         = 0x00000000,
+DSM_SELECT_INJECT_DELAY_DELAY_ERROR      = 0x00000001,
+} DSM_SELECT_INJECT_DELAY;
+
+/*
+ * DSM_DATA_SEL enum
+ */
+
+typedef enum DSM_DATA_SEL {
+DSM_DATA_SEL_DISABLE                     = 0x00000000,
+DSM_DATA_SEL_0                           = 0x00000001,
+DSM_DATA_SEL_1                           = 0x00000002,
+DSM_DATA_SEL_BOTH                        = 0x00000003,
+} DSM_DATA_SEL;
+
+/*
+ * DSM_SINGLE_WRITE enum
+ */
+
+typedef enum DSM_SINGLE_WRITE {
+DSM_SINGLE_WRITE_DIS                     = 0x00000000,
+DSM_SINGLE_WRITE_EN                      = 0x00000001,
+} DSM_SINGLE_WRITE;
+
+/*
+ * SWIZZLE_TYPE_ENUM enum
+ */
+
+typedef enum SWIZZLE_TYPE_ENUM {
+SW_Z                                     = 0x00000000,
+SW_S                                     = 0x00000001,
+SW_D                                     = 0x00000002,
+SW_R                                     = 0x00000003,
+SW_L                                     = 0x00000004,
+} SWIZZLE_TYPE_ENUM;
+
+/*
+ * TC_MICRO_TILE_MODE enum
+ */
+
+typedef enum TC_MICRO_TILE_MODE {
+MICRO_TILE_MODE_LINEAR                   = 0x00000000,
+MICRO_TILE_MODE_ROTATED                  = 0x00000001,
+MICRO_TILE_MODE_STD_2D                   = 0x00000002,
+MICRO_TILE_MODE_STD_3D                   = 0x00000003,
+MICRO_TILE_MODE_DISPLAY_2D               = 0x00000004,
+MICRO_TILE_MODE_DISPLAY_3D               = 0x00000005,
+MICRO_TILE_MODE_Z_2D                     = 0x00000006,
+MICRO_TILE_MODE_Z_3D                     = 0x00000007,
+} TC_MICRO_TILE_MODE;
+
+/*
+ * SWIZZLE_MODE_ENUM enum
+ */
+
+typedef enum SWIZZLE_MODE_ENUM {
+SW_LINEAR                                = 0x00000000,
+SW_256B_S                                = 0x00000001,
+SW_256B_D                                = 0x00000002,
+SW_256B_R                                = 0x00000003,
+SW_4KB_Z                                 = 0x00000004,
+SW_4KB_S                                 = 0x00000005,
+SW_4KB_D                                 = 0x00000006,
+SW_4KB_R                                 = 0x00000007,
+SW_64KB_Z                                = 0x00000008,
+SW_64KB_S                                = 0x00000009,
+SW_64KB_D                                = 0x0000000a,
+SW_64KB_R                                = 0x0000000b,
+SW_VAR_Z                                 = 0x0000000c,
+SW_VAR_S                                 = 0x0000000d,
+SW_VAR_D                                 = 0x0000000e,
+SW_VAR_R                                 = 0x0000000f,
+SW_RESERVED_16                           = 0x00000010,
+SW_RESERVED_17                           = 0x00000011,
+SW_RESERVED_18                           = 0x00000012,
+SW_RESERVED_19                           = 0x00000013,
+SW_4KB_Z_X                               = 0x00000014,
+SW_4KB_S_X                               = 0x00000015,
+SW_4KB_D_X                               = 0x00000016,
+SW_4KB_R_X                               = 0x00000017,
+SW_64KB_Z_X                              = 0x00000018,
+SW_64KB_S_X                              = 0x00000019,
+SW_64KB_D_X                              = 0x0000001a,
+SW_64KB_R_X                              = 0x0000001b,
+SW_VAR_Z_X                               = 0x0000001c,
+SW_VAR_S_X                               = 0x0000001d,
+SW_VAR_D_X                               = 0x0000001e,
+SW_VAR_R_X                               = 0x0000001f,
+} SWIZZLE_MODE_ENUM;
+
+/*******************************************************
+ * IH Enums
+ *******************************************************/
+
+/*
+ * IH_PERF_SEL enum
+ */
+
+typedef enum IH_PERF_SEL {
+IH_PERF_SEL_CYCLE                        = 0x00000000,
+IH_PERF_SEL_IDLE                         = 0x00000001,
+IH_PERF_SEL_INPUT_IDLE                   = 0x00000002,
+IH_PERF_SEL_BUFFER_IDLE                  = 0x00000003,
+IH_PERF_SEL_RB0_FULL                     = 0x00000004,
+IH_PERF_SEL_RB0_OVERFLOW                 = 0x00000005,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK           = 0x00000006,
+IH_PERF_SEL_RB0_WPTR_WRAP                = 0x00000007,
+IH_PERF_SEL_RB0_RPTR_WRAP                = 0x00000008,
+IH_PERF_SEL_MC_WR_IDLE                   = 0x00000009,
+IH_PERF_SEL_MC_WR_COUNT                  = 0x0000000a,
+IH_PERF_SEL_MC_WR_STALL                  = 0x0000000b,
+IH_PERF_SEL_MC_WR_CLEAN_PENDING          = 0x0000000c,
+IH_PERF_SEL_MC_WR_CLEAN_STALL            = 0x0000000d,
+IH_PERF_SEL_BIF_LINE0_RISING             = 0x0000000e,
+IH_PERF_SEL_BIF_LINE0_FALLING            = 0x0000000f,
+IH_PERF_SEL_RB1_FULL                     = 0x00000010,
+IH_PERF_SEL_RB1_OVERFLOW                 = 0x00000011,
+Reserved18                               = 0x00000012,
+IH_PERF_SEL_RB1_WPTR_WRAP                = 0x00000013,
+IH_PERF_SEL_RB1_RPTR_WRAP                = 0x00000014,
+IH_PERF_SEL_RB2_FULL                     = 0x00000015,
+IH_PERF_SEL_RB2_OVERFLOW                 = 0x00000016,
+Reserved23                               = 0x00000017,
+IH_PERF_SEL_RB2_WPTR_WRAP                = 0x00000018,
+IH_PERF_SEL_RB2_RPTR_WRAP                = 0x00000019,
+Reserved26                               = 0x0000001a,
+Reserved27                               = 0x0000001b,
+Reserved28                               = 0x0000001c,
+Reserved29                               = 0x0000001d,
+IH_PERF_SEL_RB0_FULL_VF0                 = 0x0000001e,
+IH_PERF_SEL_RB0_FULL_VF1                 = 0x0000001f,
+IH_PERF_SEL_RB0_FULL_VF2                 = 0x00000020,
+IH_PERF_SEL_RB0_FULL_VF3                 = 0x00000021,
+IH_PERF_SEL_RB0_FULL_VF4                 = 0x00000022,
+IH_PERF_SEL_RB0_FULL_VF5                 = 0x00000023,
+IH_PERF_SEL_RB0_FULL_VF6                 = 0x00000024,
+IH_PERF_SEL_RB0_FULL_VF7                 = 0x00000025,
+IH_PERF_SEL_RB0_FULL_VF8                 = 0x00000026,
+IH_PERF_SEL_RB0_FULL_VF9                 = 0x00000027,
+IH_PERF_SEL_RB0_FULL_VF10                = 0x00000028,
+IH_PERF_SEL_RB0_FULL_VF11                = 0x00000029,
+IH_PERF_SEL_RB0_FULL_VF12                = 0x0000002a,
+IH_PERF_SEL_RB0_FULL_VF13                = 0x0000002b,
+IH_PERF_SEL_RB0_FULL_VF14                = 0x0000002c,
+IH_PERF_SEL_RB0_FULL_VF15                = 0x0000002d,
+IH_PERF_SEL_RB0_OVERFLOW_VF0             = 0x0000002e,
+IH_PERF_SEL_RB0_OVERFLOW_VF1             = 0x0000002f,
+IH_PERF_SEL_RB0_OVERFLOW_VF2             = 0x00000030,
+IH_PERF_SEL_RB0_OVERFLOW_VF3             = 0x00000031,
+IH_PERF_SEL_RB0_OVERFLOW_VF4             = 0x00000032,
+IH_PERF_SEL_RB0_OVERFLOW_VF5             = 0x00000033,
+IH_PERF_SEL_RB0_OVERFLOW_VF6             = 0x00000034,
+IH_PERF_SEL_RB0_OVERFLOW_VF7             = 0x00000035,
+IH_PERF_SEL_RB0_OVERFLOW_VF8             = 0x00000036,
+IH_PERF_SEL_RB0_OVERFLOW_VF9             = 0x00000037,
+IH_PERF_SEL_RB0_OVERFLOW_VF10            = 0x00000038,
+IH_PERF_SEL_RB0_OVERFLOW_VF11            = 0x00000039,
+IH_PERF_SEL_RB0_OVERFLOW_VF12            = 0x0000003a,
+IH_PERF_SEL_RB0_OVERFLOW_VF13            = 0x0000003b,
+IH_PERF_SEL_RB0_OVERFLOW_VF14            = 0x0000003c,
+IH_PERF_SEL_RB0_OVERFLOW_VF15            = 0x0000003d,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF0       = 0x0000003e,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF1       = 0x0000003f,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF2       = 0x00000040,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF3       = 0x00000041,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF4       = 0x00000042,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF5       = 0x00000043,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF6       = 0x00000044,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF7       = 0x00000045,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF8       = 0x00000046,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF9       = 0x00000047,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF10      = 0x00000048,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF11      = 0x00000049,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF12      = 0x0000004a,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF13      = 0x0000004b,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF14      = 0x0000004c,
+IH_PERF_SEL_RB0_WPTR_WRITEBACK_VF15      = 0x0000004d,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF0            = 0x0000004e,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF1            = 0x0000004f,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF2            = 0x00000050,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF3            = 0x00000051,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF4            = 0x00000052,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF5            = 0x00000053,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF6            = 0x00000054,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF7            = 0x00000055,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF8            = 0x00000056,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF9            = 0x00000057,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF10           = 0x00000058,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF11           = 0x00000059,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF12           = 0x0000005a,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF13           = 0x0000005b,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF14           = 0x0000005c,
+IH_PERF_SEL_RB0_WPTR_WRAP_VF15           = 0x0000005d,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF0            = 0x0000005e,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF1            = 0x0000005f,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF2            = 0x00000060,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF3            = 0x00000061,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF4            = 0x00000062,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF5            = 0x00000063,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF6            = 0x00000064,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF7            = 0x00000065,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF8            = 0x00000066,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF9            = 0x00000067,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF10           = 0x00000068,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF11           = 0x00000069,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF12           = 0x0000006a,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF13           = 0x0000006b,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF14           = 0x0000006c,
+IH_PERF_SEL_RB0_RPTR_WRAP_VF15           = 0x0000006d,
+IH_PERF_SEL_BIF_LINE0_RISING_VF0         = 0x0000006e,
+IH_PERF_SEL_BIF_LINE0_RISING_VF1         = 0x0000006f,
+IH_PERF_SEL_BIF_LINE0_RISING_VF2         = 0x00000070,
+IH_PERF_SEL_BIF_LINE0_RISING_VF3         = 0x00000071,
+IH_PERF_SEL_BIF_LINE0_RISING_VF4         = 0x00000072,
+IH_PERF_SEL_BIF_LINE0_RISING_VF5         = 0x00000073,
+IH_PERF_SEL_BIF_LINE0_RISING_VF6         = 0x00000074,
+IH_PERF_SEL_BIF_LINE0_RISING_VF7         = 0x00000075,
+IH_PERF_SEL_BIF_LINE0_RISING_VF8         = 0x00000076,
+IH_PERF_SEL_BIF_LINE0_RISING_VF9         = 0x00000077,
+IH_PERF_SEL_BIF_LINE0_RISING_VF10        = 0x00000078,
+IH_PERF_SEL_BIF_LINE0_RISING_VF11        = 0x00000079,
+IH_PERF_SEL_BIF_LINE0_RISING_VF12        = 0x0000007a,
+IH_PERF_SEL_BIF_LINE0_RISING_VF13        = 0x0000007b,
+IH_PERF_SEL_BIF_LINE0_RISING_VF14        = 0x0000007c,
+IH_PERF_SEL_BIF_LINE0_RISING_VF15        = 0x0000007d,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF0        = 0x0000007e,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF1        = 0x0000007f,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF2        = 0x00000080,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF3        = 0x00000081,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF4        = 0x00000082,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF5        = 0x00000083,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF6        = 0x00000084,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF7        = 0x00000085,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF8        = 0x00000086,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF9        = 0x00000087,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF10       = 0x00000088,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF11       = 0x00000089,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF12       = 0x0000008a,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF13       = 0x0000008b,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF14       = 0x0000008c,
+IH_PERF_SEL_BIF_LINE0_FALLING_VF15       = 0x0000008d,
+Reserved142                              = 0x0000008e,
+Reserved143                              = 0x0000008f,
+Reserved144                              = 0x00000090,
+Reserved145                              = 0x00000091,
+Reserved146                              = 0x00000092,
+Reserved147                              = 0x00000093,
+Reserved148                              = 0x00000094,
+Reserved149                              = 0x00000095,
+IH_PERF_SEL_CLIENT0_INT                  = 0x00000096,
+IH_PERF_SEL_CLIENT1_INT                  = 0x00000097,
+IH_PERF_SEL_CLIENT2_INT                  = 0x00000098,
+IH_PERF_SEL_CLIENT3_INT                  = 0x00000099,
+IH_PERF_SEL_CLIENT4_INT                  = 0x0000009a,
+IH_PERF_SEL_CLIENT5_INT                  = 0x0000009b,
+IH_PERF_SEL_CLIENT6_INT                  = 0x0000009c,
+IH_PERF_SEL_CLIENT7_INT                  = 0x0000009d,
+IH_PERF_SEL_CLIENT8_INT                  = 0x0000009e,
+IH_PERF_SEL_CLIENT9_INT                  = 0x0000009f,
+IH_PERF_SEL_CLIENT10_INT                 = 0x000000a0,
+IH_PERF_SEL_CLIENT11_INT                 = 0x000000a1,
+IH_PERF_SEL_CLIENT12_INT                 = 0x000000a2,
+IH_PERF_SEL_CLIENT13_INT                 = 0x000000a3,
+IH_PERF_SEL_CLIENT14_INT                 = 0x000000a4,
+IH_PERF_SEL_CLIENT15_INT                 = 0x000000a5,
+IH_PERF_SEL_CLIENT16_INT                 = 0x000000a6,
+IH_PERF_SEL_CLIENT17_INT                 = 0x000000a7,
+IH_PERF_SEL_CLIENT18_INT                 = 0x000000a8,
+IH_PERF_SEL_CLIENT19_INT                 = 0x000000a9,
+IH_PERF_SEL_CLIENT20_INT                 = 0x000000aa,
+IH_PERF_SEL_CLIENT21_INT                 = 0x000000ab,
+IH_PERF_SEL_CLIENT22_INT                 = 0x000000ac,
+IH_PERF_SEL_CLIENT23_INT                 = 0x000000ad,
+IH_PERF_SEL_CLIENT24_INT                 = 0x000000ae,
+IH_PERF_SEL_CLIENT25_INT                 = 0x000000af,
+IH_PERF_SEL_CLIENT26_INT                 = 0x000000b0,
+IH_PERF_SEL_CLIENT27_INT                 = 0x000000b1,
+IH_PERF_SEL_CLIENT28_INT                 = 0x000000b2,
+IH_PERF_SEL_CLIENT29_INT                 = 0x000000b3,
+IH_PERF_SEL_CLIENT30_INT                 = 0x000000b4,
+IH_PERF_SEL_CLIENT31_INT                 = 0x000000b5,
+Reserved182                              = 0x000000b6,
+Reserved183                              = 0x000000b7,
+Reserved184                              = 0x000000b8,
+Reserved185                              = 0x000000b9,
+Reserved186                              = 0x000000ba,
+Reserved187                              = 0x000000bb,
+Reserved188                              = 0x000000bc,
+Reserved189                              = 0x000000bd,
+Reserved190                              = 0x000000be,
+Reserved191                              = 0x000000bf,
+Reserved192                              = 0x000000c0,
+Reserved193                              = 0x000000c1,
+Reserved194                              = 0x000000c2,
+Reserved195                              = 0x000000c3,
+Reserved196                              = 0x000000c4,
+Reserved197                              = 0x000000c5,
+Reserved198                              = 0x000000c6,
+Reserved199                              = 0x000000c7,
+Reserved200                              = 0x000000c8,
+Reserved201                              = 0x000000c9,
+Reserved202                              = 0x000000ca,
+Reserved203                              = 0x000000cb,
+Reserved204                              = 0x000000cc,
+Reserved205                              = 0x000000cd,
+Reserved206                              = 0x000000ce,
+Reserved207                              = 0x000000cf,
+Reserved208                              = 0x000000d0,
+Reserved209                              = 0x000000d1,
+Reserved210                              = 0x000000d2,
+Reserved211                              = 0x000000d3,
+Reserved212                              = 0x000000d4,
+Reserved213                              = 0x000000d5,
+Reserved214                              = 0x000000d6,
+Reserved215                              = 0x000000d7,
+Reserved216                              = 0x000000d8,
+Reserved217                              = 0x000000d9,
+Reserved218                              = 0x000000da,
+Reserved219                              = 0x000000db,
+IH_PERF_SEL_RB1_FULL_VF0                 = 0x000000dc,
+IH_PERF_SEL_RB1_FULL_VF1                 = 0x000000dd,
+IH_PERF_SEL_RB1_FULL_VF2                 = 0x000000de,
+IH_PERF_SEL_RB1_FULL_VF3                 = 0x000000df,
+IH_PERF_SEL_RB1_FULL_VF4                 = 0x000000e0,
+IH_PERF_SEL_RB1_FULL_VF5                 = 0x000000e1,
+IH_PERF_SEL_RB1_FULL_VF6                 = 0x000000e2,
+IH_PERF_SEL_RB1_FULL_VF7                 = 0x000000e3,
+IH_PERF_SEL_RB1_FULL_VF8                 = 0x000000e4,
+IH_PERF_SEL_RB1_FULL_VF9                 = 0x000000e5,
+IH_PERF_SEL_RB1_FULL_VF10                = 0x000000e6,
+IH_PERF_SEL_RB1_FULL_VF11                = 0x000000e7,
+IH_PERF_SEL_RB1_FULL_VF12                = 0x000000e8,
+IH_PERF_SEL_RB1_FULL_VF13                = 0x000000e9,
+IH_PERF_SEL_RB1_FULL_VF14                = 0x000000ea,
+IH_PERF_SEL_RB1_FULL_VF15                = 0x000000eb,
+IH_PERF_SEL_RB1_OVERFLOW_VF0             = 0x000000ec,
+IH_PERF_SEL_RB1_OVERFLOW_VF1             = 0x000000ed,
+IH_PERF_SEL_RB1_OVERFLOW_VF2             = 0x000000ee,
+IH_PERF_SEL_RB1_OVERFLOW_VF3             = 0x000000ef,
+IH_PERF_SEL_RB1_OVERFLOW_VF4             = 0x000000f0,
+IH_PERF_SEL_RB1_OVERFLOW_VF5             = 0x000000f1,
+IH_PERF_SEL_RB1_OVERFLOW_VF6             = 0x000000f2,
+IH_PERF_SEL_RB1_OVERFLOW_VF7             = 0x000000f3,
+IH_PERF_SEL_RB1_OVERFLOW_VF8             = 0x000000f4,
+IH_PERF_SEL_RB1_OVERFLOW_VF9             = 0x000000f5,
+IH_PERF_SEL_RB1_OVERFLOW_VF10            = 0x000000f6,
+IH_PERF_SEL_RB1_OVERFLOW_VF11            = 0x000000f7,
+IH_PERF_SEL_RB1_OVERFLOW_VF12            = 0x000000f8,
+IH_PERF_SEL_RB1_OVERFLOW_VF13            = 0x000000f9,
+IH_PERF_SEL_RB1_OVERFLOW_VF14            = 0x000000fa,
+IH_PERF_SEL_RB1_OVERFLOW_VF15            = 0x000000fb,
+Reserved252                              = 0x000000fc,
+Reserved253                              = 0x000000fd,
+Reserved254                              = 0x000000fe,
+Reserved255                              = 0x000000ff,
+Reserved256                              = 0x00000100,
+Reserved257                              = 0x00000101,
+Reserved258                              = 0x00000102,
+Reserved259                              = 0x00000103,
+Reserved260                              = 0x00000104,
+Reserved261                              = 0x00000105,
+Reserved262                              = 0x00000106,
+Reserved263                              = 0x00000107,
+Reserved264                              = 0x00000108,
+Reserved265                              = 0x00000109,
+Reserved266                              = 0x0000010a,
+Reserved267                              = 0x0000010b,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF0            = 0x0000010c,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF1            = 0x0000010d,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF2            = 0x0000010e,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF3            = 0x0000010f,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF4            = 0x00000110,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF5            = 0x00000111,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF6            = 0x00000112,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF7            = 0x00000113,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF8            = 0x00000114,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF9            = 0x00000115,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF10           = 0x00000116,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF11           = 0x00000117,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF12           = 0x00000118,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF13           = 0x00000119,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF14           = 0x0000011a,
+IH_PERF_SEL_RB1_WPTR_WRAP_VF15           = 0x0000011b,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF0            = 0x0000011c,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF1            = 0x0000011d,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF2            = 0x0000011e,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF3            = 0x0000011f,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF4            = 0x00000120,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF5            = 0x00000121,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF6            = 0x00000122,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF7            = 0x00000123,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF8            = 0x00000124,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF9            = 0x00000125,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF10           = 0x00000126,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF11           = 0x00000127,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF12           = 0x00000128,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF13           = 0x00000129,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF14           = 0x0000012a,
+IH_PERF_SEL_RB1_RPTR_WRAP_VF15           = 0x0000012b,
+Reserved300                              = 0x0000012c,
+Reserved301                              = 0x0000012d,
+Reserved302                              = 0x0000012e,
+Reserved303                              = 0x0000012f,
+Reserved304                              = 0x00000130,
+Reserved305                              = 0x00000131,
+Reserved306                              = 0x00000132,
+Reserved307                              = 0x00000133,
+Reserved308                              = 0x00000134,
+Reserved309                              = 0x00000135,
+Reserved310                              = 0x00000136,
+Reserved311                              = 0x00000137,
+Reserved312                              = 0x00000138,
+Reserved313                              = 0x00000139,
+Reserved314                              = 0x0000013a,
+Reserved315                              = 0x0000013b,
+Reserved316                              = 0x0000013c,
+Reserved317                              = 0x0000013d,
+Reserved318                              = 0x0000013e,
+Reserved319                              = 0x0000013f,
+Reserved320                              = 0x00000140,
+Reserved321                              = 0x00000141,
+Reserved322                              = 0x00000142,
+Reserved323                              = 0x00000143,
+Reserved324                              = 0x00000144,
+Reserved325                              = 0x00000145,
+Reserved326                              = 0x00000146,
+Reserved327                              = 0x00000147,
+Reserved328                              = 0x00000148,
+Reserved329                              = 0x00000149,
+Reserved330                              = 0x0000014a,
+Reserved331                              = 0x0000014b,
+IH_PERF_SEL_RB2_FULL_VF0                 = 0x0000014c,
+IH_PERF_SEL_RB2_FULL_VF1                 = 0x0000014d,
+IH_PERF_SEL_RB2_FULL_VF2                 = 0x0000014e,
+IH_PERF_SEL_RB2_FULL_VF3                 = 0x0000014f,
+IH_PERF_SEL_RB2_FULL_VF4                 = 0x00000150,
+IH_PERF_SEL_RB2_FULL_VF5                 = 0x00000151,
+IH_PERF_SEL_RB2_FULL_VF6                 = 0x00000152,
+IH_PERF_SEL_RB2_FULL_VF7                 = 0x00000153,
+IH_PERF_SEL_RB2_FULL_VF8                 = 0x00000154,
+IH_PERF_SEL_RB2_FULL_VF9                 = 0x00000155,
+IH_PERF_SEL_RB2_FULL_VF10                = 0x00000156,
+IH_PERF_SEL_RB2_FULL_VF11                = 0x00000157,
+IH_PERF_SEL_RB2_FULL_VF12                = 0x00000158,
+IH_PERF_SEL_RB2_FULL_VF13                = 0x00000159,
+IH_PERF_SEL_RB2_FULL_VF14                = 0x0000015a,
+IH_PERF_SEL_RB2_FULL_VF15                = 0x0000015b,
+IH_PERF_SEL_RB2_OVERFLOW_VF0             = 0x0000015c,
+IH_PERF_SEL_RB2_OVERFLOW_VF1             = 0x0000015d,
+IH_PERF_SEL_RB2_OVERFLOW_VF2             = 0x0000015e,
+IH_PERF_SEL_RB2_OVERFLOW_VF3             = 0x0000015f,
+IH_PERF_SEL_RB2_OVERFLOW_VF4             = 0x00000160,
+IH_PERF_SEL_RB2_OVERFLOW_VF5             = 0x00000161,
+IH_PERF_SEL_RB2_OVERFLOW_VF6             = 0x00000162,
+IH_PERF_SEL_RB2_OVERFLOW_VF7             = 0x00000163,
+IH_PERF_SEL_RB2_OVERFLOW_VF8             = 0x00000164,
+IH_PERF_SEL_RB2_OVERFLOW_VF9             = 0x00000165,
+IH_PERF_SEL_RB2_OVERFLOW_VF10            = 0x00000166,
+IH_PERF_SEL_RB2_OVERFLOW_VF11            = 0x00000167,
+IH_PERF_SEL_RB2_OVERFLOW_VF12            = 0x00000168,
+IH_PERF_SEL_RB2_OVERFLOW_VF13            = 0x00000169,
+IH_PERF_SEL_RB2_OVERFLOW_VF14            = 0x0000016a,
+IH_PERF_SEL_RB2_OVERFLOW_VF15            = 0x0000016b,
+Reserved364                              = 0x0000016c,
+Reserved365                              = 0x0000016d,
+Reserved366                              = 0x0000016e,
+Reserved367                              = 0x0000016f,
+Reserved368                              = 0x00000170,
+Reserved369                              = 0x00000171,
+Reserved370                              = 0x00000172,
+Reserved371                              = 0x00000173,
+Reserved372                              = 0x00000174,
+Reserved373                              = 0x00000175,
+Reserved374                              = 0x00000176,
+Reserved375                              = 0x00000177,
+Reserved376                              = 0x00000178,
+Reserved377                              = 0x00000179,
+Reserved378                              = 0x0000017a,
+Reserved379                              = 0x0000017b,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF0            = 0x0000017c,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF1            = 0x0000017d,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF2            = 0x0000017e,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF3            = 0x0000017f,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF4            = 0x00000180,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF5            = 0x00000181,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF6            = 0x00000182,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF7            = 0x00000183,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF8            = 0x00000184,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF9            = 0x00000185,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF10           = 0x00000186,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF11           = 0x00000187,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF12           = 0x00000188,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF13           = 0x00000189,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF14           = 0x0000018a,
+IH_PERF_SEL_RB2_WPTR_WRAP_VF15           = 0x0000018b,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF0            = 0x0000018c,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF1            = 0x0000018d,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF2            = 0x0000018e,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF3            = 0x0000018f,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF4            = 0x00000190,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF5            = 0x00000191,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF6            = 0x00000192,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF7            = 0x00000193,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF8            = 0x00000194,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF9            = 0x00000195,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF10           = 0x00000196,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF11           = 0x00000197,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF12           = 0x00000198,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF13           = 0x00000199,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF14           = 0x0000019a,
+IH_PERF_SEL_RB2_RPTR_WRAP_VF15           = 0x0000019b,
+Reserved412                              = 0x0000019c,
+Reserved413                              = 0x0000019d,
+Reserved414                              = 0x0000019e,
+Reserved415                              = 0x0000019f,
+Reserved416                              = 0x000001a0,
+Reserved417                              = 0x000001a1,
+Reserved418                              = 0x000001a2,
+Reserved419                              = 0x000001a3,
+Reserved420                              = 0x000001a4,
+Reserved421                              = 0x000001a5,
+Reserved422                              = 0x000001a6,
+Reserved423                              = 0x000001a7,
+Reserved424                              = 0x000001a8,
+Reserved425                              = 0x000001a9,
+Reserved426                              = 0x000001aa,
+Reserved427                              = 0x000001ab,
+Reserved428                              = 0x000001ac,
+Reserved429                              = 0x000001ad,
+Reserved430                              = 0x000001ae,
+Reserved431                              = 0x000001af,
+Reserved432                              = 0x000001b0,
+Reserved433                              = 0x000001b1,
+Reserved434                              = 0x000001b2,
+Reserved435                              = 0x000001b3,
+Reserved436                              = 0x000001b4,
+Reserved437                              = 0x000001b5,
+Reserved438                              = 0x000001b6,
+Reserved439                              = 0x000001b7,
+Reserved440                              = 0x000001b8,
+Reserved441                              = 0x000001b9,
+Reserved442                              = 0x000001ba,
+Reserved443                              = 0x000001bb,
+Reserved444                              = 0x000001bc,
+Reserved445                              = 0x000001bd,
+Reserved446                              = 0x000001be,
+Reserved447                              = 0x000001bf,
+Reserved448                              = 0x000001c0,
+Reserved449                              = 0x000001c1,
+Reserved450                              = 0x000001c2,
+Reserved451                              = 0x000001c3,
+Reserved452                              = 0x000001c4,
+Reserved453                              = 0x000001c5,
+Reserved454                              = 0x000001c6,
+Reserved455                              = 0x000001c7,
+Reserved456                              = 0x000001c8,
+Reserved457                              = 0x000001c9,
+Reserved458                              = 0x000001ca,
+Reserved459                              = 0x000001cb,
+Reserved460                              = 0x000001cc,
+Reserved461                              = 0x000001cd,
+Reserved462                              = 0x000001ce,
+Reserved463                              = 0x000001cf,
+Reserved464                              = 0x000001d0,
+Reserved465                              = 0x000001d1,
+Reserved466                              = 0x000001d2,
+Reserved467                              = 0x000001d3,
+Reserved468                              = 0x000001d4,
+Reserved469                              = 0x000001d5,
+Reserved470                              = 0x000001d6,
+Reserved471                              = 0x000001d7,
+Reserved472                              = 0x000001d8,
+Reserved473                              = 0x000001d9,
+Reserved474                              = 0x000001da,
+Reserved475                              = 0x000001db,
+Reserved476                              = 0x000001dc,
+Reserved477                              = 0x000001dd,
+Reserved478                              = 0x000001de,
+Reserved479                              = 0x000001df,
+Reserved480                              = 0x000001e0,
+Reserved481                              = 0x000001e1,
+Reserved482                              = 0x000001e2,
+Reserved483                              = 0x000001e3,
+Reserved484                              = 0x000001e4,
+Reserved485                              = 0x000001e5,
+Reserved486                              = 0x000001e6,
+Reserved487                              = 0x000001e7,
+Reserved488                              = 0x000001e8,
+Reserved489                              = 0x000001e9,
+Reserved490                              = 0x000001ea,
+Reserved491                              = 0x000001eb,
+Reserved492                              = 0x000001ec,
+Reserved493                              = 0x000001ed,
+Reserved494                              = 0x000001ee,
+Reserved495                              = 0x000001ef,
+Reserved496                              = 0x000001f0,
+Reserved497                              = 0x000001f1,
+Reserved498                              = 0x000001f2,
+Reserved499                              = 0x000001f3,
+Reserved500                              = 0x000001f4,
+Reserved501                              = 0x000001f5,
+Reserved502                              = 0x000001f6,
+Reserved503                              = 0x000001f7,
+Reserved504                              = 0x000001f8,
+Reserved505                              = 0x000001f9,
+Reserved506                              = 0x000001fa,
+Reserved507                              = 0x000001fb,
+Reserved508                              = 0x000001fc,
+Reserved509                              = 0x000001fd,
+Reserved510                              = 0x000001fe,
+Reserved511                              = 0x000001ff,
+} IH_PERF_SEL;
+
+/*******************************************************
+ * SEM Enums
+ *******************************************************/
+
+/*
+ * SEM_PERF_SEL enum
+ */
+
+typedef enum SEM_PERF_SEL {
+SEM_PERF_SEL_CYCLE                       = 0x00000000,
+SEM_PERF_SEL_IDLE                        = 0x00000001,
+SEM_PERF_SEL_SDMA0_REQ_SIGNAL            = 0x00000002,
+SEM_PERF_SEL_SDMA1_REQ_SIGNAL            = 0x00000003,
+SEM_PERF_SEL_UVD_REQ_SIGNAL              = 0x00000004,
+SEM_PERF_SEL_VCE0_REQ_SIGNAL             = 0x00000005,
+SEM_PERF_SEL_ACP_REQ_SIGNAL              = 0x00000006,
+SEM_PERF_SEL_ISP_REQ_SIGNAL              = 0x00000007,
+SEM_PERF_SEL_VCE1_REQ_SIGNAL             = 0x00000008,
+SEM_PERF_SEL_VP8_REQ_SIGNAL              = 0x00000009,
+SEM_PERF_SEL_CPG_E0_REQ_SIGNAL           = 0x0000000a,
+SEM_PERF_SEL_CPG_E1_REQ_SIGNAL           = 0x0000000b,
+SEM_PERF_SEL_CPC1_IMME_E0_REQ_SIGNAL     = 0x0000000c,
+SEM_PERF_SEL_CPC1_IMME_E1_REQ_SIGNAL     = 0x0000000d,
+SEM_PERF_SEL_CPC1_IMME_E2_REQ_SIGNAL     = 0x0000000e,
+SEM_PERF_SEL_CPC1_IMME_E3_REQ_SIGNAL     = 0x0000000f,
+SEM_PERF_SEL_CPC2_IMME_E0_REQ_SIGNAL     = 0x00000010,
+SEM_PERF_SEL_CPC2_IMME_E1_REQ_SIGNAL     = 0x00000011,
+SEM_PERF_SEL_CPC2_IMME_E2_REQ_SIGNAL     = 0x00000012,
+SEM_PERF_SEL_CPC2_IMME_E3_REQ_SIGNAL     = 0x00000013,
+SEM_PERF_SEL_SDMA0_REQ_WAIT              = 0x00000014,
+SEM_PERF_SEL_SDMA1_REQ_WAIT              = 0x00000015,
+SEM_PERF_SEL_UVD_REQ_WAIT                = 0x00000016,
+SEM_PERF_SEL_VCE0_REQ_WAIT               = 0x00000017,
+SEM_PERF_SEL_ACP_REQ_WAIT                = 0x00000018,
+SEM_PERF_SEL_ISP_REQ_WAIT                = 0x00000019,
+SEM_PERF_SEL_VCE1_REQ_WAIT               = 0x0000001a,
+SEM_PERF_SEL_VP8_REQ_WAIT                = 0x0000001b,
+SEM_PERF_SEL_CPG_E0_REQ_WAIT             = 0x0000001c,
+SEM_PERF_SEL_CPG_E1_REQ_WAIT             = 0x0000001d,
+SEM_PERF_SEL_CPC1_IMME_E0_REQ_WAIT       = 0x0000001e,
+SEM_PERF_SEL_CPC1_IMME_E1_REQ_WAIT       = 0x0000001f,
+SEM_PERF_SEL_CPC1_IMME_E2_REQ_WAIT       = 0x00000020,
+SEM_PERF_SEL_CPC1_IMME_E3_REQ_WAIT       = 0x00000021,
+SEM_PERF_SEL_CPC2_IMME_E0_REQ_WAIT       = 0x00000022,
+SEM_PERF_SEL_CPC2_IMME_E1_REQ_WAIT       = 0x00000023,
+SEM_PERF_SEL_CPC2_IMME_E2_REQ_WAIT       = 0x00000024,
+SEM_PERF_SEL_CPC2_IMME_E3_REQ_WAIT       = 0x00000025,
+SEM_PERF_SEL_CPC1_OFFL_E0_REQ_WAIT       = 0x00000026,
+SEM_PERF_SEL_CPC1_OFFL_E1_REQ_WAIT       = 0x00000027,
+SEM_PERF_SEL_CPC1_OFFL_E2_REQ_WAIT       = 0x00000028,
+SEM_PERF_SEL_CPC1_OFFL_E3_REQ_WAIT       = 0x00000029,
+SEM_PERF_SEL_CPC1_OFFL_E4_REQ_WAIT       = 0x0000002a,
+SEM_PERF_SEL_CPC1_OFFL_E5_REQ_WAIT       = 0x0000002b,
+SEM_PERF_SEL_CPC1_OFFL_E6_REQ_WAIT       = 0x0000002c,
+SEM_PERF_SEL_CPC1_OFFL_E7_REQ_WAIT       = 0x0000002d,
+SEM_PERF_SEL_CPC1_OFFL_E8_REQ_WAIT       = 0x0000002e,
+SEM_PERF_SEL_CPC1_OFFL_E9_REQ_WAIT       = 0x0000002f,
+SEM_PERF_SEL_CPC1_OFFL_E10_REQ_WAIT      = 0x00000030,
+SEM_PERF_SEL_CPC1_OFFL_E11_REQ_WAIT      = 0x00000031,
+SEM_PERF_SEL_CPC1_OFFL_E12_REQ_WAIT      = 0x00000032,
+SEM_PERF_SEL_CPC1_OFFL_E13_REQ_WAIT      = 0x00000033,
+SEM_PERF_SEL_CPC1_OFFL_E14_REQ_WAIT      = 0x00000034,
+SEM_PERF_SEL_CPC1_OFFL_E15_REQ_WAIT      = 0x00000035,
+SEM_PERF_SEL_CPC1_OFFL_E16_REQ_WAIT      = 0x00000036,
+SEM_PERF_SEL_CPC1_OFFL_E17_REQ_WAIT      = 0x00000037,
+SEM_PERF_SEL_CPC1_OFFL_E18_REQ_WAIT      = 0x00000038,
+SEM_PERF_SEL_CPC1_OFFL_E19_REQ_WAIT      = 0x00000039,
+SEM_PERF_SEL_CPC1_OFFL_E20_REQ_WAIT      = 0x0000003a,
+SEM_PERF_SEL_CPC1_OFFL_E21_REQ_WAIT      = 0x0000003b,
+SEM_PERF_SEL_CPC1_OFFL_E22_REQ_WAIT      = 0x0000003c,
+SEM_PERF_SEL_CPC1_OFFL_E23_REQ_WAIT      = 0x0000003d,
+SEM_PERF_SEL_CPC1_OFFL_E24_REQ_WAIT      = 0x0000003e,
+SEM_PERF_SEL_CPC1_OFFL_E25_REQ_WAIT      = 0x0000003f,
+SEM_PERF_SEL_CPC1_OFFL_E26_REQ_WAIT      = 0x00000040,
+SEM_PERF_SEL_CPC1_OFFL_E27_REQ_WAIT      = 0x00000041,
+SEM_PERF_SEL_CPC1_OFFL_E28_REQ_WAIT      = 0x00000042,
+SEM_PERF_SEL_CPC1_OFFL_E29_REQ_WAIT      = 0x00000043,
+SEM_PERF_SEL_CPC1_OFFL_E30_REQ_WAIT      = 0x00000044,
+SEM_PERF_SEL_CPC1_OFFL_E31_REQ_WAIT      = 0x00000045,
+SEM_PERF_SEL_CPC2_OFFL_E0_REQ_WAIT       = 0x00000046,
+SEM_PERF_SEL_CPC2_OFFL_E1_REQ_WAIT       = 0x00000047,
+SEM_PERF_SEL_CPC2_OFFL_E2_REQ_WAIT       = 0x00000048,
+SEM_PERF_SEL_CPC2_OFFL_E3_REQ_WAIT       = 0x00000049,
+SEM_PERF_SEL_CPC2_OFFL_E4_REQ_WAIT       = 0x0000004a,
+SEM_PERF_SEL_CPC2_OFFL_E5_REQ_WAIT       = 0x0000004b,
+SEM_PERF_SEL_CPC2_OFFL_E6_REQ_WAIT       = 0x0000004c,
+SEM_PERF_SEL_CPC2_OFFL_E7_REQ_WAIT       = 0x0000004d,
+SEM_PERF_SEL_CPC2_OFFL_E8_REQ_WAIT       = 0x0000004e,
+SEM_PERF_SEL_CPC2_OFFL_E9_REQ_WAIT       = 0x0000004f,
+SEM_PERF_SEL_CPC2_OFFL_E10_REQ_WAIT      = 0x00000050,
+SEM_PERF_SEL_CPC2_OFFL_E11_REQ_WAIT      = 0x00000051,
+SEM_PERF_SEL_CPC2_OFFL_E12_REQ_WAIT      = 0x00000052,
+SEM_PERF_SEL_CPC2_OFFL_E13_REQ_WAIT      = 0x00000053,
+SEM_PERF_SEL_CPC2_OFFL_E14_REQ_WAIT      = 0x00000054,
+SEM_PERF_SEL_CPC2_OFFL_E15_REQ_WAIT      = 0x00000055,
+SEM_PERF_SEL_CPC2_OFFL_E16_REQ_WAIT      = 0x00000056,
+SEM_PERF_SEL_CPC2_OFFL_E17_REQ_WAIT      = 0x00000057,
+SEM_PERF_SEL_CPC2_OFFL_E18_REQ_WAIT      = 0x00000058,
+SEM_PERF_SEL_CPC2_OFFL_E19_REQ_WAIT      = 0x00000059,
+SEM_PERF_SEL_CPC2_OFFL_E20_REQ_WAIT      = 0x0000005a,
+SEM_PERF_SEL_CPC2_OFFL_E21_REQ_WAIT      = 0x0000005b,
+SEM_PERF_SEL_CPC2_OFFL_E22_REQ_WAIT      = 0x0000005c,
+SEM_PERF_SEL_CPC2_OFFL_E23_REQ_WAIT      = 0x0000005d,
+SEM_PERF_SEL_CPC2_OFFL_E24_REQ_WAIT      = 0x0000005e,
+SEM_PERF_SEL_CPC2_OFFL_E25_REQ_WAIT      = 0x0000005f,
+SEM_PERF_SEL_CPC2_OFFL_E26_REQ_WAIT      = 0x00000060,
+SEM_PERF_SEL_CPC2_OFFL_E27_REQ_WAIT      = 0x00000061,
+SEM_PERF_SEL_CPC2_OFFL_E28_REQ_WAIT      = 0x00000062,
+SEM_PERF_SEL_CPC2_OFFL_E29_REQ_WAIT      = 0x00000063,
+SEM_PERF_SEL_CPC2_OFFL_E30_REQ_WAIT      = 0x00000064,
+SEM_PERF_SEL_CPC2_OFFL_E31_REQ_WAIT      = 0x00000065,
+SEM_PERF_SEL_CPC1_OFFL_E0_POLL_WAIT      = 0x00000066,
+SEM_PERF_SEL_CPC1_OFFL_E1_POLL_WAIT      = 0x00000067,
+SEM_PERF_SEL_CPC1_OFFL_E2_POLL_WAIT      = 0x00000068,
+SEM_PERF_SEL_CPC1_OFFL_E3_POLL_WAIT      = 0x00000069,
+SEM_PERF_SEL_CPC1_OFFL_E4_POLL_WAIT      = 0x0000006a,
+SEM_PERF_SEL_CPC1_OFFL_E5_POLL_WAIT      = 0x0000006b,
+SEM_PERF_SEL_CPC1_OFFL_E6_POLL_WAIT      = 0x0000006c,
+SEM_PERF_SEL_CPC1_OFFL_E7_POLL_WAIT      = 0x0000006d,
+SEM_PERF_SEL_CPC1_OFFL_E8_POLL_WAIT      = 0x0000006e,
+SEM_PERF_SEL_CPC1_OFFL_E9_POLL_WAIT      = 0x0000006f,
+SEM_PERF_SEL_CPC1_OFFL_E10_POLL_WAIT     = 0x00000070,
+SEM_PERF_SEL_CPC1_OFFL_E11_POLL_WAIT     = 0x00000071,
+SEM_PERF_SEL_CPC1_OFFL_E12_POLL_WAIT     = 0x00000072,
+SEM_PERF_SEL_CPC1_OFFL_E13_POLL_WAIT     = 0x00000073,
+SEM_PERF_SEL_CPC1_OFFL_E14_POLL_WAIT     = 0x00000074,
+SEM_PERF_SEL_CPC1_OFFL_E15_POLL_WAIT     = 0x00000075,
+SEM_PERF_SEL_CPC1_OFFL_E16_POLL_WAIT     = 0x00000076,
+SEM_PERF_SEL_CPC1_OFFL_E17_POLL_WAIT     = 0x00000077,
+SEM_PERF_SEL_CPC1_OFFL_E18_POLL_WAIT     = 0x00000078,
+SEM_PERF_SEL_CPC1_OFFL_E19_POLL_WAIT     = 0x00000079,
+SEM_PERF_SEL_CPC1_OFFL_E20_POLL_WAIT     = 0x0000007a,
+SEM_PERF_SEL_CPC1_OFFL_E21_POLL_WAIT     = 0x0000007b,
+SEM_PERF_SEL_CPC1_OFFL_E22_POLL_WAIT     = 0x0000007c,
+SEM_PERF_SEL_CPC1_OFFL_E23_POLL_WAIT     = 0x0000007d,
+SEM_PERF_SEL_CPC1_OFFL_E24_POLL_WAIT     = 0x0000007e,
+SEM_PERF_SEL_CPC1_OFFL_E25_POLL_WAIT     = 0x0000007f,
+SEM_PERF_SEL_CPC1_OFFL_E26_POLL_WAIT     = 0x00000080,
+SEM_PERF_SEL_CPC1_OFFL_E27_POLL_WAIT     = 0x00000081,
+SEM_PERF_SEL_CPC1_OFFL_E28_POLL_WAIT     = 0x00000082,
+SEM_PERF_SEL_CPC1_OFFL_E29_POLL_WAIT     = 0x00000083,
+SEM_PERF_SEL_CPC1_OFFL_E30_POLL_WAIT     = 0x00000084,
+SEM_PERF_SEL_CPC1_OFFL_E31_POLL_WAIT     = 0x00000085,
+SEM_PERF_SEL_CPC2_OFFL_E0_POLL_WAIT      = 0x00000086,
+SEM_PERF_SEL_CPC2_OFFL_E1_POLL_WAIT      = 0x00000087,
+SEM_PERF_SEL_CPC2_OFFL_E2_POLL_WAIT      = 0x00000088,
+SEM_PERF_SEL_CPC2_OFFL_E3_POLL_WAIT      = 0x00000089,
+SEM_PERF_SEL_CPC2_OFFL_E4_POLL_WAIT      = 0x0000008a,
+SEM_PERF_SEL_CPC2_OFFL_E5_POLL_WAIT      = 0x0000008b,
+SEM_PERF_SEL_CPC2_OFFL_E6_POLL_WAIT      = 0x0000008c,
+SEM_PERF_SEL_CPC2_OFFL_E7_POLL_WAIT      = 0x0000008d,
+SEM_PERF_SEL_CPC2_OFFL_E8_POLL_WAIT      = 0x0000008e,
+SEM_PERF_SEL_CPC2_OFFL_E9_POLL_WAIT      = 0x0000008f,
+SEM_PERF_SEL_CPC2_OFFL_E10_POLL_WAIT     = 0x00000090,
+SEM_PERF_SEL_CPC2_OFFL_E11_POLL_WAIT     = 0x00000091,
+SEM_PERF_SEL_CPC2_OFFL_E12_POLL_WAIT     = 0x00000092,
+SEM_PERF_SEL_CPC2_OFFL_E13_POLL_WAIT     = 0x00000093,
+SEM_PERF_SEL_CPC2_OFFL_E14_POLL_WAIT     = 0x00000094,
+SEM_PERF_SEL_CPC2_OFFL_E15_POLL_WAIT     = 0x00000095,
+SEM_PERF_SEL_CPC2_OFFL_E16_POLL_WAIT     = 0x00000096,
+SEM_PERF_SEL_CPC2_OFFL_E17_POLL_WAIT     = 0x00000097,
+SEM_PERF_SEL_CPC2_OFFL_E18_POLL_WAIT     = 0x00000098,
+SEM_PERF_SEL_CPC2_OFFL_E19_POLL_WAIT     = 0x00000099,
+SEM_PERF_SEL_CPC2_OFFL_E20_POLL_WAIT     = 0x0000009a,
+SEM_PERF_SEL_CPC2_OFFL_E21_POLL_WAIT     = 0x0000009b,
+SEM_PERF_SEL_CPC2_OFFL_E22_POLL_WAIT     = 0x0000009c,
+SEM_PERF_SEL_CPC2_OFFL_E23_POLL_WAIT     = 0x0000009d,
+SEM_PERF_SEL_CPC2_OFFL_E24_POLL_WAIT     = 0x0000009e,
+SEM_PERF_SEL_CPC2_OFFL_E25_POLL_WAIT     = 0x0000009f,
+SEM_PERF_SEL_CPC2_OFFL_E26_POLL_WAIT     = 0x000000a0,
+SEM_PERF_SEL_CPC2_OFFL_E27_POLL_WAIT     = 0x000000a1,
+SEM_PERF_SEL_CPC2_OFFL_E28_POLL_WAIT     = 0x000000a2,
+SEM_PERF_SEL_CPC2_OFFL_E29_POLL_WAIT     = 0x000000a3,
+SEM_PERF_SEL_CPC2_OFFL_E30_POLL_WAIT     = 0x000000a4,
+SEM_PERF_SEL_CPC2_OFFL_E31_POLL_WAIT     = 0x000000a5,
+SEM_PERF_SEL_MC_RD_REQ                   = 0x000000a6,
+SEM_PERF_SEL_MC_RD_RET                   = 0x000000a7,
+SEM_PERF_SEL_MC_WR_REQ                   = 0x000000a8,
+SEM_PERF_SEL_MC_WR_RET                   = 0x000000a9,
+SEM_PERF_SEL_ATC_REQ                     = 0x000000aa,
+SEM_PERF_SEL_ATC_RET                     = 0x000000ab,
+SEM_PERF_SEL_ATC_XNACK                   = 0x000000ac,
+SEM_PERF_SEL_ATC_INVALIDATION            = 0x000000ad,
+} SEM_PERF_SEL;
+
+/*******************************************************
+ * SDMA Enums
+ *******************************************************/
+
+/*
+ * SDMA_PERF_SEL enum
+ */
+
+typedef enum SDMA_PERF_SEL {
+SDMA_PERF_SEL_CYCLE                      = 0x00000000,
+SDMA_PERF_SEL_IDLE                       = 0x00000001,
+SDMA_PERF_SEL_REG_IDLE                   = 0x00000002,
+SDMA_PERF_SEL_RB_EMPTY                   = 0x00000003,
+SDMA_PERF_SEL_RB_FULL                    = 0x00000004,
+SDMA_PERF_SEL_RB_WPTR_WRAP               = 0x00000005,
+SDMA_PERF_SEL_RB_RPTR_WRAP               = 0x00000006,
+SDMA_PERF_SEL_RB_WPTR_POLL_READ          = 0x00000007,
+SDMA_PERF_SEL_RB_RPTR_WB                 = 0x00000008,
+SDMA_PERF_SEL_RB_CMD_IDLE                = 0x00000009,
+SDMA_PERF_SEL_RB_CMD_FULL                = 0x0000000a,
+SDMA_PERF_SEL_IB_CMD_IDLE                = 0x0000000b,
+SDMA_PERF_SEL_IB_CMD_FULL                = 0x0000000c,
+SDMA_PERF_SEL_EX_IDLE                    = 0x0000000d,
+SDMA_PERF_SEL_SRBM_REG_SEND              = 0x0000000e,
+SDMA_PERF_SEL_EX_IDLE_POLL_TIMER_EXPIRE  = 0x0000000f,
+SDMA_PERF_SEL_MC_WR_IDLE                 = 0x00000010,
+SDMA_PERF_SEL_MC_WR_COUNT                = 0x00000011,
+SDMA_PERF_SEL_MC_RD_IDLE                 = 0x00000012,
+SDMA_PERF_SEL_MC_RD_COUNT                = 0x00000013,
+SDMA_PERF_SEL_MC_RD_RET_STALL            = 0x00000014,
+SDMA_PERF_SEL_MC_RD_NO_POLL_IDLE         = 0x00000015,
+SDMA_PERF_SEL_DRM_IDLE                   = 0x00000016,
+SDMA_PERF_SEL_DRM_REQ_STALL              = 0x00000017,
+SDMA_PERF_SEL_SEM_IDLE                   = 0x00000018,
+SDMA_PERF_SEL_SEM_REQ_STALL              = 0x00000019,
+SDMA_PERF_SEL_SEM_REQ_COUNT              = 0x0000001a,
+SDMA_PERF_SEL_SEM_RESP_INCOMPLETE        = 0x0000001b,
+SDMA_PERF_SEL_SEM_RESP_FAIL              = 0x0000001c,
+SDMA_PERF_SEL_SEM_RESP_PASS              = 0x0000001d,
+SDMA_PERF_SEL_INT_IDLE                   = 0x0000001e,
+SDMA_PERF_SEL_INT_REQ_STALL              = 0x0000001f,
+SDMA_PERF_SEL_INT_REQ_COUNT              = 0x00000020,
+SDMA_PERF_SEL_INT_RESP_ACCEPTED          = 0x00000021,
+SDMA_PERF_SEL_INT_RESP_RETRY             = 0x00000022,
+SDMA_PERF_SEL_NUM_PACKET                 = 0x00000023,
+SDMA_PERF_SEL_DRM1_REQ_STALL             = 0x00000024,
+SDMA_PERF_SEL_CE_WREQ_IDLE               = 0x00000025,
+SDMA_PERF_SEL_CE_WR_IDLE                 = 0x00000026,
+SDMA_PERF_SEL_CE_SPLIT_IDLE              = 0x00000027,
+SDMA_PERF_SEL_CE_RREQ_IDLE               = 0x00000028,
+SDMA_PERF_SEL_CE_OUT_IDLE                = 0x00000029,
+SDMA_PERF_SEL_CE_IN_IDLE                 = 0x0000002a,
+SDMA_PERF_SEL_CE_DST_IDLE                = 0x0000002b,
+SDMA_PERF_SEL_CE_DRM_IDLE                = 0x0000002c,
+SDMA_PERF_SEL_CE_DRM1_IDLE               = 0x0000002d,
+SDMA_PERF_SEL_CE_AFIFO_FULL              = 0x0000002e,
+SDMA_PERF_SEL_CE_DRM_FULL                = 0x0000002f,
+SDMA_PERF_SEL_CE_DRM1_FULL               = 0x00000030,
+SDMA_PERF_SEL_CE_INFO_FULL               = 0x00000031,
+SDMA_PERF_SEL_CE_INFO1_FULL              = 0x00000032,
+SDMA_PERF_SEL_CE_RD_STALL                = 0x00000033,
+SDMA_PERF_SEL_CE_WR_STALL                = 0x00000034,
+SDMA_PERF_SEL_GFX_SELECT                 = 0x00000035,
+SDMA_PERF_SEL_RLC0_SELECT                = 0x00000036,
+SDMA_PERF_SEL_RLC1_SELECT                = 0x00000037,
+SDMA_PERF_SEL_PAGE_SELECT                = 0x00000038,
+SDMA_PERF_SEL_CTX_CHANGE                 = 0x00000039,
+SDMA_PERF_SEL_CTX_CHANGE_EXPIRED         = 0x0000003a,
+SDMA_PERF_SEL_CTX_CHANGE_EXCEPTION       = 0x0000003b,
+SDMA_PERF_SEL_DOORBELL                   = 0x0000003c,
+SDMA_PERF_SEL_RD_BA_RTR                  = 0x0000003d,
+SDMA_PERF_SEL_WR_BA_RTR                  = 0x0000003e,
+SDMA_PERF_SEL_F32_L1_WR_VLD              = 0x0000003f,
+SDMA_PERF_SEL_CE_L1_WR_VLD               = 0x00000040,
+SDMA_PERF_SEL_CE_L1_STALL                = 0x00000041,
+SDMA_PERF_SEL_SDMA_INVACK_NFLUSH         = 0x00000042,
+SDMA_PERF_SEL_SDMA_INVACK_FLUSH          = 0x00000043,
+SDMA_PERF_SEL_ATCL2_INVREQ_NFLUSH        = 0x00000044,
+SDMA_PERF_SEL_ATCL2_INVREQ_FLUSH         = 0x00000045,
+SDMA_PERF_SEL_ATCL2_RET_XNACK            = 0x00000046,
+SDMA_PERF_SEL_ATCL2_RET_ACK              = 0x00000047,
+SDMA_PERF_SEL_ATCL2_FREE                 = 0x00000048,
+SDMA_PERF_SEL_SDMA_ATCL2_SEND            = 0x00000049,
+SDMA_PERF_SEL_DMA_L1_WR_SEND             = 0x0000004a,
+SDMA_PERF_SEL_DMA_L1_RD_SEND             = 0x0000004b,
+SDMA_PERF_SEL_DMA_MC_WR_SEND             = 0x0000004c,
+SDMA_PERF_SEL_DMA_MC_RD_SEND             = 0x0000004d,
+SDMA_PERF_SEL_L1_WR_FIFO_IDLE            = 0x0000004e,
+SDMA_PERF_SEL_L1_RD_FIFO_IDLE            = 0x0000004f,
+SDMA_PERF_SEL_L1_WRL2_IDLE               = 0x00000050,
+SDMA_PERF_SEL_L1_RDL2_IDLE               = 0x00000051,
+SDMA_PERF_SEL_L1_WRMC_IDLE               = 0x00000052,
+SDMA_PERF_SEL_L1_RDMC_IDLE               = 0x00000053,
+SDMA_PERF_SEL_L1_WR_INV_IDLE             = 0x00000054,
+SDMA_PERF_SEL_L1_RD_INV_IDLE             = 0x00000055,
+SDMA_PERF_SEL_L1_WR_INV_EN               = 0x00000056,
+SDMA_PERF_SEL_L1_RD_INV_EN               = 0x00000057,
+SDMA_PERF_SEL_L1_WR_WAIT_INVADR          = 0x00000058,
+SDMA_PERF_SEL_L1_RD_WAIT_INVADR          = 0x00000059,
+SDMA_PERF_SEL_IS_INVREQ_ADDR_WR          = 0x0000005a,
+SDMA_PERF_SEL_IS_INVREQ_ADDR_RD          = 0x0000005b,
+SDMA_PERF_SEL_L1_WR_XNACK_TIMEOUT        = 0x0000005c,
+SDMA_PERF_SEL_L1_RD_XNACK_TIMEOUT        = 0x0000005d,
+SDMA_PERF_SEL_L1_INV_MIDDLE              = 0x0000005e,
+SDMA_PERF_SEL_UTCL1_TAG_DELAY_COUNTER    = 0x000000fe,
+SDMA_PERF_SEL_MMHUB_TAG_DELAY_COUNTER    = 0x000000ff,
+} SDMA_PERF_SEL;
+
+/*******************************************************
+ * SMUIO Enums
+ *******************************************************/
+
+/*
+ * ROM_SIGNATURE value
+ */
+
+#define ROM_SIGNATURE                  0x0000aa55
+
+/*******************************************************
+ * GDS Enums
+ *******************************************************/
+
+/*******************************************************
+ * CB Enums
+ *******************************************************/
+
+/*
+ * SurfaceNumber enum
+ */
+
+typedef enum SurfaceNumber {
+NUMBER_UNORM                             = 0x00000000,
+NUMBER_SNORM                             = 0x00000001,
+NUMBER_USCALED                           = 0x00000002,
+NUMBER_SSCALED&n