amd/addrlib: update Mesa's copy of addrlib
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 19 Nov 2018 17:53:09 +0000 (18:53 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 29 Nov 2018 12:18:24 +0000 (13:18 +0100)
Update to the internal master as of 2018-11-15.

This has a lot of gratuitous whitespace change, but on the plus
side it's built using the same tooling that's used for AMDVLK,
which should help going forward.

63 files changed:
src/amd/Makefile.addrlib.am
src/amd/Makefile.sources
src/amd/addrlib/addrinterface.cpp [deleted file]
src/amd/addrlib/addrinterface.h [deleted file]
src/amd/addrlib/addrtypes.h [deleted file]
src/amd/addrlib/amdgpu_asic_addr.h [deleted file]
src/amd/addrlib/core/addrcommon.h [deleted file]
src/amd/addrlib/core/addrelemlib.cpp [deleted file]
src/amd/addrlib/core/addrelemlib.h [deleted file]
src/amd/addrlib/core/addrlib.cpp [deleted file]
src/amd/addrlib/core/addrlib.h [deleted file]
src/amd/addrlib/core/addrlib1.cpp [deleted file]
src/amd/addrlib/core/addrlib1.h [deleted file]
src/amd/addrlib/core/addrlib2.cpp [deleted file]
src/amd/addrlib/core/addrlib2.h [deleted file]
src/amd/addrlib/core/addrobject.cpp [deleted file]
src/amd/addrlib/core/addrobject.h [deleted file]
src/amd/addrlib/gfx9/chip/gfx9_enum.h [deleted file]
src/amd/addrlib/gfx9/coord.cpp [deleted file]
src/amd/addrlib/gfx9/coord.h [deleted file]
src/amd/addrlib/gfx9/gfx9addrlib.cpp [deleted file]
src/amd/addrlib/gfx9/gfx9addrlib.h [deleted file]
src/amd/addrlib/inc/addrinterface.h [new file with mode: 0644]
src/amd/addrlib/inc/addrtypes.h [new file with mode: 0644]
src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h [deleted file]
src/amd/addrlib/inc/chip/r800/si_gb_reg.h [deleted file]
src/amd/addrlib/meson.build
src/amd/addrlib/r800/chip/si_ci_vi_merged_enum.h [deleted file]
src/amd/addrlib/r800/ciaddrlib.cpp [deleted file]
src/amd/addrlib/r800/ciaddrlib.h [deleted file]
src/amd/addrlib/r800/egbaddrlib.cpp [deleted file]
src/amd/addrlib/r800/egbaddrlib.h [deleted file]
src/amd/addrlib/r800/siaddrlib.cpp [deleted file]
src/amd/addrlib/r800/siaddrlib.h [deleted file]
src/amd/addrlib/src/addrinterface.cpp [new file with mode: 0644]
src/amd/addrlib/src/amdgpu_asic_addr.h [new file with mode: 0644]
src/amd/addrlib/src/chip/gfx9/gfx9_gb_reg.h [new file with mode: 0644]
src/amd/addrlib/src/chip/r800/si_gb_reg.h [new file with mode: 0644]
src/amd/addrlib/src/core/addrcommon.h [new file with mode: 0644]
src/amd/addrlib/src/core/addrelemlib.cpp [new file with mode: 0644]
src/amd/addrlib/src/core/addrelemlib.h [new file with mode: 0644]
src/amd/addrlib/src/core/addrlib.cpp [new file with mode: 0644]
src/amd/addrlib/src/core/addrlib.h [new file with mode: 0644]
src/amd/addrlib/src/core/addrlib1.cpp [new file with mode: 0644]
src/amd/addrlib/src/core/addrlib1.h [new file with mode: 0644]
src/amd/addrlib/src/core/addrlib2.cpp [new file with mode: 0644]
src/amd/addrlib/src/core/addrlib2.h [new file with mode: 0644]
src/amd/addrlib/src/core/addrobject.cpp [new file with mode: 0644]
src/amd/addrlib/src/core/addrobject.h [new file with mode: 0644]
src/amd/addrlib/src/core/coord.cpp [new file with mode: 0644]
src/amd/addrlib/src/core/coord.h [new file with mode: 0644]
src/amd/addrlib/src/gfx9/gfx9addrlib.cpp [new file with mode: 0644]
src/amd/addrlib/src/gfx9/gfx9addrlib.h [new file with mode: 0644]
src/amd/addrlib/src/r800/ciaddrlib.cpp [new file with mode: 0644]
src/amd/addrlib/src/r800/ciaddrlib.h [new file with mode: 0644]
src/amd/addrlib/src/r800/egbaddrlib.cpp [new file with mode: 0644]
src/amd/addrlib/src/r800/egbaddrlib.h [new file with mode: 0644]
src/amd/addrlib/src/r800/siaddrlib.cpp [new file with mode: 0644]
src/amd/addrlib/src/r800/siaddrlib.h [new file with mode: 0644]
src/amd/common/ac_surface.c
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h

index af0daf907d54fa108a55ddf42544ce17d9dba383..6de0e487f69e71e960d7554e6406e66cef2e95b7 100644 (file)
@@ -26,12 +26,11 @@ addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
        -I$(top_srcdir)/src/ \
        -I$(top_srcdir)/include \
        -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
+       -I$(srcdir)/addrlib/inc \
+       -I$(srcdir)/addrlib/src \
+       -I$(srcdir)/addrlib/src/core \
+       -I$(srcdir)/addrlib/src/chip/gfx9 \
+       -I$(srcdir)/addrlib/src/chip/r800
 
 addrlib_libamdgpu_addrlib_la_CXXFLAGS = \
        $(VISIBILITY_CXXFLAGS) $(CXX11_CXXFLAGS)
index 41334cb98189ecabcb5bc854d4d6adbb7fc8684d..49d1031874a079063d4da4bb55ec8d453279c9f4 100644 (file)
@@ -5,35 +5,34 @@ COMMON_HEADER_FILES = \
        common/amd_kernel_code_t.h
 
 ADDRLIB_FILES = \
-       addrlib/addrinterface.cpp \
-       addrlib/addrinterface.h \
-       addrlib/addrtypes.h \
-       addrlib/amdgpu_asic_addr.h \
-       addrlib/core/addrcommon.h \
-       addrlib/core/addrelemlib.cpp \
-       addrlib/core/addrelemlib.h \
-       addrlib/core/addrlib.cpp \
-       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/chip/gfx9_enum.h \
-       addrlib/gfx9/coord.cpp \
-       addrlib/gfx9/coord.h \
-       addrlib/gfx9/gfx9addrlib.cpp \
-       addrlib/gfx9/gfx9addrlib.h \
-       addrlib/inc/chip/gfx9/gfx9_gb_reg.h \
-       addrlib/inc/chip/r800/si_gb_reg.h \
-       addrlib/r800/chip/si_ci_vi_merged_enum.h \
-       addrlib/r800/ciaddrlib.cpp \
-       addrlib/r800/ciaddrlib.h \
-       addrlib/r800/egbaddrlib.cpp \
-       addrlib/r800/egbaddrlib.h \
-       addrlib/r800/siaddrlib.cpp \
-       addrlib/r800/siaddrlib.h
+       addrlib/inc/addrinterface.h \
+       addrlib/inc/addrtypes.h \
+       addrlib/src/addrinterface.cpp \
+       addrlib/src/amdgpu_asic_addr.h \
+       addrlib/src/core/addrcommon.h \
+       addrlib/src/core/addrelemlib.cpp \
+       addrlib/src/core/addrelemlib.h \
+       addrlib/src/core/addrlib.cpp \
+       addrlib/src/core/addrlib.h \
+       addrlib/src/core/addrlib1.cpp \
+       addrlib/src/core/addrlib1.h \
+       addrlib/src/core/addrlib2.cpp \
+       addrlib/src/core/addrlib2.h \
+       addrlib/src/core/addrobject.cpp \
+       addrlib/src/core/addrobject.h \
+       addrlib/src/core/coord.cpp \
+       addrlib/src/core/coord.h \
+       addrlib/src/gfx9/gfx9addrlib.cpp \
+       addrlib/src/gfx9/gfx9addrlib.h \
+       addrlib/src/chip/gfx9/gfx9_gb_reg.h \
+       addrlib/src/chip/r800/si_gb_reg.h \
+       addrlib/src/r800/chip/si_ci_vi_merged_enum.h \
+       addrlib/src/r800/ciaddrlib.cpp \
+       addrlib/src/r800/ciaddrlib.h \
+       addrlib/src/r800/egbaddrlib.cpp \
+       addrlib/src/r800/egbaddrlib.h \
+       addrlib/src/r800/siaddrlib.cpp \
+       addrlib/src/r800/siaddrlib.h
 
 AMD_COMPILER_FILES = \
        common/ac_binary.c \
diff --git a/src/amd/addrlib/addrinterface.cpp b/src/amd/addrlib/addrinterface.cpp
deleted file mode 100644 (file)
index 9cbeba4..0000000
+++ /dev/null
@@ -1,1743 +0,0 @@
-/*
- * Copyright © 2014 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  addrinterface.cpp
-* @brief Contains the addrlib interface functions
-****************************************************************************************************
-*/
-#include "addrinterface.h"
-#include "addrlib1.h"
-#include "addrlib2.h"
-
-#include "addrcommon.h"
-
-#include "util/macros.h"
-
-using namespace Addr;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Create/Destroy/Config functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrCreate
-*
-*   @brief
-*       Create address lib object
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrCreate(
-    const ADDR_CREATE_INPUT*    pAddrCreateIn,  ///< [in] infomation for creating address lib object
-    ADDR_CREATE_OUTPUT*         pAddrCreateOut) ///< [out] address lib handle
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    returnCode = Lib::Create(pAddrCreateIn, pAddrCreateOut);
-
-    return returnCode;
-}
-
-
-
-/**
-****************************************************************************************************
-*   AddrDestroy
-*
-*   @brief
-*       Destroy address lib object
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrDestroy(
-    ADDR_HANDLE hLib) ///< address lib handle
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (hLib)
-    {
-        Lib* pLib = Lib::GetLib(hLib);
-        pLib->Destroy();
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                    Surface functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrComputeSurfaceInfo
-*
-*   @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 AddrComputeSurfaceInfo(
-    ADDR_HANDLE                             hLib, ///< address lib handle
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,  ///< [in] surface information
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut) ///< [out] surface parameters and alignments
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeSurfaceInfo(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-
-
-/**
-****************************************************************************************************
-*   AddrComputeSurfaceAddrFromCoord
-*
-*   @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 AddrComputeSurfaceAddrFromCoord(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,  ///< [in] surface info and coordinates
-    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) ///< [out] surface address
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeSurfaceAddrFromCoord(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeSurfaceCoordFromAddr
-*
-*   @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 AddrComputeSurfaceCoordFromAddr(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,  ///< [in] surface info and address
-    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut) ///< [out] coordinates
-{
-    V1::Lib* pLib = V1::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
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrComputeHtileInfo
-*
-*   @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 AddrComputeHtileInfo(
-    ADDR_HANDLE                             hLib, ///< address lib handle
-    const ADDR_COMPUTE_HTILE_INFO_INPUT*    pIn,  ///< [in] Htile information
-    ADDR_COMPUTE_HTILE_INFO_OUTPUT*         pOut) ///< [out] Htile pitch, height and size in bytes
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeHtileInfo(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeHtileAddrFromCoord
-*
-*   @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 AddrComputeHtileAddrFromCoord(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,  ///< [in] Htile info and coordinates
-    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut) ///< [out] Htile address
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeHtileAddrFromCoord(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeHtileCoordFromAddr
-*
-*   @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 AddrComputeHtileCoordFromAddr(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,  ///< [in] Htile info and address
-    ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut) ///< [out] Htile coordinates
-{
-    V1::Lib* pLib = V1::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
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrComputeCmaskInfo
-*
-*   @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 AddrComputeCmaskInfo(
-    ADDR_HANDLE                             hLib, ///< address lib handle
-    const ADDR_COMPUTE_CMASK_INFO_INPUT*    pIn,  ///< [in] Cmask pitch and height
-    ADDR_COMPUTE_CMASK_INFO_OUTPUT*         pOut) ///< [out] Cmask pitch, height and size in bytes
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeCmaskInfo(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeCmaskAddrFromCoord
-*
-*   @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 AddrComputeCmaskAddrFromCoord(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,  ///< [in] Cmask info and coordinates
-    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut) ///< [out] Cmask address
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeCmaskAddrFromCoord(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeCmaskCoordFromAddr
-*
-*   @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 AddrComputeCmaskCoordFromAddr(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,  ///< [in] Cmask info and address
-    ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut) ///< [out] Cmask coordinates
-{
-    V1::Lib* pLib = V1::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
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrComputeFmaskInfo
-*
-*   @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 AddrComputeFmaskInfo(
-    ADDR_HANDLE                             hLib, ///< address lib handle
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,  ///< [in] Fmask information
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut) ///< [out] Fmask pitch and height
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeFmaskInfo(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeFmaskAddrFromCoord
-*
-*   @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 AddrComputeFmaskAddrFromCoord(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,  ///< [in] Fmask info and coordinates
-    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut) ///< [out] Fmask address
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeFmaskAddrFromCoord(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeFmaskCoordFromAddr
-*
-*   @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 AddrComputeFmaskCoordFromAddr(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,  ///< [in] Fmask info and address
-    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut) ///< [out] Fmask coordinates
-{
-    V1::Lib* pLib = V1::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
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrComputeDccInfo
-*
-*   @brief
-*       Compute DCC key size, base alignment based on color surface size, tile info or tile index
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo(
-    ADDR_HANDLE                             hLib,   ///< handle of addrlib
-    const ADDR_COMPUTE_DCCINFO_INPUT*       pIn,    ///< [in] input
-    ADDR_COMPUTE_DCCINFO_OUTPUT*            pOut)   ///< [out] output
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeDccInfo(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Below functions are element related or helper functions
-///////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrGetVersion
-*
-*   @brief
-*       Get AddrLib version number. Client may check this return value against ADDRLIB_VERSION
-*       defined in addrinterface.h to see if there is a mismatch.
-****************************************************************************************************
-*/
-UINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib)
-{
-    UINT_32 version = 0;
-
-    Addr::Lib* pLib = Lib::GetLib(hLib);
-
-    ADDR_ASSERT(pLib != NULL);
-
-    if (pLib)
-    {
-        version = pLib->GetVersion();
-    }
-
-    return version;
-}
-
-/**
-****************************************************************************************************
-*   AddrUseTileIndex
-*
-*   @brief
-*       Return TRUE if tileIndex is enabled in this address library
-****************************************************************************************************
-*/
-BOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib)
-{
-    BOOL_32 useTileIndex = FALSE;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_ASSERT(pLib != NULL);
-
-    if (pLib)
-    {
-        useTileIndex = pLib->UseTileIndex(0);
-    }
-
-    return useTileIndex;
-}
-
-/**
-****************************************************************************************************
-*   AddrUseCombinedSwizzle
-*
-*   @brief
-*       Return TRUE if combined swizzle is enabled in this address library
-****************************************************************************************************
-*/
-BOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib)
-{
-    BOOL_32 useCombinedSwizzle = FALSE;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_ASSERT(pLib != NULL);
-
-    if (pLib)
-    {
-        useCombinedSwizzle = pLib->UseCombinedSwizzle();
-    }
-
-    return useCombinedSwizzle;
-}
-
-/**
-****************************************************************************************************
-*   AddrExtractBankPipeSwizzle
-*
-*   @brief
-*       Extract Bank and Pipe swizzle from base256b
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle(
-    ADDR_HANDLE                                 hLib,     ///< addrlib handle
-    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,      ///< [in] input structure
-    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut)     ///< [out] output structure
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ExtractBankPipeSwizzle(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrCombineBankPipeSwizzle
-*
-*   @brief
-*       Combine Bank and Pipe swizzle
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle(
-    ADDR_HANDLE                                 hLib,
-    const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,
-    ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT*       pOut)
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->CombineBankPipeSwizzle(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeSliceSwizzle
-*
-*   @brief
-*       Compute a swizzle for slice from a base swizzle
-*   @return
-*       ADDR_OK if no error
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle(
-    ADDR_HANDLE                                 hLib,
-    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*      pIn,
-    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*           pOut)
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeSliceTileSwizzle(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputeBaseSwizzle
-*
-*   @brief
-*       Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
-*   @return
-*       ADDR_OK if no error
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
-    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT*       pOut)
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeBaseSwizzle(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   ElemFlt32ToDepthPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a depth/stencil pixel value
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel(
-    ADDR_HANDLE                         hLib,    ///< addrlib handle
-    const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,     ///< [in] per-component value
-    ELEM_FLT32TODEPTHPIXEL_OUTPUT*      pOut)    ///< [out] final pixel value
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    Lib* pLib = Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        pLib->Flt32ToDepthPixel(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   ElemFlt32ToColorPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel(
-    ADDR_HANDLE                         hLib,    ///< addrlib handle
-    const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,     ///< [in] format, surface number and swap value
-    ELEM_FLT32TOCOLORPIXEL_OUTPUT*      pOut)    ///< [out] final pixel value
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    Lib* pLib = Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        pLib->Flt32ToColorPixel(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   ElemGetExportNorm
-*
-*   @brief
-*       Helper function to check one format can be EXPORT_NUM,
-*       which is a register CB_COLOR_INFO.SURFACE_FORMAT.
-*       FP16 can be reported as EXPORT_NORM for rv770 in r600
-*       family
-*
-****************************************************************************************************
-*/
-BOOL_32 ADDR_API ElemGetExportNorm(
-    ADDR_HANDLE                     hLib, ///< addrlib handle
-    const ELEM_GETEXPORTNORM_INPUT* pIn)  ///< [in] input structure
-{
-    Addr::Lib* pLib = Lib::GetLib(hLib);
-    BOOL_32 enabled = FALSE;
-
-    MAYBE_UNUSED ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        enabled = pLib->GetExportNorm(pIn);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    ADDR_ASSERT(returnCode == ADDR_OK);
-
-    return enabled;
-}
-
-/**
-****************************************************************************************************
-*   AddrConvertTileInfoToHW
-*
-*   @brief
-*       Convert tile info from real value to hardware register value
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW(
-    ADDR_HANDLE                             hLib, ///< address lib handle
-    const ADDR_CONVERT_TILEINFOTOHW_INPUT*  pIn,  ///< [in] tile info with real value
-    ADDR_CONVERT_TILEINFOTOHW_OUTPUT*       pOut) ///< [out] tile info with HW register value
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ConvertTileInfoToHW(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrConvertTileIndex
-*
-*   @brief
-*       Convert tile index to tile mode/type/info
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
-    ADDR_HANDLE                          hLib, ///< address lib handle
-    const ADDR_CONVERT_TILEINDEX_INPUT*  pIn,  ///< [in] input - tile index
-    ADDR_CONVERT_TILEINDEX_OUTPUT*       pOut) ///< [out] tile mode/type/info
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ConvertTileIndex(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrGetMacroModeIndex
-*
-*   @brief
-*       Get macro mode index based on input parameters
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
-    ADDR_HANDLE                          hLib, ///< address lib handle
-    const ADDR_GET_MACROMODEINDEX_INPUT* pIn,  ///< [in] input
-    ADDR_GET_MACROMODEINDEX_OUTPUT*      pOut) ///< [out] macro mode index
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->GetMacroModeIndex(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrConvertTileIndex1
-*
-*   @brief
-*       Convert tile index to tile mode/type/info
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1(
-    ADDR_HANDLE                          hLib, ///< address lib handle
-    const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,  ///< [in] input - tile index
-    ADDR_CONVERT_TILEINDEX_OUTPUT*       pOut) ///< [out] tile mode/type/info
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ConvertTileIndex1(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrGetTileIndex
-*
-*   @brief
-*       Get tile index from tile mode/type/info
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-*
-*   @note
-*       Only meaningful for SI (and above)
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetTileIndex(
-    ADDR_HANDLE                     hLib,
-    const ADDR_GET_TILEINDEX_INPUT* pIn,
-    ADDR_GET_TILEINDEX_OUTPUT*      pOut)
-{
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->GetTileIndex(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrComputePrtInfo
-*
-*   @brief
-*       Interface function for ComputePrtInfo
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo(
-    ADDR_HANDLE                 hLib,
-    const ADDR_PRT_INFO_INPUT*  pIn,
-    ADDR_PRT_INFO_OUTPUT*       pOut)
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    V1::Lib* pLib = V1::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputePrtInfo(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrGetMaxAlignments
-*
-*   @brief
-*       Convert maximum alignments
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
-    ADDR_HANDLE                     hLib, ///< address lib handle
-    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) ///< [out] output structure
-{
-    Addr::Lib* pLib = Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->GetMaxAlignments(pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   AddrGetMaxMetaAlignments
-*
-*   @brief
-*       Convert maximum alignments for metadata
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetMaxMetaAlignments(
-    ADDR_HANDLE                     hLib, ///< address lib handle
-    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) ///< [out] output structure
-{
-    Addr::Lib* pLib = Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->GetMaxMetaAlignments(pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    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;
-}
-
-/**
-****************************************************************************************************
-*   Addr2ComputeDccAddrFromCoord
-*
-*   @brief
-*       Compute DCC key address according to coordinates
-*
-*   @return
-*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccAddrFromCoord(
-    ADDR_HANDLE                                     hLib, ///< address lib handle
-    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT*    pIn,  ///< [in] Dcc info and coordinates
-    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*         pOut) ///< [out] Dcc address
-{
-    V2::Lib* pLib = V2::Lib::GetLib(hLib);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeDccAddrFromCoord(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;
-}
-
-/**
-****************************************************************************************************
-*   Addr2ComputeSlicePipeBankXor
-*
-*   @brief
-*       Calculate slice pipe bank xor value based on base pipe bank xor and slice id.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2ComputeSlicePipeBankXor(
-    ADDR_HANDLE                                  hLib, ///< handle of addrlib
-    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,  ///< [in] input
-    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) ///< [out] output
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    V2::Lib* pLib = V2::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeSlicePipeBankXor(pIn, pOut);
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Addr2ComputeSubResourceOffsetForSwizzlePattern
-*
-*   @brief
-*       Calculate sub resource offset for swizzle pattern.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2ComputeSubResourceOffsetForSwizzlePattern(
-    ADDR_HANDLE                                                     hLib, ///< handle of addrlib
-    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,  ///< [in] input
-    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) ///< [out] output
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    V2::Lib* pLib = V2::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        returnCode = pLib->ComputeSubResourceOffsetForSwizzlePattern(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;
-}
-
-/**
-****************************************************************************************************
-*   Addr2IsValidDisplaySwizzleMode
-*
-*   @brief
-*       Return whether the swizzle mode is supported by DCE / DCN.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
-    ADDR_HANDLE     hLib,
-    AddrSwizzleMode swizzleMode,
-    UINT_32         bpp,
-    bool            *result)
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    V2::Lib* pLib = V2::Lib::GetLib(hLib);
-
-    if (pLib != NULL)
-    {
-        ADDR2_COMPUTE_SURFACE_INFO_INPUT in;
-        in.swizzleMode = swizzleMode;
-        in.bpp = bpp;
-
-        *result = pLib->IsValidDisplaySwizzleMode(&in);
-        returnCode = ADDR_OK;
-    }
-    else
-    {
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
diff --git a/src/amd/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
deleted file mode 100644 (file)
index be9e5c2..0000000
+++ /dev/null
@@ -1,3717 +0,0 @@
-/*
- * Copyright © 2014 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  addrinterface.h
-* @brief Contains the addrlib interfaces declaration and parameter defines
-****************************************************************************************************
-*/
-#ifndef __ADDR_INTERFACE_H__
-#define __ADDR_INTERFACE_H__
-
-#include "addrtypes.h"
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#define ADDRLIB_VERSION_MAJOR 6
-#define ADDRLIB_VERSION_MINOR 2
-#define ADDRLIB_VERSION ((ADDRLIB_VERSION_MAJOR << 16) | ADDRLIB_VERSION_MINOR)
-
-/// Virtually all interface functions need ADDR_HANDLE as first parameter
-typedef VOID*   ADDR_HANDLE;
-
-/// Client handle used in callbacks
-typedef VOID*   ADDR_CLIENT_HANDLE;
-
-/**
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                                  Callback functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*    typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)(
-*         const ADDR_ALLOCSYSMEM_INPUT* pInput);
-*    typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)(
-*         VOID* pVirtAddr);
-*    typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)(
-*         const ADDR_DEBUGPRINT_INPUT* pInput);
-*
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                               Create/Destroy/Config functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*     AddrCreate()
-*     AddrDestroy()
-*
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                                  Surface functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*     AddrComputeSurfaceInfo()
-*     AddrComputeSurfaceAddrFromCoord()
-*     AddrComputeSurfaceCoordFromAddr()
-*
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                                   HTile functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*     AddrComputeHtileInfo()
-*     AddrComputeHtileAddrFromCoord()
-*     AddrComputeHtileCoordFromAddr()
-*
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                                   C-mask functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*     AddrComputeCmaskInfo()
-*     AddrComputeCmaskAddrFromCoord()
-*     AddrComputeCmaskCoordFromAddr()
-*
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                                   F-mask functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*     AddrComputeFmaskInfo()
-*     AddrComputeFmaskAddrFromCoord()
-*     AddrComputeFmaskCoordFromAddr()
-*
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-* //                               Element/Utility functions
-* /////////////////////////////////////////////////////////////////////////////////////////////////
-*     ElemFlt32ToDepthPixel()
-*     ElemFlt32ToColorPixel()
-*     AddrExtractBankPipeSwizzle()
-*     AddrCombineBankPipeSwizzle()
-*     AddrComputeSliceSwizzle()
-*     AddrConvertTileInfoToHW()
-*     AddrConvertTileIndex()
-*     AddrConvertTileIndex1()
-*     AddrGetTileIndex()
-*     AddrComputeBaseSwizzle()
-*     AddrUseTileIndex()
-*     AddrUseCombinedSwizzle()
-*
-**/
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                      Callback functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-* @brief channel setting structure
-****************************************************************************************************
-*/
-typedef union _ADDR_CHANNEL_SETTING
-{
-    struct
-    {
-        UINT_8 valid   : 1;    ///< Indicate whehter this channel setting is valid
-        UINT_8 channel : 2;    ///< 0 for x channel, 1 for y channel, 2 for z channel
-        UINT_8 index   : 5;    ///< Channel index
-    };
-    UINT_8 value;              ///< Value
-} ADDR_CHANNEL_SETTING;
-
-/**
-****************************************************************************************************
-* @brief address equation key structure
-****************************************************************************************************
-*/
-typedef union _ADDR_EQUATION_KEY
-{
-    struct
-    {
-        UINT_32 log2ElementBytes : 3; ///< Log2 of Bytes per pixel
-        UINT_32 tileMode         : 5; ///< Tile mode
-        UINT_32 microTileType    : 3; ///< Micro tile type
-        UINT_32 pipeConfig       : 5; ///< pipe config
-        UINT_32 numBanksLog2     : 3; ///< Number of banks log2
-        UINT_32 bankWidth        : 4; ///< Bank width
-        UINT_32 bankHeight       : 4; ///< Bank height
-        UINT_32 macroAspectRatio : 3; ///< Macro tile aspect ratio
-        UINT_32 prt              : 1; ///< SI only, indicate whether this equation is for prt
-        UINT_32 reserved         : 1; ///< Reserved bit
-    } fields;
-    UINT_32 value;
-} ADDR_EQUATION_KEY;
-
-/**
-****************************************************************************************************
-* @brief address equation structure
-****************************************************************************************************
-*/
-#define ADDR_MAX_EQUATION_BIT 20u
-
-// Invalid equation index
-#define ADDR_INVALID_EQUATION_INDEX 0xFFFFFFFF
-
-typedef struct _ADDR_EQUATION
-{
-    ADDR_CHANNEL_SETTING addr[ADDR_MAX_EQUATION_BIT];  ///< addr setting
-                                                       ///< each bit is result of addr ^ xor ^ xor2
-    ADDR_CHANNEL_SETTING xor1[ADDR_MAX_EQUATION_BIT];  ///< xor setting
-    ADDR_CHANNEL_SETTING xor2[ADDR_MAX_EQUATION_BIT];  ///< xor2 setting
-    UINT_32              numBits;                      ///< The number of bits in equation
-    BOOL_32              stackedDepthSlices;           ///< TRUE if depth slices are treated as being
-                                                       ///< stacked vertically prior to swizzling
-} ADDR_EQUATION;
-
-
-/**
-****************************************************************************************************
-* @brief Alloc system memory flags.
-* @note These flags are reserved for future use and if flags are added will minimize the impact
-*       of the client.
-****************************************************************************************************
-*/
-typedef union _ADDR_ALLOCSYSMEM_FLAGS
-{
-    struct
-    {
-        UINT_32 reserved    : 32;  ///< Reserved for future use.
-    } fields;
-    UINT_32 value;
-
-} ADDR_ALLOCSYSMEM_FLAGS;
-
-/**
-****************************************************************************************************
-* @brief Alloc system memory input structure
-****************************************************************************************************
-*/
-typedef struct _ADDR_ALLOCSYSMEM_INPUT
-{
-    UINT_32                 size;           ///< Size of this structure in bytes
-
-    ADDR_ALLOCSYSMEM_FLAGS  flags;          ///< System memory flags.
-    UINT_32                 sizeInBytes;    ///< System memory allocation size in bytes.
-    ADDR_CLIENT_HANDLE      hClient;        ///< Client handle
-} ADDR_ALLOCSYSMEM_INPUT;
-
-/**
-****************************************************************************************************
-* ADDR_ALLOCSYSMEM
-*   @brief
-*       Allocate system memory callback function. Returns valid pointer on success.
-****************************************************************************************************
-*/
-typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)(
-    const ADDR_ALLOCSYSMEM_INPUT* pInput);
-
-/**
-****************************************************************************************************
-* @brief Free system memory input structure
-****************************************************************************************************
-*/
-typedef struct _ADDR_FREESYSMEM_INPUT
-{
-    UINT_32                 size;           ///< Size of this structure in bytes
-
-    VOID*                   pVirtAddr;      ///< Virtual address
-    ADDR_CLIENT_HANDLE      hClient;        ///< Client handle
-} ADDR_FREESYSMEM_INPUT;
-
-/**
-****************************************************************************************************
-* ADDR_FREESYSMEM
-*   @brief
-*       Free system memory callback function.
-*       Returns ADDR_OK on success.
-****************************************************************************************************
-*/
-typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)(
-    const ADDR_FREESYSMEM_INPUT* pInput);
-
-/**
-****************************************************************************************************
-* @brief Print debug message input structure
-****************************************************************************************************
-*/
-typedef struct _ADDR_DEBUGPRINT_INPUT
-{
-    UINT_32             size;           ///< Size of this structure in bytes
-
-    CHAR*               pDebugString;   ///< Debug print string
-    va_list             ap;             ///< Variable argument list
-    ADDR_CLIENT_HANDLE  hClient;        ///< Client handle
-} ADDR_DEBUGPRINT_INPUT;
-
-/**
-****************************************************************************************************
-* ADDR_DEBUGPRINT
-*   @brief
-*       Print debug message callback function.
-*       Returns ADDR_OK on success.
-****************************************************************************************************
-*/
-typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)(
-    const ADDR_DEBUGPRINT_INPUT* pInput);
-
-/**
-****************************************************************************************************
-* ADDR_CALLBACKS
-*
-*   @brief
-*       Address Library needs client to provide system memory alloc/free routines.
-****************************************************************************************************
-*/
-typedef struct _ADDR_CALLBACKS
-{
-    ADDR_ALLOCSYSMEM allocSysMem;   ///< Routine to allocate system memory
-    ADDR_FREESYSMEM  freeSysMem;    ///< Routine to free system memory
-    ADDR_DEBUGPRINT  debugPrint;    ///< Routine to print debug message
-} ADDR_CALLBACKS;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Create/Destroy functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-* ADDR_CREATE_FLAGS
-*
-*   @brief
-*       This structure is used to pass some setup in creation of AddrLib
-*   @note
-****************************************************************************************************
-*/
-typedef union _ADDR_CREATE_FLAGS
-{
-    struct
-    {
-        UINT_32 noCubeMipSlicesPad     : 1;    ///< Turn cubemap faces padding off
-        UINT_32 fillSizeFields         : 1;    ///< If clients fill size fields in all input and
-                                               ///  output structure
-        UINT_32 useTileIndex           : 1;    ///< Make tileIndex field in input valid
-        UINT_32 useCombinedSwizzle     : 1;    ///< Use combined tile swizzle
-        UINT_32 checkLast2DLevel       : 1;    ///< Check the last 2D mip sub level
-        UINT_32 useHtileSliceAlign     : 1;    ///< Do htile single slice alignment
-        UINT_32 allowLargeThickTile    : 1;    ///< Allow 64*thickness*bytesPerPixel > rowSize
-        UINT_32 reserved               : 25;   ///< Reserved bits for future use
-    };
-
-    UINT_32 value;
-} ADDR_CREATE_FLAGS;
-
-/**
-****************************************************************************************************
-*   ADDR_REGISTER_VALUE
-*
-*   @brief
-*       Data from registers to setup AddrLib global data, used in AddrCreate
-****************************************************************************************************
-*/
-typedef struct _ADDR_REGISTER_VALUE
-{
-    UINT_32  gbAddrConfig;       ///< For R8xx, use GB_ADDR_CONFIG register value.
-                                 ///  For R6xx/R7xx, use GB_TILING_CONFIG.
-                                 ///  But they can be treated as the same.
-                                 ///  if this value is 0, use chip to set default value
-    UINT_32  backendDisables;    ///< 1 bit per backend, starting with LSB. 1=disabled,0=enabled.
-                                 ///  Register value of CC_RB_BACKEND_DISABLE.BACKEND_DISABLE
-
-                                 ///  R800 registers-----------------------------------------------
-    UINT_32  noOfBanks;          ///< Number of h/w ram banks - For r800: MC_ARB_RAMCFG.NOOFBANK
-                                 ///  No enums for this value in h/w header files
-                                 ///  0: 4
-                                 ///  1: 8
-                                 ///  2: 16
-    UINT_32  noOfRanks;          ///  MC_ARB_RAMCFG.NOOFRANK
-                                 ///  0: 1
-                                 ///  1: 2
-                                 ///  SI (R1000) registers-----------------------------------------
-    const UINT_32* pTileConfig;  ///< Global tile setting tables
-    UINT_32  noOfEntries;        ///< Number of entries in pTileConfig
-
-                                 ///< 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;
-
-/**
-****************************************************************************************************
-* ADDR_CREATE_INPUT
-*
-*   @brief
-*       Parameters use to create an AddrLib Object. Caller must provide all fields.
-*
-****************************************************************************************************
-*/
-typedef struct _ADDR_CREATE_INPUT
-{
-    UINT_32             size;                ///< Size of this structure in bytes
-
-    UINT_32             chipEngine;          ///< Chip Engine
-    UINT_32             chipFamily;          ///< Chip Family
-    UINT_32             chipRevision;        ///< Chip Revision
-    ADDR_CALLBACKS      callbacks;           ///< Callbacks for sysmem alloc/free/print
-    ADDR_CREATE_FLAGS   createFlags;         ///< Flags to setup AddrLib
-    ADDR_REGISTER_VALUE regValue;            ///< Data from registers to setup AddrLib global data
-    ADDR_CLIENT_HANDLE  hClient;             ///< Client handle
-    UINT_32             minPitchAlignPixels; ///< Minimum pitch alignment in pixels
-} ADDR_CREATE_INPUT;
-
-/**
-****************************************************************************************************
-* ADDR_CREATEINFO_OUTPUT
-*
-*   @brief
-*       Return AddrLib handle to client driver
-*
-****************************************************************************************************
-*/
-typedef struct _ADDR_CREATE_OUTPUT
-{
-    UINT_32              size;            ///< Size of this structure in bytes
-
-    ADDR_HANDLE          hLib;            ///< Address lib handle
-
-    UINT_32              numEquations;    ///< Number of equations in the table
-    const ADDR_EQUATION* pEquationTable;  ///< Pointer to the equation table
-} ADDR_CREATE_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrCreate
-*
-*   @brief
-*       Create AddrLib object, must be called before any interface calls
-*
-*   @return
-*       ADDR_OK if successful
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrCreate(
-    const ADDR_CREATE_INPUT*    pAddrCreateIn,
-    ADDR_CREATE_OUTPUT*         pAddrCreateOut);
-
-
-
-/**
-****************************************************************************************************
-*   AddrDestroy
-*
-*   @brief
-*       Destroy AddrLib object, must be called to free internally allocated resources.
-*
-*   @return
-*      ADDR_OK if successful
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrDestroy(
-    ADDR_HANDLE hLib);
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                    Surface functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-* @brief
-*       Bank/tiling parameters. On function input, these can be set as desired or
-*       left 0 for AddrLib to calculate/default. On function output, these are the actual
-*       parameters used.
-* @note
-*       Valid bankWidth/bankHeight value:
-*       1,2,4,8. They are factors instead of pixels or bytes.
-*
-*       The bank number remains constant across each row of the
-*       macro tile as each pipe is selected, so the number of
-*       tiles in the x direction with the same bank number will
-*       be bank_width * num_pipes.
-****************************************************************************************************
-*/
-typedef struct _ADDR_TILEINFO
-{
-    ///  Any of these parameters can be set to 0 to use the HW default.
-    UINT_32     banks;              ///< Number of banks, numerical value
-    UINT_32     bankWidth;          ///< Number of tiles in the X direction in the same bank
-    UINT_32     bankHeight;         ///< Number of tiles in the Y direction in the same bank
-    UINT_32     macroAspectRatio;   ///< Macro tile aspect ratio. 1-1:1, 2-4:1, 4-16:1, 8-64:1
-    UINT_32     tileSplitBytes;     ///< Tile split size, in bytes
-    AddrPipeCfg pipeConfig;         ///< Pipe Config = HW enum + 1
-} ADDR_TILEINFO;
-
-// Create a define to avoid client change. The removal of R800 is because we plan to implement SI
-// within 800 HWL - An AddrPipeCfg is added in above data structure
-typedef ADDR_TILEINFO ADDR_R800_TILEINFO;
-
-/**
-****************************************************************************************************
-* @brief
-*       Information needed by quad buffer stereo support
-****************************************************************************************************
-*/
-typedef struct _ADDR_QBSTEREOINFO
-{
-    UINT_32         eyeHeight;          ///< Height (in pixel rows) to right eye
-    UINT_32         rightOffset;        ///< Offset (in bytes) to right eye
-    UINT_32         rightSwizzle;       ///< TileSwizzle for right eyes
-} ADDR_QBSTEREOINFO;
-
-/**
-****************************************************************************************************
-*   ADDR_SURFACE_FLAGS
-*
-*   @brief
-*       Surface flags
-****************************************************************************************************
-*/
-typedef union _ADDR_SURFACE_FLAGS
-{
-    struct
-    {
-        UINT_32 color                : 1; ///< Flag indicates this is a color buffer
-        UINT_32 depth                : 1; ///< Flag indicates this is a depth/stencil buffer
-        UINT_32 stencil              : 1; ///< Flag indicates this is a stencil buffer
-        UINT_32 texture              : 1; ///< Flag indicates this is a texture
-        UINT_32 cube                 : 1; ///< Flag indicates this is a cubemap
-        UINT_32 volume               : 1; ///< Flag indicates this is a volume texture
-        UINT_32 fmask                : 1; ///< Flag indicates this is an fmask
-        UINT_32 cubeAsArray          : 1; ///< Flag indicates if treat cubemap as arrays
-        UINT_32 compressZ            : 1; ///< Flag indicates z buffer is compressed
-        UINT_32 overlay              : 1; ///< Flag indicates this is an overlay surface
-        UINT_32 noStencil            : 1; ///< Flag indicates this depth has no separate stencil
-        UINT_32 display              : 1; ///< Flag indicates this should match display controller req.
-        UINT_32 opt4Space            : 1; ///< Flag indicates this surface should be optimized for space
-                                          ///  i.e. save some memory but may lose performance
-        UINT_32 prt                  : 1; ///< Flag for partially resident texture
-        UINT_32 qbStereo             : 1; ///< Quad buffer stereo surface
-        UINT_32 pow2Pad              : 1; ///< SI: Pad to pow2, must set for mipmap (include level0)
-        UINT_32 interleaved          : 1; ///< Special flag for interleaved YUV surface padding
-        UINT_32 tcCompatible         : 1; ///< Flag indicates surface needs to be shader readable
-        UINT_32 dispTileType         : 1; ///< NI: force display Tiling for 128 bit shared resoruce
-        UINT_32 dccCompatible        : 1; ///< VI: whether to make MSAA surface support dcc fast clear
-        UINT_32 dccPipeWorkaround    : 1; ///< VI: whether to workaround the HW limit that
-                                          ///  dcc can't be enabled if pipe config of tile mode
-                                          ///  is different from that of ASIC, this flag
-                                          ///  is address lib internal flag, client should ignore it
-        UINT_32 czDispCompatible     : 1; ///< SI+: CZ family has a HW bug needs special alignment.
-                                          ///  This flag indicates we need to follow the
-                                          ///  alignment with CZ families or other ASICs under
-                                          ///  PX configuration + CZ.
-        UINT_32 nonSplit             : 1; ///< CI: depth texture should not be split
-        UINT_32 disableLinearOpt     : 1; ///< Disable tile mode optimization to linear
-        UINT_32 needEquation         : 1; ///< Make the surface tile setting equation compatible.
-                                          ///  This flag indicates we need to override tile
-                                          ///  mode to PRT_* tile mode to disable slice rotation,
-                                          ///  which is needed by swizzle pattern equation.
-        UINT_32 skipIndicesOutput    : 1; ///< Skipping indices in output.
-        UINT_32 rotateDisplay        : 1; ///< Rotate micro tile type
-        UINT_32 minimizeAlignment    : 1; ///< Minimize alignment
-        UINT_32 preferEquation       : 1; ///< Return equation index without adjusting tile mode
-        UINT_32 matchStencilTileCfg  : 1; ///< Select tile index of stencil as well as depth surface
-                                          ///  to make sure they share same tile config parameters
-        UINT_32 disallowLargeThickDegrade   : 1;    ///< Disallow large thick tile degrade
-        UINT_32 reserved             : 1; ///< Reserved bits
-    };
-
-    UINT_32 value;
-} ADDR_SURFACE_FLAGS;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SURFACE_INFO_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeSurfaceInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_SURFACE_INFO_INPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-
-    AddrTileMode        tileMode;           ///< Tile mode
-    AddrFormat          format;             ///< If format is set to valid one, bpp/width/height
-                                            ///  might be overwritten
-    UINT_32             bpp;                ///< Bits per pixel
-    UINT_32             numSamples;         ///< Number of samples
-    UINT_32             width;              ///< Width, in pixels
-    UINT_32             height;             ///< Height, in pixels
-    UINT_32             numSlices;          ///< Number of surface slices or depth
-    UINT_32             slice;              ///< Slice index
-    UINT_32             mipLevel;           ///< Current mipmap level
-    UINT_32             numMipLevels;       ///< Number of mips in mip chain
-    ADDR_SURFACE_FLAGS  flags;              ///< Surface type flags
-    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
-    /// r800 and later HWL parameters
-    // Needed by 2D tiling, for linear and 1D tiling, just keep them 0's
-    ADDR_TILEINFO*      pTileInfo;          ///< 2D tile parameters. Set to 0 to default/calculate
-    AddrTileType        tileType;           ///< Micro tiling type, not needed when tileIndex != -1
-    INT_32              tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
-                                            ///  while the global useTileIndex is set to 1
-    UINT_32             basePitch;          ///< Base level pitch in pixels, 0 means ignored, is a
-                                            ///  must for mip levels from SI+.
-                                            ///  Don't use pitch in blocks for compressed formats!
-    UINT_32             maxBaseAlign;       ///< Max base alignment request from client
-    UINT_32             pitchAlign;         ///< Pitch alignment request from client
-    UINT_32             heightAlign;        ///< Height alignment request from client
-} ADDR_COMPUTE_SURFACE_INFO_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SURFACE_INFO_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeSurfInfo
-*   @note
-        Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch
-        Pixel: Original pixel
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_SURFACE_INFO_OUTPUT
-{
-    UINT_32         size;           ///< Size of this structure in bytes
-
-    UINT_32         pitch;          ///< Pitch in elements (in blocks for compressed formats)
-    UINT_32         height;         ///< Height in elements (in blocks for compressed formats)
-    UINT_32         depth;          ///< Number of slice/depth
-    UINT_64         surfSize;       ///< Surface size in bytes
-    AddrTileMode    tileMode;       ///< Actual tile mode. May differ from that in input
-    UINT_32         baseAlign;      ///< Base address alignment
-    UINT_32         pitchAlign;     ///< Pitch alignment, in elements
-    UINT_32         heightAlign;    ///< Height alignment, in elements
-    UINT_32         depthAlign;     ///< Depth alignment, aligned to thickness, for 3d texture
-    UINT_32         bpp;            ///< Bits per elements (e.g. blocks for BCn, 1/3 for 96bit)
-    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_64         sliceSize;      ///< Size of slice specified by input's slice
-                                    ///  The result is controlled by surface flags & createFlags
-                                    ///  By default this value equals to surfSize for volume
-    UINT_32         pitchTileMax;   ///< PITCH_TILE_MAX value for h/w register
-    UINT_32         heightTileMax;  ///< HEIGHT_TILE_MAX value for h/w register
-    UINT_32         sliceTileMax;   ///< SLICE_TILE_MAX value for h/w register
-
-    UINT_32         numSamples;     ///< Pass the effective numSamples processed in this call
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*  pTileInfo;      ///< Tile parameters used. Filled in if 0 on input
-    AddrTileType    tileType;       ///< Micro tiling type, only valid when tileIndex != -1
-    INT_32          tileIndex;      ///< Tile index, MAY be "downgraded"
-
-    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
-    /// Output flags
-    struct
-    {
-        /// Special information to work around SI mipmap swizzle bug UBTS #317508
-        UINT_32     last2DLevel  : 1;  ///< TRUE if this is the last 2D(3D) tiled
-                                       ///< Only meaningful when create flag checkLast2DLevel is set
-        UINT_32     tcCompatible : 1;  ///< If the surface can be shader compatible
-        UINT_32     dccUnsupport : 1;  ///< If the surface can support DCC compressed rendering
-        UINT_32     prtTileIndex : 1;  ///< SI only, indicate the returned tile index is for PRT
-                                       ///< If address lib return true for mip 0, client should set prt flag
-                                       ///< for child mips in subsequent compute surface info calls
-        UINT_32     reserved     :28;  ///< Reserved bits
-    };
-
-    UINT_32         equationIndex;     ///< Equation index in the equation table;
-
-    UINT_32         blockWidth;        ///< Width in element inside one block(1D->Micro, 2D->Macro)
-    UINT_32         blockHeight;       ///< Height in element inside one block(1D->Micro, 2D->Macro)
-    UINT_32         blockSlices;       ///< Slice number inside one block(1D->Micro, 2D->Macro)
-
-    /// Stereo info
-    ADDR_QBSTEREOINFO*  pStereoInfo;///< Stereo information, needed when .qbStereo flag is TRUE
-
-    INT_32          stencilTileIdx; ///< stencil tile index output when matchStencilTileCfg was set
-} ADDR_COMPUTE_SURFACE_INFO_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeSurfaceInfo
-*
-*   @brief
-*       Compute surface width/height/depth/alignments and suitable tiling mode
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceInfo(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeSurfaceAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_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         bpp;                ///< Bits per pixel
-    UINT_32         pitch;              ///< Surface pitch, in pixels
-    UINT_32         height;             ///< Surface height, in pixels
-    UINT_32         numSlices;          ///< Surface depth
-    UINT_32         numSamples;         ///< Number of samples
-
-    AddrTileMode    tileMode;           ///< Tile mode
-    BOOL_32         isDepth;            ///< TRUE if the surface uses depth sample ordering within
-                                        ///  micro tile. Textures can also choose depth sample order
-    UINT_32         tileBase;           ///< Base offset (in bits) inside micro tile which handles
-                                        ///  the case that components are stored separately
-    UINT_32         compBits;           ///< The component bits actually needed(for planar surface)
-
-    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
-    /// r800 and later HWL parameters
-    // Used for 1D tiling above
-    AddrTileType    tileType;           ///< See defintion of AddrTileType
-    struct
-    {
-        UINT_32     ignoreSE : 1;       ///< TRUE if shader engines are ignored. This is texture
-                                        ///  only flag. Only non-RT texture can set this to TRUE
-        UINT_32     reserved :31;       ///< Reserved for future use.
-    };
-    // 2D tiling needs following structure
-    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Client must provide all data
-    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    union
-    {
-        struct
-        {
-            UINT_32  bankSwizzle;       ///< Bank swizzle
-            UINT_32  pipeSwizzle;       ///< Pipe swizzle
-        };
-        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
-    };
-} ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeSurfaceAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_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)
-} ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeSurfaceAddrFromCoord
-*
-*   @brief
-*       Compute surface address from a given coordinate.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceAddrFromCoord(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeSurfaceCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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;
-    UINT_32         bpp;                ///< Bits per pixel
-    UINT_32         pitch;              ///< Pitch, in pixels
-    UINT_32         height;             ///< Height in pixels
-    UINT_32         numSlices;          ///< Surface depth
-    UINT_32         numSamples;         ///< Number of samples
-
-    AddrTileMode    tileMode;           ///< Tile mode
-    BOOL_32         isDepth;            ///< Surface uses depth sample ordering within micro tile.
-                                        ///  Note: Textures can choose depth sample order as well.
-    UINT_32         tileBase;           ///< Base offset (in bits) inside micro tile which handles
-                                        ///  the case that components are stored separately
-    UINT_32         compBits;           ///< The component bits actually needed(for planar surface)
-
-    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
-    /// r800 and later HWL parameters
-    // Used for 1D tiling above
-    AddrTileType    tileType;           ///< See defintion of AddrTileType
-    struct
-    {
-        UINT_32     ignoreSE : 1;       ///< TRUE if shader engines are ignored. This is texture
-                                        ///  only flag. Only non-RT texture can set this to TRUE
-        UINT_32     reserved :31;       ///< Reserved for future use.
-    };
-    // 2D tiling needs following structure
-    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Client must provide all data
-    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    union
-    {
-        struct
-        {
-            UINT_32  bankSwizzle;       ///< Bank swizzle
-            UINT_32  pipeSwizzle;       ///< Pipe swizzle
-        };
-        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
-    };
-} ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeSurfaceCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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
-} ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeSurfaceCoordFromAddr
-*
-*   @brief
-*       Compute coordinate from a given surface address
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceCoordFromAddr(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
-    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut);
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                   HTile functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   ADDR_HTILE_FLAGS
-*
-*   @brief
-*       HTILE flags
-****************************************************************************************************
-*/
-typedef union _ADDR_HTILE_FLAGS
-{
-    struct
-    {
-        UINT_32 tcCompatible          : 1;  ///< Flag indicates surface needs to be shader readable
-        UINT_32 skipTcCompatSizeAlign : 1;  ///< Flag indicates that addrLib will not align htile
-                                            ///  size to 256xBankxPipe when computing tc-compatible
-                                            ///  htile info.
-        UINT_32 reserved              : 30; ///< Reserved bits
-    };
-
-    UINT_32 value;
-} ADDR_HTILE_FLAGS;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_HTILE_INFO_INPUT
-*
-*   @brief
-*       Input structure of AddrComputeHtileInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_HTILE_INFO_INPUT
-{
-    UINT_32            size;            ///< Size of this structure in bytes
-
-    ADDR_HTILE_FLAGS   flags;           ///< HTILE flags
-    UINT_32            pitch;           ///< Surface pitch, in pixels
-    UINT_32            height;          ///< Surface height, in pixels
-    UINT_32            numSlices;       ///< Number of slices
-    BOOL_32            isLinear;        ///< Linear or tiled HTILE layout
-    AddrHtileBlockSize blockWidth;      ///< 4 or 8. EG above only support 8
-    AddrHtileBlockSize blockHeight;     ///< 4 or 8. EG above only support 8
-    ADDR_TILEINFO*     pTileInfo;       ///< Tile info
-
-    INT_32             tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    INT_32             macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-                                        ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_HTILE_INFO_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_HTILE_INFO_OUTPUT
-*
-*   @brief
-*       Output structure of AddrComputeHtileInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_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_64 htileBytes;         ///< Size of HTILE buffer, in bytes
-    UINT_32 baseAlign;          ///< Base alignment
-    UINT_32 bpp;                ///< Bits per pixel for HTILE is how many bits for an 8x8 block!
-    UINT_32 macroWidth;         ///< Macro width in pixels, actually squared cache shape
-    UINT_32 macroHeight;        ///< Macro height in pixels
-    UINT_64 sliceSize;          ///< Slice size, in bytes.
-    BOOL_32 sliceInterleaved;   ///< Flag to indicate if different slice's htile is interleaved
-                                ///  Compute engine clear can't be used if htile is interleaved
-    BOOL_32 nextMipLevelCompressible;   ///< Flag to indicate whether HTILE can be enabled in
-                                        ///  next mip level, it also indicates if memory set based
-                                        ///  fast clear can be used for current mip level.
-} ADDR_COMPUTE_HTILE_INFO_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeHtileInfo
-*
-*   @brief
-*       Compute Htile pitch, height, base alignment and size in bytes
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeHtileInfo(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_HTILE_INFO_INPUT*    pIn,
-    ADDR_COMPUTE_HTILE_INFO_OUTPUT*         pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeHtileAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
-{
-    UINT_32            size;            ///< Size of this structure in bytes
-
-    UINT_32            pitch;           ///< Pitch, in pixels
-    UINT_32            height;          ///< Height in pixels
-    UINT_32            x;               ///< X coordinate
-    UINT_32            y;               ///< Y coordinate
-    UINT_32            slice;           ///< Index of slice
-    UINT_32            numSlices;       ///< Number of slices
-    BOOL_32            isLinear;        ///< Linear or tiled HTILE layout
-    ADDR_HTILE_FLAGS   flags;           ///< htile flags
-    AddrHtileBlockSize blockWidth;      ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
-    AddrHtileBlockSize blockHeight;     ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
-    ADDR_TILEINFO*     pTileInfo;       ///< Tile info
-
-    INT_32             tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    INT_32             macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-                                        ///< README: When tileIndex is not -1, this must be valid
-    UINT_32            bpp;             ///< depth/stencil buffer bit per pixel size
-    UINT_32            zStencilAddr;    ///< tcCompatible Z/Stencil surface address
-} ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeHtileAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
-{
-    UINT_32 size;           ///< Size of this structure in bytes
-
-    UINT_64 addr;           ///< Address in bytes
-    UINT_32 bitPosition;    ///< Bit position, 0 or 4. CMASK and HTILE shares some lib method.
-                            ///  So we keep bitPosition for HTILE as well
-} ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeHtileAddrFromCoord
-*
-*   @brief
-*       Compute Htile address according to coordinates (of depth buffer)
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeHtileAddrFromCoord(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,
-    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeHtileCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
-{
-    UINT_32            size;            ///< Size of this structure in bytes
-
-    UINT_64            addr;            ///< Address
-    UINT_32            bitPosition;     ///< Bit position 0 or 4. CMASK and HTILE share some methods
-                                        ///  so we keep bitPosition for HTILE as well
-    UINT_32            pitch;           ///< Pitch, in pixels
-    UINT_32            height;          ///< Height, in pixels
-    UINT_32            numSlices;       ///< Number of slices
-    BOOL_32            isLinear;        ///< Linear or tiled HTILE layout
-    AddrHtileBlockSize blockWidth;      ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
-    AddrHtileBlockSize blockHeight;     ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
-    ADDR_TILEINFO*     pTileInfo;       ///< Tile info
-
-    INT_32             tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    INT_32             macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-                                        ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeHtileCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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;  ///< Slice index
-} ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeHtileCoordFromAddr
-*
-*   @brief
-*       Compute coordinates within depth buffer (1st pixel of a micro tile) according to
-*       Htile address
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeHtileCoordFromAddr(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,
-    ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut);
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                     C-mask functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   ADDR_CMASK_FLAGS
-*
-*   @brief
-*       CMASK flags
-****************************************************************************************************
-*/
-typedef union _ADDR_CMASK_FLAGS
-{
-    struct
-    {
-        UINT_32 tcCompatible  : 1; ///< Flag indicates surface needs to be shader readable
-        UINT_32 reserved      :31; ///< Reserved bits
-    };
-
-    UINT_32 value;
-} ADDR_CMASK_FLAGS;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_CMASK_INFO_INPUT
-*
-*   @brief
-*       Input structure of AddrComputeCmaskInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_CMASKINFO_INPUT
-{
-    UINT_32             size;            ///< Size of this structure in bytes
-
-    ADDR_CMASK_FLAGS    flags;           ///< CMASK flags
-    UINT_32             pitch;           ///< Pitch, in pixels, of color buffer
-    UINT_32             height;          ///< Height, in pixels, of color buffer
-    UINT_32             numSlices;       ///< Number of slices, of color buffer
-    BOOL_32             isLinear;        ///< Linear or tiled layout, Only SI can be linear
-    ADDR_TILEINFO*      pTileInfo;       ///< Tile info
-
-    INT_32              tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
-                                         ///  while the global useTileIndex is set to 1
-    INT_32              macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-                                         ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_CMASK_INFO_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_CMASK_INFO_OUTPUT
-*
-*   @brief
-*       Output structure of AddrComputeCmaskInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_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_64 cmaskBytes;     ///< Size in bytes of CMask buffer
-    UINT_32 baseAlign;      ///< Base alignment
-    UINT_32 blockMax;       ///< Cmask block size. Need this to set CB_COLORn_MASK register
-    UINT_32 macroWidth;     ///< Macro width in pixels, actually squared cache shape
-    UINT_32 macroHeight;    ///< Macro height in pixels
-    UINT_64 sliceSize;      ///< Slice size, in bytes.
-} ADDR_COMPUTE_CMASK_INFO_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeCmaskInfo
-*
-*   @brief
-*       Compute Cmask pitch, height, base alignment and size in bytes from color buffer
-*       info
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskInfo(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_CMASK_INFO_INPUT*    pIn,
-    ADDR_COMPUTE_CMASK_INFO_OUTPUT*         pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeCmaskAddrFromCoord
-*
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
-{
-    UINT_32          size;           ///< Size of this structure in bytes
-    UINT_32          x;              ///< X coordinate
-    UINT_32          y;              ///< Y coordinate
-    UINT_64          fmaskAddr;      ///< Fmask addr for tc compatible Cmask
-    UINT_32          slice;          ///< Slice index
-    UINT_32          pitch;          ///< Pitch in pixels, of color buffer
-    UINT_32          height;         ///< Height in pixels, of color buffer
-    UINT_32          numSlices;      ///< Number of slices
-    UINT_32          bpp;
-    BOOL_32          isLinear;       ///< Linear or tiled layout, Only SI can be linear
-    ADDR_CMASK_FLAGS flags;          ///< CMASK flags
-    ADDR_TILEINFO*   pTileInfo;      ///< Tile info
-
-    INT_32           tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
-                                     ///< while the global useTileIndex is set to 1
-    INT_32           macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
-                                     ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeCmaskAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_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-7. CMASK is 4 bpp,
-                            ///  so the address may be located in bit 0 (0) or 4 (4)
-} ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeCmaskAddrFromCoord
-*
-*   @brief
-*       Compute Cmask address according to coordinates (of MSAA color buffer)
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskAddrFromCoord(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,
-    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeCmaskCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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-7. CMASK is 4 bpp,
-                                    ///  so the address may be located in bit 0 (0) or 4 (4)
-    UINT_32        pitch;           ///< Pitch, in pixels
-    UINT_32        height;          ///< Height in pixels
-    UINT_32        numSlices;       ///< Number of slices
-    BOOL_32        isLinear;        ///< Linear or tiled layout, Only SI can be linear
-    ADDR_TILEINFO* pTileInfo;       ///< Tile info
-
-    INT_32         tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
-                                    ///  while the global useTileIndex is set to 1
-    INT_32         macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-                                    ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeCmaskCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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;  ///< Slice index
-} ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeCmaskCoordFromAddr
-*
-*   @brief
-*       Compute coordinates within color buffer (1st pixel of a micro tile) according to
-*       Cmask address
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskCoordFromAddr(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,
-    ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut);
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                     F-mask functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_FMASK_INFO_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeFmaskInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_FMASK_INFO_INPUT
-{
-    UINT_32         size;               ///< Size of this structure in bytes
-
-    AddrTileMode    tileMode;           ///< Tile mode
-    UINT_32         pitch;              ///< Surface pitch, in pixels
-    UINT_32         height;             ///< Surface height, in pixels
-    UINT_32         numSlices;          ///< Number of slice/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
-    /// r800 and later HWL parameters
-    struct
-    {
-        UINT_32 resolved:   1;          ///< TRUE if the surface is for resolved fmask, only used
-                                        ///  by H/W clients. S/W should always set it to FALSE.
-        UINT_32 reserved:  31;          ///< Reserved for future use.
-    };
-    ADDR_TILEINFO*  pTileInfo;          ///< 2D tiling parameters. Clients must give valid data
-    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-} ADDR_COMPUTE_FMASK_INFO_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_FMASK_INFO_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeFmaskInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_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         numSlices;      ///< Slices of fmask
-    UINT_64         fmaskBytes;     ///< Size of fmask in bytes
-    UINT_32         baseAlign;      ///< Base address alignment
-    UINT_32         pitchAlign;     ///< Pitch alignment
-    UINT_32         heightAlign;    ///< Height alignment
-    UINT_32         bpp;            ///< Bits per pixel of FMASK is: number of bit planes
-    UINT_32         numSamples;     ///< Number of samples, used for dump, export this since input
-                                    ///  may be changed in 9xx and above
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*  pTileInfo;      ///< Tile parameters used. Fmask can have different
-                                    ///  bank_height from color buffer
-    INT_32          tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
-                                    ///  while the global useTileIndex is set to 1
-    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
-    UINT_64         sliceSize;      ///< Size of slice in bytes
-} ADDR_COMPUTE_FMASK_INFO_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeFmaskInfo
-*
-*   @brief
-*       Compute Fmask pitch/height/depth/alignments and size in bytes
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskInfo(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeFmaskAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_FMASK_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         plane;              ///< Plane number
-    UINT_32         sample;             ///< Sample index (fragment index for EQAA)
-
-    UINT_32         pitch;              ///< Surface pitch, in pixels
-    UINT_32         height;             ///< Surface height, in pixels
-    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
-
-    AddrTileMode    tileMode;           ///< Tile mode
-    union
-    {
-        struct
-        {
-            UINT_32  bankSwizzle;       ///< Bank swizzle
-            UINT_32  pipeSwizzle;       ///< Pipe swizzle
-        };
-        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
-    };
-
-    /// r800 and later HWL parameters
-    struct
-    {
-        UINT_32 resolved:   1;          ///< TRUE if this is a resolved fmask, used by H/W clients
-        UINT_32 ignoreSE:   1;          ///< TRUE if shader engines are ignored.
-        UINT_32 reserved:  30;          ///< Reserved for future use.
-    };
-    ADDR_TILEINFO*  pTileInfo;          ///< 2D tiling parameters. Client must provide all data
-
-} ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeFmaskAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR_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.
-} ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeFmaskAddrFromCoord
-*
-*   @brief
-*       Compute Fmask address according to coordinates (x,y,slice,sample,plane)
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskAddrFromCoord(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,
-    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
-*
-*   @brief
-*       Input structure for AddrComputeFmaskCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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.
-
-    UINT_32         pitch;              ///< Pitch, in pixels
-    UINT_32         height;             ///< Height in pixels
-    UINT_32         numSamples;         ///< Number of samples
-    UINT_32         numFrags;           ///< Number of fragments
-    AddrTileMode    tileMode;           ///< Tile mode
-    union
-    {
-        struct
-        {
-            UINT_32  bankSwizzle;       ///< Bank swizzle
-            UINT_32  pipeSwizzle;       ///< Pipe swizzle
-        };
-        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
-    };
-
-    /// r800 and later HWL parameters
-    struct
-    {
-        UINT_32 resolved:   1;          ///< TRUE if this is a resolved fmask, used by HW components
-        UINT_32 ignoreSE:   1;          ///< TRUE if shader engines are ignored.
-        UINT_32 reserved:  30;          ///< Reserved for future use.
-    };
-    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Client must provide all data
-
-} ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
-*
-*   @brief
-*       Output structure for AddrComputeFmaskCoordFromAddr
-****************************************************************************************************
-*/
-typedef struct _ADDR_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 plane;      ///< Plane number
-    UINT_32 sample;     ///< Sample index (fragment index for EQAA)
-} ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeFmaskCoordFromAddr
-*
-*   @brief
-*       Compute FMASK coordinate from an given address
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskCoordFromAddr(
-    ADDR_HANDLE                                     hLib,
-    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,
-    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut);
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                          Element/utility functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrGetVersion
-*
-*   @brief
-*       Get AddrLib version number
-****************************************************************************************************
-*/
-UINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib);
-
-/**
-****************************************************************************************************
-*   AddrUseTileIndex
-*
-*   @brief
-*       Return TRUE if tileIndex is enabled in this address library
-****************************************************************************************************
-*/
-BOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib);
-
-/**
-****************************************************************************************************
-*   AddrUseCombinedSwizzle
-*
-*   @brief
-*       Return TRUE if combined swizzle is enabled in this address library
-****************************************************************************************************
-*/
-BOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib);
-
-/**
-****************************************************************************************************
-*   ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
-*
-*   @brief
-*       Input structure of AddrExtractBankPipeSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
-{
-    UINT_32         size;           ///< Size of this structure in bytes
-
-    UINT_32         base256b;       ///< Base256b value
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*  pTileInfo;      ///< 2D tile parameters. Client must provide all data
-
-    INT_32          tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
-                                    ///  while the global useTileIndex is set to 1
-    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
-                                    ///< README: When tileIndex is not -1, this must be valid
-} ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
-*
-*   @brief
-*       Output structure of AddrExtractBankPipeSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
-{
-    UINT_32 size;           ///< Size of this structure in bytes
-
-    UINT_32 bankSwizzle;    ///< Bank swizzle
-    UINT_32 pipeSwizzle;    ///< Pipe swizzle
-} ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrExtractBankPipeSwizzle
-*
-*   @brief
-*       Extract Bank and Pipe swizzle from base256b
-*   @return
-*       ADDR_OK if no error
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle(
-    ADDR_HANDLE                                 hLib,
-    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,
-    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut);
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
-*
-*   @brief
-*       Input structure of AddrCombineBankPipeSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
-{
-    UINT_32         size;           ///< Size of this structure in bytes
-
-    UINT_32         bankSwizzle;    ///< Bank swizzle
-    UINT_32         pipeSwizzle;    ///< Pipe swizzle
-    UINT_64         baseAddr;       ///< Base address (leave it zero for driver clients)
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*  pTileInfo;      ///< 2D tile parameters. Client must provide all data
-
-    INT_32          tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
-                                    ///  while the global useTileIndex is set to 1
-    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
-                                    ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
-*
-*   @brief
-*       Output structure of AddrCombineBankPipeSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
-{
-    UINT_32 size;           ///< Size of this structure in bytes
-
-    UINT_32 tileSwizzle;    ///< Combined swizzle
-} ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrCombineBankPipeSwizzle
-*
-*   @brief
-*       Combine Bank and Pipe swizzle
-*   @return
-*       ADDR_OK if no error
-*   @note
-*       baseAddr here is full MCAddress instead of base256b
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle(
-    ADDR_HANDLE                                 hLib,
-    const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,
-    ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT*       pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SLICESWIZZLE_INPUT
-*
-*   @brief
-*       Input structure of AddrComputeSliceSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_SLICESWIZZLE_INPUT
-{
-    UINT_32         size;               ///< Size of this structure in bytes
-
-    AddrTileMode    tileMode;           ///< Tile Mode
-    UINT_32         baseSwizzle;        ///< Base tile swizzle
-    UINT_32         slice;              ///< Slice index
-    UINT_64         baseAddr;           ///< Base address, driver should leave it 0 in most cases
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Actually banks needed here!
-
-    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    INT_32          macroModeIndex;     ///< Index in macro tile mode table if there is one (CI)
-                                        ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_SLICESWIZZLE_INPUT;
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
-*
-*   @brief
-*       Output structure of AddrComputeSliceSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
-{
-    UINT_32  size;           ///< Size of this structure in bytes
-
-    UINT_32  tileSwizzle;    ///< Recalculated tileSwizzle value
-} ADDR_COMPUTE_SLICESWIZZLE_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeSliceSwizzle
-*
-*   @brief
-*       Extract Bank and Pipe swizzle from base256b
-*   @return
-*       ADDR_OK if no error
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,
-    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut);
-
-
-/**
-****************************************************************************************************
-*   AddrSwizzleGenOption
-*
-*   @brief
-*       Which swizzle generating options: legacy or linear
-****************************************************************************************************
-*/
-typedef enum _AddrSwizzleGenOption
-{
-    ADDR_SWIZZLE_GEN_DEFAULT    = 0,    ///< As is in client driver implemention for swizzle
-    ADDR_SWIZZLE_GEN_LINEAR     = 1,    ///< Using a linear increment of swizzle
-} AddrSwizzleGenOption;
-
-/**
-****************************************************************************************************
-*   AddrSwizzleOption
-*
-*   @brief
-*       Controls how swizzle is generated
-****************************************************************************************************
-*/
-typedef union _ADDR_SWIZZLE_OPTION
-{
-    struct
-    {
-        UINT_32 genOption       : 1;    ///< The way swizzle is generated, see AddrSwizzleGenOption
-        UINT_32 reduceBankBit   : 1;    ///< TRUE if we need reduce swizzle bits
-        UINT_32 reserved        :30;    ///< Reserved bits
-    };
-
-    UINT_32 value;
-
-} ADDR_SWIZZLE_OPTION;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_BASE_SWIZZLE_INPUT
-*
-*   @brief
-*       Input structure of AddrComputeBaseSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_INPUT
-{
-    UINT_32             size;           ///< Size of this structure in bytes
-
-    ADDR_SWIZZLE_OPTION option;         ///< Swizzle option
-    UINT_32             surfIndex;      ///< Index of this surface type
-    AddrTileMode        tileMode;       ///< Tile Mode
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*      pTileInfo;      ///< 2D tile parameters. Actually banks needed here!
-
-    INT_32              tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    INT_32              macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
-                                        ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_BASE_SWIZZLE_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
-*
-*   @brief
-*       Output structure of AddrComputeBaseSwizzle
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
-{
-    UINT_32 size;           ///< Size of this structure in bytes
-
-    UINT_32 tileSwizzle;    ///< Combined swizzle
-} ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeBaseSwizzle
-*
-*   @brief
-*       Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
-*   @return
-*       ADDR_OK if no error
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
-    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT*       pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ELEM_GETEXPORTNORM_INPUT
-*
-*   @brief
-*       Input structure for ElemGetExportNorm
-*
-****************************************************************************************************
-*/
-typedef struct _ELEM_GETEXPORTNORM_INPUT
-{
-    UINT_32             size;       ///< Size of this structure in bytes
-
-    AddrColorFormat     format;     ///< Color buffer format; Client should use ColorFormat
-    AddrSurfaceNumber   num;        ///< Surface number type; Client should use NumberType
-    AddrSurfaceSwap     swap;       ///< Surface swap byte swap; Client should use SurfaceSwap
-    UINT_32             numSamples; ///< Number of samples
-} ELEM_GETEXPORTNORM_INPUT;
-
-/**
-****************************************************************************************************
-*  ElemGetExportNorm
-*
-*   @brief
-*       Helper function to check one format can be EXPORT_NUM, which is a register
-*       CB_COLOR_INFO.SURFACE_FORMAT. FP16 can be reported as EXPORT_NORM for rv770 in r600
-*       family
-*   @note
-*       The implementation is only for r600.
-*       00 - EXPORT_FULL: PS exports are 4 pixels with 4 components with 32-bits-per-component. (two
-*       clocks per export)
-*       01 - EXPORT_NORM: PS exports are 4 pixels with 4 components with 16-bits-per-component. (one
-*       clock per export)
-*
-****************************************************************************************************
-*/
-BOOL_32 ADDR_API ElemGetExportNorm(
-    ADDR_HANDLE                     hLib,
-    const ELEM_GETEXPORTNORM_INPUT* pIn);
-
-
-
-/**
-****************************************************************************************************
-*   ELEM_FLT32TODEPTHPIXEL_INPUT
-*
-*   @brief
-*       Input structure for addrFlt32ToDepthPixel
-*
-****************************************************************************************************
-*/
-typedef struct _ELEM_FLT32TODEPTHPIXEL_INPUT
-{
-    UINT_32         size;           ///< Size of this structure in bytes
-
-    AddrDepthFormat format;         ///< Depth buffer format
-    ADDR_FLT_32     comps[2];       ///< Component values (Z/stencil)
-} ELEM_FLT32TODEPTHPIXEL_INPUT;
-
-/**
-****************************************************************************************************
-*   ELEM_FLT32TODEPTHPIXEL_INPUT
-*
-*   @brief
-*       Output structure for ElemFlt32ToDepthPixel
-*
-****************************************************************************************************
-*/
-typedef struct _ELEM_FLT32TODEPTHPIXEL_OUTPUT
-{
-    UINT_32 size;           ///< Size of this structure in bytes
-
-    UINT_8* pPixel;         ///< Real depth value. Same data type as depth buffer.
-                            ///  Client must provide enough storage for this type.
-    UINT_32 depthBase;      ///< Tile base in bits for depth bits
-    UINT_32 stencilBase;    ///< Tile base in bits for stencil bits
-    UINT_32 depthBits;      ///< Bits for depth
-    UINT_32 stencilBits;    ///< Bits for stencil
-} ELEM_FLT32TODEPTHPIXEL_OUTPUT;
-
-/**
-****************************************************************************************************
-*   ElemFlt32ToDepthPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a depth/stencil pixel value
-*
-*   @return
-*       Return code
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel(
-    ADDR_HANDLE                         hLib,
-    const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
-    ELEM_FLT32TODEPTHPIXEL_OUTPUT*      pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ELEM_FLT32TOCOLORPIXEL_INPUT
-*
-*   @brief
-*       Input structure for addrFlt32ToColorPixel
-*
-****************************************************************************************************
-*/
-typedef struct _ELEM_FLT32TOCOLORPIXEL_INPUT
-{
-    UINT_32            size;           ///< Size of this structure in bytes
-
-    AddrColorFormat    format;         ///< Color buffer format
-    AddrSurfaceNumber  surfNum;        ///< Surface number
-    AddrSurfaceSwap    surfSwap;       ///< Surface swap
-    ADDR_FLT_32        comps[4];       ///< Component values (r/g/b/a)
-} ELEM_FLT32TOCOLORPIXEL_INPUT;
-
-/**
-****************************************************************************************************
-*   ELEM_FLT32TOCOLORPIXEL_INPUT
-*
-*   @brief
-*       Output structure for ElemFlt32ToColorPixel
-*
-****************************************************************************************************
-*/
-typedef struct _ELEM_FLT32TOCOLORPIXEL_OUTPUT
-{
-    UINT_32 size;       ///< Size of this structure in bytes
-
-    UINT_8* pPixel;     ///< Real color value. Same data type as color buffer.
-                        ///  Client must provide enough storage for this type.
-} ELEM_FLT32TOCOLORPIXEL_OUTPUT;
-
-/**
-****************************************************************************************************
-*   ElemFlt32ToColorPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
-*
-*   @return
-*       Return code
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel(
-    ADDR_HANDLE                         hLib,
-    const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
-    ELEM_FLT32TOCOLORPIXEL_OUTPUT*      pOut);
-
-
-/**
-****************************************************************************************************
-*   ADDR_CONVERT_TILEINFOTOHW_INPUT
-*
-*   @brief
-*       Input structure for AddrConvertTileInfoToHW
-*   @note
-*       When reverse is TRUE, indices are igonred
-****************************************************************************************************
-*/
-typedef struct _ADDR_CONVERT_TILEINFOTOHW_INPUT
-{
-    UINT_32         size;               ///< Size of this structure in bytes
-    BOOL_32         reverse;            ///< Convert control flag.
-                                        ///  FALSE: convert from real value to HW value;
-                                        ///  TRUE: convert from HW value to real value.
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*  pTileInfo;          ///< Tile parameters with real value
-
-    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
-                                        ///  while the global useTileIndex is set to 1
-    INT_32          macroModeIndex;     ///< Index in macro tile mode table if there is one (CI)
-                                        ///< README: When tileIndex is not -1, this must be valid
-    UINT_32         bpp;                ///< Bits per pixel
-} ADDR_CONVERT_TILEINFOTOHW_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_CONVERT_TILEINFOTOHW_OUTPUT
-*
-*   @brief
-*       Output structure for AddrConvertTileInfoToHW
-****************************************************************************************************
-*/
-typedef struct _ADDR_CONVERT_TILEINFOTOHW_OUTPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-
-    /// r800 and later HWL parameters
-    ADDR_TILEINFO*      pTileInfo;          ///< Tile parameters with hardware register value
-
-} ADDR_CONVERT_TILEINFOTOHW_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrConvertTileInfoToHW
-*
-*   @brief
-*       Convert tile info from real value to hardware register value
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW(
-    ADDR_HANDLE                             hLib,
-    const ADDR_CONVERT_TILEINFOTOHW_INPUT*  pIn,
-    ADDR_CONVERT_TILEINFOTOHW_OUTPUT*       pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_CONVERT_TILEINDEX_INPUT
-*
-*   @brief
-*       Input structure for AddrConvertTileIndex
-****************************************************************************************************
-*/
-typedef struct _ADDR_CONVERT_TILEINDEX_INPUT
-{
-    UINT_32         size;               ///< Size of this structure in bytes
-
-    INT_32          tileIndex;          ///< Tile index
-    INT_32          macroModeIndex;     ///< Index in macro tile mode table if there is one (CI)
-    UINT_32         bpp;                ///< Bits per pixel
-    BOOL_32         tileInfoHw;         ///< Set to TRUE if client wants HW enum, otherwise actual
-} ADDR_CONVERT_TILEINDEX_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_CONVERT_TILEINDEX_OUTPUT
-*
-*   @brief
-*       Output structure for AddrConvertTileIndex
-****************************************************************************************************
-*/
-typedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT
-{
-    UINT_32             size;           ///< Size of this structure in bytes
-
-    AddrTileMode        tileMode;       ///< Tile mode
-    AddrTileType        tileType;       ///< Tile type
-    ADDR_TILEINFO*      pTileInfo;      ///< Tile info
-
-} ADDR_CONVERT_TILEINDEX_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrConvertTileIndex
-*
-*   @brief
-*       Convert tile index to tile mode/type/info
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
-    ADDR_HANDLE                         hLib,
-    const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
-    ADDR_CONVERT_TILEINDEX_OUTPUT*      pOut);
-
-/**
-****************************************************************************************************
-*   ADDR_GET_MACROMODEINDEX_INPUT
-*
-*   @brief
-*       Input structure for AddrGetMacroModeIndex
-****************************************************************************************************
-*/
-typedef struct _ADDR_GET_MACROMODEINDEX_INPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-    ADDR_SURFACE_FLAGS  flags;              ///< Surface flag
-    INT_32              tileIndex;          ///< Tile index
-    UINT_32             bpp;                ///< Bits per pixel
-    UINT_32             numFrags;           ///< Number of color fragments
-} ADDR_GET_MACROMODEINDEX_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_GET_MACROMODEINDEX_OUTPUT
-*
-*   @brief
-*       Output structure for AddrGetMacroModeIndex
-****************************************************************************************************
-*/
-typedef struct _ADDR_GET_MACROMODEINDEX_OUTPUT
-{
-    UINT_32             size;            ///< Size of this structure in bytes
-    INT_32              macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-} ADDR_GET_MACROMODEINDEX_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrGetMacroModeIndex
-*
-*   @brief
-*       Get macro mode index based on input parameters
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
-    ADDR_HANDLE                          hLib,
-    const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
-    ADDR_GET_MACROMODEINDEX_OUTPUT*      pOut);
-
-/**
-****************************************************************************************************
-*   ADDR_CONVERT_TILEINDEX1_INPUT
-*
-*   @brief
-*       Input structure for AddrConvertTileIndex1 (without macro mode index)
-****************************************************************************************************
-*/
-typedef struct _ADDR_CONVERT_TILEINDEX1_INPUT
-{
-    UINT_32         size;               ///< Size of this structure in bytes
-
-    INT_32          tileIndex;          ///< Tile index
-    UINT_32         bpp;                ///< Bits per pixel
-    UINT_32         numSamples;         ///< Number of samples
-    BOOL_32         tileInfoHw;         ///< Set to TRUE if client wants HW enum, otherwise actual
-} ADDR_CONVERT_TILEINDEX1_INPUT;
-
-/**
-****************************************************************************************************
-*   AddrConvertTileIndex1
-*
-*   @brief
-*       Convert tile index to tile mode/type/info
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1(
-    ADDR_HANDLE                             hLib,
-    const ADDR_CONVERT_TILEINDEX1_INPUT*    pIn,
-    ADDR_CONVERT_TILEINDEX_OUTPUT*          pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_GET_TILEINDEX_INPUT
-*
-*   @brief
-*       Input structure for AddrGetTileIndex
-****************************************************************************************************
-*/
-typedef struct _ADDR_GET_TILEINDEX_INPUT
-{
-    UINT_32         size;           ///< Size of this structure in bytes
-
-    AddrTileMode    tileMode;       ///< Tile mode
-    AddrTileType    tileType;       ///< Tile-type: disp/non-disp/...
-    ADDR_TILEINFO*  pTileInfo;      ///< Pointer to tile-info structure, can be NULL for linear/1D
-} ADDR_GET_TILEINDEX_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_GET_TILEINDEX_OUTPUT
-*
-*   @brief
-*       Output structure for AddrGetTileIndex
-****************************************************************************************************
-*/
-typedef struct _ADDR_GET_TILEINDEX_OUTPUT
-{
-    UINT_32         size;           ///< Size of this structure in bytes
-
-    INT_32          index;          ///< index in table
-} ADDR_GET_TILEINDEX_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrGetTileIndex
-*
-*   @brief
-*       Get the tiling mode index in table
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetTileIndex(
-    ADDR_HANDLE                     hLib,
-    const ADDR_GET_TILEINDEX_INPUT* pIn,
-    ADDR_GET_TILEINDEX_OUTPUT*      pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_PRT_INFO_INPUT
-*
-*   @brief
-*       Input structure for AddrComputePrtInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_PRT_INFO_INPUT
-{
-    AddrFormat          format;        ///< Surface format
-    UINT_32             baseMipWidth;  ///< Base mipmap width
-    UINT_32             baseMipHeight; ///< Base mipmap height
-    UINT_32             baseMipDepth;  ///< Base mipmap depth
-    UINT_32             numFrags;      ///< Number of fragments,
-} ADDR_PRT_INFO_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_PRT_INFO_OUTPUT
-*
-*   @brief
-*       Input structure for AddrComputePrtInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_PRT_INFO_OUTPUT
-{
-    UINT_32             prtTileWidth;
-    UINT_32             prtTileHeight;
-} ADDR_PRT_INFO_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputePrtInfo
-*
-*   @brief
-*       Compute prt surface related information
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo(
-    ADDR_HANDLE                 hLib,
-    const ADDR_PRT_INFO_INPUT*  pIn,
-    ADDR_PRT_INFO_OUTPUT*       pOut);
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                     DCC key functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   _ADDR_COMPUTE_DCCINFO_INPUT
-*
-*   @brief
-*       Input structure of AddrComputeDccInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_DCCINFO_INPUT
-{
-    UINT_32             size;            ///< Size of this structure in bytes
-    UINT_32             bpp;             ///< BitPP of color surface
-    UINT_32             numSamples;      ///< Sample number of color surface
-    UINT_64             colorSurfSize;   ///< Size of color surface to which dcc key is bound
-    AddrTileMode        tileMode;        ///< Tile mode of color surface
-    ADDR_TILEINFO       tileInfo;        ///< Tile info of color surface
-    UINT_32             tileSwizzle;     ///< Tile swizzle
-    INT_32              tileIndex;       ///< Tile index of color surface,
-                                         ///< MUST be -1 if you don't want to use it
-                                         ///< while the global useTileIndex is set to 1
-    INT_32              macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
-                                         ///< README: When tileIndex is not -1, this must be valid
-} ADDR_COMPUTE_DCCINFO_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR_COMPUTE_DCCINFO_OUTPUT
-*
-*   @brief
-*       Output structure of AddrComputeDccInfo
-****************************************************************************************************
-*/
-typedef struct _ADDR_COMPUTE_DCCINFO_OUTPUT
-{
-    UINT_32 size;                 ///< Size of this structure in bytes
-    UINT_32 dccRamBaseAlign;      ///< Base alignment of dcc key
-    UINT_64 dccRamSize;           ///< Size of dcc key
-    UINT_64 dccFastClearSize;     ///< Size of dcc key portion that can be fast cleared
-    BOOL_32 subLvlCompressible;   ///< Whether sub resource is compressiable
-    BOOL_32 dccRamSizeAligned;    ///< Whether the dcc key size is aligned
-} ADDR_COMPUTE_DCCINFO_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrComputeDccInfo
-*
-*   @brief
-*       Compute DCC key size, base alignment
-*       info
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo(
-    ADDR_HANDLE                             hLib,
-    const ADDR_COMPUTE_DCCINFO_INPUT*       pIn,
-    ADDR_COMPUTE_DCCINFO_OUTPUT*            pOut);
-
-
-
-/**
-****************************************************************************************************
-*   ADDR_GET_MAX_ALINGMENTS_OUTPUT
-*
-*   @brief
-*       Output structure of AddrGetMaxAlignments
-****************************************************************************************************
-*/
-typedef struct _ADDR_GET_MAX_ALINGMENTS_OUTPUT
-{
-    UINT_32 size;                   ///< Size of this structure in bytes
-    UINT_32 baseAlign;              ///< Maximum base alignment in bytes
-} ADDR_GET_MAX_ALINGMENTS_OUTPUT;
-
-/**
-****************************************************************************************************
-*   AddrGetMaxAlignments
-*
-*   @brief
-*       Gets maximnum alignments
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
-    ADDR_HANDLE                     hLib,
-    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut);
-
-/**
-****************************************************************************************************
-*   AddrGetMaxMetaAlignments
-*
-*   @brief
-*       Gets maximnum alignments for metadata
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API AddrGetMaxMetaAlignments(
-    ADDR_HANDLE                     hLib,
-    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut);
-
-/**
-****************************************************************************************************
-*                                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 noMetadata        :  1; ///< This resource has no metadata
-        UINT_32 metaRbUnaligned   :  1; ///< This resource has rb unaligned metadata
-        UINT_32 metaPipeUnaligned :  1; ///< This resource has pipe unaligned metadata
-        UINT_32 reserved          : 14; ///< 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             pixelPitch;         ///< Pitch in pixels
-    UINT_32             pixelHeight;        ///< Padded height in pixels
-    UINT_32             equationIndex;      ///< Equation index in the equation table
-    UINT_64             offset;             ///< Offset in bytes from mip base, should only be used
-                                            ///< to setup vam surface descriptor, can't be used
-                                            ///< to setup swizzle pattern
-    UINT_64             macroBlockOffset;   ///< macro block offset in bytes from mip base
-    UINT_32             mipTailOffset;      ///< mip tail offset in bytes
-    UINT_32             mipTailCoordX;      ///< mip tail coord x
-    UINT_32             mipTailCoordY;      ///< mip tail coord y
-    UINT_32             mipTailCoordZ;      ///< mip tail coord z
-} 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_64             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             mipChainInTail;       ///< If whole mipchain falls into mip tail block
-    UINT_32             firstMipIdInTail;     ///< The id of first mip in tail, if there is no mip
-                                              ///  in tail, it will be set to number of mip levels
-} 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;
-    union
-    {
-        struct
-        {
-            UINT_32    startX;
-            UINT_32    startY;
-            UINT_32    startZ;
-            UINT_32    width;
-            UINT_32    height;
-            UINT_32    depth;
-        };
-
-        struct
-        {
-            UINT_32    offset;
-            UINT_32    sliceSize;
-        };
-    };
-} 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
-    UINT_32             firstMipIdInTail;
-} 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
-    UINT_32             firstMipIdInTail;
-} 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    metaBlkNumPerSlice; ///< Number of metablock within one slice
-
-    union
-    {
-        UINT_32 fastClearSizePerSlice;  ///< Size of DCC within a slice should be fast cleared
-        UINT_32 dccRamSliceSize;
-    };
-
-    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);
-
-
-/**
-****************************************************************************************************
-*   ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT
-*
-*   @brief
-*       Input structure for Addr2ComputeDccAddrFromCoord
-*
-****************************************************************************************************
-*/
-typedef struct _ADDR2_COMPUTE_DCC_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             sample;              ///< Index of samples, means fragment index for EQAA
-    UINT_32             mipId;               ///< mipmap level id
-
-    ADDR2_META_FLAGS    dccKeyFlags;         ///< DCC flags
-    ADDR2_SURFACE_FLAGS colorFlags;          ///< Color surface flags
-    AddrResourceType    resourceType;        ///< Color surface type
-    AddrSwizzleMode     swizzleMode;         ///< Color surface swizzle mode
-    UINT_32             bpp;                 ///< Color surface bits per pixel
-    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 mipmap levels
-    UINT_32             numFrags;            ///< Color surface fragment number
-
-    UINT_32             pipeXor;             ///< pipe Xor setting
-} ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
-*
-*   @brief
-*       Output structure for Addr2ComputeDccAddrFromCoord
-****************************************************************************************************
-*/
-typedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
-{
-    UINT_32    size;           ///< Size of this structure in bytes
-
-    UINT_64    addr;           ///< DCC address in bytes
-} ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT;
-
-/**
-****************************************************************************************************
-*   Addr2ComputeDccAddrFromCoord
-*
-*   @brief
-*       Compute DCC address according to coordinates (of MSAA color buffer)
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccAddrFromCoord(
-    ADDR_HANDLE                                    hLib,
-    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT*   pIn,
-    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_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
-    AddrFormat          format;             ///< Surface format
-    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_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_COMPUTE_SLICE_PIPEBANKXOR_INPUT
-*
-*   @brief
-*       Input structure of Addr2ComputeSlicePipeBankXor
-****************************************************************************************************
-*/
-typedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-    AddrSwizzleMode     swizzleMode;        ///< Surface swizzle mode
-    AddrResourceType    resourceType;       ///< Surface resource type
-    UINT_32             basePipeBankXor;    ///< Base pipe bank xor
-    UINT_32             slice;              ///< Slice id
-    UINT_32             numSamples;         ///< Number of samples
-} ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
-*
-*   @brief
-*       Output structure of Addr2ComputeSlicePipeBankXor
-****************************************************************************************************
-*/
-typedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-    UINT_32             pipeBankXor;        ///< Pipe bank xor
-} ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT;
-
-/**
-****************************************************************************************************
-*   Addr2ComputeSlicePipeBankXor
-*
-*   @brief
-*       Calculate slice pipe bank xor value based on base pipe bank xor and slice id.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2ComputeSlicePipeBankXor(
-    ADDR_HANDLE                                  hLib,
-    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
-    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut);
-
-/**
-****************************************************************************************************
-*   ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
-*
-*   @brief
-*       Input structure of Addr2ComputeSubResourceOffsetForSwizzlePattern
-****************************************************************************************************
-*/
-typedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-    AddrSwizzleMode     swizzleMode;        ///< Surface swizzle mode
-    AddrResourceType    resourceType;       ///< Surface resource type
-    UINT_32             pipeBankXor;        ///< Per resource xor
-    UINT_32             slice;              ///< Slice id
-    UINT_64             sliceSize;          ///< Slice size of a mip chain
-    UINT_64             macroBlockOffset;   ///< Macro block offset, returned in ADDR2_MIP_INFO
-    UINT_32             mipTailOffset;      ///< Mip tail offset, returned in ADDR2_MIP_INFO
-} ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT;
-
-/**
-****************************************************************************************************
-*   ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
-*
-*   @brief
-*       Output structure of Addr2ComputeSubResourceOffsetForSwizzlePattern
-****************************************************************************************************
-*/
-typedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
-{
-    UINT_32             size;               ///< Size of this structure in bytes
-    UINT_64             offset;             ///< offset
-} ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT;
-
-/**
-****************************************************************************************************
-*   Addr2ComputeSubResourceOffsetForSwizzlePattern
-*
-*   @brief
-*       Calculate sub resource offset to support swizzle pattern.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2ComputeSubResourceOffsetForSwizzlePattern(
-    ADDR_HANDLE                                                     hLib,
-    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
-    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut);
-
-/**
-****************************************************************************************************
-*   ADDR2_BLOCK_SET
-*
-*   @brief
-*       Bit field that defines 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_SWTYPE_SET
-*
-*   @brief
-*       Bit field that defines swizzle type
-****************************************************************************************************
-*/
-typedef union _ADDR2_SWTYPE_SET
-{
-    struct
-    {
-        UINT_32 sw_Z     : 1;   // SW_*_Z_*
-        UINT_32 sw_S     : 1;   // SW_*_S_*
-        UINT_32 sw_D     : 1;   // SW_*_D_*
-        UINT_32 sw_R     : 1;   // SW_*_R_*
-        UINT_32 reserved : 28;
-    };
-
-    UINT_32 value;
-} ADDR2_SWTYPE_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
-    ADDR2_SWTYPE_SET      preferredSwSet;    ///< Client can use it to specify sw type(s) wanted
-    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
-    UINT_32               minSizeAlign;      ///< memory allocated for surface in client driver will
-                                             ///  be padded to multiple of this value (in bytes)
-} 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_SWTYPE_SET      validSwTypeSet;       ///< Valid swizzle type bit combination
-    ADDR2_SWTYPE_SET      clientPreferredSwSet; ///< Client-preferred swizzle type bit combination
-} 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);
-
-/**
-****************************************************************************************************
-*   Addr2IsValidDisplaySwizzleMode
-*
-*   @brief
-*       Return whether the swizzle mode is supported by DCE / DCN.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
-    ADDR_HANDLE     hLib,
-    AddrSwizzleMode swizzleMode,
-    UINT_32         bpp,
-    bool            *result);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif // __ADDR_INTERFACE_H__
diff --git a/src/amd/addrlib/addrtypes.h b/src/amd/addrlib/addrtypes.h
deleted file mode 100644 (file)
index c63ad96..0000000
+++ /dev/null
@@ -1,749 +0,0 @@
-/*
- * Copyright © 2014 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  addrtypes.h
-* @brief Contains the helper function and constants
-****************************************************************************************************
-*/
-#ifndef __ADDR_TYPES_H__
-#define __ADDR_TYPES_H__
-
-#if defined(__APPLE__) && !defined(HAVE_TSERVER)
-// External definitions header maintained by Apple driver team, but not for diag team under Mac.
-// Helps address compilation issues & reduces code covered by NDA
-#include "addrExtDef.h"
-
-#else
-
-// Windows and/or Linux
-#if !defined(VOID)
-typedef void           VOID;
-#endif
-
-#if !defined(FLOAT)
-typedef float          FLOAT;
-#endif
-
-#if !defined(CHAR)
-typedef char           CHAR;
-#endif
-
-#if !defined(INT)
-typedef int            INT;
-#endif
-
-#include <stdarg.h> // va_list...etc need this header
-
-#endif // defined (__APPLE__) && !defined(HAVE_TSERVER)
-
-/**
-****************************************************************************************************
-*   Calling conventions
-****************************************************************************************************
-*/
-#ifndef ADDR_CDECL
-    #if defined(__GNUC__)
-        #define ADDR_CDECL __attribute__((cdecl))
-    #else
-        #define ADDR_CDECL __cdecl
-    #endif
-#endif
-
-#ifndef ADDR_STDCALL
-    #if defined(__GNUC__)
-        #if defined(__amd64__) || defined(__x86_64__)
-            #define ADDR_STDCALL
-        #else
-            #define ADDR_STDCALL __attribute__((stdcall))
-        #endif
-    #else
-        #define ADDR_STDCALL __stdcall
-    #endif
-#endif
-
-#ifndef ADDR_FASTCALL
-    #if defined(BRAHMA_ARM)
-        #define ADDR_FASTCALL
-    #elif defined(__GNUC__)
-        #if defined(__i386__)
-            #define ADDR_FASTCALL __attribute__((regparm(0)))
-        #else
-            #define ADDR_FASTCALL
-        #endif
-    #else
-        #define ADDR_FASTCALL __fastcall
-    #endif
-#endif
-
-#ifndef GC_CDECL
-    #define GC_CDECL  ADDR_CDECL
-#endif
-
-#ifndef GC_STDCALL
-    #define GC_STDCALL  ADDR_STDCALL
-#endif
-
-#ifndef GC_FASTCALL
-    #define GC_FASTCALL  ADDR_FASTCALL
-#endif
-
-
-#if defined(__GNUC__)
-    #define ADDR_INLINE static inline   // inline needs to be static to link
-#else
-    // win32, win64, other platforms
-    #define ADDR_INLINE   __inline
-#endif // #if defined(__GNUC__)
-
-#define ADDR_API ADDR_FASTCALL //default call convention is fast call
-
-/**
-****************************************************************************************************
-* Global defines used by other modules
-****************************************************************************************************
-*/
-#if !defined(TILEINDEX_INVALID)
-#define TILEINDEX_INVALID                -1
-#endif
-
-#if !defined(TILEINDEX_LINEAR_GENERAL)
-#define TILEINDEX_LINEAR_GENERAL         -2
-#endif
-
-#if !defined(TILEINDEX_LINEAR_ALIGNED)
-#define TILEINDEX_LINEAR_ALIGNED          8
-#endif
-
-/**
-****************************************************************************************************
-* Return codes
-****************************************************************************************************
-*/
-typedef enum _ADDR_E_RETURNCODE
-{
-    // General Return
-    ADDR_OK    = 0,
-    ADDR_ERROR = 1,
-
-    // Specific Errors
-    ADDR_OUTOFMEMORY,
-    ADDR_INVALIDPARAMS,
-    ADDR_NOTSUPPORTED,
-    ADDR_NOTIMPLEMENTED,
-    ADDR_PARAMSIZEMISMATCH,
-    ADDR_INVALIDGBREGVALUES,
-
-} ADDR_E_RETURNCODE;
-
-/**
-****************************************************************************************************
-* @brief
-*   Neutral enums that define tile modes for all H/W
-* @note
-*   R600/R800 tiling mode can be cast to hw enums directly but never cast into HW enum from
-*   ADDR_TM_2D_TILED_XTHICK
-*
-****************************************************************************************************
-*/
-typedef enum _AddrTileMode
-{
-    ADDR_TM_LINEAR_GENERAL      = 0,    ///< Least restrictions, pitch: multiple of 8 if not buffer
-    ADDR_TM_LINEAR_ALIGNED      = 1,    ///< Requests pitch or slice to be multiple of 64 pixels
-    ADDR_TM_1D_TILED_THIN1      = 2,    ///< Linear array of 8x8 tiles
-    ADDR_TM_1D_TILED_THICK      = 3,    ///< Linear array of 8x8x4 tiles
-    ADDR_TM_2D_TILED_THIN1      = 4,    ///< A set of macro tiles consist of 8x8 tiles
-    ADDR_TM_2D_TILED_THIN2      = 5,    ///< 600 HWL only, macro tile ratio is 1:4
-    ADDR_TM_2D_TILED_THIN4      = 6,    ///< 600 HWL only, macro tile ratio is 1:16
-    ADDR_TM_2D_TILED_THICK      = 7,    ///< A set of macro tiles consist of 8x8x4 tiles
-    ADDR_TM_2B_TILED_THIN1      = 8,    ///< 600 HWL only, with bank swap
-    ADDR_TM_2B_TILED_THIN2      = 9,    ///< 600 HWL only, with bank swap and ratio is 1:4
-    ADDR_TM_2B_TILED_THIN4      = 10,   ///< 600 HWL only, with bank swap and ratio is 1:16
-    ADDR_TM_2B_TILED_THICK      = 11,   ///< 600 HWL only, with bank swap, consists of 8x8x4 tiles
-    ADDR_TM_3D_TILED_THIN1      = 12,   ///< Macro tiling w/ pipe rotation between slices
-    ADDR_TM_3D_TILED_THICK      = 13,   ///< Macro tiling w/ pipe rotation bwtween slices, thick
-    ADDR_TM_3B_TILED_THIN1      = 14,   ///< 600 HWL only, with bank swap
-    ADDR_TM_3B_TILED_THICK      = 15,   ///< 600 HWL only, with bank swap, thick
-    ADDR_TM_2D_TILED_XTHICK     = 16,   ///< Tile is 8x8x8, valid from NI
-    ADDR_TM_3D_TILED_XTHICK     = 17,   ///< Tile is 8x8x8, valid from NI
-    ADDR_TM_POWER_SAVE          = 18,   ///< Power save mode, only used by KMD on NI
-    ADDR_TM_PRT_TILED_THIN1     = 19,   ///< No bank/pipe rotation or hashing beyond macrotile size
-    ADDR_TM_PRT_2D_TILED_THIN1  = 20,   ///< Same as 2D_TILED_THIN1, PRT only
-    ADDR_TM_PRT_3D_TILED_THIN1  = 21,   ///< Same as 3D_TILED_THIN1, PRT only
-    ADDR_TM_PRT_TILED_THICK     = 22,   ///< No bank/pipe rotation or hashing beyond macrotile size
-    ADDR_TM_PRT_2D_TILED_THICK  = 23,   ///< Same as 2D_TILED_THICK, PRT only
-    ADDR_TM_PRT_3D_TILED_THICK  = 24,   ///< Same as 3D_TILED_THICK, PRT only
-    ADDR_TM_UNKNOWN             = 25,   ///< Unkown tile mode, should be decided by address lib
-    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
-*
-*   @brief
-*       Neutral enum for SurfaceFormat
-*
-****************************************************************************************************
-*/
-typedef enum _AddrFormat {
-    ADDR_FMT_INVALID                              = 0x00000000,
-    ADDR_FMT_8                                    = 0x00000001,
-    ADDR_FMT_4_4                                  = 0x00000002,
-    ADDR_FMT_3_3_2                                = 0x00000003,
-    ADDR_FMT_RESERVED_4                           = 0x00000004,
-    ADDR_FMT_16                                   = 0x00000005,
-    ADDR_FMT_16_FLOAT                             = 0x00000006,
-    ADDR_FMT_8_8                                  = 0x00000007,
-    ADDR_FMT_5_6_5                                = 0x00000008,
-    ADDR_FMT_6_5_5                                = 0x00000009,
-    ADDR_FMT_1_5_5_5                              = 0x0000000a,
-    ADDR_FMT_4_4_4_4                              = 0x0000000b,
-    ADDR_FMT_5_5_5_1                              = 0x0000000c,
-    ADDR_FMT_32                                   = 0x0000000d,
-    ADDR_FMT_32_FLOAT                             = 0x0000000e,
-    ADDR_FMT_16_16                                = 0x0000000f,
-    ADDR_FMT_16_16_FLOAT                          = 0x00000010,
-    ADDR_FMT_8_24                                 = 0x00000011,
-    ADDR_FMT_8_24_FLOAT                           = 0x00000012,
-    ADDR_FMT_24_8                                 = 0x00000013,
-    ADDR_FMT_24_8_FLOAT                           = 0x00000014,
-    ADDR_FMT_10_11_11                             = 0x00000015,
-    ADDR_FMT_10_11_11_FLOAT                       = 0x00000016,
-    ADDR_FMT_11_11_10                             = 0x00000017,
-    ADDR_FMT_11_11_10_FLOAT                       = 0x00000018,
-    ADDR_FMT_2_10_10_10                           = 0x00000019,
-    ADDR_FMT_8_8_8_8                              = 0x0000001a,
-    ADDR_FMT_10_10_10_2                           = 0x0000001b,
-    ADDR_FMT_X24_8_32_FLOAT                       = 0x0000001c,
-    ADDR_FMT_32_32                                = 0x0000001d,
-    ADDR_FMT_32_32_FLOAT                          = 0x0000001e,
-    ADDR_FMT_16_16_16_16                          = 0x0000001f,
-    ADDR_FMT_16_16_16_16_FLOAT                    = 0x00000020,
-    ADDR_FMT_RESERVED_33                          = 0x00000021,
-    ADDR_FMT_32_32_32_32                          = 0x00000022,
-    ADDR_FMT_32_32_32_32_FLOAT                    = 0x00000023,
-    ADDR_FMT_RESERVED_36                          = 0x00000024,
-    ADDR_FMT_1                                    = 0x00000025,
-    ADDR_FMT_1_REVERSED                           = 0x00000026,
-    ADDR_FMT_GB_GR                                = 0x00000027,
-    ADDR_FMT_BG_RG                                = 0x00000028,
-    ADDR_FMT_32_AS_8                              = 0x00000029,
-    ADDR_FMT_32_AS_8_8                            = 0x0000002a,
-    ADDR_FMT_5_9_9_9_SHAREDEXP                    = 0x0000002b,
-    ADDR_FMT_8_8_8                                = 0x0000002c,
-    ADDR_FMT_16_16_16                             = 0x0000002d,
-    ADDR_FMT_16_16_16_FLOAT                       = 0x0000002e,
-    ADDR_FMT_32_32_32                             = 0x0000002f,
-    ADDR_FMT_32_32_32_FLOAT                       = 0x00000030,
-    ADDR_FMT_BC1                                  = 0x00000031,
-    ADDR_FMT_BC2                                  = 0x00000032,
-    ADDR_FMT_BC3                                  = 0x00000033,
-    ADDR_FMT_BC4                                  = 0x00000034,
-    ADDR_FMT_BC5                                  = 0x00000035,
-    ADDR_FMT_BC6                                  = 0x00000036,
-    ADDR_FMT_BC7                                  = 0x00000037,
-    ADDR_FMT_32_AS_32_32_32_32                    = 0x00000038,
-    ADDR_FMT_APC3                                 = 0x00000039,
-    ADDR_FMT_APC4                                 = 0x0000003a,
-    ADDR_FMT_APC5                                 = 0x0000003b,
-    ADDR_FMT_APC6                                 = 0x0000003c,
-    ADDR_FMT_APC7                                 = 0x0000003d,
-    ADDR_FMT_CTX1                                 = 0x0000003e,
-    ADDR_FMT_RESERVED_63                          = 0x0000003f,
-    ADDR_FMT_ASTC_4x4                             = 0x00000040,
-    ADDR_FMT_ASTC_5x4                             = 0x00000041,
-    ADDR_FMT_ASTC_5x5                             = 0x00000042,
-    ADDR_FMT_ASTC_6x5                             = 0x00000043,
-    ADDR_FMT_ASTC_6x6                             = 0x00000044,
-    ADDR_FMT_ASTC_8x5                             = 0x00000045,
-    ADDR_FMT_ASTC_8x6                             = 0x00000046,
-    ADDR_FMT_ASTC_8x8                             = 0x00000047,
-    ADDR_FMT_ASTC_10x5                            = 0x00000048,
-    ADDR_FMT_ASTC_10x6                            = 0x00000049,
-    ADDR_FMT_ASTC_10x8                            = 0x0000004a,
-    ADDR_FMT_ASTC_10x10                           = 0x0000004b,
-    ADDR_FMT_ASTC_12x10                           = 0x0000004c,
-    ADDR_FMT_ASTC_12x12                           = 0x0000004d,
-    ADDR_FMT_ETC2_64BPP                           = 0x0000004e,
-    ADDR_FMT_ETC2_128BPP                          = 0x0000004f,
-} AddrFormat;
-
-/**
-****************************************************************************************************
-*   AddrDepthFormat
-*
-*   @brief
-*       Neutral enum for addrFlt32ToDepthPixel
-*
-****************************************************************************************************
-*/
-typedef enum _AddrDepthFormat
-{
-    ADDR_DEPTH_INVALID                            = 0x00000000,
-    ADDR_DEPTH_16                                 = 0x00000001,
-    ADDR_DEPTH_X8_24                              = 0x00000002,
-    ADDR_DEPTH_8_24                               = 0x00000003,
-    ADDR_DEPTH_X8_24_FLOAT                        = 0x00000004,
-    ADDR_DEPTH_8_24_FLOAT                         = 0x00000005,
-    ADDR_DEPTH_32_FLOAT                           = 0x00000006,
-    ADDR_DEPTH_X24_8_32_FLOAT                     = 0x00000007,
-
-} AddrDepthFormat;
-
-/**
-****************************************************************************************************
-*   AddrColorFormat
-*
-*   @brief
-*       Neutral enum for ColorFormat
-*
-****************************************************************************************************
-*/
-typedef enum _AddrColorFormat
-{
-    ADDR_COLOR_INVALID                            = 0x00000000,
-    ADDR_COLOR_8                                  = 0x00000001,
-    ADDR_COLOR_4_4                                = 0x00000002,
-    ADDR_COLOR_3_3_2                              = 0x00000003,
-    ADDR_COLOR_RESERVED_4                         = 0x00000004,
-    ADDR_COLOR_16                                 = 0x00000005,
-    ADDR_COLOR_16_FLOAT                           = 0x00000006,
-    ADDR_COLOR_8_8                                = 0x00000007,
-    ADDR_COLOR_5_6_5                              = 0x00000008,
-    ADDR_COLOR_6_5_5                              = 0x00000009,
-    ADDR_COLOR_1_5_5_5                            = 0x0000000a,
-    ADDR_COLOR_4_4_4_4                            = 0x0000000b,
-    ADDR_COLOR_5_5_5_1                            = 0x0000000c,
-    ADDR_COLOR_32                                 = 0x0000000d,
-    ADDR_COLOR_32_FLOAT                           = 0x0000000e,
-    ADDR_COLOR_16_16                              = 0x0000000f,
-    ADDR_COLOR_16_16_FLOAT                        = 0x00000010,
-    ADDR_COLOR_8_24                               = 0x00000011,
-    ADDR_COLOR_8_24_FLOAT                         = 0x00000012,
-    ADDR_COLOR_24_8                               = 0x00000013,
-    ADDR_COLOR_24_8_FLOAT                         = 0x00000014,
-    ADDR_COLOR_10_11_11                           = 0x00000015,
-    ADDR_COLOR_10_11_11_FLOAT                     = 0x00000016,
-    ADDR_COLOR_11_11_10                           = 0x00000017,
-    ADDR_COLOR_11_11_10_FLOAT                     = 0x00000018,
-    ADDR_COLOR_2_10_10_10                         = 0x00000019,
-    ADDR_COLOR_8_8_8_8                            = 0x0000001a,
-    ADDR_COLOR_10_10_10_2                         = 0x0000001b,
-    ADDR_COLOR_X24_8_32_FLOAT                     = 0x0000001c,
-    ADDR_COLOR_32_32                              = 0x0000001d,
-    ADDR_COLOR_32_32_FLOAT                        = 0x0000001e,
-    ADDR_COLOR_16_16_16_16                        = 0x0000001f,
-    ADDR_COLOR_16_16_16_16_FLOAT                  = 0x00000020,
-    ADDR_COLOR_RESERVED_33                        = 0x00000021,
-    ADDR_COLOR_32_32_32_32                        = 0x00000022,
-    ADDR_COLOR_32_32_32_32_FLOAT                  = 0x00000023,
-} AddrColorFormat;
-
-/**
-****************************************************************************************************
-*   AddrSurfaceNumber
-*
-*   @brief
-*       Neutral enum for SurfaceNumber
-*
-****************************************************************************************************
-*/
-typedef enum _AddrSurfaceNumber {
-    ADDR_NUMBER_UNORM                             = 0x00000000,
-    ADDR_NUMBER_SNORM                             = 0x00000001,
-    ADDR_NUMBER_USCALED                           = 0x00000002,
-    ADDR_NUMBER_SSCALED                           = 0x00000003,
-    ADDR_NUMBER_UINT                              = 0x00000004,
-    ADDR_NUMBER_SINT                              = 0x00000005,
-    ADDR_NUMBER_SRGB                              = 0x00000006,
-    ADDR_NUMBER_FLOAT                             = 0x00000007,
-} AddrSurfaceNumber;
-
-/**
-****************************************************************************************************
-*   AddrSurfaceSwap
-*
-*   @brief
-*       Neutral enum for SurfaceSwap
-*
-****************************************************************************************************
-*/
-typedef enum _AddrSurfaceSwap {
-    ADDR_SWAP_STD                                 = 0x00000000,
-    ADDR_SWAP_ALT                                 = 0x00000001,
-    ADDR_SWAP_STD_REV                             = 0x00000002,
-    ADDR_SWAP_ALT_REV                             = 0x00000003,
-} AddrSurfaceSwap;
-
-/**
-****************************************************************************************************
-*   AddrHtileBlockSize
-*
-*   @brief
-*       Size of HTILE blocks, valid values are 4 or 8 for now
-****************************************************************************************************
-*/
-typedef enum _AddrHtileBlockSize
-{
-    ADDR_HTILE_BLOCKSIZE_4 = 4,
-    ADDR_HTILE_BLOCKSIZE_8 = 8,
-} AddrHtileBlockSize;
-
-
-/**
-****************************************************************************************************
-*   AddrPipeCfg
-*
-*   @brief
-*       The pipe configuration field specifies both the number of pipes and
-*       how pipes are interleaved on the surface.
-*       The expression of number of pipes, the shader engine tile size, and packer tile size
-*       is encoded in a PIPE_CONFIG register field.
-*       In general the number of pipes usually matches the number of memory channels of the
-*       hardware configuration.
-*       For hw configurations w/ non-pow2 memory number of memory channels, it usually matches
-*       the number of ROP units(? TODO: which registers??)
-*       The enum value = hw enum + 1 which is to reserve 0 for requesting default.
-****************************************************************************************************
-*/
-typedef enum _AddrPipeCfg
-{
-    ADDR_PIPECFG_INVALID         = 0,
-    ADDR_PIPECFG_P2              = 1, /// 2 pipes,
-    ADDR_PIPECFG_P4_8x16         = 5, /// 4 pipes,
-    ADDR_PIPECFG_P4_16x16        = 6,
-    ADDR_PIPECFG_P4_16x32        = 7,
-    ADDR_PIPECFG_P4_32x32        = 8,
-    ADDR_PIPECFG_P8_16x16_8x16   = 9, /// 8 pipes
-    ADDR_PIPECFG_P8_16x32_8x16   = 10,
-    ADDR_PIPECFG_P8_32x32_8x16   = 11,
-    ADDR_PIPECFG_P8_16x32_16x16  = 12,
-    ADDR_PIPECFG_P8_32x32_16x16  = 13,
-    ADDR_PIPECFG_P8_32x32_16x32  = 14,
-    ADDR_PIPECFG_P8_32x64_32x32  = 15,
-    ADDR_PIPECFG_P16_32x32_8x16  = 17, /// 16 pipes
-    ADDR_PIPECFG_P16_32x32_16x16 = 18,
-    ADDR_PIPECFG_MAX             = 19,
-} AddrPipeCfg;
-
-/**
-****************************************************************************************************
-* AddrTileType
-*
-*   @brief
-*       Neutral enums that specifies micro tile type (MICRO_TILE_MODE)
-****************************************************************************************************
-*/
-typedef enum _AddrTileType
-{
-    ADDR_DISPLAYABLE        = 0,    ///< Displayable tiling
-    ADDR_NON_DISPLAYABLE    = 1,    ///< Non-displayable tiling, a.k.a thin micro tiling
-    ADDR_DEPTH_SAMPLE_ORDER = 2,    ///< Same as non-displayable plus depth-sample-order
-    ADDR_ROTATED            = 3,    ///< Rotated displayable tiling
-    ADDR_THICK              = 4,    ///< Thick micro-tiling, only valid for THICK and XTHICK
-} AddrTileType;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-//  Type definitions: short system-independent names for address library types
-//
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if !defined(__APPLE__) || defined(HAVE_TSERVER)
-
-#ifndef BOOL_32        // no bool type in C
-/// @brief Boolean type, since none is defined in C
-/// @ingroup type
-#define BOOL_32 int
-#endif
-
-#ifndef INT_32
-#define INT_32  int
-#endif
-
-#ifndef UINT_32
-#define UINT_32 unsigned int
-#endif
-
-#ifndef INT_16
-#define INT_16  short
-#endif
-
-#ifndef UINT_16
-#define UINT_16 unsigned short
-#endif
-
-#ifndef INT_8
-#define INT_8   char
-#endif
-
-#ifndef UINT_8
-#define UINT_8  unsigned char
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-//
-//  64-bit integer types depend on the compiler
-//
-#if defined( __GNUC__ ) || defined( __WATCOMC__ )
-#define INT_64   long long
-#define UINT_64  unsigned long long
-
-#elif defined( _WIN32 )
-#define INT_64   __int64
-#define UINT_64  unsigned __int64
-
-#else
-#error Unsupported compiler and/or operating system for 64-bit integers
-
-/// @brief 64-bit signed integer type (compiler dependent)
-/// @ingroup type
-///
-/// The addrlib defines a 64-bit signed integer type for either
-/// Gnu/Watcom compilers (which use the first syntax) or for
-/// the Windows VCC compiler (which uses the second syntax).
-#define INT_64  long long OR __int64
-
-/// @brief 64-bit unsigned integer type (compiler dependent)
-/// @ingroup type
-///
-/// The addrlib defines a 64-bit unsigned integer type for either
-/// Gnu/Watcom compilers (which use the first syntax) or for
-/// the Windows VCC compiler (which uses the second syntax).
-///
-#define UINT_64  unsigned long long OR unsigned __int64
-#endif
-
-#endif // #if !defined(__APPLE__) || defined(HAVE_TSERVER)
-
-//  ADDR64X is used to print addresses in hex form on both Windows and Linux
-//
-#if defined( __GNUC__ ) || defined( __WATCOMC__ )
-#define ADDR64X "llx"
-#define ADDR64D "lld"
-
-#elif defined( _WIN32 )
-#define ADDR64X "I64x"
-#define ADDR64D "I64d"
-
-#else
-#error Unsupported compiler and/or operating system for 64-bit integers
-
-/// @brief Addrlib device address 64-bit printf tag  (compiler dependent)
-/// @ingroup type
-///
-/// This allows printf to display an ADDR_64 for either the Windows VCC compiler
-/// (which used this value) or the Gnu/Watcom compilers (which use "llx".
-/// An example of use is printf("addr 0x%"ADDR64X"\n", address);
-///
-#define ADDR64X "llx" OR "I64x"
-#define ADDR64D "lld" OR "I64d"
-#endif
-
-
-/// @brief Union for storing a 32-bit float or 32-bit integer
-/// @ingroup type
-///
-/// This union provides a simple way to convert between a 32-bit float
-/// and a 32-bit integer. It also prevents the compiler from producing
-/// code that alters NaN values when assiging or coying floats.
-/// Therefore, all address library routines that pass or return 32-bit
-/// floating point data do so by passing or returning a FLT_32.
-///
-typedef union {
-    INT_32   i;
-    UINT_32  u;
-    float    f;
-} ADDR_FLT_32;
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-//  Macros for controlling linking and building on multiple systems
-//
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#if defined(_MSC_VER)
-#if defined(va_copy)
-#undef va_copy  //redefine va_copy to support VC2013
-#endif
-#endif
-
-#if !defined(va_copy)
-#define va_copy(dst, src) \
-    ((void) memcpy(&(dst), &(src), sizeof(va_list)))
-#endif
-
-#endif // __ADDR_TYPES_H__
-
diff --git a/src/amd/addrlib/amdgpu_asic_addr.h b/src/amd/addrlib/amdgpu_asic_addr.h
deleted file mode 100644 (file)
index 7436c54..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _AMDGPU_ASIC_ADDR_H
-#define _AMDGPU_ASIC_ADDR_H
-
-#define ATI_VENDOR_ID         0x1002
-#define AMD_VENDOR_ID         0x1022
-
-// AMDGPU_VENDOR_IS_AMD(vendorId)
-#define AMDGPU_VENDOR_IS_AMD(v) ((v == ATI_VENDOR_ID) || (v == AMD_VENDOR_ID))
-
-#define FAMILY_UNKNOWN 0x00
-#define FAMILY_TN      0x69
-#define FAMILY_SI      0x6E
-#define FAMILY_CI      0x78
-#define FAMILY_KV      0x7D
-#define FAMILY_VI      0x82
-#define FAMILY_POLARIS 0x82
-#define FAMILY_CZ      0x87
-#define FAMILY_AI      0x8D
-#define FAMILY_RV      0x8E
-
-// AMDGPU_FAMILY_IS(familyId, familyName)
-#define FAMILY_IS(f, fn)     (f == FAMILY_##fn)
-#define FAMILY_IS_TN(f)      FAMILY_IS(f, TN)
-#define FAMILY_IS_SI(f)      FAMILY_IS(f, SI)
-#define FAMILY_IS_CI(f)      FAMILY_IS(f, CI)
-#define FAMILY_IS_KV(f)      FAMILY_IS(f, KV)
-#define FAMILY_IS_VI(f)      FAMILY_IS(f, VI)
-#define FAMILY_IS_POLARIS(f) FAMILY_IS(f, POLARIS)
-#define FAMILY_IS_CZ(f)      FAMILY_IS(f, CZ)
-#define FAMILY_IS_AI(f)      FAMILY_IS(f, AI)
-#define FAMILY_IS_RV(f)      FAMILY_IS(f, RV)
-
-#define AMDGPU_UNKNOWN          0xFF
-
-#define AMDGPU_TAHITI_RANGE     0x05, 0x14
-#define AMDGPU_PITCAIRN_RANGE   0x15, 0x28
-#define AMDGPU_CAPEVERDE_RANGE  0x29, 0x3C
-#define AMDGPU_OLAND_RANGE      0x3C, 0x46
-#define AMDGPU_HAINAN_RANGE     0x46, 0xFF
-
-#define AMDGPU_BONAIRE_RANGE    0x14, 0x28
-#define AMDGPU_HAWAII_RANGE     0x28, 0x3C
-
-#define AMDGPU_SPECTRE_RANGE    0x01, 0x41
-#define AMDGPU_SPOOKY_RANGE     0x41, 0x81
-#define AMDGPU_KALINDI_RANGE    0x81, 0xA1
-#define AMDGPU_GODAVARI_RANGE   0xA1, 0xFF
-
-#define AMDGPU_ICELAND_RANGE    0x01, 0x14
-#define AMDGPU_TONGA_RANGE      0x14, 0x28
-#define AMDGPU_FIJI_RANGE       0x3C, 0x50
-
-#define AMDGPU_POLARIS10_RANGE  0x50, 0x5A
-#define AMDGPU_POLARIS11_RANGE  0x5A, 0x64
-#define AMDGPU_POLARIS12_RANGE  0x64, 0x6E
-#define AMDGPU_VEGAM_RANGE      0x6E, 0xFF
-
-#define AMDGPU_CARRIZO_RANGE    0x01, 0x21
-#define AMDGPU_BRISTOL_RANGE    0x10, 0x21
-#define AMDGPU_STONEY_RANGE     0x61, 0xFF
-
-#define AMDGPU_VEGA10_RANGE     0x01, 0x14
-#define AMDGPU_VEGA12_RANGE     0x14, 0x28
-#define AMDGPU_VEGA20_RANGE     0x28, 0xFF
-
-#define AMDGPU_RAVEN_RANGE      0x01, 0x81
-#define AMDGPU_RAVEN2_RANGE     0x81, 0xFF
-
-#define AMDGPU_EXPAND_FIX(x) x
-#define AMDGPU_RANGE_HELPER(val, min, max) ((val >= min) && (val < max))
-#define AMDGPU_IN_RANGE(val, ...)   AMDGPU_EXPAND_FIX(AMDGPU_RANGE_HELPER(val, __VA_ARGS__))
-
-
-// ASICREV_IS(eRevisionId, revisionName)
-#define ASICREV_IS(r, rn)              AMDGPU_IN_RANGE(r, AMDGPU_##rn##_RANGE)
-#define ASICREV_IS_TAHITI_P(r)         ASICREV_IS(r, TAHITI)
-#define ASICREV_IS_PITCAIRN_PM(r)      ASICREV_IS(r, PITCAIRN)
-#define ASICREV_IS_CAPEVERDE_M(r)      ASICREV_IS(r, CAPEVERDE)
-#define ASICREV_IS_OLAND_M(r)          ASICREV_IS(r, OLAND)
-#define ASICREV_IS_HAINAN_V(r)         ASICREV_IS(r, HAINAN)
-
-#define ASICREV_IS_BONAIRE_M(r)        ASICREV_IS(r, BONAIRE)
-#define ASICREV_IS_HAWAII_P(r)         ASICREV_IS(r, HAWAII)
-
-#define ASICREV_IS_SPECTRE(r)          ASICREV_IS(r, SPECTRE)
-#define ASICREV_IS_SPOOKY(r)           ASICREV_IS(r, SPOOKY)
-#define ASICREV_IS_KALINDI(r)          ASICREV_IS(r, KALINDI)
-#define ASICREV_IS_KALINDI_GODAVARI(r) ASICREV_IS(r, GODAVARI)
-
-#define ASICREV_IS_ICELAND_M(r)        ASICREV_IS(r, ICELAND)
-#define ASICREV_IS_TONGA_P(r)          ASICREV_IS(r, TONGA)
-#define ASICREV_IS_FIJI_P(r)           ASICREV_IS(r, FIJI)
-
-#define ASICREV_IS_POLARIS10_P(r)      ASICREV_IS(r, POLARIS10)
-#define ASICREV_IS_POLARIS11_M(r)      ASICREV_IS(r, POLARIS11)
-#define ASICREV_IS_POLARIS12_V(r)      ASICREV_IS(r, POLARIS12)
-#define ASICREV_IS_VEGAM_P(r)          ASICREV_IS(r, VEGAM)
-
-#define ASICREV_IS_CARRIZO(r)          ASICREV_IS(r, CARRIZO)
-#define ASICREV_IS_CARRIZO_BRISTOL(r)  ASICREV_IS(r, BRISTOL)
-#define ASICREV_IS_STONEY(r)           ASICREV_IS(r, STONEY)
-
-#define ASICREV_IS_VEGA10_M(r)         ASICREV_IS(r, VEGA10)
-#define ASICREV_IS_VEGA10_P(r)         ASICREV_IS(r, VEGA10)
-#define ASICREV_IS_VEGA12_P(r)         ASICREV_IS(r, VEGA12)
-#define ASICREV_IS_VEGA12_p(r)         ASICREV_IS(r, VEGA12)
-#define ASICREV_IS_VEGA20_P(r)         ASICREV_IS(r, VEGA20)
-
-#define ASICREV_IS_RAVEN(r)            ASICREV_IS(r, RAVEN)
-#define ASICREV_IS_RAVEN2(r)           ASICREV_IS(r, RAVEN2)
-
-#endif // _AMDGPU_ASIC_ADDR_H
diff --git a/src/amd/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h
deleted file mode 100644 (file)
index 99bb62e..0000000
+++ /dev/null
@@ -1,924 +0,0 @@
-/*
- * Copyright © 2014 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  addrcommon.h
-* @brief Contains the helper function and constants.
-****************************************************************************************************
-*/
-
-#ifndef __ADDR_COMMON_H__
-#define __ADDR_COMMON_H__
-
-#include "addrinterface.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#if !defined(DEBUG)
-#ifdef NDEBUG
-#define DEBUG 0
-#else
-#define DEBUG 1
-#endif
-#endif
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Platform specific debug break defines
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#if DEBUG
-    #if defined(__GNUC__)
-        #define ADDR_DBG_BREAK()    assert(false)
-    #elif defined(__APPLE__)
-        #define ADDR_DBG_BREAK()    { IOPanic("");}
-    #else
-        #define ADDR_DBG_BREAK()    { __debugbreak(); }
-    #endif
-#else
-    #define ADDR_DBG_BREAK()
-#endif
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Debug assertions used in AddrLib
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#if defined(_WIN32) && (_MSC_VER >= 1400)
-    #define ADDR_ANALYSIS_ASSUME(expr) __analysis_assume(expr)
-#else
-    #define ADDR_ANALYSIS_ASSUME(expr) do { (void)(expr); } while (0)
-#endif
-
-#define ADDR_ASSERT(__e) assert(__e)
-#define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK()
-#define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case")
-#define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented");
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Debug print macro from legacy address library
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#if DEBUG
-
-#define ADDR_PRNT(a)    Object::DebugPrint a
-
-/// @brief Macro for reporting informational messages
-/// @ingroup util
-///
-/// This macro optionally prints an informational message to stdout.
-/// The first parameter is a condition -- if it is true, nothing is done.
-/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
-/// starting with a string. This is passed to printf() or an equivalent
-/// in order to format the informational message. For example,
-/// ADDR_INFO(0, ("test %d",3) ); prints out "test 3".
-///
-#define ADDR_INFO(cond, a)         \
-{ if (!(cond)) { ADDR_PRNT(a); } }
-
-
-/// @brief Macro for reporting error warning messages
-/// @ingroup util
-///
-/// This macro optionally prints an error warning message to stdout,
-/// followed by the file name and line number where the macro was called.
-/// The first parameter is a condition -- if it is true, nothing is done.
-/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
-/// starting with a string. This is passed to printf() or an equivalent
-/// in order to format the informational message. For example,
-/// ADDR_WARN(0, ("test %d",3) ); prints out "test 3" followed by
-/// a second line with the file name and line number.
-///
-#define ADDR_WARN(cond, a)         \
-{ if (!(cond))                     \
-  { ADDR_PRNT(a);                  \
-    ADDR_PRNT(("  WARNING in file %s, line %d\n", __FILE__, __LINE__)); \
-} }
-
-
-/// @brief Macro for reporting fatal error conditions
-/// @ingroup util
-///
-/// This macro optionally stops execution of the current routine
-/// after printing an error warning message to stdout,
-/// followed by the file name and line number where the macro was called.
-/// The first parameter is a condition -- if it is true, nothing is done.
-/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
-/// starting with a string. This is passed to printf() or an equivalent
-/// in order to format the informational message. For example,
-/// ADDR_EXIT(0, ("test %d",3) ); prints out "test 3" followed by
-/// a second line with the file name and line number, then stops execution.
-///
-#define ADDR_EXIT(cond, a)         \
-{ if (!(cond))                     \
-  { ADDR_PRNT(a); ADDR_DBG_BREAK();\
-} }
-
-#else // DEBUG
-
-#define ADDRDPF 1 ? (void)0 : (void)
-
-#define ADDR_PRNT(a)
-
-#define ADDR_DBG_BREAK()
-
-#define ADDR_INFO(cond, a)
-
-#define ADDR_WARN(cond, a)
-
-#define ADDR_EXIT(cond, a)
-
-#endif // DEBUG
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#define ADDR_C_ASSERT(__e) typedef char __ADDR_C_ASSERT__[(__e) ? 1 : -1]
-
-namespace Addr
-{
-
-namespace V1
-{
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Common constants
-////////////////////////////////////////////////////////////////////////////////////////////////////
-static const UINT_32 MicroTileWidth      = 8;       ///< Micro tile width, for 1D and 2D tiling
-static const UINT_32 MicroTileHeight     = 8;       ///< Micro tile height, for 1D and 2D tiling
-static const UINT_32 ThickTileThickness  = 4;       ///< Micro tile thickness, for THICK modes
-static const UINT_32 XThickTileThickness = 8;       ///< Extra thick tiling thickness
-static const UINT_32 PowerSaveTileBytes  = 64;      ///< Nuber of bytes per tile for power save 64
-static const UINT_32 CmaskCacheBits      = 1024;    ///< Number of bits for CMASK cache
-static const UINT_32 CmaskElemBits       = 4;       ///< Number of bits for CMASK element
-static const UINT_32 HtileCacheBits      = 16384;   ///< Number of bits for HTILE cache 512*32
-
-static const UINT_32 MicroTilePixels     = MicroTileWidth * MicroTileHeight;
-
-static const INT_32 TileIndexInvalid        = TILEINDEX_INVALID;
-static const INT_32 TileIndexLinearGeneral  = TILEINDEX_LINEAR_GENERAL;
-static const INT_32 TileIndexNoMacroIndex   = -3;
-
-} // V1
-
-namespace V2
-{
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Common constants
-////////////////////////////////////////////////////////////////////////////////////////////////////
-static const UINT_32 MaxSurfaceHeight = 16384;
-
-} // V2
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Common macros
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#define BITS_PER_BYTE 8
-#define BITS_TO_BYTES(x) ( ((x) + (BITS_PER_BYTE-1)) / BITS_PER_BYTE )
-#define BYTES_TO_BITS(x) ( (x) * BITS_PER_BYTE )
-
-/// Helper macros to select a single bit from an int (undefined later in section)
-#define _BIT(v,b)      (((v) >> (b) ) & 1)
-
-/**
-****************************************************************************************************
-* @brief Enums to identify AddrLib type
-****************************************************************************************************
-*/
-enum LibClass
-{
-    BASE_ADDRLIB = 0x0,
-    R600_ADDRLIB = 0x6,
-    R800_ADDRLIB = 0x8,
-    SI_ADDRLIB   = 0xa,
-    CI_ADDRLIB   = 0xb,
-    AI_ADDRLIB   = 0xd,
-};
-
-/**
-****************************************************************************************************
-* ChipFamily
-*
-*   @brief
-*       Neutral enums that specifies chip family.
-*
-****************************************************************************************************
-*/
-enum ChipFamily
-{
-    ADDR_CHIP_FAMILY_IVLD,    ///< Invalid family
-    ADDR_CHIP_FAMILY_R6XX,
-    ADDR_CHIP_FAMILY_R7XX,
-    ADDR_CHIP_FAMILY_R8XX,
-    ADDR_CHIP_FAMILY_NI,
-    ADDR_CHIP_FAMILY_SI,
-    ADDR_CHIP_FAMILY_CI,
-    ADDR_CHIP_FAMILY_VI,
-    ADDR_CHIP_FAMILY_AI,
-};
-
-/**
-****************************************************************************************************
-* ConfigFlags
-*
-*   @brief
-*       This structure is used to set configuration flags.
-****************************************************************************************************
-*/
-union ConfigFlags
-{
-    struct
-    {
-        /// These flags are set up internally thru AddrLib::Create() based on ADDR_CREATE_FLAGS
-        UINT_32 optimalBankSwap        : 1;    ///< New bank tiling for RV770 only
-        UINT_32 noCubeMipSlicesPad     : 1;    ///< Disables faces padding for cubemap mipmaps
-        UINT_32 fillSizeFields         : 1;    ///< If clients fill size fields in all input and
-                                               ///  output structure
-        UINT_32 ignoreTileInfo         : 1;    ///< Don't use tile info structure
-        UINT_32 useTileIndex           : 1;    ///< Make tileIndex field in input valid
-        UINT_32 useCombinedSwizzle     : 1;    ///< Use combined swizzle
-        UINT_32 checkLast2DLevel       : 1;    ///< Check the last 2D mip sub level
-        UINT_32 useHtileSliceAlign     : 1;    ///< Do htile single slice alignment
-        UINT_32 allowLargeThickTile    : 1;    ///< Allow 64*thickness*bytesPerPixel > rowSize
-        UINT_32 disableLinearOpt       : 1;    ///< Disallow tile modes to be optimized to linear
-        UINT_32 reserved               : 22;   ///< Reserved bits for future use
-    };
-
-    UINT_32 value;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Misc helper functions
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   AddrXorReduce
-*
-*   @brief
-*       Xor the right-side numberOfBits bits of x.
-****************************************************************************************************
-*/
-static inline UINT_32 XorReduce(
-    UINT_32 x,
-    UINT_32 numberOfBits)
-{
-    UINT_32 i;
-    UINT_32 result = x & 1;
-
-    for (i=1; i<numberOfBits; i++)
-    {
-        result ^= ((x>>i) & 1);
-    }
-
-    return result;
-}
-
-/**
-****************************************************************************************************
-*   IsPow2
-*
-*   @brief
-*       Check if the size (UINT_32) is pow 2
-****************************************************************************************************
-*/
-static inline UINT_32 IsPow2(
-    UINT_32 dim)        ///< [in] dimension of miplevel
-{
-    ADDR_ASSERT(dim > 0);
-    return !(dim & (dim - 1));
-}
-
-/**
-****************************************************************************************************
-*   IsPow2
-*
-*   @brief
-*       Check if the size (UINT_64) is pow 2
-****************************************************************************************************
-*/
-static inline UINT_64 IsPow2(
-    UINT_64 dim)        ///< [in] dimension of miplevel
-{
-    ADDR_ASSERT(dim > 0);
-    return !(dim & (dim - 1));
-}
-
-/**
-****************************************************************************************************
-*   ByteAlign
-*
-*   @brief
-*       Align UINT_32 "x" to "align" alignment, "align" should be power of 2
-****************************************************************************************************
-*/
-static inline UINT_32 PowTwoAlign(
-    UINT_32 x,
-    UINT_32 align)
-{
-    //
-    // Assert that x is a power of two.
-    //
-    ADDR_ASSERT(IsPow2(align));
-    return (x + (align - 1)) & (~(align - 1));
-}
-
-/**
-****************************************************************************************************
-*   ByteAlign
-*
-*   @brief
-*       Align UINT_64 "x" to "align" alignment, "align" should be power of 2
-****************************************************************************************************
-*/
-static inline UINT_64 PowTwoAlign(
-    UINT_64 x,
-    UINT_64 align)
-{
-    //
-    // Assert that x is a power of two.
-    //
-    ADDR_ASSERT(IsPow2(align));
-    return (x + (align - 1)) & (~(align - 1));
-}
-
-/**
-****************************************************************************************************
-*   Min
-*
-*   @brief
-*       Get the min value between two unsigned values
-****************************************************************************************************
-*/
-static inline UINT_32 Min(
-    UINT_32 value1,
-    UINT_32 value2)
-{
-    return ((value1 < (value2)) ? (value1) : value2);
-}
-
-/**
-****************************************************************************************************
-*   Min
-*
-*   @brief
-*       Get the min value between two signed values
-****************************************************************************************************
-*/
-static inline INT_32 Min(
-    INT_32 value1,
-    INT_32 value2)
-{
-    return ((value1 < (value2)) ? (value1) : value2);
-}
-
-/**
-****************************************************************************************************
-*   Max
-*
-*   @brief
-*       Get the max value between two unsigned values
-****************************************************************************************************
-*/
-static inline UINT_32 Max(
-    UINT_32 value1,
-    UINT_32 value2)
-{
-    return ((value1 > (value2)) ? (value1) : value2);
-}
-
-/**
-****************************************************************************************************
-*   Max
-*
-*   @brief
-*       Get the max value between two signed values
-****************************************************************************************************
-*/
-static inline INT_32 Max(
-    INT_32 value1,
-    INT_32 value2)
-{
-    return ((value1 > (value2)) ? (value1) : value2);
-}
-
-/**
-****************************************************************************************************
-*   NextPow2
-*
-*   @brief
-*       Compute the mipmap's next level dim size
-****************************************************************************************************
-*/
-static inline UINT_32 NextPow2(
-    UINT_32 dim)        ///< [in] dimension of miplevel
-{
-    UINT_32 newDim = 1;
-
-    if (dim > 0x7fffffff)
-    {
-        ADDR_ASSERT_ALWAYS();
-        newDim = 0x80000000;
-    }
-    else
-    {
-        while (newDim < dim)
-        {
-            newDim <<= 1;
-        }
-    }
-
-    return newDim;
-}
-
-/**
-****************************************************************************************************
-*   Log2NonPow2
-*
-*   @brief
-*       Compute log of base 2 no matter the target is power of 2 or not
-****************************************************************************************************
-*/
-static inline UINT_32 Log2NonPow2(
-    UINT_32 x)      ///< [in] the value should calculate log based 2
-{
-    UINT_32 y;
-
-    y = 0;
-    while (x > 1)
-    {
-        x >>= 1;
-        y++;
-    }
-
-    return y;
-}
-
-/**
-****************************************************************************************************
-*   Log2
-*
-*   @brief
-*       Compute log of base 2
-****************************************************************************************************
-*/
-static inline UINT_32 Log2(
-    UINT_32 x)      ///< [in] the value should calculate log based 2
-{
-    // Assert that x is a power of two.
-    ADDR_ASSERT(IsPow2(x));
-
-    return Log2NonPow2(x);
-}
-
-/**
-****************************************************************************************************
-*   QLog2
-*
-*   @brief
-*       Compute log of base 2 quickly (<= 16)
-****************************************************************************************************
-*/
-static inline UINT_32 QLog2(
-    UINT_32 x)      ///< [in] the value should calculate log based 2
-{
-    ADDR_ASSERT(x <= 16);
-
-    UINT_32 y = 0;
-
-    switch (x)
-    {
-        case 1:
-            y = 0;
-            break;
-        case 2:
-            y = 1;
-            break;
-        case 4:
-            y = 2;
-            break;
-        case 8:
-            y = 3;
-            break;
-        case 16:
-            y = 4;
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-    }
-
-    return y;
-}
-
-/**
-****************************************************************************************************
-*   SafeAssign
-*
-*   @brief
-*       NULL pointer safe assignment
-****************************************************************************************************
-*/
-static inline VOID SafeAssign(
-    UINT_32*    pLVal,  ///< [in] Pointer to left val
-    UINT_32     rVal)   ///< [in] Right value
-{
-    if (pLVal)
-    {
-        *pLVal = rVal;
-    }
-}
-
-/**
-****************************************************************************************************
-*   SafeAssign
-*
-*   @brief
-*       NULL pointer safe assignment for 64bit values
-****************************************************************************************************
-*/
-static inline VOID SafeAssign(
-    UINT_64*    pLVal,  ///< [in] Pointer to left val
-    UINT_64     rVal)   ///< [in] Right value
-{
-    if (pLVal)
-    {
-        *pLVal = rVal;
-    }
-}
-
-/**
-****************************************************************************************************
-*   SafeAssign
-*
-*   @brief
-*       NULL pointer safe assignment for AddrTileMode
-****************************************************************************************************
-*/
-static inline VOID SafeAssign(
-    AddrTileMode*    pLVal, ///< [in] Pointer to left val
-    AddrTileMode     rVal)  ///< [in] Right value
-{
-    if (pLVal)
-    {
-        *pLVal = rVal;
-    }
-}
-
-/**
-****************************************************************************************************
-*   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: v[0]v[1]...v[num-2]v[num-1]
-****************************************************************************************************
-*/
-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
-*       Set channel initialization value via a return value
-****************************************************************************************************
-*/
-static inline ADDR_CHANNEL_SETTING InitChannel(
-    UINT_32     valid,     ///< [in] valid setting
-    UINT_32     channel,   ///< [in] channel setting
-    UINT_32     index)     ///< [in] index setting
-{
-    ADDR_CHANNEL_SETTING t;
-    t.valid = valid;
-    t.channel = channel;
-    t.index = index;
-
-    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->index;
-}
-
-/**
-****************************************************************************************************
-*   GetMaxValidChannelIndex
-*
-*   @brief
-*       Get max valid index for a specific channel
-****************************************************************************************************
-*/
-static inline UINT_32 GetMaxValidChannelIndex(
-    const 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;
-}
-
-/**
-****************************************************************************************************
-*   GetCoordActiveMask
-*
-*   @brief
-*       Get bit mask which indicates which positions in the equation match the target coord
-****************************************************************************************************
-*/
-static inline UINT_32 GetCoordActiveMask(
-    const 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)      ///< [in] index to be searched
-{
-    UINT_32 mask = 0;
-
-    for (UINT_32 i = 0; i < searchCount; i++)
-    {
-        if ((pChanSet[i].valid   == TRUE)    &&
-            (pChanSet[i].channel == channel) &&
-            (pChanSet[i].index   == index))
-        {
-            mask |= (1 << i);
-        }
-    }
-
-    return mask;
-}
-
-} // Addr
-
-#endif // __ADDR_COMMON_H__
-
diff --git a/src/amd/addrlib/core/addrelemlib.cpp b/src/amd/addrlib/core/addrelemlib.cpp
deleted file mode 100644 (file)
index c9e6da4..0000000
+++ /dev/null
@@ -1,1843 +0,0 @@
-/*
- * Copyright © 2014 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  addrelemlib.cpp
-* @brief Contains the class implementation for element/pixel related functions.
-****************************************************************************************************
-*/
-
-#include "addrelemlib.h"
-#include "addrlib.h"
-
-namespace Addr
-{
-
-/**
-****************************************************************************************************
-*   ElemLib::ElemLib
-*
-*   @brief
-*       constructor
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-ElemLib::ElemLib(
-    Lib* pAddrLib)  ///< [in] Parent addrlib instance pointer
-    :
-    Object(pAddrLib->GetClient()),
-    m_pAddrLib(pAddrLib)
-{
-    switch (m_pAddrLib->GetChipFamily())
-    {
-        case ADDR_CHIP_FAMILY_R6XX:
-            m_depthPlanarType = ADDR_DEPTH_PLANAR_R600;
-            m_fp16ExportNorm = 0;
-            break;
-        case ADDR_CHIP_FAMILY_R7XX:
-            m_depthPlanarType = ADDR_DEPTH_PLANAR_R600;
-            m_fp16ExportNorm = 1;
-            break;
-        case ADDR_CHIP_FAMILY_R8XX:
-        case ADDR_CHIP_FAMILY_NI: // Same as 8xx
-            m_depthPlanarType = ADDR_DEPTH_PLANAR_R800;
-            m_fp16ExportNorm = 1;
-            break;
-        default:
-            m_fp16ExportNorm = 1;
-            m_depthPlanarType = ADDR_DEPTH_PLANAR_R800;
-    }
-
-    m_configFlags.value = 0;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::~ElemLib
-*
-*   @brief
-*       destructor
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-ElemLib::~ElemLib()
-{
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::Create
-*
-*   @brief
-*       Creates and initializes AddrLib object.
-*
-*   @return
-*       Returns point to ADDR_CREATEINFO if successful.
-****************************************************************************************************
-*/
-ElemLib* ElemLib::Create(
-    const Lib* pAddrLib)   ///< [in] Pointer of parent AddrLib instance
-{
-    ElemLib* pElemLib = NULL;
-
-    if (pAddrLib)
-    {
-        VOID* pObj = Object::ClientAlloc(sizeof(ElemLib), pAddrLib->GetClient());
-        if (pObj)
-        {
-            pElemLib = new(pObj) ElemLib(const_cast<Lib* const>(pAddrLib));
-        }
-    }
-
-    return pElemLib;
-}
-
-/**************************************************************************************************
-*   ElemLib::Flt32sToInt32s
-*
-*   @brief
-*       Convert a ADDR_FLT_32 value to Int32 value
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::Flt32sToInt32s(
-    ADDR_FLT_32     value,      ///< [in] ADDR_FLT_32 value
-    UINT_32         bits,       ///< [in] nubmer of bits in value
-    NumberType      numberType, ///< [in] the type of number
-    UINT_32*        pResult)    ///< [out] Int32 value
-{
-    UINT_8 round = 128;    //ADDR_ROUND_BY_HALF
-    UINT_32 uscale;
-    UINT_32 sign;
-
-    //convert each component to an INT_32
-    switch ( numberType )
-    {
-        case ADDR_NO_NUMBER:    //fall through
-        case ADDR_ZERO:         //fall through
-        case ADDR_ONE:          //fall through
-        case ADDR_EPSILON:      //fall through
-            return;        // these are zero-bit components, so don't set result
-
-        case ADDR_UINT_BITS:            // unsigned integer bit field, clamped to range
-            uscale = (1<<bits) - 1;
-            if (bits == 32)               // special case unsigned 32-bit int
-            {
-                *pResult = value.i;
-            }
-            else
-            {
-                if ((value.i < 0) || (value.u > uscale))
-                {
-                    *pResult = uscale;
-                }
-                else
-                {
-                    *pResult = value.i;
-                }
-                return;
-            }
-
-        // The algorithm used in the DB and TX differs at one value for 24-bit unorms
-        case ADDR_UNORM_R6XXDB:        // unsigned repeating fraction
-            if ((bits==24) && (value.i == 0x33000000))
-            {
-                *pResult = 1;
-                return;
-            }              // Else treat like ADDR_UNORM_R6XX
-
-        case ADDR_UNORM_R6XX:            // unsigned repeating fraction
-            if (value.f <= 0)
-            {
-                *pResult = 0;            // first clamp to [0..1]
-            }
-            else
-            {
-                if (value.f >= 1)
-                {
-                     *pResult = (1<<bits) - 1;
-                }
-                else
-                {
-                    if ((value.i | 0x87FFFFFF) == 0xFFFFFFFF)
-                    {
-                        *pResult = 0;                        // NaN, so force to 0
-                    }
-
-                    #if 0 // floating point version for documentation
-                    else
-                    {
-                        FLOAT f = value.f * ((1<<bits) - 1);
-                        *pResult = static_cast<INT_32>(f + (round/256.0f));
-                    }
-                    #endif
-                    else
-                    {
-                        ADDR_FLT_32 scaled;
-                        ADDR_FLT_32 shifted;
-                        UINT_64 truncated, rounded;
-                        UINT_32 altShift;
-                        UINT_32 mask = (1 << bits) - 1;
-                        UINT_32 half = 1 << (bits - 1);
-                        UINT_32 mant24 = (value.i & 0x7FFFFF) + 0x800000;
-                        UINT_64 temp = mant24 - (mant24>>bits) -
-                            static_cast<INT_32>((mant24 & mask) > half);
-                        UINT_32 exp8 = value.i >> 23;
-                        UINT_32 shift = 126 - exp8 + 24 - bits;
-                        UINT_64 final;
-
-                        if (shift >= 32) // This is zero, even with maximum dither add
-                        {
-                            final = 0;
-                        }
-                        else
-                        {
-                            final = ((temp<<8) + (static_cast<UINT_64>(round)<<shift)) >> (shift+8);
-                        }
-                        //ADDR_EXIT( *pResult == final,
-                        //    ("Float %x converted to %d-bit Unorm %x != bitwise %x",
-                        //     value.u, bits, (UINT_32)*pResult, (UINT_32)final) );
-                        if (final > mask)
-                        {
-                            final = mask;
-                        }
-
-                        scaled.f  = value.f * ((1<<bits) - 1);
-                        shifted.f = (scaled.f * 256);
-                        truncated = ((shifted.i&0x7FFFFF) + (INT_64)0x800000) << 8;
-                        altShift  = 126 + 24 + 8 - ((shifted.i>>23)&0xFF);
-                        truncated = (altShift > 60) ? 0 : truncated >> altShift;
-                        rounded   = static_cast<INT_32>((round + truncated) >> 8);
-                        //if (rounded > ((1<<bits) - 1))
-                        //    rounded = ((1<<bits) - 1);
-                        *pResult = static_cast<INT_32>(rounded); //(INT_32)final;
-                    }
-                }
-            }
-
-            return;
-
-        case ADDR_S8FLOAT32:    // 32-bit IEEE float, passes through NaN values
-            *pResult = value.i;
-            return;
-
-        // @@ FIX ROUNDING in this code, fix the denorm case
-        case ADDR_U4FLOATC:         // Unsigned float, 4-bit exponent. bias 15, clamped [0..1]
-            sign = (value.i >> 31) & 1;
-            if ((value.i&0x7F800000) == 0x7F800000)    // If NaN or INF:
-            {
-                if ((value.i&0x007FFFFF) != 0)             // then if NaN
-                {
-                    *pResult = 0;                       // return 0
-                }
-                else
-                {
-                    *pResult = (sign)?0:0xF00000;           // else +INF->+1, -INF->0
-                }
-                return;
-            }
-            if (value.f <= 0)
-            {
-                *pResult = 0;
-            }
-            else
-            {
-                if (value.f>=1)
-                {
-                    *pResult = 0xF << (bits-4);
-                }
-                else
-                {
-                    if ((value.i>>23) > 112 )
-                    {
-                        // 24-bit float: normalized
-                        // value.i += 1 << (22-bits+4);
-                        // round the IEEE mantissa to mantissa size
-                        // @@ NOTE: add code to support rounding
-                        value.u &= 0x7FFFFFF;             // mask off high 4 exponent bits
-                        *pResult = value.i >> (23-bits+4);// shift off unused mantissa bits
-                    }
-                    else
-                    {
-                        // 24-bit float: denormalized
-                        value.f = value.f / (1<<28) / (1<<28);
-                        value.f = value.f / (1<<28) / (1<<28);    // convert to IEEE denorm
-                        // value.i += 1 << (22-bits+4);
-                        // round the IEEE mantissa to mantissa size
-                        // @@ NOTE: add code to support rounding
-                        *pResult = value.i >> (23-bits+4);    // shift off unused mantissa bits
-                    }
-                }
-            }
-
-            return;
-
-        default:                    // invalid number mode
-            //ADDR_EXIT(0, ("Invalid AddrNumber %d", numberType) );
-            break;
-
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::Int32sToPixel
-*
-*   @brief
-*       Pack 32-bit integer values into an uncompressed pixel,
-*       in the proper order
-*
-*   @return
-*       N/A
-*
-*   @note
-*       This entry point packes four 32-bit integer values into
-*       an uncompressed pixel. The pixel values are specifies in
-*       standard order, e.g. depth/stencil. This routine asserts
-*       if called on compressed pixel.
-****************************************************************************************************
-*/
-VOID ElemLib::Int32sToPixel(
-    UINT_32              numComps,      ///< [in] number of components
-    UINT_32*             pComps,        ///< [in] compnents
-    UINT_32*             pCompBits,     ///< [in] total bits in each component
-    UINT_32*             pCompStart,    ///< [in] the first bit position of each component
-    ComponentFlags       properties,    ///< [in] properties about byteAligned, exportNorm
-    UINT_32              resultBits,    ///< [in] result bits: total bpp after decompression
-    UINT_8*              pPixel)        ///< [out] a depth/stencil pixel value
-{
-    UINT_32 i;
-    UINT_32 j;
-    UINT_32 start;
-    UINT_32 size;
-    UINT_32 byte;
-    UINT_32 value = 0;
-    UINT_32 compMask;
-    UINT_32 elemMask=0;
-    UINT_32 elementXor = 0;  // address xor when reading bytes from elements
-
-
-    // @@ NOTE: assert if called on a compressed format!
-
-    if (properties.byteAligned)    // Components are all byte-sized
-    {
-        for (i = 0; i < numComps; i++)        // Then for each component
-        {
-            // Copy the bytes of the component into the element
-            start = pCompStart[i] / 8;
-            size  = pCompBits[i]  / 8;
-            for (j = 0; j < size; j++)
-            {
-                pPixel[(j+start)^elementXor] = static_cast<UINT_8>(pComps[i] >> (8*j));
-            }
-        }
-    }
-    else                        // Element is 32-bits or less, components are bit fields
-    {
-        // First, extract each component in turn and combine it into a 32-bit value
-        for (i = 0; i < numComps; i++)
-        {
-            compMask = (1 << pCompBits[i]) - 1;
-            elemMask |= compMask << pCompStart[i];
-            value |= (pComps[i] & compMask) << pCompStart[i];
-        }
-
-        // Mext, copy the masked value into the element
-        size = (resultBits + 7) / 8;
-        for (i = 0; i < size; i++)
-        {
-            byte = pPixel[i^elementXor] & ~(elemMask >> (8*i));
-            pPixel[i^elementXor] = static_cast<UINT_8>(byte | ((elemMask & value) >> (8*i)));
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   Flt32ToDepthPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a depth/stencil pixel value
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::Flt32ToDepthPixel(
-    AddrDepthFormat     format,     ///< [in] Depth format
-    const ADDR_FLT_32   comps[2],   ///< [in] two components of depth
-    UINT_8*             pPixel      ///< [out] depth pixel value
-    ) const
-{
-    UINT_32 i;
-    UINT_32 values[2];
-    ComponentFlags properties;  // byteAligned, exportNorm
-    UINT_32 resultBits = 0;     // result bits: total bits per pixel after decompression
-
-    PixelFormatInfo fmt;
-
-    // get type for each component
-    PixGetDepthCompInfo(format, &fmt);
-
-    //initialize properties
-    properties.byteAligned = TRUE;
-    properties.exportNorm  = TRUE;
-    properties.floatComp   = FALSE;
-
-    //set properties and result bits
-    for (i = 0; i < 2; i++)
-    {
-        if ((fmt.compBit[i] & 7) || (fmt.compStart[i] & 7))
-        {
-            properties.byteAligned = FALSE;
-        }
-
-        if (resultBits < fmt.compStart[i] + fmt.compBit[i])
-        {
-            resultBits = fmt.compStart[i] + fmt.compBit[i];
-        }
-
-        // Clear ADDR_EXPORT_NORM if can't be represented as 11-bit or smaller [-1..+1] format
-        if (fmt.compBit[i] > 11 || fmt.numType[i] >= ADDR_USCALED)
-        {
-            properties.exportNorm = FALSE;
-        }
-
-        // Mark if there are any floating point components
-        if ((fmt.numType[i] == ADDR_U4FLOATC) || (fmt.numType[i] >= ADDR_S8FLOAT) )
-        {
-            properties.floatComp = TRUE;
-        }
-    }
-
-    // Convert the two input floats to integer values
-    for (i = 0; i < 2; i++)
-    {
-        Flt32sToInt32s(comps[i], fmt.compBit[i], fmt.numType[i], &values[i]);
-    }
-
-    // Then pack the two integer components, in the proper order
-    Int32sToPixel(2, values, fmt.compBit, fmt.compStart, properties, resultBits, pPixel );
-
-}
-
-/**
-****************************************************************************************************
-*   Flt32ToColorPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::Flt32ToColorPixel(
-    AddrColorFormat     format,     ///< [in] Color format
-    AddrSurfaceNumber   surfNum,    ///< [in] Surface number
-    AddrSurfaceSwap     surfSwap,   ///< [in] Surface swap
-    const ADDR_FLT_32   comps[4],   ///< [in] four components of color
-    UINT_8*             pPixel      ///< [out] a red/green/blue/alpha pixel value
-    ) const
-{
-    PixelFormatInfo pixelInfo;
-
-    UINT_32 i;
-    UINT_32 values[4];
-    ComponentFlags properties;    // byteAligned, exportNorm
-    UINT_32 resultBits = 0;       // result bits: total bits per pixel after decompression
-
-    memset(&pixelInfo, 0, sizeof(PixelFormatInfo));
-
-    PixGetColorCompInfo(format, surfNum, surfSwap, &pixelInfo);
-
-    //initialize properties
-    properties.byteAligned = TRUE;
-    properties.exportNorm  = TRUE;
-    properties.floatComp   = FALSE;
-
-    //set properties and result bits
-    for (i = 0; i < 4; i++)
-    {
-        if ( (pixelInfo.compBit[i] & 7) || (pixelInfo.compStart[i] & 7) )
-        {
-            properties.byteAligned = FALSE;
-        }
-
-        if (resultBits < pixelInfo.compStart[i] + pixelInfo.compBit[i])
-        {
-            resultBits = pixelInfo.compStart[i] + pixelInfo.compBit[i];
-        }
-
-        if (m_fp16ExportNorm)
-        {
-            // Clear ADDR_EXPORT_NORM if can't be represented as 11-bit or smaller [-1..+1] format
-            // or if it's not FP and <=16 bits
-            if (((pixelInfo.compBit[i] > 11) || (pixelInfo.numType[i] >= ADDR_USCALED))
-                && (pixelInfo.numType[i] !=ADDR_U4FLOATC))
-            {
-                properties.exportNorm = FALSE;
-            }
-        }
-        else
-        {
-            // Clear ADDR_EXPORT_NORM if can't be represented as 11-bit or smaller [-1..+1] format
-            if (pixelInfo.compBit[i] > 11 || pixelInfo.numType[i] >= ADDR_USCALED)
-            {
-                properties.exportNorm = FALSE;
-            }
-        }
-
-        // Mark if there are any floating point components
-        if ( (pixelInfo.numType[i] == ADDR_U4FLOATC) ||
-             (pixelInfo.numType[i] >= ADDR_S8FLOAT) )
-        {
-            properties.floatComp = TRUE;
-        }
-    }
-
-    // Convert the four input floats to integer values
-    for (i = 0; i < 4; i++)
-    {
-        Flt32sToInt32s(comps[i], pixelInfo.compBit[i], pixelInfo.numType[i], &values[i]);
-    }
-
-    // Then pack the four integer components, in the proper order
-    Int32sToPixel(4, values, &pixelInfo.compBit[0], &pixelInfo.compStart[0],
-                  properties, resultBits, pPixel);
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::GetCompType
-*
-*   @brief
-*       Fill per component info
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID ElemLib::GetCompType(
-    AddrColorFormat   format,     ///< [in] surface format
-    AddrSurfaceNumber numType,  ///< [in] number type
-    PixelFormatInfo*  pInfo)       ///< [in][out] per component info out
-{
-    BOOL_32 handled = FALSE;
-
-    // Floating point formats override the number format
-    switch (format)
-    {
-        case ADDR_COLOR_16_FLOAT:            // fall through for all pure floating point format
-        case ADDR_COLOR_16_16_FLOAT:
-        case ADDR_COLOR_16_16_16_16_FLOAT:
-        case ADDR_COLOR_32_FLOAT:
-        case ADDR_COLOR_32_32_FLOAT:
-        case ADDR_COLOR_32_32_32_32_FLOAT:
-        case ADDR_COLOR_10_11_11_FLOAT:
-        case ADDR_COLOR_11_11_10_FLOAT:
-            numType = ADDR_NUMBER_FLOAT;
-            break;
-            // Special handling for the depth formats
-        case ADDR_COLOR_8_24:                // fall through for these 2 similar format
-        case ADDR_COLOR_24_8:
-            for (UINT_32 c = 0; c < 4; c++)
-            {
-                if (pInfo->compBit[c] == 8)
-                {
-                    pInfo->numType[c] = ADDR_UINT_BITS;
-                }
-                else if (pInfo->compBit[c]  == 24)
-                {
-                    pInfo->numType[c] = ADDR_UNORM_R6XX;
-                }
-                else
-                {
-                    pInfo->numType[c] = ADDR_NO_NUMBER;
-                }
-            }
-            handled = TRUE;
-            break;
-        case ADDR_COLOR_8_24_FLOAT:          // fall through for these 3 similar format
-        case ADDR_COLOR_24_8_FLOAT:
-        case ADDR_COLOR_X24_8_32_FLOAT:
-            for (UINT_32 c = 0; c < 4; c++)
-            {
-                if (pInfo->compBit[c] == 8)
-                {
-                    pInfo->numType[c] = ADDR_UINT_BITS;
-                }
-                else if (pInfo->compBit[c] == 24)
-                {
-                    pInfo->numType[c] = ADDR_U4FLOATC;
-                }
-                else if (pInfo->compBit[c] == 32)
-                {
-                    pInfo->numType[c] = ADDR_S8FLOAT32;
-                }
-                else
-                {
-                    pInfo->numType[c] = ADDR_NO_NUMBER;
-                }
-            }
-            handled = TRUE;
-            break;
-        default:
-            break;
-    }
-
-    if (!handled)
-    {
-        for (UINT_32 c = 0; c < 4; c++)
-        {
-            // Assign a number type for each component
-            AddrSurfaceNumber cnum;
-
-            // First handle default component values
-            if (pInfo->compBit[c] == 0)
-            {
-                if (c < 3)
-                {
-                    pInfo->numType[c] = ADDR_ZERO;      // Default is zero for RGB
-                }
-                else if (numType == ADDR_NUMBER_UINT || numType == ADDR_NUMBER_SINT)
-                {
-                    pInfo->numType[c] = ADDR_EPSILON;   // Alpha INT_32 bits default is 0x01
-                }
-                else
-                {
-                    pInfo->numType[c] = ADDR_ONE;       // Alpha normal default is float 1.0
-                }
-                continue;
-            }
-            // Now handle small components
-            else if (pInfo->compBit[c] == 1)
-            {
-                if (numType == ADDR_NUMBER_UINT || numType == ADDR_NUMBER_SINT)
-                {
-                    cnum = ADDR_NUMBER_UINT;
-                }
-                else
-                {
-                    cnum = ADDR_NUMBER_UNORM;
-                }
-            }
-            else
-            {
-                cnum = numType;
-            }
-
-            // If no default, set the number type fom num, compbits, and architecture
-            switch (cnum)
-            {
-                case ADDR_NUMBER_SRGB:
-                    pInfo->numType[c] = (c < 3) ? ADDR_GAMMA8_R6XX : ADDR_UNORM_R6XX;
-                    break;
-                case ADDR_NUMBER_UNORM:
-                    pInfo->numType[c] = ADDR_UNORM_R6XX;
-                    break;
-                case ADDR_NUMBER_SNORM:
-                    pInfo->numType[c] = ADDR_SNORM_R6XX;
-                    break;
-                case ADDR_NUMBER_USCALED:
-                    pInfo->numType[c] = ADDR_USCALED;  // @@ Do we need separate Pele routine?
-                    break;
-                case ADDR_NUMBER_SSCALED:
-                    pInfo->numType[c] = ADDR_SSCALED;  // @@ Do we need separate Pele routine?
-                    break;
-                case ADDR_NUMBER_FLOAT:
-                    if (pInfo->compBit[c] == 32)
-                    {
-                        pInfo->numType[c] = ADDR_S8FLOAT32;
-                    }
-                    else if (pInfo->compBit[c] == 16)
-                    {
-                        pInfo->numType[c] = ADDR_S5FLOAT;
-                    }
-                    else if (pInfo->compBit[c] >= 10)
-                    {
-                        pInfo->numType[c] = ADDR_U5FLOAT;
-                    }
-                    else
-                    {
-                        ADDR_ASSERT_ALWAYS();
-                    }
-                    break;
-                case ADDR_NUMBER_SINT:
-                    pInfo->numType[c] = ADDR_SINT_BITS;
-                    break;
-                case ADDR_NUMBER_UINT:
-                    pInfo->numType[c] = ADDR_UINT_BITS;
-                    break;
-
-                default:
-                    ADDR_ASSERT(!"Invalid number type");
-                    pInfo->numType[c] = ADDR_NO_NUMBER;
-                    break;
-             }
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::GetCompSwap
-*
-*   @brief
-*       Get components swapped for color surface
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID ElemLib::GetCompSwap(
-    AddrSurfaceSwap  swap,   ///< [in] swap mode
-    PixelFormatInfo* pInfo)  ///< [in,out] output per component info
-{
-    switch (pInfo->comps)
-    {
-        case 4:
-            switch (swap)
-            {
-                case ADDR_SWAP_ALT:
-                    SwapComps( 0, 2, pInfo );
-                    break;    // BGRA
-                case ADDR_SWAP_STD_REV:
-                    SwapComps( 0, 3, pInfo );
-                    SwapComps( 1, 2, pInfo );
-                    break;    // ABGR
-                case ADDR_SWAP_ALT_REV:
-                    SwapComps( 0, 3, pInfo );
-                    SwapComps( 0, 2, pInfo );
-                    SwapComps( 0, 1, pInfo );
-                    break;    // ARGB
-                default:
-                    break;
-            }
-            break;
-        case 3:
-            switch (swap)
-            {
-                case ADDR_SWAP_ALT_REV:
-                    SwapComps( 0, 3, pInfo );
-                    SwapComps( 0, 2, pInfo );
-                    break;    // AGR
-                case ADDR_SWAP_STD_REV:
-                    SwapComps( 0, 2, pInfo );
-                    break;    // BGR
-                case ADDR_SWAP_ALT:
-                    SwapComps( 2, 3, pInfo );
-                    break;    // RGA
-                default:
-                    break;    // RGB
-            }
-            break;
-        case 2:
-            switch (swap)
-            {
-                case ADDR_SWAP_ALT_REV:
-                    SwapComps( 0, 1, pInfo );
-                    SwapComps( 1, 3, pInfo );
-                    break;    // AR
-                case ADDR_SWAP_STD_REV:
-                    SwapComps( 0, 1, pInfo );
-                    break;    // GR
-                case ADDR_SWAP_ALT:
-                    SwapComps( 1, 3, pInfo );
-                    break;    // RA
-                default:
-                    break;    // RG
-            }
-            break;
-        case 1:
-            switch (swap)
-            {
-                case ADDR_SWAP_ALT_REV:
-                    SwapComps( 0, 3, pInfo );
-                    break;    // A
-                case ADDR_SWAP_STD_REV:
-                    SwapComps( 0, 2, pInfo );
-                    break;    // B
-                case ADDR_SWAP_ALT:
-                    SwapComps( 0, 1, pInfo );
-                    break;    // G
-                default:
-                    break;    // R
-            }
-            break;
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::GetCompSwap
-*
-*   @brief
-*       Get components swapped for color surface
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID ElemLib::SwapComps(
-    UINT_32          c0,     ///< [in] component index 0
-    UINT_32          c1,     ///< [in] component index 1
-    PixelFormatInfo* pInfo)  ///< [in,out] output per component info
-{
-    UINT_32 start;
-    UINT_32 bits;
-
-    start = pInfo->compStart[c0];
-    pInfo->compStart[c0] = pInfo->compStart[c1];
-    pInfo->compStart[c1] = start;
-
-    bits  = pInfo->compBit[c0];
-    pInfo->compBit[c0] = pInfo->compBit[c1];
-    pInfo->compBit[c1] = bits;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::PixGetColorCompInfo
-*
-*   @brief
-*       Get per component info for color surface
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID ElemLib::PixGetColorCompInfo(
-    AddrColorFormat   format, ///< [in] surface format, read from register
-    AddrSurfaceNumber number, ///< [in] pixel number type
-    AddrSurfaceSwap   swap,   ///< [in] component swap mode
-    PixelFormatInfo*  pInfo   ///< [out] output per component info
-    ) const
-{
-    // 1. Get componet bits
-    switch (format)
-    {
-        case ADDR_COLOR_8:
-            GetCompBits(8, 0, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_1_5_5_5:
-            GetCompBits(5, 5, 5, 1, pInfo);
-            break;
-        case ADDR_COLOR_5_6_5:
-            GetCompBits(8, 6, 5, 0, pInfo);
-            break;
-        case ADDR_COLOR_6_5_5:
-            GetCompBits(5, 5, 6, 0, pInfo);
-            break;
-        case ADDR_COLOR_8_8:
-            GetCompBits(8, 8, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_4_4_4_4:
-            GetCompBits(4, 4, 4, 4, pInfo);
-            break;
-        case ADDR_COLOR_16:
-            GetCompBits(16, 0, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_8_8_8_8:
-            GetCompBits(8, 8, 8, 8, pInfo);
-            break;
-        case ADDR_COLOR_2_10_10_10:
-            GetCompBits(10, 10, 10, 2, pInfo);
-            break;
-        case ADDR_COLOR_10_11_11:
-            GetCompBits(11, 11, 10, 0, pInfo);
-            break;
-        case ADDR_COLOR_11_11_10:
-            GetCompBits(10, 11, 11, 0, pInfo);
-            break;
-        case ADDR_COLOR_16_16:
-            GetCompBits(16, 16, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_16_16_16_16:
-            GetCompBits(16, 16, 16, 16, pInfo);
-            break;
-        case ADDR_COLOR_16_FLOAT:
-            GetCompBits(16, 0, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_16_16_FLOAT:
-            GetCompBits(16, 16, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_32_FLOAT:
-            GetCompBits(32, 0, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_32_32_FLOAT:
-            GetCompBits(32, 32, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_16_16_16_16_FLOAT:
-            GetCompBits(16, 16, 16, 16, pInfo);
-            break;
-        case ADDR_COLOR_32_32_32_32_FLOAT:
-            GetCompBits(32, 32, 32, 32, pInfo);
-            break;
-
-        case ADDR_COLOR_32:
-            GetCompBits(32, 0, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_32_32:
-            GetCompBits(32, 32, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_32_32_32_32:
-            GetCompBits(32, 32, 32, 32, pInfo);
-            break;
-        case ADDR_COLOR_10_10_10_2:
-            GetCompBits(2, 10, 10, 10, pInfo);
-            break;
-        case ADDR_COLOR_10_11_11_FLOAT:
-            GetCompBits(11, 11, 10, 0, pInfo);
-            break;
-        case ADDR_COLOR_11_11_10_FLOAT:
-            GetCompBits(10, 11, 11, 0, pInfo);
-            break;
-        case ADDR_COLOR_5_5_5_1:
-            GetCompBits(1, 5, 5, 5, pInfo);
-            break;
-        case ADDR_COLOR_3_3_2:
-            GetCompBits(2, 3, 3, 0, pInfo);
-            break;
-        case ADDR_COLOR_4_4:
-            GetCompBits(4, 4, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_8_24:
-        case ADDR_COLOR_8_24_FLOAT:  // same bit count, fall through
-            GetCompBits(24, 8, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_24_8:
-        case ADDR_COLOR_24_8_FLOAT:  // same bit count, fall through
-            GetCompBits(8, 24, 0, 0, pInfo);
-            break;
-        case ADDR_COLOR_X24_8_32_FLOAT:
-            GetCompBits(32, 8, 0, 0, pInfo);
-            break;
-
-        case ADDR_COLOR_INVALID:
-            GetCompBits(0, 0, 0, 0, pInfo);
-            break;
-        default:
-            ADDR_ASSERT(0);
-            GetCompBits(0, 0, 0, 0, pInfo);
-            break;
-    }
-
-    // 2. Get component number type
-
-    GetCompType(format, number, pInfo);
-
-    // 3. Swap components if needed
-
-    GetCompSwap(swap, pInfo);
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::PixGetDepthCompInfo
-*
-*   @brief
-*       Get per component info for depth surface
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID ElemLib::PixGetDepthCompInfo(
-    AddrDepthFormat  format,     ///< [in] surface format, read from register
-    PixelFormatInfo* pInfo       ///< [out] output per component bits and type
-    ) const
-{
-    if (m_depthPlanarType == ADDR_DEPTH_PLANAR_R800)
-    {
-        if (format == ADDR_DEPTH_8_24_FLOAT)
-        {
-            format = ADDR_DEPTH_X24_8_32_FLOAT; // Use this format to represent R800's D24FS8
-        }
-
-        if (format == ADDR_DEPTH_X8_24_FLOAT)
-        {
-            format = ADDR_DEPTH_32_FLOAT;
-        }
-    }
-
-    switch (format)
-    {
-        case ADDR_DEPTH_16:
-            GetCompBits(16, 0, 0, 0, pInfo);
-            break;
-        case ADDR_DEPTH_8_24:
-        case ADDR_DEPTH_8_24_FLOAT:      // similar format, fall through
-            GetCompBits(24, 8, 0, 0, pInfo);
-            break;
-        case ADDR_DEPTH_X8_24:
-        case ADDR_DEPTH_X8_24_FLOAT:     // similar format, fall through
-            GetCompBits(24, 0, 0, 0, pInfo);
-            break;
-        case ADDR_DEPTH_32_FLOAT:
-            GetCompBits(32, 0, 0, 0, pInfo);
-            break;
-        case ADDR_DEPTH_X24_8_32_FLOAT:
-            GetCompBits(32, 8, 0, 0, pInfo);
-            break;
-        case ADDR_DEPTH_INVALID:
-            GetCompBits(0, 0, 0, 0, pInfo);
-            break;
-        default:
-            ADDR_ASSERT(0);
-            GetCompBits(0, 0, 0, 0, pInfo);
-            break;
-    }
-
-    switch (format)
-    {
-        case ADDR_DEPTH_16:
-            pInfo->numType [0] = ADDR_UNORM_R6XX;
-            pInfo->numType [1] = ADDR_ZERO;
-            break;
-        case ADDR_DEPTH_8_24:
-            pInfo->numType [0] = ADDR_UNORM_R6XXDB;
-            pInfo->numType [1] = ADDR_UINT_BITS;
-            break;
-        case ADDR_DEPTH_8_24_FLOAT:
-            pInfo->numType [0] = ADDR_U4FLOATC;
-            pInfo->numType [1] = ADDR_UINT_BITS;
-            break;
-        case ADDR_DEPTH_X8_24:
-            pInfo->numType [0] = ADDR_UNORM_R6XXDB;
-            pInfo->numType [1] = ADDR_ZERO;
-            break;
-        case ADDR_DEPTH_X8_24_FLOAT:
-            pInfo->numType [0] = ADDR_U4FLOATC;
-            pInfo->numType [1] = ADDR_ZERO;
-            break;
-        case ADDR_DEPTH_32_FLOAT:
-            pInfo->numType [0] = ADDR_S8FLOAT32;
-            pInfo->numType [1] = ADDR_ZERO;
-            break;
-        case ADDR_DEPTH_X24_8_32_FLOAT:
-            pInfo->numType [0] = ADDR_S8FLOAT32;
-            pInfo->numType [1] = ADDR_UINT_BITS;
-            break;
-        default:
-            pInfo->numType [0] = ADDR_NO_NUMBER;
-            pInfo->numType [1] = ADDR_NO_NUMBER;
-            break;
-    }
-
-    pInfo->numType [2] = ADDR_NO_NUMBER;
-    pInfo->numType [3] = ADDR_NO_NUMBER;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::PixGetExportNorm
-*
-*   @brief
-*       Check if fp16 export norm can be enabled.
-*
-*   @return
-*       TRUE if this can be enabled.
-*
-****************************************************************************************************
-*/
-BOOL_32 ElemLib::PixGetExportNorm(
-    AddrColorFormat     colorFmt,       ///< [in] surface format, read from register
-    AddrSurfaceNumber   numberFmt,      ///< [in] pixel number type
-    AddrSurfaceSwap     swap            ///< [in] components swap type
-    ) const
-{
-    BOOL_32 enabled = TRUE;
-
-    PixelFormatInfo formatInfo;
-
-    PixGetColorCompInfo(colorFmt, numberFmt, swap, &formatInfo);
-
-    for (UINT_32 c = 0; c < 4; c++)
-    {
-        if (m_fp16ExportNorm)
-        {
-            if (((formatInfo.compBit[c] > 11) || (formatInfo.numType[c] > ADDR_USCALED)) &&
-                (formatInfo.numType[c] != ADDR_U4FLOATC)    &&
-                (formatInfo.numType[c] != ADDR_S5FLOAT)     &&
-                (formatInfo.numType[c] != ADDR_S5FLOATM)    &&
-                (formatInfo.numType[c] != ADDR_U5FLOAT)     &&
-                (formatInfo.numType[c] != ADDR_U3FLOATM))
-            {
-                enabled = FALSE;
-                break;
-            }
-        }
-        else
-        {
-            if ((formatInfo.compBit[c] > 11) || (formatInfo.numType[c] > ADDR_USCALED))
-            {
-                enabled = FALSE;
-                break;
-            }
-        }
-    }
-
-    return enabled;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::AdjustSurfaceInfo
-*
-*   @brief
-*       Adjust bpp/base pitch/width/height according to elemMode and expandX/Y
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::AdjustSurfaceInfo(
-    ElemMode        elemMode,       ///< [in] element mode
-    UINT_32         expandX,        ///< [in] decompression expansion factor in X
-    UINT_32         expandY,        ///< [in] decompression expansion factor in Y
-    UINT_32*        pBpp,           ///< [in,out] bpp
-    UINT_32*        pBasePitch,     ///< [in,out] base pitch
-    UINT_32*        pWidth,         ///< [in,out] width
-    UINT_32*        pHeight)        ///< [in,out] height
-{
-    UINT_32 packedBits;
-    UINT_32 basePitch;
-    UINT_32 width;
-    UINT_32 height;
-    UINT_32 bpp;
-    BOOL_32 bBCnFormat = FALSE;
-
-    ADDR_ASSERT(pBpp != NULL);
-    ADDR_ASSERT(pWidth != NULL && pHeight != NULL && pBasePitch != NULL);
-
-    if (pBpp)
-    {
-        bpp = *pBpp;
-
-        switch (elemMode)
-        {
-            case ADDR_EXPANDED:
-                packedBits = bpp / expandX / expandY;
-                break;
-            case ADDR_PACKED_STD: // Different bit order
-            case ADDR_PACKED_REV:
-                packedBits = bpp * expandX * expandY;
-                break;
-            case ADDR_PACKED_GBGR:
-            case ADDR_PACKED_BGRG:
-                packedBits = bpp; // 32-bit packed ==> 2 32-bit result
-                break;
-            case ADDR_PACKED_BC1: // Fall through
-            case ADDR_PACKED_BC4:
-                packedBits = 64;
-                bBCnFormat = TRUE;
-                break;
-            case ADDR_PACKED_BC2: // Fall through
-            case ADDR_PACKED_BC3: // Fall through
-            case ADDR_PACKED_BC5: // Fall through
-                bBCnFormat = TRUE;
-                // fall through
-            case ADDR_PACKED_ASTC:
-            case ADDR_PACKED_ETC2_128BPP:
-                packedBits = 128;
-                break;
-            case ADDR_PACKED_ETC2_64BPP:
-                packedBits = 64;
-                break;
-            case ADDR_ROUND_BY_HALF:  // Fall through
-            case ADDR_ROUND_TRUNCATE: // Fall through
-            case ADDR_ROUND_DITHER:   // Fall through
-            case ADDR_UNCOMPRESSED:
-                packedBits = bpp;
-                break;
-            default:
-                packedBits = bpp;
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        *pBpp = packedBits;
-    }
-
-    if (pWidth && pHeight && pBasePitch)
-    {
-        basePitch = *pBasePitch;
-        width     = *pWidth;
-        height    = *pHeight;
-
-        if ((expandX > 1) || (expandY > 1))
-        {
-            if (elemMode == ADDR_EXPANDED)
-            {
-                basePitch *= expandX;
-                width     *= expandX;
-                height    *= expandY;
-            }
-            else
-            {
-                // Evergreen family workaround
-                if (bBCnFormat && (m_pAddrLib->GetChipFamily() == ADDR_CHIP_FAMILY_R8XX))
-                {
-                    // For BCn we now pad it to POW2 at the beginning so it is safe to
-                    // divide by 4 directly
-                    basePitch = basePitch / expandX;
-                    width     = width  / expandX;
-                    height    = height / expandY;
-#if DEBUG
-                    width     = (width == 0) ? 1 : width;
-                    height    = (height == 0) ? 1 : height;
-
-                    if ((*pWidth > PowTwoAlign(width, 8) * expandX) ||
-                        (*pHeight > PowTwoAlign(height, 8) * expandY)) // 8 is 1D tiling alignment
-                    {
-                        // if this assertion is hit we may have issues if app samples
-                        // rightmost/bottommost pixels
-                        ADDR_ASSERT_ALWAYS();
-                    }
-#endif
-                }
-                else // Not BCn format we still keep old way (FMT_1? No real test yet)
-                {
-                    basePitch = (basePitch + expandX - 1) / expandX;
-                    width     = (width + expandX - 1) / expandX;
-                    height    = (height + expandY - 1) / expandY;
-                }
-            }
-
-            *pBasePitch = basePitch; // 0 is legal value for base pitch.
-            *pWidth     = (width == 0) ? 1 : width;
-            *pHeight    = (height == 0) ? 1 : height;
-        } //if (pWidth && pHeight && pBasePitch)
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::RestoreSurfaceInfo
-*
-*   @brief
-*       Reverse operation of AdjustSurfaceInfo
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::RestoreSurfaceInfo(
-    ElemMode        elemMode,       ///< [in] element mode
-    UINT_32         expandX,        ///< [in] decompression expansion factor in X
-    UINT_32         expandY,        ///< [out] decompression expansion factor in Y
-    UINT_32*        pBpp,           ///< [in,out] bpp
-    UINT_32*        pWidth,         ///< [in,out] width
-    UINT_32*        pHeight)        ///< [in,out] height
-{
-    UINT_32 originalBits;
-    UINT_32 width;
-    UINT_32 height;
-    UINT_32 bpp;
-
-    BOOL_32 bBCnFormat = FALSE;
-    (void)bBCnFormat;
-
-    ADDR_ASSERT(pBpp != NULL);
-    ADDR_ASSERT(pWidth != NULL && pHeight != NULL);
-
-    if (pBpp)
-    {
-        bpp = *pBpp;
-
-        switch (elemMode)
-        {
-        case ADDR_EXPANDED:
-            originalBits = bpp * expandX * expandY;
-            break;
-        case ADDR_PACKED_STD: // Different bit order
-        case ADDR_PACKED_REV:
-            originalBits = bpp / expandX / expandY;
-            break;
-        case ADDR_PACKED_GBGR:
-        case ADDR_PACKED_BGRG:
-            originalBits = bpp; // 32-bit packed ==> 2 32-bit result
-            break;
-        case ADDR_PACKED_BC1: // Fall through
-        case ADDR_PACKED_BC4:
-            originalBits = 64;
-            bBCnFormat = TRUE;
-            break;
-        case ADDR_PACKED_BC2: // Fall through
-        case ADDR_PACKED_BC3: // Fall through
-        case ADDR_PACKED_BC5:
-            bBCnFormat = TRUE;
-            // fall through
-        case ADDR_PACKED_ASTC:
-        case ADDR_PACKED_ETC2_128BPP:
-            originalBits = 128;
-            break;
-        case ADDR_PACKED_ETC2_64BPP:
-            originalBits = 64;
-            break;
-        case ADDR_ROUND_BY_HALF:  // Fall through
-        case ADDR_ROUND_TRUNCATE: // Fall through
-        case ADDR_ROUND_DITHER:   // Fall through
-        case ADDR_UNCOMPRESSED:
-            originalBits = bpp;
-            break;
-        default:
-            originalBits = bpp;
-            ADDR_ASSERT_ALWAYS();
-            break;
-        }
-
-        *pBpp = originalBits;
-    }
-
-    if (pWidth && pHeight)
-    {
-        width    = *pWidth;
-        height   = *pHeight;
-
-        if ((expandX > 1) || (expandY > 1))
-        {
-            if (elemMode == ADDR_EXPANDED)
-            {
-                width /= expandX;
-                height /= expandY;
-            }
-            else
-            {
-                width *= expandX;
-                height *= expandY;
-            }
-        }
-
-        *pWidth  = (width == 0) ? 1 : width;
-        *pHeight = (height == 0) ? 1 : height;
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::GetBitsPerPixel
-*
-*   @brief
-*       Compute the total bits per element according to a format
-*       code. For compressed formats, this is not the same as
-*       the number of bits per decompressed element.
-*
-*   @return
-*       Bits per pixel
-****************************************************************************************************
-*/
-UINT_32 ElemLib::GetBitsPerPixel(
-    AddrFormat          format,         ///< [in] surface format code
-    ElemMode*           pElemMode,      ///< [out] element mode
-    UINT_32*            pExpandX,       ///< [out] decompression expansion factor in X
-    UINT_32*            pExpandY,       ///< [out] decompression expansion factor in Y
-    UINT_32*            pUnusedBits)    ///< [out] bits unused
-{
-    UINT_32 bpp;
-    UINT_32 expandX = 1;
-    UINT_32 expandY = 1;
-    UINT_32 bitUnused = 0;
-    ElemMode elemMode = ADDR_UNCOMPRESSED; // default value
-
-    switch (format)
-    {
-        case ADDR_FMT_8:
-            bpp = 8;
-            break;
-        case ADDR_FMT_1_5_5_5:
-        case ADDR_FMT_5_6_5:
-        case ADDR_FMT_6_5_5:
-        case ADDR_FMT_8_8:
-        case ADDR_FMT_4_4_4_4:
-        case ADDR_FMT_16:
-        case ADDR_FMT_16_FLOAT:
-            bpp = 16;
-            break;
-        case ADDR_FMT_GB_GR: // treat as FMT_8_8
-            elemMode = ADDR_PACKED_GBGR;
-            bpp     = 16;
-            break;
-        case ADDR_FMT_BG_RG: // treat as FMT_8_8
-            elemMode = ADDR_PACKED_BGRG;
-            bpp     = 16;
-            break;
-        case ADDR_FMT_8_8_8_8:
-        case ADDR_FMT_2_10_10_10:
-        case ADDR_FMT_10_11_11:
-        case ADDR_FMT_11_11_10:
-        case ADDR_FMT_16_16:
-        case ADDR_FMT_16_16_FLOAT:
-        case ADDR_FMT_32:
-        case ADDR_FMT_32_FLOAT:
-        case ADDR_FMT_24_8:
-        case ADDR_FMT_24_8_FLOAT:
-            bpp = 32;
-            break;
-        case ADDR_FMT_16_16_16_16:
-        case ADDR_FMT_16_16_16_16_FLOAT:
-        case ADDR_FMT_32_32:
-        case ADDR_FMT_32_32_FLOAT:
-        case ADDR_FMT_CTX1:
-            bpp = 64;
-            break;
-        case ADDR_FMT_32_32_32_32:
-        case ADDR_FMT_32_32_32_32_FLOAT:
-            bpp = 128;
-            break;
-        case ADDR_FMT_INVALID:
-            bpp = 0;
-            break;
-        case ADDR_FMT_1_REVERSED:
-            elemMode = ADDR_PACKED_REV;
-            expandX = 8;
-            bpp = 1;
-            break;
-        case ADDR_FMT_1:
-            elemMode = ADDR_PACKED_STD;
-            expandX = 8;
-            bpp = 1;
-            break;
-        case ADDR_FMT_4_4:
-        case ADDR_FMT_3_3_2:
-            bpp = 8;
-            break;
-        case ADDR_FMT_5_5_5_1:
-            bpp = 16;
-            break;
-        case ADDR_FMT_32_AS_8:
-        case ADDR_FMT_32_AS_8_8:
-        case ADDR_FMT_8_24:
-        case ADDR_FMT_8_24_FLOAT:
-        case ADDR_FMT_10_10_10_2:
-        case ADDR_FMT_10_11_11_FLOAT:
-        case ADDR_FMT_11_11_10_FLOAT:
-        case ADDR_FMT_5_9_9_9_SHAREDEXP:
-            bpp = 32;
-            break;
-        case ADDR_FMT_X24_8_32_FLOAT:
-            bpp = 64;
-            bitUnused = 24;
-            break;
-        case ADDR_FMT_8_8_8:
-            elemMode = ADDR_EXPANDED;
-            bpp = 24;//@@ 8;      // read 3 elements per pixel
-            expandX = 3;
-            break;
-        case ADDR_FMT_16_16_16:
-        case ADDR_FMT_16_16_16_FLOAT:
-            elemMode = ADDR_EXPANDED;
-            bpp = 48;//@@ 16;      // read 3 elements per pixel
-            expandX = 3;
-            break;
-        case ADDR_FMT_32_32_32_FLOAT:
-        case ADDR_FMT_32_32_32:
-            elemMode = ADDR_EXPANDED;
-            expandX = 3;
-            bpp = 96;//@@ 32;      // read 3 elements per pixel
-            break;
-        case ADDR_FMT_BC1:
-            elemMode = ADDR_PACKED_BC1;
-            expandX = 4;
-            expandY = 4;
-            bpp = 64;
-            break;
-        case ADDR_FMT_BC4:
-            elemMode = ADDR_PACKED_BC4;
-            expandX = 4;
-            expandY = 4;
-            bpp = 64;
-            break;
-        case ADDR_FMT_BC2:
-            elemMode = ADDR_PACKED_BC2;
-            expandX = 4;
-            expandY = 4;
-            bpp = 128;
-            break;
-        case ADDR_FMT_BC3:
-            elemMode = ADDR_PACKED_BC3;
-            expandX = 4;
-            expandY = 4;
-            bpp = 128;
-            break;
-        case ADDR_FMT_BC5:
-        case ADDR_FMT_BC6: // reuse ADDR_PACKED_BC5
-        case ADDR_FMT_BC7: // reuse ADDR_PACKED_BC5
-            elemMode = ADDR_PACKED_BC5;
-            expandX = 4;
-            expandY = 4;
-            bpp = 128;
-            break;
-
-        case ADDR_FMT_ETC2_64BPP:
-            elemMode = ADDR_PACKED_ETC2_64BPP;
-            expandX  = 4;
-            expandY  = 4;
-            bpp      = 64;
-            break;
-
-        case ADDR_FMT_ETC2_128BPP:
-            elemMode = ADDR_PACKED_ETC2_128BPP;
-            expandX  = 4;
-            expandY  = 4;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_4x4:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 4;
-            expandY  = 4;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_5x4:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 5;
-            expandY  = 4;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_5x5:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 5;
-            expandY  = 5;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_6x5:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 6;
-            expandY  = 5;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_6x6:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 6;
-            expandY  = 6;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_8x5:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 8;
-            expandY  = 5;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_8x6:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 8;
-            expandY  = 6;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_8x8:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 8;
-            expandY  = 8;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_10x5:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 10;
-            expandY  = 5;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_10x6:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 10;
-            expandY  = 6;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_10x8:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 10;
-            expandY  = 8;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_10x10:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 10;
-            expandY  = 10;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_12x10:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 12;
-            expandY  = 10;
-            bpp      = 128;
-            break;
-
-        case ADDR_FMT_ASTC_12x12:
-            elemMode = ADDR_PACKED_ASTC;
-            expandX  = 12;
-            expandY  = 12;
-            bpp      = 128;
-            break;
-
-        default:
-            bpp = 0;
-            ADDR_ASSERT_ALWAYS();
-            break;
-            // @@ or should this be an error?
-    }
-
-    SafeAssign(pExpandX, expandX);
-    SafeAssign(pExpandY, expandY);
-    SafeAssign(pUnusedBits, bitUnused);
-    SafeAssign(reinterpret_cast<UINT_32*>(pElemMode), elemMode);
-
-    return bpp;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::GetCompBits
-*
-*   @brief
-*       Set each component's bit size and bit start. And set element mode and number type
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::GetCompBits(
-    UINT_32          c0,        ///< [in] bits of component 0
-    UINT_32          c1,        ///< [in] bits of component 1
-    UINT_32          c2,        ///< [in] bits of component 2
-    UINT_32          c3,        ///< [in] bits of component 3
-    PixelFormatInfo* pInfo,     ///< [out] per component info out
-    ElemMode         elemMode)  ///< [in] element mode
-{
-    pInfo->comps = 0;
-
-    pInfo->compBit[0] = c0;
-    pInfo->compBit[1] = c1;
-    pInfo->compBit[2] = c2;
-    pInfo->compBit[3] = c3;
-
-    pInfo->compStart[0] = 0;
-    pInfo->compStart[1] = c0;
-    pInfo->compStart[2] = c0+c1;
-    pInfo->compStart[3] = c0+c1+c2;
-
-    pInfo->elemMode = elemMode;
-    // still needed since component swap may depend on number of components
-    for (INT i=0; i<4; i++)
-    {
-        if (pInfo->compBit[i] == 0)
-        {
-            pInfo->compStart[i]  = 0;       // all null components start at bit 0
-            pInfo->numType[i] = ADDR_NO_NUMBER; // and have no number type
-        }
-        else
-        {
-            pInfo->comps++;
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::GetCompBits
-*
-*   @brief
-*       Set the clear color (or clear depth/stencil) for a surface
-*
-*   @note
-*       If clearColor is zero, a default clear value is used in place of comps[4].
-*       If float32 is set, full precision is used, else the mantissa is reduced to 12-bits
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID ElemLib::SetClearComps(
-    ADDR_FLT_32 comps[4],   ///< [in,out] components
-    BOOL_32 clearColor,     ///< [in] TRUE if clear color is set (CLEAR_COLOR)
-    BOOL_32 float32)        ///< [in] TRUE if float32 component (BLEND_FLOAT32)
-{
-    INT_32 i;
-
-    // Use default clearvalues if clearColor is disabled
-    if (clearColor == FALSE)
-    {
-        for (i=0; i<3; i++)
-        {
-            comps[i].f = 0.0;
-        }
-        comps[3].f = 1.0;
-    }
-
-    // Otherwise use the (modified) clear value
-    else
-    {
-        for (i=0; i<4; i++)
-        {   // If full precision, use clear value unchanged
-            if (float32)
-            {
-                // Do nothing
-                //comps[i] = comps[i];
-            }
-            // Else if it is a NaN, use the standard NaN value
-            else if ((comps[i].u & 0x7FFFFFFF) > 0x7F800000)
-            {
-                comps[i].u = 0xFFC00000;
-            }
-            // Else reduce the mantissa precision
-            else
-            {
-                comps[i].u = comps[i].u & 0xFFFFF000;
-            }
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::IsBlockCompressed
-*
-*   @brief
-*       TRUE if this is block compressed format
-*
-*   @note
-*
-*   @return
-*       BOOL_32
-****************************************************************************************************
-*/
-BOOL_32 ElemLib::IsBlockCompressed(
-    AddrFormat format)  ///< [in] Format
-{
-    return (((format >= ADDR_FMT_BC1) && (format <= ADDR_FMT_BC7)) ||
-            ((format >= ADDR_FMT_ASTC_4x4) && (format <= ADDR_FMT_ETC2_128BPP)));
-}
-
-
-/**
-****************************************************************************************************
-*   ElemLib::IsCompressed
-*
-*   @brief
-*       TRUE if this is block compressed format or 1 bit format
-*
-*   @note
-*
-*   @return
-*       BOOL_32
-****************************************************************************************************
-*/
-BOOL_32 ElemLib::IsCompressed(
-    AddrFormat format)  ///< [in] Format
-{
-    return IsBlockCompressed(format) || format == ADDR_FMT_BC1 || format == ADDR_FMT_BC7;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::IsExpand3x
-*
-*   @brief
-*       TRUE if this is 3x expand format
-*
-*   @note
-*
-*   @return
-*       BOOL_32
-****************************************************************************************************
-*/
-BOOL_32 ElemLib::IsExpand3x(
-    AddrFormat format)  ///< [in] Format
-{
-    BOOL_32 is3x = FALSE;
-
-    switch (format)
-    {
-        case ADDR_FMT_8_8_8:
-        case ADDR_FMT_16_16_16:
-        case ADDR_FMT_16_16_16_FLOAT:
-        case ADDR_FMT_32_32_32:
-        case ADDR_FMT_32_32_32_FLOAT:
-            is3x = TRUE;
-            break;
-        default:
-            break;
-    }
-
-    return is3x;
-}
-
-/**
-****************************************************************************************************
-*   ElemLib::IsMacroPixelPacked
-*
-*   @brief
-*       TRUE if this is a macro-pixel-packed format.
-*
-*   @note
-*
-*   @return
-*       BOOL_32
-****************************************************************************************************
-*/
-BOOL_32 ElemLib::IsMacroPixelPacked(
-    AddrFormat format)  ///< [in] Format
-{
-    BOOL_32 isMacroPixelPacked = FALSE;
-
-    switch (format)
-    {
-        case ADDR_FMT_BG_RG:
-        case ADDR_FMT_GB_GR:
-            isMacroPixelPacked = TRUE;
-            break;
-        default:
-            break;
-    }
-
-    return isMacroPixelPacked;
-}
-
-}
diff --git a/src/amd/addrlib/core/addrelemlib.h b/src/amd/addrlib/core/addrelemlib.h
deleted file mode 100644 (file)
index 88755db..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright © 2014 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  addrelemlib.h
-* @brief Contains the class for element/pixel related functions.
-****************************************************************************************************
-*/
-
-#ifndef __ELEM_LIB_H__
-#define __ELEM_LIB_H__
-
-#include "addrinterface.h"
-#include "addrobject.h"
-#include "addrcommon.h"
-
-namespace Addr
-{
-
-class Lib;
-
-// The masks for property bits within the Properties INT_32
-union ComponentFlags
-{
-    struct
-    {
-        UINT_32 byteAligned    : 1;    ///< all components are byte aligned
-        UINT_32 exportNorm     : 1;    ///< components support R6xx NORM compression
-        UINT_32 floatComp      : 1;    ///< there is at least one floating point component
-    };
-
-    UINT_32 value;
-};
-
-// Copy from legacy lib's NumberType
-enum NumberType
-{
-    // The following number types have the range [-1..1]
-    ADDR_NO_NUMBER,         // This component doesn't exist and has no default value
-    ADDR_EPSILON,           // Force component value to integer 0x00000001
-    ADDR_ZERO,              // Force component value to integer 0x00000000
-    ADDR_ONE,               // Force component value to floating point 1.0
-    // Above values don't have any bits per component (keep ADDR_ONE the last of these)
-
-    ADDR_UNORM,             // Unsigned normalized (repeating fraction) full precision
-    ADDR_SNORM,             // Signed normalized (repeating fraction) full precision
-    ADDR_GAMMA,             // Gamma-corrected, full precision
-
-    ADDR_UNORM_R5XXRB,      // Unsigned normalized (repeating fraction) for r5xx RB
-    ADDR_SNORM_R5XXRB,      // Signed normalized (repeating fraction) for r5xx RB
-    ADDR_GAMMA_R5XXRB,      // Gamma-corrected for r5xx RB (note: unnormalized value)
-    ADDR_UNORM_R5XXBC,      // Unsigned normalized (repeating fraction) for r5xx BC
-    ADDR_SNORM_R5XXBC,      // Signed normalized (repeating fraction) for r5xx BC
-    ADDR_GAMMA_R5XXBC,      // Gamma-corrected for r5xx BC (note: unnormalized value)
-
-    ADDR_UNORM_R6XX,        // Unsigned normalized (repeating fraction) for R6xx
-    ADDR_UNORM_R6XXDB,      // Unorms for 24-bit depth: one value differs from ADDR_UNORM_R6XX
-    ADDR_SNORM_R6XX,        // Signed normalized (repeating fraction) for R6xx
-    ADDR_GAMMA8_R6XX,       // Gamma-corrected for r6xx
-    ADDR_GAMMA8_R7XX_TP,    // Gamma-corrected for r7xx TP 12bit unorm 8.4.
-
-    ADDR_U4FLOATC,          // Unsigned float: 4-bit exponent, bias=15, no NaN, clamp [0..1]
-    ADDR_GAMMA_4SEG,        // Gamma-corrected, four segment approximation
-    ADDR_U0FIXED,           // Unsigned 0.N-bit fixed point
-
-    // The following number types have large ranges (LEAVE ADDR_USCALED first or fix Finish routine)
-    ADDR_USCALED,           // Unsigned integer converted to/from floating point
-    ADDR_SSCALED,           // Signed integer converted to/from floating point
-    ADDR_USCALED_R5XXRB,    // Unsigned integer to/from floating point for r5xx RB
-    ADDR_SSCALED_R5XXRB,    // Signed integer to/from floating point for r5xx RB
-    ADDR_UINT_BITS,         // Keep in unsigned integer form, clamped to specified range
-    ADDR_SINT_BITS,         // Keep in signed integer form, clamped to specified range
-    ADDR_UINTBITS,          // @@ remove Keep in unsigned integer form, use modulus to reduce bits
-    ADDR_SINTBITS,          // @@ remove Keep in signed integer form, use modulus to reduce bits
-
-    // The following number types and ADDR_U4FLOATC have exponents
-    // (LEAVE ADDR_S8FLOAT first or fix Finish routine)
-    ADDR_S8FLOAT,           // Signed floating point with 8-bit exponent, bias=127
-    ADDR_S8FLOAT32,         // 32-bit IEEE float, passes through NaN values
-    ADDR_S5FLOAT,           // Signed floating point with 5-bit exponent, bias=15
-    ADDR_S5FLOATM,          // Signed floating point with 5-bit exponent, bias=15, no NaN/Inf
-    ADDR_U5FLOAT,           // Signed floating point with 5-bit exponent, bias=15
-    ADDR_U3FLOATM,          // Unsigned floating point with 3-bit exponent, bias=3
-
-    ADDR_S5FIXED,           // Signed 5.N-bit fixed point, with rounding
-
-    ADDR_END_NUMBER         // Used for range comparisons
-};
-
-// Copy from legacy lib's AddrElement
-enum ElemMode
-{
-    // These formats allow both packing an unpacking
-    ADDR_ROUND_BY_HALF,      // add 1/2 and truncate when packing this element
-    ADDR_ROUND_TRUNCATE,     // truncate toward 0 for sign/mag, else toward neg
-    ADDR_ROUND_DITHER,       // Pack by dithering -- requires (x,y) position
-
-    // These formats only allow unpacking, no packing
-    ADDR_UNCOMPRESSED,       // Elements are not compressed: one data element per pixel/texel
-    ADDR_EXPANDED,           // Elements are split up and stored in multiple data elements
-    ADDR_PACKED_STD,         // Elements are compressed into ExpandX by ExpandY data elements
-    ADDR_PACKED_REV,         // Like ADDR_PACKED, but X order of pixels is reverved
-    ADDR_PACKED_GBGR,        // Elements are compressed 4:2:2 in G1B_G0R order (high to low)
-    ADDR_PACKED_BGRG,        // Elements are compressed 4:2:2 in BG1_RG0 order (high to low)
-    ADDR_PACKED_BC1,         // Each data element is uncompressed to a 4x4 pixel/texel array
-    ADDR_PACKED_BC2,         // Each data element is uncompressed to a 4x4 pixel/texel array
-    ADDR_PACKED_BC3,         // Each data element is uncompressed to a 4x4 pixel/texel array
-    ADDR_PACKED_BC4,         // Each data element is uncompressed to a 4x4 pixel/texel array
-    ADDR_PACKED_BC5,         // Each data element is uncompressed to a 4x4 pixel/texel array
-    ADDR_PACKED_ETC2_64BPP,  // ETC2 formats that use 64bpp to represent each 4x4 block
-    ADDR_PACKED_ETC2_128BPP, // ETC2 formats that use 128bpp to represent each 4x4 block
-    ADDR_PACKED_ASTC,        // Various ASTC formats, all are 128bpp with varying block sizes
-
-    // These formats provide various kinds of compression
-    ADDR_ZPLANE_R5XX,        // Compressed Zplane using r5xx architecture format
-    ADDR_ZPLANE_R6XX,        // Compressed Zplane using r6xx architecture format
-    //@@ Fill in the compression modes
-
-    ADDR_END_ELEMENT         // Used for range comparisons
-};
-
-enum DepthPlanarType
-{
-    ADDR_DEPTH_PLANAR_NONE = 0, // No plane z/stencl
-    ADDR_DEPTH_PLANAR_R600 = 1, // R600 z and stencil planes are store within a tile
-    ADDR_DEPTH_PLANAR_R800 = 2, // R800 has separate z and stencil planes
-};
-
-/**
-****************************************************************************************************
-*   PixelFormatInfo
-*
-*   @brief
-*       Per component info
-*
-****************************************************************************************************
-*/
-struct PixelFormatInfo
-{
-    UINT_32             compBit[4];
-    NumberType          numType[4];
-    UINT_32             compStart[4];
-    ElemMode            elemMode;
-    UINT_32             comps;          ///< Number of components
-};
-
-/**
-****************************************************************************************************
-* @brief This class contains asic indepentent element related attributes and operations
-****************************************************************************************************
-*/
-class ElemLib : public Object
-{
-protected:
-    ElemLib(Lib* pAddrLib);
-
-public:
-
-    /// Makes this class virtual
-    virtual ~ElemLib();
-
-    static ElemLib* Create(
-        const Lib* pAddrLib);
-
-    /// The implementation is only for R6xx/R7xx, so make it virtual in case we need for R8xx
-    BOOL_32 PixGetExportNorm(
-        AddrColorFormat colorFmt,
-        AddrSurfaceNumber numberFmt, AddrSurfaceSwap swap) const;
-
-    /// Below method are asic independent, so make them just static.
-    /// Remove static if we need different operation in hwl.
-
-    VOID    Flt32ToDepthPixel(
-        AddrDepthFormat format, const ADDR_FLT_32 comps[2], UINT_8 *pPixel) const;
-
-    VOID    Flt32ToColorPixel(
-        AddrColorFormat format, AddrSurfaceNumber surfNum, AddrSurfaceSwap surfSwap,
-        const ADDR_FLT_32 comps[4], UINT_8 *pPixel) const;
-
-    static VOID    Flt32sToInt32s(
-        ADDR_FLT_32 value, UINT_32 bits, NumberType numberType, UINT_32* pResult);
-
-    static VOID    Int32sToPixel(
-        UINT_32 numComps, UINT_32* pComps, UINT_32* pCompBits, UINT_32* pCompStart,
-        ComponentFlags properties, UINT_32 resultBits, UINT_8* pPixel);
-
-    VOID    PixGetColorCompInfo(
-        AddrColorFormat format, AddrSurfaceNumber number, AddrSurfaceSwap swap,
-        PixelFormatInfo* pInfo) const;
-
-    VOID    PixGetDepthCompInfo(
-        AddrDepthFormat format, PixelFormatInfo* pInfo) const;
-
-    UINT_32 GetBitsPerPixel(
-        AddrFormat format, ElemMode* pElemMode = NULL,
-        UINT_32* pExpandX = NULL, UINT_32* pExpandY = NULL, UINT_32* pBitsUnused = NULL);
-
-    static VOID    SetClearComps(
-        ADDR_FLT_32 comps[4], BOOL_32 clearColor, BOOL_32 float32);
-
-    VOID    AdjustSurfaceInfo(
-        ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
-        UINT_32* pBpp, UINT_32* pBasePitch, UINT_32* pWidth, UINT_32* pHeight);
-
-    VOID    RestoreSurfaceInfo(
-        ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
-        UINT_32* pBpp, UINT_32* pWidth, UINT_32* pHeight);
-
-    /// Checks if depth and stencil are planar inside a tile
-    BOOL_32 IsDepthStencilTilePlanar()
-    {
-        return (m_depthPlanarType == ADDR_DEPTH_PLANAR_R600) ? TRUE : FALSE;
-    }
-
-    /// Sets m_configFlags, copied from AddrLib
-    VOID    SetConfigFlags(ConfigFlags flags)
-    {
-        m_configFlags = flags;
-    }
-
-    static BOOL_32 IsCompressed(AddrFormat format);
-    static BOOL_32 IsBlockCompressed(AddrFormat format);
-    static BOOL_32 IsExpand3x(AddrFormat format);
-    static BOOL_32 IsMacroPixelPacked(AddrFormat format);
-
-protected:
-
-    static VOID    GetCompBits(
-        UINT_32 c0, UINT_32 c1, UINT_32 c2, UINT_32 c3,
-        PixelFormatInfo* pInfo,
-        ElemMode elemMode = ADDR_ROUND_BY_HALF);
-
-    static VOID    GetCompType(
-        AddrColorFormat format, AddrSurfaceNumber numType,
-        PixelFormatInfo* pInfo);
-
-    static VOID    GetCompSwap(
-        AddrSurfaceSwap swap, PixelFormatInfo* pInfo);
-
-    static VOID    SwapComps(
-        UINT_32 c0, UINT_32 c1, PixelFormatInfo* pInfo);
-
-private:
-
-    UINT_32             m_fp16ExportNorm;   ///< If allow FP16 to be reported as EXPORT_NORM
-    DepthPlanarType     m_depthPlanarType;
-
-    ConfigFlags         m_configFlags;      ///< Copy of AddrLib's configFlags
-    Addr::Lib* const    m_pAddrLib;         ///< Pointer to parent addrlib instance
-};
-
-} //Addr
-
-#endif
-
diff --git a/src/amd/addrlib/core/addrlib.cpp b/src/amd/addrlib/core/addrlib.cpp
deleted file mode 100644 (file)
index 5af6dd1..0000000
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Copyright © 2014 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  addrlib.cpp
-* @brief Contains the implementation for the Addr::Lib class.
-****************************************************************************************************
-*/
-
-#include "addrinterface.h"
-#include "addrlib.h"
-#include "addrcommon.h"
-
-#if defined(__APPLE__)
-
-UINT_32 div64_32(UINT_64 n, UINT_32 base)
-{
-    UINT_64 rem = n;
-    UINT_64 b = base;
-    UINT_64 res, d = 1;
-    UINT_32 high = rem >> 32;
-
-    res = 0;
-    if (high >= base)
-    {
-        high /= base;
-        res = (UINT_64) high << 32;
-        rem -= (UINT_64) (high * base) << 32;
-    }
-
-    while (((INT_64)b > 0) && (b < rem))
-    {
-        b = b + b;
-        d = d + d;
-    }
-
-    do
-    {
-        if (rem >= b)
-        {
-            rem -= b;
-            res += d;
-        }
-        b >>= 1;
-        d >>= 1;
-    } while (d);
-
-    n = res;
-    return rem;
-}
-
-extern "C"
-UINT_32 __umoddi3(UINT_64 n, UINT_32 base)
-{
-    return div64_32(n, base);
-}
-
-#endif // __APPLE__
-
-namespace Addr
-{
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Constructor/Destructor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   Lib::Lib
-*
-*   @brief
-*       Constructor for the AddrLib class
-*
-****************************************************************************************************
-*/
-Lib::Lib() :
-    m_class(BASE_ADDRLIB),
-    m_chipFamily(ADDR_CHIP_FAMILY_IVLD),
-    m_chipRevision(0),
-    m_version(ADDRLIB_VERSION),
-    m_pipes(0),
-    m_banks(0),
-    m_pipeInterleaveBytes(0),
-    m_rowSize(0),
-    m_minPitchAlignPixels(1),
-    m_maxSamples(8),
-    m_pElemLib(NULL)
-{
-    m_configFlags.value = 0;
-}
-
-/**
-****************************************************************************************************
-*   Lib::Lib
-*
-*   @brief
-*       Constructor for the AddrLib class with hClient as parameter
-*
-****************************************************************************************************
-*/
-Lib::Lib(const Client* pClient) :
-    Object(pClient),
-    m_class(BASE_ADDRLIB),
-    m_chipFamily(ADDR_CHIP_FAMILY_IVLD),
-    m_chipRevision(0),
-    m_version(ADDRLIB_VERSION),
-    m_pipes(0),
-    m_banks(0),
-    m_pipeInterleaveBytes(0),
-    m_rowSize(0),
-    m_minPitchAlignPixels(1),
-    m_maxSamples(8),
-    m_pElemLib(NULL)
-{
-    m_configFlags.value = 0;
-}
-
-/**
-****************************************************************************************************
-*   Lib::~AddrLib
-*
-*   @brief
-*       Destructor for the AddrLib class
-*
-****************************************************************************************************
-*/
-Lib::~Lib()
-{
-    if (m_pElemLib)
-    {
-        delete m_pElemLib;
-        m_pElemLib = NULL;
-    }
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Initialization/Helper
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   Lib::Create
-*
-*   @brief
-*       Creates and initializes AddrLib object.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::Create(
-    const ADDR_CREATE_INPUT* pCreateIn,     ///< [in] pointer to ADDR_CREATE_INPUT
-    ADDR_CREATE_OUTPUT*      pCreateOut)    ///< [out] pointer to ADDR_CREATE_OUTPUT
-{
-    Lib* pLib = NULL;
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pCreateIn->createFlags.fillSizeFields == TRUE)
-    {
-        if ((pCreateIn->size != sizeof(ADDR_CREATE_INPUT)) ||
-            (pCreateOut->size != sizeof(ADDR_CREATE_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if ((returnCode == ADDR_OK)                    &&
-        (pCreateIn->callbacks.allocSysMem != NULL) &&
-        (pCreateIn->callbacks.freeSysMem != NULL))
-    {
-        Client client = {
-            pCreateIn->hClient,
-            pCreateIn->callbacks
-        };
-
-        switch (pCreateIn->chipEngine)
-        {
-            case CIASICIDGFXENGINE_SOUTHERNISLAND:
-                switch (pCreateIn->chipFamily)
-                {
-                    case FAMILY_SI:
-                        pLib = SiHwlInit(&client);
-                        break;
-                    case FAMILY_VI:
-                    case FAMILY_CZ: // VI based fusion(carrizo)
-                    case FAMILY_CI:
-                    case FAMILY_KV: // CI based fusion
-                        pLib = CiHwlInit(&client);
-                        break;
-                    default:
-                        ADDR_ASSERT_ALWAYS();
-                        break;
-                }
-                break;
-            case CIASICIDGFXENGINE_ARCTICISLAND:
-                switch (pCreateIn->chipFamily)
-                {
-                    case FAMILY_AI:
-                    case FAMILY_RV:
-                        pLib = Gfx9HwlInit(&client);
-                        break;
-                    default:
-                        ADDR_ASSERT_ALWAYS();
-                        break;
-                }
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-    }
-
-    if (pLib != NULL)
-    {
-        BOOL_32 initValid;
-
-        // Pass createFlags to configFlags first since these flags may be overwritten
-        pLib->m_configFlags.noCubeMipSlicesPad  = pCreateIn->createFlags.noCubeMipSlicesPad;
-        pLib->m_configFlags.fillSizeFields      = pCreateIn->createFlags.fillSizeFields;
-        pLib->m_configFlags.useTileIndex        = pCreateIn->createFlags.useTileIndex;
-        pLib->m_configFlags.useCombinedSwizzle  = pCreateIn->createFlags.useCombinedSwizzle;
-        pLib->m_configFlags.checkLast2DLevel    = pCreateIn->createFlags.checkLast2DLevel;
-        pLib->m_configFlags.useHtileSliceAlign  = pCreateIn->createFlags.useHtileSliceAlign;
-        pLib->m_configFlags.allowLargeThickTile = pCreateIn->createFlags.allowLargeThickTile;
-        pLib->m_configFlags.disableLinearOpt    = FALSE;
-
-        pLib->SetChipFamily(pCreateIn->chipFamily, pCreateIn->chipRevision);
-
-        pLib->SetMinPitchAlignPixels(pCreateIn->minPitchAlignPixels);
-
-        // Global parameters initialized and remaining configFlags bits are set as well
-        initValid = pLib->HwlInitGlobalParams(pCreateIn);
-
-        if (initValid)
-        {
-            pLib->m_pElemLib = ElemLib::Create(pLib);
-        }
-        else
-        {
-            pLib->m_pElemLib = NULL; // Don't go on allocating element lib
-            returnCode = ADDR_INVALIDGBREGVALUES;
-        }
-
-        if (pLib->m_pElemLib == NULL)
-        {
-            delete pLib;
-            pLib = NULL;
-            ADDR_ASSERT_ALWAYS();
-        }
-        else
-        {
-            pLib->m_pElemLib->SetConfigFlags(pLib->m_configFlags);
-        }
-    }
-
-    pCreateOut->hLib = pLib;
-
-    if ((pLib != NULL) &&
-        (returnCode == ADDR_OK))
-    {
-        pCreateOut->numEquations =
-            pLib->HwlGetEquationTableInfo(&pCreateOut->pEquationTable);
-
-        pLib->SetMaxAlignments();
-
-    }
-    else if ((pLib == NULL) &&
-             (returnCode == ADDR_OK))
-    {
-        // Unknown failures, we return the general error code
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::SetChipFamily
-*
-*   @brief
-*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
-*   @return
-*      N/A
-****************************************************************************************************
-*/
-VOID Lib::SetChipFamily(
-    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
-    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
-{
-    ChipFamily family = HwlConvertChipFamily(uChipFamily, uChipRevision);
-
-    ADDR_ASSERT(family != ADDR_CHIP_FAMILY_IVLD);
-
-    m_chipFamily   = family;
-    m_chipRevision = uChipRevision;
-}
-
-/**
-****************************************************************************************************
-*   Lib::SetMinPitchAlignPixels
-*
-*   @brief
-*       Set m_minPitchAlignPixels with input param
-*
-*   @return
-*      N/A
-****************************************************************************************************
-*/
-VOID Lib::SetMinPitchAlignPixels(
-    UINT_32 minPitchAlignPixels)    ///< [in] minmum pitch alignment in pixels
-{
-    m_minPitchAlignPixels = (minPitchAlignPixels == 0) ? 1 : minPitchAlignPixels;
-}
-
-/**
-****************************************************************************************************
-*   Lib::SetMaxAlignments
-*
-*   @brief
-*       Set max alignments
-*
-*   @return
-*      N/A
-****************************************************************************************************
-*/
-VOID Lib::SetMaxAlignments()
-{
-    m_maxBaseAlign     = HwlComputeMaxBaseAlignments();
-    m_maxMetaBaseAlign = HwlComputeMaxMetaBaseAlignments();
-}
-
-/**
-****************************************************************************************************
-*   Lib::GetLib
-*
-*   @brief
-*       Get AddrLib pointer
-*
-*   @return
-*      An AddrLib class pointer
-****************************************************************************************************
-*/
-Lib* Lib::GetLib(
-    ADDR_HANDLE hLib)   ///< [in] handle of ADDR_HANDLE
-{
-    return static_cast<Addr::Lib*>(hLib);
-}
-
-/**
-****************************************************************************************************
-*   Lib::GetMaxAlignments
-*
-*   @brief
-*       Gets maximum alignments for data surface (include FMask)
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::GetMaxAlignments(
-    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if (pOut->size != sizeof(ADDR_GET_MAX_ALINGMENTS_OUTPUT))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        if (m_maxBaseAlign != 0)
-        {
-            pOut->baseAlign = m_maxBaseAlign;
-        }
-        else
-        {
-            returnCode = ADDR_NOTIMPLEMENTED;
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::GetMaxMetaAlignments
-*
-*   @brief
-*       Gets maximum alignments for metadata (CMask, DCC and HTile)
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::GetMaxMetaAlignments(
-    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if (pOut->size != sizeof(ADDR_GET_MAX_ALINGMENTS_OUTPUT))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        if (m_maxMetaBaseAlign != 0)
-        {
-            pOut->baseAlign = m_maxMetaBaseAlign;
-        }
-        else
-        {
-            returnCode = ADDR_NOTIMPLEMENTED;
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::Bits2Number
-*
-*   @brief
-*       Cat a array of binary bit to a number
-*
-*   @return
-*       The number combined with the array of bits
-****************************************************************************************************
-*/
-UINT_32 Lib::Bits2Number(
-    UINT_32 bitNum,     ///< [in] how many bits
-    ...)                ///< [in] varaible bits value starting from MSB
-{
-    UINT_32 number = 0;
-    UINT_32 i;
-    va_list bits_ptr;
-
-    va_start(bits_ptr, bitNum);
-
-    for(i = 0; i < bitNum; i++)
-    {
-        number |= va_arg(bits_ptr, UINT_32);
-        number <<= 1;
-    }
-
-    number >>= 1;
-
-    va_end(bits_ptr);
-
-    return number;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Element lib
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-/**
-****************************************************************************************************
-*   Lib::Flt32ToColorPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a depth/stencil pixel value
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::Flt32ToDepthPixel(
-    const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
-    ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ELEM_FLT32TODEPTHPIXEL_INPUT)) ||
-            (pOut->size != sizeof(ELEM_FLT32TODEPTHPIXEL_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        GetElemLib()->Flt32ToDepthPixel(pIn->format, pIn->comps, pOut->pPixel);
-
-        UINT_32 depthBase = 0;
-        UINT_32 stencilBase = 0;
-        UINT_32 depthBits = 0;
-        UINT_32 stencilBits = 0;
-
-        switch (pIn->format)
-        {
-            case ADDR_DEPTH_16:
-                depthBits = 16;
-                break;
-            case ADDR_DEPTH_X8_24:
-            case ADDR_DEPTH_8_24:
-            case ADDR_DEPTH_X8_24_FLOAT:
-            case ADDR_DEPTH_8_24_FLOAT:
-                depthBase = 8;
-                depthBits = 24;
-                stencilBits = 8;
-                break;
-            case ADDR_DEPTH_32_FLOAT:
-                depthBits = 32;
-                break;
-            case ADDR_DEPTH_X24_8_32_FLOAT:
-                depthBase = 8;
-                depthBits = 32;
-                stencilBits = 8;
-                break;
-            default:
-                break;
-        }
-
-        // Overwrite base since R800 has no "tileBase"
-        if (GetElemLib()->IsDepthStencilTilePlanar() == FALSE)
-        {
-            depthBase = 0;
-            stencilBase = 0;
-        }
-
-        depthBase *= 64;
-        stencilBase *= 64;
-
-        pOut->stencilBase = stencilBase;
-        pOut->depthBase = depthBase;
-        pOut->depthBits = depthBits;
-        pOut->stencilBits = stencilBits;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::Flt32ToColorPixel
-*
-*   @brief
-*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::Flt32ToColorPixel(
-    const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
-    ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ELEM_FLT32TOCOLORPIXEL_INPUT)) ||
-            (pOut->size != sizeof(ELEM_FLT32TOCOLORPIXEL_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        GetElemLib()->Flt32ToColorPixel(pIn->format,
-                                        pIn->surfNum,
-                                        pIn->surfSwap,
-                                        pIn->comps,
-                                        pOut->pPixel);
-    }
-
-    return returnCode;
-}
-
-
-/**
-****************************************************************************************************
-*   Lib::GetExportNorm
-*
-*   @brief
-*       Check one format can be EXPORT_NUM
-*   @return
-*       TRUE if EXPORT_NORM can be used
-****************************************************************************************************
-*/
-BOOL_32 Lib::GetExportNorm(
-    const ELEM_GETEXPORTNORM_INPUT* pIn) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    BOOL_32 enabled = FALSE;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if (pIn->size != sizeof(ELEM_GETEXPORTNORM_INPUT))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        enabled = GetElemLib()->PixGetExportNorm(pIn->format, pIn->num, pIn->swap);
-    }
-
-    return enabled;
-}
-
-} // Addr
diff --git a/src/amd/addrlib/core/addrlib.h b/src/amd/addrlib/core/addrlib.h
deleted file mode 100644 (file)
index 0cbb4e0..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright © 2014 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  addrlib.h
-* @brief Contains the Addr::Lib base class definition.
-****************************************************************************************************
-*/
-
-#ifndef __ADDR_LIB_H__
-#define __ADDR_LIB_H__
-
-#include "addrinterface.h"
-#include "addrobject.h"
-#include "addrelemlib.h"
-
-#include "amdgpu_asic_addr.h"
-
-#ifndef CIASICIDGFXENGINE_R600
-#define CIASICIDGFXENGINE_R600 0x00000006
-#endif
-
-#ifndef CIASICIDGFXENGINE_R800
-#define CIASICIDGFXENGINE_R800 0x00000008
-#endif
-
-#ifndef CIASICIDGFXENGINE_SOUTHERNISLAND
-#define CIASICIDGFXENGINE_SOUTHERNISLAND 0x0000000A
-#endif
-
-#ifndef CIASICIDGFXENGINE_ARCTICISLAND
-#define CIASICIDGFXENGINE_ARCTICISLAND 0x0000000D
-#endif
-
-namespace Addr
-{
-
-/**
-****************************************************************************************************
-* @brief Neutral enums that define pipeinterleave
-****************************************************************************************************
-*/
-enum PipeInterleave
-{
-    ADDR_PIPEINTERLEAVE_256B = 256,
-    ADDR_PIPEINTERLEAVE_512B = 512,
-    ADDR_PIPEINTERLEAVE_1KB  = 1024,
-    ADDR_PIPEINTERLEAVE_2KB  = 2048,
-};
-
-/**
-****************************************************************************************************
-* @brief Neutral enums that define DRAM row size
-****************************************************************************************************
-*/
-enum RowSize
-{
-    ADDR_ROWSIZE_1KB = 1024,
-    ADDR_ROWSIZE_2KB = 2048,
-    ADDR_ROWSIZE_4KB = 4096,
-    ADDR_ROWSIZE_8KB = 8192,
-};
-
-/**
-****************************************************************************************************
-* @brief Neutral enums that define bank interleave
-****************************************************************************************************
-*/
-enum BankInterleave
-{
-    ADDR_BANKINTERLEAVE_1 = 1,
-    ADDR_BANKINTERLEAVE_2 = 2,
-    ADDR_BANKINTERLEAVE_4 = 4,
-    ADDR_BANKINTERLEAVE_8 = 8,
-};
-
-/**
-****************************************************************************************************
-* @brief Neutral enums that define shader engine tile size
-****************************************************************************************************
-*/
-enum ShaderEngineTileSize
-{
-    ADDR_SE_TILESIZE_16 = 16,
-    ADDR_SE_TILESIZE_32 = 32,
-};
-
-/**
-****************************************************************************************************
-* @brief Neutral enums that define bank swap size
-****************************************************************************************************
-*/
-enum BankSwapSize
-{
-    ADDR_BANKSWAP_128B = 128,
-    ADDR_BANKSWAP_256B = 256,
-    ADDR_BANKSWAP_512B = 512,
-    ADDR_BANKSWAP_1KB = 1024,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define max compressed fragments config
-****************************************************************************************************
-*/
-enum NumMaxCompressedFragmentsConfig
-{
-    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,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define num pipes config
-****************************************************************************************************
-*/
-enum NumPipesConfig
-{
-    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,
-    ADDR_CONFIG_64_PIPE                      = 0x00000006,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define num banks config
-****************************************************************************************************
-*/
-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,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define num rb per shader engine config
-****************************************************************************************************
-*/
-enum NumRbPerShaderEngineConfig
-{
-    ADDR_CONFIG_1_RB_PER_SHADER_ENGINE       = 0x00000000,
-    ADDR_CONFIG_2_RB_PER_SHADER_ENGINE       = 0x00000001,
-    ADDR_CONFIG_4_RB_PER_SHADER_ENGINE       = 0x00000002,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define num shader engines config
-****************************************************************************************************
-*/
-enum NumShaderEnginesConfig
-{
-    ADDR_CONFIG_1_SHADER_ENGINE              = 0x00000000,
-    ADDR_CONFIG_2_SHADER_ENGINE              = 0x00000001,
-    ADDR_CONFIG_4_SHADER_ENGINE              = 0x00000002,
-    ADDR_CONFIG_8_SHADER_ENGINE              = 0x00000003,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define pipe interleave size config
-****************************************************************************************************
-*/
-enum PipeInterleaveSizeConfig
-{
-    ADDR_CONFIG_PIPE_INTERLEAVE_256B         = 0x00000000,
-    ADDR_CONFIG_PIPE_INTERLEAVE_512B         = 0x00000001,
-    ADDR_CONFIG_PIPE_INTERLEAVE_1KB          = 0x00000002,
-    ADDR_CONFIG_PIPE_INTERLEAVE_2KB          = 0x00000003,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define row size config
-****************************************************************************************************
-*/
-enum RowSizeConfig
-{
-    ADDR_CONFIG_1KB_ROW                      = 0x00000000,
-    ADDR_CONFIG_2KB_ROW                      = 0x00000001,
-    ADDR_CONFIG_4KB_ROW                      = 0x00000002,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define bank interleave size config
-****************************************************************************************************
-*/
-enum BankInterleaveSizeConfig
-{
-    ADDR_CONFIG_BANK_INTERLEAVE_1            = 0x00000000,
-    ADDR_CONFIG_BANK_INTERLEAVE_2            = 0x00000001,
-    ADDR_CONFIG_BANK_INTERLEAVE_4            = 0x00000002,
-    ADDR_CONFIG_BANK_INTERLEAVE_8            = 0x00000003,
-};
-
-/**
-****************************************************************************************************
-* @brief Enums that define engine tile size config
-****************************************************************************************************
-*/
-enum ShaderEngineTileSizeConfig
-{
-    ADDR_CONFIG_SE_TILE_16                   = 0x00000000,
-    ADDR_CONFIG_SE_TILE_32                   = 0x00000001,
-};
-
-/**
-****************************************************************************************************
-* @brief This class contains asic independent address lib functionalities
-****************************************************************************************************
-*/
-class Lib : public Object
-{
-public:
-    virtual ~Lib();
-
-    static ADDR_E_RETURNCODE Create(
-        const ADDR_CREATE_INPUT* pCreateInfo, ADDR_CREATE_OUTPUT* pCreateOut);
-
-    /// Pair of Create
-    VOID Destroy()
-    {
-        delete this;
-    }
-
-    static Lib* GetLib(ADDR_HANDLE hLib);
-
-    /// Returns AddrLib version (from compiled binary instead include file)
-    UINT_32 GetVersion()
-    {
-        return m_version;
-    }
-
-    /// Returns asic chip family name defined by AddrLib
-    ChipFamily GetChipFamily()
-    {
-        return m_chipFamily;
-    }
-
-    ADDR_E_RETURNCODE Flt32ToDepthPixel(
-        const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
-        ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE Flt32ToColorPixel(
-        const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
-        ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) const;
-
-    BOOL_32 GetExportNorm(const ELEM_GETEXPORTNORM_INPUT* pIn) const;
-
-    ADDR_E_RETURNCODE GetMaxAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE GetMaxMetaAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
-
-protected:
-    Lib();  // Constructor is protected
-    Lib(const Client* pClient);
-
-    /// Pure virtual function to get max base alignments
-    virtual UINT_32 HwlComputeMaxBaseAlignments() const = 0;
-
-    /// Gets maximum alignements for metadata
-    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const
-    {
-        ADDR_NOT_IMPLEMENTED();
-
-        return 0;
-    }
-
-    VOID ValidBaseAlignments(UINT_32 alignment) const
-    {
-#if DEBUG
-        ADDR_ASSERT(alignment <= m_maxBaseAlign);
-#endif
-    }
-
-    VOID ValidMetaBaseAlignments(UINT_32 metaAlignment) const
-    {
-#if DEBUG
-        ADDR_ASSERT(metaAlignment <= m_maxMetaBaseAlign);
-#endif
-    }
-
-    //
-    // Initialization
-    //
-    /// Pure Virtual function for Hwl computing internal global parameters from h/w registers
-    virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn) = 0;
-
-    /// Pure Virtual function for Hwl converting chip family
-    virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision) = 0;
-
-    /// Get equation table pointer and number of equations
-    virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
-    {
-        *ppEquationTable = NULL;
-
-        return 0;
-    }
-
-    //
-    // Misc helper
-    //
-    static UINT_32 Bits2Number(UINT_32 bitNum, ...);
-
-    static UINT_32 GetNumFragments(UINT_32 numSamples, UINT_32 numFrags)
-    {
-        return (numFrags != 0) ? numFrags : Max(1u, numSamples);
-    }
-
-    /// Returns pointer of ElemLib
-    ElemLib* GetElemLib() const
-    {
-        return m_pElemLib;
-    }
-
-    /// Returns fillSizeFields flag
-    UINT_32 GetFillSizeFieldsFlags() const
-    {
-        return m_configFlags.fillSizeFields;
-    }
-
-private:
-    // Disallow the copy constructor
-    Lib(const Lib& a);
-
-    // Disallow the assignment operator
-    Lib& operator=(const Lib& a);
-
-    VOID SetChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
-
-    VOID SetMinPitchAlignPixels(UINT_32 minPitchAlignPixels);
-
-    VOID SetMaxAlignments();
-
-protected:
-    LibClass    m_class;        ///< Store class type (HWL type)
-
-    ChipFamily  m_chipFamily;   ///< Chip family translated from the one in atiid.h
-
-    UINT_32     m_chipRevision; ///< Revision id from xxx_id.h
-
-    UINT_32     m_version;      ///< Current version
-
-    //
-    // Global parameters
-    //
-    ConfigFlags m_configFlags;          ///< Global configuration flags. Note this is setup by
-                                        ///  AddrLib instead of Client except forceLinearAligned
-
-    UINT_32     m_pipes;                ///< Number of pipes
-    UINT_32     m_banks;                ///< Number of banks
-                                        ///  For r800 this is MC_ARB_RAMCFG.NOOFBANK
-                                        ///  Keep it here to do default parameter calculation
-
-    UINT_32     m_pipeInterleaveBytes;
-                                        ///< Specifies the size of contiguous address space
-                                        ///  within each tiling pipe when making linear
-                                        ///  accesses. (Formerly Group Size)
-
-    UINT_32     m_rowSize;              ///< DRAM row size, in bytes
-
-    UINT_32     m_minPitchAlignPixels;  ///< Minimum pitch alignment in pixels
-    UINT_32     m_maxSamples;           ///< Max numSamples
-
-    UINT_32     m_maxBaseAlign;         ///< Max base alignment for data surface
-    UINT_32     m_maxMetaBaseAlign;     ///< Max base alignment for metadata
-
-private:
-    ElemLib*    m_pElemLib;             ///< Element Lib pointer
-};
-
-Lib* SiHwlInit   (const Client* pClient);
-Lib* CiHwlInit   (const Client* pClient);
-Lib* Gfx9HwlInit (const Client* pClient);
-
-} // Addr
-
-#endif
diff --git a/src/amd/addrlib/core/addrlib1.cpp b/src/amd/addrlib/core/addrlib1.cpp
deleted file mode 100644 (file)
index 9c1d842..0000000
+++ /dev/null
@@ -1,4076 +0,0 @@
-/*
- * Copyright © 2016 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  addr1lib.cpp
-* @brief Contains the implementation for the Addr::V1::Lib base class.
-****************************************************************************************************
-*/
-
-#include "addrinterface.h"
-#include "addrlib1.h"
-#include "addrcommon.h"
-
-namespace Addr
-{
-namespace V1
-{
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Static Const Member
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-const TileModeFlags Lib::ModeFlags[ADDR_TM_COUNT] =
-{// T   L  1  2  3  P  Pr B
-    {1, 1, 0, 0, 0, 0, 0, 0}, // ADDR_TM_LINEAR_GENERAL
-    {1, 1, 0, 0, 0, 0, 0, 0}, // ADDR_TM_LINEAR_ALIGNED
-    {1, 0, 1, 0, 0, 0, 0, 0}, // ADDR_TM_1D_TILED_THIN1
-    {4, 0, 1, 0, 0, 0, 0, 0}, // ADDR_TM_1D_TILED_THICK
-    {1, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THIN1
-    {1, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THIN2
-    {1, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THIN4
-    {4, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THICK
-    {1, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THIN1
-    {1, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THIN2
-    {1, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THIN4
-    {4, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THICK
-    {1, 0, 0, 1, 1, 0, 0, 0}, // ADDR_TM_3D_TILED_THIN1
-    {4, 0, 0, 1, 1, 0, 0, 0}, // ADDR_TM_3D_TILED_THICK
-    {1, 0, 0, 1, 1, 0, 0, 1}, // ADDR_TM_3B_TILED_THIN1
-    {4, 0, 0, 1, 1, 0, 0, 1}, // ADDR_TM_3B_TILED_THICK
-    {8, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_XTHICK
-    {8, 0, 0, 1, 1, 0, 0, 0}, // ADDR_TM_3D_TILED_XTHICK
-    {1, 0, 0, 0, 0, 0, 0, 0}, // ADDR_TM_POWER_SAVE
-    {1, 0, 0, 1, 0, 1, 1, 0}, // ADDR_TM_PRT_TILED_THIN1
-    {1, 0, 0, 1, 0, 1, 0, 0}, // ADDR_TM_PRT_2D_TILED_THIN1
-    {1, 0, 0, 1, 1, 1, 0, 0}, // ADDR_TM_PRT_3D_TILED_THIN1
-    {4, 0, 0, 1, 0, 1, 1, 0}, // ADDR_TM_PRT_TILED_THICK
-    {4, 0, 0, 1, 0, 1, 0, 0}, // ADDR_TM_PRT_2D_TILED_THICK
-    {4, 0, 0, 1, 1, 1, 0, 0}, // ADDR_TM_PRT_3D_TILED_THICK
-    {0, 0, 0, 0, 0, 0, 0, 0}, // ADDR_TM_UNKNOWN
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Constructor/Destructor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   Lib::AddrLib1
-*
-*   @brief
-*       Constructor for the AddrLib1 class
-*
-****************************************************************************************************
-*/
-Lib::Lib()
-    :
-    Addr::Lib()
-{
-}
-
-/**
-****************************************************************************************************
-*   Lib::Lib
-*
-*   @brief
-*       Constructor for the Addr::V1::Lib class with hClient as parameter
-*
-****************************************************************************************************
-*/
-Lib::Lib(const Client* pClient)
-    :
-    Addr::Lib(pClient)
-{
-}
-
-/**
-****************************************************************************************************
-*   Lib::~AddrLib1
-*
-*   @brief
-*       Destructor for the AddrLib1 class
-*
-****************************************************************************************************
-*/
-Lib::~Lib()
-{
-}
-
-/**
-****************************************************************************************************
-*   Lib::GetLib
-*
-*   @brief
-*       Get AddrLib1 pointer
-*
-*   @return
-*      An Addr::V1::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_IVLD) ||
-         (pAddrLib->GetChipFamily() > ADDR_CHIP_FAMILY_VI)))
-    {
-        // only valid and pre-VI AISC can use AddrLib1 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 ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input structure
-     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*      pOut    ///< [out] output structure
-     ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_SURFACE_INFO_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_SURFACE_INFO_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    // We suggest client do sanity check but a check here is also good
-    if (pIn->bpp > 128)
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    if ((pIn->tileMode == ADDR_TM_UNKNOWN) && (pIn->mipLevel > 0))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    // Thick modes don't support multisample
-    if ((Thickness(pIn->tileMode) > 1) && (pIn->numSamples > 1))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        // Get a local copy of input structure and only reference pIn for unadjusted values
-        ADDR_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
-        ADDR_TILEINFO tileInfoNull = {0};
-
-        if (UseTileInfo())
-        {
-            // If the original input has a valid ADDR_TILEINFO pointer then copy its contents.
-            // Otherwise the default 0's in tileInfoNull are used.
-            if (pIn->pTileInfo)
-            {
-                tileInfoNull = *pIn->pTileInfo;
-            }
-            localIn.pTileInfo  = &tileInfoNull;
-        }
-
-        localIn.numSamples = (pIn->numSamples == 0) ? 1 : pIn->numSamples;
-
-        // Do mipmap check first
-        // If format is BCn, pre-pad dimension to power-of-two according to HWL
-        ComputeMipLevel(&localIn);
-
-        if (m_configFlags.checkLast2DLevel)
-        {
-            // Save this level's original height in pixels
-            pOut->height = pIn->height;
-        }
-
-        UINT_32 expandX = 1;
-        UINT_32 expandY = 1;
-        ElemMode elemMode;
-
-        // Save outputs that may not go through HWL
-        pOut->pixelBits = localIn.bpp;
-        pOut->numSamples = localIn.numSamples;
-        pOut->last2DLevel = FALSE;
-        pOut->tcCompatible = FALSE;
-
-#if !ALT_TEST
-        if (localIn.numSamples > 1)
-        {
-            ADDR_ASSERT(localIn.mipLevel == 0);
-        }
-#endif
-
-        if (localIn.format != ADDR_FMT_INVALID) // Set format to INVALID will skip this conversion
-        {
-            // 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(IsLinear(localIn.tileMode));
-            }
-
-            GetElemLib()->AdjustSurfaceInfo(elemMode,
-                                            expandX,
-                                            expandY,
-                                            &localIn.bpp,
-                                            &localIn.basePitch,
-                                            &localIn.width,
-                                            &localIn.height);
-
-            // Overwrite these parameters if we have a valid format
-        }
-        else if (localIn.bpp != 0)
-        {
-            localIn.width  = (localIn.width != 0) ? localIn.width : 1;
-            localIn.height = (localIn.height != 0) ? localIn.height : 1;
-        }
-        else // Rule out some invalid parameters
-        {
-            ADDR_ASSERT_ALWAYS();
-
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-
-        // Check mipmap after surface expansion
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = PostComputeMipLevel(&localIn, pOut);
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            if (UseTileIndex(localIn.tileIndex))
-            {
-                // Make sure pTileInfo is not NULL
-                ADDR_ASSERT(localIn.pTileInfo);
-
-                UINT_32 numSamples = GetNumFragments(localIn.numSamples, localIn.numFrags);
-
-                INT_32 macroModeIndex = TileIndexNoMacroIndex;
-
-                if (localIn.tileIndex != TileIndexLinearGeneral)
-                {
-                    // Try finding a macroModeIndex
-                    macroModeIndex = HwlComputeMacroModeIndex(localIn.tileIndex,
-                                                              localIn.flags,
-                                                              localIn.bpp,
-                                                              numSamples,
-                                                              localIn.pTileInfo,
-                                                              &localIn.tileMode,
-                                                              &localIn.tileType);
-                }
-
-                // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
-                if (macroModeIndex == TileIndexNoMacroIndex)
-                {
-                    returnCode = HwlSetupTileCfg(localIn.bpp,
-                                                 localIn.tileIndex, macroModeIndex,
-                                                 localIn.pTileInfo,
-                                                 &localIn.tileMode, &localIn.tileType);
-                }
-                // If macroModeIndex is invalid, then assert this is not macro tiled
-                else if (macroModeIndex == TileIndexInvalid)
-                {
-                    ADDR_ASSERT(!IsMacroTiled(localIn.tileMode));
-                }
-
-                pOut->macroModeIndex = macroModeIndex;
-            }
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            localIn.flags.dccPipeWorkaround = localIn.flags.dccCompatible;
-
-            if (localIn.tileMode == ADDR_TM_UNKNOWN)
-            {
-                // HWL layer may override tile mode if necessary
-                HwlSelectTileMode(&localIn);
-            }
-            else
-            {
-                // HWL layer may override tile mode if necessary
-                HwlOverrideTileMode(&localIn);
-
-                // Optimize tile mode if possible
-                OptimizeTileMode(&localIn);
-            }
-        }
-
-        // Call main function to compute surface info
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlComputeSurfaceInfo(&localIn, pOut);
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            // Since bpp might be changed we just pass it through
-            pOut->bpp  = localIn.bpp;
-
-            // Also original width/height/bpp
-            pOut->pixelPitch    = pOut->pitch;
-            pOut->pixelHeight   = pOut->height;
-
-#if DEBUG
-            if (localIn.flags.display)
-            {
-                ADDR_ASSERT((pOut->pitchAlign % 32) == 0);
-            }
-#endif //DEBUG
-
-            if (localIn.format != ADDR_FMT_INVALID)
-            {
-                //
-                // Note: For 96 bit surface, the pixelPitch returned might be an odd number, but it
-                // is okay to program texture pitch as HW's mip calculator would multiply 3 first,
-                // then do the appropriate paddings (linear alignment requirement and possible the
-                // nearest power-of-two for mipmaps), which results in the original pitch.
-                //
-                GetElemLib()->RestoreSurfaceInfo(elemMode,
-                                                 expandX,
-                                                 expandY,
-                                                 &localIn.bpp,
-                                                 &pOut->pixelPitch,
-                                                 &pOut->pixelHeight);
-            }
-
-            if (localIn.flags.qbStereo)
-            {
-                if (pOut->pStereoInfo)
-                {
-                    ComputeQbStereoInfo(pOut);
-                }
-            }
-
-            if (localIn.flags.volume) // For volume sliceSize equals to all z-slices
-            {
-                pOut->sliceSize = pOut->surfSize;
-            }
-            else // For array: sliceSize is likely to have slice-padding (the last one)
-            {
-                pOut->sliceSize = pOut->surfSize / pOut->depth;
-
-                // array or cubemap
-                if (pIn->numSlices > 1)
-                {
-                    // If this is the last slice then add the padding size to this slice
-                    if (pIn->slice == (pIn->numSlices - 1))
-                    {
-                        pOut->sliceSize += pOut->sliceSize * (pOut->depth - pIn->numSlices);
-                    }
-                    else if (m_configFlags.checkLast2DLevel)
-                    {
-                        // Reset last2DLevel flag if this is not the last array slice
-                        pOut->last2DLevel = FALSE;
-                    }
-                }
-            }
-
-            pOut->pitchTileMax = pOut->pitch / 8 - 1;
-            pOut->heightTileMax = pOut->height / 8 - 1;
-            pOut->sliceTileMax = pOut->pitch * pOut->height / 64 - 1;
-        }
-    }
-
-    ValidBaseAlignments(pOut->baseAlign);
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeSurfaceInfo
-*
-*   @brief
-*       Interface function stub of AddrComputeSurfaceInfo.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeSurfaceAddrFromCoord(
-    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            const ADDR_SURFACE_FLAGS flags = {{0}};
-            UINT_32 numSamples = GetNumFragments(pIn->numSamples, pIn->numFrags);
-
-            // Try finding a macroModeIndex
-            INT_32 macroModeIndex = HwlComputeMacroModeIndex(input.tileIndex,
-                                                             flags,
-                                                             input.bpp,
-                                                             numSamples,
-                                                             input.pTileInfo,
-                                                             &input.tileMode,
-                                                             &input.tileType);
-
-            // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
-            if (macroModeIndex == TileIndexNoMacroIndex)
-            {
-                returnCode = HwlSetupTileCfg(input.bpp, input.tileIndex, macroModeIndex,
-                                             input.pTileInfo, &input.tileMode, &input.tileType);
-            }
-            // If macroModeIndex is invalid, then assert this is not macro tiled
-            else if (macroModeIndex == TileIndexInvalid)
-            {
-                ADDR_ASSERT(!IsMacroTiled(input.tileMode));
-            }
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlComputeSurfaceAddrFromCoord(pIn, pOut);
-
-            if (returnCode == ADDR_OK)
-            {
-                pOut->prtBlockIndex = static_cast<UINT_32>(pOut->addr / (64 * 1024));
-            }
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeSurfaceCoordFromAddr
-*
-*   @brief
-*       Interface function stub of ComputeSurfaceCoordFromAddr.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeSurfaceCoordFromAddr(
-    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            const ADDR_SURFACE_FLAGS flags = {{0}};
-            UINT_32 numSamples = GetNumFragments(pIn->numSamples, pIn->numFrags);
-
-            // Try finding a macroModeIndex
-            INT_32 macroModeIndex = HwlComputeMacroModeIndex(input.tileIndex,
-                                                             flags,
-                                                             input.bpp,
-                                                             numSamples,
-                                                             input.pTileInfo,
-                                                             &input.tileMode,
-                                                             &input.tileType);
-
-            // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
-            if (macroModeIndex == TileIndexNoMacroIndex)
-            {
-                returnCode = HwlSetupTileCfg(input.bpp, input.tileIndex, macroModeIndex,
-                                             input.pTileInfo, &input.tileMode, &input.tileType);
-            }
-            // If macroModeIndex is invalid, then assert this is not macro tiled
-            else if (macroModeIndex == TileIndexInvalid)
-            {
-                ADDR_ASSERT(!IsMacroTiled(input.tileMode));
-            }
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlComputeSurfaceCoordFromAddr(pIn, pOut);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeSliceTileSwizzle
-*
-*   @brief
-*       Interface function stub of ComputeSliceTileSwizzle.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeSliceTileSwizzle(
-    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_SLICESWIZZLE_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_SLICESWIZZLE_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_SLICESWIZZLE_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex,
-                                         input.pTileInfo, &input.tileMode);
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlComputeSliceTileSwizzle(pIn, pOut);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ExtractBankPipeSwizzle
-*
-*   @brief
-*       Interface function stub of AddrExtractBankPipeSwizzle.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ExtractBankPipeSwizzle(
-    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,    ///< [in] input structure
-    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT)) ||
-            (pOut->size != sizeof(ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlExtractBankPipeSwizzle(pIn, pOut);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::CombineBankPipeSwizzle
-*
-*   @brief
-*       Interface function stub of AddrCombineBankPipeSwizzle.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::CombineBankPipeSwizzle(
-    const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_INFO_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_INFO_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlCombineBankPipeSwizzle(pIn->bankSwizzle,
-                                                   pIn->pipeSwizzle,
-                                                   pIn->pTileInfo,
-                                                   pIn->baseAddr,
-                                                   &pOut->tileSwizzle);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeBaseSwizzle
-*
-*   @brief
-*       Interface function stub of AddrCompueBaseSwizzle.
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeBaseSwizzle(
-    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
-    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_BASE_SWIZZLE_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_BASE_SWIZZLE_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            if (IsMacroTiled(pIn->tileMode))
-            {
-                returnCode = HwlComputeBaseSwizzle(pIn, pOut);
-            }
-            else
-            {
-                pOut->tileSwizzle = 0;
-            }
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeFmaskInfo
-*
-*   @brief
-*       Interface function stub of ComputeFmaskInfo.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeFmaskInfo(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
-    )
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_INFO_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_INFO_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    // No thick MSAA
-    if (Thickness(pIn->tileMode) > 1)
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_FMASK_INFO_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-
-            if (pOut->pTileInfo)
-            {
-                // Use temp tile info for calcalation
-                input.pTileInfo = pOut->pTileInfo;
-            }
-            else
-            {
-                input.pTileInfo = &tileInfoNull;
-            }
-
-            ADDR_SURFACE_FLAGS flags = {{0}};
-            flags.fmask = 1;
-
-            // Try finding a macroModeIndex
-            INT_32 macroModeIndex = HwlComputeMacroModeIndex(pIn->tileIndex,
-                                                             flags,
-                                                             HwlComputeFmaskBits(pIn, NULL),
-                                                             pIn->numSamples,
-                                                             input.pTileInfo,
-                                                             &input.tileMode);
-
-            // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
-            if (macroModeIndex == TileIndexNoMacroIndex)
-            {
-                returnCode = HwlSetupTileCfg(0, input.tileIndex, macroModeIndex,
-                                             input.pTileInfo, &input.tileMode);
-            }
-
-            ADDR_ASSERT(macroModeIndex != TileIndexInvalid);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            if (pIn->numSamples > 1)
-            {
-                returnCode = HwlComputeFmaskInfo(pIn, pOut);
-            }
-            else
-            {
-                memset(pOut, 0, sizeof(ADDR_COMPUTE_FMASK_INFO_OUTPUT));
-
-                returnCode = ADDR_INVALIDPARAMS;
-            }
-        }
-    }
-
-    ValidBaseAlignments(pOut->baseAlign);
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeFmaskAddrFromCoord
-*
-*   @brief
-*       Interface function stub of ComputeFmaskAddrFromCoord.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeFmaskAddrFromCoord(
-    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_ASSERT(pIn->numSamples > 1);
-
-        if (pIn->numSamples > 1)
-        {
-            returnCode = HwlComputeFmaskAddrFromCoord(pIn, pOut);
-        }
-        else
-        {
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeFmaskCoordFromAddr
-*
-*   @brief
-*       Interface function stub of ComputeFmaskAddrFromCoord.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeFmaskCoordFromAddr(
-    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*  pIn,     ///< [in] input structure
-    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut           ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_ASSERT(pIn->numSamples > 1);
-
-        if (pIn->numSamples > 1)
-        {
-            returnCode = HwlComputeFmaskCoordFromAddr(pIn, pOut);
-        }
-        else
-        {
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ConvertTileInfoToHW
-*
-*   @brief
-*       Convert tile info from real value to HW register value in HW layer
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ConvertTileInfoToHW(
-    const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
-    ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_CONVERT_TILEINFOTOHW_INPUT)) ||
-            (pOut->size != sizeof(ADDR_CONVERT_TILEINFOTOHW_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_CONVERT_TILEINFOTOHW_INPUT input;
-        // if pIn->reverse is TRUE, indices are ignored
-        if (pIn->reverse == FALSE && UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(input.bpp, input.tileIndex,
-                                         input.macroModeIndex, input.pTileInfo);
-
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = HwlConvertTileInfoToHW(pIn, pOut);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ConvertTileIndex
-*
-*   @brief
-*       Convert tile index to tile mode/type/info
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ConvertTileIndex(
-    const ADDR_CONVERT_TILEINDEX_INPUT* pIn, ///< [in] input structure
-    ADDR_CONVERT_TILEINDEX_OUTPUT* pOut      ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_CONVERT_TILEINDEX_INPUT)) ||
-            (pOut->size != sizeof(ADDR_CONVERT_TILEINDEX_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-
-        returnCode = HwlSetupTileCfg(pIn->bpp, pIn->tileIndex, pIn->macroModeIndex,
-                                     pOut->pTileInfo, &pOut->tileMode, &pOut->tileType);
-
-        if (returnCode == ADDR_OK && pIn->tileInfoHw)
-        {
-            ADDR_CONVERT_TILEINFOTOHW_INPUT hwInput = {0};
-            ADDR_CONVERT_TILEINFOTOHW_OUTPUT hwOutput = {0};
-
-            hwInput.pTileInfo = pOut->pTileInfo;
-            hwInput.tileIndex = -1;
-            hwOutput.pTileInfo = pOut->pTileInfo;
-
-            returnCode = HwlConvertTileInfoToHW(&hwInput, &hwOutput);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::GetMacroModeIndex
-*
-*   @brief
-*       Get macro mode index based on input info
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::GetMacroModeIndex(
-    const ADDR_GET_MACROMODEINDEX_INPUT* pIn, ///< [in] input structure
-    ADDR_GET_MACROMODEINDEX_OUTPUT*      pOut ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags())
-    {
-        if ((pIn->size != sizeof(ADDR_GET_MACROMODEINDEX_INPUT)) ||
-            (pOut->size != sizeof(ADDR_GET_MACROMODEINDEX_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfo = {0};
-        pOut->macroModeIndex = HwlComputeMacroModeIndex(pIn->tileIndex, pIn->flags, pIn->bpp,
-                                                        pIn->numFrags, &tileInfo);
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ConvertTileIndex1
-*
-*   @brief
-*       Convert tile index to tile mode/type/info
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ConvertTileIndex1(
-    const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,   ///< [in] input structure
-    ADDR_CONVERT_TILEINDEX_OUTPUT* pOut         ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_CONVERT_TILEINDEX1_INPUT)) ||
-            (pOut->size != sizeof(ADDR_CONVERT_TILEINDEX_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_SURFACE_FLAGS flags = {{0}};
-
-        HwlComputeMacroModeIndex(pIn->tileIndex, flags, pIn->bpp, pIn->numSamples,
-                                 pOut->pTileInfo, &pOut->tileMode, &pOut->tileType);
-
-        if (pIn->tileInfoHw)
-        {
-            ADDR_CONVERT_TILEINFOTOHW_INPUT hwInput = {0};
-            ADDR_CONVERT_TILEINFOTOHW_OUTPUT hwOutput = {0};
-
-            hwInput.pTileInfo = pOut->pTileInfo;
-            hwInput.tileIndex = -1;
-            hwOutput.pTileInfo = pOut->pTileInfo;
-
-            returnCode = HwlConvertTileInfoToHW(&hwInput, &hwOutput);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::GetTileIndex
-*
-*   @brief
-*       Get tile index from tile mode/type/info
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::GetTileIndex(
-    const ADDR_GET_TILEINDEX_INPUT* pIn, ///< [in] input structure
-    ADDR_GET_TILEINDEX_OUTPUT* pOut      ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_GET_TILEINDEX_INPUT)) ||
-            (pOut->size != sizeof(ADDR_GET_TILEINDEX_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        returnCode = HwlGetTileIndex(pIn, pOut);
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::Thickness
-*
-*   @brief
-*       Get tile mode thickness
-*
-*   @return
-*       Tile mode thickness
-****************************************************************************************************
-*/
-UINT_32 Lib::Thickness(
-    AddrTileMode tileMode)    ///< [in] tile mode
-{
-    return ModeFlags[tileMode].thickness;
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               CMASK/HTILE
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   Lib::ComputeHtileInfo
-*
-*   @brief
-*       Interface function stub of AddrComputeHtilenfo
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeHtileInfo(
-    const ADDR_COMPUTE_HTILE_INFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR_COMPUTE_HTILE_INFO_OUTPUT*         pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    BOOL_32 isWidth8  = (pIn->blockWidth == 8) ? TRUE : FALSE;
-    BOOL_32 isHeight8 = (pIn->blockHeight == 8) ? TRUE : FALSE;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_HTILE_INFO_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_HTILE_INFO_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_HTILE_INFO_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            if (pIn->flags.tcCompatible)
-            {
-                const UINT_32 sliceSize = pIn->pitch * pIn->height * 4 / (8 * 8);
-                const UINT_32 align     = HwlGetPipes(pIn->pTileInfo) * pIn->pTileInfo->banks * m_pipeInterleaveBytes;
-
-                if (pIn->numSlices > 1)
-                {
-                    const UINT_32 surfBytes = (sliceSize * pIn->numSlices);
-
-                    pOut->sliceSize        = sliceSize;
-                    pOut->htileBytes       = pIn->flags.skipTcCompatSizeAlign ?
-                                             surfBytes : PowTwoAlign(surfBytes, align);
-                    pOut->sliceInterleaved = ((sliceSize % align) != 0) ? TRUE : FALSE;
-                }
-                else
-                {
-                    pOut->sliceSize        = pIn->flags.skipTcCompatSizeAlign ?
-                                             sliceSize : PowTwoAlign(sliceSize, align);
-                    pOut->htileBytes       = pOut->sliceSize;
-                    pOut->sliceInterleaved = FALSE;
-                }
-
-                pOut->nextMipLevelCompressible = ((sliceSize % align) == 0) ? TRUE : FALSE;
-
-                pOut->pitch       = pIn->pitch;
-                pOut->height      = pIn->height;
-                pOut->baseAlign   = align;
-                pOut->macroWidth  = 0;
-                pOut->macroHeight = 0;
-                pOut->bpp         = 32;
-            }
-            else
-            {
-                pOut->bpp = ComputeHtileInfo(pIn->flags,
-                                             pIn->pitch,
-                                             pIn->height,
-                                             pIn->numSlices,
-                                             pIn->isLinear,
-                                             isWidth8,
-                                             isHeight8,
-                                             pIn->pTileInfo,
-                                             &pOut->pitch,
-                                             &pOut->height,
-                                             &pOut->htileBytes,
-                                             &pOut->macroWidth,
-                                             &pOut->macroHeight,
-                                             &pOut->sliceSize,
-                                             &pOut->baseAlign);
-            }
-        }
-    }
-
-    ValidMetaBaseAlignments(pOut->baseAlign);
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeCmaskInfo
-*
-*   @brief
-*       Interface function stub of AddrComputeCmaskInfo
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeCmaskInfo(
-    const ADDR_COMPUTE_CMASK_INFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR_COMPUTE_CMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_CMASK_INFO_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_CMASK_INFO_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_CMASK_INFO_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            returnCode = ComputeCmaskInfo(pIn->flags,
-                                          pIn->pitch,
-                                          pIn->height,
-                                          pIn->numSlices,
-                                          pIn->isLinear,
-                                          pIn->pTileInfo,
-                                          &pOut->pitch,
-                                          &pOut->height,
-                                          &pOut->cmaskBytes,
-                                          &pOut->macroWidth,
-                                          &pOut->macroHeight,
-                                          &pOut->sliceSize,
-                                          &pOut->baseAlign,
-                                          &pOut->blockMax);
-        }
-    }
-
-    ValidMetaBaseAlignments(pOut->baseAlign);
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeDccInfo
-*
-*   @brief
-*       Interface function to compute DCC key info
-*
-*   @return
-*       return code of HwlComputeDccInfo
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeDccInfo(
-    const ADDR_COMPUTE_DCCINFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR_COMPUTE_DCCINFO_OUTPUT*         pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE ret = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_DCCINFO_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_DCCINFO_OUTPUT)))
-        {
-            ret = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (ret == ADDR_OK)
-    {
-        ADDR_COMPUTE_DCCINFO_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-
-            ret = HwlSetupTileCfg(input.bpp, input.tileIndex, input.macroModeIndex,
-                                  &input.tileInfo, &input.tileMode);
-
-            pIn = &input;
-        }
-
-        if (ret == ADDR_OK)
-        {
-            ret = HwlComputeDccInfo(pIn, pOut);
-
-            ValidMetaBaseAlignments(pOut->dccRamBaseAlign);
-        }
-    }
-
-    return ret;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeHtileAddrFromCoord
-*
-*   @brief
-*       Interface function stub of AddrComputeHtileAddrFromCoord
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeHtileAddrFromCoord(
-    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    BOOL_32 isWidth8  = (pIn->blockWidth == 8) ? TRUE : FALSE;
-    BOOL_32 isHeight8 = (pIn->blockHeight == 8) ? TRUE : FALSE;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            if (pIn->flags.tcCompatible)
-            {
-                HwlComputeHtileAddrFromCoord(pIn, pOut);
-            }
-            else
-            {
-                pOut->addr = HwlComputeXmaskAddrFromCoord(pIn->pitch,
-                                                          pIn->height,
-                                                          pIn->x,
-                                                          pIn->y,
-                                                          pIn->slice,
-                                                          pIn->numSlices,
-                                                          1,
-                                                          pIn->isLinear,
-                                                          isWidth8,
-                                                          isHeight8,
-                                                          pIn->pTileInfo,
-                                                          &pOut->bitPosition);
-            }
-        }
-    }
-
-    return returnCode;
-
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeHtileCoordFromAddr
-*
-*   @brief
-*       Interface function stub of AddrComputeHtileCoordFromAddr
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeHtileCoordFromAddr(
-    const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    BOOL_32 isWidth8  = (pIn->blockWidth == 8) ? TRUE : FALSE;
-    BOOL_32 isHeight8 = (pIn->blockHeight == 8) ? TRUE : FALSE;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            HwlComputeXmaskCoordFromAddr(pIn->addr,
-                                         pIn->bitPosition,
-                                         pIn->pitch,
-                                         pIn->height,
-                                         pIn->numSlices,
-                                         1,
-                                         pIn->isLinear,
-                                         isWidth8,
-                                         isHeight8,
-                                         pIn->pTileInfo,
-                                         &pOut->x,
-                                         &pOut->y,
-                                         &pOut->slice);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeCmaskAddrFromCoord
-*
-*   @brief
-*       Interface function stub of AddrComputeCmaskAddrFromCoord
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeCmaskAddrFromCoord(
-    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            if (pIn->flags.tcCompatible == TRUE)
-            {
-                returnCode = HwlComputeCmaskAddrFromCoord(pIn, pOut);
-            }
-            else
-            {
-                pOut->addr = HwlComputeXmaskAddrFromCoord(pIn->pitch,
-                                                          pIn->height,
-                                                          pIn->x,
-                                                          pIn->y,
-                                                          pIn->slice,
-                                                          pIn->numSlices,
-                                                          2,
-                                                          pIn->isLinear,
-                                                          FALSE, //this is cmask, isWidth8 is not needed
-                                                          FALSE, //this is cmask, isHeight8 is not needed
-                                                          pIn->pTileInfo,
-                                                          &pOut->bitPosition);
-            }
-
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeCmaskCoordFromAddr
-*
-*   @brief
-*       Interface function stub of AddrComputeCmaskCoordFromAddr
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeCmaskCoordFromAddr(
-    const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (GetFillSizeFieldsFlags() == TRUE)
-    {
-        if ((pIn->size != sizeof(ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT)) ||
-            (pOut->size != sizeof(ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT)))
-        {
-            returnCode = ADDR_PARAMSIZEMISMATCH;
-        }
-    }
-
-    if (returnCode == ADDR_OK)
-    {
-        ADDR_TILEINFO tileInfoNull;
-        ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT input;
-
-        if (UseTileIndex(pIn->tileIndex))
-        {
-            input = *pIn;
-            // Use temp tile info for calcalation
-            input.pTileInfo = &tileInfoNull;
-
-            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
-
-            // Change the input structure
-            pIn = &input;
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            HwlComputeXmaskCoordFromAddr(pIn->addr,
-                                         pIn->bitPosition,
-                                         pIn->pitch,
-                                         pIn->height,
-                                         pIn->numSlices,
-                                         2,
-                                         pIn->isLinear,
-                                         FALSE,
-                                         FALSE,
-                                         pIn->pTileInfo,
-                                         &pOut->x,
-                                         &pOut->y,
-                                         &pOut->slice);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeTileDataWidthAndHeight
-*
-*   @brief
-*       Compute the squared cache shape for per-tile data (CMASK and HTILE)
-*
-*   @return
-*       N/A
-*
-*   @note
-*       MacroWidth and macroHeight are measured in pixels
-****************************************************************************************************
-*/
-VOID Lib::ComputeTileDataWidthAndHeight(
-    UINT_32         bpp,             ///< [in] bits per pixel
-    UINT_32         cacheBits,       ///< [in] bits of cache
-    ADDR_TILEINFO*  pTileInfo,       ///< [in] Tile info
-    UINT_32*        pMacroWidth,     ///< [out] macro tile width
-    UINT_32*        pMacroHeight     ///< [out] macro tile height
-    ) const
-{
-    UINT_32 height = 1;
-    UINT_32 width  = cacheBits / bpp;
-    UINT_32 pipes  = HwlGetPipes(pTileInfo);
-
-    // Double height until the macro-tile is close to square
-    // Height can only be doubled if width is even
-
-    while ((width > height * 2 * pipes) && !(width & 1))
-    {
-        width  /= 2;
-        height *= 2;
-    }
-
-    *pMacroWidth  = 8 * width;
-    *pMacroHeight = 8 * height * pipes;
-
-    // Note: The above iterative comptuation is equivalent to the following
-    //
-    //int log2_height = ((log2(cacheBits)-log2(bpp)-log2(pipes))/2);
-    //int macroHeight = pow2( 3+log2(pipes)+log2_height );
-}
-
-/**
-****************************************************************************************************
-*   Lib::HwlComputeTileDataWidthAndHeightLinear
-*
-*   @brief
-*       Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
-*
-*   @return
-*       N/A
-*
-*   @note
-*       MacroWidth and macroHeight are measured in pixels
-****************************************************************************************************
-*/
-VOID Lib::HwlComputeTileDataWidthAndHeightLinear(
-    UINT_32*        pMacroWidth,     ///< [out] macro tile width
-    UINT_32*        pMacroHeight,    ///< [out] macro tile height
-    UINT_32         bpp,             ///< [in] bits per pixel
-    ADDR_TILEINFO*  pTileInfo        ///< [in] tile info
-    ) const
-{
-    ADDR_ASSERT(bpp != 4);              // Cmask does not support linear layout prior to SI
-    *pMacroWidth  = 8 * 512 / bpp;      // Align width to 512-bit memory accesses
-    *pMacroHeight = 8 * m_pipes;        // Align height to number of pipes
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeHtileInfo
-*
-*   @brief
-*       Compute htile pitch,width, bytes per 2D slice
-*
-*   @return
-*       Htile bpp i.e. How many bits for an 8x8 tile
-*       Also returns by output parameters:
-*       *Htile pitch, height, total size in bytes, macro-tile dimensions and slice size*
-****************************************************************************************************
-*/
-UINT_32 Lib::ComputeHtileInfo(
-    ADDR_HTILE_FLAGS flags,             ///< [in] htile flags
-    UINT_32          pitchIn,           ///< [in] pitch input
-    UINT_32          heightIn,          ///< [in] height input
-    UINT_32          numSlices,         ///< [in] number of slices
-    BOOL_32          isLinear,          ///< [in] if it is linear mode
-    BOOL_32          isWidth8,          ///< [in] if htile block width is 8
-    BOOL_32          isHeight8,         ///< [in] if htile block height is 8
-    ADDR_TILEINFO*   pTileInfo,         ///< [in] Tile info
-    UINT_32*         pPitchOut,         ///< [out] pitch output
-    UINT_32*         pHeightOut,        ///< [out] height output
-    UINT_64*         pHtileBytes,       ///< [out] bytes per 2D slice
-    UINT_32*         pMacroWidth,       ///< [out] macro-tile width in pixels
-    UINT_32*         pMacroHeight,      ///< [out] macro-tile width in pixels
-    UINT_64*         pSliceSize,        ///< [out] slice size in bytes
-    UINT_32*         pBaseAlign         ///< [out] base alignment
-    ) const
-{
-
-    UINT_32 macroWidth;
-    UINT_32 macroHeight;
-    UINT_32 baseAlign;
-    UINT_64 surfBytes;
-    UINT_64 sliceBytes;
-
-    numSlices = Max(1u, numSlices);
-
-    const UINT_32 bpp = HwlComputeHtileBpp(isWidth8, isHeight8);
-    const UINT_32 cacheBits = HtileCacheBits;
-
-    if (isLinear)
-    {
-        HwlComputeTileDataWidthAndHeightLinear(&macroWidth,
-                                               &macroHeight,
-                                               bpp,
-                                               pTileInfo);
-    }
-    else
-    {
-        ComputeTileDataWidthAndHeight(bpp,
-                                      cacheBits,
-                                      pTileInfo,
-                                      &macroWidth,
-                                      &macroHeight);
-    }
-
-    *pPitchOut = PowTwoAlign(pitchIn,  macroWidth);
-    *pHeightOut = PowTwoAlign(heightIn,  macroHeight);
-
-    baseAlign = HwlComputeHtileBaseAlign(flags.tcCompatible, isLinear, pTileInfo);
-
-    surfBytes = HwlComputeHtileBytes(*pPitchOut,
-                                     *pHeightOut,
-                                     bpp,
-                                     isLinear,
-                                     numSlices,
-                                     &sliceBytes,
-                                     baseAlign);
-
-    *pHtileBytes = surfBytes;
-
-    //
-    // Use SafeAssign since they are optional
-    //
-    SafeAssign(pMacroWidth, macroWidth);
-
-    SafeAssign(pMacroHeight, macroHeight);
-
-    SafeAssign(pSliceSize,  sliceBytes);
-
-    SafeAssign(pBaseAlign, baseAlign);
-
-    return bpp;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeCmaskBaseAlign
-*
-*   @brief
-*       Compute cmask base alignment
-*
-*   @return
-*       Cmask base alignment
-****************************************************************************************************
-*/
-UINT_32 Lib::ComputeCmaskBaseAlign(
-    ADDR_CMASK_FLAGS flags,           ///< [in] Cmask flags
-    ADDR_TILEINFO*   pTileInfo        ///< [in] Tile info
-    ) const
-{
-    UINT_32 baseAlign = m_pipeInterleaveBytes * HwlGetPipes(pTileInfo);
-
-    if (flags.tcCompatible)
-    {
-        ADDR_ASSERT(pTileInfo != NULL);
-        if (pTileInfo)
-        {
-            baseAlign *= pTileInfo->banks;
-        }
-    }
-
-    return baseAlign;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeCmaskBytes
-*
-*   @brief
-*       Compute cmask size in bytes
-*
-*   @return
-*       Cmask size in bytes
-****************************************************************************************************
-*/
-UINT_64 Lib::ComputeCmaskBytes(
-    UINT_32 pitch,        ///< [in] pitch
-    UINT_32 height,       ///< [in] height
-    UINT_32 numSlices     ///< [in] number of slices
-    ) const
-{
-    return BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * numSlices * CmaskElemBits) /
-        MicroTilePixels;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeCmaskInfo
-*
-*   @brief
-*       Compute cmask pitch,width, bytes per 2D slice
-*
-*   @return
-*       BlockMax. Also by output parameters: Cmask pitch,height, total size in bytes,
-*       macro-tile dimensions
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeCmaskInfo(
-    ADDR_CMASK_FLAGS flags,            ///< [in] cmask flags
-    UINT_32          pitchIn,           ///< [in] pitch input
-    UINT_32          heightIn,          ///< [in] height input
-    UINT_32          numSlices,         ///< [in] number of slices
-    BOOL_32          isLinear,          ///< [in] is linear mode
-    ADDR_TILEINFO*   pTileInfo,         ///< [in] Tile info
-    UINT_32*         pPitchOut,         ///< [out] pitch output
-    UINT_32*         pHeightOut,        ///< [out] height output
-    UINT_64*         pCmaskBytes,       ///< [out] bytes per 2D slice
-    UINT_32*         pMacroWidth,       ///< [out] macro-tile width in pixels
-    UINT_32*         pMacroHeight,      ///< [out] macro-tile width in pixels
-    UINT_64*         pSliceSize,        ///< [out] slice size in bytes
-    UINT_32*         pBaseAlign,        ///< [out] base alignment
-    UINT_32*         pBlockMax          ///< [out] block max == slice / 128 / 128 - 1
-    ) const
-{
-    UINT_32 macroWidth;
-    UINT_32 macroHeight;
-    UINT_32 baseAlign;
-    UINT_64 surfBytes;
-    UINT_64 sliceBytes;
-
-    numSlices = Max(1u, numSlices);
-
-    const UINT_32 bpp = CmaskElemBits;
-    const UINT_32 cacheBits = CmaskCacheBits;
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (isLinear)
-    {
-        HwlComputeTileDataWidthAndHeightLinear(&macroWidth,
-                                               &macroHeight,
-                                               bpp,
-                                               pTileInfo);
-    }
-    else
-    {
-        ComputeTileDataWidthAndHeight(bpp,
-                                      cacheBits,
-                                      pTileInfo,
-                                      &macroWidth,
-                                      &macroHeight);
-    }
-
-    *pPitchOut = (pitchIn + macroWidth - 1) & ~(macroWidth - 1);
-    *pHeightOut = (heightIn + macroHeight - 1) & ~(macroHeight - 1);
-
-
-    sliceBytes = ComputeCmaskBytes(*pPitchOut,
-                                   *pHeightOut,
-                                   1);
-
-    baseAlign = ComputeCmaskBaseAlign(flags, pTileInfo);
-
-    while (sliceBytes % baseAlign)
-    {
-        *pHeightOut += macroHeight;
-
-        sliceBytes = ComputeCmaskBytes(*pPitchOut,
-                                       *pHeightOut,
-                                       1);
-    }
-
-    surfBytes = sliceBytes * numSlices;
-
-    *pCmaskBytes = surfBytes;
-
-    //
-    // Use SafeAssign since they are optional
-    //
-    SafeAssign(pMacroWidth, macroWidth);
-
-    SafeAssign(pMacroHeight, macroHeight);
-
-    SafeAssign(pBaseAlign, baseAlign);
-
-    SafeAssign(pSliceSize, sliceBytes);
-
-    UINT_32 slice = (*pPitchOut) * (*pHeightOut);
-    UINT_32 blockMax = slice / 128 / 128 - 1;
-
-#if DEBUG
-    if (slice % (64*256) != 0)
-    {
-        ADDR_ASSERT_ALWAYS();
-    }
-#endif //DEBUG
-
-    UINT_32 maxBlockMax = HwlGetMaxCmaskBlockMax();
-
-    if (blockMax > maxBlockMax)
-    {
-        blockMax = maxBlockMax;
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    SafeAssign(pBlockMax, blockMax);
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeXmaskCoordYFromPipe
-*
-*   @brief
-*       Compute the Y coord from pipe number for cmask/htile
-*
-*   @return
-*       Y coordinate
-*
-****************************************************************************************************
-*/
-UINT_32 Lib::ComputeXmaskCoordYFromPipe(
-    UINT_32         pipe,       ///< [in] pipe number
-    UINT_32         x           ///< [in] x coordinate
-    ) const
-{
-    UINT_32 pipeBit0;
-    UINT_32 pipeBit1;
-    UINT_32 xBit0;
-    UINT_32 xBit1;
-    UINT_32 yBit0;
-    UINT_32 yBit1;
-
-    UINT_32 y = 0;
-
-    UINT_32 numPipes = m_pipes; // SI has its implementation
-    //
-    // Convert pipe + x to y coordinate.
-    //
-    switch (numPipes)
-    {
-        case 1:
-            //
-            // 1 pipe
-            //
-            // p0 = 0
-            //
-            y = 0;
-            break;
-        case 2:
-            //
-            // 2 pipes
-            //
-            // p0 = x0 ^ y0
-            //
-            // y0 = p0 ^ x0
-            //
-            pipeBit0 = pipe & 0x1;
-
-            xBit0 = x & 0x1;
-
-            yBit0 = pipeBit0 ^ xBit0;
-
-            y = yBit0;
-            break;
-        case 4:
-            //
-            // 4 pipes
-            //
-            // p0 = x1 ^ y0
-            // p1 = x0 ^ y1
-            //
-            // y0 = p0 ^ x1
-            // y1 = p1 ^ x0
-            //
-            pipeBit0 =  pipe & 0x1;
-            pipeBit1 = (pipe & 0x2) >> 1;
-
-            xBit0 =  x & 0x1;
-            xBit1 = (x & 0x2) >> 1;
-
-            yBit0 = pipeBit0 ^ xBit1;
-            yBit1 = pipeBit1 ^ xBit0;
-
-            y = (yBit0 |
-                 (yBit1 << 1));
-            break;
-        case 8:
-            //
-            // 8 pipes
-            //
-            // r600 and r800 have different method
-            //
-            y = HwlComputeXmaskCoordYFrom8Pipe(pipe, x);
-            break;
-        default:
-            break;
-    }
-    return y;
-}
-
-/**
-****************************************************************************************************
-*   Lib::HwlComputeXmaskCoordFromAddr
-*
-*   @brief
-*       Compute the coord from an address of a cmask/htile
-*
-*   @return
-*       N/A
-*
-*   @note
-*       This method is reused by htile, so rename to Xmask
-****************************************************************************************************
-*/
-VOID Lib::HwlComputeXmaskCoordFromAddr(
-    UINT_64         addr,           ///< [in] address
-    UINT_32         bitPosition,    ///< [in] bitPosition in a byte
-    UINT_32         pitch,          ///< [in] pitch
-    UINT_32         height,         ///< [in] height
-    UINT_32         numSlices,      ///< [in] number of slices
-    UINT_32         factor,         ///< [in] factor that indicates cmask or htile
-    BOOL_32         isLinear,       ///< [in] linear or tiled HTILE layout
-    BOOL_32         isWidth8,       ///< [in] TRUE if width is 8, FALSE means 4. It's register value
-    BOOL_32         isHeight8,      ///< [in] TRUE if width is 8, FALSE means 4. It's register value
-    ADDR_TILEINFO*  pTileInfo,      ///< [in] Tile info
-    UINT_32*        pX,             ///< [out] x coord
-    UINT_32*        pY,             ///< [out] y coord
-    UINT_32*        pSlice          ///< [out] slice index
-    ) const
-{
-    UINT_32 pipe;
-    UINT_32 numPipes;
-    UINT_32 numGroupBits;
-    (void)numGroupBits;
-    UINT_32 numPipeBits;
-    UINT_32 macroTilePitch;
-    UINT_32 macroTileHeight;
-
-    UINT_64 bitAddr;
-
-    UINT_32 microTileCoordY;
-
-    UINT_32 elemBits;
-
-    UINT_32 pitchAligned = pitch;
-    UINT_32 heightAligned = height;
-    UINT_64 totalBytes;
-
-    UINT_64 elemOffset;
-
-    UINT_64 macroIndex;
-    UINT_32 microIndex;
-
-    UINT_64 macroNumber;
-    UINT_32 microNumber;
-
-    UINT_32 macroX;
-    UINT_32 macroY;
-    UINT_32 macroZ;
-
-    UINT_32 microX;
-    UINT_32 microY;
-
-    UINT_32 tilesPerMacro;
-    UINT_32 macrosPerPitch;
-    UINT_32 macrosPerSlice;
-
-    //
-    // Extract pipe.
-    //
-    numPipes = HwlGetPipes(pTileInfo);
-    pipe = ComputePipeFromAddr(addr, numPipes);
-
-    //
-    // Compute the number of group and pipe bits.
-    //
-    numGroupBits = Log2(m_pipeInterleaveBytes);
-    numPipeBits  = Log2(numPipes);
-
-    UINT_32 groupBits = 8 * m_pipeInterleaveBytes;
-    UINT_32 pipes = numPipes;
-
-
-    //
-    // Compute the micro tile size, in bits. And macro tile pitch and height.
-    //
-    if (factor == 2) //CMASK
-    {
-        ADDR_CMASK_FLAGS flags = {{0}};
-
-        elemBits = CmaskElemBits;
-
-        ComputeCmaskInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         pTileInfo,
-                         &pitchAligned,
-                         &heightAligned,
-                         &totalBytes,
-                         &macroTilePitch,
-                         &macroTileHeight);
-    }
-    else  //HTILE
-    {
-        ADDR_HTILE_FLAGS flags = {{0}};
-
-        if (factor != 1)
-        {
-            factor = 1;
-        }
-
-        elemBits = HwlComputeHtileBpp(isWidth8, isHeight8);
-
-        ComputeHtileInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         isWidth8,
-                         isHeight8,
-                         pTileInfo,
-                         &pitchAligned,
-                         &heightAligned,
-                         &totalBytes,
-                         &macroTilePitch,
-                         &macroTileHeight);
-    }
-
-    // Should use aligned dims
-    //
-    pitch = pitchAligned;
-    height = heightAligned;
-
-
-    //
-    // Convert byte address to bit address.
-    //
-    bitAddr = BYTES_TO_BITS(addr) + bitPosition;
-
-
-    //
-    // Remove pipe bits from address.
-    //
-
-    bitAddr = (bitAddr % groupBits) + ((bitAddr/groupBits/pipes)*groupBits);
-
-
-    elemOffset = bitAddr / elemBits;
-
-    tilesPerMacro = (macroTilePitch/factor) * macroTileHeight / MicroTilePixels >> numPipeBits;
-
-    macrosPerPitch = pitch / (macroTilePitch/factor);
-    macrosPerSlice = macrosPerPitch * height / macroTileHeight;
-
-    macroIndex = elemOffset / factor / tilesPerMacro;
-    microIndex = static_cast<UINT_32>(elemOffset % (tilesPerMacro * factor));
-
-    macroNumber = macroIndex * factor + microIndex % factor;
-    microNumber = microIndex / factor;
-
-    macroX = static_cast<UINT_32>((macroNumber % macrosPerPitch));
-    macroY = static_cast<UINT_32>((macroNumber % macrosPerSlice) / macrosPerPitch);
-    macroZ = static_cast<UINT_32>((macroNumber / macrosPerSlice));
-
-
-    microX = microNumber % (macroTilePitch / factor / MicroTileWidth);
-    microY = (microNumber / (macroTilePitch / factor / MicroTileHeight));
-
-    *pX = macroX * (macroTilePitch/factor) + microX * MicroTileWidth;
-    *pY = macroY * macroTileHeight + (microY * MicroTileHeight << numPipeBits);
-    *pSlice = macroZ;
-
-    microTileCoordY = ComputeXmaskCoordYFromPipe(pipe,
-                                                 *pX/MicroTileWidth);
-
-
-    //
-    // Assemble final coordinates.
-    //
-    *pY += microTileCoordY * MicroTileHeight;
-
-}
-
-/**
-****************************************************************************************************
-*   Lib::HwlComputeXmaskAddrFromCoord
-*
-*   @brief
-*       Compute the address from an address of cmask (prior to si)
-*
-*   @return
-*       Address in bytes
-*
-****************************************************************************************************
-*/
-UINT_64 Lib::HwlComputeXmaskAddrFromCoord(
-    UINT_32        pitch,          ///< [in] pitch
-    UINT_32        height,         ///< [in] height
-    UINT_32        x,              ///< [in] x coord
-    UINT_32        y,              ///< [in] y coord
-    UINT_32        slice,          ///< [in] slice/depth index
-    UINT_32        numSlices,      ///< [in] number of slices
-    UINT_32        factor,         ///< [in] factor that indicates cmask(2) or htile(1)
-    BOOL_32        isLinear,       ///< [in] linear or tiled HTILE layout
-    BOOL_32        isWidth8,       ///< [in] TRUE if width is 8, FALSE means 4. It's register value
-    BOOL_32        isHeight8,      ///< [in] TRUE if width is 8, FALSE means 4. It's register value
-    ADDR_TILEINFO* pTileInfo,      ///< [in] Tile info
-    UINT_32*       pBitPosition    ///< [out] bit position inside a byte
-    ) const
-{
-    UINT_64 addr;
-    UINT_32 numGroupBits;
-    UINT_32 numPipeBits;
-    UINT_32 newPitch = 0;
-    UINT_32 newHeight = 0;
-    UINT_64 sliceBytes = 0;
-    UINT_64 totalBytes = 0;
-    UINT_64 sliceOffset;
-    UINT_32 pipe;
-    UINT_32 macroTileWidth;
-    UINT_32 macroTileHeight;
-    UINT_32 macroTilesPerRow;
-    UINT_32 macroTileBytes;
-    UINT_32 macroTileIndexX;
-    UINT_32 macroTileIndexY;
-    UINT_64 macroTileOffset;
-    UINT_32 pixelBytesPerRow;
-    UINT_32 pixelOffsetX;
-    UINT_32 pixelOffsetY;
-    UINT_32 pixelOffset;
-    UINT_64 totalOffset;
-    UINT_64 offsetLo;
-    UINT_64 offsetHi;
-    UINT_64 groupMask;
-
-
-    UINT_32 elemBits = 0;
-
-    UINT_32 numPipes = m_pipes; // This function is accessed prior to si only
-
-    if (factor == 2) //CMASK
-    {
-        elemBits = CmaskElemBits;
-
-        // For asics before SI, cmask is always tiled
-        isLinear = FALSE;
-    }
-    else //HTILE
-    {
-        if (factor != 1) // Fix compile warning
-        {
-            factor = 1;
-        }
-
-        elemBits = HwlComputeHtileBpp(isWidth8, isHeight8);
-    }
-
-    //
-    // Compute the number of group bits and pipe bits.
-    //
-    numGroupBits = Log2(m_pipeInterleaveBytes);
-    numPipeBits  = Log2(numPipes);
-
-    //
-    // Compute macro tile dimensions.
-    //
-    if (factor == 2) // CMASK
-    {
-        ADDR_CMASK_FLAGS flags = {{0}};
-
-        ComputeCmaskInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         pTileInfo,
-                         &newPitch,
-                         &newHeight,
-                         &totalBytes,
-                         &macroTileWidth,
-                         &macroTileHeight);
-
-        sliceBytes = totalBytes / numSlices;
-    }
-    else // HTILE
-    {
-        ADDR_HTILE_FLAGS flags = {{0}};
-
-        ComputeHtileInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         isWidth8,
-                         isHeight8,
-                         pTileInfo,
-                         &newPitch,
-                         &newHeight,
-                         &totalBytes,
-                         &macroTileWidth,
-                         &macroTileHeight,
-                         &sliceBytes);
-    }
-
-    sliceOffset = slice * sliceBytes;
-
-    //
-    // Get the pipe.  Note that neither slice rotation nor pipe swizzling apply for CMASK.
-    //
-    pipe = ComputePipeFromCoord(x,
-                                y,
-                                0,
-                                ADDR_TM_2D_TILED_THIN1,
-                                0,
-                                FALSE,
-                                pTileInfo);
-
-    //
-    // Compute the number of macro tiles per row.
-    //
-    macroTilesPerRow = newPitch / macroTileWidth;
-
-    //
-    // Compute the number of bytes per macro tile.
-    //
-    macroTileBytes = BITS_TO_BYTES((macroTileWidth * macroTileHeight * elemBits) / MicroTilePixels);
-
-    //
-    // Compute the offset to the macro tile containing the specified coordinate.
-    //
-    macroTileIndexX = x / macroTileWidth;
-    macroTileIndexY = y / macroTileHeight;
-    macroTileOffset = ((macroTileIndexY * macroTilesPerRow) + macroTileIndexX) * macroTileBytes;
-
-    //
-    // Compute the pixel offset within the macro tile.
-    //
-    pixelBytesPerRow = BITS_TO_BYTES(macroTileWidth * elemBits) / MicroTileWidth;
-
-    //
-    // The nibbles are interleaved (see below), so the part of the offset relative to the x
-    // coordinate repeats halfway across the row. (Not for HTILE)
-    //
-    if (factor == 2)
-    {
-        pixelOffsetX = (x % (macroTileWidth / 2)) / MicroTileWidth;
-    }
-    else
-    {
-        pixelOffsetX = (x % (macroTileWidth)) / MicroTileWidth * BITS_TO_BYTES(elemBits);
-    }
-
-    //
-    // Compute the y offset within the macro tile.
-    //
-    pixelOffsetY = (((y % macroTileHeight) / MicroTileHeight) / numPipes) * pixelBytesPerRow;
-
-    pixelOffset = pixelOffsetX + pixelOffsetY;
-
-    //
-    // Combine the slice offset and macro tile offset with the pixel offset, accounting for the
-    // pipe bits in the middle of the address.
-    //
-    totalOffset = ((sliceOffset + macroTileOffset) >> numPipeBits) + pixelOffset;
-
-    //
-    // Split the offset to put some bits below the pipe bits and some above.
-    //
-    groupMask = (1 << numGroupBits) - 1;
-    offsetLo  = totalOffset &  groupMask;
-    offsetHi  = (totalOffset & ~groupMask) << numPipeBits;
-
-    //
-    // Assemble the address from its components.
-    //
-    addr  = offsetLo;
-    addr |= offsetHi;
-    // This is to remove warning with /analyze option
-    UINT_32 pipeBits = pipe << numGroupBits;
-    addr |= pipeBits;
-
-    //
-    // Compute the bit position.  The lower nibble is used when the x coordinate within the macro
-    // tile is less than half of the macro tile width, and the upper nibble is used when the x
-    // coordinate within the macro tile is greater than or equal to half the macro tile width.
-    //
-    *pBitPosition = ((x % macroTileWidth) < (macroTileWidth / factor)) ? 0 : 4;
-
-    return addr;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Surface Addressing Shared
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
-****************************************************************************************************
-*   Lib::ComputeSurfaceAddrFromCoordLinear
-*
-*   @brief
-*       Compute address from coord for linear surface
-*
-*   @return
-*       Address in bytes
-*
-****************************************************************************************************
-*/
-UINT_64 Lib::ComputeSurfaceAddrFromCoordLinear(
-    UINT_32  x,              ///< [in] x coord
-    UINT_32  y,              ///< [in] y coord
-    UINT_32  slice,          ///< [in] slice/depth index
-    UINT_32  sample,         ///< [in] sample index
-    UINT_32  bpp,            ///< [in] bits per pixel
-    UINT_32  pitch,          ///< [in] pitch
-    UINT_32  height,         ///< [in] height
-    UINT_32  numSlices,      ///< [in] number of slices
-    UINT_32* pBitPosition    ///< [out] bit position inside a byte
-    ) const
-{
-    const UINT_64 sliceSize = static_cast<UINT_64>(pitch) * height;
-
-    UINT_64 sliceOffset = (slice + sample * numSlices)* sliceSize;
-    UINT_64 rowOffset   = static_cast<UINT_64>(y) * pitch;
-    UINT_64 pixOffset   = x;
-
-    UINT_64 addr = (sliceOffset + rowOffset + pixOffset) * bpp;
-
-    *pBitPosition = static_cast<UINT_32>(addr % 8);
-    addr /= 8;
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeSurfaceCoordFromAddrLinear
-*
-*   @brief
-*       Compute the coord from an address of a linear surface
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID Lib::ComputeSurfaceCoordFromAddrLinear(
-    UINT_64  addr,           ///< [in] address
-    UINT_32  bitPosition,    ///< [in] bitPosition in a byte
-    UINT_32  bpp,            ///< [in] bits per pixel
-    UINT_32  pitch,          ///< [in] pitch
-    UINT_32  height,         ///< [in] height
-    UINT_32  numSlices,      ///< [in] number of slices
-    UINT_32* pX,             ///< [out] x coord
-    UINT_32* pY,             ///< [out] y coord
-    UINT_32* pSlice,         ///< [out] slice/depth index
-    UINT_32* pSample         ///< [out] sample index
-    ) const
-{
-    const UINT_64 sliceSize = static_cast<UINT_64>(pitch) * height;
-    const UINT_64 linearOffset = (BYTES_TO_BITS(addr) + bitPosition) / bpp;
-
-    *pX = static_cast<UINT_32>((linearOffset % sliceSize) % pitch);
-    *pY = static_cast<UINT_32>((linearOffset % sliceSize) / pitch % height);
-    *pSlice  = static_cast<UINT_32>((linearOffset / sliceSize) % numSlices);
-    *pSample = static_cast<UINT_32>((linearOffset / sliceSize) / numSlices);
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeSurfaceCoordFromAddrMicroTiled
-*
-*   @brief
-*       Compute the coord from an address of a micro tiled surface
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID Lib::ComputeSurfaceCoordFromAddrMicroTiled(
-    UINT_64         addr,               ///< [in] address
-    UINT_32         bitPosition,        ///< [in] bitPosition in a byte
-    UINT_32         bpp,                ///< [in] bits per pixel
-    UINT_32         pitch,              ///< [in] pitch
-    UINT_32         height,             ///< [in] height
-    UINT_32         numSamples,         ///< [in] number of samples
-    AddrTileMode    tileMode,           ///< [in] tile mode
-    UINT_32         tileBase,           ///< [in] base offset within a tile
-    UINT_32         compBits,           ///< [in] component bits actually needed(for planar surface)
-    UINT_32*        pX,                 ///< [out] x coord
-    UINT_32*        pY,                 ///< [out] y coord
-    UINT_32*        pSlice,             ///< [out] slice/depth index
-    UINT_32*        pSample,            ///< [out] sample index,
-    AddrTileType    microTileType,      ///< [in] micro tiling order
-    BOOL_32         isDepthSampleOrder  ///< [in] TRUE if in depth sample order
-    ) const
-{
-    UINT_64 bitAddr;
-    UINT_32 microTileThickness;
-    UINT_32 microTileBits;
-    UINT_64 sliceBits;
-    UINT_64 rowBits;
-    UINT_32 sliceIndex;
-    UINT_32 microTileCoordX;
-    UINT_32 microTileCoordY;
-    UINT_32 pixelOffset;
-    UINT_32 pixelCoordX = 0;
-    UINT_32 pixelCoordY = 0;
-    UINT_32 pixelCoordZ = 0;
-    UINT_32 pixelCoordS = 0;
-
-    //
-    // Convert byte address to bit address.
-    //
-    bitAddr = BYTES_TO_BITS(addr) + bitPosition;
-
-    //
-    // Compute the micro tile size, in bits.
-    //
-    switch (tileMode)
-    {
-        case ADDR_TM_1D_TILED_THICK:
-            microTileThickness = ThickTileThickness;
-            break;
-        default:
-            microTileThickness = 1;
-            break;
-    }
-
-    microTileBits = MicroTilePixels * microTileThickness * bpp * numSamples;
-
-    //
-    // Compute number of bits per slice and number of bits per row of micro tiles.
-    //
-    sliceBits = static_cast<UINT_64>(pitch) * height * microTileThickness * bpp * numSamples;
-
-    rowBits   = (pitch / MicroTileWidth) * microTileBits;
-
-    //
-    // Extract the slice index.
-    //
-    sliceIndex = static_cast<UINT_32>(bitAddr / sliceBits);
-    bitAddr -= sliceIndex * sliceBits;
-
-    //
-    // Extract the y coordinate of the micro tile.
-    //
-    microTileCoordY = static_cast<UINT_32>(bitAddr / rowBits) * MicroTileHeight;
-    bitAddr -= (microTileCoordY / MicroTileHeight) * rowBits;
-
-    //
-    // Extract the x coordinate of the micro tile.
-    //
-    microTileCoordX = static_cast<UINT_32>(bitAddr / microTileBits) * MicroTileWidth;
-
-    //
-    // Compute the pixel offset within the micro tile.
-    //
-    pixelOffset = static_cast<UINT_32>(bitAddr % microTileBits);
-
-    //
-    // Extract pixel coordinates from the offset.
-    //
-    HwlComputePixelCoordFromOffset(pixelOffset,
-                                   bpp,
-                                   numSamples,
-                                   tileMode,
-                                   tileBase,
-                                   compBits,
-                                   &pixelCoordX,
-                                   &pixelCoordY,
-                                   &pixelCoordZ,
-                                   &pixelCoordS,
-                                   microTileType,
-                                   isDepthSampleOrder);
-
-    //
-    // Assemble final coordinates.
-    //
-    *pX     = microTileCoordX + pixelCoordX;
-    *pY     = microTileCoordY + pixelCoordY;
-    *pSlice = (sliceIndex * microTileThickness) + pixelCoordZ;
-    *pSample = pixelCoordS;
-
-    if (microTileThickness > 1)
-    {
-        *pSample = 0;
-    }
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputePipeFromAddr
-*
-*   @brief
-*       Compute the pipe number from an address
-*
-*   @return
-*       Pipe number
-*
-****************************************************************************************************
-*/
-UINT_32 Lib::ComputePipeFromAddr(
-    UINT_64 addr,        ///< [in] address
-    UINT_32 numPipes     ///< [in] number of banks
-    ) const
-{
-    UINT_32 pipe;
-
-    UINT_32 groupBytes = m_pipeInterleaveBytes; //just different terms
-
-    // R600
-    // The LSBs of the address are arranged as follows:
-    //   bank | pipe | group
-    //
-    // To get the pipe number, shift off the group bits and mask the pipe bits.
-    //
-
-    // R800
-    // The LSBs of the address are arranged as follows:
-    //   bank | bankInterleave | pipe | pipeInterleave
-    //
-    // To get the pipe number, shift off the pipe interleave bits and mask the pipe bits.
-    //
-
-    pipe = static_cast<UINT_32>(addr >> Log2(groupBytes)) & (numPipes - 1);
-
-    return pipe;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeMicroTileEquation
-*
-*   @brief
-*       Compute micro tile equation
-*
-*   @return
-*       If equation can be computed
-*
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeMicroTileEquation(
-    UINT_32         log2BytesPP,    ///< [in] log2 of bytes per pixel
-    AddrTileMode    tileMode,       ///< [in] tile mode
-    AddrTileType    microTileType,  ///< [in] pixel order in display/non-display mode
-    ADDR_EQUATION*  pEquation       ///< [out] equation
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    for (UINT_32 i = 0; i < log2BytesPP; i++)
-    {
-        pEquation->addr[i].valid = 1;
-        pEquation->addr[i].channel = 0;
-        pEquation->addr[i].index = i;
-    }
-
-    ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[log2BytesPP];
-
-    ADDR_CHANNEL_SETTING x0 = InitChannel(1, 0, log2BytesPP + 0);
-    ADDR_CHANNEL_SETTING x1 = InitChannel(1, 0, log2BytesPP + 1);
-    ADDR_CHANNEL_SETTING x2 = InitChannel(1, 0, log2BytesPP + 2);
-    ADDR_CHANNEL_SETTING y0 = InitChannel(1, 1, 0);
-    ADDR_CHANNEL_SETTING y1 = InitChannel(1, 1, 1);
-    ADDR_CHANNEL_SETTING y2 = InitChannel(1, 1, 2);
-    ADDR_CHANNEL_SETTING z0 = InitChannel(1, 2, 0);
-    ADDR_CHANNEL_SETTING z1 = InitChannel(1, 2, 1);
-    ADDR_CHANNEL_SETTING z2 = InitChannel(1, 2, 2);
-
-    UINT_32 thickness = Thickness(tileMode);
-    UINT_32 bpp = 1 << (log2BytesPP + 3);
-
-    if (microTileType != ADDR_THICK)
-    {
-        if (microTileType == ADDR_DISPLAYABLE)
-        {
-            switch (bpp)
-            {
-                case 8:
-                    pixelBit[0] = x0;
-                    pixelBit[1] = x1;
-                    pixelBit[2] = x2;
-                    pixelBit[3] = y1;
-                    pixelBit[4] = y0;
-                    pixelBit[5] = y2;
-                    break;
-                case 16:
-                    pixelBit[0] = x0;
-                    pixelBit[1] = x1;
-                    pixelBit[2] = x2;
-                    pixelBit[3] = y0;
-                    pixelBit[4] = y1;
-                    pixelBit[5] = y2;
-                    break;
-                case 32:
-                    pixelBit[0] = x0;
-                    pixelBit[1] = x1;
-                    pixelBit[2] = y0;
-                    pixelBit[3] = x2;
-                    pixelBit[4] = y1;
-                    pixelBit[5] = y2;
-                    break;
-                case 64:
-                    pixelBit[0] = x0;
-                    pixelBit[1] = y0;
-                    pixelBit[2] = x1;
-                    pixelBit[3] = x2;
-                    pixelBit[4] = y1;
-                    pixelBit[5] = y2;
-                    break;
-                case 128:
-                    pixelBit[0] = y0;
-                    pixelBit[1] = x0;
-                    pixelBit[2] = x1;
-                    pixelBit[3] = x2;
-                    pixelBit[4] = y1;
-                    pixelBit[5] = y2;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    break;
-            }
-        }
-        else if (microTileType == ADDR_NON_DISPLAYABLE || microTileType == ADDR_DEPTH_SAMPLE_ORDER)
-        {
-            pixelBit[0] = x0;
-            pixelBit[1] = y0;
-            pixelBit[2] = x1;
-            pixelBit[3] = y1;
-            pixelBit[4] = x2;
-            pixelBit[5] = y2;
-        }
-        else if (microTileType == ADDR_ROTATED)
-        {
-            ADDR_ASSERT(thickness == 1);
-
-            switch (bpp)
-            {
-                case 8:
-                    pixelBit[0] = y0;
-                    pixelBit[1] = y1;
-                    pixelBit[2] = y2;
-                    pixelBit[3] = x1;
-                    pixelBit[4] = x0;
-                    pixelBit[5] = x2;
-                    break;
-                case 16:
-                    pixelBit[0] = y0;
-                    pixelBit[1] = y1;
-                    pixelBit[2] = y2;
-                    pixelBit[3] = x0;
-                    pixelBit[4] = x1;
-                    pixelBit[5] = x2;
-                    break;
-                case 32:
-                    pixelBit[0] = y0;
-                    pixelBit[1] = y1;
-                    pixelBit[2] = x0;
-                    pixelBit[3] = y2;
-                    pixelBit[4] = x1;
-                    pixelBit[5] = x2;
-                    break;
-                case 64:
-                    pixelBit[0] = y0;
-                    pixelBit[1] = x0;
-                    pixelBit[2] = y1;
-                    pixelBit[3] = x1;
-                    pixelBit[4] = x2;
-                    pixelBit[5] = y2;
-                    break;
-                default:
-                    retCode = ADDR_NOTSUPPORTED;
-                    break;
-            }
-        }
-
-        if (thickness > 1)
-        {
-            pixelBit[6] = z0;
-            pixelBit[7] = z1;
-            pEquation->numBits = 8 + log2BytesPP;
-        }
-        else
-        {
-            pEquation->numBits = 6 + log2BytesPP;
-        }
-    }
-    else // ADDR_THICK
-    {
-        ADDR_ASSERT(thickness > 1);
-
-        switch (bpp)
-        {
-            case 8:
-            case 16:
-                pixelBit[0] = x0;
-                pixelBit[1] = y0;
-                pixelBit[2] = x1;
-                pixelBit[3] = y1;
-                pixelBit[4] = z0;
-                pixelBit[5] = z1;
-                break;
-            case 32:
-                pixelBit[0] = x0;
-                pixelBit[1] = y0;
-                pixelBit[2] = x1;
-                pixelBit[3] = z0;
-                pixelBit[4] = y1;
-                pixelBit[5] = z1;
-                break;
-            case 64:
-            case 128:
-                pixelBit[0] = x0;
-                pixelBit[1] = y0;
-                pixelBit[2] = z0;
-                pixelBit[3] = x1;
-                pixelBit[4] = y1;
-                pixelBit[5] = z1;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        pixelBit[6] = x2;
-        pixelBit[7] = y2;
-        pEquation->numBits = 8 + log2BytesPP;
-    }
-
-    if (thickness == 8)
-    {
-        pixelBit[8] = z2;
-        pEquation->numBits = 9 + log2BytesPP;
-    }
-
-    // stackedDepthSlices is used for addressing mode that a tile block contains multiple slices,
-    // which is not supported by our address lib
-    pEquation->stackedDepthSlices = FALSE;
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputePixelIndexWithinMicroTile
-*
-*   @brief
-*       Compute the pixel index inside a micro tile of surface
-*
-*   @return
-*       Pixel index
-*
-****************************************************************************************************
-*/
-UINT_32 Lib::ComputePixelIndexWithinMicroTile(
-    UINT_32         x,              ///< [in] x coord
-    UINT_32         y,              ///< [in] y coord
-    UINT_32         z,              ///< [in] slice/depth index
-    UINT_32         bpp,            ///< [in] bits per pixel
-    AddrTileMode    tileMode,       ///< [in] tile mode
-    AddrTileType    microTileType   ///< [in] pixel order in display/non-display mode
-    ) const
-{
-    UINT_32 pixelBit0 = 0;
-    UINT_32 pixelBit1 = 0;
-    UINT_32 pixelBit2 = 0;
-    UINT_32 pixelBit3 = 0;
-    UINT_32 pixelBit4 = 0;
-    UINT_32 pixelBit5 = 0;
-    UINT_32 pixelBit6 = 0;
-    UINT_32 pixelBit7 = 0;
-    UINT_32 pixelBit8 = 0;
-    UINT_32 pixelNumber;
-
-    UINT_32 x0 = _BIT(x, 0);
-    UINT_32 x1 = _BIT(x, 1);
-    UINT_32 x2 = _BIT(x, 2);
-    UINT_32 y0 = _BIT(y, 0);
-    UINT_32 y1 = _BIT(y, 1);
-    UINT_32 y2 = _BIT(y, 2);
-    UINT_32 z0 = _BIT(z, 0);
-    UINT_32 z1 = _BIT(z, 1);
-    UINT_32 z2 = _BIT(z, 2);
-
-    UINT_32 thickness = Thickness(tileMode);
-
-    // Compute the pixel number within the micro tile.
-
-    if (microTileType != ADDR_THICK)
-    {
-        if (microTileType == ADDR_DISPLAYABLE)
-        {
-            switch (bpp)
-            {
-                case 8:
-                    pixelBit0 = x0;
-                    pixelBit1 = x1;
-                    pixelBit2 = x2;
-                    pixelBit3 = y1;
-                    pixelBit4 = y0;
-                    pixelBit5 = y2;
-                    break;
-                case 16:
-                    pixelBit0 = x0;
-                    pixelBit1 = x1;
-                    pixelBit2 = x2;
-                    pixelBit3 = y0;
-                    pixelBit4 = y1;
-                    pixelBit5 = y2;
-                    break;
-                case 32:
-                    pixelBit0 = x0;
-                    pixelBit1 = x1;
-                    pixelBit2 = y0;
-                    pixelBit3 = x2;
-                    pixelBit4 = y1;
-                    pixelBit5 = y2;
-                    break;
-                case 64:
-                    pixelBit0 = x0;
-                    pixelBit1 = y0;
-                    pixelBit2 = x1;
-                    pixelBit3 = x2;
-                    pixelBit4 = y1;
-                    pixelBit5 = y2;
-                    break;
-                case 128:
-                    pixelBit0 = y0;
-                    pixelBit1 = x0;
-                    pixelBit2 = x1;
-                    pixelBit3 = x2;
-                    pixelBit4 = y1;
-                    pixelBit5 = y2;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    break;
-            }
-        }
-        else if (microTileType == ADDR_NON_DISPLAYABLE || microTileType == ADDR_DEPTH_SAMPLE_ORDER)
-        {
-            pixelBit0 = x0;
-            pixelBit1 = y0;
-            pixelBit2 = x1;
-            pixelBit3 = y1;
-            pixelBit4 = x2;
-            pixelBit5 = y2;
-        }
-        else if (microTileType == ADDR_ROTATED)
-        {
-            ADDR_ASSERT(thickness == 1);
-
-            switch (bpp)
-            {
-                case 8:
-                    pixelBit0 = y0;
-                    pixelBit1 = y1;
-                    pixelBit2 = y2;
-                    pixelBit3 = x1;
-                    pixelBit4 = x0;
-                    pixelBit5 = x2;
-                    break;
-                case 16:
-                    pixelBit0 = y0;
-                    pixelBit1 = y1;
-                    pixelBit2 = y2;
-                    pixelBit3 = x0;
-                    pixelBit4 = x1;
-                    pixelBit5 = x2;
-                    break;
-                case 32:
-                    pixelBit0 = y0;
-                    pixelBit1 = y1;
-                    pixelBit2 = x0;
-                    pixelBit3 = y2;
-                    pixelBit4 = x1;
-                    pixelBit5 = x2;
-                    break;
-                case 64:
-                    pixelBit0 = y0;
-                    pixelBit1 = x0;
-                    pixelBit2 = y1;
-                    pixelBit3 = x1;
-                    pixelBit4 = x2;
-                    pixelBit5 = y2;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    break;
-            }
-        }
-
-        if (thickness > 1)
-        {
-            pixelBit6 = z0;
-            pixelBit7 = z1;
-        }
-    }
-    else // ADDR_THICK
-    {
-        ADDR_ASSERT(thickness > 1);
-
-        switch (bpp)
-        {
-            case 8:
-            case 16:
-                pixelBit0 = x0;
-                pixelBit1 = y0;
-                pixelBit2 = x1;
-                pixelBit3 = y1;
-                pixelBit4 = z0;
-                pixelBit5 = z1;
-                break;
-            case 32:
-                pixelBit0 = x0;
-                pixelBit1 = y0;
-                pixelBit2 = x1;
-                pixelBit3 = z0;
-                pixelBit4 = y1;
-                pixelBit5 = z1;
-                break;
-            case 64:
-            case 128:
-                pixelBit0 = x0;
-                pixelBit1 = y0;
-                pixelBit2 = z0;
-                pixelBit3 = x1;
-                pixelBit4 = y1;
-                pixelBit5 = z1;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        pixelBit6 = x2;
-        pixelBit7 = y2;
-    }
-
-    if (thickness == 8)
-    {
-        pixelBit8 = z2;
-    }
-
-    pixelNumber = ((pixelBit0     ) |
-                   (pixelBit1 << 1) |
-                   (pixelBit2 << 2) |
-                   (pixelBit3 << 3) |
-                   (pixelBit4 << 4) |
-                   (pixelBit5 << 5) |
-                   (pixelBit6 << 6) |
-                   (pixelBit7 << 7) |
-                   (pixelBit8 << 8));
-
-    return pixelNumber;
-}
-
-/**
-****************************************************************************************************
-*   Lib::AdjustPitchAlignment
-*
-*   @brief
-*       Adjusts pitch alignment for flipping surface
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID Lib::AdjustPitchAlignment(
-    ADDR_SURFACE_FLAGS  flags,      ///< [in] Surface flags
-    UINT_32*            pPitchAlign ///< [out] Pointer to pitch alignment
-    ) const
-{
-    // Display engine hardwires lower 5 bit of GRPH_PITCH to ZERO which means 32 pixel alignment
-    // Maybe it will be fixed in future but let's make it general for now.
-    if (flags.display || flags.overlay)
-    {
-        *pPitchAlign = PowTwoAlign(*pPitchAlign, 32);
-
-        if(flags.display)
-        {
-            *pPitchAlign = Max(m_minPitchAlignPixels, *pPitchAlign);
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   Lib::PadDimensions
-*
-*   @brief
-*       Helper function to pad dimensions
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID Lib::PadDimensions(
-    AddrTileMode        tileMode,    ///< [in] tile mode
-    UINT_32             bpp,         ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,       ///< [in] surface flags
-    UINT_32             numSamples,  ///< [in] number of samples
-    ADDR_TILEINFO*      pTileInfo,   ///< [in,out] bank structure.
-    UINT_32             padDims,     ///< [in] Dimensions to pad valid value 1,2,3
-    UINT_32             mipLevel,    ///< [in] MipLevel
-    UINT_32*            pPitch,      ///< [in,out] pitch in pixels
-    UINT_32*            pPitchAlign, ///< [in,out] pitch align could be changed in HwlPadDimensions
-    UINT_32*            pHeight,     ///< [in,out] height in pixels
-    UINT_32             heightAlign, ///< [in] height alignment
-    UINT_32*            pSlices,     ///< [in,out] number of slices
-    UINT_32             sliceAlign   ///< [in] number of slice alignment
-    ) const
-{
-    UINT_32 pitchAlign = *pPitchAlign;
-    UINT_32 thickness = Thickness(tileMode);
-
-    ADDR_ASSERT(padDims <= 3);
-
-    //
-    // Override padding for mip levels
-    //
-    if (mipLevel > 0)
-    {
-        if (flags.cube)
-        {
-            // for cubemap, we only pad when client call with 6 faces as an identity
-            if (*pSlices > 1)
-            {
-                padDims = 3; // we should pad cubemap sub levels when we treat it as 3d texture
-            }
-            else
-            {
-                padDims = 2;
-            }
-        }
-    }
-
-    // Any possibilities that padDims is 0?
-    if (padDims == 0)
-    {
-        padDims = 3;
-    }
-
-    if (IsPow2(pitchAlign))
-    {
-        *pPitch = PowTwoAlign((*pPitch), pitchAlign);
-    }
-    else // add this code to pass unit test, r600 linear mode is not align bpp to pow2 for linear
-    {
-        *pPitch += pitchAlign - 1;
-        *pPitch /= pitchAlign;
-        *pPitch *= pitchAlign;
-    }
-
-    if (padDims > 1)
-    {
-        if (IsPow2(heightAlign))
-        {
-            *pHeight = PowTwoAlign((*pHeight), heightAlign);
-        }
-        else
-        {
-            *pHeight += heightAlign - 1;
-            *pHeight /= heightAlign;
-            *pHeight *= heightAlign;
-        }
-    }
-
-    if (padDims > 2 || thickness > 1)
-    {
-        // for cubemap single face, we do not pad slices.
-        // if we pad it, the slice number should be set to 6 and current mip level > 1
-        if (flags.cube && (!m_configFlags.noCubeMipSlicesPad || flags.cubeAsArray))
-        {
-            *pSlices = NextPow2(*pSlices);
-        }
-
-        // normal 3D texture or arrays or cubemap has a thick mode? (Just pass unit test)
-        if (thickness > 1)
-        {
-            *pSlices = PowTwoAlign((*pSlices), sliceAlign);
-        }
-
-    }
-
-    HwlPadDimensions(tileMode,
-                     bpp,
-                     flags,
-                     numSamples,
-                     pTileInfo,
-                     mipLevel,
-                     pPitch,
-                     pPitchAlign,
-                     *pHeight,
-                     heightAlign);
-}
-
-
-/**
-****************************************************************************************************
-*   Lib::HwlPreHandleBaseLvl3xPitch
-*
-*   @brief
-*       Pre-handler of 3x pitch (96 bit) adjustment
-*
-*   @return
-*       Expected pitch
-****************************************************************************************************
-*/
-UINT_32 Lib::HwlPreHandleBaseLvl3xPitch(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
-    UINT_32                                 expPitch    ///< [in] pitch
-    ) const
-{
-    ADDR_ASSERT(pIn->width == expPitch);
-    //
-    // If pitch is pre-multiplied by 3, we retrieve original one here to get correct miplevel size
-    //
-    if (ElemLib::IsExpand3x(pIn->format) &&
-        pIn->mipLevel == 0 &&
-        pIn->tileMode == ADDR_TM_LINEAR_ALIGNED)
-    {
-        expPitch /= 3;
-        expPitch = NextPow2(expPitch);
-    }
-
-    return expPitch;
-}
-
-/**
-****************************************************************************************************
-*   Lib::HwlPostHandleBaseLvl3xPitch
-*
-*   @brief
-*       Post-handler of 3x pitch adjustment
-*
-*   @return
-*       Expected pitch
-****************************************************************************************************
-*/
-UINT_32 Lib::HwlPostHandleBaseLvl3xPitch(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
-    UINT_32                                 expPitch    ///< [in] pitch
-    ) const
-{
-    //
-    // 96 bits surface of sub levels require element pitch of 32 bits instead
-    // So we just return pitch in 32 bit pixels without timing 3
-    //
-    if (ElemLib::IsExpand3x(pIn->format) &&
-        pIn->mipLevel == 0 &&
-        pIn->tileMode == ADDR_TM_LINEAR_ALIGNED)
-    {
-        expPitch *= 3;
-    }
-
-    return expPitch;
-}
-
-
-/**
-****************************************************************************************************
-*   Lib::IsMacroTiled
-*
-*   @brief
-*       Check if the tile mode is macro tiled
-*
-*   @return
-*       TRUE if it is macro tiled (2D/2B/3D/3B)
-****************************************************************************************************
-*/
-BOOL_32 Lib::IsMacroTiled(
-    AddrTileMode tileMode)  ///< [in] tile mode
-{
-   return ModeFlags[tileMode].isMacro;
-}
-
-/**
-****************************************************************************************************
-*   Lib::IsMacro3dTiled
-*
-*   @brief
-*       Check if the tile mode is 3D macro tiled
-*
-*   @return
-*       TRUE if it is 3D macro tiled
-****************************************************************************************************
-*/
-BOOL_32 Lib::IsMacro3dTiled(
-    AddrTileMode tileMode)  ///< [in] tile mode
-{
-    return ModeFlags[tileMode].isMacro3d;
-}
-
-/**
-****************************************************************************************************
-*   Lib::IsMicroTiled
-*
-*   @brief
-*       Check if the tile mode is micro tiled
-*
-*   @return
-*       TRUE if micro tiled
-****************************************************************************************************
-*/
-BOOL_32 Lib::IsMicroTiled(
-    AddrTileMode tileMode)  ///< [in] tile mode
-{
-    return ModeFlags[tileMode].isMicro;
-}
-
-/**
-****************************************************************************************************
-*   Lib::IsLinear
-*
-*   @brief
-*       Check if the tile mode is linear
-*
-*   @return
-*       TRUE if linear
-****************************************************************************************************
-*/
-BOOL_32 Lib::IsLinear(
-    AddrTileMode tileMode)  ///< [in] tile mode
-{
-    return ModeFlags[tileMode].isLinear;
-}
-
-/**
-****************************************************************************************************
-*   Lib::IsPrtNoRotationTileMode
-*
-*   @brief
-*       Return TRUE if it is prt tile without rotation
-*   @note
-*       This function just used by CI
-****************************************************************************************************
-*/
-BOOL_32 Lib::IsPrtNoRotationTileMode(
-    AddrTileMode tileMode)
-{
-    return ModeFlags[tileMode].isPrtNoRotation;
-}
-
-/**
-****************************************************************************************************
-*   Lib::IsPrtTileMode
-*
-*   @brief
-*       Return TRUE if it is prt tile
-*   @note
-*       This function just used by CI
-****************************************************************************************************
-*/
-BOOL_32 Lib::IsPrtTileMode(
-    AddrTileMode tileMode)
-{
-    return ModeFlags[tileMode].isPrt;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeMipLevel
-*
-*   @brief
-*       Compute mipmap level width/height/slices
-*   @return
-*      N/A
-****************************************************************************************************
-*/
-VOID Lib::ComputeMipLevel(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn ///< [in,out] Input structure
-    ) const
-{
-    // Check if HWL has handled
-    BOOL_32 hwlHandled = FALSE;
-    (void)hwlHandled;
-
-    if (ElemLib::IsBlockCompressed(pIn->format))
-    {
-        if (pIn->mipLevel == 0)
-        {
-            // DXTn's level 0 must be multiple of 4
-            // But there are exceptions:
-            // 1. Internal surface creation in hostblt/vsblt/etc...
-            // 2. Runtime doesn't reject ATI1/ATI2 whose width/height are not multiple of 4
-            pIn->width = PowTwoAlign(pIn->width, 4);
-            pIn->height = PowTwoAlign(pIn->height, 4);
-        }
-    }
-
-    hwlHandled = HwlComputeMipLevel(pIn);
-}
-
-/**
-****************************************************************************************************
-*   Lib::DegradeTo1D
-*
-*   @brief
-*       Check if surface can be degraded to 1D
-*   @return
-*       TRUE if degraded
-****************************************************************************************************
-*/
-BOOL_32 Lib::DegradeTo1D(
-    UINT_32 width,                  ///< surface width
-    UINT_32 height,                 ///< surface height
-    UINT_32 macroTilePitchAlign,    ///< macro tile pitch align
-    UINT_32 macroTileHeightAlign    ///< macro tile height align
-    )
-{
-    BOOL_32 degrade = ((width < macroTilePitchAlign) || (height < macroTileHeightAlign));
-
-    // Check whether 2D tiling still has too much footprint
-    if (degrade == FALSE)
-    {
-        // Only check width and height as slices are aligned to thickness
-        UINT_64 unalignedSize = width * height;
-
-        UINT_32 alignedPitch = PowTwoAlign(width, macroTilePitchAlign);
-        UINT_32 alignedHeight = PowTwoAlign(height, macroTileHeightAlign);
-        UINT_64 alignedSize = alignedPitch * alignedHeight;
-
-        // alignedSize > 1.5 * unalignedSize
-        if (2 * alignedSize > 3 * unalignedSize)
-        {
-            degrade = TRUE;
-        }
-    }
-
-    return degrade;
-}
-
-/**
-****************************************************************************************************
-*   Lib::OptimizeTileMode
-*
-*   @brief
-*       Check if base level's tile mode can be optimized (degraded)
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID Lib::OptimizeTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*  pInOut     ///< [in, out] structure for surface info
-    ) const
-{
-    AddrTileMode tileMode = pInOut->tileMode;
-
-    BOOL_32 doOpt = (pInOut->flags.opt4Space == TRUE) ||
-                    (pInOut->flags.minimizeAlignment == TRUE) ||
-                    (pInOut->maxBaseAlign != 0);
-
-    BOOL_32 convertToPrt = FALSE;
-
-    // Optimization can only be done on level 0 and samples <= 1
-    if ((doOpt == TRUE)                     &&
-        (pInOut->mipLevel == 0)             &&
-        (IsPrtTileMode(tileMode) == FALSE)  &&
-        (pInOut->flags.prt == FALSE))
-    {
-        UINT_32 width = pInOut->width;
-        UINT_32 height = pInOut->height;
-        UINT_32 thickness = Thickness(tileMode);
-        BOOL_32 macroTiledOK = TRUE;
-        UINT_32 macroWidthAlign = 0;
-        UINT_32 macroHeightAlign = 0;
-        UINT_32 macroSizeAlign = 0;
-
-        if (IsMacroTiled(tileMode))
-        {
-            macroTiledOK = HwlGetAlignmentInfoMacroTiled(pInOut,
-                                                         &macroWidthAlign,
-                                                         &macroHeightAlign,
-                                                         &macroSizeAlign);
-        }
-
-        if (macroTiledOK)
-        {
-            if ((pInOut->flags.display == FALSE) &&
-                (pInOut->flags.opt4Space == TRUE) &&
-                (pInOut->numSamples <= 1))
-            {
-                // Check if linear mode is optimal
-                if ((pInOut->height == 1) &&
-                    (IsLinear(tileMode) == FALSE) &&
-                    (ElemLib::IsBlockCompressed(pInOut->format) == FALSE) &&
-                    (pInOut->flags.depth == FALSE) &&
-                    (pInOut->flags.stencil == FALSE) &&
-                    (m_configFlags.disableLinearOpt == FALSE) &&
-                    (pInOut->flags.disableLinearOpt == FALSE))
-                {
-                    tileMode = ADDR_TM_LINEAR_ALIGNED;
-                }
-                else if (IsMacroTiled(tileMode) && (pInOut->flags.tcCompatible == FALSE))
-                {
-                    if (DegradeTo1D(width, height, macroWidthAlign, macroHeightAlign))
-                    {
-                        tileMode = (thickness == 1) ?
-                                   ADDR_TM_1D_TILED_THIN1 : ADDR_TM_1D_TILED_THICK;
-                    }
-                    else if ((thickness > 1) && (pInOut->flags.disallowLargeThickDegrade == 0))
-                    {
-                        // As in the following HwlComputeSurfaceInfo, thick modes may be degraded to
-                        // thinner modes, we should re-evaluate whether the corresponding
-                        // thinner modes should be degraded. If so, we choose 1D thick mode instead.
-                        tileMode = DegradeLargeThickTile(pInOut->tileMode, pInOut->bpp);
-
-                        if (tileMode != pInOut->tileMode)
-                        {
-                            // Get thickness again after large thick degrade
-                            thickness = Thickness(tileMode);
-
-                            ADDR_COMPUTE_SURFACE_INFO_INPUT input = *pInOut;
-                            input.tileMode = tileMode;
-
-                            macroTiledOK = HwlGetAlignmentInfoMacroTiled(&input,
-                                                                         &macroWidthAlign,
-                                                                         &macroHeightAlign,
-                                                                         &macroSizeAlign);
-
-                            if (macroTiledOK &&
-                                DegradeTo1D(width, height, macroWidthAlign, macroHeightAlign))
-                            {
-                                tileMode = ADDR_TM_1D_TILED_THICK;
-                            }
-                        }
-                    }
-                }
-            }
-
-            if (macroTiledOK)
-            {
-                if ((pInOut->flags.minimizeAlignment == TRUE) &&
-                    (pInOut->numSamples <= 1) &&
-                    (IsMacroTiled(tileMode) == TRUE))
-                {
-                    UINT_32 macroSize = PowTwoAlign(width, macroWidthAlign) *
-                                        PowTwoAlign(height, macroHeightAlign);
-                    UINT_32 microSize = PowTwoAlign(width, MicroTileWidth) *
-                                        PowTwoAlign(height, MicroTileHeight);
-
-                    if (macroSize > microSize)
-                    {
-                        tileMode = (thickness == 1) ?
-                                   ADDR_TM_1D_TILED_THIN1 : ADDR_TM_1D_TILED_THICK;
-                    }
-                }
-
-                if ((pInOut->maxBaseAlign != 0) &&
-                    (IsMacroTiled(tileMode) == TRUE))
-                {
-                    if (macroSizeAlign > pInOut->maxBaseAlign)
-                    {
-                        if (pInOut->numSamples > 1)
-                        {
-                            ADDR_ASSERT(pInOut->maxBaseAlign >= Block64K);
-
-                            convertToPrt = TRUE;
-                        }
-                        else if (pInOut->maxBaseAlign < Block64K)
-                        {
-                            tileMode = (thickness == 1) ?
-                                       ADDR_TM_1D_TILED_THIN1 : ADDR_TM_1D_TILED_THICK;
-                        }
-                        else
-                        {
-                            convertToPrt = TRUE;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    if (convertToPrt)
-    {
-        if ((pInOut->flags.matchStencilTileCfg == TRUE) && (pInOut->numSamples <= 1))
-        {
-            pInOut->tileMode = ADDR_TM_1D_TILED_THIN1;
-        }
-        else
-        {
-            HwlSetPrtTileMode(pInOut);
-        }
-    }
-    else if (tileMode != pInOut->tileMode)
-    {
-        pInOut->tileMode = tileMode;
-    }
-
-    HwlOptimizeTileMode(pInOut);
-}
-
-/**
-****************************************************************************************************
-*   Lib::DegradeLargeThickTile
-*
-*   @brief
-*       Check if the thickness needs to be reduced if a tile is too large
-*   @return
-*       The degraded tile mode (unchanged if not degraded)
-****************************************************************************************************
-*/
-AddrTileMode Lib::DegradeLargeThickTile(
-    AddrTileMode tileMode,
-    UINT_32 bpp) const
-{
-    // Override tilemode
-    // When tile_width (8) * tile_height (8) * thickness * element_bytes is > row_size,
-    // it is better to just use THIN mode in this case
-    UINT_32 thickness = Thickness(tileMode);
-
-    if (thickness > 1 && m_configFlags.allowLargeThickTile == 0)
-    {
-        UINT_32 tileSize = MicroTilePixels * thickness * (bpp >> 3);
-
-        if (tileSize > m_rowSize)
-        {
-            switch (tileMode)
-            {
-                case ADDR_TM_2D_TILED_XTHICK:
-                    if ((tileSize >> 1) <= m_rowSize)
-                    {
-                        tileMode = ADDR_TM_2D_TILED_THICK;
-                        break;
-                    }
-                    // else fall through
-                case ADDR_TM_2D_TILED_THICK:
-                    tileMode    = ADDR_TM_2D_TILED_THIN1;
-                    break;
-
-                case ADDR_TM_3D_TILED_XTHICK:
-                    if ((tileSize >> 1) <= m_rowSize)
-                    {
-                        tileMode = ADDR_TM_3D_TILED_THICK;
-                        break;
-                    }
-                    // else fall through
-                case ADDR_TM_3D_TILED_THICK:
-                    tileMode    = ADDR_TM_3D_TILED_THIN1;
-                    break;
-
-                case ADDR_TM_PRT_TILED_THICK:
-                    tileMode    = ADDR_TM_PRT_TILED_THIN1;
-                    break;
-
-                case ADDR_TM_PRT_2D_TILED_THICK:
-                    tileMode    = ADDR_TM_PRT_2D_TILED_THIN1;
-                    break;
-
-                case ADDR_TM_PRT_3D_TILED_THICK:
-                    tileMode    = ADDR_TM_PRT_3D_TILED_THIN1;
-                    break;
-
-                default:
-                    break;
-            }
-        }
-    }
-
-    return tileMode;
-}
-
-/**
-****************************************************************************************************
-*   Lib::PostComputeMipLevel
-*   @brief
-*       Compute MipLevel info (including level 0) after surface adjustment
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::PostComputeMipLevel(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pIn,   ///< [in,out] Input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*   pOut   ///< [out] Output structure
-    ) const
-{
-    // Mipmap including level 0 must be pow2 padded since either SI hw expects so or it is
-    // required by CFX  for Hw Compatibility between NI and SI. Otherwise it is only needed for
-    // mipLevel > 0. Any h/w has different requirement should implement its own virtual function
-
-    if (pIn->flags.pow2Pad)
-    {
-        pIn->width      = NextPow2(pIn->width);
-        pIn->height     = NextPow2(pIn->height);
-        pIn->numSlices  = NextPow2(pIn->numSlices);
-    }
-    else if (pIn->mipLevel > 0)
-    {
-        pIn->width      = NextPow2(pIn->width);
-        pIn->height     = NextPow2(pIn->height);
-
-        if (!pIn->flags.cube)
-        {
-            pIn->numSlices = NextPow2(pIn->numSlices);
-        }
-
-        // for cubemap, we keep its value at first
-    }
-
-    return ADDR_OK;
-}
-
-/**
-****************************************************************************************************
-*   Lib::HwlSetupTileCfg
-*
-*   @brief
-*       Map tile index to tile setting.
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::HwlSetupTileCfg(
-    UINT_32         bpp,              ///< Bits per pixel
-    INT_32          index,            ///< [in] Tile index
-    INT_32          macroModeIndex,   ///< [in] Index in macro tile mode table(CI)
-    ADDR_TILEINFO*  pInfo,            ///< [out] Tile Info
-    AddrTileMode*   pMode,            ///< [out] Tile mode
-    AddrTileType*   pType             ///< [out] Tile type
-    ) const
-{
-    return ADDR_NOTSUPPORTED;
-}
-
-/**
-****************************************************************************************************
-*   Lib::HwlGetPipes
-*
-*   @brief
-*       Get number pipes
-*   @return
-*       num pipes
-****************************************************************************************************
-*/
-UINT_32 Lib::HwlGetPipes(
-    const ADDR_TILEINFO* pTileInfo    ///< [in] Tile info
-    ) const
-{
-    //pTileInfo can be NULL when asic is 6xx and 8xx.
-    return m_pipes;
-}
-
-/**
-****************************************************************************************************
-*   Lib::ComputeQbStereoInfo
-*
-*   @brief
-*       Get quad buffer stereo information
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID Lib::ComputeQbStereoInfo(
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [in,out] updated pOut+pStereoInfo
-    ) const
-{
-    ADDR_ASSERT(pOut->bpp >= 8);
-    ADDR_ASSERT((pOut->surfSize % pOut->baseAlign) == 0);
-
-    // Save original height
-    pOut->pStereoInfo->eyeHeight = pOut->height;
-
-    // Right offset
-    pOut->pStereoInfo->rightOffset = static_cast<UINT_32>(pOut->surfSize);
-
-    pOut->pStereoInfo->rightSwizzle = HwlComputeQbStereoRightSwizzle(pOut);
-    // Double height
-    pOut->height <<= 1;
-    pOut->pixelHeight <<= 1;
-
-    // Double size
-    pOut->surfSize <<= 1;
-
-    // Right start address meets the base align since it is guaranteed by AddrLib1
-
-    // 1D surface on SI may break this rule, but we can force it to meet by checking .qbStereo.
-}
-
-
-/**
-****************************************************************************************************
-*   Lib::ComputePrtInfo
-*
-*   @brief
-*       Compute prt surface related info
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputePrtInfo(
-    const ADDR_PRT_INFO_INPUT*  pIn,
-    ADDR_PRT_INFO_OUTPUT*       pOut) const
-{
-    ADDR_ASSERT(pOut != NULL);
-
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    UINT_32     expandX = 1;
-    UINT_32     expandY = 1;
-    ElemMode    elemMode;
-
-    UINT_32     bpp = GetElemLib()->GetBitsPerPixel(pIn->format,
-                                                    &elemMode,
-                                                    &expandX,
-                                                    &expandY);
-
-    if (bpp <8 || bpp == 24 || bpp == 48 || bpp == 96)
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    UINT_32     numFrags = pIn->numFrags;
-    ADDR_ASSERT(numFrags <= 8);
-
-    UINT_32     tileWidth = 0;
-    UINT_32     tileHeight = 0;
-    if (returnCode == ADDR_OK)
-    {
-        // 3D texture without depth or 2d texture
-        if (pIn->baseMipDepth > 1 || pIn->baseMipHeight > 1)
-        {
-            if (bpp == 8)
-            {
-                tileWidth = 256;
-                tileHeight = 256;
-            }
-            else if (bpp == 16)
-            {
-                tileWidth = 256;
-                tileHeight = 128;
-            }
-            else if (bpp == 32)
-            {
-                tileWidth = 128;
-                tileHeight = 128;
-            }
-            else if (bpp == 64)
-            {
-                // assume it is BC1/4
-                tileWidth = 512;
-                tileHeight = 256;
-
-                if (elemMode == ADDR_UNCOMPRESSED)
-                {
-                    tileWidth = 128;
-                    tileHeight = 64;
-                }
-            }
-            else if (bpp == 128)
-            {
-                // assume it is BC2/3/5/6H/7
-                tileWidth = 256;
-                tileHeight = 256;
-
-                if (elemMode == ADDR_UNCOMPRESSED)
-                {
-                    tileWidth = 64;
-                    tileHeight = 64;
-                }
-            }
-
-            if (numFrags == 2)
-            {
-                tileWidth = tileWidth / 2;
-            }
-            else if (numFrags == 4)
-            {
-                tileWidth = tileWidth / 2;
-                tileHeight = tileHeight / 2;
-            }
-            else if (numFrags == 8)
-            {
-                tileWidth = tileWidth / 4;
-                tileHeight = tileHeight / 2;
-            }
-        }
-        else    // 1d
-        {
-            tileHeight = 1;
-            if (bpp == 8)
-            {
-                tileWidth = 65536;
-            }
-            else if (bpp == 16)
-            {
-                tileWidth = 32768;
-            }
-            else if (bpp == 32)
-            {
-                tileWidth = 16384;
-            }
-            else if (bpp == 64)
-            {
-                tileWidth = 8192;
-            }
-            else if (bpp == 128)
-            {
-                tileWidth = 4096;
-            }
-        }
-    }
-
-    pOut->prtTileWidth = tileWidth;
-    pOut->prtTileHeight = tileHeight;
-
-    return returnCode;
-}
-
-} // V1
-} // Addr
diff --git a/src/amd/addrlib/core/addrlib1.h b/src/amd/addrlib/core/addrlib1.h
deleted file mode 100644 (file)
index d6642aa..0000000
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright © 2016 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  addrlib1.h
-* @brief Contains the Addr::V1::Lib class definition.
-****************************************************************************************************
-*/
-
-#ifndef __ADDR_LIB1_H__
-#define __ADDR_LIB1_H__
-
-#include "addrlib.h"
-
-namespace Addr
-{
-namespace V1
-{
-
-/**
-****************************************************************************************************
-* @brief Neutral enums that define bank swap size
-****************************************************************************************************
-*/
-enum SampleSplitSize
-{
-    ADDR_SAMPLESPLIT_1KB = 1024,
-    ADDR_SAMPLESPLIT_2KB = 2048,
-    ADDR_SAMPLESPLIT_4KB = 4096,
-    ADDR_SAMPLESPLIT_8KB = 8192,
-};
-
-/**
-****************************************************************************************************
-* @brief Flags for AddrTileMode
-****************************************************************************************************
-*/
-struct TileModeFlags
-{
-    UINT_32 thickness       : 4;
-    UINT_32 isLinear        : 1;
-    UINT_32 isMicro         : 1;
-    UINT_32 isMacro         : 1;
-    UINT_32 isMacro3d       : 1;
-    UINT_32 isPrt           : 1;
-    UINT_32 isPrtNoRotation : 1;
-    UINT_32 isBankSwapped   : 1;
-};
-
-static const UINT_32 Block64K = 0x10000;
-static const UINT_32 PrtTileSize = Block64K;
-
-/**
-****************************************************************************************************
-* @brief This class contains asic independent address lib functionalities
-****************************************************************************************************
-*/
-class Lib : public Addr::Lib
-{
-public:
-    virtual ~Lib();
-
-    static Lib* GetLib(
-        ADDR_HANDLE hLib);
-
-    /// Returns tileIndex support
-    BOOL_32 UseTileIndex(INT_32 index) const
-    {
-        return m_configFlags.useTileIndex && (index != TileIndexInvalid);
-    }
-
-    /// Returns combined swizzle support
-    BOOL_32 UseCombinedSwizzle() const
-    {
-        return m_configFlags.useCombinedSwizzle;
-    }
-
-    //
-    // Interface stubs
-    //
-    ADDR_E_RETURNCODE ComputeSurfaceInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoord(
-        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddr(
-        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT*  pIn,
-        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeSliceTileSwizzle(
-        const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,
-        ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ExtractBankPipeSwizzle(
-        const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
-        ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE CombineBankPipeSwizzle(
-        const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,
-        ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeBaseSwizzle(
-        const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
-        ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeFmaskInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT*  pIn,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
-
-    ADDR_E_RETURNCODE ComputeFmaskAddrFromCoord(
-        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*  pIn,
-        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeFmaskCoordFromAddr(
-        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*  pIn,
-        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ConvertTileInfoToHW(
-        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
-        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ConvertTileIndex(
-        const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
-        ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE GetMacroModeIndex(
-        const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
-        ADDR_GET_MACROMODEINDEX_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ConvertTileIndex1(
-        const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,
-        ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE GetTileIndex(
-        const ADDR_GET_TILEINDEX_INPUT* pIn,
-        ADDR_GET_TILEINDEX_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeHtileInfo(
-        const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeCmaskInfo(
-        const ADDR_COMPUTE_CMASK_INFO_INPUT* pIn,
-        ADDR_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeDccInfo(
-        const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
-        ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeHtileAddrFromCoord(
-        const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
-        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeCmaskAddrFromCoord(
-        const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*  pIn,
-        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
-        const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*  pIn,
-        ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputeCmaskCoordFromAddr(
-        const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*  pIn,
-        ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE ComputePrtInfo(
-        const ADDR_PRT_INFO_INPUT*  pIn,
-        ADDR_PRT_INFO_OUTPUT*       pOut) const;
-protected:
-    Lib();  // Constructor is protected
-    Lib(const Client* pClient);
-
-    /// Pure Virtual function for Hwl computing surface info
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl computing surface address from coord
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoord(
-        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl computing surface coord from address
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceCoordFromAddr(
-        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl computing surface tile swizzle
-    virtual ADDR_E_RETURNCODE HwlComputeSliceTileSwizzle(
-        const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
-        ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl extracting bank/pipe swizzle from base256b
-    virtual ADDR_E_RETURNCODE HwlExtractBankPipeSwizzle(
-        const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
-        ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl combining bank/pipe swizzle
-    virtual ADDR_E_RETURNCODE HwlCombineBankPipeSwizzle(
-        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, ADDR_TILEINFO*  pTileInfo,
-        UINT_64 baseAddr, UINT_32* pTileSwizzle) const = 0;
-
-    /// Pure Virtual function for Hwl computing base swizzle
-    virtual ADDR_E_RETURNCODE HwlComputeBaseSwizzle(
-        const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
-        ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl computing HTILE base align
-    virtual UINT_32 HwlComputeHtileBaseAlign(
-        BOOL_32 isTcCompatible, BOOL_32 isLinear, ADDR_TILEINFO* pTileInfo) const = 0;
-
-    /// Pure Virtual function for Hwl computing HTILE bpp
-    virtual UINT_32 HwlComputeHtileBpp(
-        BOOL_32 isWidth8, BOOL_32 isHeight8) const = 0;
-
-    /// Pure Virtual function for Hwl computing HTILE bytes
-    virtual UINT_64 HwlComputeHtileBytes(
-        UINT_32 pitch, UINT_32 height, UINT_32 bpp,
-        BOOL_32 isLinear, UINT_32 numSlices, UINT_64* pSliceBytes, UINT_32 baseAlign) const = 0;
-
-    /// Pure Virtual function for Hwl computing FMASK info
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut) = 0;
-
-    /// Pure Virtual function for Hwl FMASK address from coord
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskAddrFromCoord(
-        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl FMASK coord from address
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskCoordFromAddr(
-        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl convert tile info from real value to HW value
-    virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
-        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
-        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const = 0;
-
-    /// Pure Virtual function for Hwl compute mipmap info
-    virtual BOOL_32 HwlComputeMipLevel(
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const = 0;
-
-    /// Pure Virtual function for Hwl compute max cmask blockMax value
-    virtual BOOL_32 HwlGetMaxCmaskBlockMax() const = 0;
-
-    /// Pure Virtual function for Hwl compute fmask bits
-    virtual UINT_32 HwlComputeFmaskBits(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-        UINT_32* pNumSamples) const = 0;
-
-    /// Virtual function to get index (not pure then no need to implement this in all hwls
-    virtual ADDR_E_RETURNCODE HwlGetTileIndex(
-        const ADDR_GET_TILEINDEX_INPUT* pIn,
-        ADDR_GET_TILEINDEX_OUTPUT*      pOut) const
-    {
-        return ADDR_NOTSUPPORTED;
-    }
-
-    /// Virtual function for Hwl to compute Dcc info
-    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
-        const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
-        ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const
-    {
-        return ADDR_NOTSUPPORTED;
-    }
-
-    /// Virtual function to get cmask address for tc compatible cmask
-    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
-        const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const
-    {
-        return ADDR_NOTSUPPORTED;
-    }
-
-    /// Virtual function to get htile address for tc compatible htile
-    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
-        const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const
-    {
-        return ADDR_NOTSUPPORTED;
-    }
-
-    // Compute attributes
-
-    // HTILE
-    UINT_32    ComputeHtileInfo(
-        ADDR_HTILE_FLAGS flags,
-        UINT_32 pitchIn, UINT_32 heightIn, UINT_32 numSlices,
-        BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
-        ADDR_TILEINFO*  pTileInfo,
-        UINT_32* pPitchOut, UINT_32* pHeightOut, UINT_64* pHtileBytes,
-        UINT_32* pMacroWidth = NULL, UINT_32* pMacroHeight = NULL,
-        UINT_64* pSliceSize = NULL, UINT_32* pBaseAlign = NULL) const;
-
-    // CMASK
-    ADDR_E_RETURNCODE ComputeCmaskInfo(
-        ADDR_CMASK_FLAGS flags,
-        UINT_32 pitchIn, UINT_32 heightIn, UINT_32 numSlices, BOOL_32 isLinear,
-        ADDR_TILEINFO* pTileInfo, UINT_32* pPitchOut, UINT_32* pHeightOut, UINT_64* pCmaskBytes,
-        UINT_32* pMacroWidth, UINT_32* pMacroHeight, UINT_64* pSliceSize = NULL,
-        UINT_32* pBaseAlign = NULL, UINT_32* pBlockMax = NULL) const;
-
-    virtual VOID HwlComputeTileDataWidthAndHeightLinear(
-        UINT_32* pMacroWidth, UINT_32* pMacroHeight,
-        UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
-
-    // CMASK & HTILE addressing
-    virtual UINT_64 HwlComputeXmaskAddrFromCoord(
-        UINT_32 pitch, UINT_32 height, UINT_32 x, UINT_32 y, UINT_32 slice,
-        UINT_32 numSlices, UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8,
-        BOOL_32 isHeight8, ADDR_TILEINFO* pTileInfo,
-        UINT_32* bitPosition) const;
-
-    virtual VOID HwlComputeXmaskCoordFromAddr(
-        UINT_64 addr, UINT_32 bitPosition, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
-        UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
-        ADDR_TILEINFO* pTileInfo, UINT_32* pX, UINT_32* pY, UINT_32* pSlice) const;
-
-    // Surface mipmap
-    VOID    ComputeMipLevel(
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
-
-    /// Pure Virtual function for Hwl to get macro tiled alignment info
-    virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const = 0;
-
-
-    virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
-    {
-        // not supported in hwl layer
-    }
-
-    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
-    {
-        // not supported in hwl layer
-    }
-
-    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
-    {
-        // not supported in hwl layer
-    }
-
-    AddrTileMode DegradeLargeThickTile(AddrTileMode tileMode, UINT_32 bpp) const;
-
-    VOID PadDimensions(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 padDims, UINT_32 mipLevel,
-        UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32* pHeight, UINT_32 heightAlign,
-        UINT_32* pSlices, UINT_32 sliceAlign) const;
-
-    virtual VOID HwlPadDimensions(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
-        UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32 height, UINT_32 heightAlign) const
-    {
-    }
-
-    //
-    // Addressing shared for linear/1D tiling
-    //
-    UINT_64 ComputeSurfaceAddrFromCoordLinear(
-        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
-        UINT_32* pBitPosition) const;
-
-    VOID    ComputeSurfaceCoordFromAddrLinear(
-        UINT_64 addr, UINT_32 bitPosition, UINT_32 bpp,
-        UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample) const;
-
-    VOID    ComputeSurfaceCoordFromAddrMicroTiled(
-        UINT_64 addr, UINT_32 bitPosition,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
-        AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const;
-
-    ADDR_E_RETURNCODE ComputeMicroTileEquation(
-        UINT_32 bpp, AddrTileMode tileMode,
-        AddrTileType microTileType, ADDR_EQUATION* pEquation) const;
-
-    UINT_32 ComputePixelIndexWithinMicroTile(
-        UINT_32 x, UINT_32 y, UINT_32 z,
-        UINT_32 bpp, AddrTileMode tileMode, AddrTileType microTileType) const;
-
-    /// Pure Virtual function for Hwl computing coord from offset inside micro tile
-    virtual VOID HwlComputePixelCoordFromOffset(
-        UINT_32 offset, UINT_32 bpp, UINT_32 numSamples,
-        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
-        AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const = 0;
-
-    //
-    // Addressing shared by all
-    //
-    virtual UINT_32 HwlGetPipes(
-        const ADDR_TILEINFO* pTileInfo) const;
-
-    UINT_32 ComputePipeFromAddr(
-        UINT_64 addr, UINT_32 numPipes) const;
-
-    virtual ADDR_E_RETURNCODE ComputePipeEquation(
-        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY, ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const
-    {
-        return ADDR_NOTSUPPORTED;
-    }
-
-    /// Pure Virtual function for Hwl computing pipe from coord
-    virtual UINT_32 ComputePipeFromCoord(
-        UINT_32 x, UINT_32 y, UINT_32 slice, AddrTileMode tileMode,
-        UINT_32 pipeSwizzle, BOOL_32 flags, ADDR_TILEINFO* pTileInfo) const = 0;
-
-    /// Pure Virtual function for Hwl computing coord Y for 8 pipe cmask/htile
-    virtual UINT_32 HwlComputeXmaskCoordYFrom8Pipe(
-        UINT_32 pipe, UINT_32 x) const = 0;
-
-    //
-    // Misc helper
-    //
-    static const TileModeFlags ModeFlags[ADDR_TM_COUNT];
-
-    static UINT_32 Thickness(
-        AddrTileMode tileMode);
-
-    // Checking tile mode
-    static BOOL_32 IsMacroTiled(AddrTileMode tileMode);
-    static BOOL_32 IsMacro3dTiled(AddrTileMode tileMode);
-    static BOOL_32 IsLinear(AddrTileMode tileMode);
-    static BOOL_32 IsMicroTiled(AddrTileMode tileMode);
-    static BOOL_32 IsPrtTileMode(AddrTileMode tileMode);
-    static BOOL_32 IsPrtNoRotationTileMode(AddrTileMode tileMode);
-
-    /// Return TRUE if tile info is needed
-    BOOL_32 UseTileInfo() const
-    {
-        return !m_configFlags.ignoreTileInfo;
-    }
-
-    /// Adjusts pitch alignment for flipping surface
-    VOID    AdjustPitchAlignment(
-        ADDR_SURFACE_FLAGS flags, UINT_32* pPitchAlign) const;
-
-    /// Overwrite tile config according to tile index
-    virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
-        UINT_32 bpp, INT_32 index, INT_32 macroModeIndex,
-        ADDR_TILEINFO* pInfo, AddrTileMode* mode = NULL, AddrTileType* type = NULL) const;
-
-    /// Overwrite macro tile config according to tile index
-    virtual INT_32 HwlComputeMacroModeIndex(
-        INT_32 index, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
-        ADDR_TILEINFO* pTileInfo, AddrTileMode *pTileMode = NULL, AddrTileType *pTileType = NULL
-        ) const
-    {
-        return TileIndexNoMacroIndex;
-    }
-
-    /// Pre-handler of 3x pitch (96 bit) adjustment
-    virtual UINT_32 HwlPreHandleBaseLvl3xPitch(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
-    /// Post-handler of 3x pitch adjustment
-    virtual UINT_32 HwlPostHandleBaseLvl3xPitch(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
-    /// Check miplevel after surface adjustment
-    ADDR_E_RETURNCODE PostComputeMipLevel(
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    /// Quad buffer stereo support, has its implementation in ind. layer
-    VOID ComputeQbStereoInfo(
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    /// Pure virutual function to compute stereo bank swizzle for right eye
-    virtual UINT_32 HwlComputeQbStereoRightSwizzle(
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
-
-    VOID OptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    /// Overwrite tile setting to PRT
-    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
-    {
-    }
-
-    static BOOL_32 DegradeTo1D(
-        UINT_32 width, UINT_32 height,
-        UINT_32 macroTilePitchAlign, UINT_32 macroTileHeightAlign);
-
-private:
-    // Disallow the copy constructor
-    Lib(const Lib& a);
-
-    // Disallow the assignment operator
-    Lib& operator=(const Lib& a);
-
-    UINT_32 ComputeCmaskBaseAlign(
-        ADDR_CMASK_FLAGS flags, ADDR_TILEINFO*  pTileInfo) const;
-
-    UINT_64 ComputeCmaskBytes(
-        UINT_32 pitch, UINT_32 height, UINT_32 numSlices) const;
-
-    //
-    // CMASK/HTILE shared methods
-    //
-    VOID    ComputeTileDataWidthAndHeight(
-        UINT_32 bpp, UINT_32 cacheBits, ADDR_TILEINFO* pTileInfo,
-        UINT_32* pMacroWidth, UINT_32* pMacroHeight) const;
-
-    UINT_32 ComputeXmaskCoordYFromPipe(
-        UINT_32 pipe, UINT_32 x) const;
-};
-
-} // V1
-} // Addr
-
-#endif
-
diff --git a/src/amd/addrlib/core/addrlib2.cpp b/src/amd/addrlib/core/addrlib2.cpp
deleted file mode 100644 (file)
index fc9b71f..0000000
+++ /dev/null
@@ -1,1891 +0,0 @@
-/*
- * 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 Dim2d Lib::Block256_2d[] = {{16, 16}, {16, 8}, {8, 8}, {8, 4}, {4, 4}};
-
-const Dim3d Lib::Block1K_3d[]  = {{16, 8, 8}, {8, 8, 8}, {8, 8, 4}, {8, 4, 4}, {4, 4, 4}};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               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(IsLinear(localIn.swizzleMode));
-            }
-
-            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.numMipLevels > 1) && (pOut->pMipInfo != NULL))
-                {
-                    for (UINT_32 i = 0; i < localIn.numMipLevels; i++)
-                    {
-                        pOut->pMipInfo[i].pixelPitch  = pOut->pMipInfo[i].pitch;
-                        pOut->pMipInfo[i].pixelHeight = pOut->pMipInfo[i].height;
-
-                        GetElemLib()->RestoreSurfaceInfo(elemMode,
-                                                         expandX,
-                                                         expandY,
-                                                         &pixelBits,
-                                                         &pOut->pMipInfo[i].pixelPitch,
-                                                         &pOut->pMipInfo[i].pixelHeight);
-                    }
-                }
-            }
-
-            if (localIn.flags.needEquation && (Log2(localIn.numFrags) == 0))
-            {
-                pOut->equationIndex = GetEquationIndex(&localIn, pOut);
-            }
-
-            if (localIn.flags.qbStereo)
-            {
-                if (pOut->pStereoInfo != NULL)
-                {
-                    ComputeQbStereoInfo(pOut);
-                }
-            }
-        }
-    }
-
-    ADDR_ASSERT(pOut->surfSize != 0);
-
-    ValidBaseAlignments(pOut->baseAlign);
-
-    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);
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            pOut->prtBlockIndex = static_cast<UINT_32>(pOut->addr / (64 * 1024));
-        }
-    }
-
-    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);
-
-        ValidMetaBaseAlignments(pOut->baseAlign);
-    }
-
-    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
-{
-    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
-{
-    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);
-
-        ValidMetaBaseAlignments(pOut->baseAlign);
-    }
-
-    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
-{
-    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  = static_cast<UINT_32>(localOut.sliceSize);
-            pOut->bpp        = localIn.bpp;
-            pOut->numSamples = 1;
-        }
-    }
-
-    ValidBaseAlignments(pOut->baseAlign);
-
-    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::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);
-
-        ValidMetaBaseAlignments(pOut->dccRamBaseAlign);
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Lib::ComputeDccAddrFromCoord
-*
-*   @brief
-*       Interface function stub of ComputeDccAddrFromCoord
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeDccAddrFromCoord(
-    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut)   ///< [out] output structure
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    if ((GetFillSizeFieldsFlags() == TRUE) &&
-        ((pIn->size != sizeof(ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT)) ||
-         (pOut->size != sizeof(ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT))))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        returnCode = HwlComputeDccAddrFromCoord(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 if (IsXor(pIn->swizzleMode) == FALSE)
-    {
-        returnCode = ADDR_NOTSUPPORTED;
-    }
-    else
-    {
-        returnCode = HwlComputePipeBankXor(pIn, pOut);
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Lib::ComputeSlicePipeBankXor
-*
-*   @brief
-*       Interface function stub of Addr2ComputeSlicePipeBankXor.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeSlicePipeBankXor(
-    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
-    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut)
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    if ((GetFillSizeFieldsFlags() == TRUE) &&
-        ((pIn->size != sizeof(ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT)) ||
-         (pOut->size != sizeof(ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT))))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-    else if ((IsThin(pIn->resourceType, pIn->swizzleMode) == FALSE) ||
-             (IsNonPrtXor(pIn->swizzleMode) == FALSE) ||
-             (pIn->numSamples > 1))
-    {
-        returnCode = ADDR_NOTSUPPORTED;
-    }
-    else
-    {
-        returnCode = HwlComputeSlicePipeBankXor(pIn, pOut);
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Lib::ComputeSubResourceOffsetForSwizzlePattern
-*
-*   @brief
-*       Interface function stub of Addr2ComputeSubResourceOffsetForSwizzlePattern.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Lib::ComputeSubResourceOffsetForSwizzlePattern(
-    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
-    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut)
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    if ((GetFillSizeFieldsFlags() == TRUE) &&
-        ((pIn->size != sizeof(ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT)) ||
-         (pOut->size != sizeof(ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT))))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        returnCode = HwlComputeSubResourceOffsetForSwizzlePattern(pIn, pOut);
-    }
-
-    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;
-
-    if ((GetFillSizeFieldsFlags() == TRUE) &&
-        (pIn->size != sizeof(ADDR2_COMPUTE_SURFACE_INFO_INPUT)))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        returnCode = HwlComputeSurfaceInfoSanityCheck(pIn);
-    }
-
-    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  pitchAlignInElement,                   ///< [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 % pitchAlignInElement) != 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
-{
-    return HwlComputeSurfaceInfoLinear(pIn, pOut);
-}
-
-/**
-************************************************************************************************************************
-*   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
-{
-    return HwlComputeSurfaceInfoTiled(pIn, pOut);
-}
-
-/**
-************************************************************************************************************************
-*   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};
-        ADDR2_MIP_INFO                    mipInfo[MaxMipLevels];
-
-        localIn.bpp          = pIn->bpp;
-        localIn.flags        = pIn->flags;
-        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;
-        }
-
-        localOut.pMipInfo = mipInfo;
-
-        returnCode = ComputeSurfaceInfoLinear(&localIn, &localOut);
-
-        if (returnCode == ADDR_OK)
-        {
-            pOut->addr        = (localOut.sliceSize * pIn->slice) +
-                                mipInfo[pIn->mipId].offset +
-                                (pIn->y * mipInfo[pIn->mipId].pitch + pIn->x) * (pIn->bpp >> 3);
-            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
-{
-    return HwlComputeSurfaceAddrFromCoordTiled(pIn, pOut);
-}
-
-/**
-************************************************************************************************************************
-*   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.flags        = pIn->flags;
-        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::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))
-    {
-        const UINT_32 log2blkSize = GetBlockSizeLog2(swizzleMode);
-        const UINT_32 log2sample  = Log2(numSamples);
-        const UINT_32 q           = log2sample >> 1;
-        const UINT_32 r           = log2sample & 1;
-
-        if (log2blkSize & 1)
-        {
-            *pWidth  >>= q;
-            *pHeight >>= (q + r);
-        }
-        else
-        {
-            *pWidth  >>= (q + r);
-            *pHeight >>= q;
-        }
-    }
-
-    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))
-    {
-        UINT_32 log2blkSizeIn256B = log2blkSize - 8;
-        UINT_32 widthAmp          = log2blkSizeIn256B / 2;
-        UINT_32 heightAmp         = log2blkSizeIn256B - widthAmp;
-
-        ADDR_ASSERT(microBlockSizeTableIndex < sizeof(Block256_2d) / sizeof(Block256_2d[0]));
-
-        *pWidth  = (Block256_2d[microBlockSizeTableIndex].w << widthAmp);
-        *pHeight = (Block256_2d[microBlockSizeTableIndex].h << heightAmp);
-        *pDepth  = 1;
-    }
-    else if (IsThick(resourceType, swizzleMode))
-    {
-        UINT_32 log2blkSizeIn1KB = log2blkSize - 10;
-        UINT_32 averageAmp       = log2blkSizeIn1KB / 3;
-        UINT_32 restAmp          = log2blkSizeIn1KB % 3;
-
-        ADDR_ASSERT(microBlockSizeTableIndex < sizeof(Block1K_3d) / sizeof(Block1K_3d[0]));
-
-        *pWidth  = Block1K_3d[microBlockSizeTableIndex].w << averageAmp;
-        *pHeight = Block1K_3d[microBlockSizeTableIndex].h << (averageAmp + (restAmp / 2));
-        *pDepth  = Block1K_3d[microBlockSizeTableIndex].d << (averageAmp + ((restAmp != 0) ? 1 : 0));
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   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
-{
-    ADDR_E_RETURNCODE returnCode;
-
-    if ((GetFillSizeFieldsFlags() == TRUE) &&
-        ((pIn->size != sizeof(ADDR2_GET_PREFERRED_SURF_SETTING_INPUT)) ||
-         (pOut->size != sizeof(ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT))))
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        returnCode = HwlGetPreferredSurfaceSetting(pIn, pOut);
-    }
-
-    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;
-}
-
-/**
-************************************************************************************************************************
-*   Lib::ComputeQbStereoInfo
-*
-*   @brief
-*       Get quad buffer stereo information
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Lib::ComputeQbStereoInfo(
-    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut    ///< [in,out] updated pOut+pStereoInfo
-    ) const
-{
-    ADDR_ASSERT(pOut->bpp >= 8);
-    ADDR_ASSERT((pOut->surfSize % pOut->baseAlign) == 0);
-
-    // Save original height
-    pOut->pStereoInfo->eyeHeight = pOut->height;
-
-    // Right offset
-    pOut->pStereoInfo->rightOffset = static_cast<UINT_32>(pOut->surfSize);
-
-    // Double height
-    pOut->height <<= 1;
-
-    ADDR_ASSERT(pOut->height <= MaxSurfaceHeight);
-
-    pOut->pixelHeight <<= 1;
-
-    // Double size
-    pOut->surfSize <<= 1;
-}
-
-
-} // V2
-} // Addr
-
diff --git a/src/amd/addrlib/core/addrlib2.h b/src/amd/addrlib/core/addrlib2.h
deleted file mode 100644 (file)
index d82e6c0..0000000
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * 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
-
-    UINT_32 isRtOpt         : 1;    // mode opt for render target
-};
-
-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);
-
-    ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
-        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
-        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*      pOut);
-
-    // 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);
-
-    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;
-
-    ADDR_E_RETURNCODE ComputeDccAddrFromCoord(
-        const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut);
-
-    // Misc
-    ADDR_E_RETURNCODE ComputePipeBankXor(
-        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
-        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut);
-
-    ADDR_E_RETURNCODE ComputeSlicePipeBankXor(
-        const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
-        ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut);
-
-    ADDR_E_RETURNCODE ComputeSubResourceOffsetForSwizzlePattern(
-        const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
-        ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut);
-
-    ADDR_E_RETURNCODE Addr2GetPreferredSurfaceSetting(
-        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
-        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const;
-
-    virtual BOOL_32 IsValidDisplaySwizzleMode(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTIMPLEMENTED;
-    }
-
-protected:
-    Lib();  // Constructor is protected
-    Lib(const Client* pClient);
-
-    static const UINT_32 MaxNumOfBpp = 5;
-
-    static const Dim2d Block256_2d[MaxNumOfBpp];
-    static const Dim3d Block1K_3d[MaxNumOfBpp];
-
-    static const UINT_32 PrtAlignment = 64 * 1024;
-    static const UINT_32 MaxMacroBits = 20;
-
-    static const UINT_32 MaxMipLevels = 16;
-
-    // Checking block size
-    BOOL_32 IsBlock256b(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].is256b;
-    }
-
-    BOOL_32 IsBlock4kb(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].is4kb;
-    }
-
-    BOOL_32 IsBlock64kb(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].is64kb;
-    }
-
-    BOOL_32 IsBlockVariable(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isVar;
-    }
-
-    // Checking swizzle mode
-    BOOL_32 IsLinear(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isLinear;
-    }
-
-    BOOL_32 IsRtOptSwizzle(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isRtOpt;
-    }
-
-    BOOL_32 IsZOrderSwizzle(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isZ;
-    }
-
-    BOOL_32 IsStandardSwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
-    {
-        return HwlIsStandardSwizzle(resourceType, swizzleMode);
-    }
-
-    BOOL_32 IsDisplaySwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
-    {
-        return HwlIsDisplaySwizzle(resourceType, swizzleMode);
-    }
-
-    BOOL_32 IsRotateSwizzle(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isRot;
-    }
-
-    BOOL_32 IsXor(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isXor;
-    }
-
-    BOOL_32 IsPrt(AddrSwizzleMode swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isT;
-    }
-
-    BOOL_32 IsNonPrtXor(AddrSwizzleMode swizzleMode) const
-    {
-        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);
-    }
-
-    BOOL_32 IsThick(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
-    {
-        return HwlIsThick(resourceType, swizzleMode);
-    }
-
-    BOOL_32 IsThin(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
-    {
-        return HwlIsThin(resourceType, swizzleMode);
-    }
-
-    UINT_32 GetBlockSizeLog2(AddrSwizzleMode swizzleMode) const
-    {
-        UINT_32 blockSizeLog2 = 0;
-
-        if (IsBlock256b(swizzleMode) || IsLinear(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 BOOL_32 HwlIsStandardSwizzle(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return FALSE;
-    }
-
-    virtual BOOL_32 HwlIsDisplaySwizzle(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return FALSE;
-    }
-
-    virtual BOOL_32 HwlIsThin(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return FALSE;
-    }
-
-    virtual BOOL_32 HwlIsThick(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return FALSE;
-    }
-
-    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 HwlComputeDccAddrFromCoord(
-        const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut)
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
-        const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*      pOut)
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
-        const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*      pOut)
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
-        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
-        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*      pOut)
-    {
-        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 ADDR_E_RETURNCODE HwlComputePipeBankXor(
-        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
-        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
-        const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
-        ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-
-    virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
-        const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
-        ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
-        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
-        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTSUPPORTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
-         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTIMPLEMENTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
-         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTIMPLEMENTED;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
-        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) const
-    {
-        ADDR_NOT_IMPLEMENTED();
-        return ADDR_NOTIMPLEMENTED;
-    }
-
-    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 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(
-        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;
-    }
-
-    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);
-    }
-
-    Dim3d GetMipTailDim(
-        AddrResourceType  resourceType,
-        AddrSwizzleMode   swizzleMode,
-        UINT_32           blockWidth,
-        UINT_32           blockHeight,
-        UINT_32           blockDepth) const;
-
-    BOOL_32 IsInMipTail(
-        AddrResourceType  resourceType,
-        AddrSwizzleMode   swizzleMode,
-        Dim3d             mipTailDim,
-        UINT_32           width,
-        UINT_32           height,
-        UINT_32           depth) const
-    {
-        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;
-
-    ADDR_E_RETURNCODE ApplyCustomizedPitchHeight(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        UINT_32                                 elementBytes,
-        UINT_32                                 pitchAlignInElement,
-        UINT_32*                                pPitch,
-        UINT_32*                                pHeight) const;
-
-    VOID ComputeQbStereoInfo(ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) 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
-
-    SwizzleModeFlags m_swizzleModeTable[ADDR_SW_MAX_TYPE];  ///< Swizzle mode table
-
-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/core/addrobject.cpp b/src/amd/addrlib/core/addrobject.cpp
deleted file mode 100644 (file)
index 452feb5..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright © 2014 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  addrobject.cpp
-* @brief Contains the Object base class implementation.
-****************************************************************************************************
-*/
-
-#include "addrinterface.h"
-#include "addrobject.h"
-
-namespace Addr
-{
-
-/**
-****************************************************************************************************
-*   Object::Object
-*
-*   @brief
-*       Constructor for the Object class.
-****************************************************************************************************
-*/
-Object::Object()
-{
-    m_client.handle = NULL;
-    m_client.callbacks.allocSysMem = NULL;
-    m_client.callbacks.freeSysMem = NULL;
-    m_client.callbacks.debugPrint = NULL;
-}
-
-/**
-****************************************************************************************************
-*   Object::Object
-*
-*   @brief
-*       Constructor for the Object class.
-****************************************************************************************************
-*/
-Object::Object(const Client* pClient)
-{
-    m_client = *pClient;
-}
-
-/**
-****************************************************************************************************
-*   Object::~Object
-*
-*   @brief
-*       Destructor for the Object class.
-****************************************************************************************************
-*/
-Object::~Object()
-{
-}
-
-/**
-****************************************************************************************************
-*   Object::ClientAlloc
-*
-*   @brief
-*       Calls instanced allocSysMem inside Client
-****************************************************************************************************
-*/
-VOID* Object::ClientAlloc(
-    size_t         objSize,    ///< [in] Size to allocate
-    const Client*  pClient)    ///< [in] Client pointer
-{
-    VOID* pObjMem = NULL;
-
-    if (pClient->callbacks.allocSysMem != NULL)
-    {
-        ADDR_ALLOCSYSMEM_INPUT allocInput = {0};
-
-        allocInput.size        = sizeof(ADDR_ALLOCSYSMEM_INPUT);
-        allocInput.flags.value = 0;
-        allocInput.sizeInBytes = static_cast<UINT_32>(objSize);
-        allocInput.hClient     = pClient->handle;
-
-        pObjMem = pClient->callbacks.allocSysMem(&allocInput);
-    }
-
-    return pObjMem;
-}
-
-/**
-****************************************************************************************************
-*   Object::Alloc
-*
-*   @brief
-*       A wrapper of ClientAlloc
-****************************************************************************************************
-*/
-VOID* Object::Alloc(
-    size_t objSize      ///< [in] Size to allocate
-    ) const
-{
-    return ClientAlloc(objSize, &m_client);
-}
-
-/**
-****************************************************************************************************
-*   Object::ClientFree
-*
-*   @brief
-*       Calls freeSysMem inside Client
-****************************************************************************************************
-*/
-VOID Object::ClientFree(
-    VOID*          pObjMem,    ///< [in] User virtual address to free.
-    const Client*  pClient)    ///< [in] Client pointer
-{
-    if (pClient->callbacks.freeSysMem != NULL)
-    {
-        if (pObjMem != NULL)
-        {
-            ADDR_FREESYSMEM_INPUT freeInput = {0};
-
-            freeInput.size      = sizeof(ADDR_FREESYSMEM_INPUT);
-            freeInput.hClient   = pClient->handle;
-            freeInput.pVirtAddr = pObjMem;
-
-            pClient->callbacks.freeSysMem(&freeInput);
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   Object::Free
-*
-*   @brief
-*       A wrapper of ClientFree
-****************************************************************************************************
-*/
-VOID Object::Free(
-    VOID* pObjMem       ///< [in] User virtual address to free.
-    ) const
-{
-    ClientFree(pObjMem, &m_client);
-}
-
-/**
-****************************************************************************************************
-*   Object::operator new
-*
-*   @brief
-*       Placement new operator. (with pre-allocated memory pointer)
-*
-*   @return
-*       Returns pre-allocated memory pointer.
-****************************************************************************************************
-*/
-VOID* Object::operator new(
-    size_t objSize,     ///< [in] Size to allocate
-    VOID*  pMem)        ///< [in] Pre-allocated pointer
-{
-    return pMem;
-}
-
-/**
-****************************************************************************************************
-*   Object::operator delete
-*
-*   @brief
-*       Frees Object object memory.
-****************************************************************************************************
-*/
-VOID Object::operator delete(
-    VOID* pObjMem)      ///< [in] User virtual address to free.
-{
-    Object* pObj = static_cast<Object*>(pObjMem);
-    ClientFree(pObjMem, &pObj->m_client);
-}
-
-/**
-****************************************************************************************************
-*   Object::DebugPrint
-*
-*   @brief
-*       Print debug message
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID Object::DebugPrint(
-    const CHAR* pDebugString,     ///< [in] Debug string
-    ...
-    ) const
-{
-#if DEBUG
-    if (m_client.callbacks.debugPrint != NULL)
-    {
-        ADDR_DEBUGPRINT_INPUT debugPrintInput = {0};
-
-        debugPrintInput.size         = sizeof(ADDR_DEBUGPRINT_INPUT);
-        debugPrintInput.pDebugString = const_cast<CHAR*>(pDebugString);
-        debugPrintInput.hClient      = m_client.handle;
-        va_start(debugPrintInput.ap, pDebugString);
-
-        m_client.callbacks.debugPrint(&debugPrintInput);
-
-        va_end(debugPrintInput.ap);
-    }
-#endif
-}
-
-} // Addr
diff --git a/src/amd/addrlib/core/addrobject.h b/src/amd/addrlib/core/addrobject.h
deleted file mode 100644 (file)
index 66886f6..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright © 2014 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  addrobject.h
-* @brief Contains the Object base class definition.
-****************************************************************************************************
-*/
-
-#ifndef __ADDR_OBJECT_H__
-#define __ADDR_OBJECT_H__
-
-#include "addrtypes.h"
-#include "addrcommon.h"
-
-namespace Addr
-{
-
-/**
-****************************************************************************************************
-* @brief This structure contains client specific data
-****************************************************************************************************
-*/
-struct Client
-{
-    ADDR_CLIENT_HANDLE  handle;
-    ADDR_CALLBACKS      callbacks;
-};
-/**
-****************************************************************************************************
-* @brief This class is the base class for all ADDR class objects.
-****************************************************************************************************
-*/
-class Object
-{
-public:
-    Object();
-    Object(const Client* pClient);
-    virtual ~Object();
-
-    VOID* operator new(size_t size, VOID* pMem);
-    VOID  operator delete(VOID* pObj);
-    /// Microsoft compiler requires a matching delete implementation, which seems to be called when
-    /// bad_alloc is thrown. But currently C++ exception isn't allowed so a dummy implementation is
-    /// added to eliminate the warning.
-    VOID  operator delete(VOID* pObj, VOID* pMem) { ADDR_ASSERT_ALWAYS(); }
-
-    VOID* Alloc(size_t size) const;
-    VOID  Free(VOID* pObj) const;
-
-    VOID DebugPrint(const CHAR* pDebugString, ...) const;
-
-    const Client* GetClient() const {return &m_client;}
-
-protected:
-    Client m_client;
-
-    static VOID* ClientAlloc(size_t size, const Client* pClient);
-    static VOID  ClientFree(VOID* pObj, const Client* pClient);
-
-private:
-    // disallow the copy constructor
-    Object(const Object& a);
-
-    // disallow the assignment operator
-    Object& operator=(const Object& a);
-};
-
-} // Addr
-#endif
-
diff --git a/src/amd/addrlib/gfx9/chip/gfx9_enum.h b/src/amd/addrlib/gfx9/chip/gfx9_enum.h
deleted file mode 100644 (file)
index c81101b..0000000
+++ /dev/null
@@ -1,10535 +0,0 @@
-/*
- * 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                           = 0x00000003,
-NUMBER_UINT                              = 0x00000004,
-NUMBER_SINT                              = 0x00000005,
-NUMBER_SRGB                              = 0x00000006,
-NUMBER_FLOAT                             = 0x00000007,
-} SurfaceNumber;
-
-/*
- * SurfaceSwap enum
- */
-
-typedef enum SurfaceSwap {
-SWAP_STD                                 = 0x00000000,
-SWAP_ALT                                 = 0x00000001,
-SWAP_STD_REV                             = 0x00000002,
-SWAP_ALT_REV                             = 0x00000003,
-} SurfaceSwap;
-
-/*
- * CBMode enum
- */
-
-typedef enum CBMode {
-CB_DISABLE                               = 0x00000000,
-CB_NORMAL                                = 0x00000001,
-CB_ELIMINATE_FAST_CLEAR                  = 0x00000002,
-CB_RESOLVE                               = 0x00000003,
-CB_DECOMPRESS                            = 0x00000004,
-CB_FMASK_DECOMPRESS                      = 0x00000005,
-CB_DCC_DECOMPRESS                        = 0x00000006,
-} CBMode;
-
-/*
- * RoundMode enum
- */
-
-typedef enum RoundMode {
-ROUND_BY_HALF                            = 0x00000000,
-ROUND_TRUNCATE                           = 0x00000001,
-} RoundMode;
-
-/*
- * SourceFormat enum
- */
-
-typedef enum SourceFormat {
-EXPORT_4C_32BPC                          = 0x00000000,
-EXPORT_4C_16BPC                          = 0x00000001,
-EXPORT_2C_32BPC_GR                       = 0x00000002,
-EXPORT_2C_32BPC_AR                       = 0x00000003,
-} SourceFormat;
-
-/*
- * BlendOp enum
- */
-
-typedef enum BlendOp {
-BLEND_ZERO                               = 0x00000000,
-BLEND_ONE                                = 0x00000001,
-BLEND_SRC_COLOR                          = 0x00000002,
-BLEND_ONE_MINUS_SRC_COLOR                = 0x00000003,
-BLEND_SRC_ALPHA                          = 0x00000004,
-BLEND_ONE_MINUS_SRC_ALPHA                = 0x00000005,
-BLEND_DST_ALPHA                          = 0x00000006,
-BLEND_ONE_MINUS_DST_ALPHA                = 0x00000007,
-BLEND_DST_COLOR                          = 0x00000008,
-BLEND_ONE_MINUS_DST_COLOR                = 0x00000009,
-BLEND_SRC_ALPHA_SATURATE                 = 0x0000000a,
-BLEND_BOTH_SRC_ALPHA                     = 0x0000000b,
-BLEND_BOTH_INV_SRC_ALPHA                 = 0x0000000c,
-BLEND_CONSTANT_COLOR                     = 0x0000000d,
-BLEND_ONE_MINUS_CONSTANT_COLOR           = 0x0000000e,
-BLEND_SRC1_COLOR                         = 0x0000000f,
-BLEND_INV_SRC1_COLOR                     = 0x00000010,
-BLEND_SRC1_ALPHA                         = 0x00000011,
-BLEND_INV_SRC1_ALPHA                     = 0x00000012,
-BLEND_CONSTANT_ALPHA                     = 0x00000013,
-BLEND_ONE_MINUS_CONSTANT_ALPHA           = 0x00000014,
-} BlendOp;
-
-/*
- * CombFunc enum
- */
-
-typedef enum CombFunc {
-COMB_DST_PLUS_SRC                        = 0x00000000,
-COMB_SRC_MINUS_DST                       = 0x00000001,
-COMB_MIN_DST_SRC                         = 0x00000002,
-COMB_MAX_DST_SRC                         = 0x00000003,
-COMB_DST_MINUS_SRC                       = 0x00000004,
-} CombFunc;
-
-/*
- * BlendOpt enum
- */
-
-typedef enum BlendOpt {
-FORCE_OPT_AUTO                           = 0x00000000,
-FORCE_OPT_DISABLE                        = 0x00000001,
-FORCE_OPT_ENABLE_IF_SRC_A_0              = 0x00000002,
-FORCE_OPT_ENABLE_IF_SRC_RGB_0            = 0x00000003,
-FORCE_OPT_ENABLE_IF_SRC_ARGB_0           = 0x00000004,
-FORCE_OPT_ENABLE_IF_SRC_A_1              = 0x00000005,
-FORCE_OPT_ENABLE_IF_SRC_RGB_1            = 0x00000006,
-FORCE_OPT_ENABLE_IF_SRC_ARGB_1           = 0x00000007,
-} BlendOpt;
-
-/*
- * CmaskCode enum
- */
-
-typedef enum CmaskCode {
-CMASK_CLR00_F0                           = 0x00000000,
-CMASK_CLR00_F1                           = 0x00000001,
-CMASK_CLR00_F2                           = 0x00000002,
-CMASK_CLR00_FX                           = 0x00000003,
-CMASK_CLR01_F0                           = 0x00000004,
-CMASK_CLR01_F1                           = 0x00000005,
-CMASK_CLR01_F2                           = 0x00000006,
-CMASK_CLR01_FX                           = 0x00000007,
-CMASK_CLR10_F0                           = 0x00000008,
-CMASK_CLR10_F1                           = 0x00000009,
-CMASK_CLR10_F2                           = 0x0000000a,
-CMASK_CLR10_FX                           = 0x0000000b,
-CMASK_CLR11_F0                           = 0x0000000c,
-CMASK_CLR11_F1                           = 0x0000000d,
-CMASK_CLR11_F2                           = 0x0000000e,
-CMASK_CLR11_FX                           = 0x0000000f,
-} CmaskCode;
-
-/*
- * CmaskAddr enum
- */
-
-typedef enum CmaskAddr {
-CMASK_ADDR_TILED                         = 0x00000000,
-CMASK_ADDR_LINEAR                        = 0x00000001,
-CMASK_ADDR_COMPATIBLE                    = 0x00000002,
-} CmaskAddr;
-
-/*
- * MemArbMode enum
- */
-
-typedef enum MemArbMode {
-MEM_ARB_MODE_FIXED                       = 0x00000000,
-MEM_ARB_MODE_AGE                         = 0x00000001,
-MEM_ARB_MODE_WEIGHT                      = 0x00000002,
-MEM_ARB_MODE_BOTH                        = 0x00000003,
-} MemArbMode;
-
-/*
- * CBPerfSel enum
- */
-
-typedef enum CBPerfSel {
-CB_PERF_SEL_NONE                         = 0x00000000,
-CB_PERF_SEL_BUSY                         = 0x00000001,
-CB_PERF_SEL_CORE_SCLK_VLD                = 0x00000002,
-CB_PERF_SEL_REG_SCLK0_VLD                = 0x00000003,
-CB_PERF_SEL_REG_SCLK1_VLD                = 0x00000004,
-CB_PERF_SEL_DRAWN_QUAD                   = 0x00000005,
-CB_PERF_SEL_DRAWN_PIXEL                  = 0x00000006,
-CB_PERF_SEL_DRAWN_QUAD_FRAGMENT          = 0x00000007,
-CB_PERF_SEL_DRAWN_TILE                   = 0x00000008,
-CB_PERF_SEL_DB_CB_TILE_VALID_READY       = 0x00000009,
-CB_PERF_SEL_DB_CB_TILE_VALID_READYB      = 0x0000000a,
-CB_PERF_SEL_DB_CB_TILE_VALIDB_READY      = 0x0000000b,
-CB_PERF_SEL_DB_CB_TILE_VALIDB_READYB     = 0x0000000c,
-CB_PERF_SEL_CM_FC_TILE_VALID_READY       = 0x0000000d,
-CB_PERF_SEL_CM_FC_TILE_VALID_READYB      = 0x0000000e,
-CB_PERF_SEL_CM_FC_TILE_VALIDB_READY      = 0x0000000f,
-CB_PERF_SEL_CM_FC_TILE_VALIDB_READYB     = 0x00000010,
-CB_PERF_SEL_MERGE_TILE_ONLY_VALID_READY  = 0x00000011,
-CB_PERF_SEL_MERGE_TILE_ONLY_VALID_READYB  = 0x00000012,
-CB_PERF_SEL_DB_CB_LQUAD_VALID_READY      = 0x00000013,
-CB_PERF_SEL_DB_CB_LQUAD_VALID_READYB     = 0x00000014,
-CB_PERF_SEL_DB_CB_LQUAD_VALIDB_READY     = 0x00000015,
-CB_PERF_SEL_DB_CB_LQUAD_VALIDB_READYB    = 0x00000016,
-CB_PERF_SEL_LQUAD_NO_TILE                = 0x00000017,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_32_R  = 0x00000018,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_32_AR  = 0x00000019,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_32_GR  = 0x0000001a,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_32_ABGR  = 0x0000001b,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_FP16_ABGR  = 0x0000001c,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_SIGNED16_ABGR  = 0x0000001d,
-CB_PERF_SEL_LQUAD_FORMAT_IS_EXPORT_UNSIGNED16_ABGR  = 0x0000001e,
-CB_PERF_SEL_QUAD_KILLED_BY_EXTRA_PIXEL_EXPORT  = 0x0000001f,
-CB_PERF_SEL_QUAD_KILLED_BY_COLOR_INVALID  = 0x00000020,
-CB_PERF_SEL_QUAD_KILLED_BY_NULL_TARGET_SHADER_MASK  = 0x00000021,
-CB_PERF_SEL_QUAD_KILLED_BY_NULL_SAMPLE_MASK  = 0x00000022,
-CB_PERF_SEL_QUAD_KILLED_BY_DISCARD_PIXEL  = 0x00000023,
-CB_PERF_SEL_FC_CLEAR_QUAD_VALID_READY    = 0x00000024,
-CB_PERF_SEL_FC_CLEAR_QUAD_VALID_READYB   = 0x00000025,
-CB_PERF_SEL_FC_CLEAR_QUAD_VALIDB_READY   = 0x00000026,
-CB_PERF_SEL_FC_CLEAR_QUAD_VALIDB_READYB  = 0x00000027,
-CB_PERF_SEL_FOP_IN_VALID_READY           = 0x00000028,
-CB_PERF_SEL_FOP_IN_VALID_READYB          = 0x00000029,
-CB_PERF_SEL_FOP_IN_VALIDB_READY          = 0x0000002a,
-CB_PERF_SEL_FOP_IN_VALIDB_READYB         = 0x0000002b,
-CB_PERF_SEL_FC_CC_QUADFRAG_VALID_READY   = 0x0000002c,
-CB_PERF_SEL_FC_CC_QUADFRAG_VALID_READYB  = 0x0000002d,
-CB_PERF_SEL_FC_CC_QUADFRAG_VALIDB_READY  = 0x0000002e,
-CB_PERF_SEL_FC_CC_QUADFRAG_VALIDB_READYB  = 0x0000002f,
-CB_PERF_SEL_CC_IB_SR_FRAG_VALID_READY    = 0x00000030,
-CB_PERF_SEL_CC_IB_SR_FRAG_VALID_READYB   = 0x00000031,
-CB_PERF_SEL_CC_IB_SR_FRAG_VALIDB_READY   = 0x00000032,
-CB_PERF_SEL_CC_IB_SR_FRAG_VALIDB_READYB  = 0x00000033,
-CB_PERF_SEL_CC_IB_TB_FRAG_VALID_READY    = 0x00000034,
-CB_PERF_SEL_CC_IB_TB_FRAG_VALID_READYB   = 0x00000035,
-CB_PERF_SEL_CC_IB_TB_FRAG_VALIDB_READY   = 0x00000036,
-CB_PERF_SEL_CC_IB_TB_FRAG_VALIDB_READYB  = 0x00000037,
-CB_PERF_SEL_CC_RB_BC_EVENFRAG_VALID_READY  = 0x00000038,
-CB_PERF_SEL_CC_RB_BC_EVENFRAG_VALID_READYB  = 0x00000039,
-CB_PERF_SEL_CC_RB_BC_EVENFRAG_VALIDB_READY  = 0x0000003a,
-CB_PERF_SEL_CC_RB_BC_EVENFRAG_VALIDB_READYB  = 0x0000003b,
-CB_PERF_SEL_CC_RB_BC_ODDFRAG_VALID_READY  = 0x0000003c,
-CB_PERF_SEL_CC_RB_BC_ODDFRAG_VALID_READYB  = 0x0000003d,
-CB_PERF_SEL_CC_RB_BC_ODDFRAG_VALIDB_READY  = 0x0000003e,
-CB_PERF_SEL_CC_RB_BC_ODDFRAG_VALIDB_READYB  = 0x0000003f,
-CB_PERF_SEL_CC_BC_CS_FRAG_VALID          = 0x00000040,
-CB_PERF_SEL_CM_CACHE_HIT                 = 0x00000041,
-CB_PERF_SEL_CM_CACHE_TAG_MISS            = 0x00000042,
-CB_PERF_SEL_CM_CACHE_SECTOR_MISS         = 0x00000043,
-CB_PERF_SEL_CM_CACHE_REEVICTION_STALL    = 0x00000044,
-CB_PERF_SEL_CM_CACHE_EVICT_NONZERO_INFLIGHT_STALL  = 0x00000045,
-CB_PERF_SEL_CM_CACHE_REPLACE_PENDING_EVICT_STALL  = 0x00000046,
-CB_PERF_SEL_CM_CACHE_INFLIGHT_COUNTER_MAXIMUM_STALL  = 0x00000047,
-CB_PERF_SEL_CM_CACHE_READ_OUTPUT_STALL   = 0x00000048,
-CB_PERF_SEL_CM_CACHE_WRITE_OUTPUT_STALL  = 0x00000049,
-CB_PERF_SEL_CM_CACHE_ACK_OUTPUT_STALL    = 0x0000004a,
-CB_PERF_SEL_CM_CACHE_STALL               = 0x0000004b,
-CB_PERF_SEL_CM_CACHE_FLUSH               = 0x0000004c,
-CB_PERF_SEL_CM_CACHE_TAGS_FLUSHED        = 0x0000004d,
-CB_PERF_SEL_CM_CACHE_SECTORS_FLUSHED     = 0x0000004e,
-CB_PERF_SEL_CM_CACHE_DIRTY_SECTORS_FLUSHED  = 0x0000004f,
-CB_PERF_SEL_FC_CACHE_HIT                 = 0x00000050,
-CB_PERF_SEL_FC_CACHE_TAG_MISS            = 0x00000051,
-CB_PERF_SEL_FC_CACHE_SECTOR_MISS         = 0x00000052,
-CB_PERF_SEL_FC_CACHE_REEVICTION_STALL    = 0x00000053,
-CB_PERF_SEL_FC_CACHE_EVICT_NONZERO_INFLIGHT_STALL  = 0x00000054,
-CB_PERF_SEL_FC_CACHE_REPLACE_PENDING_EVICT_STALL  = 0x00000055,
-CB_PERF_SEL_FC_CACHE_INFLIGHT_COUNTER_MAXIMUM_STALL  = 0x00000056,
-CB_PERF_SEL_FC_CACHE_READ_OUTPUT_STALL   = 0x00000057,
-CB_PERF_SEL_FC_CACHE_WRITE_OUTPUT_STALL  = 0x00000058,
-CB_PERF_SEL_FC_CACHE_ACK_OUTPUT_STALL    = 0x00000059,
-CB_PERF_SEL_FC_CACHE_STALL               = 0x0000005a,
-CB_PERF_SEL_FC_CACHE_FLUSH               = 0x0000005b,
-CB_PERF_SEL_FC_CACHE_TAGS_FLUSHED        = 0x0000005c,
-CB_PERF_SEL_FC_CACHE_SECTORS_FLUSHED     = 0x0000005d,
-CB_PERF_SEL_FC_CACHE_DIRTY_SECTORS_FLUSHED  = 0x0000005e,
-CB_PERF_SEL_CC_CACHE_HIT                 = 0x0000005f,
-CB_PERF_SEL_CC_CACHE_TAG_MISS            = 0x00000060,
-CB_PERF_SEL_CC_CACHE_SECTOR_MISS         = 0x00000061,
-CB_PERF_SEL_CC_CACHE_REEVICTION_STALL    = 0x00000062,
-CB_PERF_SEL_CC_CACHE_EVICT_NONZERO_INFLIGHT_STALL  = 0x00000063,
-CB_PERF_SEL_CC_CACHE_REPLACE_PENDING_EVICT_STALL  = 0x00000064,
-CB_PERF_SEL_CC_CACHE_INFLIGHT_COUNTER_MAXIMUM_STALL  = 0x00000065,
-CB_PERF_SEL_CC_CACHE_READ_OUTPUT_STALL   = 0x00000066,
-CB_PERF_SEL_CC_CACHE_WRITE_OUTPUT_STALL  = 0x00000067,
-CB_PERF_SEL_CC_CACHE_ACK_OUTPUT_STALL    = 0x00000068,
-CB_PERF_SEL_CC_CACHE_STALL               = 0x00000069,
-CB_PERF_SEL_CC_CACHE_FLUSH               = 0x0000006a,
-CB_PERF_SEL_CC_CACHE_TAGS_FLUSHED        = 0x0000006b,
-CB_PERF_SEL_CC_CACHE_SECTORS_FLUSHED     = 0x0000006c,
-CB_PERF_SEL_CC_CACHE_DIRTY_SECTORS_FLUSHED  = 0x0000006d,
-CB_PERF_SEL_CC_CACHE_WA_TO_RMW_CONVERSION  = 0x0000006e,
-CB_PERF_SEL_CC_CACHE_READS_SAVED_DUE_TO_DCC  = 0x0000006f,
-CB_PERF_SEL_CB_TAP_WRREQ_VALID_READY     = 0x00000070,
-CB_PERF_SEL_CB_TAP_WRREQ_VALID_READYB    = 0x00000071,
-CB_PERF_SEL_CB_TAP_WRREQ_VALIDB_READY    = 0x00000072,
-CB_PERF_SEL_CB_TAP_WRREQ_VALIDB_READYB   = 0x00000073,
-CB_PERF_SEL_CM_MC_WRITE_REQUEST          = 0x00000074,
-CB_PERF_SEL_FC_MC_WRITE_REQUEST          = 0x00000075,
-CB_PERF_SEL_CC_MC_WRITE_REQUEST          = 0x00000076,
-CB_PERF_SEL_CM_MC_WRITE_REQUESTS_IN_FLIGHT  = 0x00000077,
-CB_PERF_SEL_FC_MC_WRITE_REQUESTS_IN_FLIGHT  = 0x00000078,
-CB_PERF_SEL_CC_MC_WRITE_REQUESTS_IN_FLIGHT  = 0x00000079,
-CB_PERF_SEL_CB_TAP_RDREQ_VALID_READY     = 0x0000007a,
-CB_PERF_SEL_CB_TAP_RDREQ_VALID_READYB    = 0x0000007b,
-CB_PERF_SEL_CB_TAP_RDREQ_VALIDB_READY    = 0x0000007c,
-CB_PERF_SEL_CB_TAP_RDREQ_VALIDB_READYB   = 0x0000007d,
-CB_PERF_SEL_CM_MC_READ_REQUEST           = 0x0000007e,
-CB_PERF_SEL_FC_MC_READ_REQUEST           = 0x0000007f,
-CB_PERF_SEL_CC_MC_READ_REQUEST           = 0x00000080,
-CB_PERF_SEL_CM_MC_READ_REQUESTS_IN_FLIGHT  = 0x00000081,
-CB_PERF_SEL_FC_MC_READ_REQUESTS_IN_FLIGHT  = 0x00000082,
-CB_PERF_SEL_CC_MC_READ_REQUESTS_IN_FLIGHT  = 0x00000083,
-CB_PERF_SEL_CM_TQ_FULL                   = 0x00000084,
-CB_PERF_SEL_CM_TQ_FIFO_TILE_RESIDENCY_STALL  = 0x00000085,
-CB_PERF_SEL_FC_QUAD_RDLAT_FIFO_FULL      = 0x00000086,
-CB_PERF_SEL_FC_TILE_RDLAT_FIFO_FULL      = 0x00000087,
-CB_PERF_SEL_FC_RDLAT_FIFO_QUAD_RESIDENCY_STALL  = 0x00000088,
-CB_PERF_SEL_FOP_FMASK_RAW_STALL          = 0x00000089,
-CB_PERF_SEL_FOP_FMASK_BYPASS_STALL       = 0x0000008a,
-CB_PERF_SEL_CC_SF_FULL                   = 0x0000008b,
-CB_PERF_SEL_CC_RB_FULL                   = 0x0000008c,
-CB_PERF_SEL_CC_EVENFIFO_QUAD_RESIDENCY_STALL  = 0x0000008d,
-CB_PERF_SEL_CC_ODDFIFO_QUAD_RESIDENCY_STALL  = 0x0000008e,
-CB_PERF_SEL_BLENDER_RAW_HAZARD_STALL     = 0x0000008f,
-CB_PERF_SEL_EVENT                        = 0x00000090,
-CB_PERF_SEL_EVENT_CACHE_FLUSH_TS         = 0x00000091,
-CB_PERF_SEL_EVENT_CONTEXT_DONE           = 0x00000092,
-CB_PERF_SEL_EVENT_CACHE_FLUSH            = 0x00000093,
-CB_PERF_SEL_EVENT_CACHE_FLUSH_AND_INV_TS_EVENT  = 0x00000094,
-CB_PERF_SEL_EVENT_CACHE_FLUSH_AND_INV_EVENT  = 0x00000095,
-CB_PERF_SEL_EVENT_FLUSH_AND_INV_CB_DATA_TS  = 0x00000096,
-CB_PERF_SEL_EVENT_FLUSH_AND_INV_CB_META  = 0x00000097,
-CB_PERF_SEL_CC_SURFACE_SYNC              = 0x00000098,
-CB_PERF_SEL_CMASK_READ_DATA_0xC          = 0x00000099,
-CB_PERF_SEL_CMASK_READ_DATA_0xD          = 0x0000009a,
-CB_PERF_SEL_CMASK_READ_DATA_0xE          = 0x0000009b,
-CB_PERF_SEL_CMASK_READ_DATA_0xF          = 0x0000009c,
-CB_PERF_SEL_CMASK_WRITE_DATA_0xC         = 0x0000009d,
-CB_PERF_SEL_CMASK_WRITE_DATA_0xD         = 0x0000009e,
-CB_PERF_SEL_CMASK_WRITE_DATA_0xE         = 0x0000009f,
-CB_PERF_SEL_CMASK_WRITE_DATA_0xF         = 0x000000a0,
-CB_PERF_SEL_TWO_PROBE_QUAD_FRAGMENT      = 0x000000a1,
-CB_PERF_SEL_EXPORT_32_ABGR_QUAD_FRAGMENT  = 0x000000a2,
-CB_PERF_SEL_DUAL_SOURCE_COLOR_QUAD_FRAGMENT  = 0x000000a3,
-CB_PERF_SEL_QUAD_HAS_1_FRAGMENT_BEFORE_UPDATE  = 0x000000a4,
-CB_PERF_SEL_QUAD_HAS_2_FRAGMENTS_BEFORE_UPDATE  = 0x000000a5,
-CB_PERF_SEL_QUAD_HAS_3_FRAGMENTS_BEFORE_UPDATE  = 0x000000a6,
-CB_PERF_SEL_QUAD_HAS_4_FRAGMENTS_BEFORE_UPDATE  = 0x000000a7,
-CB_PERF_SEL_QUAD_HAS_5_FRAGMENTS_BEFORE_UPDATE  = 0x000000a8,
-CB_PERF_SEL_QUAD_HAS_6_FRAGMENTS_BEFORE_UPDATE  = 0x000000a9,
-CB_PERF_SEL_QUAD_HAS_7_FRAGMENTS_BEFORE_UPDATE  = 0x000000aa,
-CB_PERF_SEL_QUAD_HAS_8_FRAGMENTS_BEFORE_UPDATE  = 0x000000ab,
-CB_PERF_SEL_QUAD_HAS_1_FRAGMENT_AFTER_UPDATE  = 0x000000ac,
-CB_PERF_SEL_QUAD_HAS_2_FRAGMENTS_AFTER_UPDATE  = 0x000000ad,
-CB_PERF_SEL_QUAD_HAS_3_FRAGMENTS_AFTER_UPDATE  = 0x000000ae,
-CB_PERF_SEL_QUAD_HAS_4_FRAGMENTS_AFTER_UPDATE  = 0x000000af,
-CB_PERF_SEL_QUAD_HAS_5_FRAGMENTS_AFTER_UPDATE  = 0x000000b0,
-CB_PERF_SEL_QUAD_HAS_6_FRAGMENTS_AFTER_UPDATE  = 0x000000b1,
-CB_PERF_SEL_QUAD_HAS_7_FRAGMENTS_AFTER_UPDATE  = 0x000000b2,
-CB_PERF_SEL_QUAD_HAS_8_FRAGMENTS_AFTER_UPDATE  = 0x000000b3,
-CB_PERF_SEL_QUAD_ADDED_1_FRAGMENT        = 0x000000b4,
-CB_PERF_SEL_QUAD_ADDED_2_FRAGMENTS       = 0x000000b5,
-CB_PERF_SEL_QUAD_ADDED_3_FRAGMENTS       = 0x000000b6,
-CB_PERF_SEL_QUAD_ADDED_4_FRAGMENTS       = 0x000000b7,
-CB_PERF_SEL_QUAD_ADDED_5_FRAGMENTS       = 0x000000b8,
-CB_PERF_SEL_QUAD_ADDED_6_FRAGMENTS       = 0x000000b9,
-CB_PERF_SEL_QUAD_ADDED_7_FRAGMENTS       = 0x000000ba,
-CB_PERF_SEL_QUAD_REMOVED_1_FRAGMENT      = 0x000000bb,
-CB_PERF_SEL_QUAD_REMOVED_2_FRAGMENTS     = 0x000000bc,
-CB_PERF_SEL_QUAD_REMOVED_3_FRAGMENTS     = 0x000000bd,
-CB_PERF_SEL_QUAD_REMOVED_4_FRAGMENTS     = 0x000000be,
-CB_PERF_SEL_QUAD_REMOVED_5_FRAGMENTS     = 0x000000bf,
-CB_PERF_SEL_QUAD_REMOVED_6_FRAGMENTS     = 0x000000c0,
-CB_PERF_SEL_QUAD_REMOVED_7_FRAGMENTS     = 0x000000c1,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_0        = 0x000000c2,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_1        = 0x000000c3,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_2        = 0x000000c4,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_3        = 0x000000c5,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_4        = 0x000000c6,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_5        = 0x000000c7,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_6        = 0x000000c8,
-CB_PERF_SEL_QUAD_READS_FRAGMENT_7        = 0x000000c9,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_0       = 0x000000ca,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_1       = 0x000000cb,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_2       = 0x000000cc,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_3       = 0x000000cd,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_4       = 0x000000ce,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_5       = 0x000000cf,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_6       = 0x000000d0,
-CB_PERF_SEL_QUAD_WRITES_FRAGMENT_7       = 0x000000d1,
-CB_PERF_SEL_QUAD_BLEND_OPT_DONT_READ_DST  = 0x000000d2,
-CB_PERF_SEL_QUAD_BLEND_OPT_BLEND_BYPASS  = 0x000000d3,
-CB_PERF_SEL_QUAD_BLEND_OPT_DISCARD_PIXELS  = 0x000000d4,
-CB_PERF_SEL_QUAD_DST_READ_COULD_HAVE_BEEN_OPTIMIZED  = 0x000000d5,
-CB_PERF_SEL_QUAD_BLENDING_COULD_HAVE_BEEN_BYPASSED  = 0x000000d6,
-CB_PERF_SEL_QUAD_COULD_HAVE_BEEN_DISCARDED  = 0x000000d7,
-CB_PERF_SEL_BLEND_OPT_PIXELS_RESULT_EQ_DEST  = 0x000000d8,
-CB_PERF_SEL_DRAWN_BUSY                   = 0x000000d9,
-CB_PERF_SEL_TILE_TO_CMR_REGION_BUSY      = 0x000000da,
-CB_PERF_SEL_CMR_TO_FCR_REGION_BUSY       = 0x000000db,
-CB_PERF_SEL_FCR_TO_CCR_REGION_BUSY       = 0x000000dc,
-CB_PERF_SEL_CCR_TO_CCW_REGION_BUSY       = 0x000000dd,
-CB_PERF_SEL_FC_PF_SLOW_MODE_QUAD_EMPTY_HALF_DROPPED  = 0x000000de,
-CB_PERF_SEL_FC_SEQUENCER_CLEAR           = 0x000000df,
-CB_PERF_SEL_FC_SEQUENCER_ELIMINATE_FAST_CLEAR  = 0x000000e0,
-CB_PERF_SEL_FC_SEQUENCER_FMASK_DECOMPRESS  = 0x000000e1,
-CB_PERF_SEL_FC_SEQUENCER_FMASK_COMPRESSION_DISABLE  = 0x000000e2,
-CB_PERF_SEL_FC_KEYID_RDLAT_FIFO_FULL     = 0x000000e3,
-CB_PERF_SEL_FC_DOC_IS_STALLED            = 0x000000e4,
-CB_PERF_SEL_FC_DOC_MRTS_NOT_COMBINED     = 0x000000e5,
-CB_PERF_SEL_FC_DOC_MRTS_COMBINED         = 0x000000e6,
-CB_PERF_SEL_FC_DOC_QTILE_CAM_MISS        = 0x000000e7,
-CB_PERF_SEL_FC_DOC_QTILE_CAM_HIT         = 0x000000e8,
-CB_PERF_SEL_FC_DOC_CLINE_CAM_MISS        = 0x000000e9,
-CB_PERF_SEL_FC_DOC_CLINE_CAM_HIT         = 0x000000ea,
-CB_PERF_SEL_FC_DOC_QUAD_PTR_FIFO_IS_FULL  = 0x000000eb,
-CB_PERF_SEL_FC_DOC_OVERWROTE_1_SECTOR    = 0x000000ec,
-CB_PERF_SEL_FC_DOC_OVERWROTE_2_SECTORS   = 0x000000ed,
-CB_PERF_SEL_FC_DOC_OVERWROTE_3_SECTORS   = 0x000000ee,
-CB_PERF_SEL_FC_DOC_OVERWROTE_4_SECTORS   = 0x000000ef,
-CB_PERF_SEL_FC_DOC_TOTAL_OVERWRITTEN_SECTORS  = 0x000000f0,
-CB_PERF_SEL_FC_DCC_CACHE_HIT             = 0x000000f1,
-CB_PERF_SEL_FC_DCC_CACHE_TAG_MISS        = 0x000000f2,
-CB_PERF_SEL_FC_DCC_CACHE_SECTOR_MISS     = 0x000000f3,
-CB_PERF_SEL_FC_DCC_CACHE_REEVICTION_STALL  = 0x000000f4,
-CB_PERF_SEL_FC_DCC_CACHE_EVICT_NONZERO_INFLIGHT_STALL  = 0x000000f5,
-CB_PERF_SEL_FC_DCC_CACHE_REPLACE_PENDING_EVICT_STALL  = 0x000000f6,
-CB_PERF_SEL_FC_DCC_CACHE_INFLIGHT_COUNTER_MAXIMUM_STALL  = 0x000000f7,
-CB_PERF_SEL_FC_DCC_CACHE_READ_OUTPUT_STALL  = 0x000000f8,
-CB_PERF_SEL_FC_DCC_CACHE_WRITE_OUTPUT_STALL  = 0x000000f9,
-CB_PERF_SEL_FC_DCC_CACHE_ACK_OUTPUT_STALL  = 0x000000fa,
-CB_PERF_SEL_FC_DCC_CACHE_STALL           = 0x000000fb,
-CB_PERF_SEL_FC_DCC_CACHE_FLUSH           = 0x000000fc,
-CB_PERF_SEL_FC_DCC_CACHE_TAGS_FLUSHED    = 0x000000fd,
-CB_PERF_SEL_FC_DCC_CACHE_SECTORS_FLUSHED  = 0x000000fe,
-CB_PERF_SEL_FC_DCC_CACHE_DIRTY_SECTORS_FLUSHED  = 0x000000ff,
-CB_PERF_SEL_CC_DCC_BEYOND_TILE_SPLIT     = 0x00000100,
-CB_PERF_SEL_FC_MC_DCC_WRITE_REQUEST      = 0x00000101,
-CB_PERF_SEL_FC_MC_DCC_WRITE_REQUESTS_IN_FLIGHT  = 0x00000102,
-CB_PERF_SEL_FC_MC_DCC_READ_REQUEST       = 0x00000103,
-CB_PERF_SEL_FC_MC_DCC_READ_REQUESTS_IN_FLIGHT  = 0x00000104,
-CB_PERF_SEL_CC_DCC_RDREQ_STALL           = 0x00000105,
-CB_PERF_SEL_CC_DCC_DECOMPRESS_TIDS_IN    = 0x00000106,
-CB_PERF_SEL_CC_DCC_DECOMPRESS_TIDS_OUT   = 0x00000107,
-CB_PERF_SEL_CC_DCC_COMPRESS_TIDS_IN      = 0x00000108,
-CB_PERF_SEL_CC_DCC_COMPRESS_TIDS_OUT     = 0x00000109,
-CB_PERF_SEL_FC_DCC_KEY_VALUE__CLEAR      = 0x0000010a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__4_BLOCKS__2TO1  = 0x0000010b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__3BLOCKS_2TO1__1BLOCK_2TO2  = 0x0000010c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO1__1BLOCK_2TO2__1BLOCK_2TO1  = 0x0000010d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_2TO2__2BLOCKS_2TO1  = 0x0000010e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__3BLOCKS_2TO1  = 0x0000010f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO1__2BLOCKS_2TO2  = 0x00000110,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__2BLOCKS_2TO2__1BLOCK_2TO1  = 0x00000111,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_2TO2__1BLOCK_2TO1__1BLOCK_2TO2  = 0x00000112,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_2TO1__1BLOCK_2TO2__1BLOCK_2TO1  = 0x00000113,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO2__2BLOCKS_2TO1  = 0x00000114,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__2BLOCKS_2TO1__1BLOCK_2TO2  = 0x00000115,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__3BLOCKS_2TO2  = 0x00000116,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_2TO1__2BLOCKS_2TO2  = 0x00000117,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO2__1BLOCK_2TO1__1BLOCK_2TO2  = 0x00000118,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__3BLOCKS_2TO2__1BLOCK_2TO1  = 0x00000119,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_4TO1  = 0x0000011a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__1BLOCK_4TO2  = 0x0000011b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__1BLOCK_4TO3  = 0x0000011c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__1BLOCK_4TO4  = 0x0000011d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__1BLOCK_4TO1  = 0x0000011e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_4TO2  = 0x0000011f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__1BLOCK_4TO3  = 0x00000120,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__1BLOCK_4TO4  = 0x00000121,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__1BLOCK_4TO1  = 0x00000122,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__1BLOCK_4TO2  = 0x00000123,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_4TO3  = 0x00000124,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__1BLOCK_4TO4  = 0x00000125,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO4__1BLOCK_4TO1  = 0x00000126,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO4__1BLOCK_4TO2  = 0x00000127,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO4__1BLOCK_4TO3  = 0x00000128,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO1__1BLOCK_4TO1  = 0x00000129,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO1__1BLOCK_4TO2  = 0x0000012a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO1__1BLOCK_4TO3  = 0x0000012b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO1__1BLOCK_4TO4  = 0x0000012c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_2TO2__1BLOCK_4TO1  = 0x0000012d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_2TO2__1BLOCK_4TO2  = 0x0000012e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_2TO2__1BLOCK_4TO3  = 0x0000012f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_2TO2__1BLOCK_4TO4  = 0x00000130,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_2TO1__1BLOCK_4TO1  = 0x00000131,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_2TO1__1BLOCK_4TO2  = 0x00000132,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_2TO1__1BLOCK_4TO3  = 0x00000133,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_2TO1__1BLOCK_4TO4  = 0x00000134,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO2__1BLOCK_4TO1  = 0x00000135,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO2__1BLOCK_4TO2  = 0x00000136,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__2BLOCKS_2TO2__1BLOCK_4TO3  = 0x00000137,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO1__1BLOCK_2TO1  = 0x00000138,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO2__1BLOCK_2TO1  = 0x00000139,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO3__1BLOCK_2TO1  = 0x0000013a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO4__1BLOCK_2TO1  = 0x0000013b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO1__1BLOCK_2TO1  = 0x0000013c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO2__1BLOCK_2TO1  = 0x0000013d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO3__1BLOCK_2TO1  = 0x0000013e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO4__1BLOCK_2TO1  = 0x0000013f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO1__1BLOCK_2TO2  = 0x00000140,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO2__1BLOCK_2TO2  = 0x00000141,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO3__1BLOCK_2TO2  = 0x00000142,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_4TO4__1BLOCK_2TO2  = 0x00000143,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO1__1BLOCK_2TO2  = 0x00000144,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO2__1BLOCK_2TO2  = 0x00000145,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_4TO3__1BLOCK_2TO2  = 0x00000146,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__2BLOCKS_2TO1  = 0x00000147,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__2BLOCKS_2TO1  = 0x00000148,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__2BLOCKS_2TO1  = 0x00000149,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO4__2BLOCKS_2TO1  = 0x0000014a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__2BLOCKS_2TO2  = 0x0000014b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__2BLOCKS_2TO2  = 0x0000014c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__2BLOCKS_2TO2  = 0x0000014d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__1BLOCK_2TO1__1BLOCK_2TO2  = 0x0000014e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__1BLOCK_2TO1__1BLOCK_2TO2  = 0x0000014f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__1BLOCK_2TO1__1BLOCK_2TO2  = 0x00000150,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO4__1BLOCK_2TO1__1BLOCK_2TO2  = 0x00000151,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO1__1BLOCK_2TO2__1BLOCK_2TO1  = 0x00000152,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO2__1BLOCK_2TO2__1BLOCK_2TO1  = 0x00000153,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO3__1BLOCK_2TO2__1BLOCK_2TO1  = 0x00000154,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_4TO4__1BLOCK_2TO2__1BLOCK_2TO1  = 0x00000155,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_6TO1  = 0x00000156,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_6TO2  = 0x00000157,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_6TO3  = 0x00000158,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_6TO4  = 0x00000159,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_6TO5  = 0x0000015a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__1BLOCK_6TO6  = 0x0000015b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__INV0  = 0x0000015c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO1__INV1  = 0x0000015d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_6TO1  = 0x0000015e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_6TO2  = 0x0000015f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_6TO3  = 0x00000160,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_6TO4  = 0x00000161,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__1BLOCK_6TO5  = 0x00000162,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__INV0  = 0x00000163,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_2TO2__INV1  = 0x00000164,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO1__1BLOCK_2TO1  = 0x00000165,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO2__1BLOCK_2TO1  = 0x00000166,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO3__1BLOCK_2TO1  = 0x00000167,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO4__1BLOCK_2TO1  = 0x00000168,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO5__1BLOCK_2TO1  = 0x00000169,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO6__1BLOCK_2TO1  = 0x0000016a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__INV0__1BLOCK_2TO1  = 0x0000016b,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__INV1__1BLOCK_2TO1  = 0x0000016c,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO1__1BLOCK_2TO2  = 0x0000016d,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO2__1BLOCK_2TO2  = 0x0000016e,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO3__1BLOCK_2TO2  = 0x0000016f,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO4__1BLOCK_2TO2  = 0x00000170,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_6TO5__1BLOCK_2TO2  = 0x00000171,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__INV0__1BLOCK_2TO2  = 0x00000172,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__INV1__1BLOCK_2TO2  = 0x00000173,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO1  = 0x00000174,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO2  = 0x00000175,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO3  = 0x00000176,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO4  = 0x00000177,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO5  = 0x00000178,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO6  = 0x00000179,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__1BLOCK_8TO7  = 0x0000017a,
-CB_PERF_SEL_CC_DCC_KEY_VALUE__UNCOMPRESSED  = 0x0000017b,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_2TO1   = 0x0000017c,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_4TO1   = 0x0000017d,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_4TO2   = 0x0000017e,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_4TO3   = 0x0000017f,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_6TO1   = 0x00000180,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_6TO2   = 0x00000181,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_6TO3   = 0x00000182,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_6TO4   = 0x00000183,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_6TO5   = 0x00000184,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO1   = 0x00000185,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO2   = 0x00000186,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO3   = 0x00000187,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO4   = 0x00000188,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO5   = 0x00000189,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO6   = 0x0000018a,
-CB_PERF_SEL_CC_DCC_COMPRESS_RATIO_8TO7   = 0x0000018b,
-CB_PERF_SEL_RBP_EXPORT_8PIX_LIT_BOTH     = 0x0000018c,
-CB_PERF_SEL_RBP_EXPORT_8PIX_LIT_LEFT     = 0x0000018d,
-CB_PERF_SEL_RBP_EXPORT_8PIX_LIT_RIGHT    = 0x0000018e,
-CB_PERF_SEL_RBP_SPLIT_MICROTILE          = 0x0000018f,
-CB_PERF_SEL_RBP_SPLIT_AA_SAMPLE_MASK     = 0x00000190,
-CB_PERF_SEL_RBP_SPLIT_PARTIAL_TARGET_MASK  = 0x00000191,
-CB_PERF_SEL_RBP_SPLIT_LINEAR_ADDRESSING  = 0x00000192,
-CB_PERF_SEL_RBP_SPLIT_AA_NO_FMASK_COMPRESS  = 0x00000193,
-CB_PERF_SEL_RBP_INSERT_MISSING_LAST_QUAD  = 0x00000194,
-} CBPerfSel;
-
-/*
- * CBPerfOpFilterSel enum
- */
-
-typedef enum CBPerfOpFilterSel {
-CB_PERF_OP_FILTER_SEL_WRITE_ONLY         = 0x00000000,
-CB_PERF_OP_FILTER_SEL_NEEDS_DESTINATION  = 0x00000001,
-CB_PERF_OP_FILTER_SEL_RESOLVE            = 0x00000002,
-CB_PERF_OP_FILTER_SEL_DECOMPRESS         = 0x00000003,
-CB_PERF_OP_FILTER_SEL_FMASK_DECOMPRESS   = 0x00000004,
-CB_PERF_OP_FILTER_SEL_ELIMINATE_FAST_CLEAR  = 0x00000005,
-} CBPerfOpFilterSel;
-
-/*
- * CBPerfClearFilterSel enum
- */
-
-typedef enum CBPerfClearFilterSel {
-CB_PERF_CLEAR_FILTER_SEL_NONCLEAR        = 0x00000000,
-CB_PERF_CLEAR_FILTER_SEL_CLEAR           = 0x00000001,
-} CBPerfClearFilterSel;
-
-/*******************************************************
- * TC Enums
- *******************************************************/
-
-/*
- * TC_OP_MASKS enum
- */
-
-typedef enum TC_OP_MASKS {
-TC_OP_MASK_FLUSH_DENROM                  = 0x00000008,
-TC_OP_MASK_64                            = 0x00000020,
-TC_OP_MASK_NO_RTN                        = 0x00000040,
-} TC_OP_MASKS;
-
-/*
- * TC_OP enum
- */
-
-typedef enum TC_OP {
-TC_OP_READ                               = 0x00000000,
-TC_OP_ATOMIC_FCMPSWAP_RTN_32             = 0x00000001,
-TC_OP_ATOMIC_FMIN_RTN_32                 = 0x00000002,
-TC_OP_ATOMIC_FMAX_RTN_32                 = 0x00000003,
-TC_OP_RESERVED_FOP_RTN_32_0              = 0x00000004,
-TC_OP_RESERVED_FOP_RTN_32_1              = 0x00000005,
-TC_OP_RESERVED_FOP_RTN_32_2              = 0x00000006,
-TC_OP_ATOMIC_SWAP_RTN_32                 = 0x00000007,
-TC_OP_ATOMIC_CMPSWAP_RTN_32              = 0x00000008,
-TC_OP_ATOMIC_FCMPSWAP_FLUSH_DENORM_RTN_32  = 0x00000009,
-TC_OP_ATOMIC_FMIN_FLUSH_DENORM_RTN_32    = 0x0000000a,
-TC_OP_ATOMIC_FMAX_FLUSH_DENORM_RTN_32    = 0x0000000b,
-TC_OP_PROBE_FILTER                       = 0x0000000c,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_RTN_32_1  = 0x0000000d,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_RTN_32_2  = 0x0000000e,
-TC_OP_ATOMIC_ADD_RTN_32                  = 0x0000000f,
-TC_OP_ATOMIC_SUB_RTN_32                  = 0x00000010,
-TC_OP_ATOMIC_SMIN_RTN_32                 = 0x00000011,
-TC_OP_ATOMIC_UMIN_RTN_32                 = 0x00000012,
-TC_OP_ATOMIC_SMAX_RTN_32                 = 0x00000013,
-TC_OP_ATOMIC_UMAX_RTN_32                 = 0x00000014,
-TC_OP_ATOMIC_AND_RTN_32                  = 0x00000015,
-TC_OP_ATOMIC_OR_RTN_32                   = 0x00000016,
-TC_OP_ATOMIC_XOR_RTN_32                  = 0x00000017,
-TC_OP_ATOMIC_INC_RTN_32                  = 0x00000018,
-TC_OP_ATOMIC_DEC_RTN_32                  = 0x00000019,
-TC_OP_WBINVL1_VOL                        = 0x0000001a,
-TC_OP_WBINVL1_SD                         = 0x0000001b,
-TC_OP_RESERVED_NON_FLOAT_RTN_32_0        = 0x0000001c,
-TC_OP_RESERVED_NON_FLOAT_RTN_32_1        = 0x0000001d,
-TC_OP_RESERVED_NON_FLOAT_RTN_32_2        = 0x0000001e,
-TC_OP_RESERVED_NON_FLOAT_RTN_32_3        = 0x0000001f,
-TC_OP_WRITE                              = 0x00000020,
-TC_OP_ATOMIC_FCMPSWAP_RTN_64             = 0x00000021,
-TC_OP_ATOMIC_FMIN_RTN_64                 = 0x00000022,
-TC_OP_ATOMIC_FMAX_RTN_64                 = 0x00000023,
-TC_OP_RESERVED_FOP_RTN_64_0              = 0x00000024,
-TC_OP_RESERVED_FOP_RTN_64_1              = 0x00000025,
-TC_OP_RESERVED_FOP_RTN_64_2              = 0x00000026,
-TC_OP_ATOMIC_SWAP_RTN_64                 = 0x00000027,
-TC_OP_ATOMIC_CMPSWAP_RTN_64              = 0x00000028,
-TC_OP_ATOMIC_FCMPSWAP_FLUSH_DENORM_RTN_64  = 0x00000029,
-TC_OP_ATOMIC_FMIN_FLUSH_DENORM_RTN_64    = 0x0000002a,
-TC_OP_ATOMIC_FMAX_FLUSH_DENORM_RTN_64    = 0x0000002b,
-TC_OP_WBINVL2_SD                         = 0x0000002c,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_RTN_64_0  = 0x0000002d,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_RTN_64_1  = 0x0000002e,
-TC_OP_ATOMIC_ADD_RTN_64                  = 0x0000002f,
-TC_OP_ATOMIC_SUB_RTN_64                  = 0x00000030,
-TC_OP_ATOMIC_SMIN_RTN_64                 = 0x00000031,
-TC_OP_ATOMIC_UMIN_RTN_64                 = 0x00000032,
-TC_OP_ATOMIC_SMAX_RTN_64                 = 0x00000033,
-TC_OP_ATOMIC_UMAX_RTN_64                 = 0x00000034,
-TC_OP_ATOMIC_AND_RTN_64                  = 0x00000035,
-TC_OP_ATOMIC_OR_RTN_64                   = 0x00000036,
-TC_OP_ATOMIC_XOR_RTN_64                  = 0x00000037,
-TC_OP_ATOMIC_INC_RTN_64                  = 0x00000038,
-TC_OP_ATOMIC_DEC_RTN_64                  = 0x00000039,
-TC_OP_WBL2_NC                            = 0x0000003a,
-TC_OP_WBL2_WC                            = 0x0000003b,
-TC_OP_RESERVED_NON_FLOAT_RTN_64_1        = 0x0000003c,
-TC_OP_RESERVED_NON_FLOAT_RTN_64_2        = 0x0000003d,
-TC_OP_RESERVED_NON_FLOAT_RTN_64_3        = 0x0000003e,
-TC_OP_RESERVED_NON_FLOAT_RTN_64_4        = 0x0000003f,
-TC_OP_WBINVL1                            = 0x00000040,
-TC_OP_ATOMIC_FCMPSWAP_32                 = 0x00000041,
-TC_OP_ATOMIC_FMIN_32                     = 0x00000042,
-TC_OP_ATOMIC_FMAX_32                     = 0x00000043,
-TC_OP_RESERVED_FOP_32_0                  = 0x00000044,
-TC_OP_RESERVED_FOP_32_1                  = 0x00000045,
-TC_OP_RESERVED_FOP_32_2                  = 0x00000046,
-TC_OP_ATOMIC_SWAP_32                     = 0x00000047,
-TC_OP_ATOMIC_CMPSWAP_32                  = 0x00000048,
-TC_OP_ATOMIC_FCMPSWAP_FLUSH_DENORM_32    = 0x00000049,
-TC_OP_ATOMIC_FMIN_FLUSH_DENORM_32        = 0x0000004a,
-TC_OP_ATOMIC_FMAX_FLUSH_DENORM_32        = 0x0000004b,
-TC_OP_INV_METADATA                       = 0x0000004c,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_32_1     = 0x0000004d,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_32_2     = 0x0000004e,
-TC_OP_ATOMIC_ADD_32                      = 0x0000004f,
-TC_OP_ATOMIC_SUB_32                      = 0x00000050,
-TC_OP_ATOMIC_SMIN_32                     = 0x00000051,
-TC_OP_ATOMIC_UMIN_32                     = 0x00000052,
-TC_OP_ATOMIC_SMAX_32                     = 0x00000053,
-TC_OP_ATOMIC_UMAX_32                     = 0x00000054,
-TC_OP_ATOMIC_AND_32                      = 0x00000055,
-TC_OP_ATOMIC_OR_32                       = 0x00000056,
-TC_OP_ATOMIC_XOR_32                      = 0x00000057,
-TC_OP_ATOMIC_INC_32                      = 0x00000058,
-TC_OP_ATOMIC_DEC_32                      = 0x00000059,
-TC_OP_INVL2_NC                           = 0x0000005a,
-TC_OP_NOP_RTN0                           = 0x0000005b,
-TC_OP_RESERVED_NON_FLOAT_32_1            = 0x0000005c,
-TC_OP_RESERVED_NON_FLOAT_32_2            = 0x0000005d,
-TC_OP_RESERVED_NON_FLOAT_32_3            = 0x0000005e,
-TC_OP_RESERVED_NON_FLOAT_32_4            = 0x0000005f,
-TC_OP_WBINVL2                            = 0x00000060,
-TC_OP_ATOMIC_FCMPSWAP_64                 = 0x00000061,
-TC_OP_ATOMIC_FMIN_64                     = 0x00000062,
-TC_OP_ATOMIC_FMAX_64                     = 0x00000063,
-TC_OP_RESERVED_FOP_64_0                  = 0x00000064,
-TC_OP_RESERVED_FOP_64_1                  = 0x00000065,
-TC_OP_RESERVED_FOP_64_2                  = 0x00000066,
-TC_OP_ATOMIC_SWAP_64                     = 0x00000067,
-TC_OP_ATOMIC_CMPSWAP_64                  = 0x00000068,
-TC_OP_ATOMIC_FCMPSWAP_FLUSH_DENORM_64    = 0x00000069,
-TC_OP_ATOMIC_FMIN_FLUSH_DENORM_64        = 0x0000006a,
-TC_OP_ATOMIC_FMAX_FLUSH_DENORM_64        = 0x0000006b,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_64_0     = 0x0000006c,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_64_1     = 0x0000006d,
-TC_OP_RESERVED_FOP_FLUSH_DENORM_64_2     = 0x0000006e,
-TC_OP_ATOMIC_ADD_64                      = 0x0000006f,
-TC_OP_ATOMIC_SUB_64                      = 0x00000070,
-TC_OP_ATOMIC_SMIN_64                     = 0x00000071,
-TC_OP_ATOMIC_UMIN_64                     = 0x00000072,
-TC_OP_ATOMIC_SMAX_64                     = 0x00000073,
-TC_OP_ATOMIC_UMAX_64                     = 0x00000074,
-TC_OP_ATOMIC_AND_64                      = 0x00000075,
-TC_OP_ATOMIC_OR_64                       = 0x00000076,
-TC_OP_ATOMIC_XOR_64                      = 0x00000077,
-TC_OP_ATOMIC_INC_64                      = 0x00000078,
-TC_OP_ATOMIC_DEC_64                      = 0x00000079,
-TC_OP_WBINVL2_NC                         = 0x0000007a,
-TC_OP_NOP_ACK                            = 0x0000007b,
-TC_OP_RESERVED_NON_FLOAT_64_1            = 0x0000007c,
-TC_OP_RESERVED_NON_FLOAT_64_2            = 0x0000007d,
-TC_OP_RESERVED_NON_FLOAT_64_3            = 0x0000007e,
-TC_OP_RESERVED_NON_FLOAT_64_4            = 0x0000007f,
-} TC_OP;
-
-/*
- * TC_CHUB_REQ_CREDITS_ENUM enum
- */
-
-typedef enum TC_CHUB_REQ_CREDITS_ENUM {
-TC_CHUB_REQ_CREDITS                      = 0x00000010,
-} TC_CHUB_REQ_CREDITS_ENUM;
-
-/*
- * CHUB_TC_RET_CREDITS_ENUM enum
- */
-
-typedef enum CHUB_TC_RET_CREDITS_ENUM {
-CHUB_TC_RET_CREDITS                      = 0x00000020,
-} CHUB_TC_RET_CREDITS_ENUM;
-
-/*
- * TC_NACKS enum
- */
-
-typedef enum TC_NACKS {
-TC_NACK_NO_FAULT                         = 0x00000000,
-TC_NACK_PAGE_FAULT                       = 0x00000001,
-TC_NACK_PROTECTION_FAULT                 = 0x00000002,
-TC_NACK_DATA_ERROR                       = 0x00000003,
-} TC_NACKS;
-
-/*
- * TC_EA_CID enum
- */
-
-typedef enum TC_EA_CID {
-TC_EA_CID_RT                             = 0x00000000,
-TC_EA_CID_FMASK                          = 0x00000001,
-TC_EA_CID_DCC                            = 0x00000002,
-TC_EA_CID_TCPMETA                        = 0x00000003,
-TC_EA_CID_Z                              = 0x00000004,
-TC_EA_CID_STENCIL                        = 0x00000005,
-TC_EA_CID_HTILE                          = 0x00000006,
-TC_EA_CID_MISC                           = 0x00000007,
-TC_EA_CID_TCP                            = 0x00000008,
-TC_EA_CID_SQC                            = 0x00000009,
-TC_EA_CID_CPF                            = 0x0000000a,
-TC_EA_CID_CPG                            = 0x0000000b,
-TC_EA_CID_IA                             = 0x0000000c,
-TC_EA_CID_WD                             = 0x0000000d,
-TC_EA_CID_PA                             = 0x0000000e,
-TC_EA_CID_UTCL2_TPI                      = 0x0000000f,
-} TC_EA_CID;
-
-/*******************************************************
- * GC_CAC Enums
- *******************************************************/
-
-/*******************************************************
- * RLC Enums
- *******************************************************/
-
-/*******************************************************
- * SPI Enums
- *******************************************************/
-
-/*
- * SPI_SAMPLE_CNTL enum
- */
-
-typedef enum SPI_SAMPLE_CNTL {
-CENTROIDS_ONLY                           = 0x00000000,
-CENTERS_ONLY                             = 0x00000001,
-CENTROIDS_AND_CENTERS                    = 0x00000002,
-UNDEF                                    = 0x00000003,
-} SPI_SAMPLE_CNTL;
-
-/*
- * SPI_FOG_MODE enum
- */
-
-typedef enum SPI_FOG_MODE {
-SPI_FOG_NONE                             = 0x00000000,
-SPI_FOG_EXP                              = 0x00000001,
-SPI_FOG_EXP2                             = 0x00000002,
-SPI_FOG_LINEAR                           = 0x00000003,
-} SPI_FOG_MODE;
-
-/*
- * SPI_PNT_SPRITE_OVERRIDE enum
- */
-
-typedef enum SPI_PNT_SPRITE_OVERRIDE {
-SPI_PNT_SPRITE_SEL_0                     = 0x00000000,
-SPI_PNT_SPRITE_SEL_1                     = 0x00000001,
-SPI_PNT_SPRITE_SEL_S                     = 0x00000002,
-SPI_PNT_SPRITE_SEL_T                     = 0x00000003,
-SPI_PNT_SPRITE_SEL_NONE                  = 0x00000004,
-} SPI_PNT_SPRITE_OVERRIDE;
-
-/*
- * SPI_PERFCNT_SEL enum
- */
-
-typedef enum SPI_PERFCNT_SEL {
-SPI_PERF_VS_WINDOW_VALID                 = 0x00000000,
-SPI_PERF_VS_BUSY                         = 0x00000001,
-SPI_PERF_VS_FIRST_WAVE                   = 0x00000002,
-SPI_PERF_VS_LAST_WAVE                    = 0x00000003,
-SPI_PERF_VS_LSHS_DEALLOC                 = 0x00000004,
-SPI_PERF_VS_PC_STALL                     = 0x00000005,
-SPI_PERF_VS_POS0_STALL                   = 0x00000006,
-SPI_PERF_VS_POS1_STALL                   = 0x00000007,
-SPI_PERF_VS_CRAWLER_STALL                = 0x00000008,
-SPI_PERF_VS_EVENT_WAVE                   = 0x00000009,
-SPI_PERF_VS_WAVE                         = 0x0000000a,
-SPI_PERF_VS_PERS_UPD_FULL0               = 0x0000000b,
-SPI_PERF_VS_PERS_UPD_FULL1               = 0x0000000c,
-SPI_PERF_VS_LATE_ALLOC_FULL              = 0x0000000d,
-SPI_PERF_VS_FIRST_SUBGRP                 = 0x0000000e,
-SPI_PERF_VS_LAST_SUBGRP                  = 0x0000000f,
-SPI_PERF_GS_WINDOW_VALID                 = 0x00000010,
-SPI_PERF_GS_BUSY                         = 0x00000011,
-SPI_PERF_GS_CRAWLER_STALL                = 0x00000012,
-SPI_PERF_GS_EVENT_WAVE                   = 0x00000013,
-SPI_PERF_GS_WAVE                         = 0x00000014,
-SPI_PERF_GS_PERS_UPD_FULL0               = 0x00000015,
-SPI_PERF_GS_PERS_UPD_FULL1               = 0x00000016,
-SPI_PERF_GS_FIRST_SUBGRP                 = 0x00000017,
-SPI_PERF_GS_LAST_SUBGRP                  = 0x00000018,
-SPI_PERF_ES_WINDOW_VALID                 = 0x00000019,
-SPI_PERF_ES_BUSY                         = 0x0000001a,
-SPI_PERF_ES_CRAWLER_STALL                = 0x0000001b,
-SPI_PERF_ES_FIRST_WAVE                   = 0x0000001c,
-SPI_PERF_ES_LAST_WAVE                    = 0x0000001d,
-SPI_PERF_ES_LSHS_DEALLOC                 = 0x0000001e,
-SPI_PERF_ES_EVENT_WAVE                   = 0x0000001f,
-SPI_PERF_ES_WAVE                         = 0x00000020,
-SPI_PERF_ES_PERS_UPD_FULL0               = 0x00000021,
-SPI_PERF_ES_PERS_UPD_FULL1               = 0x00000022,
-SPI_PERF_ES_FIRST_SUBGRP                 = 0x00000023,
-SPI_PERF_ES_LAST_SUBGRP                  = 0x00000024,
-SPI_PERF_HS_WINDOW_VALID                 = 0x00000025,
-SPI_PERF_HS_BUSY                         = 0x00000026,
-SPI_PERF_HS_CRAWLER_STALL                = 0x00000027,
-SPI_PERF_HS_FIRST_WAVE                   = 0x00000028,
-SPI_PERF_HS_LAST_WAVE                    = 0x00000029,
-SPI_PERF_HS_LSHS_DEALLOC                 = 0x0000002a,
-SPI_PERF_HS_EVENT_WAVE                   = 0x0000002b,
-SPI_PERF_HS_WAVE                         = 0x0000002c,
-SPI_PERF_HS_PERS_UPD_FULL0               = 0x0000002d,
-SPI_PERF_HS_PERS_UPD_FULL1               = 0x0000002e,
-SPI_PERF_LS_WINDOW_VALID                 = 0x0000002f,
-SPI_PERF_LS_BUSY                         = 0x00000030,
-SPI_PERF_LS_CRAWLER_STALL                = 0x00000031,
-SPI_PERF_LS_FIRST_WAVE                   = 0x00000032,
-SPI_PERF_LS_LAST_WAVE                    = 0x00000033,
-SPI_PERF_OFFCHIP_LDS_STALL_LS            = 0x00000034,
-SPI_PERF_LS_EVENT_WAVE                   = 0x00000035,
-SPI_PERF_LS_WAVE                         = 0x00000036,
-SPI_PERF_LS_PERS_UPD_FULL0               = 0x00000037,
-SPI_PERF_LS_PERS_UPD_FULL1               = 0x00000038,
-SPI_PERF_CSG_WINDOW_VALID                = 0x00000039,
-SPI_PERF_CSG_BUSY                        = 0x0000003a,
-SPI_PERF_CSG_NUM_THREADGROUPS            = 0x0000003b,
-SPI_PERF_CSG_CRAWLER_STALL               = 0x0000003c,
-SPI_PERF_CSG_EVENT_WAVE                  = 0x0000003d,
-SPI_PERF_CSG_WAVE                        = 0x0000003e,
-SPI_PERF_CSN_WINDOW_VALID                = 0x0000003f,
-SPI_PERF_CSN_BUSY                        = 0x00000040,
-SPI_PERF_CSN_NUM_THREADGROUPS            = 0x00000041,
-SPI_PERF_CSN_CRAWLER_STALL               = 0x00000042,
-SPI_PERF_CSN_EVENT_WAVE                  = 0x00000043,
-SPI_PERF_CSN_WAVE                        = 0x00000044,
-SPI_PERF_PS_CTL_WINDOW_VALID             = 0x00000045,
-SPI_PERF_PS_CTL_BUSY                     = 0x00000046,
-SPI_PERF_PS_CTL_ACTIVE                   = 0x00000047,
-SPI_PERF_PS_CTL_DEALLOC_BIN0             = 0x00000048,
-SPI_PERF_PS_CTL_FPOS_BIN1_STALL          = 0x00000049,
-SPI_PERF_PS_CTL_EVENT_WAVE               = 0x0000004a,
-SPI_PERF_PS_CTL_WAVE                     = 0x0000004b,
-SPI_PERF_PS_CTL_OPT_WAVE                 = 0x0000004c,
-SPI_PERF_PS_CTL_PASS_BIN0                = 0x0000004d,
-SPI_PERF_PS_CTL_PASS_BIN1                = 0x0000004e,
-SPI_PERF_PS_CTL_FPOS_BIN2                = 0x0000004f,
-SPI_PERF_PS_CTL_PRIM_BIN0                = 0x00000050,
-SPI_PERF_PS_CTL_PRIM_BIN1                = 0x00000051,
-SPI_PERF_PS_CTL_CNF_BIN2                 = 0x00000052,
-SPI_PERF_PS_CTL_CNF_BIN3                 = 0x00000053,
-SPI_PERF_PS_CTL_CRAWLER_STALL            = 0x00000054,
-SPI_PERF_PS_CTL_LDS_RES_FULL             = 0x00000055,
-SPI_PERF_PS_PERS_UPD_FULL0               = 0x00000056,
-SPI_PERF_PS_PERS_UPD_FULL1               = 0x00000057,
-SPI_PERF_PIX_ALLOC_PEND_CNT              = 0x00000058,
-SPI_PERF_PIX_ALLOC_SCB_STALL             = 0x00000059,
-SPI_PERF_PIX_ALLOC_DB0_STALL             = 0x0000005a,
-SPI_PERF_PIX_ALLOC_DB1_STALL             = 0x0000005b,
-SPI_PERF_PIX_ALLOC_DB2_STALL             = 0x0000005c,
-SPI_PERF_PIX_ALLOC_DB3_STALL             = 0x0000005d,
-SPI_PERF_LDS0_PC_VALID                   = 0x0000005e,
-SPI_PERF_LDS1_PC_VALID                   = 0x0000005f,
-SPI_PERF_RA_PIPE_REQ_BIN2                = 0x00000060,
-SPI_PERF_RA_TASK_REQ_BIN3                = 0x00000061,
-SPI_PERF_RA_WR_CTL_FULL                  = 0x00000062,
-SPI_PERF_RA_REQ_NO_ALLOC                 = 0x00000063,
-SPI_PERF_RA_REQ_NO_ALLOC_PS              = 0x00000064,
-SPI_PERF_RA_REQ_NO_ALLOC_VS              = 0x00000065,
-SPI_PERF_RA_REQ_NO_ALLOC_GS              = 0x00000066,
-SPI_PERF_RA_REQ_NO_ALLOC_ES              = 0x00000067,
-SPI_PERF_RA_REQ_NO_ALLOC_HS              = 0x00000068,
-SPI_PERF_RA_REQ_NO_ALLOC_LS              = 0x00000069,
-SPI_PERF_RA_REQ_NO_ALLOC_CSG             = 0x0000006a,
-SPI_PERF_RA_REQ_NO_ALLOC_CSN             = 0x0000006b,
-SPI_PERF_RA_RES_STALL_PS                 = 0x0000006c,
-SPI_PERF_RA_RES_STALL_VS                 = 0x0000006d,
-SPI_PERF_RA_RES_STALL_GS                 = 0x0000006e,
-SPI_PERF_RA_RES_STALL_ES                 = 0x0000006f,
-SPI_PERF_RA_RES_STALL_HS                 = 0x00000070,
-SPI_PERF_RA_RES_STALL_LS                 = 0x00000071,
-SPI_PERF_RA_RES_STALL_CSG                = 0x00000072,
-SPI_PERF_RA_RES_STALL_CSN                = 0x00000073,
-SPI_PERF_RA_TMP_STALL_PS                 = 0x00000074,
-SPI_PERF_RA_TMP_STALL_VS                 = 0x00000075,
-SPI_PERF_RA_TMP_STALL_GS                 = 0x00000076,
-SPI_PERF_RA_TMP_STALL_ES                 = 0x00000077,
-SPI_PERF_RA_TMP_STALL_HS                 = 0x00000078,
-SPI_PERF_RA_TMP_STALL_LS                 = 0x00000079,
-SPI_PERF_RA_TMP_STALL_CSG                = 0x0000007a,
-SPI_PERF_RA_TMP_STALL_CSN                = 0x0000007b,
-SPI_PERF_RA_WAVE_SIMD_FULL_PS            = 0x0000007c,
-SPI_PERF_RA_WAVE_SIMD_FULL_VS            = 0x0000007d,
-SPI_PERF_RA_WAVE_SIMD_FULL_GS            = 0x0000007e,
-SPI_PERF_RA_WAVE_SIMD_FULL_ES            = 0x0000007f,
-SPI_PERF_RA_WAVE_SIMD_FULL_HS            = 0x00000080,
-SPI_PERF_RA_WAVE_SIMD_FULL_LS            = 0x00000081,
-SPI_PERF_RA_WAVE_SIMD_FULL_CSG           = 0x00000082,
-SPI_PERF_RA_WAVE_SIMD_FULL_CSN           = 0x00000083,
-SPI_PERF_RA_VGPR_SIMD_FULL_PS            = 0x00000084,
-SPI_PERF_RA_VGPR_SIMD_FULL_VS            = 0x00000085,
-SPI_PERF_RA_VGPR_SIMD_FULL_GS            = 0x00000086,
-SPI_PERF_RA_VGPR_SIMD_FULL_ES            = 0x00000087,
-SPI_PERF_RA_VGPR_SIMD_FULL_HS            = 0x00000088,
-SPI_PERF_RA_VGPR_SIMD_FULL_LS            = 0x00000089,
-SPI_PERF_RA_VGPR_SIMD_FULL_CSG           = 0x0000008a,
-SPI_PERF_RA_VGPR_SIMD_FULL_CSN           = 0x0000008b,
-SPI_PERF_RA_SGPR_SIMD_FULL_PS            = 0x0000008c,
-SPI_PERF_RA_SGPR_SIMD_FULL_VS            = 0x0000008d,
-SPI_PERF_RA_SGPR_SIMD_FULL_GS            = 0x0000008e,
-SPI_PERF_RA_SGPR_SIMD_FULL_ES            = 0x0000008f,
-SPI_PERF_RA_SGPR_SIMD_FULL_HS            = 0x00000090,
-SPI_PERF_RA_SGPR_SIMD_FULL_LS            = 0x00000091,
-SPI_PERF_RA_SGPR_SIMD_FULL_CSG           = 0x00000092,
-SPI_PERF_RA_SGPR_SIMD_FULL_CSN           = 0x00000093,
-SPI_PERF_RA_LDS_CU_FULL_PS               = 0x00000094,
-SPI_PERF_RA_LDS_CU_FULL_LS               = 0x00000095,
-SPI_PERF_RA_LDS_CU_FULL_ES               = 0x00000096,
-SPI_PERF_RA_LDS_CU_FULL_CSG              = 0x00000097,
-SPI_PERF_RA_LDS_CU_FULL_CSN              = 0x00000098,
-SPI_PERF_RA_BAR_CU_FULL_HS               = 0x00000099,
-SPI_PERF_RA_BAR_CU_FULL_CSG              = 0x0000009a,
-SPI_PERF_RA_BAR_CU_FULL_CSN              = 0x0000009b,
-SPI_PERF_RA_BULKY_CU_FULL_CSG            = 0x0000009c,
-SPI_PERF_RA_BULKY_CU_FULL_CSN            = 0x0000009d,
-SPI_PERF_RA_TGLIM_CU_FULL_CSG            = 0x0000009e,
-SPI_PERF_RA_TGLIM_CU_FULL_CSN            = 0x0000009f,
-SPI_PERF_RA_WVLIM_STALL_PS               = 0x000000a0,
-SPI_PERF_RA_WVLIM_STALL_VS               = 0x000000a1,
-SPI_PERF_RA_WVLIM_STALL_GS               = 0x000000a2,
-SPI_PERF_RA_WVLIM_STALL_ES               = 0x000000a3,
-SPI_PERF_RA_WVLIM_STALL_HS               = 0x000000a4,
-SPI_PERF_RA_WVLIM_STALL_LS               = 0x000000a5,
-SPI_PERF_RA_WVLIM_STALL_CSG              = 0x000000a6,
-SPI_PERF_RA_WVLIM_STALL_CSN              = 0x000000a7,
-SPI_PERF_RA_PS_LOCK_NA                   = 0x000000a8,
-SPI_PERF_RA_VS_LOCK                      = 0x000000a9,
-SPI_PERF_RA_GS_LOCK                      = 0x000000aa,
-SPI_PERF_RA_ES_LOCK                      = 0x000000ab,
-SPI_PERF_RA_HS_LOCK                      = 0x000000ac,
-SPI_PERF_RA_LS_LOCK                      = 0x000000ad,
-SPI_PERF_RA_CSG_LOCK                     = 0x000000ae,
-SPI_PERF_RA_CSN_LOCK                     = 0x000000af,
-SPI_PERF_RA_RSV_UPD                      = 0x000000b0,
-SPI_PERF_EXP_ARB_COL_CNT                 = 0x000000b1,
-SPI_PERF_EXP_ARB_PAR_CNT                 = 0x000000b2,
-SPI_PERF_EXP_ARB_POS_CNT                 = 0x000000b3,
-SPI_PERF_EXP_ARB_GDS_CNT                 = 0x000000b4,
-SPI_PERF_CLKGATE_BUSY_STALL              = 0x000000b5,
-SPI_PERF_CLKGATE_ACTIVE_STALL            = 0x000000b6,
-SPI_PERF_CLKGATE_ALL_CLOCKS_ON           = 0x000000b7,
-SPI_PERF_CLKGATE_CGTT_DYN_ON             = 0x000000b8,
-SPI_PERF_CLKGATE_CGTT_REG_ON             = 0x000000b9,
-SPI_PERF_NUM_VS_POS_EXPORTS              = 0x000000ba,
-SPI_PERF_NUM_VS_PARAM_EXPORTS            = 0x000000bb,
-SPI_PERF_NUM_PS_COL_EXPORTS              = 0x000000bc,
-SPI_PERF_ES_GRP_FIFO_FULL                = 0x000000bd,
-SPI_PERF_GS_GRP_FIFO_FULL                = 0x000000be,
-SPI_PERF_HS_GRP_FIFO_FULL                = 0x000000bf,
-SPI_PERF_LS_GRP_FIFO_FULL                = 0x000000c0,
-SPI_PERF_VS_ALLOC_CNT                    = 0x000000c1,
-SPI_PERF_VS_LATE_ALLOC_ACCUM             = 0x000000c2,
-SPI_PERF_PC_ALLOC_CNT                    = 0x000000c3,
-SPI_PERF_PC_ALLOC_ACCUM                  = 0x000000c4,
-} SPI_PERFCNT_SEL;
-
-/*
- * SPI_SHADER_FORMAT enum
- */
-
-typedef enum SPI_SHADER_FORMAT {
-SPI_SHADER_NONE                          = 0x00000000,
-SPI_SHADER_1COMP                         = 0x00000001,
-SPI_SHADER_2COMP                         = 0x00000002,
-SPI_SHADER_4COMPRESS                     = 0x00000003,
-SPI_SHADER_4COMP                         = 0x00000004,
-} SPI_SHADER_FORMAT;
-
-/*
- * SPI_SHADER_EX_FORMAT enum
- */
-
-typedef enum SPI_SHADER_EX_FORMAT {
-SPI_SHADER_ZERO                          = 0x00000000,
-SPI_SHADER_32_R                          = 0x00000001,
-SPI_SHADER_32_GR                         = 0x00000002,
-SPI_SHADER_32_AR                         = 0x00000003,
-SPI_SHADER_FP16_ABGR                     = 0x00000004,
-SPI_SHADER_UNORM16_ABGR                  = 0x00000005,
-SPI_SHADER_SNORM16_ABGR                  = 0x00000006,
-SPI_SHADER_UINT16_ABGR                   = 0x00000007,
-SPI_SHADER_SINT16_ABGR                   = 0x00000008,
-SPI_SHADER_32_ABGR                       = 0x00000009,
-} SPI_SHADER_EX_FORMAT;
-
-/*
- * CLKGATE_SM_MODE enum
- */
-
-typedef enum CLKGATE_SM_MODE {
-ON_SEQ                                   = 0x00000000,
-OFF_SEQ                                  = 0x00000001,
-PROG_SEQ                                 = 0x00000002,
-READ_SEQ                                 = 0x00000003,
-SM_MODE_RESERVED                         = 0x00000004,
-} CLKGATE_SM_MODE;
-
-/*
- * CLKGATE_BASE_MODE enum
- */
-
-typedef enum CLKGATE_BASE_MODE {
-MULT_8                                   = 0x00000000,
-MULT_16                                  = 0x00000001,
-} CLKGATE_BASE_MODE;
-
-/*******************************************************
- * SQ Enums
- *******************************************************/
-
-/*
- * SQ_TEX_CLAMP enum
- */
-
-typedef enum SQ_TEX_CLAMP {
-SQ_TEX_WRAP                              = 0x00000000,
-SQ_TEX_MIRROR                            = 0x00000001,
-SQ_TEX_CLAMP_LAST_TEXEL                  = 0x00000002,
-SQ_TEX_MIRROR_ONCE_LAST_TEXEL            = 0x00000003,
-SQ_TEX_CLAMP_HALF_BORDER                 = 0x00000004,
-SQ_TEX_MIRROR_ONCE_HALF_BORDER           = 0x00000005,
-SQ_TEX_CLAMP_BORDER                      = 0x00000006,
-SQ_TEX_MIRROR_ONCE_BORDER                = 0x00000007,
-} SQ_TEX_CLAMP;
-
-/*
- * SQ_TEX_XY_FILTER enum
- */
-
-typedef enum SQ_TEX_XY_FILTER {
-SQ_TEX_XY_FILTER_POINT                   = 0x00000000,
-SQ_TEX_XY_FILTER_BILINEAR                = 0x00000001,
-SQ_TEX_XY_FILTER_ANISO_POINT             = 0x00000002,
-SQ_TEX_XY_FILTER_ANISO_BILINEAR          = 0x00000003,
-} SQ_TEX_XY_FILTER;
-
-/*
- * SQ_TEX_Z_FILTER enum
- */
-
-typedef enum SQ_TEX_Z_FILTER {
-SQ_TEX_Z_FILTER_NONE                     = 0x00000000,
-SQ_TEX_Z_FILTER_POINT                    = 0x00000001,
-SQ_TEX_Z_FILTER_LINEAR                   = 0x00000002,
-} SQ_TEX_Z_FILTER;
-
-/*
- * SQ_TEX_MIP_FILTER enum
- */
-
-typedef enum SQ_TEX_MIP_FILTER {
-SQ_TEX_MIP_FILTER_NONE                   = 0x00000000,
-SQ_TEX_MIP_FILTER_POINT                  = 0x00000001,
-SQ_TEX_MIP_FILTER_LINEAR                 = 0x00000002,
-SQ_TEX_MIP_FILTER_POINT_ANISO_ADJ        = 0x00000003,
-} SQ_TEX_MIP_FILTER;
-
-/*
- * SQ_TEX_ANISO_RATIO enum
- */
-
-typedef enum SQ_TEX_ANISO_RATIO {
-SQ_TEX_ANISO_RATIO_1                     = 0x00000000,
-SQ_TEX_ANISO_RATIO_2                     = 0x00000001,
-SQ_TEX_ANISO_RATIO_4                     = 0x00000002,
-SQ_TEX_ANISO_RATIO_8                     = 0x00000003,
-SQ_TEX_ANISO_RATIO_16                    = 0x00000004,
-} SQ_TEX_ANISO_RATIO;
-
-/*
- * SQ_TEX_DEPTH_COMPARE enum
- */
-
-typedef enum SQ_TEX_DEPTH_COMPARE {
-SQ_TEX_DEPTH_COMPARE_NEVER               = 0x00000000,
-SQ_TEX_DEPTH_COMPARE_LESS                = 0x00000001,
-SQ_TEX_DEPTH_COMPARE_EQUAL               = 0x00000002,
-SQ_TEX_DEPTH_COMPARE_LESSEQUAL           = 0x00000003,
-SQ_TEX_DEPTH_COMPARE_GREATER             = 0x00000004,
-SQ_TEX_DEPTH_COMPARE_NOTEQUAL            = 0x00000005,
-SQ_TEX_DEPTH_COMPARE_GREATEREQUAL        = 0x00000006,
-SQ_TEX_DEPTH_COMPARE_ALWAYS              = 0x00000007,
-} SQ_TEX_DEPTH_COMPARE;
-
-/*
- * SQ_TEX_BORDER_COLOR enum
- */
-
-typedef enum SQ_TEX_BORDER_COLOR {
-SQ_TEX_BORDER_COLOR_TRANS_BLACK          = 0x00000000,
-SQ_TEX_BORDER_COLOR_OPAQUE_BLACK         = 0x00000001,
-SQ_TEX_BORDER_COLOR_OPAQUE_WHITE         = 0x00000002,
-SQ_TEX_BORDER_COLOR_REGISTER             = 0x00000003,
-} SQ_TEX_BORDER_COLOR;
-
-/*
- * SQ_RSRC_BUF_TYPE enum
- */
-
-typedef enum SQ_RSRC_BUF_TYPE {
-SQ_RSRC_BUF                              = 0x00000000,
-SQ_RSRC_BUF_RSVD_1                       = 0x00000001,
-SQ_RSRC_BUF_RSVD_2                       = 0x00000002,
-SQ_RSRC_BUF_RSVD_3                       = 0x00000003,
-} SQ_RSRC_BUF_TYPE;
-
-/*
- * SQ_RSRC_IMG_TYPE enum
- */
-
-typedef enum SQ_RSRC_IMG_TYPE {
-SQ_RSRC_IMG_RSVD_0                       = 0x00000000,
-SQ_RSRC_IMG_RSVD_1                       = 0x00000001,
-SQ_RSRC_IMG_RSVD_2                       = 0x00000002,
-SQ_RSRC_IMG_RSVD_3                       = 0x00000003,
-SQ_RSRC_IMG_RSVD_4                       = 0x00000004,
-SQ_RSRC_IMG_RSVD_5                       = 0x00000005,
-SQ_RSRC_IMG_RSVD_6                       = 0x00000006,
-SQ_RSRC_IMG_RSVD_7                       = 0x00000007,
-SQ_RSRC_IMG_1D                           = 0x00000008,
-SQ_RSRC_IMG_2D                           = 0x00000009,
-SQ_RSRC_IMG_3D                           = 0x0000000a,
-SQ_RSRC_IMG_CUBE                         = 0x0000000b,
-SQ_RSRC_IMG_1D_ARRAY                     = 0x0000000c,
-SQ_RSRC_IMG_2D_ARRAY                     = 0x0000000d,
-SQ_RSRC_IMG_2D_MSAA                      = 0x0000000e,
-SQ_RSRC_IMG_2D_MSAA_ARRAY                = 0x0000000f,
-} SQ_RSRC_IMG_TYPE;
-
-/*
- * SQ_RSRC_FLAT_TYPE enum
- */
-
-typedef enum SQ_RSRC_FLAT_TYPE {
-SQ_RSRC_FLAT_RSVD_0                      = 0x00000000,
-SQ_RSRC_FLAT                             = 0x00000001,
-SQ_RSRC_FLAT_RSVD_2                      = 0x00000002,
-SQ_RSRC_FLAT_RSVD_3                      = 0x00000003,
-} SQ_RSRC_FLAT_TYPE;
-
-/*
- * SQ_IMG_FILTER_TYPE enum
- */
-
-typedef enum SQ_IMG_FILTER_TYPE {
-SQ_IMG_FILTER_MODE_BLEND                 = 0x00000000,
-SQ_IMG_FILTER_MODE_MIN                   = 0x00000001,
-SQ_IMG_FILTER_MODE_MAX                   = 0x00000002,
-} SQ_IMG_FILTER_TYPE;
-
-/*
- * SQ_SEL_XYZW01 enum
- */
-
-typedef enum SQ_SEL_XYZW01 {
-SQ_SEL_0                                 = 0x00000000,
-SQ_SEL_1                                 = 0x00000001,
-SQ_SEL_RESERVED_0                        = 0x00000002,
-SQ_SEL_RESERVED_1                        = 0x00000003,
-SQ_SEL_X                                 = 0x00000004,
-SQ_SEL_Y                                 = 0x00000005,
-SQ_SEL_Z                                 = 0x00000006,
-SQ_SEL_W                                 = 0x00000007,
-} SQ_SEL_XYZW01;
-
-/*
- * SQ_WAVE_TYPE enum
- */
-
-typedef enum SQ_WAVE_TYPE {
-SQ_WAVE_TYPE_PS                          = 0x00000000,
-SQ_WAVE_TYPE_VS                          = 0x00000001,
-SQ_WAVE_TYPE_GS                          = 0x00000002,
-SQ_WAVE_TYPE_ES                          = 0x00000003,
-SQ_WAVE_TYPE_HS                          = 0x00000004,
-SQ_WAVE_TYPE_LS                          = 0x00000005,
-SQ_WAVE_TYPE_CS                          = 0x00000006,
-SQ_WAVE_TYPE_PS1                         = 0x00000007,
-} SQ_WAVE_TYPE;
-
-/*
- * SQ_THREAD_TRACE_TOKEN_TYPE enum
- */
-
-typedef enum SQ_THREAD_TRACE_TOKEN_TYPE {
-SQ_THREAD_TRACE_TOKEN_MISC               = 0x00000000,
-SQ_THREAD_TRACE_TOKEN_TIMESTAMP          = 0x00000001,
-SQ_THREAD_TRACE_TOKEN_REG                = 0x00000002,
-SQ_THREAD_TRACE_TOKEN_WAVE_START         = 0x00000003,
-SQ_THREAD_TRACE_TOKEN_WAVE_ALLOC         = 0x00000004,
-SQ_THREAD_TRACE_TOKEN_REG_CSPRIV         = 0x00000005,
-SQ_THREAD_TRACE_TOKEN_WAVE_END           = 0x00000006,
-SQ_THREAD_TRACE_TOKEN_EVENT              = 0x00000007,
-SQ_THREAD_TRACE_TOKEN_EVENT_CS           = 0x00000008,
-SQ_THREAD_TRACE_TOKEN_EVENT_GFX1         = 0x00000009,
-SQ_THREAD_TRACE_TOKEN_INST               = 0x0000000a,
-SQ_THREAD_TRACE_TOKEN_INST_PC            = 0x0000000b,
-SQ_THREAD_TRACE_TOKEN_INST_USERDATA      = 0x0000000c,
-SQ_THREAD_TRACE_TOKEN_ISSUE              = 0x0000000d,
-SQ_THREAD_TRACE_TOKEN_PERF               = 0x0000000e,
-SQ_THREAD_TRACE_TOKEN_REG_CS             = 0x0000000f,
-} SQ_THREAD_TRACE_TOKEN_TYPE;
-
-/*
- * SQ_THREAD_TRACE_MISC_TOKEN_TYPE enum
- */
-
-typedef enum SQ_THREAD_TRACE_MISC_TOKEN_TYPE {
-SQ_THREAD_TRACE_MISC_TOKEN_TIME          = 0x00000000,
-SQ_THREAD_TRACE_MISC_TOKEN_TIME_RESET    = 0x00000001,
-SQ_THREAD_TRACE_MISC_TOKEN_PACKET_LOST   = 0x00000002,
-SQ_THREAD_TRACE_MISC_TOKEN_SURF_SYNC     = 0x00000003,
-SQ_THREAD_TRACE_MISC_TOKEN_TTRACE_STALL_BEGIN  = 0x00000004,
-SQ_THREAD_TRACE_MISC_TOKEN_TTRACE_STALL_END  = 0x00000005,
-SQ_THREAD_TRACE_MISC_TOKEN_SAVECTX       = 0x00000006,
-SQ_THREAD_TRACE_MISC_TOKEN_SHOOT_DOWN    = 0x00000007,
-} SQ_THREAD_TRACE_MISC_TOKEN_TYPE;
-
-/*
- * SQ_THREAD_TRACE_INST_TYPE enum
- */
-
-typedef enum SQ_THREAD_TRACE_INST_TYPE {
-SQ_THREAD_TRACE_INST_TYPE_SMEM_RD        = 0x00000000,
-SQ_THREAD_TRACE_INST_TYPE_SALU_32        = 0x00000001,
-SQ_THREAD_TRACE_INST_TYPE_VMEM_RD        = 0x00000002,
-SQ_THREAD_TRACE_INST_TYPE_VMEM_WR        = 0x00000003,
-SQ_THREAD_TRACE_INST_TYPE_FLAT_WR        = 0x00000004,
-SQ_THREAD_TRACE_INST_TYPE_VALU_32        = 0x00000005,
-SQ_THREAD_TRACE_INST_TYPE_LDS            = 0x00000006,
-SQ_THREAD_TRACE_INST_TYPE_PC             = 0x00000007,
-SQ_THREAD_TRACE_INST_TYPE_EXPREQ_GDS     = 0x00000008,
-SQ_THREAD_TRACE_INST_TYPE_EXPREQ_GFX     = 0x00000009,
-SQ_THREAD_TRACE_INST_TYPE_EXPGNT_PAR_COL  = 0x0000000a,
-SQ_THREAD_TRACE_INST_TYPE_EXPGNT_POS_GDS  = 0x0000000b,
-SQ_THREAD_TRACE_INST_TYPE_JUMP           = 0x0000000c,
-SQ_THREAD_TRACE_INST_TYPE_NEXT           = 0x0000000d,
-SQ_THREAD_TRACE_INST_TYPE_FLAT_RD        = 0x0000000e,
-SQ_THREAD_TRACE_INST_TYPE_OTHER_MSG      = 0x0000000f,
-SQ_THREAD_TRACE_INST_TYPE_SMEM_WR        = 0x00000010,
-SQ_THREAD_TRACE_INST_TYPE_SALU_64        = 0x00000011,
-SQ_THREAD_TRACE_INST_TYPE_VALU_64        = 0x00000012,
-SQ_THREAD_TRACE_INST_TYPE_SMEM_RD_REPLAY  = 0x00000013,
-SQ_THREAD_TRACE_INST_TYPE_SMEM_WR_REPLAY  = 0x00000014,
-SQ_THREAD_TRACE_INST_TYPE_VMEM_RD_REPLAY  = 0x00000015,
-SQ_THREAD_TRACE_INST_TYPE_VMEM_WR_REPLAY  = 0x00000016,
-SQ_THREAD_TRACE_INST_TYPE_FLAT_RD_REPLAY  = 0x00000017,
-SQ_THREAD_TRACE_INST_TYPE_FLAT_WR_REPLAY  = 0x00000018,
-SQ_THREAD_TRACE_INST_TYPE_FATAL_HALT     = 0x00000019,
-} SQ_THREAD_TRACE_INST_TYPE;
-
-/*
- * SQ_THREAD_TRACE_REG_TYPE enum
- */
-
-typedef enum SQ_THREAD_TRACE_REG_TYPE {
-SQ_THREAD_TRACE_REG_TYPE_EVENT           = 0x00000000,
-SQ_THREAD_TRACE_REG_TYPE_DRAW            = 0x00000001,
-SQ_THREAD_TRACE_REG_TYPE_DISPATCH        = 0x00000002,
-SQ_THREAD_TRACE_REG_TYPE_USERDATA        = 0x00000003,
-SQ_THREAD_TRACE_REG_TYPE_MARKER          = 0x00000004,
-SQ_THREAD_TRACE_REG_TYPE_GFXDEC          = 0x00000005,
-SQ_THREAD_TRACE_REG_TYPE_SHDEC           = 0x00000006,
-SQ_THREAD_TRACE_REG_TYPE_OTHER           = 0x00000007,
-} SQ_THREAD_TRACE_REG_TYPE;
-
-/*
- * SQ_THREAD_TRACE_REG_OP enum
- */
-
-typedef enum SQ_THREAD_TRACE_REG_OP {
-SQ_THREAD_TRACE_REG_OP_READ              = 0x00000000,
-SQ_THREAD_TRACE_REG_OP_WRITE             = 0x00000001,
-} SQ_THREAD_TRACE_REG_OP;
-
-/*
- * SQ_THREAD_TRACE_MODE_SEL enum
- */
-
-typedef enum SQ_THREAD_TRACE_MODE_SEL {
-SQ_THREAD_TRACE_MODE_OFF                 = 0x00000000,
-SQ_THREAD_TRACE_MODE_ON                  = 0x00000001,
-} SQ_THREAD_TRACE_MODE_SEL;
-
-/*
- * SQ_THREAD_TRACE_CAPTURE_MODE enum
- */
-
-typedef enum SQ_THREAD_TRACE_CAPTURE_MODE {
-SQ_THREAD_TRACE_CAPTURE_MODE_ALL         = 0x00000000,
-SQ_THREAD_TRACE_CAPTURE_MODE_SELECT      = 0x00000001,
-SQ_THREAD_TRACE_CAPTURE_MODE_SELECT_DETAIL  = 0x00000002,
-} SQ_THREAD_TRACE_CAPTURE_MODE;
-
-/*
- * SQ_THREAD_TRACE_VM_ID_MASK enum
- */
-
-typedef enum SQ_THREAD_TRACE_VM_ID_MASK {
-SQ_THREAD_TRACE_VM_ID_MASK_SINGLE        = 0x00000000,
-SQ_THREAD_TRACE_VM_ID_MASK_ALL           = 0x00000001,
-SQ_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL  = 0x00000002,
-} SQ_THREAD_TRACE_VM_ID_MASK;
-
-/*
- * SQ_THREAD_TRACE_WAVE_MASK enum
- */
-
-typedef enum SQ_THREAD_TRACE_WAVE_MASK {
-SQ_THREAD_TRACE_WAVE_MASK_NONE           = 0x00000000,
-SQ_THREAD_TRACE_WAVE_MASK_ALL            = 0x00000001,
-} SQ_THREAD_TRACE_WAVE_MASK;
-
-/*
- * SQ_THREAD_TRACE_ISSUE enum
- */
-
-typedef enum SQ_THREAD_TRACE_ISSUE {
-SQ_THREAD_TRACE_ISSUE_NULL               = 0x00000000,
-SQ_THREAD_TRACE_ISSUE_STALL              = 0x00000001,
-SQ_THREAD_TRACE_ISSUE_INST               = 0x00000002,
-SQ_THREAD_TRACE_ISSUE_IMMED              = 0x00000003,
-} SQ_THREAD_TRACE_ISSUE;
-
-/*
- * SQ_THREAD_TRACE_ISSUE_MASK enum
- */
-
-typedef enum SQ_THREAD_TRACE_ISSUE_MASK {
-SQ_THREAD_TRACE_ISSUE_MASK_ALL           = 0x00000000,
-SQ_THREAD_TRACE_ISSUE_MASK_STALLED       = 0x00000001,
-SQ_THREAD_TRACE_ISSUE_MASK_STALLED_AND_IMMED  = 0x00000002,
-SQ_THREAD_TRACE_ISSUE_MASK_IMMED         = 0x00000003,
-} SQ_THREAD_TRACE_ISSUE_MASK;
-
-/*
- * SQ_PERF_SEL enum
- */
-
-typedef enum SQ_PERF_SEL {
-SQ_PERF_SEL_NONE                         = 0x00000000,
-SQ_PERF_SEL_ACCUM_PREV                   = 0x00000001,
-SQ_PERF_SEL_CYCLES                       = 0x00000002,
-SQ_PERF_SEL_BUSY_CYCLES                  = 0x00000003,
-SQ_PERF_SEL_WAVES                        = 0x00000004,
-SQ_PERF_SEL_LEVEL_WAVES                  = 0x00000005,
-SQ_PERF_SEL_WAVES_EQ_64                  = 0x00000006,
-SQ_PERF_SEL_WAVES_LT_64                  = 0x00000007,
-SQ_PERF_SEL_WAVES_LT_48                  = 0x00000008,
-SQ_PERF_SEL_WAVES_LT_32                  = 0x00000009,
-SQ_PERF_SEL_WAVES_LT_16                  = 0x0000000a,
-SQ_PERF_SEL_WAVES_CU                     = 0x0000000b,
-SQ_PERF_SEL_LEVEL_WAVES_CU               = 0x0000000c,
-SQ_PERF_SEL_BUSY_CU_CYCLES               = 0x0000000d,
-SQ_PERF_SEL_ITEMS                        = 0x0000000e,
-SQ_PERF_SEL_QUADS                        = 0x0000000f,
-SQ_PERF_SEL_EVENTS                       = 0x00000010,
-SQ_PERF_SEL_SURF_SYNCS                   = 0x00000011,
-SQ_PERF_SEL_TTRACE_REQS                  = 0x00000012,
-SQ_PERF_SEL_TTRACE_INFLIGHT_REQS         = 0x00000013,
-SQ_PERF_SEL_TTRACE_STALL                 = 0x00000014,
-SQ_PERF_SEL_MSG_CNTR                     = 0x00000015,
-SQ_PERF_SEL_MSG_PERF                     = 0x00000016,
-SQ_PERF_SEL_MSG_GSCNT                    = 0x00000017,
-SQ_PERF_SEL_MSG_INTERRUPT                = 0x00000018,
-SQ_PERF_SEL_INSTS                        = 0x00000019,
-SQ_PERF_SEL_INSTS_VALU                   = 0x0000001a,
-SQ_PERF_SEL_INSTS_VMEM_WR                = 0x0000001b,
-SQ_PERF_SEL_INSTS_VMEM_RD                = 0x0000001c,
-SQ_PERF_SEL_INSTS_VMEM                   = 0x0000001d,
-SQ_PERF_SEL_INSTS_SALU                   = 0x0000001e,
-SQ_PERF_SEL_INSTS_SMEM                   = 0x0000001f,
-SQ_PERF_SEL_INSTS_FLAT                   = 0x00000020,
-SQ_PERF_SEL_INSTS_FLAT_LDS_ONLY          = 0x00000021,
-SQ_PERF_SEL_INSTS_LDS                    = 0x00000022,
-SQ_PERF_SEL_INSTS_GDS                    = 0x00000023,
-SQ_PERF_SEL_INSTS_EXP                    = 0x00000024,
-SQ_PERF_SEL_INSTS_EXP_GDS                = 0x00000025,
-SQ_PERF_SEL_INSTS_BRANCH                 = 0x00000026,
-SQ_PERF_SEL_INSTS_SENDMSG                = 0x00000027,
-SQ_PERF_SEL_INSTS_VSKIPPED               = 0x00000028,
-SQ_PERF_SEL_INST_LEVEL_VMEM              = 0x00000029,
-SQ_PERF_SEL_INST_LEVEL_SMEM              = 0x0000002a,
-SQ_PERF_SEL_INST_LEVEL_LDS               = 0x0000002b,
-SQ_PERF_SEL_INST_LEVEL_GDS               = 0x0000002c,
-SQ_PERF_SEL_INST_LEVEL_EXP               = 0x0000002d,
-SQ_PERF_SEL_WAVE_CYCLES                  = 0x0000002e,
-SQ_PERF_SEL_WAVE_READY                   = 0x0000002f,
-SQ_PERF_SEL_WAIT_CNT_VM                  = 0x00000030,
-SQ_PERF_SEL_WAIT_CNT_LGKM                = 0x00000031,
-SQ_PERF_SEL_WAIT_CNT_EXP                 = 0x00000032,
-SQ_PERF_SEL_WAIT_CNT_ANY                 = 0x00000033,
-SQ_PERF_SEL_WAIT_BARRIER                 = 0x00000034,
-SQ_PERF_SEL_WAIT_EXP_ALLOC               = 0x00000035,
-SQ_PERF_SEL_WAIT_SLEEP                   = 0x00000036,
-SQ_PERF_SEL_WAIT_SLEEP_XNACK             = 0x00000037,
-SQ_PERF_SEL_WAIT_OTHER                   = 0x00000038,
-SQ_PERF_SEL_WAIT_ANY                     = 0x00000039,
-SQ_PERF_SEL_WAIT_TTRACE                  = 0x0000003a,
-SQ_PERF_SEL_WAIT_IFETCH                  = 0x0000003b,
-SQ_PERF_SEL_WAIT_INST_ANY                = 0x0000003c,
-SQ_PERF_SEL_WAIT_INST_VMEM               = 0x0000003d,
-SQ_PERF_SEL_WAIT_INST_SCA                = 0x0000003e,
-SQ_PERF_SEL_WAIT_INST_LDS                = 0x0000003f,
-SQ_PERF_SEL_WAIT_INST_VALU               = 0x00000040,
-SQ_PERF_SEL_WAIT_INST_EXP_GDS            = 0x00000041,
-SQ_PERF_SEL_WAIT_INST_MISC               = 0x00000042,
-SQ_PERF_SEL_WAIT_INST_FLAT               = 0x00000043,
-SQ_PERF_SEL_ACTIVE_INST_ANY              = 0x00000044,
-SQ_PERF_SEL_ACTIVE_INST_VMEM             = 0x00000045,
-SQ_PERF_SEL_ACTIVE_INST_LDS              = 0x00000046,
-SQ_PERF_SEL_ACTIVE_INST_VALU             = 0x00000047,
-SQ_PERF_SEL_ACTIVE_INST_SCA              = 0x00000048,
-SQ_PERF_SEL_ACTIVE_INST_EXP_GDS          = 0x00000049,
-SQ_PERF_SEL_ACTIVE_INST_MISC             = 0x0000004a,
-SQ_PERF_SEL_ACTIVE_INST_FLAT             = 0x0000004b,
-SQ_PERF_SEL_INST_CYCLES_VMEM_WR          = 0x0000004c,
-SQ_PERF_SEL_INST_CYCLES_VMEM_RD          = 0x0000004d,
-SQ_PERF_SEL_INST_CYCLES_VMEM_ADDR        = 0x0000004e,
-SQ_PERF_SEL_INST_CYCLES_VMEM_DATA        = 0x0000004f,
-SQ_PERF_SEL_INST_CYCLES_VMEM_CMD         = 0x00000050,
-SQ_PERF_SEL_INST_CYCLES_EXP              = 0x00000051,
-SQ_PERF_SEL_INST_CYCLES_GDS              = 0x00000052,
-SQ_PERF_SEL_INST_CYCLES_SMEM             = 0x00000053,
-SQ_PERF_SEL_INST_CYCLES_SALU             = 0x00000054,
-SQ_PERF_SEL_THREAD_CYCLES_VALU           = 0x00000055,
-SQ_PERF_SEL_THREAD_CYCLES_VALU_MAX       = 0x00000056,
-SQ_PERF_SEL_IFETCH                       = 0x00000057,
-SQ_PERF_SEL_IFETCH_LEVEL                 = 0x00000058,
-SQ_PERF_SEL_CBRANCH_FORK                 = 0x00000059,
-SQ_PERF_SEL_CBRANCH_FORK_SPLIT           = 0x0000005a,
-SQ_PERF_SEL_VALU_LDS_DIRECT_RD           = 0x0000005b,
-SQ_PERF_SEL_VALU_LDS_INTERP_OP           = 0x0000005c,
-SQ_PERF_SEL_LDS_BANK_CONFLICT            = 0x0000005d,
-SQ_PERF_SEL_LDS_ADDR_CONFLICT            = 0x0000005e,
-SQ_PERF_SEL_LDS_UNALIGNED_STALL          = 0x0000005f,
-SQ_PERF_SEL_LDS_MEM_VIOLATIONS           = 0x00000060,
-SQ_PERF_SEL_LDS_ATOMIC_RETURN            = 0x00000061,
-SQ_PERF_SEL_LDS_IDX_ACTIVE               = 0x00000062,
-SQ_PERF_SEL_VALU_DEP_STALL               = 0x00000063,
-SQ_PERF_SEL_VALU_STARVE                  = 0x00000064,
-SQ_PERF_SEL_EXP_REQ_FIFO_FULL            = 0x00000065,
-SQ_PERF_SEL_LDS_DATA_FIFO_FULL           = 0x00000066,
-SQ_PERF_SEL_LDS_CMD_FIFO_FULL            = 0x00000067,
-SQ_PERF_SEL_VMEM_TA_ADDR_FIFO_FULL       = 0x00000068,
-SQ_PERF_SEL_VMEM_TA_CMD_FIFO_FULL        = 0x00000069,
-SQ_PERF_SEL_VMEM_EX_DATA_REG_BUSY        = 0x0000006a,
-SQ_PERF_SEL_VMEM_WR_TA_DATA_FIFO_FULL    = 0x0000006b,
-SQ_PERF_SEL_VALU_SRC_C_CONFLICT          = 0x0000006c,
-SQ_PERF_SEL_VMEM_RD_SRC_CD_CONFLICT      = 0x0000006d,
-SQ_PERF_SEL_VMEM_WR_SRC_CD_CONFLICT      = 0x0000006e,
-SQ_PERF_SEL_FLAT_SRC_CD_CONFLICT         = 0x0000006f,
-SQ_PERF_SEL_LDS_SRC_CD_CONFLICT          = 0x00000070,
-SQ_PERF_SEL_SRC_CD_BUSY                  = 0x00000071,
-SQ_PERF_SEL_PT_POWER_STALL               = 0x00000072,
-SQ_PERF_SEL_USER0                        = 0x00000073,
-SQ_PERF_SEL_USER1                        = 0x00000074,
-SQ_PERF_SEL_USER2                        = 0x00000075,
-SQ_PERF_SEL_USER3                        = 0x00000076,
-SQ_PERF_SEL_USER4                        = 0x00000077,
-SQ_PERF_SEL_USER5                        = 0x00000078,
-SQ_PERF_SEL_USER6                        = 0x00000079,
-SQ_PERF_SEL_USER7                        = 0x0000007a,
-SQ_PERF_SEL_USER8                        = 0x0000007b,
-SQ_PERF_SEL_USER9                        = 0x0000007c,
-SQ_PERF_SEL_USER10                       = 0x0000007d,
-SQ_PERF_SEL_USER11                       = 0x0000007e,
-SQ_PERF_SEL_USER12                       = 0x0000007f,
-SQ_PERF_SEL_USER13                       = 0x00000080,
-SQ_PERF_SEL_USER14                       = 0x00000081,
-SQ_PERF_SEL_USER15                       = 0x00000082,
-SQ_PERF_SEL_USER_LEVEL0                  = 0x00000083,
-SQ_PERF_SEL_USER_LEVEL1                  = 0x00000084,
-SQ_PERF_SEL_USER_LEVEL2                  = 0x00000085,
-SQ_PERF_SEL_USER_LEVEL3                  = 0x00000086,
-SQ_PERF_SEL_USER_LEVEL4                  = 0x00000087,
-SQ_PERF_SEL_USER_LEVEL5                  = 0x00000088,
-SQ_PERF_SEL_USER_LEVEL6                  = 0x00000089,
-SQ_PERF_SEL_USER_LEVEL7                  = 0x0000008a,
-SQ_PERF_SEL_USER_LEVEL8                  = 0x0000008b,
-SQ_PERF_SEL_USER_LEVEL9                  = 0x0000008c,
-SQ_PERF_SEL_USER_LEVEL10                 = 0x0000008d,
-SQ_PERF_SEL_USER_LEVEL11                 = 0x0000008e,
-SQ_PERF_SEL_USER_LEVEL12                 = 0x0000008f,
-SQ_PERF_SEL_USER_LEVEL13                 = 0x00000090,
-SQ_PERF_SEL_USER_LEVEL14                 = 0x00000091,
-SQ_PERF_SEL_USER_LEVEL15                 = 0x00000092,
-SQ_PERF_SEL_POWER_VALU                   = 0x00000093,
-SQ_PERF_SEL_POWER_VALU0                  = 0x00000094,
-SQ_PERF_SEL_POWER_VALU1                  = 0x00000095,
-SQ_PERF_SEL_POWER_VALU2                  = 0x00000096,
-SQ_PERF_SEL_POWER_GPR_RD                 = 0x00000097,
-SQ_PERF_SEL_POWER_GPR_WR                 = 0x00000098,
-SQ_PERF_SEL_POWER_LDS_BUSY               = 0x00000099,
-SQ_PERF_SEL_POWER_ALU_BUSY               = 0x0000009a,
-SQ_PERF_SEL_POWER_TEX_BUSY               = 0x0000009b,
-SQ_PERF_SEL_ACCUM_PREV_HIRES             = 0x0000009c,
-SQ_PERF_SEL_WAVES_RESTORED               = 0x0000009d,
-SQ_PERF_SEL_WAVES_SAVED                  = 0x0000009e,
-SQ_PERF_SEL_INSTS_SMEM_NORM              = 0x0000009f,
-SQ_PERF_SEL_ATC_INSTS_VMEM               = 0x000000a0,
-SQ_PERF_SEL_ATC_INST_LEVEL_VMEM          = 0x000000a1,
-SQ_PERF_SEL_ATC_XNACK_FIRST              = 0x000000a2,
-SQ_PERF_SEL_ATC_XNACK_ALL                = 0x000000a3,
-SQ_PERF_SEL_ATC_XNACK_FIFO_FULL          = 0x000000a4,
-SQ_PERF_SEL_ATC_INSTS_SMEM               = 0x000000a5,
-SQ_PERF_SEL_ATC_INST_LEVEL_SMEM          = 0x000000a6,
-SQ_PERF_SEL_IFETCH_XNACK                 = 0x000000a7,
-SQ_PERF_SEL_TLB_SHOOTDOWN                = 0x000000a8,
-SQ_PERF_SEL_TLB_SHOOTDOWN_CYCLES         = 0x000000a9,
-SQ_PERF_SEL_INSTS_VMEM_WR_REPLAY         = 0x000000aa,
-SQ_PERF_SEL_INSTS_VMEM_RD_REPLAY         = 0x000000ab,
-SQ_PERF_SEL_INSTS_VMEM_REPLAY            = 0x000000ac,
-SQ_PERF_SEL_INSTS_SMEM_REPLAY            = 0x000000ad,
-SQ_PERF_SEL_INSTS_SMEM_NORM_REPLAY       = 0x000000ae,
-SQ_PERF_SEL_INSTS_FLAT_REPLAY            = 0x000000af,
-SQ_PERF_SEL_ATC_INSTS_VMEM_REPLAY        = 0x000000b0,
-SQ_PERF_SEL_ATC_INSTS_SMEM_REPLAY        = 0x000000b1,
-SQ_PERF_SEL_UTCL1_TRANSLATION_MISS       = 0x000000b2,
-SQ_PERF_SEL_UTCL1_PERMISSION_MISS        = 0x000000b3,
-SQ_PERF_SEL_UTCL1_REQUEST                = 0x000000b4,
-SQ_PERF_SEL_UTCL1_STALL_MISSFIFO_FULL    = 0x000000b5,
-SQ_PERF_SEL_UTCL1_STALL_INFLIGHT_MAX     = 0x000000b6,
-SQ_PERF_SEL_UTCL1_STALL_LRU_INFLIGHT     = 0x000000b7,
-SQ_PERF_SEL_UTCL1_LFIFO_FULL             = 0x000000b8,
-SQ_PERF_SEL_UTCL1_STALL_LFIFO_NOT_RES    = 0x000000b9,
-SQ_PERF_SEL_UTCL1_STALL_UTCL2_REQ_OUT_OF_CREDITS  = 0x000000ba,
-SQ_PERF_SEL_DUMMY_END                    = 0x000000bb,
-SQ_PERF_SEL_DUMMY_LAST                   = 0x000000ff,
-SQC_PERF_SEL_ICACHE_INPUT_VALID_READY    = 0x00000100,
-SQC_PERF_SEL_ICACHE_INPUT_VALID_READYB   = 0x00000101,
-SQC_PERF_SEL_ICACHE_INPUT_VALIDB         = 0x00000102,
-SQC_PERF_SEL_DCACHE_INPUT_VALID_READY    = 0x00000103,
-SQC_PERF_SEL_DCACHE_INPUT_VALID_READYB   = 0x00000104,
-SQC_PERF_SEL_DCACHE_INPUT_VALIDB         = 0x00000105,
-SQC_PERF_SEL_TC_REQ                      = 0x00000106,
-SQC_PERF_SEL_TC_INST_REQ                 = 0x00000107,
-SQC_PERF_SEL_TC_DATA_READ_REQ            = 0x00000108,
-SQC_PERF_SEL_TC_DATA_WRITE_REQ           = 0x00000109,
-SQC_PERF_SEL_TC_DATA_ATOMIC_REQ          = 0x0000010a,
-SQC_PERF_SEL_TC_STALL                    = 0x0000010b,
-SQC_PERF_SEL_TC_STARVE                   = 0x0000010c,
-SQC_PERF_SEL_ICACHE_BUSY_CYCLES          = 0x0000010d,
-SQC_PERF_SEL_ICACHE_REQ                  = 0x0000010e,
-SQC_PERF_SEL_ICACHE_HITS                 = 0x0000010f,
-SQC_PERF_SEL_ICACHE_MISSES               = 0x00000110,
-SQC_PERF_SEL_ICACHE_MISSES_DUPLICATE     = 0x00000111,
-SQC_PERF_SEL_ICACHE_INVAL_INST           = 0x00000112,
-SQC_PERF_SEL_ICACHE_INVAL_ASYNC          = 0x00000113,
-SQC_PERF_SEL_ICACHE_INPUT_STALL_ARB_NO_GRANT  = 0x00000114,
-SQC_PERF_SEL_ICACHE_INPUT_STALL_BANK_READYB  = 0x00000115,
-SQC_PERF_SEL_ICACHE_CACHE_STALLED        = 0x00000116,
-SQC_PERF_SEL_ICACHE_CACHE_STALL_INFLIGHT_NONZERO  = 0x00000117,
-SQC_PERF_SEL_ICACHE_CACHE_STALL_INFLIGHT_MAX  = 0x00000118,
-SQC_PERF_SEL_ICACHE_CACHE_STALL_OUTPUT   = 0x00000119,
-SQC_PERF_SEL_ICACHE_CACHE_STALL_OUTPUT_MISS_FIFO  = 0x0000011a,
-SQC_PERF_SEL_ICACHE_CACHE_STALL_OUTPUT_HIT_FIFO  = 0x0000011b,
-SQC_PERF_SEL_ICACHE_CACHE_STALL_OUTPUT_TC_IF  = 0x0000011c,
-SQC_PERF_SEL_ICACHE_STALL_OUTXBAR_ARB_NO_GRANT  = 0x0000011d,
-SQC_PERF_SEL_ICACHE_PREFETCH_1           = 0x0000011e,
-SQC_PERF_SEL_ICACHE_PREFETCH_2           = 0x0000011f,
-SQC_PERF_SEL_ICACHE_PREFETCH_FILTERED    = 0x00000120,
-SQC_PERF_SEL_DCACHE_BUSY_CYCLES          = 0x00000121,
-SQC_PERF_SEL_DCACHE_REQ                  = 0x00000122,
-SQC_PERF_SEL_DCACHE_HITS                 = 0x00000123,
-SQC_PERF_SEL_DCACHE_MISSES               = 0x00000124,
-SQC_PERF_SEL_DCACHE_MISSES_DUPLICATE     = 0x00000125,
-SQC_PERF_SEL_DCACHE_HIT_LRU_READ         = 0x00000126,
-SQC_PERF_SEL_DCACHE_MISS_EVICT_READ      = 0x00000127,
-SQC_PERF_SEL_DCACHE_WC_LRU_WRITE         = 0x00000128,
-SQC_PERF_SEL_DCACHE_WT_EVICT_WRITE       = 0x00000129,
-SQC_PERF_SEL_DCACHE_ATOMIC               = 0x0000012a,
-SQC_PERF_SEL_DCACHE_VOLATILE             = 0x0000012b,
-SQC_PERF_SEL_DCACHE_INVAL_INST           = 0x0000012c,
-SQC_PERF_SEL_DCACHE_INVAL_ASYNC          = 0x0000012d,
-SQC_PERF_SEL_DCACHE_INVAL_VOLATILE_INST  = 0x0000012e,
-SQC_PERF_SEL_DCACHE_INVAL_VOLATILE_ASYNC  = 0x0000012f,
-SQC_PERF_SEL_DCACHE_WB_INST              = 0x00000130,
-SQC_PERF_SEL_DCACHE_WB_ASYNC             = 0x00000131,
-SQC_PERF_SEL_DCACHE_WB_VOLATILE_INST     = 0x00000132,
-SQC_PERF_SEL_DCACHE_WB_VOLATILE_ASYNC    = 0x00000133,
-SQC_PERF_SEL_DCACHE_INPUT_STALL_ARB_NO_GRANT  = 0x00000134,
-SQC_PERF_SEL_DCACHE_INPUT_STALL_BANK_READYB  = 0x00000135,
-SQC_PERF_SEL_DCACHE_CACHE_STALLED        = 0x00000136,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_INFLIGHT_MAX  = 0x00000137,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_OUTPUT   = 0x00000138,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_EVICT    = 0x00000139,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_UNORDERED  = 0x0000013a,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_ALLOC_UNAVAILABLE  = 0x0000013b,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_FORCE_EVICT  = 0x0000013c,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_MULTI_FLUSH  = 0x0000013d,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_FLUSH_DONE  = 0x0000013e,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_OUTPUT_MISS_FIFO  = 0x0000013f,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_OUTPUT_HIT_FIFO  = 0x00000140,
-SQC_PERF_SEL_DCACHE_CACHE_STALL_OUTPUT_TC_IF  = 0x00000141,
-SQC_PERF_SEL_DCACHE_STALL_OUTXBAR_ARB_NO_GRANT  = 0x00000142,
-SQC_PERF_SEL_DCACHE_REQ_READ_1           = 0x00000143,
-SQC_PERF_SEL_DCACHE_REQ_READ_2           = 0x00000144,
-SQC_PERF_SEL_DCACHE_REQ_READ_4           = 0x00000145,
-SQC_PERF_SEL_DCACHE_REQ_READ_8           = 0x00000146,
-SQC_PERF_SEL_DCACHE_REQ_READ_16          = 0x00000147,
-SQC_PERF_SEL_DCACHE_REQ_TIME             = 0x00000148,
-SQC_PERF_SEL_DCACHE_REQ_WRITE_1          = 0x00000149,
-SQC_PERF_SEL_DCACHE_REQ_WRITE_2          = 0x0000014a,
-SQC_PERF_SEL_DCACHE_REQ_WRITE_4          = 0x0000014b,
-SQC_PERF_SEL_DCACHE_REQ_ATC_PROBE        = 0x0000014c,
-SQC_PERF_SEL_SQ_DCACHE_REQS              = 0x0000014d,
-SQC_PERF_SEL_DCACHE_FLAT_REQ             = 0x0000014e,
-SQC_PERF_SEL_DCACHE_NONFLAT_REQ          = 0x0000014f,
-SQC_PERF_SEL_ICACHE_INFLIGHT_LEVEL       = 0x00000150,
-SQC_PERF_SEL_DCACHE_INFLIGHT_LEVEL       = 0x00000151,
-SQC_PERF_SEL_TC_INFLIGHT_LEVEL           = 0x00000152,
-SQC_PERF_SEL_ICACHE_TC_INFLIGHT_LEVEL    = 0x00000153,
-SQC_PERF_SEL_DCACHE_TC_INFLIGHT_LEVEL    = 0x00000154,
-SQC_PERF_SEL_ICACHE_GATCL1_TRANSLATION_MISS  = 0x00000155,
-SQC_PERF_SEL_ICACHE_GATCL1_PERMISSION_MISS  = 0x00000156,
-SQC_PERF_SEL_ICACHE_GATCL1_REQUEST       = 0x00000157,
-SQC_PERF_SEL_ICACHE_GATCL1_STALL_INFLIGHT_MAX  = 0x00000158,
-SQC_PERF_SEL_ICACHE_GATCL1_STALL_LRU_INFLIGHT  = 0x00000159,
-SQC_PERF_SEL_ICACHE_GATCL1_LFIFO_FULL    = 0x0000015a,
-SQC_PERF_SEL_ICACHE_GATCL1_STALL_LFIFO_NOT_RES  = 0x0000015b,
-SQC_PERF_SEL_ICACHE_GATCL1_STALL_ATCL2_REQ_OUT_OF_CREDITS  = 0x0000015c,
-SQC_PERF_SEL_ICACHE_GATCL1_ATCL2_INFLIGHT  = 0x0000015d,
-SQC_PERF_SEL_ICACHE_GATCL1_STALL_MISSFIFO_FULL  = 0x0000015e,
-SQC_PERF_SEL_DCACHE_GATCL1_TRANSLATION_MISS  = 0x0000015f,
-SQC_PERF_SEL_DCACHE_GATCL1_PERMISSION_MISS  = 0x00000160,
-SQC_PERF_SEL_DCACHE_GATCL1_REQUEST       = 0x00000161,
-SQC_PERF_SEL_DCACHE_GATCL1_STALL_INFLIGHT_MAX  = 0x00000162,
-SQC_PERF_SEL_DCACHE_GATCL1_STALL_LRU_INFLIGHT  = 0x00000163,
-SQC_PERF_SEL_DCACHE_GATCL1_LFIFO_FULL    = 0x00000164,
-SQC_PERF_SEL_DCACHE_GATCL1_STALL_LFIFO_NOT_RES  = 0x00000165,
-SQC_PERF_SEL_DCACHE_GATCL1_STALL_ATCL2_REQ_OUT_OF_CREDITS  = 0x00000166,
-SQC_PERF_SEL_DCACHE_GATCL1_ATCL2_INFLIGHT  = 0x00000167,
-SQC_PERF_SEL_DCACHE_GATCL1_STALL_MISSFIFO_FULL  = 0x00000168,
-SQC_PERF_SEL_DCACHE_GATCL1_STALL_MULTI_MISS  = 0x00000169,
-SQC_PERF_SEL_DCACHE_GATCL1_HIT_FIFO_FULL  = 0x0000016a,
-SQC_PERF_SEL_DUMMY_LAST                  = 0x0000016b,
-} SQ_PERF_SEL;
-
-/*
- * SQ_CAC_POWER_SEL enum
- */
-
-typedef enum SQ_CAC_POWER_SEL {
-SQ_CAC_POWER_VALU                        = 0x00000000,
-SQ_CAC_POWER_VALU0                       = 0x00000001,
-SQ_CAC_POWER_VALU1                       = 0x00000002,
-SQ_CAC_POWER_VALU2                       = 0x00000003,
-SQ_CAC_POWER_GPR_RD                      = 0x00000004,
-SQ_CAC_POWER_GPR_WR                      = 0x00000005,
-SQ_CAC_POWER_LDS_BUSY                    = 0x00000006,
-SQ_CAC_POWER_ALU_BUSY                    = 0x00000007,
-SQ_CAC_POWER_TEX_BUSY                    = 0x00000008,
-} SQ_CAC_POWER_SEL;
-
-/*
- * SQ_IND_CMD_CMD enum
- */
-
-typedef enum SQ_IND_CMD_CMD {
-SQ_IND_CMD_CMD_NULL                      = 0x00000000,
-SQ_IND_CMD_CMD_SETHALT                   = 0x00000001,
-SQ_IND_CMD_CMD_SAVECTX                   = 0x00000002,
-SQ_IND_CMD_CMD_KILL                      = 0x00000003,
-SQ_IND_CMD_CMD_DEBUG                     = 0x00000004,
-SQ_IND_CMD_CMD_TRAP                      = 0x00000005,
-SQ_IND_CMD_CMD_SET_SPI_PRIO              = 0x00000006,
-SQ_IND_CMD_CMD_SETFATALHALT              = 0x00000007,
-} SQ_IND_CMD_CMD;
-
-/*
- * SQ_IND_CMD_MODE enum
- */
-
-typedef enum SQ_IND_CMD_MODE {
-SQ_IND_CMD_MODE_SINGLE                   = 0x00000000,
-SQ_IND_CMD_MODE_BROADCAST                = 0x00000001,
-SQ_IND_CMD_MODE_BROADCAST_QUEUE          = 0x00000002,
-SQ_IND_CMD_MODE_BROADCAST_PIPE           = 0x00000003,
-SQ_IND_CMD_MODE_BROADCAST_ME             = 0x00000004,
-} SQ_IND_CMD_MODE;
-
-/*
- * SQ_EDC_INFO_SOURCE enum
- */
-
-typedef enum SQ_EDC_INFO_SOURCE {
-SQ_EDC_INFO_SOURCE_INVALID               = 0x00000000,
-SQ_EDC_INFO_SOURCE_INST                  = 0x00000001,
-SQ_EDC_INFO_SOURCE_SGPR                  = 0x00000002,
-SQ_EDC_INFO_SOURCE_VGPR                  = 0x00000003,
-SQ_EDC_INFO_SOURCE_LDS                   = 0x00000004,
-SQ_EDC_INFO_SOURCE_GDS                   = 0x00000005,
-SQ_EDC_INFO_SOURCE_TA                    = 0x00000006,
-} SQ_EDC_INFO_SOURCE;
-
-/*
- * SQ_ROUND_MODE enum
- */
-
-typedef enum SQ_ROUND_MODE {
-SQ_ROUND_NEAREST_EVEN                    = 0x00000000,
-SQ_ROUND_PLUS_INFINITY                   = 0x00000001,
-SQ_ROUND_MINUS_INFINITY                  = 0x00000002,
-SQ_ROUND_TO_ZERO                         = 0x00000003,
-} SQ_ROUND_MODE;
-
-/*
- * SQ_INTERRUPT_WORD_ENCODING enum
- */
-
-typedef enum SQ_INTERRUPT_WORD_ENCODING {
-SQ_INTERRUPT_WORD_ENCODING_AUTO          = 0x00000000,
-SQ_INTERRUPT_WORD_ENCODING_INST          = 0x00000001,
-SQ_INTERRUPT_WORD_ENCODING_ERROR         = 0x00000002,
-} SQ_INTERRUPT_WORD_ENCODING;
-
-/*
- * ENUM_SQ_EXPORT_RAT_INST enum
- */
-
-typedef enum ENUM_SQ_EXPORT_RAT_INST {
-SQ_EXPORT_RAT_INST_NOP                   = 0x00000000,
-SQ_EXPORT_RAT_INST_STORE_TYPED           = 0x00000001,
-SQ_EXPORT_RAT_INST_STORE_RAW             = 0x00000002,
-SQ_EXPORT_RAT_INST_STORE_RAW_FDENORM     = 0x00000003,
-SQ_EXPORT_RAT_INST_CMPXCHG_INT           = 0x00000004,
-SQ_EXPORT_RAT_INST_CMPXCHG_FLT           = 0x00000005,
-SQ_EXPORT_RAT_INST_CMPXCHG_FDENORM       = 0x00000006,
-SQ_EXPORT_RAT_INST_ADD                   = 0x00000007,
-SQ_EXPORT_RAT_INST_SUB                   = 0x00000008,
-SQ_EXPORT_RAT_INST_RSUB                  = 0x00000009,
-SQ_EXPORT_RAT_INST_MIN_INT               = 0x0000000a,
-SQ_EXPORT_RAT_INST_MIN_UINT              = 0x0000000b,
-SQ_EXPORT_RAT_INST_MAX_INT               = 0x0000000c,
-SQ_EXPORT_RAT_INST_MAX_UINT              = 0x0000000d,
-SQ_EXPORT_RAT_INST_AND                   = 0x0000000e,
-SQ_EXPORT_RAT_INST_OR                    = 0x0000000f,
-SQ_EXPORT_RAT_INST_XOR                   = 0x00000010,
-SQ_EXPORT_RAT_INST_MSKOR                 = 0x00000011,
-SQ_EXPORT_RAT_INST_INC_UINT              = 0x00000012,
-SQ_EXPORT_RAT_INST_DEC_UINT              = 0x00000013,
-SQ_EXPORT_RAT_INST_STORE_DWORD           = 0x00000014,
-SQ_EXPORT_RAT_INST_STORE_SHORT           = 0x00000015,
-SQ_EXPORT_RAT_INST_STORE_BYTE            = 0x00000016,
-SQ_EXPORT_RAT_INST_NOP_RTN               = 0x00000020,
-SQ_EXPORT_RAT_INST_XCHG_RTN              = 0x00000022,
-SQ_EXPORT_RAT_INST_XCHG_FDENORM_RTN      = 0x00000023,
-SQ_EXPORT_RAT_INST_CMPXCHG_INT_RTN       = 0x00000024,
-SQ_EXPORT_RAT_INST_CMPXCHG_FLT_RTN       = 0x00000025,
-SQ_EXPORT_RAT_INST_CMPXCHG_FDENORM_RTN   = 0x00000026,
-SQ_EXPORT_RAT_INST_ADD_RTN               = 0x00000027,
-SQ_EXPORT_RAT_INST_SUB_RTN               = 0x00000028,
-SQ_EXPORT_RAT_INST_RSUB_RTN              = 0x00000029,
-SQ_EXPORT_RAT_INST_MIN_INT_RTN           = 0x0000002a,
-SQ_EXPORT_RAT_INST_MIN_UINT_RTN          = 0x0000002b,
-SQ_EXPORT_RAT_INST_MAX_INT_RTN           = 0x0000002c,
-SQ_EXPORT_RAT_INST_MAX_UINT_RTN          = 0x0000002d,
-SQ_EXPORT_RAT_INST_AND_RTN               = 0x0000002e,
-SQ_EXPORT_RAT_INST_OR_RTN                = 0x0000002f,
-SQ_EXPORT_RAT_INST_XOR_RTN               = 0x00000030,
-SQ_EXPORT_RAT_INST_MSKOR_RTN             = 0x00000031,
-SQ_EXPORT_RAT_INST_INC_UINT_RTN          = 0x00000032,
-SQ_EXPORT_RAT_INST_DEC_UINT_RTN          = 0x00000033,
-} ENUM_SQ_EXPORT_RAT_INST;
-
-/*
- * SQ_IBUF_ST enum
- */
-
-typedef enum SQ_IBUF_ST {
-SQ_IBUF_IB_IDLE                          = 0x00000000,
-SQ_IBUF_IB_INI_WAIT_GNT                  = 0x00000001,
-SQ_IBUF_IB_INI_WAIT_DRET                 = 0x00000002,
-SQ_IBUF_IB_LE_4DW                        = 0x00000003,
-SQ_IBUF_IB_WAIT_DRET                     = 0x00000004,
-SQ_IBUF_IB_EMPTY_WAIT_DRET               = 0x00000005,
-SQ_IBUF_IB_DRET                          = 0x00000006,
-SQ_IBUF_IB_EMPTY_WAIT_GNT                = 0x00000007,
-} SQ_IBUF_ST;
-
-/*
- * SQ_INST_STR_ST enum
- */
-
-typedef enum SQ_INST_STR_ST {
-SQ_INST_STR_IB_WAVE_NORML                = 0x00000000,
-SQ_INST_STR_IB_WAVE2ID_NORMAL_INST_AV    = 0x00000001,
-SQ_INST_STR_IB_WAVE_INTERNAL_INST_AV     = 0x00000002,
-SQ_INST_STR_IB_WAVE_INST_SKIP_AV         = 0x00000003,
-SQ_INST_STR_IB_WAVE_SETVSKIP_ST0         = 0x00000004,
-SQ_INST_STR_IB_WAVE_SETVSKIP_ST1         = 0x00000005,
-SQ_INST_STR_IB_WAVE_NOP_SLEEP_WAIT       = 0x00000006,
-SQ_INST_STR_IB_WAVE_PC_FROM_SGPR_MSG_WAIT  = 0x00000007,
-} SQ_INST_STR_ST;
-
-/*
- * SQ_WAVE_IB_ECC_ST enum
- */
-
-typedef enum SQ_WAVE_IB_ECC_ST {
-SQ_WAVE_IB_ECC_CLEAN                     = 0x00000000,
-SQ_WAVE_IB_ECC_ERR_CONTINUE              = 0x00000001,
-SQ_WAVE_IB_ECC_ERR_HALT                  = 0x00000002,
-SQ_WAVE_IB_ECC_WITH_ERR_MSG              = 0x00000003,
-} SQ_WAVE_IB_ECC_ST;
-
-/*
- * SH_MEM_ADDRESS_MODE enum
- */
-
-typedef enum SH_MEM_ADDRESS_MODE {
-SH_MEM_ADDRESS_MODE_64                   = 0x00000000,
-SH_MEM_ADDRESS_MODE_32                   = 0x00000001,
-} SH_MEM_ADDRESS_MODE;
-
-/*
- * SH_MEM_ALIGNMENT_MODE enum
- */
-
-typedef enum SH_MEM_ALIGNMENT_MODE {
-SH_MEM_ALIGNMENT_MODE_DWORD              = 0x00000000,
-SH_MEM_ALIGNMENT_MODE_DWORD_STRICT       = 0x00000001,
-SH_MEM_ALIGNMENT_MODE_STRICT             = 0x00000002,
-SH_MEM_ALIGNMENT_MODE_UNALIGNED          = 0x00000003,
-} SH_MEM_ALIGNMENT_MODE;
-
-/*
- * SQ_THREAD_TRACE_WAVE_START_COUNT_PREFIX enum
- */
-
-typedef enum SQ_THREAD_TRACE_WAVE_START_COUNT_PREFIX {
-SQ_THREAD_TRACE_WAVE_START_COUNT_PREFIX_WREXEC  = 0x00000018,
-SQ_THREAD_TRACE_WAVE_START_COUNT_PREFIX_RESTORE  = 0x00000019,
-} SQ_THREAD_TRACE_WAVE_START_COUNT_PREFIX;
-
-/*
- * SQ_LB_CTR_SEL_VALUES enum
- */
-
-typedef enum SQ_LB_CTR_SEL_VALUES {
-SQ_LB_CTR_SEL_ALU_CYCLES                 = 0x00000000,
-SQ_LB_CTR_SEL_ALU_STALLS                 = 0x00000001,
-SQ_LB_CTR_SEL_TEX_CYCLES                 = 0x00000002,
-SQ_LB_CTR_SEL_TEX_STALLS                 = 0x00000003,
-SQ_LB_CTR_SEL_SALU_CYCLES                = 0x00000004,
-SQ_LB_CTR_SEL_SCALAR_STALLS              = 0x00000005,
-SQ_LB_CTR_SEL_SMEM_CYCLES                = 0x00000006,
-SQ_LB_CTR_SEL_ICACHE_STALLS              = 0x00000007,
-SQ_LB_CTR_SEL_DCACHE_STALLS              = 0x00000008,
-SQ_LB_CTR_SEL_RESERVED0                  = 0x00000009,
-SQ_LB_CTR_SEL_RESERVED1                  = 0x0000000a,
-SQ_LB_CTR_SEL_RESERVED2                  = 0x0000000b,
-SQ_LB_CTR_SEL_RESERVED3                  = 0x0000000c,
-SQ_LB_CTR_SEL_RESERVED4                  = 0x0000000d,
-SQ_LB_CTR_SEL_RESERVED5                  = 0x0000000e,
-SQ_LB_CTR_SEL_RESERVED6                  = 0x0000000f,
-} SQ_LB_CTR_SEL_VALUES;
-
-/*
- * SQ_WAVE_TYPE value
- */
-
-#define SQ_WAVE_TYPE_PS0               0x00000000
-
-/*
- * SQIND_PARTITIONS value
- */
-
-#define SQIND_GLOBAL_REGS_OFFSET       0x00000000
-#define SQIND_GLOBAL_REGS_SIZE         0x00000008
-#define SQIND_LOCAL_REGS_OFFSET        0x00000008
-#define SQIND_LOCAL_REGS_SIZE          0x00000008
-#define SQIND_WAVE_HWREGS_OFFSET       0x00000010
-#define SQIND_WAVE_HWREGS_SIZE         0x000001f0
-#define SQIND_WAVE_SGPRS_OFFSET        0x00000200
-#define SQIND_WAVE_SGPRS_SIZE          0x00000200
-#define SQIND_WAVE_VGPRS_OFFSET        0x00000400
-#define SQIND_WAVE_VGPRS_SIZE          0x00000100
-
-/*
- * SQ_GFXDEC value
- */
-
-#define SQ_GFXDEC_BEGIN                0x0000a000
-#define SQ_GFXDEC_END                  0x0000c000
-#define SQ_GFXDEC_STATE_ID_SHIFT       0x0000000a
-
-/*
- * SQDEC value
- */
-
-#define SQDEC_BEGIN                    0x00002300
-#define SQDEC_END                      0x000023ff
-
-/*
- * SQPERFSDEC value
- */
-
-#define SQPERFSDEC_BEGIN               0x0000d9c0
-#define SQPERFSDEC_END                 0x0000da40
-
-/*
- * SQPERFDDEC value
- */
-
-#define SQPERFDDEC_BEGIN               0x0000d1c0
-#define SQPERFDDEC_END                 0x0000d240
-
-/*
- * SQGFXUDEC value
- */
-
-#define SQGFXUDEC_BEGIN                0x0000c330
-#define SQGFXUDEC_END                  0x0000c380
-
-/*
- * SQPWRDEC value
- */
-
-#define SQPWRDEC_BEGIN                 0x0000f08c
-#define SQPWRDEC_END                   0x0000f094
-
-/*
- * SQ_DISPATCHER value
- */
-
-#define SQ_DISPATCHER_GFX_MIN          0x00000010
-#define SQ_DISPATCHER_GFX_CNT_PER_RING 0x00000008
-
-/*
- * SQ_MAX value
- */
-
-#define SQ_MAX_PGM_SGPRS               0x00000068
-#define SQ_MAX_PGM_VGPRS               0x00000100
-
-/*
- * SQ_THREAD_TRACE_TIME_UNIT value
- */
-
-#define SQ_THREAD_TRACE_TIME_UNIT      0x00000004
-
-/*
- * SQ_EXCP_BITS value
- */
-
-#define SQ_EX_MODE_EXCP_VALU_BASE      0x00000000
-#define SQ_EX_MODE_EXCP_VALU_SIZE      0x00000007
-#define SQ_EX_MODE_EXCP_INVALID        0x00000000
-#define SQ_EX_MODE_EXCP_INPUT_DENORM   0x00000001
-#define SQ_EX_MODE_EXCP_DIV0           0x00000002
-#define SQ_EX_MODE_EXCP_OVERFLOW       0x00000003
-#define SQ_EX_MODE_EXCP_UNDERFLOW      0x00000004
-#define SQ_EX_MODE_EXCP_INEXACT        0x00000005
-#define SQ_EX_MODE_EXCP_INT_DIV0       0x00000006
-#define SQ_EX_MODE_EXCP_ADDR_WATCH0    0x00000007
-#define SQ_EX_MODE_EXCP_MEM_VIOL       0x00000008
-
-/*
- * SQ_EXCP_HI_BITS value
- */
-
-#define SQ_EX_MODE_EXCP_HI_ADDR_WATCH1 0x00000000
-#define SQ_EX_MODE_EXCP_HI_ADDR_WATCH2 0x00000001
-#define SQ_EX_MODE_EXCP_HI_ADDR_WATCH3 0x00000002
-
-/*
- * HW_INSERTED_INST_ID value
- */
-
-#define INST_ID_PRIV_START             0x80000000
-#define INST_ID_ECC_INTERRUPT_MSG      0xfffffff0
-#define INST_ID_TTRACE_NEW_PC_MSG      0xfffffff1
-#define INST_ID_HW_TRAP                0xfffffff2
-#define INST_ID_KILL_SEQ               0xfffffff3
-#define INST_ID_SPI_WREXEC             0xfffffff4
-#define INST_ID_HOST_REG_TRAP_MSG      0xfffffffe
-
-/*
- * SIMM16_WAITCNT_PARTITIONS value
- */
-
-#define SIMM16_WAITCNT_VM_CNT_START    0x00000000
-#define SIMM16_WAITCNT_VM_CNT_SIZE     0x00000004
-#define SIMM16_WAITCNT_EXP_CNT_START   0x00000004
-#define SIMM16_WAITCNT_EXP_CNT_SIZE    0x00000003
-#define SIMM16_WAITCNT_LGKM_CNT_START  0x00000008
-#define SIMM16_WAITCNT_LGKM_CNT_SIZE   0x00000004
-#define SIMM16_WAITCNT_VM_CNT_HI_START 0x0000000e
-#define SIMM16_WAITCNT_VM_CNT_HI_SIZE  0x00000002
-
-/*
- * SQ_EDC_FUE_CNTL_BITS value
- */
-
-#define SQ_EDC_FUE_CNTL_SQ             0x00000000
-#define SQ_EDC_FUE_CNTL_LDS            0x00000001
-#define SQ_EDC_FUE_CNTL_SIMD0          0x00000002
-#define SQ_EDC_FUE_CNTL_SIMD1          0x00000003
-#define SQ_EDC_FUE_CNTL_SIMD2          0x00000004
-#define SQ_EDC_FUE_CNTL_SIMD3          0x00000005
-#define SQ_EDC_FUE_CNTL_TA             0x00000006
-#define SQ_EDC_FUE_CNTL_TD             0x00000007
-#define SQ_EDC_FUE_CNTL_TCP            0x00000008
-
-/*******************************************************
- * COMP Enums
- *******************************************************/
-
-/*
- * CSDATA_TYPE enum
- */
-
-typedef enum CSDATA_TYPE {
-CSDATA_TYPE_TG                           = 0x00000000,
-CSDATA_TYPE_STATE                        = 0x00000001,
-CSDATA_TYPE_EVENT                        = 0x00000002,
-CSDATA_TYPE_PRIVATE                      = 0x00000003,
-} CSDATA_TYPE;
-
-/*
- * CSDATA_TYPE_WIDTH value
- */
-
-#define CSDATA_TYPE_WIDTH              0x00000002
-
-/*
- * CSDATA_ADDR_WIDTH value
- */
-
-#define CSDATA_ADDR_WIDTH              0x00000007
-
-/*
- * CSDATA_DATA_WIDTH value
- */
-
-#define CSDATA_DATA_WIDTH              0x00000020
-
-/*******************************************************
- * VGT Enums
- *******************************************************/
-
-/*
- * VGT_OUT_PRIM_TYPE enum
- */
-
-typedef enum VGT_OUT_PRIM_TYPE {
-VGT_OUT_POINT                            = 0x00000000,
-VGT_OUT_LINE                             = 0x00000001,
-VGT_OUT_TRI                              = 0x00000002,
-VGT_OUT_RECT_V0                          = 0x00000003,
-VGT_OUT_RECT_V1                          = 0x00000004,
-VGT_OUT_RECT_V2                          = 0x00000005,
-VGT_OUT_RECT_V3                          = 0x00000006,
-VGT_OUT_2D_RECT                          = 0x00000007,
-VGT_TE_QUAD                              = 0x00000008,
-VGT_TE_PRIM_INDEX_LINE                   = 0x00000009,
-VGT_TE_PRIM_INDEX_TRI                    = 0x0000000a,
-VGT_TE_PRIM_INDEX_QUAD                   = 0x0000000b,
-VGT_OUT_LINE_ADJ                         = 0x0000000c,
-VGT_OUT_TRI_ADJ                          = 0x0000000d,
-VGT_OUT_PATCH                            = 0x0000000e,
-} VGT_OUT_PRIM_TYPE;
-
-/*
- * VGT_DI_PRIM_TYPE enum
- */
-
-typedef enum VGT_DI_PRIM_TYPE {
-DI_PT_NONE                               = 0x00000000,
-DI_PT_POINTLIST                          = 0x00000001,
-DI_PT_LINELIST                           = 0x00000002,
-DI_PT_LINESTRIP                          = 0x00000003,
-DI_PT_TRILIST                            = 0x00000004,
-DI_PT_TRIFAN                             = 0x00000005,
-DI_PT_TRISTRIP                           = 0x00000006,
-DI_PT_2D_RECTANGLE                       = 0x00000007,
-DI_PT_UNUSED_1                           = 0x00000008,
-DI_PT_PATCH                              = 0x00000009,
-DI_PT_LINELIST_ADJ                       = 0x0000000a,
-DI_PT_LINESTRIP_ADJ                      = 0x0000000b,
-DI_PT_TRILIST_ADJ                        = 0x0000000c,
-DI_PT_TRISTRIP_ADJ                       = 0x0000000d,
-DI_PT_UNUSED_3                           = 0x0000000e,
-DI_PT_UNUSED_4                           = 0x0000000f,
-DI_PT_TRI_WITH_WFLAGS                    = 0x00000010,
-DI_PT_RECTLIST                           = 0x00000011,
-DI_PT_LINELOOP                           = 0x00000012,
-DI_PT_QUADLIST                           = 0x00000013,
-DI_PT_QUADSTRIP                          = 0x00000014,
-DI_PT_POLYGON                            = 0x00000015,
-} VGT_DI_PRIM_TYPE;
-
-/*
- * VGT_DI_SOURCE_SELECT enum
- */
-
-typedef enum VGT_DI_SOURCE_SELECT {
-DI_SRC_SEL_DMA                           = 0x00000000,
-DI_SRC_SEL_IMMEDIATE                     = 0x00000001,
-DI_SRC_SEL_AUTO_INDEX                    = 0x00000002,
-DI_SRC_SEL_RESERVED                      = 0x00000003,
-} VGT_DI_SOURCE_SELECT;
-
-/*
- * VGT_DI_MAJOR_MODE_SELECT enum
- */
-
-typedef enum VGT_DI_MAJOR_MODE_SELECT {
-DI_MAJOR_MODE_0                          = 0x00000000,
-DI_MAJOR_MODE_1                          = 0x00000001,
-} VGT_DI_MAJOR_MODE_SELECT;
-
-/*
- * VGT_DI_INDEX_SIZE enum
- */
-
-typedef enum VGT_DI_INDEX_SIZE {
-DI_INDEX_SIZE_16_BIT                     = 0x00000000,
-DI_INDEX_SIZE_32_BIT                     = 0x00000001,
-DI_INDEX_SIZE_8_BIT                      = 0x00000002,
-} VGT_DI_INDEX_SIZE;
-
-/*
- * VGT_EVENT_TYPE enum
- */
-
-typedef enum VGT_EVENT_TYPE {
-Reserved_0x00                            = 0x00000000,
-SAMPLE_STREAMOUTSTATS1                   = 0x00000001,
-SAMPLE_STREAMOUTSTATS2                   = 0x00000002,
-SAMPLE_STREAMOUTSTATS3                   = 0x00000003,
-CACHE_FLUSH_TS                           = 0x00000004,
-CONTEXT_DONE                             = 0x00000005,
-CACHE_FLUSH                              = 0x00000006,
-CS_PARTIAL_FLUSH                         = 0x00000007,
-VGT_STREAMOUT_SYNC                       = 0x00000008,
-Reserved_0x09                            = 0x00000009,
-VGT_STREAMOUT_RESET                      = 0x0000000a,
-END_OF_PIPE_INCR_DE                      = 0x0000000b,
-END_OF_PIPE_IB_END                       = 0x0000000c,
-RST_PIX_CNT                              = 0x0000000d,
-BREAK_BATCH                              = 0x0000000e,
-VS_PARTIAL_FLUSH                         = 0x0000000f,
-PS_PARTIAL_FLUSH                         = 0x00000010,
-FLUSH_HS_OUTPUT                          = 0x00000011,
-FLUSH_DFSM                               = 0x00000012,
-RESET_TO_LOWEST_VGT                      = 0x00000013,
-CACHE_FLUSH_AND_INV_TS_EVENT             = 0x00000014,
-ZPASS_DONE                               = 0x00000015,
-CACHE_FLUSH_AND_INV_EVENT                = 0x00000016,
-PERFCOUNTER_START                        = 0x00000017,
-PERFCOUNTER_STOP                         = 0x00000018,
-PIPELINESTAT_START                       = 0x00000019,
-PIPELINESTAT_STOP                        = 0x0000001a,
-PERFCOUNTER_SAMPLE                       = 0x0000001b,
-Available_0x1c                           = 0x0000001c,
-Available_0x1d                           = 0x0000001d,
-SAMPLE_PIPELINESTAT                      = 0x0000001e,
-SO_VGTSTREAMOUT_FLUSH                    = 0x0000001f,
-SAMPLE_STREAMOUTSTATS                    = 0x00000020,
-RESET_VTX_CNT                            = 0x00000021,
-BLOCK_CONTEXT_DONE                       = 0x00000022,
-CS_CONTEXT_DONE                          = 0x00000023,
-VGT_FLUSH                                = 0x00000024,
-TGID_ROLLOVER                            = 0x00000025,
-SQ_NON_EVENT                             = 0x00000026,
-SC_SEND_DB_VPZ                           = 0x00000027,
-BOTTOM_OF_PIPE_TS                        = 0x00000028,
-FLUSH_SX_TS                              = 0x00000029,
-DB_CACHE_FLUSH_AND_INV                   = 0x0000002a,
-FLUSH_AND_INV_DB_DATA_TS                 = 0x0000002b,
-FLUSH_AND_INV_DB_META                    = 0x0000002c,
-FLUSH_AND_INV_CB_DATA_TS                 = 0x0000002d,
-FLUSH_AND_INV_CB_META                    = 0x0000002e,
-CS_DONE                                  = 0x0000002f,
-PS_DONE                                  = 0x00000030,
-FLUSH_AND_INV_CB_PIXEL_DATA              = 0x00000031,
-SX_CB_RAT_ACK_REQUEST                    = 0x00000032,
-THREAD_TRACE_START                       = 0x00000033,
-THREAD_TRACE_STOP                        = 0x00000034,
-THREAD_TRACE_MARKER                      = 0x00000035,
-THREAD_TRACE_FLUSH                       = 0x00000036,
-THREAD_TRACE_FINISH                      = 0x00000037,
-PIXEL_PIPE_STAT_CONTROL                  = 0x00000038,
-PIXEL_PIPE_STAT_DUMP                     = 0x00000039,
-PIXEL_PIPE_STAT_RESET                    = 0x0000003a,
-CONTEXT_SUSPEND                          = 0x0000003b,
-OFFCHIP_HS_DEALLOC                       = 0x0000003c,
-ENABLE_NGG_PIPELINE                      = 0x0000003d,
-ENABLE_LEGACY_PIPELINE                   = 0x0000003e,
-Reserved_0x3f                            = 0x0000003f,
-} VGT_EVENT_TYPE;
-
-/*
- * VGT_DMA_SWAP_MODE enum
- */
-
-typedef enum VGT_DMA_SWAP_MODE {
-VGT_DMA_SWAP_NONE                        = 0x00000000,
-VGT_DMA_SWAP_16_BIT                      = 0x00000001,
-VGT_DMA_SWAP_32_BIT                      = 0x00000002,
-VGT_DMA_SWAP_WORD                        = 0x00000003,
-} VGT_DMA_SWAP_MODE;
-
-/*
- * VGT_INDEX_TYPE_MODE enum
- */
-
-typedef enum VGT_INDEX_TYPE_MODE {
-VGT_INDEX_16                             = 0x00000000,
-VGT_INDEX_32                             = 0x00000001,
-VGT_INDEX_8                              = 0x00000002,
-} VGT_INDEX_TYPE_MODE;
-
-/*
- * VGT_DMA_BUF_TYPE enum
- */
-
-typedef enum VGT_DMA_BUF_TYPE {
-VGT_DMA_BUF_MEM                          = 0x00000000,
-VGT_DMA_BUF_RING                         = 0x00000001,
-VGT_DMA_BUF_SETUP                        = 0x00000002,
-VGT_DMA_PTR_UPDATE                       = 0x00000003,
-} VGT_DMA_BUF_TYPE;
-
-/*
- * VGT_OUTPATH_SELECT enum
- */
-
-typedef enum VGT_OUTPATH_SELECT {
-VGT_OUTPATH_VTX_REUSE                    = 0x00000000,
-VGT_OUTPATH_TESS_EN                      = 0x00000001,
-VGT_OUTPATH_PASSTHRU                     = 0x00000002,
-VGT_OUTPATH_GS_BLOCK                     = 0x00000003,
-VGT_OUTPATH_HS_BLOCK                     = 0x00000004,
-VGT_OUTPATH_PRIM_GEN                     = 0x00000005,
-} VGT_OUTPATH_SELECT;
-
-/*
- * VGT_GRP_PRIM_TYPE enum
- */
-
-typedef enum VGT_GRP_PRIM_TYPE {
-VGT_GRP_3D_POINT                         = 0x00000000,
-VGT_GRP_3D_LINE                          = 0x00000001,
-VGT_GRP_3D_TRI                           = 0x00000002,
-VGT_GRP_3D_RECT                          = 0x00000003,
-VGT_GRP_3D_QUAD                          = 0x00000004,
-VGT_GRP_2D_COPY_RECT_V0                  = 0x00000005,
-VGT_GRP_2D_COPY_RECT_V1                  = 0x00000006,
-VGT_GRP_2D_COPY_RECT_V2                  = 0x00000007,
-VGT_GRP_2D_COPY_RECT_V3                  = 0x00000008,
-VGT_GRP_2D_FILL_RECT                     = 0x00000009,
-VGT_GRP_2D_LINE                          = 0x0000000a,
-VGT_GRP_2D_TRI                           = 0x0000000b,
-VGT_GRP_PRIM_INDEX_LINE                  = 0x0000000c,
-VGT_GRP_PRIM_INDEX_TRI                   = 0x0000000d,
-VGT_GRP_PRIM_INDEX_QUAD                  = 0x0000000e,
-VGT_GRP_3D_LINE_ADJ                      = 0x0000000f,
-VGT_GRP_3D_TRI_ADJ                       = 0x00000010,
-VGT_GRP_3D_PATCH                         = 0x00000011,
-VGT_GRP_2D_RECT                          = 0x00000012,
-} VGT_GRP_PRIM_TYPE;
-
-/*
- * VGT_GRP_PRIM_ORDER enum
- */
-
-typedef enum VGT_GRP_PRIM_ORDER {
-VGT_GRP_LIST                             = 0x00000000,
-VGT_GRP_STRIP                            = 0x00000001,
-VGT_GRP_FAN                              = 0x00000002,
-VGT_GRP_LOOP                             = 0x00000003,
-VGT_GRP_POLYGON                          = 0x00000004,
-} VGT_GRP_PRIM_ORDER;
-
-/*
- * VGT_GROUP_CONV_SEL enum
- */
-
-typedef enum VGT_GROUP_CONV_SEL {
-VGT_GRP_INDEX_16                         = 0x00000000,
-VGT_GRP_INDEX_32                         = 0x00000001,
-VGT_GRP_UINT_16                          = 0x00000002,
-VGT_GRP_UINT_32                          = 0x00000003,
-VGT_GRP_SINT_16                          = 0x00000004,
-VGT_GRP_SINT_32                          = 0x00000005,
-VGT_GRP_FLOAT_32                         = 0x00000006,
-VGT_GRP_AUTO_PRIM                        = 0x00000007,
-VGT_GRP_FIX_1_23_TO_FLOAT                = 0x00000008,
-} VGT_GROUP_CONV_SEL;
-
-/*
- * VGT_GS_MODE_TYPE enum
- */
-
-typedef enum VGT_GS_MODE_TYPE {
-GS_OFF                                   = 0x00000000,
-GS_SCENARIO_A                            = 0x00000001,
-GS_SCENARIO_B                            = 0x00000002,
-GS_SCENARIO_G                            = 0x00000003,
-GS_SCENARIO_C                            = 0x00000004,
-SPRITE_EN                                = 0x00000005,
-} VGT_GS_MODE_TYPE;
-
-/*
- * VGT_GS_CUT_MODE enum
- */
-
-typedef enum VGT_GS_CUT_MODE {
-GS_CUT_1024                              = 0x00000000,
-GS_CUT_512                               = 0x00000001,
-GS_CUT_256                               = 0x00000002,
-GS_CUT_128                               = 0x00000003,
-} VGT_GS_CUT_MODE;
-
-/*
- * VGT_GS_OUTPRIM_TYPE enum
- */
-
-typedef enum VGT_GS_OUTPRIM_TYPE {
-POINTLIST                                = 0x00000000,
-LINESTRIP                                = 0x00000001,
-TRISTRIP                                 = 0x00000002,
-RECTLIST                                 = 0x00000003,
-} VGT_GS_OUTPRIM_TYPE;
-
-/*
- * VGT_CACHE_INVALID_MODE enum
- */
-
-typedef enum VGT_CACHE_INVALID_MODE {
-VC_ONLY                                  = 0x00000000,
-TC_ONLY                                  = 0x00000001,
-VC_AND_TC                                = 0x00000002,
-} VGT_CACHE_INVALID_MODE;
-
-/*
- * VGT_TESS_TYPE enum
- */
-
-typedef enum VGT_TESS_TYPE {
-TESS_ISOLINE                             = 0x00000000,
-TESS_TRIANGLE                            = 0x00000001,
-TESS_QUAD                                = 0x00000002,
-} VGT_TESS_TYPE;
-
-/*
- * VGT_TESS_PARTITION enum
- */
-
-typedef enum VGT_TESS_PARTITION {
-PART_INTEGER                             = 0x00000000,
-PART_POW2                                = 0x00000001,
-PART_FRAC_ODD                            = 0x00000002,
-PART_FRAC_EVEN                           = 0x00000003,
-} VGT_TESS_PARTITION;
-
-/*
- * VGT_TESS_TOPOLOGY enum
- */
-
-typedef enum VGT_TESS_TOPOLOGY {
-OUTPUT_POINT                             = 0x00000000,
-OUTPUT_LINE                              = 0x00000001,
-OUTPUT_TRIANGLE_CW                       = 0x00000002,
-OUTPUT_TRIANGLE_CCW                      = 0x00000003,
-} VGT_TESS_TOPOLOGY;
-
-/*
- * VGT_RDREQ_POLICY enum
- */
-
-typedef enum VGT_RDREQ_POLICY {
-VGT_POLICY_LRU                           = 0x00000000,
-VGT_POLICY_STREAM                        = 0x00000001,
-} VGT_RDREQ_POLICY;
-
-/*
- * VGT_DIST_MODE enum
- */
-
-typedef enum VGT_DIST_MODE {
-NO_DIST                                  = 0x00000000,
-PATCHES                                  = 0x00000001,
-DONUTS                                   = 0x00000002,
-TRAPEZOIDS                               = 0x00000003,
-} VGT_DIST_MODE;
-
-/*
- * VGT_STAGES_LS_EN enum
- */
-
-typedef enum VGT_STAGES_LS_EN {
-LS_STAGE_OFF                             = 0x00000000,
-LS_STAGE_ON                              = 0x00000001,
-CS_STAGE_ON                              = 0x00000002,
-RESERVED_LS                              = 0x00000003,
-} VGT_STAGES_LS_EN;
-
-/*
- * VGT_STAGES_HS_EN enum
- */
-
-typedef enum VGT_STAGES_HS_EN {
-HS_STAGE_OFF                             = 0x00000000,
-HS_STAGE_ON                              = 0x00000001,
-} VGT_STAGES_HS_EN;
-
-/*
- * VGT_STAGES_ES_EN enum
- */
-
-typedef enum VGT_STAGES_ES_EN {
-ES_STAGE_OFF                             = 0x00000000,
-ES_STAGE_DS                              = 0x00000001,
-ES_STAGE_REAL                            = 0x00000002,
-RESERVED_ES                              = 0x00000003,
-} VGT_STAGES_ES_EN;
-
-/*
- * VGT_STAGES_GS_EN enum
- */
-
-typedef enum VGT_STAGES_GS_EN {
-GS_STAGE_OFF                             = 0x00000000,
-GS_STAGE_ON                              = 0x00000001,
-} VGT_STAGES_GS_EN;
-
-/*
- * VGT_STAGES_VS_EN enum
- */
-
-typedef enum VGT_STAGES_VS_EN {
-VS_STAGE_REAL                            = 0x00000000,
-VS_STAGE_DS                              = 0x00000001,
-VS_STAGE_COPY_SHADER                     = 0x00000002,
-RESERVED_VS                              = 0x00000003,
-} VGT_STAGES_VS_EN;
-
-/*
- * VGT_PERFCOUNT_SELECT enum
- */
-
-typedef enum VGT_PERFCOUNT_SELECT {
-vgt_perf_VGT_SPI_ESTHREAD_EVENT_WINDOW_ACTIVE  = 0x00000000,
-vgt_perf_VGT_SPI_ESVERT_VALID            = 0x00000001,
-vgt_perf_VGT_SPI_ESVERT_EOV              = 0x00000002,
-vgt_perf_VGT_SPI_ESVERT_STALLED          = 0x00000003,
-vgt_perf_VGT_SPI_ESVERT_STARVED_BUSY     = 0x00000004,
-vgt_perf_VGT_SPI_ESVERT_STARVED_IDLE     = 0x00000005,
-vgt_perf_VGT_SPI_ESVERT_STATIC           = 0x00000006,
-vgt_perf_VGT_SPI_ESTHREAD_IS_EVENT       = 0x00000007,
-vgt_perf_VGT_SPI_ESTHREAD_SEND           = 0x00000008,
-vgt_perf_VGT_SPI_GSPRIM_VALID            = 0x00000009,
-vgt_perf_VGT_SPI_GSPRIM_EOV              = 0x0000000a,
-vgt_perf_VGT_SPI_GSPRIM_CONT             = 0x0000000b,
-vgt_perf_VGT_SPI_GSPRIM_STALLED          = 0x0000000c,
-vgt_perf_VGT_SPI_GSPRIM_STARVED_BUSY     = 0x0000000d,
-vgt_perf_VGT_SPI_GSPRIM_STARVED_IDLE     = 0x0000000e,
-vgt_perf_VGT_SPI_GSPRIM_STATIC           = 0x0000000f,
-vgt_perf_VGT_SPI_GSTHREAD_EVENT_WINDOW_ACTIVE  = 0x00000010,
-vgt_perf_VGT_SPI_GSTHREAD_IS_EVENT       = 0x00000011,
-vgt_perf_VGT_SPI_GSTHREAD_SEND           = 0x00000012,
-vgt_perf_VGT_SPI_VSTHREAD_EVENT_WINDOW_ACTIVE  = 0x00000013,
-vgt_perf_VGT_SPI_VSVERT_SEND             = 0x00000014,
-vgt_perf_VGT_SPI_VSVERT_EOV              = 0x00000015,
-vgt_perf_VGT_SPI_VSVERT_STALLED          = 0x00000016,
-vgt_perf_VGT_SPI_VSVERT_STARVED_BUSY     = 0x00000017,
-vgt_perf_VGT_SPI_VSVERT_STARVED_IDLE     = 0x00000018,
-vgt_perf_VGT_SPI_VSVERT_STATIC           = 0x00000019,
-vgt_perf_VGT_SPI_VSTHREAD_IS_EVENT       = 0x0000001a,
-vgt_perf_VGT_SPI_VSTHREAD_SEND           = 0x0000001b,
-vgt_perf_VGT_PA_EVENT_WINDOW_ACTIVE      = 0x0000001c,
-vgt_perf_VGT_PA_CLIPV_SEND               = 0x0000001d,
-vgt_perf_VGT_PA_CLIPV_FIRSTVERT          = 0x0000001e,
-vgt_perf_VGT_PA_CLIPV_STALLED            = 0x0000001f,
-vgt_perf_VGT_PA_CLIPV_STARVED_BUSY       = 0x00000020,
-vgt_perf_VGT_PA_CLIPV_STARVED_IDLE       = 0x00000021,
-vgt_perf_VGT_PA_CLIPV_STATIC             = 0x00000022,
-vgt_perf_VGT_PA_CLIPP_SEND               = 0x00000023,
-vgt_perf_VGT_PA_CLIPP_EOP                = 0x00000024,
-vgt_perf_VGT_PA_CLIPP_IS_EVENT           = 0x00000025,
-vgt_perf_VGT_PA_CLIPP_NULL_PRIM          = 0x00000026,
-vgt_perf_VGT_PA_CLIPP_NEW_VTX_VECT       = 0x00000027,
-vgt_perf_VGT_PA_CLIPP_STALLED            = 0x00000028,
-vgt_perf_VGT_PA_CLIPP_STARVED_BUSY       = 0x00000029,
-vgt_perf_VGT_PA_CLIPP_STARVED_IDLE       = 0x0000002a,
-vgt_perf_VGT_PA_CLIPP_STATIC             = 0x0000002b,
-vgt_perf_VGT_PA_CLIPS_SEND               = 0x0000002c,
-vgt_perf_VGT_PA_CLIPS_STALLED            = 0x0000002d,
-vgt_perf_VGT_PA_CLIPS_STARVED_BUSY       = 0x0000002e,
-vgt_perf_VGT_PA_CLIPS_STARVED_IDLE       = 0x0000002f,
-vgt_perf_VGT_PA_CLIPS_STATIC             = 0x00000030,
-vgt_perf_vsvert_ds_send                  = 0x00000031,
-vgt_perf_vsvert_api_send                 = 0x00000032,
-vgt_perf_hs_tif_stall                    = 0x00000033,
-vgt_perf_hs_input_stall                  = 0x00000034,
-vgt_perf_hs_interface_stall              = 0x00000035,
-vgt_perf_hs_tfm_stall                    = 0x00000036,
-vgt_perf_te11_starved                    = 0x00000037,
-vgt_perf_gs_event_stall                  = 0x00000038,
-vgt_perf_vgt_pa_clipp_send_not_event     = 0x00000039,
-vgt_perf_vgt_pa_clipp_valid_prim         = 0x0000003a,
-vgt_perf_reused_es_indices               = 0x0000003b,
-vgt_perf_vs_cache_hits                   = 0x0000003c,
-vgt_perf_gs_cache_hits                   = 0x0000003d,
-vgt_perf_ds_cache_hits                   = 0x0000003e,
-vgt_perf_total_cache_hits                = 0x0000003f,
-vgt_perf_vgt_busy                        = 0x00000040,
-vgt_perf_vgt_gs_busy                     = 0x00000041,
-vgt_perf_esvert_stalled_es_tbl           = 0x00000042,
-vgt_perf_esvert_stalled_gs_tbl           = 0x00000043,
-vgt_perf_esvert_stalled_gs_event         = 0x00000044,
-vgt_perf_esvert_stalled_gsprim           = 0x00000045,
-vgt_perf_gsprim_stalled_es_tbl           = 0x00000046,
-vgt_perf_gsprim_stalled_gs_tbl           = 0x00000047,
-vgt_perf_gsprim_stalled_gs_event         = 0x00000048,
-vgt_perf_gsprim_stalled_esvert           = 0x00000049,
-vgt_perf_esthread_stalled_es_rb_full     = 0x0000004a,
-vgt_perf_esthread_stalled_spi_bp         = 0x0000004b,
-vgt_perf_counters_avail_stalled          = 0x0000004c,
-vgt_perf_gs_rb_space_avail_stalled       = 0x0000004d,
-vgt_perf_gs_issue_rtr_stalled            = 0x0000004e,
-vgt_perf_gsthread_stalled                = 0x0000004f,
-vgt_perf_strmout_stalled                 = 0x00000050,
-vgt_perf_wait_for_es_done_stalled        = 0x00000051,
-vgt_perf_cm_stalled_by_gog               = 0x00000052,
-vgt_perf_cm_reading_stalled              = 0x00000053,
-vgt_perf_cm_stalled_by_gsfetch_done      = 0x00000054,
-vgt_perf_gog_vs_tbl_stalled              = 0x00000055,
-vgt_perf_gog_out_indx_stalled            = 0x00000056,
-vgt_perf_gog_out_prim_stalled            = 0x00000057,
-vgt_perf_waveid_stalled                  = 0x00000058,
-vgt_perf_gog_busy                        = 0x00000059,
-vgt_perf_reused_vs_indices               = 0x0000005a,
-vgt_perf_sclk_reg_vld_event              = 0x0000005b,
-vgt_perf_vs_conflicting_indices          = 0x0000005c,
-vgt_perf_sclk_core_vld_event             = 0x0000005d,
-vgt_perf_hswave_stalled                  = 0x0000005e,
-vgt_perf_sclk_gs_vld_event               = 0x0000005f,
-vgt_perf_VGT_SPI_LSVERT_VALID            = 0x00000060,
-vgt_perf_VGT_SPI_LSVERT_EOV              = 0x00000061,
-vgt_perf_VGT_SPI_LSVERT_STALLED          = 0x00000062,
-vgt_perf_VGT_SPI_LSVERT_STARVED_BUSY     = 0x00000063,
-vgt_perf_VGT_SPI_LSVERT_STARVED_IDLE     = 0x00000064,
-vgt_perf_VGT_SPI_LSVERT_STATIC           = 0x00000065,
-vgt_perf_VGT_SPI_LSWAVE_EVENT_WINDOW_ACTIVE  = 0x00000066,
-vgt_perf_VGT_SPI_LSWAVE_IS_EVENT         = 0x00000067,
-vgt_perf_VGT_SPI_LSWAVE_SEND             = 0x00000068,
-vgt_perf_VGT_SPI_HSVERT_VALID            = 0x00000069,
-vgt_perf_VGT_SPI_HSVERT_EOV              = 0x0000006a,
-vgt_perf_VGT_SPI_HSVERT_STALLED          = 0x0000006b,
-vgt_perf_VGT_SPI_HSVERT_STARVED_BUSY     = 0x0000006c,
-vgt_perf_VGT_SPI_HSVERT_STARVED_IDLE     = 0x0000006d,
-vgt_perf_VGT_SPI_HSVERT_STATIC           = 0x0000006e,
-vgt_perf_VGT_SPI_HSWAVE_EVENT_WINDOW_ACTIVE  = 0x0000006f,
-vgt_perf_VGT_SPI_HSWAVE_IS_EVENT         = 0x00000070,
-vgt_perf_VGT_SPI_HSWAVE_SEND             = 0x00000071,
-vgt_perf_ds_prims                        = 0x00000072,
-vgt_perf_ds_RESERVED                     = 0x00000073,
-vgt_perf_ls_thread_groups                = 0x00000074,
-vgt_perf_hs_thread_groups                = 0x00000075,
-vgt_perf_es_thread_groups                = 0x00000076,
-vgt_perf_vs_thread_groups                = 0x00000077,
-vgt_perf_ls_done_latency                 = 0x00000078,
-vgt_perf_hs_done_latency                 = 0x00000079,
-vgt_perf_es_done_latency                 = 0x0000007a,
-vgt_perf_gs_done_latency                 = 0x0000007b,
-vgt_perf_vgt_hs_busy                     = 0x0000007c,
-vgt_perf_vgt_te11_busy                   = 0x0000007d,
-vgt_perf_ls_flush                        = 0x0000007e,
-vgt_perf_hs_flush                        = 0x0000007f,
-vgt_perf_es_flush                        = 0x00000080,
-vgt_perf_vgt_pa_clipp_eopg               = 0x00000081,
-vgt_perf_ls_done                         = 0x00000082,
-vgt_perf_hs_done                         = 0x00000083,
-vgt_perf_es_done                         = 0x00000084,
-vgt_perf_gs_done                         = 0x00000085,
-vgt_perf_vsfetch_done                    = 0x00000086,
-vgt_perf_gs_done_received                = 0x00000087,
-vgt_perf_es_ring_high_water_mark         = 0x00000088,
-vgt_perf_gs_ring_high_water_mark         = 0x00000089,
-vgt_perf_vs_table_high_water_mark        = 0x0000008a,
-vgt_perf_hs_tgs_active_high_water_mark   = 0x0000008b,
-vgt_perf_pa_clipp_dealloc                = 0x0000008c,
-vgt_perf_cut_mem_flush_stalled           = 0x0000008d,
-vgt_perf_vsvert_work_received            = 0x0000008e,
-vgt_perf_vgt_pa_clipp_starved_after_work  = 0x0000008f,
-vgt_perf_te11_con_starved_after_work     = 0x00000090,
-vgt_perf_hs_waiting_on_ls_done_stall     = 0x00000091,
-vgt_spi_vsvert_valid                     = 0x00000092,
-} VGT_PERFCOUNT_SELECT;
-
-/*
- * IA_PERFCOUNT_SELECT enum
- */
-
-typedef enum IA_PERFCOUNT_SELECT {
-ia_perf_GRP_INPUT_EVENT_WINDOW_ACTIVE    = 0x00000000,
-ia_perf_dma_data_fifo_full               = 0x00000001,
-ia_perf_RESERVED1                        = 0x00000002,
-ia_perf_RESERVED2                        = 0x00000003,
-ia_perf_RESERVED3                        = 0x00000004,
-ia_perf_RESERVED4                        = 0x00000005,
-ia_perf_RESERVED5                        = 0x00000006,
-ia_perf_MC_LAT_BIN_0                     = 0x00000007,
-ia_perf_MC_LAT_BIN_1                     = 0x00000008,
-ia_perf_MC_LAT_BIN_2                     = 0x00000009,
-ia_perf_MC_LAT_BIN_3                     = 0x0000000a,
-ia_perf_MC_LAT_BIN_4                     = 0x0000000b,
-ia_perf_MC_LAT_BIN_5                     = 0x0000000c,
-ia_perf_MC_LAT_BIN_6                     = 0x0000000d,
-ia_perf_MC_LAT_BIN_7                     = 0x0000000e,
-ia_perf_ia_busy                          = 0x0000000f,
-ia_perf_ia_sclk_reg_vld_event            = 0x00000010,
-ia_perf_RESERVED6                        = 0x00000011,
-ia_perf_ia_sclk_core_vld_event           = 0x00000012,
-ia_perf_RESERVED7                        = 0x00000013,
-ia_perf_ia_dma_return                    = 0x00000014,
-ia_perf_ia_stalled                       = 0x00000015,
-ia_perf_shift_starved_pipe0_event        = 0x00000016,
-ia_perf_shift_starved_pipe1_event        = 0x00000017,
-} IA_PERFCOUNT_SELECT;
-
-/*
- * WD_PERFCOUNT_SELECT enum
- */
-
-typedef enum WD_PERFCOUNT_SELECT {
-wd_perf_RBIU_FIFOS_EVENT_WINDOW_ACTIVE   = 0x00000000,
-wd_perf_RBIU_DR_FIFO_STARVED             = 0x00000001,
-wd_perf_RBIU_DR_FIFO_STALLED             = 0x00000002,
-wd_perf_RBIU_DI_FIFO_STARVED             = 0x00000003,
-wd_perf_RBIU_DI_FIFO_STALLED             = 0x00000004,
-wd_perf_wd_busy                          = 0x00000005,
-wd_perf_wd_sclk_reg_vld_event            = 0x00000006,
-wd_perf_wd_sclk_input_vld_event          = 0x00000007,
-wd_perf_wd_sclk_core_vld_event           = 0x00000008,
-wd_perf_wd_stalled                       = 0x00000009,
-wd_perf_inside_tf_bin_0                  = 0x0000000a,
-wd_perf_inside_tf_bin_1                  = 0x0000000b,
-wd_perf_inside_tf_bin_2                  = 0x0000000c,
-wd_perf_inside_tf_bin_3                  = 0x0000000d,
-wd_perf_inside_tf_bin_4                  = 0x0000000e,
-wd_perf_inside_tf_bin_5                  = 0x0000000f,
-wd_perf_inside_tf_bin_6                  = 0x00000010,
-wd_perf_inside_tf_bin_7                  = 0x00000011,
-wd_perf_inside_tf_bin_8                  = 0x00000012,
-wd_perf_tfreq_lat_bin_0                  = 0x00000013,
-wd_perf_tfreq_lat_bin_1                  = 0x00000014,
-wd_perf_tfreq_lat_bin_2                  = 0x00000015,
-wd_perf_tfreq_lat_bin_3                  = 0x00000016,
-wd_perf_tfreq_lat_bin_4                  = 0x00000017,
-wd_perf_tfreq_lat_bin_5                  = 0x00000018,
-wd_perf_tfreq_lat_bin_6                  = 0x00000019,
-wd_perf_tfreq_lat_bin_7                  = 0x0000001a,
-wd_starved_on_hs_done                    = 0x0000001b,
-wd_perf_se0_hs_done_latency              = 0x0000001c,
-wd_perf_se1_hs_done_latency              = 0x0000001d,
-wd_perf_se2_hs_done_latency              = 0x0000001e,
-wd_perf_se3_hs_done_latency              = 0x0000001f,
-wd_perf_hs_done_se0                      = 0x00000020,
-wd_perf_hs_done_se1                      = 0x00000021,
-wd_perf_hs_done_se2                      = 0x00000022,
-wd_perf_hs_done_se3                      = 0x00000023,
-wd_perf_null_patches                     = 0x00000024,
-} WD_PERFCOUNT_SELECT;
-
-/*
- * WD_IA_DRAW_TYPE enum
- */
-
-typedef enum WD_IA_DRAW_TYPE {
-WD_IA_DRAW_TYPE_DI_MM0                   = 0x00000000,
-WD_IA_DRAW_TYPE_REG_XFER                 = 0x00000001,
-WD_IA_DRAW_TYPE_EVENT_INIT               = 0x00000002,
-WD_IA_DRAW_TYPE_EVENT_ADDR               = 0x00000003,
-WD_IA_DRAW_TYPE_MIN_INDX                 = 0x00000004,
-WD_IA_DRAW_TYPE_MAX_INDX                 = 0x00000005,
-WD_IA_DRAW_TYPE_INDX_OFF                 = 0x00000006,
-WD_IA_DRAW_TYPE_IMM_DATA                 = 0x00000007,
-} WD_IA_DRAW_TYPE;
-
-/*
- * WD_IA_DRAW_REG_XFER enum
- */
-
-typedef enum WD_IA_DRAW_REG_XFER {
-WD_IA_DRAW_REG_XFER_IA_MULTI_VGT_PARAM   = 0x00000000,
-WD_IA_DRAW_REG_XFER_VGT_MULTI_PRIM_IB_RESET_EN = 0x00000001,
-} WD_IA_DRAW_REG_XFER;
-
-/*
- * WD_IA_DRAW_SOURCE enum
- */
-
-typedef enum WD_IA_DRAW_SOURCE {
-WD_IA_DRAW_SOURCE_DMA                    = 0x00000000,
-WD_IA_DRAW_SOURCE_IMMD                   = 0x00000001,
-WD_IA_DRAW_SOURCE_AUTO                   = 0x00000002,
-WD_IA_DRAW_SOURCE_OPAQ                   = 0x00000003,
-} WD_IA_DRAW_SOURCE;
-
-/*
- * GS_THREADID_SIZE value
- */
-
-#define GSTHREADID_SIZE                0x00000002
-
-/*******************************************************
- * GB Enums
- *******************************************************/
-
-/*
- * GB_EDC_DED_MODE enum
- */
-
-typedef enum GB_EDC_DED_MODE {
-GB_EDC_DED_MODE_LOG                      = 0x00000000,
-GB_EDC_DED_MODE_HALT                     = 0x00000001,
-GB_EDC_DED_MODE_INT_HALT                 = 0x00000002,
-} GB_EDC_DED_MODE;
-
-/*
- * VALUE_GB_TILING_CONFIG_TABLE_SIZE value
- */
-
-#define GB_TILING_CONFIG_TABLE_SIZE    0x00000020
-
-/*
- * VALUE_GB_TILING_CONFIG_MACROTABLE_SIZE value
- */
-
-#define GB_TILING_CONFIG_MACROTABLE_SIZE 0x00000010
-
-/*******************************************************
- * TP Enums
- *******************************************************/
-
-/*
- * TA_TC_ADDR_MODES enum
- */
-
-typedef enum TA_TC_ADDR_MODES {
-TA_TC_ADDR_MODE_DEFAULT                  = 0x00000000,
-TA_TC_ADDR_MODE_COMP0                    = 0x00000001,
-TA_TC_ADDR_MODE_COMP1                    = 0x00000002,
-TA_TC_ADDR_MODE_COMP2                    = 0x00000003,
-TA_TC_ADDR_MODE_COMP3                    = 0x00000004,
-TA_TC_ADDR_MODE_UNALIGNED                = 0x00000005,
-TA_TC_ADDR_MODE_BORDER_COLOR             = 0x00000006,
-} TA_TC_ADDR_MODES;
-
-/*
- * TA_PERFCOUNT_SEL enum
- */
-
-typedef enum TA_PERFCOUNT_SEL {
-TA_PERF_SEL_NULL                         = 0x00000000,
-TA_PERF_SEL_sh_fifo_busy                 = 0x00000001,
-TA_PERF_SEL_sh_fifo_cmd_busy             = 0x00000002,
-TA_PERF_SEL_sh_fifo_addr_busy            = 0x00000003,
-TA_PERF_SEL_sh_fifo_data_busy            = 0x00000004,
-TA_PERF_SEL_sh_fifo_data_sfifo_busy      = 0x00000005,
-TA_PERF_SEL_sh_fifo_data_tfifo_busy      = 0x00000006,
-TA_PERF_SEL_gradient_busy                = 0x00000007,
-TA_PERF_SEL_gradient_fifo_busy           = 0x00000008,
-TA_PERF_SEL_lod_busy                     = 0x00000009,
-TA_PERF_SEL_lod_fifo_busy                = 0x0000000a,
-TA_PERF_SEL_addresser_busy               = 0x0000000b,
-TA_PERF_SEL_addresser_fifo_busy          = 0x0000000c,
-TA_PERF_SEL_aligner_busy                 = 0x0000000d,
-TA_PERF_SEL_write_path_busy              = 0x0000000e,
-TA_PERF_SEL_ta_busy                      = 0x0000000f,
-TA_PERF_SEL_sq_ta_cmd_cycles             = 0x00000010,
-TA_PERF_SEL_sp_ta_addr_cycles            = 0x00000011,
-TA_PERF_SEL_sp_ta_data_cycles            = 0x00000012,
-TA_PERF_SEL_ta_fa_data_state_cycles      = 0x00000013,
-TA_PERF_SEL_sh_fifo_addr_waiting_on_cmd_cycles  = 0x00000014,
-TA_PERF_SEL_sh_fifo_cmd_waiting_on_addr_cycles  = 0x00000015,
-TA_PERF_SEL_sh_fifo_addr_starved_while_busy_cycles  = 0x00000016,
-TA_PERF_SEL_sh_fifo_cmd_starved_while_busy_cycles  = 0x00000017,
-TA_PERF_SEL_sh_fifo_data_waiting_on_data_state_cycles  = 0x00000018,
-TA_PERF_SEL_sh_fifo_data_state_waiting_on_data_cycles  = 0x00000019,
-TA_PERF_SEL_sh_fifo_data_starved_while_busy_cycles  = 0x0000001a,
-TA_PERF_SEL_sh_fifo_data_state_starved_while_busy_cycles  = 0x0000001b,
-TA_PERF_SEL_RESERVED_28                  = 0x0000001c,
-TA_PERF_SEL_RESERVED_29                  = 0x0000001d,
-TA_PERF_SEL_sh_fifo_addr_cycles          = 0x0000001e,
-TA_PERF_SEL_sh_fifo_data_cycles          = 0x0000001f,
-TA_PERF_SEL_total_wavefronts             = 0x00000020,
-TA_PERF_SEL_gradient_cycles              = 0x00000021,
-TA_PERF_SEL_walker_cycles                = 0x00000022,
-TA_PERF_SEL_aligner_cycles               = 0x00000023,
-TA_PERF_SEL_image_wavefronts             = 0x00000024,
-TA_PERF_SEL_image_read_wavefronts        = 0x00000025,
-TA_PERF_SEL_image_write_wavefronts       = 0x00000026,
-TA_PERF_SEL_image_atomic_wavefronts      = 0x00000027,
-TA_PERF_SEL_image_total_cycles           = 0x00000028,
-TA_PERF_SEL_RESERVED_41                  = 0x00000029,
-TA_PERF_SEL_RESERVED_42                  = 0x0000002a,
-TA_PERF_SEL_RESERVED_43                  = 0x0000002b,
-TA_PERF_SEL_buffer_wavefronts            = 0x0000002c,
-TA_PERF_SEL_buffer_read_wavefronts       = 0x0000002d,
-TA_PERF_SEL_buffer_write_wavefronts      = 0x0000002e,
-TA_PERF_SEL_buffer_atomic_wavefronts     = 0x0000002f,
-TA_PERF_SEL_buffer_coalescable_wavefronts  = 0x00000030,
-TA_PERF_SEL_buffer_total_cycles          = 0x00000031,
-TA_PERF_SEL_buffer_coalescable_addr_multicycled_cycles  = 0x00000032,
-TA_PERF_SEL_buffer_coalescable_clamp_16kdword_multicycled_cycles  = 0x00000033,
-TA_PERF_SEL_buffer_coalesced_read_cycles  = 0x00000034,
-TA_PERF_SEL_buffer_coalesced_write_cycles  = 0x00000035,
-TA_PERF_SEL_addr_stalled_by_tc_cycles    = 0x00000036,
-TA_PERF_SEL_addr_stalled_by_td_cycles    = 0x00000037,
-TA_PERF_SEL_data_stalled_by_tc_cycles    = 0x00000038,
-TA_PERF_SEL_addresser_stalled_by_aligner_only_cycles  = 0x00000039,
-TA_PERF_SEL_addresser_stalled_cycles     = 0x0000003a,
-TA_PERF_SEL_aniso_stalled_by_addresser_only_cycles  = 0x0000003b,
-TA_PERF_SEL_aniso_stalled_cycles         = 0x0000003c,
-TA_PERF_SEL_deriv_stalled_by_aniso_only_cycles  = 0x0000003d,
-TA_PERF_SEL_deriv_stalled_cycles         = 0x0000003e,
-TA_PERF_SEL_aniso_gt1_cycle_quads        = 0x0000003f,
-TA_PERF_SEL_color_1_cycle_pixels         = 0x00000040,
-TA_PERF_SEL_color_2_cycle_pixels         = 0x00000041,
-TA_PERF_SEL_color_3_cycle_pixels         = 0x00000042,
-TA_PERF_SEL_color_4_cycle_pixels         = 0x00000043,
-TA_PERF_SEL_mip_1_cycle_pixels           = 0x00000044,
-TA_PERF_SEL_mip_2_cycle_pixels           = 0x00000045,
-TA_PERF_SEL_vol_1_cycle_pixels           = 0x00000046,
-TA_PERF_SEL_vol_2_cycle_pixels           = 0x00000047,
-TA_PERF_SEL_bilin_point_1_cycle_pixels   = 0x00000048,
-TA_PERF_SEL_mipmap_lod_0_samples         = 0x00000049,
-TA_PERF_SEL_mipmap_lod_1_samples         = 0x0000004a,
-TA_PERF_SEL_mipmap_lod_2_samples         = 0x0000004b,
-TA_PERF_SEL_mipmap_lod_3_samples         = 0x0000004c,
-TA_PERF_SEL_mipmap_lod_4_samples         = 0x0000004d,
-TA_PERF_SEL_mipmap_lod_5_samples         = 0x0000004e,
-TA_PERF_SEL_mipmap_lod_6_samples         = 0x0000004f,
-TA_PERF_SEL_mipmap_lod_7_samples         = 0x00000050,
-TA_PERF_SEL_mipmap_lod_8_samples         = 0x00000051,
-TA_PERF_SEL_mipmap_lod_9_samples         = 0x00000052,
-TA_PERF_SEL_mipmap_lod_10_samples        = 0x00000053,
-TA_PERF_SEL_mipmap_lod_11_samples        = 0x00000054,
-TA_PERF_SEL_mipmap_lod_12_samples        = 0x00000055,
-TA_PERF_SEL_mipmap_lod_13_samples        = 0x00000056,
-TA_PERF_SEL_mipmap_lod_14_samples        = 0x00000057,
-TA_PERF_SEL_mipmap_invalid_samples       = 0x00000058,
-TA_PERF_SEL_aniso_1_cycle_quads          = 0x00000059,
-TA_PERF_SEL_aniso_2_cycle_quads          = 0x0000005a,
-TA_PERF_SEL_aniso_4_cycle_quads          = 0x0000005b,
-TA_PERF_SEL_aniso_6_cycle_quads          = 0x0000005c,
-TA_PERF_SEL_aniso_8_cycle_quads          = 0x0000005d,
-TA_PERF_SEL_aniso_10_cycle_quads         = 0x0000005e,
-TA_PERF_SEL_aniso_12_cycle_quads         = 0x0000005f,
-TA_PERF_SEL_aniso_14_cycle_quads         = 0x00000060,
-TA_PERF_SEL_aniso_16_cycle_quads         = 0x00000061,
-TA_PERF_SEL_write_path_input_cycles      = 0x00000062,
-TA_PERF_SEL_write_path_output_cycles     = 0x00000063,
-TA_PERF_SEL_flat_wavefronts              = 0x00000064,
-TA_PERF_SEL_flat_read_wavefronts         = 0x00000065,
-TA_PERF_SEL_flat_write_wavefronts        = 0x00000066,
-TA_PERF_SEL_flat_atomic_wavefronts       = 0x00000067,
-TA_PERF_SEL_flat_coalesceable_wavefronts  = 0x00000068,
-TA_PERF_SEL_reg_sclk_vld                 = 0x00000069,
-TA_PERF_SEL_local_cg_dyn_sclk_grp0_en    = 0x0000006a,
-TA_PERF_SEL_local_cg_dyn_sclk_grp1_en    = 0x0000006b,
-TA_PERF_SEL_local_cg_dyn_sclk_grp1_mems_en  = 0x0000006c,
-TA_PERF_SEL_local_cg_dyn_sclk_grp4_en    = 0x0000006d,
-TA_PERF_SEL_local_cg_dyn_sclk_grp5_en    = 0x0000006e,
-TA_PERF_SEL_xnack_on_phase0              = 0x0000006f,
-TA_PERF_SEL_xnack_on_phase1              = 0x00000070,
-TA_PERF_SEL_xnack_on_phase2              = 0x00000071,
-TA_PERF_SEL_xnack_on_phase3              = 0x00000072,
-TA_PERF_SEL_first_xnack_on_phase0        = 0x00000073,
-TA_PERF_SEL_first_xnack_on_phase1        = 0x00000074,
-TA_PERF_SEL_first_xnack_on_phase2        = 0x00000075,
-TA_PERF_SEL_first_xnack_on_phase3        = 0x00000076,
-} TA_PERFCOUNT_SEL;
-
-/*
- * TD_PERFCOUNT_SEL enum
- */
-
-typedef enum TD_PERFCOUNT_SEL {
-TD_PERF_SEL_none                         = 0x00000000,
-TD_PERF_SEL_td_busy                      = 0x00000001,
-TD_PERF_SEL_input_busy                   = 0x00000002,
-TD_PERF_SEL_output_busy                  = 0x00000003,
-TD_PERF_SEL_lerp_busy                    = 0x00000004,
-TD_PERF_SEL_reg_sclk_vld                 = 0x00000005,
-TD_PERF_SEL_local_cg_dyn_sclk_grp0_en    = 0x00000006,
-TD_PERF_SEL_local_cg_dyn_sclk_grp1_en    = 0x00000007,
-TD_PERF_SEL_local_cg_dyn_sclk_grp4_en    = 0x00000008,
-TD_PERF_SEL_local_cg_dyn_sclk_grp5_en    = 0x00000009,
-TD_PERF_SEL_tc_td_fifo_full              = 0x0000000a,
-TD_PERF_SEL_constant_state_full          = 0x0000000b,
-TD_PERF_SEL_sample_state_full            = 0x0000000c,
-TD_PERF_SEL_output_fifo_full             = 0x0000000d,
-TD_PERF_SEL_RESERVED_14                  = 0x0000000e,
-TD_PERF_SEL_tc_stall                     = 0x0000000f,
-TD_PERF_SEL_pc_stall                     = 0x00000010,
-TD_PERF_SEL_gds_stall                    = 0x00000011,
-TD_PERF_SEL_RESERVED_18                  = 0x00000012,
-TD_PERF_SEL_RESERVED_19                  = 0x00000013,
-TD_PERF_SEL_gather4_wavefront            = 0x00000014,
-TD_PERF_SEL_gather4h_wavefront           = 0x00000015,
-TD_PERF_SEL_gather4h_packed_wavefront    = 0x00000016,
-TD_PERF_SEL_gather8h_packed_wavefront    = 0x00000017,
-TD_PERF_SEL_sample_c_wavefront           = 0x00000018,
-TD_PERF_SEL_load_wavefront               = 0x00000019,
-TD_PERF_SEL_atomic_wavefront             = 0x0000001a,
-TD_PERF_SEL_store_wavefront              = 0x0000001b,
-TD_PERF_SEL_ldfptr_wavefront             = 0x0000001c,
-TD_PERF_SEL_d16_en_wavefront             = 0x0000001d,
-TD_PERF_SEL_bypass_filter_wavefront      = 0x0000001e,
-TD_PERF_SEL_min_max_filter_wavefront     = 0x0000001f,
-TD_PERF_SEL_coalescable_wavefront        = 0x00000020,
-TD_PERF_SEL_coalesced_phase              = 0x00000021,
-TD_PERF_SEL_four_phase_wavefront         = 0x00000022,
-TD_PERF_SEL_eight_phase_wavefront        = 0x00000023,
-TD_PERF_SEL_sixteen_phase_wavefront      = 0x00000024,
-TD_PERF_SEL_four_phase_forward_wavefront  = 0x00000025,
-TD_PERF_SEL_write_ack_wavefront          = 0x00000026,
-TD_PERF_SEL_RESERVED_39                  = 0x00000027,
-TD_PERF_SEL_user_defined_border          = 0x00000028,
-TD_PERF_SEL_white_border                 = 0x00000029,
-TD_PERF_SEL_opaque_black_border          = 0x0000002a,
-TD_PERF_SEL_RESERVED_43                  = 0x0000002b,
-TD_PERF_SEL_RESERVED_44                  = 0x0000002c,
-TD_PERF_SEL_nack                         = 0x0000002d,
-TD_PERF_SEL_td_sp_traffic                = 0x0000002e,
-TD_PERF_SEL_consume_gds_traffic          = 0x0000002f,
-TD_PERF_SEL_addresscmd_poison            = 0x00000030,
-TD_PERF_SEL_data_poison                  = 0x00000031,
-TD_PERF_SEL_start_cycle_0                = 0x00000032,
-TD_PERF_SEL_start_cycle_1                = 0x00000033,
-TD_PERF_SEL_start_cycle_2                = 0x00000034,
-TD_PERF_SEL_start_cycle_3                = 0x00000035,
-TD_PERF_SEL_null_cycle_output            = 0x00000036,
-TD_PERF_SEL_d16_data_packed              = 0x00000037,
-TD_PERF_SEL_texels_zeroed_out_by_blend_zero_prt  = 0x00000038,
-} TD_PERFCOUNT_SEL;
-
-/*
- * TCP_PERFCOUNT_SELECT enum
- */
-
-typedef enum TCP_PERFCOUNT_SELECT {
-TCP_PERF_SEL_TA_TCP_ADDR_STARVE_CYCLES   = 0x00000000,
-TCP_PERF_SEL_TA_TCP_DATA_STARVE_CYCLES   = 0x00000001,
-TCP_PERF_SEL_TCP_TA_ADDR_STALL_CYCLES    = 0x00000002,
-TCP_PERF_SEL_TCP_TA_DATA_STALL_CYCLES    = 0x00000003,
-TCP_PERF_SEL_TD_TCP_STALL_CYCLES         = 0x00000004,
-TCP_PERF_SEL_TCR_TCP_STALL_CYCLES        = 0x00000005,
-TCP_PERF_SEL_LOD_STALL_CYCLES            = 0x00000006,
-TCP_PERF_SEL_READ_TAGCONFLICT_STALL_CYCLES  = 0x00000007,
-TCP_PERF_SEL_WRITE_TAGCONFLICT_STALL_CYCLES  = 0x00000008,
-TCP_PERF_SEL_ATOMIC_TAGCONFLICT_STALL_CYCLES  = 0x00000009,
-TCP_PERF_SEL_ALLOC_STALL_CYCLES          = 0x0000000a,
-TCP_PERF_SEL_LFIFO_STALL_CYCLES          = 0x0000000b,
-TCP_PERF_SEL_RFIFO_STALL_CYCLES          = 0x0000000c,
-TCP_PERF_SEL_TCR_RDRET_STALL             = 0x0000000d,
-TCP_PERF_SEL_WRITE_CONFLICT_STALL        = 0x0000000e,
-TCP_PERF_SEL_HOLE_READ_STALL             = 0x0000000f,
-TCP_PERF_SEL_READCONFLICT_STALL_CYCLES   = 0x00000010,
-TCP_PERF_SEL_PENDING_STALL_CYCLES        = 0x00000011,
-TCP_PERF_SEL_READFIFO_STALL_CYCLES       = 0x00000012,
-TCP_PERF_SEL_TCP_LATENCY                 = 0x00000013,
-TCP_PERF_SEL_TCC_READ_REQ_LATENCY        = 0x00000014,
-TCP_PERF_SEL_TCC_WRITE_REQ_LATENCY       = 0x00000015,
-TCP_PERF_SEL_TCC_WRITE_REQ_HOLE_LATENCY  = 0x00000016,
-TCP_PERF_SEL_TCC_READ_REQ                = 0x00000017,
-TCP_PERF_SEL_TCC_WRITE_REQ               = 0x00000018,
-TCP_PERF_SEL_TCC_ATOMIC_WITH_RET_REQ     = 0x00000019,
-TCP_PERF_SEL_TCC_ATOMIC_WITHOUT_RET_REQ  = 0x0000001a,
-TCP_PERF_SEL_TOTAL_LOCAL_READ            = 0x0000001b,
-TCP_PERF_SEL_TOTAL_GLOBAL_READ           = 0x0000001c,
-TCP_PERF_SEL_TOTAL_LOCAL_WRITE           = 0x0000001d,
-TCP_PERF_SEL_TOTAL_GLOBAL_WRITE          = 0x0000001e,
-TCP_PERF_SEL_TOTAL_ATOMIC_WITH_RET       = 0x0000001f,
-TCP_PERF_SEL_TOTAL_ATOMIC_WITHOUT_RET    = 0x00000020,
-TCP_PERF_SEL_TOTAL_WBINVL1               = 0x00000021,
-TCP_PERF_SEL_IMG_READ_FMT_1              = 0x00000022,
-TCP_PERF_SEL_IMG_READ_FMT_8              = 0x00000023,
-TCP_PERF_SEL_IMG_READ_FMT_16             = 0x00000024,
-TCP_PERF_SEL_IMG_READ_FMT_32             = 0x00000025,
-TCP_PERF_SEL_IMG_READ_FMT_32_AS_8        = 0x00000026,
-TCP_PERF_SEL_IMG_READ_FMT_32_AS_16       = 0x00000027,
-TCP_PERF_SEL_IMG_READ_FMT_32_AS_128      = 0x00000028,
-TCP_PERF_SEL_IMG_READ_FMT_64_2_CYCLE     = 0x00000029,
-TCP_PERF_SEL_IMG_READ_FMT_64_1_CYCLE     = 0x0000002a,
-TCP_PERF_SEL_IMG_READ_FMT_96             = 0x0000002b,
-TCP_PERF_SEL_IMG_READ_FMT_128_4_CYCLE    = 0x0000002c,
-TCP_PERF_SEL_IMG_READ_FMT_128_1_CYCLE    = 0x0000002d,
-TCP_PERF_SEL_IMG_READ_FMT_BC1            = 0x0000002e,
-TCP_PERF_SEL_IMG_READ_FMT_BC2            = 0x0000002f,
-TCP_PERF_SEL_IMG_READ_FMT_BC3            = 0x00000030,
-TCP_PERF_SEL_IMG_READ_FMT_BC4            = 0x00000031,
-TCP_PERF_SEL_IMG_READ_FMT_BC5            = 0x00000032,
-TCP_PERF_SEL_IMG_READ_FMT_BC6            = 0x00000033,
-TCP_PERF_SEL_IMG_READ_FMT_BC7            = 0x00000034,
-TCP_PERF_SEL_IMG_READ_FMT_I8             = 0x00000035,
-TCP_PERF_SEL_IMG_READ_FMT_I16            = 0x00000036,
-TCP_PERF_SEL_IMG_READ_FMT_I32            = 0x00000037,
-TCP_PERF_SEL_IMG_READ_FMT_I32_AS_8       = 0x00000038,
-TCP_PERF_SEL_IMG_READ_FMT_I32_AS_16      = 0x00000039,
-TCP_PERF_SEL_IMG_READ_FMT_D8             = 0x0000003a,
-TCP_PERF_SEL_IMG_READ_FMT_D16            = 0x0000003b,
-TCP_PERF_SEL_IMG_READ_FMT_D32            = 0x0000003c,
-TCP_PERF_SEL_IMG_WRITE_FMT_8             = 0x0000003d,
-TCP_PERF_SEL_IMG_WRITE_FMT_16            = 0x0000003e,
-TCP_PERF_SEL_IMG_WRITE_FMT_32            = 0x0000003f,
-TCP_PERF_SEL_IMG_WRITE_FMT_64            = 0x00000040,
-TCP_PERF_SEL_IMG_WRITE_FMT_128           = 0x00000041,
-TCP_PERF_SEL_IMG_WRITE_FMT_D8            = 0x00000042,
-TCP_PERF_SEL_IMG_WRITE_FMT_D16           = 0x00000043,
-TCP_PERF_SEL_IMG_WRITE_FMT_D32           = 0x00000044,
-TCP_PERF_SEL_IMG_ATOMIC_WITH_RET_FMT_32  = 0x00000045,
-TCP_PERF_SEL_IMG_ATOMIC_WITHOUT_RET_FMT_32  = 0x00000046,
-TCP_PERF_SEL_IMG_ATOMIC_WITH_RET_FMT_64  = 0x00000047,
-TCP_PERF_SEL_IMG_ATOMIC_WITHOUT_RET_FMT_64  = 0x00000048,
-TCP_PERF_SEL_BUF_READ_FMT_8              = 0x00000049,
-TCP_PERF_SEL_BUF_READ_FMT_16             = 0x0000004a,
-TCP_PERF_SEL_BUF_READ_FMT_32             = 0x0000004b,
-TCP_PERF_SEL_BUF_WRITE_FMT_8             = 0x0000004c,
-TCP_PERF_SEL_BUF_WRITE_FMT_16            = 0x0000004d,
-TCP_PERF_SEL_BUF_WRITE_FMT_32            = 0x0000004e,
-TCP_PERF_SEL_BUF_ATOMIC_WITH_RET_FMT_32  = 0x0000004f,
-TCP_PERF_SEL_BUF_ATOMIC_WITHOUT_RET_FMT_32  = 0x00000050,
-TCP_PERF_SEL_BUF_ATOMIC_WITH_RET_FMT_64  = 0x00000051,
-TCP_PERF_SEL_BUF_ATOMIC_WITHOUT_RET_FMT_64  = 0x00000052,
-TCP_PERF_SEL_ARR_LINEAR_GENERAL          = 0x00000053,
-TCP_PERF_SEL_ARR_LINEAR_ALIGNED          = 0x00000054,
-TCP_PERF_SEL_ARR_1D_THIN1                = 0x00000055,
-TCP_PERF_SEL_ARR_1D_THICK                = 0x00000056,
-TCP_PERF_SEL_ARR_2D_THIN1                = 0x00000057,
-TCP_PERF_SEL_ARR_2D_THICK                = 0x00000058,
-TCP_PERF_SEL_ARR_2D_XTHICK               = 0x00000059,
-TCP_PERF_SEL_ARR_3D_THIN1                = 0x0000005a,
-TCP_PERF_SEL_ARR_3D_THICK                = 0x0000005b,
-TCP_PERF_SEL_ARR_3D_XTHICK               = 0x0000005c,
-TCP_PERF_SEL_DIM_1D                      = 0x0000005d,
-TCP_PERF_SEL_DIM_2D                      = 0x0000005e,
-TCP_PERF_SEL_DIM_3D                      = 0x0000005f,
-TCP_PERF_SEL_DIM_1D_ARRAY                = 0x00000060,
-TCP_PERF_SEL_DIM_2D_ARRAY                = 0x00000061,
-TCP_PERF_SEL_DIM_2D_MSAA                 = 0x00000062,
-TCP_PERF_SEL_DIM_2D_ARRAY_MSAA           = 0x00000063,
-TCP_PERF_SEL_DIM_CUBE_ARRAY              = 0x00000064,
-TCP_PERF_SEL_CP_TCP_INVALIDATE           = 0x00000065,
-TCP_PERF_SEL_TA_TCP_STATE_READ           = 0x00000066,
-TCP_PERF_SEL_TAGRAM0_REQ                 = 0x00000067,
-TCP_PERF_SEL_TAGRAM1_REQ                 = 0x00000068,
-TCP_PERF_SEL_TAGRAM2_REQ                 = 0x00000069,
-TCP_PERF_SEL_TAGRAM3_REQ                 = 0x0000006a,
-TCP_PERF_SEL_GATE_EN1                    = 0x0000006b,
-TCP_PERF_SEL_GATE_EN2                    = 0x0000006c,
-TCP_PERF_SEL_CORE_REG_SCLK_VLD           = 0x0000006d,
-TCP_PERF_SEL_TCC_REQ                     = 0x0000006e,
-TCP_PERF_SEL_TCC_NON_READ_REQ            = 0x0000006f,
-TCP_PERF_SEL_TCC_BYPASS_READ_REQ         = 0x00000070,
-TCP_PERF_SEL_TCC_MISS_EVICT_READ_REQ     = 0x00000071,
-TCP_PERF_SEL_TCC_VOLATILE_READ_REQ       = 0x00000072,
-TCP_PERF_SEL_TCC_VOLATILE_BYPASS_READ_REQ  = 0x00000073,
-TCP_PERF_SEL_TCC_VOLATILE_MISS_EVICT_READ_REQ  = 0x00000074,
-TCP_PERF_SEL_TCC_BYPASS_WRITE_REQ        = 0x00000075,
-TCP_PERF_SEL_TCC_MISS_EVICT_WRITE_REQ    = 0x00000076,
-TCP_PERF_SEL_TCC_VOLATILE_BYPASS_WRITE_REQ  = 0x00000077,
-TCP_PERF_SEL_TCC_VOLATILE_WRITE_REQ      = 0x00000078,
-TCP_PERF_SEL_TCC_VOLATILE_MISS_EVICT_WRITE_REQ  = 0x00000079,
-TCP_PERF_SEL_TCC_BYPASS_ATOMIC_REQ       = 0x0000007a,
-TCP_PERF_SEL_TCC_ATOMIC_REQ              = 0x0000007b,
-TCP_PERF_SEL_TCC_VOLATILE_ATOMIC_REQ     = 0x0000007c,
-TCP_PERF_SEL_TCC_DATA_BUS_BUSY           = 0x0000007d,
-TCP_PERF_SEL_TOTAL_ACCESSES              = 0x0000007e,
-TCP_PERF_SEL_TOTAL_READ                  = 0x0000007f,
-TCP_PERF_SEL_TOTAL_HIT_LRU_READ          = 0x00000080,
-TCP_PERF_SEL_TOTAL_HIT_EVICT_READ        = 0x00000081,
-TCP_PERF_SEL_TOTAL_MISS_LRU_READ         = 0x00000082,
-TCP_PERF_SEL_TOTAL_MISS_EVICT_READ       = 0x00000083,
-TCP_PERF_SEL_TOTAL_NON_READ              = 0x00000084,
-TCP_PERF_SEL_TOTAL_WRITE                 = 0x00000085,
-TCP_PERF_SEL_TOTAL_MISS_LRU_WRITE        = 0x00000086,
-TCP_PERF_SEL_TOTAL_MISS_EVICT_WRITE      = 0x00000087,
-TCP_PERF_SEL_TOTAL_WBINVL1_VOL           = 0x00000088,
-TCP_PERF_SEL_TOTAL_WRITEBACK_INVALIDATES  = 0x00000089,
-TCP_PERF_SEL_DISPLAY_MICROTILING         = 0x0000008a,
-TCP_PERF_SEL_THIN_MICROTILING            = 0x0000008b,
-TCP_PERF_SEL_DEPTH_MICROTILING           = 0x0000008c,
-TCP_PERF_SEL_ARR_PRT_THIN1               = 0x0000008d,
-TCP_PERF_SEL_ARR_PRT_2D_THIN1            = 0x0000008e,
-TCP_PERF_SEL_ARR_PRT_3D_THIN1            = 0x0000008f,
-TCP_PERF_SEL_ARR_PRT_THICK               = 0x00000090,
-TCP_PERF_SEL_ARR_PRT_2D_THICK            = 0x00000091,
-TCP_PERF_SEL_ARR_PRT_3D_THICK            = 0x00000092,
-TCP_PERF_SEL_CP_TCP_INVALIDATE_VOL       = 0x00000093,
-TCP_PERF_SEL_SQ_TCP_INVALIDATE_VOL       = 0x00000094,
-TCP_PERF_SEL_UNALIGNED                   = 0x00000095,
-TCP_PERF_SEL_ROTATED_MICROTILING         = 0x00000096,
-TCP_PERF_SEL_THICK_MICROTILING           = 0x00000097,
-TCP_PERF_SEL_ATC                         = 0x00000098,
-TCP_PERF_SEL_POWER_STALL                 = 0x00000099,
-TCP_PERF_SEL_RESERVED_154                = 0x0000009a,
-TCP_PERF_SEL_TCC_LRU_REQ                 = 0x0000009b,
-TCP_PERF_SEL_TCC_STREAM_REQ              = 0x0000009c,
-TCP_PERF_SEL_TCC_NC_READ_REQ             = 0x0000009d,
-TCP_PERF_SEL_TCC_NC_WRITE_REQ            = 0x0000009e,
-TCP_PERF_SEL_TCC_NC_ATOMIC_REQ           = 0x0000009f,
-TCP_PERF_SEL_TCC_UC_READ_REQ             = 0x000000a0,
-TCP_PERF_SEL_TCC_UC_WRITE_REQ            = 0x000000a1,
-TCP_PERF_SEL_TCC_UC_ATOMIC_REQ           = 0x000000a2,
-TCP_PERF_SEL_TCC_CC_READ_REQ             = 0x000000a3,
-TCP_PERF_SEL_TCC_CC_WRITE_REQ            = 0x000000a4,
-TCP_PERF_SEL_TCC_CC_ATOMIC_REQ           = 0x000000a5,
-TCP_PERF_SEL_TCC_DCC_REQ                 = 0x000000a6,
-TCP_PERF_SEL_TCC_PHYSICAL_REQ            = 0x000000a7,
-TCP_PERF_SEL_UNORDERED_MTYPE_STALL       = 0x000000a8,
-TCP_PERF_SEL_VOLATILE                    = 0x000000a9,
-TCP_PERF_SEL_TC_TA_XNACK_STALL           = 0x000000aa,
-TCP_PERF_SEL_UTCL1_SERIALIZATION_STALL   = 0x000000ab,
-TCP_PERF_SEL_SHOOTDOWN                   = 0x000000ac,
-TCP_PERF_SEL_UTCL1_TRANSLATION_MISS      = 0x000000ad,
-TCP_PERF_SEL_UTCL1_PERMISSION_MISS       = 0x000000ae,
-TCP_PERF_SEL_UTCL1_REQUEST               = 0x000000af,
-TCP_PERF_SEL_UTCL1_STALL_INFLIGHT_MAX    = 0x000000b0,
-TCP_PERF_SEL_UTCL1_STALL_LRU_INFLIGHT    = 0x000000b1,
-TCP_PERF_SEL_UTCL1_LFIFO_FULL            = 0x000000b2,
-TCP_PERF_SEL_UTCL1_STALL_LFIFO_NOT_RES   = 0x000000b3,
-TCP_PERF_SEL_UTCL1_STALL_UTCL2_REQ_OUT_OF_CREDITS  = 0x000000b4,
-TCP_PERF_SEL_UTCL1_UTCL2_INFLIGHT        = 0x000000b5,
-TCP_PERF_SEL_UTCL1_STALL_MISSFIFO_FULL   = 0x000000b6,
-TCP_PERF_SEL_IMG_READ_FMT_ETC2_RGB       = 0x000000b7,
-TCP_PERF_SEL_IMG_READ_FMT_ETC2_RGBA      = 0x000000b8,
-TCP_PERF_SEL_IMG_READ_FMT_ETC2_RGBA1     = 0x000000b9,
-TCP_PERF_SEL_IMG_READ_FMT_ETC2_R         = 0x000000ba,
-TCP_PERF_SEL_IMG_READ_FMT_ETC2_RG        = 0x000000bb,
-TCP_PERF_SEL_IMG_READ_FMT_8_AS_32        = 0x000000bc,
-TCP_PERF_SEL_IMG_READ_FMT_8_AS_64        = 0x000000bd,
-TCP_PERF_SEL_IMG_READ_FMT_16_AS_64       = 0x000000be,
-TCP_PERF_SEL_IMG_READ_FMT_16_AS_128      = 0x000000bf,
-TCP_PERF_SEL_IMG_WRITE_FMT_8_AS_32       = 0x000000c0,
-TCP_PERF_SEL_IMG_WRITE_FMT_8_AS_64       = 0x000000c1,
-TCP_PERF_SEL_IMG_WRITE_FMT_16_AS_64      = 0x000000c2,
-TCP_PERF_SEL_IMG_WRITE_FMT_16_AS_128     = 0x000000c3,
-} TCP_PERFCOUNT_SELECT;
-
-/*
- * TCP_CACHE_POLICIES enum
- */
-
-typedef enum TCP_CACHE_POLICIES {
-TCP_CACHE_POLICY_MISS_LRU                = 0x00000000,
-TCP_CACHE_POLICY_MISS_EVICT              = 0x00000001,
-TCP_CACHE_POLICY_HIT_LRU                 = 0x00000002,
-TCP_CACHE_POLICY_HIT_EVICT               = 0x00000003,
-} TCP_CACHE_POLICIES;
-
-/*
- * TCP_CACHE_STORE_POLICIES enum
- */
-
-typedef enum TCP_CACHE_STORE_POLICIES {
-TCP_CACHE_STORE_POLICY_WT_LRU            = 0x00000000,
-TCP_CACHE_STORE_POLICY_WT_EVICT          = 0x00000001,
-} TCP_CACHE_STORE_POLICIES;
-
-/*
- * TCP_WATCH_MODES enum
- */
-
-typedef enum TCP_WATCH_MODES {
-TCP_WATCH_MODE_READ                      = 0x00000000,
-TCP_WATCH_MODE_NONREAD                   = 0x00000001,
-TCP_WATCH_MODE_ATOMIC                    = 0x00000002,
-TCP_WATCH_MODE_ALL                       = 0x00000003,
-} TCP_WATCH_MODES;
-
-/*
- * TCP_DSM_DATA_SEL enum
- */
-
-typedef enum TCP_DSM_DATA_SEL {
-TCP_DSM_DISABLE                          = 0x00000000,
-TCP_DSM_SEL0                             = 0x00000001,
-TCP_DSM_SEL1                             = 0x00000002,
-TCP_DSM_SEL_BOTH                         = 0x00000003,
-} TCP_DSM_DATA_SEL;
-
-/*
- * TCP_DSM_SINGLE_WRITE enum
- */
-
-typedef enum TCP_DSM_SINGLE_WRITE {
-TCP_DSM_SINGLE_WRITE_DIS                 = 0x00000000,
-TCP_DSM_SINGLE_WRITE_EN                  = 0x00000001,
-} TCP_DSM_SINGLE_WRITE;
-
-/*
- * TCP_DSM_INJECT_SEL enum
- */
-
-typedef enum TCP_DSM_INJECT_SEL {
-TCP_DSM_INJECT_SEL0                      = 0x00000000,
-TCP_DSM_INJECT_SEL1                      = 0x00000001,
-TCP_DSM_INJECT_SEL2                      = 0x00000002,
-TCP_DSM_INJECT_SEL3                      = 0x00000003,
-} TCP_DSM_INJECT_SEL;
-
-/*******************************************************
- * TCC Enums
- *******************************************************/
-
-/*
- * TCC_PERF_SEL enum
- */
-
-typedef enum TCC_PERF_SEL {
-TCC_PERF_SEL_NONE                        = 0x00000000,
-TCC_PERF_SEL_CYCLE                       = 0x00000001,
-TCC_PERF_SEL_BUSY                        = 0x00000002,
-TCC_PERF_SEL_REQ                         = 0x00000003,
-TCC_PERF_SEL_STREAMING_REQ               = 0x00000004,
-TCC_PERF_SEL_EXE_REQ                     = 0x00000005,
-TCC_PERF_SEL_COMPRESSED_REQ              = 0x00000006,
-TCC_PERF_SEL_COMPRESSED_0_REQ            = 0x00000007,
-TCC_PERF_SEL_METADATA_REQ                = 0x00000008,
-TCC_PERF_SEL_NC_VIRTUAL_REQ              = 0x00000009,
-TCC_PERF_SEL_UC_VIRTUAL_REQ              = 0x0000000a,
-TCC_PERF_SEL_CC_PHYSICAL_REQ             = 0x0000000b,
-TCC_PERF_SEL_PROBE                       = 0x0000000c,
-TCC_PERF_SEL_PROBE_ALL                   = 0x0000000d,
-TCC_PERF_SEL_READ                        = 0x0000000e,
-TCC_PERF_SEL_WRITE                       = 0x0000000f,
-TCC_PERF_SEL_ATOMIC                      = 0x00000010,
-TCC_PERF_SEL_HIT                         = 0x00000011,
-TCC_PERF_SEL_SECTOR_HIT                  = 0x00000012,
-TCC_PERF_SEL_MISS                        = 0x00000013,
-TCC_PERF_SEL_DEWRITE_ALLOCATE_HIT        = 0x00000014,
-TCC_PERF_SEL_FULLY_WRITTEN_HIT           = 0x00000015,
-TCC_PERF_SEL_WRITEBACK                   = 0x00000016,
-TCC_PERF_SEL_LATENCY_FIFO_FULL           = 0x00000017,
-TCC_PERF_SEL_SRC_FIFO_FULL               = 0x00000018,
-TCC_PERF_SEL_HOLE_FIFO_FULL              = 0x00000019,
-TCC_PERF_SEL_EA_WRREQ                    = 0x0000001a,
-TCC_PERF_SEL_EA_WRREQ_64B                = 0x0000001b,
-TCC_PERF_SEL_EA_WRREQ_PROBE_COMMAND      = 0x0000001c,
-TCC_PERF_SEL_EA_WR_UNCACHED_32B          = 0x0000001d,
-TCC_PERF_SEL_EA_WRREQ_STALL              = 0x0000001e,
-TCC_PERF_SEL_EA_WRREQ_CREDIT_STALL       = 0x0000001f,
-TCC_PERF_SEL_TOO_MANY_EA_WRREQS_STALL    = 0x00000020,
-TCC_PERF_SEL_EA_WRREQ_LEVEL              = 0x00000021,
-TCC_PERF_SEL_EA_ATOMIC                   = 0x00000022,
-TCC_PERF_SEL_EA_ATOMIC_LEVEL             = 0x00000023,
-TCC_PERF_SEL_EA_RDREQ                    = 0x00000024,
-TCC_PERF_SEL_EA_RDREQ_32B                = 0x00000025,
-TCC_PERF_SEL_EA_RD_UNCACHED_32B          = 0x00000026,
-TCC_PERF_SEL_EA_RD_MDC_32B               = 0x00000027,
-TCC_PERF_SEL_EA_RD_COMPRESSED_32B        = 0x00000028,
-TCC_PERF_SEL_EA_RDREQ_CREDIT_STALL       = 0x00000029,
-TCC_PERF_SEL_EA_RDREQ_LEVEL              = 0x0000002a,
-TCC_PERF_SEL_TAG_STALL                   = 0x0000002b,
-TCC_PERF_SEL_TAG_WRITEBACK_FIFO_FULL_STALL  = 0x0000002c,
-TCC_PERF_SEL_TAG_MISS_NOTHING_REPLACEABLE_STALL  = 0x0000002d,
-TCC_PERF_SEL_TAG_UNCACHED_WRITE_ATOMIC_FIFO_FULL_STALL  = 0x0000002e,
-TCC_PERF_SEL_TAG_NO_UNCACHED_WRITE_ATOMIC_ENTRIES_STALL  = 0x0000002f,
-TCC_PERF_SEL_TAG_PROBE_STALL             = 0x00000030,
-TCC_PERF_SEL_TAG_PROBE_FILTER_STALL      = 0x00000031,
-TCC_PERF_SEL_READ_RETURN_TIMEOUT         = 0x00000032,
-TCC_PERF_SEL_WRITEBACK_READ_TIMEOUT      = 0x00000033,
-TCC_PERF_SEL_READ_RETURN_FULL_BUBBLE     = 0x00000034,
-TCC_PERF_SEL_BUBBLE                      = 0x00000035,
-TCC_PERF_SEL_RETURN_ACK                  = 0x00000036,
-TCC_PERF_SEL_RETURN_DATA                 = 0x00000037,
-TCC_PERF_SEL_RETURN_HOLE                 = 0x00000038,
-TCC_PERF_SEL_RETURN_ACK_HOLE             = 0x00000039,
-TCC_PERF_SEL_IB_REQ                      = 0x0000003a,
-TCC_PERF_SEL_IB_STALL                    = 0x0000003b,
-TCC_PERF_SEL_IB_TAG_STALL                = 0x0000003c,
-TCC_PERF_SEL_IB_MDC_STALL                = 0x0000003d,
-TCC_PERF_SEL_TCA_LEVEL                   = 0x0000003e,
-TCC_PERF_SEL_HOLE_LEVEL                  = 0x0000003f,
-TCC_PERF_SEL_EA_RDRET_NACK               = 0x00000040,
-TCC_PERF_SEL_EA_WRRET_NACK               = 0x00000041,
-TCC_PERF_SEL_NORMAL_WRITEBACK            = 0x00000042,
-TCC_PERF_SEL_TC_OP_WBL2_NC_WRITEBACK     = 0x00000043,
-TCC_PERF_SEL_TC_OP_WBL2_WC_WRITEBACK     = 0x00000044,
-TCC_PERF_SEL_TC_OP_WBINVL2_WRITEBACK     = 0x00000045,
-TCC_PERF_SEL_TC_OP_WBINVL2_NC_WRITEBACK  = 0x00000046,
-TCC_PERF_SEL_TC_OP_WBINVL2_SD_WRITEBACK  = 0x00000047,
-TCC_PERF_SEL_ALL_TC_OP_WB_WRITEBACK      = 0x00000048,
-TCC_PERF_SEL_NORMAL_EVICT                = 0x00000049,
-TCC_PERF_SEL_TC_OP_WBL2_NC_EVICT         = 0x0000004a,
-TCC_PERF_SEL_TC_OP_WBL2_WC_EVICT         = 0x0000004b,
-TCC_PERF_SEL_TC_OP_INVL2_NC_EVICT        = 0x0000004c,
-TCC_PERF_SEL_TC_OP_WBINVL2_EVICT         = 0x0000004d,
-TCC_PERF_SEL_TC_OP_WBINVL2_NC_EVICT      = 0x0000004e,
-TCC_PERF_SEL_TC_OP_WBINVL2_SD_EVICT      = 0x0000004f,
-TCC_PERF_SEL_ALL_TC_OP_INV_EVICT         = 0x00000050,
-TCC_PERF_SEL_PROBE_EVICT                 = 0x00000051,
-TCC_PERF_SEL_TC_OP_WBL2_NC_CYCLE         = 0x00000052,
-TCC_PERF_SEL_TC_OP_WBL2_WC_CYCLE         = 0x00000053,
-TCC_PERF_SEL_TC_OP_INVL2_NC_CYCLE        = 0x00000054,
-TCC_PERF_SEL_TC_OP_WBINVL2_CYCLE         = 0x00000055,
-TCC_PERF_SEL_TC_OP_WBINVL2_NC_CYCLE      = 0x00000056,
-TCC_PERF_SEL_TC_OP_WBINVL2_SD_CYCLE      = 0x00000057,
-TCC_PERF_SEL_ALL_TC_OP_WB_OR_INV_CYCLE   = 0x00000058,
-TCC_PERF_SEL_TC_OP_WBL2_NC_START         = 0x00000059,
-TCC_PERF_SEL_TC_OP_WBL2_WC_START         = 0x0000005a,
-TCC_PERF_SEL_TC_OP_INVL2_NC_START        = 0x0000005b,
-TCC_PERF_SEL_TC_OP_WBINVL2_START         = 0x0000005c,
-TCC_PERF_SEL_TC_OP_WBINVL2_NC_START      = 0x0000005d,
-TCC_PERF_SEL_TC_OP_WBINVL2_SD_START      = 0x0000005e,
-TCC_PERF_SEL_ALL_TC_OP_WB_OR_INV_START   = 0x0000005f,
-TCC_PERF_SEL_TC_OP_WBL2_NC_FINISH        = 0x00000060,
-TCC_PERF_SEL_TC_OP_WBL2_WC_FINISH        = 0x00000061,
-TCC_PERF_SEL_TC_OP_INVL2_NC_FINISH       = 0x00000062,
-TCC_PERF_SEL_TC_OP_WBINVL2_FINISH        = 0x00000063,
-TCC_PERF_SEL_TC_OP_WBINVL2_NC_FINISH     = 0x00000064,
-TCC_PERF_SEL_TC_OP_WBINVL2_SD_FINISH     = 0x00000065,
-TCC_PERF_SEL_ALL_TC_OP_WB_OR_INV_FINISH  = 0x00000066,
-TCC_PERF_SEL_MDC_REQ                     = 0x00000067,
-TCC_PERF_SEL_MDC_LEVEL                   = 0x00000068,
-TCC_PERF_SEL_MDC_TAG_HIT                 = 0x00000069,
-TCC_PERF_SEL_MDC_SECTOR_HIT              = 0x0000006a,
-TCC_PERF_SEL_MDC_SECTOR_MISS             = 0x0000006b,
-TCC_PERF_SEL_MDC_TAG_STALL               = 0x0000006c,
-TCC_PERF_SEL_MDC_TAG_REPLACEMENT_LINE_IN_USE_STALL  = 0x0000006d,
-TCC_PERF_SEL_MDC_TAG_DESECTORIZATION_FIFO_FULL_STALL  = 0x0000006e,
-TCC_PERF_SEL_MDC_TAG_WAITING_FOR_INVALIDATE_COMPLETION_STALL  = 0x0000006f,
-TCC_PERF_SEL_PROBE_FILTER_DISABLE_TRANSITION  = 0x00000070,
-TCC_PERF_SEL_PROBE_FILTER_DISABLED       = 0x00000071,
-TCC_PERF_SEL_CLIENT0_REQ                 = 0x00000080,
-TCC_PERF_SEL_CLIENT1_REQ                 = 0x00000081,
-TCC_PERF_SEL_CLIENT2_REQ                 = 0x00000082,
-TCC_PERF_SEL_CLIENT3_REQ                 = 0x00000083,
-TCC_PERF_SEL_CLIENT4_REQ                 = 0x00000084,
-TCC_PERF_SEL_CLIENT5_REQ                 = 0x00000085,
-TCC_PERF_SEL_CLIENT6_REQ                 = 0x00000086,
-TCC_PERF_SEL_CLIENT7_REQ                 = 0x00000087,
-TCC_PERF_SEL_CLIENT8_REQ                 = 0x00000088,
-TCC_PERF_SEL_CLIENT9_REQ                 = 0x00000089,
-TCC_PERF_SEL_CLIENT10_REQ                = 0x0000008a,
-TCC_PERF_SEL_CLIENT11_REQ                = 0x0000008b,
-TCC_PERF_SEL_CLIENT12_REQ                = 0x0000008c,
-TCC_PERF_SEL_CLIENT13_REQ                = 0x0000008d,
-TCC_PERF_SEL_CLIENT14_REQ                = 0x0000008e,
-TCC_PERF_SEL_CLIENT15_REQ                = 0x0000008f,
-TCC_PERF_SEL_CLIENT16_REQ                = 0x00000090,
-TCC_PERF_SEL_CLIENT17_REQ                = 0x00000091,
-TCC_PERF_SEL_CLIENT18_REQ                = 0x00000092,
-TCC_PERF_SEL_CLIENT19_REQ                = 0x00000093,
-TCC_PERF_SEL_CLIENT20_REQ                = 0x00000094,
-TCC_PERF_SEL_CLIENT21_REQ                = 0x00000095,
-TCC_PERF_SEL_CLIENT22_REQ                = 0x00000096,
-TCC_PERF_SEL_CLIENT23_REQ                = 0x00000097,
-TCC_PERF_SEL_CLIENT24_REQ                = 0x00000098,
-TCC_PERF_SEL_CLIENT25_REQ                = 0x00000099,
-TCC_PERF_SEL_CLIENT26_REQ                = 0x0000009a,
-TCC_PERF_SEL_CLIENT27_REQ                = 0x0000009b,
-TCC_PERF_SEL_CLIENT28_REQ                = 0x0000009c,
-TCC_PERF_SEL_CLIENT29_REQ                = 0x0000009d,
-TCC_PERF_SEL_CLIENT30_REQ                = 0x0000009e,
-TCC_PERF_SEL_CLIENT31_REQ                = 0x0000009f,
-TCC_PERF_SEL_CLIENT32_REQ                = 0x000000a0,
-TCC_PERF_SEL_CLIENT33_REQ                = 0x000000a1,
-TCC_PERF_SEL_CLIENT34_REQ                = 0x000000a2,
-TCC_PERF_SEL_CLIENT35_REQ                = 0x000000a3,
-TCC_PERF_SEL_CLIENT36_REQ                = 0x000000a4,
-TCC_PERF_SEL_CLIENT37_REQ                = 0x000000a5,
-TCC_PERF_SEL_CLIENT38_REQ                = 0x000000a6,
-TCC_PERF_SEL_CLIENT39_REQ                = 0x000000a7,
-TCC_PERF_SEL_CLIENT40_REQ                = 0x000000a8,
-TCC_PERF_SEL_CLIENT41_REQ                = 0x000000a9,
-TCC_PERF_SEL_CLIENT42_REQ                = 0x000000aa,
-TCC_PERF_SEL_CLIENT43_REQ                = 0x000000ab,
-TCC_PERF_SEL_CLIENT44_REQ                = 0x000000ac,
-TCC_PERF_SEL_CLIENT45_REQ                = 0x000000ad,
-TCC_PERF_SEL_CLIENT46_REQ                = 0x000000ae,
-TCC_PERF_SEL_CLIENT47_REQ                = 0x000000af,
-TCC_PERF_SEL_CLIENT48_REQ                = 0x000000b0,
-TCC_PERF_SEL_CLIENT49_REQ                = 0x000000b1,
-TCC_PERF_SEL_CLIENT50_REQ                = 0x000000b2,
-TCC_PERF_SEL_CLIENT51_REQ                = 0x000000b3,
-TCC_PERF_SEL_CLIENT52_REQ                = 0x000000b4,
-TCC_PERF_SEL_CLIENT53_REQ                = 0x000000b5,
-TCC_PERF_SEL_CLIENT54_REQ                = 0x000000b6,
-TCC_PERF_SEL_CLIENT55_REQ                = 0x000000b7,
-TCC_PERF_SEL_CLIENT56_REQ                = 0x000000b8,
-TCC_PERF_SEL_CLIENT57_REQ                = 0x000000b9,
-TCC_PERF_SEL_CLIENT58_REQ                = 0x000000ba,
-TCC_PERF_SEL_CLIENT59_REQ                = 0x000000bb,
-TCC_PERF_SEL_CLIENT60_REQ                = 0x000000bc,
-TCC_PERF_SEL_CLIENT61_REQ                = 0x000000bd,
-TCC_PERF_SEL_CLIENT62_REQ                = 0x000000be,
-TCC_PERF_SEL_CLIENT63_REQ                = 0x000000bf,
-TCC_PERF_SEL_CLIENT64_REQ                = 0x000000c0,
-TCC_PERF_SEL_CLIENT65_REQ                = 0x000000c1,
-TCC_PERF_SEL_CLIENT66_REQ                = 0x000000c2,
-TCC_PERF_SEL_CLIENT67_REQ                = 0x000000c3,
-TCC_PERF_SEL_CLIENT68_REQ                = 0x000000c4,
-TCC_PERF_SEL_CLIENT69_REQ                = 0x000000c5,
-TCC_PERF_SEL_CLIENT70_REQ                = 0x000000c6,
-TCC_PERF_SEL_CLIENT71_REQ                = 0x000000c7,
-TCC_PERF_SEL_CLIENT72_REQ                = 0x000000c8,
-TCC_PERF_SEL_CLIENT73_REQ                = 0x000000c9,
-TCC_PERF_SEL_CLIENT74_REQ                = 0x000000ca,
-TCC_PERF_SEL_CLIENT75_REQ                = 0x000000cb,
-TCC_PERF_SEL_CLIENT76_REQ                = 0x000000cc,
-TCC_PERF_SEL_CLIENT77_REQ                = 0x000000cd,
-TCC_PERF_SEL_CLIENT78_REQ                = 0x000000ce,
-TCC_PERF_SEL_CLIENT79_REQ                = 0x000000cf,
-TCC_PERF_SEL_CLIENT80_REQ                = 0x000000d0,
-TCC_PERF_SEL_CLIENT81_REQ                = 0x000000d1,
-TCC_PERF_SEL_CLIENT82_REQ                = 0x000000d2,
-TCC_PERF_SEL_CLIENT83_REQ                = 0x000000d3,
-TCC_PERF_SEL_CLIENT84_REQ                = 0x000000d4,
-TCC_PERF_SEL_CLIENT85_REQ                = 0x000000d5,
-TCC_PERF_SEL_CLIENT86_REQ                = 0x000000d6,
-TCC_PERF_SEL_CLIENT87_REQ                = 0x000000d7,
-TCC_PERF_SEL_CLIENT88_REQ                = 0x000000d8,
-TCC_PERF_SEL_CLIENT89_REQ                = 0x000000d9,
-TCC_PERF_SEL_CLIENT90_REQ                = 0x000000da,
-TCC_PERF_SEL_CLIENT91_REQ                = 0x000000db,
-TCC_PERF_SEL_CLIENT92_REQ                = 0x000000dc,
-TCC_PERF_SEL_CLIENT93_REQ                = 0x000000dd,
-TCC_PERF_SEL_CLIENT94_REQ                = 0x000000de,
-TCC_PERF_SEL_CLIENT95_REQ                = 0x000000df,
-TCC_PERF_SEL_CLIENT96_REQ                = 0x000000e0,
-TCC_PERF_SEL_CLIENT97_REQ                = 0x000000e1,
-TCC_PERF_SEL_CLIENT98_REQ                = 0x000000e2,
-TCC_PERF_SEL_CLIENT99_REQ                = 0x000000e3,
-TCC_PERF_SEL_CLIENT100_REQ               = 0x000000e4,
-TCC_PERF_SEL_CLIENT101_REQ               = 0x000000e5,
-TCC_PERF_SEL_CLIENT102_REQ               = 0x000000e6,
-TCC_PERF_SEL_CLIENT103_REQ               = 0x000000e7,
-TCC_PERF_SEL_CLIENT104_REQ               = 0x000000e8,
-TCC_PERF_SEL_CLIENT105_REQ               = 0x000000e9,
-TCC_PERF_SEL_CLIENT106_REQ               = 0x000000ea,
-TCC_PERF_SEL_CLIENT107_REQ               = 0x000000eb,
-TCC_PERF_SEL_CLIENT108_REQ               = 0x000000ec,
-TCC_PERF_SEL_CLIENT109_REQ               = 0x000000ed,
-TCC_PERF_SEL_CLIENT110_REQ               = 0x000000ee,
-TCC_PERF_SEL_CLIENT111_REQ               = 0x000000ef,
-TCC_PERF_SEL_CLIENT112_REQ               = 0x000000f0,
-TCC_PERF_SEL_CLIENT113_REQ               = 0x000000f1,
-TCC_PERF_SEL_CLIENT114_REQ               = 0x000000f2,
-TCC_PERF_SEL_CLIENT115_REQ               = 0x000000f3,
-TCC_PERF_SEL_CLIENT116_REQ               = 0x000000f4,
-TCC_PERF_SEL_CLIENT117_REQ               = 0x000000f5,
-TCC_PERF_SEL_CLIENT118_REQ               = 0x000000f6,
-TCC_PERF_SEL_CLIENT119_REQ               = 0x000000f7,
-TCC_PERF_SEL_CLIENT120_REQ               = 0x000000f8,
-TCC_PERF_SEL_CLIENT121_REQ               = 0x000000f9,
-TCC_PERF_SEL_CLIENT122_REQ               = 0x000000fa,
-TCC_PERF_SEL_CLIENT123_REQ               = 0x000000fb,
-TCC_PERF_SEL_CLIENT124_REQ               = 0x000000fc,
-TCC_PERF_SEL_CLIENT125_REQ               = 0x000000fd,
-TCC_PERF_SEL_CLIENT126_REQ               = 0x000000fe,
-TCC_PERF_SEL_CLIENT127_REQ               = 0x000000ff,
-} TCC_PERF_SEL;
-
-/*
- * TCA_PERF_SEL enum
- */
-
-typedef enum TCA_PERF_SEL {
-TCA_PERF_SEL_NONE                        = 0x00000000,
-TCA_PERF_SEL_CYCLE                       = 0x00000001,
-TCA_PERF_SEL_BUSY                        = 0x00000002,
-TCA_PERF_SEL_FORCED_HOLE_TCC0            = 0x00000003,
-TCA_PERF_SEL_FORCED_HOLE_TCC1            = 0x00000004,
-TCA_PERF_SEL_FORCED_HOLE_TCC2            = 0x00000005,
-TCA_PERF_SEL_FORCED_HOLE_TCC3            = 0x00000006,
-TCA_PERF_SEL_FORCED_HOLE_TCC4            = 0x00000007,
-TCA_PERF_SEL_FORCED_HOLE_TCC5            = 0x00000008,
-TCA_PERF_SEL_FORCED_HOLE_TCC6            = 0x00000009,
-TCA_PERF_SEL_FORCED_HOLE_TCC7            = 0x0000000a,
-TCA_PERF_SEL_REQ_TCC0                    = 0x0000000b,
-TCA_PERF_SEL_REQ_TCC1                    = 0x0000000c,
-TCA_PERF_SEL_REQ_TCC2                    = 0x0000000d,
-TCA_PERF_SEL_REQ_TCC3                    = 0x0000000e,
-TCA_PERF_SEL_REQ_TCC4                    = 0x0000000f,
-TCA_PERF_SEL_REQ_TCC5                    = 0x00000010,
-TCA_PERF_SEL_REQ_TCC6                    = 0x00000011,
-TCA_PERF_SEL_REQ_TCC7                    = 0x00000012,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC0    = 0x00000013,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC1    = 0x00000014,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC2    = 0x00000015,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC3    = 0x00000016,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC4    = 0x00000017,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC5    = 0x00000018,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC6    = 0x00000019,
-TCA_PERF_SEL_CROSSBAR_DOUBLE_ARB_TCC7    = 0x0000001a,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC0         = 0x0000001b,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC1         = 0x0000001c,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC2         = 0x0000001d,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC3         = 0x0000001e,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC4         = 0x0000001f,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC5         = 0x00000020,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC6         = 0x00000021,
-TCA_PERF_SEL_CROSSBAR_STALL_TCC7         = 0x00000022,
-} TCA_PERF_SEL;
-
-/*******************************************************
- * GRBM Enums
- *******************************************************/
-
-/*
- * GRBM_PERF_SEL enum
- */
-
-typedef enum GRBM_PERF_SEL {
-GRBM_PERF_SEL_COUNT                      = 0x00000000,
-GRBM_PERF_SEL_USER_DEFINED               = 0x00000001,
-GRBM_PERF_SEL_GUI_ACTIVE                 = 0x00000002,
-GRBM_PERF_SEL_CP_BUSY                    = 0x00000003,
-GRBM_PERF_SEL_CP_COHER_BUSY              = 0x00000004,
-GRBM_PERF_SEL_CP_DMA_BUSY                = 0x00000005,
-GRBM_PERF_SEL_CB_BUSY                    = 0x00000006,
-GRBM_PERF_SEL_DB_BUSY                    = 0x00000007,
-GRBM_PERF_SEL_PA_BUSY                    = 0x00000008,
-GRBM_PERF_SEL_SC_BUSY                    = 0x00000009,
-GRBM_PERF_SEL_RESERVED_6                 = 0x0000000a,
-GRBM_PERF_SEL_SPI_BUSY                   = 0x0000000b,
-GRBM_PERF_SEL_SX_BUSY                    = 0x0000000c,
-GRBM_PERF_SEL_TA_BUSY                    = 0x0000000d,
-GRBM_PERF_SEL_CB_CLEAN                   = 0x0000000e,
-GRBM_PERF_SEL_DB_CLEAN                   = 0x0000000f,
-GRBM_PERF_SEL_RESERVED_5                 = 0x00000010,
-GRBM_PERF_SEL_VGT_BUSY                   = 0x00000011,
-GRBM_PERF_SEL_RESERVED_4                 = 0x00000012,
-GRBM_PERF_SEL_RESERVED_3                 = 0x00000013,
-GRBM_PERF_SEL_RESERVED_2                 = 0x00000014,
-GRBM_PERF_SEL_RESERVED_1                 = 0x00000015,
-GRBM_PERF_SEL_RESERVED_0                 = 0x00000016,
-GRBM_PERF_SEL_IA_BUSY                    = 0x00000017,
-GRBM_PERF_SEL_IA_NO_DMA_BUSY             = 0x00000018,
-GRBM_PERF_SEL_GDS_BUSY                   = 0x00000019,
-GRBM_PERF_SEL_BCI_BUSY                   = 0x0000001a,
-GRBM_PERF_SEL_RLC_BUSY                   = 0x0000001b,
-GRBM_PERF_SEL_TC_BUSY                    = 0x0000001c,
-GRBM_PERF_SEL_CPG_BUSY                   = 0x0000001d,
-GRBM_PERF_SEL_CPC_BUSY                   = 0x0000001e,
-GRBM_PERF_SEL_CPF_BUSY                   = 0x0000001f,
-GRBM_PERF_SEL_WD_BUSY                    = 0x00000020,
-GRBM_PERF_SEL_WD_NO_DMA_BUSY             = 0x00000021,
-GRBM_PERF_SEL_UTCL2_BUSY                 = 0x00000022,
-GRBM_PERF_SEL_EA_BUSY                    = 0x00000023,
-GRBM_PERF_SEL_RMI_BUSY                   = 0x00000024,
-GRBM_PERF_SEL_CPAXI_BUSY                 = 0x00000025,
-} GRBM_PERF_SEL;
-
-/*
- * GRBM_SE0_PERF_SEL enum
- */
-
-typedef enum GRBM_SE0_PERF_SEL {
-GRBM_SE0_PERF_SEL_COUNT                  = 0x00000000,
-GRBM_SE0_PERF_SEL_USER_DEFINED           = 0x00000001,
-GRBM_SE0_PERF_SEL_CB_BUSY                = 0x00000002,
-GRBM_SE0_PERF_SEL_DB_BUSY                = 0x00000003,
-GRBM_SE0_PERF_SEL_SC_BUSY                = 0x00000004,
-GRBM_SE0_PERF_SEL_RESERVED_1             = 0x00000005,
-GRBM_SE0_PERF_SEL_SPI_BUSY               = 0x00000006,
-GRBM_SE0_PERF_SEL_SX_BUSY                = 0x00000007,
-GRBM_SE0_PERF_SEL_TA_BUSY                = 0x00000008,
-GRBM_SE0_PERF_SEL_CB_CLEAN               = 0x00000009,
-GRBM_SE0_PERF_SEL_DB_CLEAN               = 0x0000000a,
-GRBM_SE0_PERF_SEL_RESERVED_0             = 0x0000000b,
-GRBM_SE0_PERF_SEL_PA_BUSY                = 0x0000000c,
-GRBM_SE0_PERF_SEL_VGT_BUSY               = 0x0000000d,
-GRBM_SE0_PERF_SEL_BCI_BUSY               = 0x0000000e,
-GRBM_SE0_PERF_SEL_RMI_BUSY               = 0x0000000f,
-} GRBM_SE0_PERF_SEL;
-
-/*
- * GRBM_SE1_PERF_SEL enum
- */
-
-typedef enum GRBM_SE1_PERF_SEL {
-GRBM_SE1_PERF_SEL_COUNT                  = 0x00000000,
-GRBM_SE1_PERF_SEL_USER_DEFINED           = 0x00000001,
-GRBM_SE1_PERF_SEL_CB_BUSY                = 0x00000002,
-GRBM_SE1_PERF_SEL_DB_BUSY                = 0x00000003,
-GRBM_SE1_PERF_SEL_SC_BUSY                = 0x00000004,
-GRBM_SE1_PERF_SEL_RESERVED_1             = 0x00000005,
-GRBM_SE1_PERF_SEL_SPI_BUSY               = 0x00000006,
-GRBM_SE1_PERF_SEL_SX_BUSY                = 0x00000007,
-GRBM_SE1_PERF_SEL_TA_BUSY                = 0x00000008,
-GRBM_SE1_PERF_SEL_CB_CLEAN               = 0x00000009,
-GRBM_SE1_PERF_SEL_DB_CLEAN               = 0x0000000a,
-GRBM_SE1_PERF_SEL_RESERVED_0             = 0x0000000b,
-GRBM_SE1_PERF_SEL_PA_BUSY                = 0x0000000c,
-GRBM_SE1_PERF_SEL_VGT_BUSY               = 0x0000000d,
-GRBM_SE1_PERF_SEL_BCI_BUSY               = 0x0000000e,
-GRBM_SE1_PERF_SEL_RMI_BUSY               = 0x0000000f,
-} GRBM_SE1_PERF_SEL;
-
-/*
- * GRBM_SE2_PERF_SEL enum
- */
-
-typedef enum GRBM_SE2_PERF_SEL {
-GRBM_SE2_PERF_SEL_COUNT                  = 0x00000000,
-GRBM_SE2_PERF_SEL_USER_DEFINED           = 0x00000001,
-GRBM_SE2_PERF_SEL_CB_BUSY                = 0x00000002,
-GRBM_SE2_PERF_SEL_DB_BUSY                = 0x00000003,
-GRBM_SE2_PERF_SEL_SC_BUSY                = 0x00000004,
-GRBM_SE2_PERF_SEL_RESERVED_1             = 0x00000005,
-GRBM_SE2_PERF_SEL_SPI_BUSY               = 0x00000006,
-GRBM_SE2_PERF_SEL_SX_BUSY                = 0x00000007,
-GRBM_SE2_PERF_SEL_TA_BUSY                = 0x00000008,
-GRBM_SE2_PERF_SEL_CB_CLEAN               = 0x00000009,
-GRBM_SE2_PERF_SEL_DB_CLEAN               = 0x0000000a,
-GRBM_SE2_PERF_SEL_RESERVED_0             = 0x0000000b,
-GRBM_SE2_PERF_SEL_PA_BUSY                = 0x0000000c,
-GRBM_SE2_PERF_SEL_VGT_BUSY               = 0x0000000d,
-GRBM_SE2_PERF_SEL_BCI_BUSY               = 0x0000000e,
-GRBM_SE2_PERF_SEL_RMI_BUSY               = 0x0000000f,
-} GRBM_SE2_PERF_SEL;
-
-/*
- * GRBM_SE3_PERF_SEL enum
- */
-
-typedef enum GRBM_SE3_PERF_SEL {
-GRBM_SE3_PERF_SEL_COUNT                  = 0x00000000,
-GRBM_SE3_PERF_SEL_USER_DEFINED           = 0x00000001,
-GRBM_SE3_PERF_SEL_CB_BUSY                = 0x00000002,
-GRBM_SE3_PERF_SEL_DB_BUSY                = 0x00000003,
-GRBM_SE3_PERF_SEL_SC_BUSY                = 0x00000004,
-GRBM_SE3_PERF_SEL_RESERVED_1             = 0x00000005,
-GRBM_SE3_PERF_SEL_SPI_BUSY               = 0x00000006,
-GRBM_SE3_PERF_SEL_SX_BUSY                = 0x00000007,
-GRBM_SE3_PERF_SEL_TA_BUSY                = 0x00000008,
-GRBM_SE3_PERF_SEL_CB_CLEAN               = 0x00000009,
-GRBM_SE3_PERF_SEL_DB_CLEAN               = 0x0000000a,
-GRBM_SE3_PERF_SEL_RESERVED_0             = 0x0000000b,
-GRBM_SE3_PERF_SEL_PA_BUSY                = 0x0000000c,
-GRBM_SE3_PERF_SEL_VGT_BUSY               = 0x0000000d,
-GRBM_SE3_PERF_SEL_BCI_BUSY               = 0x0000000e,
-GRBM_SE3_PERF_SEL_RMI_BUSY               = 0x0000000f,
-} GRBM_SE3_PERF_SEL;
-
-/*******************************************************
- * CP Enums
- *******************************************************/
-
-/*
- * CP_RING_ID enum
- */
-
-typedef enum CP_RING_ID {
-RINGID0                                  = 0x00000000,
-RINGID1                                  = 0x00000001,
-RINGID2                                  = 0x00000002,
-RINGID3                                  = 0x00000003,
-} CP_RING_ID;
-
-/*
- * CP_PIPE_ID enum
- */
-
-typedef enum CP_PIPE_ID {
-PIPE_ID0                                 = 0x00000000,
-PIPE_ID1                                 = 0x00000001,
-PIPE_ID2                                 = 0x00000002,
-PIPE_ID3                                 = 0x00000003,
-} CP_PIPE_ID;
-
-/*
- * CP_ME_ID enum
- */
-
-typedef enum CP_ME_ID {
-ME_ID0                                   = 0x00000000,
-ME_ID1                                   = 0x00000001,
-ME_ID2                                   = 0x00000002,
-ME_ID3                                   = 0x00000003,
-} CP_ME_ID;
-
-/*
- * SPM_PERFMON_STATE enum
- */
-
-typedef enum SPM_PERFMON_STATE {
-STRM_PERFMON_STATE_DISABLE_AND_RESET     = 0x00000000,
-STRM_PERFMON_STATE_START_COUNTING        = 0x00000001,
-STRM_PERFMON_STATE_STOP_COUNTING         = 0x00000002,
-STRM_PERFMON_STATE_RESERVED_3            = 0x00000003,
-STRM_PERFMON_STATE_DISABLE_AND_RESET_PHANTOM  = 0x00000004,
-STRM_PERFMON_STATE_COUNT_AND_DUMP_PHANTOM  = 0x00000005,
-} SPM_PERFMON_STATE;
-
-/*
- * CP_PERFMON_STATE enum
- */
-
-typedef enum CP_PERFMON_STATE {
-CP_PERFMON_STATE_DISABLE_AND_RESET       = 0x00000000,
-CP_PERFMON_STATE_START_COUNTING          = 0x00000001,
-CP_PERFMON_STATE_STOP_COUNTING           = 0x00000002,
-CP_PERFMON_STATE_RESERVED_3              = 0x00000003,
-CP_PERFMON_STATE_DISABLE_AND_RESET_PHANTOM  = 0x00000004,
-CP_PERFMON_STATE_COUNT_AND_DUMP_PHANTOM  = 0x00000005,
-} CP_PERFMON_STATE;
-
-/*
- * CP_PERFMON_ENABLE_MODE enum
- */
-
-typedef enum CP_PERFMON_ENABLE_MODE {
-CP_PERFMON_ENABLE_MODE_ALWAYS_COUNT      = 0x00000000,
-CP_PERFMON_ENABLE_MODE_RESERVED_1        = 0x00000001,
-CP_PERFMON_ENABLE_MODE_COUNT_CONTEXT_TRUE  = 0x00000002,
-CP_PERFMON_ENABLE_MODE_COUNT_CONTEXT_FALSE  = 0x00000003,
-} CP_PERFMON_ENABLE_MODE;
-
-/*
- * CPG_PERFCOUNT_SEL enum
- */
-
-typedef enum CPG_PERFCOUNT_SEL {
-CPG_PERF_SEL_ALWAYS_COUNT                = 0x00000000,
-CPG_PERF_SEL_RBIU_FIFO_FULL              = 0x00000001,
-CPG_PERF_SEL_CSF_RTS_BUT_MIU_NOT_RTR     = 0x00000002,
-CPG_PERF_SEL_CSF_ST_BASE_SIZE_FIFO_FULL  = 0x00000003,
-CPG_PERF_SEL_CP_GRBM_DWORDS_SENT         = 0x00000004,
-CPG_PERF_SEL_ME_PARSER_BUSY              = 0x00000005,
-CPG_PERF_SEL_COUNT_TYPE0_PACKETS         = 0x00000006,
-CPG_PERF_SEL_COUNT_TYPE3_PACKETS         = 0x00000007,
-CPG_PERF_SEL_CSF_FETCHING_CMD_BUFFERS    = 0x00000008,
-CPG_PERF_SEL_CP_GRBM_OUT_OF_CREDITS      = 0x00000009,
-CPG_PERF_SEL_CP_PFP_GRBM_OUT_OF_CREDITS  = 0x0000000a,
-CPG_PERF_SEL_CP_GDS_GRBM_OUT_OF_CREDITS  = 0x0000000b,
-CPG_PERF_SEL_RCIU_STALLED_ON_ME_READ     = 0x0000000c,
-CPG_PERF_SEL_RCIU_STALLED_ON_DMA_READ    = 0x0000000d,
-CPG_PERF_SEL_SSU_STALLED_ON_ACTIVE_CNTX  = 0x0000000e,
-CPG_PERF_SEL_SSU_STALLED_ON_CLEAN_SIGNALS  = 0x0000000f,
-CPG_PERF_SEL_QU_STALLED_ON_EOP_DONE_PULSE  = 0x00000010,
-CPG_PERF_SEL_QU_STALLED_ON_EOP_DONE_WR_CONFIRM  = 0x00000011,
-CPG_PERF_SEL_PFP_STALLED_ON_CSF_READY    = 0x00000012,
-CPG_PERF_SEL_PFP_STALLED_ON_MEQ_READY    = 0x00000013,
-CPG_PERF_SEL_PFP_STALLED_ON_RCIU_READY   = 0x00000014,
-CPG_PERF_SEL_PFP_STALLED_FOR_DATA_FROM_ROQ  = 0x00000015,
-CPG_PERF_SEL_ME_STALLED_FOR_DATA_FROM_PFP  = 0x00000016,
-CPG_PERF_SEL_ME_STALLED_FOR_DATA_FROM_STQ  = 0x00000017,
-CPG_PERF_SEL_ME_STALLED_ON_NO_AVAIL_GFX_CNTX  = 0x00000018,
-CPG_PERF_SEL_ME_STALLED_WRITING_TO_RCIU  = 0x00000019,
-CPG_PERF_SEL_ME_STALLED_WRITING_CONSTANTS  = 0x0000001a,
-CPG_PERF_SEL_ME_STALLED_ON_PARTIAL_FLUSH  = 0x0000001b,
-CPG_PERF_SEL_ME_WAIT_ON_CE_COUNTER       = 0x0000001c,
-CPG_PERF_SEL_ME_WAIT_ON_AVAIL_BUFFER     = 0x0000001d,
-CPG_PERF_SEL_SEMAPHORE_BUSY_POLLING_FOR_PASS  = 0x0000001e,
-CPG_PERF_SEL_LOAD_STALLED_ON_SET_COHERENCY  = 0x0000001f,
-CPG_PERF_SEL_DYNAMIC_CLK_VALID           = 0x00000020,
-CPG_PERF_SEL_REGISTER_CLK_VALID          = 0x00000021,
-CPG_PERF_SEL_MIU_WRITE_REQUEST_SENT      = 0x00000022,
-CPG_PERF_SEL_MIU_READ_REQUEST_SENT       = 0x00000023,
-CPG_PERF_SEL_CE_STALL_RAM_DUMP           = 0x00000024,
-CPG_PERF_SEL_CE_STALL_RAM_WRITE          = 0x00000025,
-CPG_PERF_SEL_CE_STALL_ON_INC_FIFO        = 0x00000026,
-CPG_PERF_SEL_CE_STALL_ON_WR_RAM_FIFO     = 0x00000027,
-CPG_PERF_SEL_CE_STALL_ON_DATA_FROM_MIU   = 0x00000028,
-CPG_PERF_SEL_CE_STALL_ON_DATA_FROM_ROQ   = 0x00000029,
-CPG_PERF_SEL_CE_STALL_ON_CE_BUFFER_FLAG  = 0x0000002a,
-CPG_PERF_SEL_CE_STALL_ON_DE_COUNTER      = 0x0000002b,
-CPG_PERF_SEL_TCIU_STALL_WAIT_ON_FREE     = 0x0000002c,
-CPG_PERF_SEL_TCIU_STALL_WAIT_ON_TAGS     = 0x0000002d,
-CPG_PERF_SEL_UTCL2IU_STALL_WAIT_ON_FREE  = 0x0000002e,
-CPG_PERF_SEL_UTCL2IU_STALL_WAIT_ON_TAGS  = 0x0000002f,
-CPG_PERF_SEL_UTCL1_STALL_ON_TRANSLATION  = 0x00000030,
-} CPG_PERFCOUNT_SEL;
-
-/*
- * CPF_PERFCOUNT_SEL enum
- */
-
-typedef enum CPF_PERFCOUNT_SEL {
-CPF_PERF_SEL_ALWAYS_COUNT                = 0x00000000,
-CPF_PERF_SEL_MIU_STALLED_WAITING_RDREQ_FREE  = 0x00000001,
-CPF_PERF_SEL_TCIU_STALLED_WAITING_ON_FREE  = 0x00000002,
-CPF_PERF_SEL_TCIU_STALLED_WAITING_ON_TAGS  = 0x00000003,
-CPF_PERF_SEL_CSF_BUSY_FOR_FETCHING_RING  = 0x00000004,
-CPF_PERF_SEL_CSF_BUSY_FOR_FETCHING_IB1   = 0x00000005,
-CPF_PERF_SEL_CSF_BUSY_FOR_FETCHING_IB2   = 0x00000006,
-CPF_PERF_SEL_CSF_BUSY_FOR_FECTHINC_STATE  = 0x00000007,
-CPF_PERF_SEL_MIU_BUSY_FOR_OUTSTANDING_TAGS  = 0x00000008,
-CPF_PERF_SEL_CSF_RTS_MIU_NOT_RTR         = 0x00000009,
-CPF_PERF_SEL_CSF_STATE_FIFO_NOT_RTR      = 0x0000000a,
-CPF_PERF_SEL_CSF_FETCHING_CMD_BUFFERS    = 0x0000000b,
-CPF_PERF_SEL_GRBM_DWORDS_SENT            = 0x0000000c,
-CPF_PERF_SEL_DYNAMIC_CLOCK_VALID         = 0x0000000d,
-CPF_PERF_SEL_REGISTER_CLOCK_VALID        = 0x0000000e,
-CPF_PERF_SEL_MIU_WRITE_REQUEST_SEND      = 0x0000000f,
-CPF_PERF_SEL_MIU_READ_REQUEST_SEND       = 0x00000010,
-CPF_PERF_SEL_UTCL2IU_STALL_WAIT_ON_FREE  = 0x00000011,
-CPF_PERF_SEL_UTCL2IU_STALL_WAIT_ON_TAGS  = 0x00000012,
-CPF_PERF_SEL_UTCL1_STALL_ON_TRANSLATION  = 0x00000013,
-CPF_PERF_SEL_RCIU_STALL_WAIT_ON_FREE     = 0x00000014,
-} CPF_PERFCOUNT_SEL;
-
-/*
- * CPC_PERFCOUNT_SEL enum
- */
-
-typedef enum CPC_PERFCOUNT_SEL {
-CPC_PERF_SEL_ALWAYS_COUNT                = 0x00000000,
-CPC_PERF_SEL_RCIU_STALL_WAIT_ON_FREE     = 0x00000001,
-CPC_PERF_SEL_RCIU_STALL_PRIV_VIOLATION   = 0x00000002,
-CPC_PERF_SEL_MIU_STALL_ON_RDREQ_FREE     = 0x00000003,
-CPC_PERF_SEL_MIU_STALL_ON_WRREQ_FREE     = 0x00000004,
-CPC_PERF_SEL_TCIU_STALL_WAIT_ON_FREE     = 0x00000005,
-CPC_PERF_SEL_ME1_STALL_WAIT_ON_RCIU_READY  = 0x00000006,
-CPC_PERF_SEL_ME1_STALL_WAIT_ON_RCIU_READY_PERF  = 0x00000007,
-CPC_PERF_SEL_ME1_STALL_WAIT_ON_RCIU_READ  = 0x00000008,
-CPC_PERF_SEL_ME1_STALL_WAIT_ON_MIU_READ  = 0x00000009,
-CPC_PERF_SEL_ME1_STALL_WAIT_ON_MIU_WRITE  = 0x0000000a,
-CPC_PERF_SEL_ME1_STALL_ON_DATA_FROM_ROQ  = 0x0000000b,
-CPC_PERF_SEL_ME1_STALL_ON_DATA_FROM_ROQ_PERF  = 0x0000000c,
-CPC_PERF_SEL_ME1_BUSY_FOR_PACKET_DECODE  = 0x0000000d,
-CPC_PERF_SEL_ME2_STALL_WAIT_ON_RCIU_READY  = 0x0000000e,
-CPC_PERF_SEL_ME2_STALL_WAIT_ON_RCIU_READY_PERF  = 0x0000000f,
-CPC_PERF_SEL_ME2_STALL_WAIT_ON_RCIU_READ  = 0x00000010,
-CPC_PERF_SEL_ME2_STALL_WAIT_ON_MIU_READ  = 0x00000011,
-CPC_PERF_SEL_ME2_STALL_WAIT_ON_MIU_WRITE  = 0x00000012,
-CPC_PERF_SEL_ME2_STALL_ON_DATA_FROM_ROQ  = 0x00000013,
-CPC_PERF_SEL_ME2_STALL_ON_DATA_FROM_ROQ_PERF  = 0x00000014,
-CPC_PERF_SEL_ME2_BUSY_FOR_PACKET_DECODE  = 0x00000015,
-CPC_PERF_SEL_UTCL2IU_STALL_WAIT_ON_FREE  = 0x00000016,
-CPC_PERF_SEL_UTCL2IU_STALL_WAIT_ON_TAGS  = 0x00000017,
-CPC_PERF_SEL_UTCL1_STALL_ON_TRANSLATION  = 0x00000018,
-} CPC_PERFCOUNT_SEL;
-
-/*
- * CP_ALPHA_TAG_RAM_SEL enum
- */
-
-typedef enum CP_ALPHA_TAG_RAM_SEL {
-CPG_TAG_RAM                              = 0x00000000,
-CPC_TAG_RAM                              = 0x00000001,
-CPF_TAG_RAM                              = 0x00000002,
-RSV_TAG_RAM                              = 0x00000003,
-} CP_ALPHA_TAG_RAM_SEL;
-
-/*
- * SEM_RESPONSE value
- */
-
-#define SEM_ECC_ERROR                  0x00000000
-#define SEM_TRANS_ERROR                0x00000001
-#define SEM_FAILED                     0x00000002
-#define SEM_PASSED                     0x00000003
-
-/*
- * IQ_RETRY_TYPE value
- */
-
-#define IQ_QUEUE_SLEEP                 0x00000000
-#define IQ_OFFLOAD_RETRY               0x00000001
-#define IQ_SCH_WAVE_MSG                0x00000002
-#define IQ_SEM_REARM                   0x00000003
-#define IQ_DEQUEUE_RETRY               0x00000004
-
-/*
- * IQ_INTR_TYPE value
- */
-
-#define IQ_INTR_TYPE_PQ                0x00000000
-#define IQ_INTR_TYPE_IB                0x00000001
-#define IQ_INTR_TYPE_MQD               0x00000002
-
-/*
- * VMID_SIZE value
- */
-
-#define VMID_SZ                        0x00000004
-
-/*
- * CONFIG_SPACE value
- */
-
-#define CONFIG_SPACE_START             0x00002000
-#define CONFIG_SPACE_END               0x00009fff
-
-/*
- * CONFIG_SPACE1 value
- */
-
-#define CONFIG_SPACE1_START            0x00002000
-#define CONFIG_SPACE1_END              0x00002bff
-
-/*
- * CONFIG_SPACE2 value
- */
-
-#define CONFIG_SPACE2_START            0x00003000
-#define CONFIG_SPACE2_END              0x00009fff
-
-/*
- * UCONFIG_SPACE value
- */
-
-#define UCONFIG_SPACE_START            0x0000c000
-#define UCONFIG_SPACE_END              0x0000ffff
-
-/*
- * PERSISTENT_SPACE value
- */
-
-#define PERSISTENT_SPACE_START         0x00002c00
-#define PERSISTENT_SPACE_END           0x00002fff
-
-/*
- * CONTEXT_SPACE value
- */
-
-#define CONTEXT_SPACE_START            0x0000a000
-#define CONTEXT_SPACE_END              0x0000bfff
-
-/*******************************************************
- * SQ_UC Enums
- *******************************************************/
-
-/*
- * VALUE_SQ_ENC_SOP1 value
- */
-
-#define SQ_ENC_SOP1_BITS               0xbe800000
-#define SQ_ENC_SOP1_MASK               0xff800000
-#define SQ_ENC_SOP1_FIELD              0x0000017d
-
-/*
- * VALUE_SQ_ENC_SOPC value
- */
-
-#define SQ_ENC_SOPC_BITS               0xbf000000
-#define SQ_ENC_SOPC_MASK               0xff800000
-#define SQ_ENC_SOPC_FIELD              0x0000017e
-
-/*
- * VALUE_SQ_ENC_SOPP value
- */
-
-#define SQ_ENC_SOPP_BITS               0xbf800000
-#define SQ_ENC_SOPP_MASK               0xff800000
-#define SQ_ENC_SOPP_FIELD              0x0000017f
-
-/*
- * VALUE_SQ_ENC_SOPK value
- */
-
-#define SQ_ENC_SOPK_BITS               0xb0000000
-#define SQ_ENC_SOPK_MASK               0xf0000000
-#define SQ_ENC_SOPK_FIELD              0x0000000b
-
-/*
- * VALUE_SQ_ENC_SOP2 value
- */
-
-#define SQ_ENC_SOP2_BITS               0x80000000
-#define SQ_ENC_SOP2_MASK               0xc0000000
-#define SQ_ENC_SOP2_FIELD              0x00000002
-
-/*
- * VALUE_SQ_ENC_SMEM value
- */
-
-#define SQ_ENC_SMEM_BITS               0xc0000000
-#define SQ_ENC_SMEM_MASK               0xfc000000
-#define SQ_ENC_SMEM_FIELD              0x00000030
-
-/*
- * VALUE_SQ_ENC_VOP1 value
- */
-
-#define SQ_ENC_VOP1_BITS               0x7e000000
-#define SQ_ENC_VOP1_MASK               0xfe000000
-#define SQ_ENC_VOP1_FIELD              0x0000003f
-
-/*
- * VALUE_SQ_ENC_VOPC value
- */
-
-#define SQ_ENC_VOPC_BITS               0x7c000000
-#define SQ_ENC_VOPC_MASK               0xfe000000
-#define SQ_ENC_VOPC_FIELD              0x0000003e
-
-/*
- * VALUE_SQ_ENC_VOP2 value
- */
-
-#define SQ_ENC_VOP2_BITS               0x00000000
-#define SQ_ENC_VOP2_MASK               0x80000000
-#define SQ_ENC_VOP2_FIELD              0x00000000
-
-/*
- * VALUE_SQ_ENC_VINTRP value
- */
-
-#define SQ_ENC_VINTRP_BITS             0xd4000000
-#define SQ_ENC_VINTRP_MASK             0xfc000000
-#define SQ_ENC_VINTRP_FIELD            0x00000035
-
-/*
- * VALUE_SQ_ENC_VOP3P value
- */
-
-#define SQ_ENC_VOP3P_BITS              0xd3800000
-#define SQ_ENC_VOP3P_MASK              0xff800000
-#define SQ_ENC_VOP3P_FIELD             0x000001a7
-
-/*
- * VALUE_SQ_ENC_VOP3 value
- */
-
-#define SQ_ENC_VOP3_BITS               0xd0000000
-#define SQ_ENC_VOP3_MASK               0xfc000000
-#define SQ_ENC_VOP3_FIELD              0x00000034
-
-/*
- * VALUE_SQ_ENC_DS value
- */
-
-#define SQ_ENC_DS_BITS                 0xd8000000
-#define SQ_ENC_DS_MASK                 0xfc000000
-#define SQ_ENC_DS_FIELD                0x00000036
-
-/*
- * VALUE_SQ_ENC_MUBUF value
- */
-
-#define SQ_ENC_MUBUF_BITS              0xe0000000
-#define SQ_ENC_MUBUF_MASK              0xfc000000
-#define SQ_ENC_MUBUF_FIELD             0x00000038
-
-/*
- * VALUE_SQ_ENC_MTBUF value
- */
-
-#define SQ_ENC_MTBUF_BITS              0xe8000000
-#define SQ_ENC_MTBUF_MASK              0xfc000000
-#define SQ_ENC_MTBUF_FIELD             0x0000003a
-
-/*
- * VALUE_SQ_ENC_MIMG value
- */
-
-#define SQ_ENC_MIMG_BITS               0xf0000000
-#define SQ_ENC_MIMG_MASK               0xfc000000
-#define SQ_ENC_MIMG_FIELD              0x0000003c
-
-/*
- * VALUE_SQ_ENC_EXP value
- */
-
-#define SQ_ENC_EXP_BITS                0xc4000000
-#define SQ_ENC_EXP_MASK                0xfc000000
-#define SQ_ENC_EXP_FIELD               0x00000031
-
-/*
- * VALUE_SQ_ENC_FLAT value
- */
-
-#define SQ_ENC_FLAT_BITS               0xdc000000
-#define SQ_ENC_FLAT_MASK               0xfc000000
-#define SQ_ENC_FLAT_FIELD              0x00000037
-
-/*
- * VALUE_SQ_HWREG_ID_SHIFT value
- */
-
-#define SQ_HWREG_ID_SHIFT              0x00000000
-
-/*
- * VALUE_SQ_V_OP3P_COUNT value
- */
-
-#define SQ_V_OP3P_COUNT                0x00000080
-
-/*
- * VALUE_SQ_SENDMSG_SYSTEM_SHIFT value
- */
-
-#define SQ_SENDMSG_SYSTEM_SHIFT        0x00000004
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOP1_COUNT value
- */
-
-#define SQ_XLATE_VOP3_TO_VOP1_COUNT    0x00000080
-
-/*
- * VALUE_SQ_SRC_VGPR_BIT value
- */
-
-#define SQ_SRC_VGPR_BIT                0x00000100
-
-/*
- * VALUE_SQ_V_OP1_COUNT value
- */
-
-#define SQ_V_OP1_COUNT                 0x00000080
-
-/*
- * VALUE_SQ_SENDMSG_STREAMID_SHIFT value
- */
-
-#define SQ_SENDMSG_STREAMID_SHIFT      0x00000008
-
-/*
- * VALUE_SQ_HWREG_ID_SIZE value
- */
-
-#define SQ_HWREG_ID_SIZE               0x00000006
-
-/*
- * VALUE_SQ_EXP_NUM_MRT value
- */
-
-#define SQ_EXP_NUM_MRT                 0x00000008
-
-/*
- * VALUE_SQ_V_OP3_3IN_OFFSET value
- */
-
-#define SQ_V_OP3_3IN_OFFSET            0x000001c0
-
-/*
- * VALUE_SQ_SENDMSG_STREAMID_SIZE value
- */
-
-#define SQ_SENDMSG_STREAMID_SIZE       0x00000002
-
-/*
- * VALUE_SQ_HWREG_OFFSET_SHIFT value
- */
-
-#define SQ_HWREG_OFFSET_SHIFT          0x00000006
-
-/*
- * VALUE_SQ_SENDMSG_MSG_SIZE value
- */
-
-#define SQ_SENDMSG_MSG_SIZE            0x00000004
-
-/*
- * VALUE_SQ_HWREG_SIZE_SHIFT value
- */
-
-#define SQ_HWREG_SIZE_SHIFT            0x0000000b
-
-/*
- * VALUE_SQ_SENDMSG_SYSTEM_SIZE value
- */
-
-#define SQ_SENDMSG_SYSTEM_SIZE         0x00000003
-
-/*
- * VALUE_SQ_SENDMSG_MSG_SHIFT value
- */
-
-#define SQ_SENDMSG_MSG_SHIFT           0x00000000
-
-/*
- * VALUE_SQ_SENDMSG_GSOP_SIZE value
- */
-
-#define SQ_SENDMSG_GSOP_SIZE           0x00000002
-
-/*
- * VALUE_SQ_SENDMSG_GSOP_SHIFT value
- */
-
-#define SQ_SENDMSG_GSOP_SHIFT          0x00000004
-
-/*
- * VALUE_SQ_NUM_TTMP value
- */
-
-#define SQ_NUM_TTMP                    0x00000010
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOP3P_COUNT value
- */
-
-#define SQ_XLATE_VOP3_TO_VOP3P_COUNT   0x00000080
-
-/*
- * VALUE_SQ_EXP_NUM_POS value
- */
-
-#define SQ_EXP_NUM_POS                 0x00000004
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOP3P_OFFSET value
- */
-
-#define SQ_XLATE_VOP3_TO_VOP3P_OFFSET  0x00000380
-
-/*
- * VALUE_SQ_WAITCNT_EXP_SIZE value
- */
-
-#define SQ_WAITCNT_EXP_SIZE            0x00000003
-
-/*
- * VALUE_SQ_V_OP2_COUNT value
- */
-
-#define SQ_V_OP2_COUNT                 0x00000040
-
-/*
- * VALUE_SQ_HWREG_SIZE_SIZE value
- */
-
-#define SQ_HWREG_SIZE_SIZE             0x00000005
-
-/*
- * VALUE_SQ_WAITCNT_VM_SHIFT value
- */
-
-#define SQ_WAITCNT_VM_SHIFT            0x00000000
-
-/*
- * VALUE_SQ_V_OP3_3IN_COUNT value
- */
-
-#define SQ_V_OP3_3IN_COUNT             0x000000b0
-
-/*
- * VALUE_SQ_NUM_VGPR value
- */
-
-#define SQ_NUM_VGPR                    0x00000100
-
-/*
- * VALUE_SQ_EXP_NUM_PARAM value
- */
-
-#define SQ_EXP_NUM_PARAM               0x00000020
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOPC_OFFSET value
- */
-
-#define SQ_XLATE_VOP3_TO_VOPC_OFFSET   0x00000000
-
-/*
- * VALUE_SQ_V_OP3_INTRP_COUNT value
- */
-
-#define SQ_V_OP3_INTRP_COUNT           0x0000000c
-
-/*
- * VALUE_SQ_WAITCNT_LGKM_SHIFT value
- */
-
-#define SQ_WAITCNT_LGKM_SHIFT          0x00000008
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOP2_OFFSET value
- */
-
-#define SQ_XLATE_VOP3_TO_VOP2_OFFSET   0x00000100
-
-/*
- * VALUE_SQ_V_OP3_2IN_OFFSET value
- */
-
-#define SQ_V_OP3_2IN_OFFSET            0x00000280
-
-/*
- * VALUE_SQ_V_INTRP_COUNT value
- */
-
-#define SQ_V_INTRP_COUNT               0x00000004
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VINTRP_OFFSET value
- */
-
-#define SQ_XLATE_VOP3_TO_VINTRP_OFFSET 0x00000270
-
-/*
- * VALUE_SQ_WAITCNT_LGKM_SIZE value
- */
-
-#define SQ_WAITCNT_LGKM_SIZE           0x00000004
-
-/*
- * VALUE_SQ_EXP_NUM_GDS value
- */
-
-#define SQ_EXP_NUM_GDS                 0x00000005
-
-/*
- * VALUE_SQ_HWREG_OFFSET_SIZE value
- */
-
-#define SQ_HWREG_OFFSET_SIZE           0x00000005
-
-/*
- * VALUE_SQ_WAITCNT_VM_SIZE value
- */
-
-#define SQ_WAITCNT_VM_SIZE             0x00000004
-
-/*
- * VALUE_SQ_V_OP3_2IN_COUNT value
- */
-
-#define SQ_V_OP3_2IN_COUNT             0x00000080
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VINTRP_COUNT value
- */
-
-#define SQ_XLATE_VOP3_TO_VINTRP_COUNT  0x00000004
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOPC_COUNT value
- */
-
-#define SQ_XLATE_VOP3_TO_VOPC_COUNT    0x00000100
-
-/*
- * VALUE_SQ_NUM_ATTR value
- */
-
-#define SQ_NUM_ATTR                    0x00000021
-
-/*
- * VALUE_SQ_V_OPC_COUNT value
- */
-
-#define SQ_V_OPC_COUNT                 0x00000100
-
-/*
- * VALUE_SQ_V_OP3_INTRP_OFFSET value
- */
-
-#define SQ_V_OP3_INTRP_OFFSET          0x00000274
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOP2_COUNT value
- */
-
-#define SQ_XLATE_VOP3_TO_VOP2_COUNT    0x00000040
-
-/*
- * VALUE_SQ_WAITCNT_EXP_SHIFT value
- */
-
-#define SQ_WAITCNT_EXP_SHIFT           0x00000004
-
-/*
- * VALUE_SQ_XLATE_VOP3_TO_VOP1_OFFSET value
- */
-
-#define SQ_XLATE_VOP3_TO_VOP1_OFFSET   0x00000140
-
-/*
- * VALUE_SQ_NUM_SGPR value
- */
-
-#define SQ_NUM_SGPR                    0x00000066
-
-/*
- * VALUE_SQ_FLAT_SCRATCH_LOHI value
- */
-
-#define SQ_FLAT_SCRATCH_LO             0x00000066
-#define SQ_FLAT_SCRATCH_HI             0x00000067
-
-/*
- * VALUE_SQ_OP_VOP3 value
- */
-
-#define SQ_V_MAD_LEGACY_F32            0x000001c0
-#define SQ_V_MAD_F32                   0x000001c1
-#define SQ_V_MAD_I32_I24               0x000001c2
-#define SQ_V_MAD_U32_U24               0x000001c3
-#define SQ_V_CUBEID_F32                0x000001c4
-#define SQ_V_CUBESC_F32                0x000001c5
-#define SQ_V_CUBETC_F32                0x000001c6
-#define SQ_V_CUBEMA_F32                0x000001c7
-#define SQ_V_BFE_U32                   0x000001c8
-#define SQ_V_BFE_I32                   0x000001c9
-#define SQ_V_BFI_B32                   0x000001ca
-#define SQ_V_FMA_F32                   0x000001cb
-#define SQ_V_FMA_F64                   0x000001cc
-#define SQ_V_LERP_U8                   0x000001cd
-#define SQ_V_ALIGNBIT_B32              0x000001ce
-#define SQ_V_ALIGNBYTE_B32             0x000001cf
-#define SQ_V_MIN3_F32                  0x000001d0
-#define SQ_V_MIN3_I32                  0x000001d1
-#define SQ_V_MIN3_U32                  0x000001d2
-#define SQ_V_MAX3_F32                  0x000001d3
-#define SQ_V_MAX3_I32                  0x000001d4
-#define SQ_V_MAX3_U32                  0x000001d5
-#define SQ_V_MED3_F32                  0x000001d6
-#define SQ_V_MED3_I32                  0x000001d7
-#define SQ_V_MED3_U32                  0x000001d8
-#define SQ_V_SAD_U8                    0x000001d9
-#define SQ_V_SAD_HI_U8                 0x000001da
-#define SQ_V_SAD_U16                   0x000001db
-#define SQ_V_SAD_U32                   0x000001dc
-#define SQ_V_CVT_PK_U8_F32             0x000001dd
-#define SQ_V_DIV_FIXUP_F32             0x000001de
-#define SQ_V_DIV_FIXUP_F64             0x000001df
-#define SQ_V_DIV_SCALE_F32             0x000001e0
-#define SQ_V_DIV_SCALE_F64             0x000001e1
-#define SQ_V_DIV_FMAS_F32              0x000001e2
-#define SQ_V_DIV_FMAS_F64              0x000001e3
-#define SQ_V_MSAD_U8                   0x000001e4
-#define SQ_V_QSAD_PK_U16_U8            0x000001e5
-#define SQ_V_MQSAD_PK_U16_U8           0x000001e6
-#define SQ_V_MQSAD_U32_U8              0x000001e7
-#define SQ_V_MAD_U64_U32               0x000001e8
-#define SQ_V_MAD_I64_I32               0x000001e9
-#define SQ_V_MAD_LEGACY_F16            0x000001ea
-#define SQ_V_MAD_LEGACY_U16            0x000001eb
-#define SQ_V_MAD_LEGACY_I16            0x000001ec
-#define SQ_V_PERM_B32                  0x000001ed
-#define SQ_V_FMA_LEGACY_F16            0x000001ee
-#define SQ_V_DIV_FIXUP_LEGACY_F16      0x000001ef
-#define SQ_V_CVT_PKACCUM_U8_F32        0x000001f0
-#define SQ_V_MAD_U32_U16               0x000001f1
-#define SQ_V_MAD_I32_I16               0x000001f2
-#define SQ_V_XAD_U32                   0x000001f3
-#define SQ_V_MIN3_F16                  0x000001f4
-#define SQ_V_MIN3_I16                  0x000001f5
-#define SQ_V_MIN3_U16                  0x000001f6
-#define SQ_V_MAX3_F16                  0x000001f7
-#define SQ_V_MAX3_I16                  0x000001f8
-#define SQ_V_MAX3_U16                  0x000001f9
-#define SQ_V_MED3_F16                  0x000001fa
-#define SQ_V_MED3_I16                  0x000001fb
-#define SQ_V_MED3_U16                  0x000001fc
-#define SQ_V_LSHL_ADD_U32              0x000001fd
-#define SQ_V_ADD_LSHL_U32              0x000001fe
-#define SQ_V_ADD3_U32                  0x000001ff
-#define SQ_V_LSHL_OR_B32               0x00000200
-#define SQ_V_AND_OR_B32                0x00000201
-#define SQ_V_OR3_B32                   0x00000202
-#define SQ_V_MAD_F16                   0x00000203
-#define SQ_V_MAD_U16                   0x00000204
-#define SQ_V_MAD_I16                   0x00000205
-#define SQ_V_FMA_F16                   0x00000206
-#define SQ_V_DIV_FIXUP_F16             0x00000207
-#define SQ_V_INTERP_P1LL_F16           0x00000274
-#define SQ_V_INTERP_P1LV_F16           0x00000275
-#define SQ_V_INTERP_P2_LEGACY_F16      0x00000276
-#define SQ_V_INTERP_P2_F16             0x00000277
-#define SQ_V_ADD_F64                   0x00000280
-#define SQ_V_MUL_F64                   0x00000281
-#define SQ_V_MIN_F64                   0x00000282
-#define SQ_V_MAX_F64                   0x00000283
-#define SQ_V_LDEXP_F64                 0x00000284
-#define SQ_V_MUL_LO_U32                0x00000285
-#define SQ_V_MUL_HI_U32                0x00000286
-#define SQ_V_MUL_HI_I32                0x00000287
-#define SQ_V_LDEXP_F32                 0x00000288
-#define SQ_V_READLANE_B32              0x00000289
-#define SQ_V_WRITELANE_B32             0x0000028a
-#define SQ_V_BCNT_U32_B32              0x0000028b
-#define SQ_V_MBCNT_LO_U32_B32          0x0000028c
-#define SQ_V_MBCNT_HI_U32_B32          0x0000028d
-#define SQ_V_MAC_LEGACY_F32            0x0000028e
-#define SQ_V_LSHLREV_B64               0x0000028f
-#define SQ_V_LSHRREV_B64               0x00000290
-#define SQ_V_ASHRREV_I64               0x00000291
-#define SQ_V_TRIG_PREOP_F64            0x00000292
-#define SQ_V_BFM_B32                   0x00000293
-#define SQ_V_CVT_PKNORM_I16_F32        0x00000294
-#define SQ_V_CVT_PKNORM_U16_F32        0x00000295
-#define SQ_V_CVT_PKRTZ_F16_F32         0x00000296
-#define SQ_V_CVT_PK_U16_U32            0x00000297
-#define SQ_V_CVT_PK_I16_I32            0x00000298
-#define SQ_V_CVT_PKNORM_I16_F16        0x00000299
-#define SQ_V_CVT_PKNORM_U16_F16        0x0000029a
-#define SQ_V_READLANE_REGRD_B32        0x0000029b
-#define SQ_V_ADD_I32                   0x0000029c
-#define SQ_V_SUB_I32                   0x0000029d
-#define SQ_V_ADD_I16                   0x0000029e
-#define SQ_V_SUB_I16                   0x0000029f
-#define SQ_V_PACK_B32_F16              0x000002a0
-
-/*
- * VALUE_SQ_OP_VINTRP value
- */
-
-#define SQ_V_INTERP_P1_F32             0x00000000
-#define SQ_V_INTERP_P2_F32             0x00000001
-#define SQ_V_INTERP_MOV_F32            0x00000002
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_VCCZ value
- */
-
-#define SQ_SRC_VCCZ                    0x000000fb
-
-/*
- * VALUE_SQ_TGT_INTERNAL value
- */
-
-#define SQ_EXP_GDS0                    0x00000018
-
-/*
- * VALUE_SQ_OMOD value
- */
-
-#define SQ_OMOD_OFF                    0x00000000
-#define SQ_OMOD_M2                     0x00000001
-#define SQ_OMOD_M4                     0x00000002
-#define SQ_OMOD_D2                     0x00000003
-
-/*
- * VALUE_SQ_ATTR value
- */
-
-#define SQ_ATTR0                       0x00000000
-
-/*
- * VALUE_SQ_TGT value
- */
-
-#define SQ_EXP_MRT0                    0x00000000
-#define SQ_EXP_MRTZ                    0x00000008
-#define SQ_EXP_NULL                    0x00000009
-#define SQ_EXP_POS0                    0x0000000c
-#define SQ_EXP_PARAM0                  0x00000020
-
-/*
- * VALUE_SQ_OPU_VOP3 value
- */
-
-#define SQ_V_OPC_OFFSET                0x00000000
-#define SQ_V_OP2_OFFSET                0x00000100
-#define SQ_V_OP1_OFFSET                0x00000140
-#define SQ_V_INTRP_OFFSET              0x00000270
-#define SQ_V_OP3P_OFFSET               0x00000380
-
-/*
- * VALUE_SQ_OP_SOPK value
- */
-
-#define SQ_S_MOVK_I32                  0x00000000
-#define SQ_S_CMOVK_I32                 0x00000001
-#define SQ_S_CMPK_EQ_I32               0x00000002
-#define SQ_S_CMPK_LG_I32               0x00000003
-#define SQ_S_CMPK_GT_I32               0x00000004
-#define SQ_S_CMPK_GE_I32               0x00000005
-#define SQ_S_CMPK_LT_I32               0x00000006
-#define SQ_S_CMPK_LE_I32               0x00000007
-#define SQ_S_CMPK_EQ_U32               0x00000008
-#define SQ_S_CMPK_LG_U32               0x00000009
-#define SQ_S_CMPK_GT_U32               0x0000000a
-#define SQ_S_CMPK_GE_U32               0x0000000b
-#define SQ_S_CMPK_LT_U32               0x0000000c
-#define SQ_S_CMPK_LE_U32               0x0000000d
-#define SQ_S_ADDK_I32                  0x0000000e
-#define SQ_S_MULK_I32                  0x0000000f
-#define SQ_S_CBRANCH_I_FORK            0x00000010
-#define SQ_S_GETREG_B32                0x00000011
-#define SQ_S_SETREG_B32                0x00000012
-#define SQ_S_GETREG_REGRD_B32          0x00000013
-#define SQ_S_SETREG_IMM32_B32          0x00000014
-#define SQ_S_CALL_B64                  0x00000015
-
-/*
- * VALUE_SQ_COMPF value
- */
-
-#define SQ_F                           0x00000000
-#define SQ_LT                          0x00000001
-#define SQ_EQ                          0x00000002
-#define SQ_LE                          0x00000003
-#define SQ_GT                          0x00000004
-#define SQ_LG                          0x00000005
-#define SQ_GE                          0x00000006
-#define SQ_O                           0x00000007
-#define SQ_U                           0x00000008
-#define SQ_NGE                         0x00000009
-#define SQ_NLG                         0x0000000a
-#define SQ_NGT                         0x0000000b
-#define SQ_NLE                         0x0000000c
-#define SQ_NEQ                         0x0000000d
-#define SQ_NLT                         0x0000000e
-#define SQ_TRU                         0x0000000f
-
-/*
- * VALUE_SQ_DPP_CTRL value
- */
-
-#define SQ_DPP_QUAD_PERM               0x00000000
-#define SQ_DPP_ROW_SL1                 0x00000101
-#define SQ_DPP_ROW_SL2                 0x00000102
-#define SQ_DPP_ROW_SL3                 0x00000103
-#define SQ_DPP_ROW_SL4                 0x00000104
-#define SQ_DPP_ROW_SL5                 0x00000105
-#define SQ_DPP_ROW_SL6                 0x00000106
-#define SQ_DPP_ROW_SL7                 0x00000107
-#define SQ_DPP_ROW_SL8                 0x00000108
-#define SQ_DPP_ROW_SL9                 0x00000109
-#define SQ_DPP_ROW_SL10                0x0000010a
-#define SQ_DPP_ROW_SL11                0x0000010b
-#define SQ_DPP_ROW_SL12                0x0000010c
-#define SQ_DPP_ROW_SL13                0x0000010d
-#define SQ_DPP_ROW_SL14                0x0000010e
-#define SQ_DPP_ROW_SL15                0x0000010f
-#define SQ_DPP_ROW_SR1                 0x00000111
-#define SQ_DPP_ROW_SR2                 0x00000112
-#define SQ_DPP_ROW_SR3                 0x00000113
-#define SQ_DPP_ROW_SR4                 0x00000114
-#define SQ_DPP_ROW_SR5                 0x00000115
-#define SQ_DPP_ROW_SR6                 0x00000116
-#define SQ_DPP_ROW_SR7                 0x00000117
-#define SQ_DPP_ROW_SR8                 0x00000118
-#define SQ_DPP_ROW_SR9                 0x00000119
-#define SQ_DPP_ROW_SR10                0x0000011a
-#define SQ_DPP_ROW_SR11                0x0000011b
-#define SQ_DPP_ROW_SR12                0x0000011c
-#define SQ_DPP_ROW_SR13                0x0000011d
-#define SQ_DPP_ROW_SR14                0x0000011e
-#define SQ_DPP_ROW_SR15                0x0000011f
-#define SQ_DPP_ROW_RR1                 0x00000121
-#define SQ_DPP_ROW_RR2                 0x00000122
-#define SQ_DPP_ROW_RR3                 0x00000123
-#define SQ_DPP_ROW_RR4                 0x00000124
-#define SQ_DPP_ROW_RR5                 0x00000125
-#define SQ_DPP_ROW_RR6                 0x00000126
-#define SQ_DPP_ROW_RR7                 0x00000127
-#define SQ_DPP_ROW_RR8                 0x00000128
-#define SQ_DPP_ROW_RR9                 0x00000129
-#define SQ_DPP_ROW_RR10                0x0000012a
-#define SQ_DPP_ROW_RR11                0x0000012b
-#define SQ_DPP_ROW_RR12                0x0000012c
-#define SQ_DPP_ROW_RR13                0x0000012d
-#define SQ_DPP_ROW_RR14                0x0000012e
-#define SQ_DPP_ROW_RR15                0x0000012f
-#define SQ_DPP_WF_SL1                  0x00000130
-#define SQ_DPP_WF_RL1                  0x00000134
-#define SQ_DPP_WF_SR1                  0x00000138
-#define SQ_DPP_WF_RR1                  0x0000013c
-#define SQ_DPP_ROW_MIRROR              0x00000140
-#define SQ_DPP_ROW_HALF_MIRROR         0x00000141
-#define SQ_DPP_ROW_BCAST15             0x00000142
-#define SQ_DPP_ROW_BCAST31             0x00000143
-
-/*
- * VALUE_SQ_VCC_LOHI value
- */
-
-#define SQ_VCC_LO                      0x0000006a
-#define SQ_VCC_HI                      0x0000006b
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_SCC value
- */
-
-#define SQ_SRC_SCC                     0x000000fd
-
-/*
- * VALUE_SQ_OP_SOP1 value
- */
-
-#define SQ_S_MOV_B32                   0x00000000
-#define SQ_S_MOV_B64                   0x00000001
-#define SQ_S_CMOV_B32                  0x00000002
-#define SQ_S_CMOV_B64                  0x00000003
-#define SQ_S_NOT_B32                   0x00000004
-#define SQ_S_NOT_B64                   0x00000005
-#define SQ_S_WQM_B32                   0x00000006
-#define SQ_S_WQM_B64                   0x00000007
-#define SQ_S_BREV_B32                  0x00000008
-#define SQ_S_BREV_B64                  0x00000009
-#define SQ_S_BCNT0_I32_B32             0x0000000a
-#define SQ_S_BCNT0_I32_B64             0x0000000b
-#define SQ_S_BCNT1_I32_B32             0x0000000c
-#define SQ_S_BCNT1_I32_B64             0x0000000d
-#define SQ_S_FF0_I32_B32               0x0000000e
-#define SQ_S_FF0_I32_B64               0x0000000f
-#define SQ_S_FF1_I32_B32               0x00000010
-#define SQ_S_FF1_I32_B64               0x00000011
-#define SQ_S_FLBIT_I32_B32             0x00000012
-#define SQ_S_FLBIT_I32_B64             0x00000013
-#define SQ_S_FLBIT_I32                 0x00000014
-#define SQ_S_FLBIT_I32_I64             0x00000015
-#define SQ_S_SEXT_I32_I8               0x00000016
-#define SQ_S_SEXT_I32_I16              0x00000017
-#define SQ_S_BITSET0_B32               0x00000018
-#define SQ_S_BITSET0_B64               0x00000019
-#define SQ_S_BITSET1_B32               0x0000001a
-#define SQ_S_BITSET1_B64               0x0000001b
-#define SQ_S_GETPC_B64                 0x0000001c
-#define SQ_S_SETPC_B64                 0x0000001d
-#define SQ_S_SWAPPC_B64                0x0000001e
-#define SQ_S_RFE_B64                   0x0000001f
-#define SQ_S_AND_SAVEEXEC_B64          0x00000020
-#define SQ_S_OR_SAVEEXEC_B64           0x00000021
-#define SQ_S_XOR_SAVEEXEC_B64          0x00000022
-#define SQ_S_ANDN2_SAVEEXEC_B64        0x00000023
-#define SQ_S_ORN2_SAVEEXEC_B64         0x00000024
-#define SQ_S_NAND_SAVEEXEC_B64         0x00000025
-#define SQ_S_NOR_SAVEEXEC_B64          0x00000026
-#define SQ_S_XNOR_SAVEEXEC_B64         0x00000027
-#define SQ_S_QUADMASK_B32              0x00000028
-#define SQ_S_QUADMASK_B64              0x00000029
-#define SQ_S_MOVRELS_B32               0x0000002a
-#define SQ_S_MOVRELS_B64               0x0000002b
-#define SQ_S_MOVRELD_B32               0x0000002c
-#define SQ_S_MOVRELD_B64               0x0000002d
-#define SQ_S_CBRANCH_JOIN              0x0000002e
-#define SQ_S_MOV_REGRD_B32             0x0000002f
-#define SQ_S_ABS_I32                   0x00000030
-#define SQ_S_MOV_FED_B32               0x00000031
-#define SQ_S_SET_GPR_IDX_IDX           0x00000032
-#define SQ_S_ANDN1_SAVEEXEC_B64        0x00000033
-#define SQ_S_ORN1_SAVEEXEC_B64         0x00000034
-#define SQ_S_ANDN1_WREXEC_B64          0x00000035
-#define SQ_S_ANDN2_WREXEC_B64          0x00000036
-#define SQ_S_BITREPLICATE_B64_B32      0x00000037
-
-/*
- * VALUE_SQ_MSG value
- */
-
-#define SQ_MSG_INTERRUPT               0x00000001
-#define SQ_MSG_GS                      0x00000002
-#define SQ_MSG_GS_DONE                 0x00000003
-#define SQ_MSG_SAVEWAVE                0x00000004
-#define SQ_MSG_STALL_WAVE_GEN          0x00000005
-#define SQ_MSG_HALT_WAVES              0x00000006
-#define SQ_MSG_ORDERED_PS_DONE         0x00000007
-#define SQ_MSG_EARLY_PRIM_DEALLOC      0x00000008
-#define SQ_MSG_GS_ALLOC_REQ            0x00000009
-#define SQ_MSG_SYSMSG                  0x0000000f
-
-/*
- * VALUE_SQ_OP_FLAT_GLBL value
- */
-
-#define SQ_GLOBAL_LOAD_UBYTE           0x00000010
-#define SQ_GLOBAL_LOAD_SBYTE           0x00000011
-#define SQ_GLOBAL_LOAD_USHORT          0x00000012
-#define SQ_GLOBAL_LOAD_SSHORT          0x00000013
-#define SQ_GLOBAL_LOAD_DWORD           0x00000014
-#define SQ_GLOBAL_LOAD_DWORDX2         0x00000015
-#define SQ_GLOBAL_LOAD_DWORDX3         0x00000016
-#define SQ_GLOBAL_LOAD_DWORDX4         0x00000017
-#define SQ_GLOBAL_STORE_BYTE           0x00000018
-#define SQ_GLOBAL_STORE_SHORT          0x0000001a
-#define SQ_GLOBAL_STORE_DWORD          0x0000001c
-#define SQ_GLOBAL_STORE_DWORDX2        0x0000001d
-#define SQ_GLOBAL_STORE_DWORDX3        0x0000001e
-#define SQ_GLOBAL_STORE_DWORDX4        0x0000001f
-#define SQ_GLOBAL_ATOMIC_SWAP          0x00000040
-#define SQ_GLOBAL_ATOMIC_CMPSWAP       0x00000041
-#define SQ_GLOBAL_ATOMIC_ADD           0x00000042
-#define SQ_GLOBAL_ATOMIC_SUB           0x00000043
-#define SQ_GLOBAL_ATOMIC_SMIN          0x00000044
-#define SQ_GLOBAL_ATOMIC_UMIN          0x00000045
-#define SQ_GLOBAL_ATOMIC_SMAX          0x00000046
-#define SQ_GLOBAL_ATOMIC_UMAX          0x00000047
-#define SQ_GLOBAL_ATOMIC_AND           0x00000048
-#define SQ_GLOBAL_ATOMIC_OR            0x00000049
-#define SQ_GLOBAL_ATOMIC_XOR           0x0000004a
-#define SQ_GLOBAL_ATOMIC_INC           0x0000004b
-#define SQ_GLOBAL_ATOMIC_DEC           0x0000004c
-#define SQ_GLOBAL_ATOMIC_SWAP_X2       0x00000060
-#define SQ_GLOBAL_ATOMIC_CMPSWAP_X2    0x00000061
-#define SQ_GLOBAL_ATOMIC_ADD_X2        0x00000062
-#define SQ_GLOBAL_ATOMIC_SUB_X2        0x00000063
-#define SQ_GLOBAL_ATOMIC_SMIN_X2       0x00000064
-#define SQ_GLOBAL_ATOMIC_UMIN_X2       0x00000065
-#define SQ_GLOBAL_ATOMIC_SMAX_X2       0x00000066
-#define SQ_GLOBAL_ATOMIC_UMAX_X2       0x00000067
-#define SQ_GLOBAL_ATOMIC_AND_X2        0x00000068
-#define SQ_GLOBAL_ATOMIC_OR_X2         0x00000069
-#define SQ_GLOBAL_ATOMIC_XOR_X2        0x0000006a
-#define SQ_GLOBAL_ATOMIC_INC_X2        0x0000006b
-#define SQ_GLOBAL_ATOMIC_DEC_X2        0x0000006c
-
-/*
- * VALUE_SQ_VGPR value
- */
-
-#define SQ_VGPR0                       0x00000000
-
-/*
- * VALUE_SQ_HW_REG value
- */
-
-#define SQ_HW_REG_MODE                 0x00000001
-#define SQ_HW_REG_STATUS               0x00000002
-#define SQ_HW_REG_TRAPSTS              0x00000003
-#define SQ_HW_REG_HW_ID                0x00000004
-#define SQ_HW_REG_GPR_ALLOC            0x00000005
-#define SQ_HW_REG_LDS_ALLOC            0x00000006
-#define SQ_HW_REG_IB_STS               0x00000007
-#define SQ_HW_REG_PC_LO                0x00000008
-#define SQ_HW_REG_PC_HI                0x00000009
-#define SQ_HW_REG_INST_DW0             0x0000000a
-#define SQ_HW_REG_INST_DW1             0x0000000b
-#define SQ_HW_REG_IB_DBG0              0x0000000c
-#define SQ_HW_REG_IB_DBG1              0x0000000d
-#define SQ_HW_REG_FLUSH_IB             0x0000000e
-#define SQ_HW_REG_SH_MEM_BASES         0x0000000f
-#define SQ_HW_REG_SQ_SHADER_TBA_LO     0x00000010
-#define SQ_HW_REG_SQ_SHADER_TBA_HI     0x00000011
-#define SQ_HW_REG_SQ_SHADER_TMA_LO     0x00000012
-#define SQ_HW_REG_SQ_SHADER_TMA_HI     0x00000013
-
-/*
- * VALUE_SQ_OP_VOP1 value
- */
-
-#define SQ_V_NOP                       0x00000000
-#define SQ_V_MOV_B32                   0x00000001
-#define SQ_V_READFIRSTLANE_B32         0x00000002
-#define SQ_V_CVT_I32_F64               0x00000003
-#define SQ_V_CVT_F64_I32               0x00000004
-#define SQ_V_CVT_F32_I32               0x00000005
-#define SQ_V_CVT_F32_U32               0x00000006
-#define SQ_V_CVT_U32_F32               0x00000007
-#define SQ_V_CVT_I32_F32               0x00000008
-#define SQ_V_MOV_FED_B32               0x00000009
-#define SQ_V_CVT_F16_F32               0x0000000a
-#define SQ_V_CVT_F32_F16               0x0000000b
-#define SQ_V_CVT_RPI_I32_F32           0x0000000c
-#define SQ_V_CVT_FLR_I32_F32           0x0000000d
-#define SQ_V_CVT_OFF_F32_I4            0x0000000e
-#define SQ_V_CVT_F32_F64               0x0000000f
-#define SQ_V_CVT_F64_F32               0x00000010
-#define SQ_V_CVT_F32_UBYTE0            0x00000011
-#define SQ_V_CVT_F32_UBYTE1            0x00000012
-#define SQ_V_CVT_F32_UBYTE2            0x00000013
-#define SQ_V_CVT_F32_UBYTE3            0x00000014
-#define SQ_V_CVT_U32_F64               0x00000015
-#define SQ_V_CVT_F64_U32               0x00000016
-#define SQ_V_TRUNC_F64                 0x00000017
-#define SQ_V_CEIL_F64                  0x00000018
-#define SQ_V_RNDNE_F64                 0x00000019
-#define SQ_V_FLOOR_F64                 0x0000001a
-#define SQ_V_FRACT_F32                 0x0000001b
-#define SQ_V_TRUNC_F32                 0x0000001c
-#define SQ_V_CEIL_F32                  0x0000001d
-#define SQ_V_RNDNE_F32                 0x0000001e
-#define SQ_V_FLOOR_F32                 0x0000001f
-#define SQ_V_EXP_F32                   0x00000020
-#define SQ_V_LOG_F32                   0x00000021
-#define SQ_V_RCP_F32                   0x00000022
-#define SQ_V_RCP_IFLAG_F32             0x00000023
-#define SQ_V_RSQ_F32                   0x00000024
-#define SQ_V_RCP_F64                   0x00000025
-#define SQ_V_RSQ_F64                   0x00000026
-#define SQ_V_SQRT_F32                  0x00000027
-#define SQ_V_SQRT_F64                  0x00000028
-#define SQ_V_SIN_F32                   0x00000029
-#define SQ_V_COS_F32                   0x0000002a
-#define SQ_V_NOT_B32                   0x0000002b
-#define SQ_V_BFREV_B32                 0x0000002c
-#define SQ_V_FFBH_U32                  0x0000002d
-#define SQ_V_FFBL_B32                  0x0000002e
-#define SQ_V_FFBH_I32                  0x0000002f
-#define SQ_V_FREXP_EXP_I32_F64         0x00000030
-#define SQ_V_FREXP_MANT_F64            0x00000031
-#define SQ_V_FRACT_F64                 0x00000032
-#define SQ_V_FREXP_EXP_I32_F32         0x00000033
-#define SQ_V_FREXP_MANT_F32            0x00000034
-#define SQ_V_CLREXCP                   0x00000035
-#define SQ_V_MOV_PRSV_B32              0x00000036
-#define SQ_V_CVT_F16_U16               0x00000039
-#define SQ_V_CVT_F16_I16               0x0000003a
-#define SQ_V_CVT_U16_F16               0x0000003b
-#define SQ_V_CVT_I16_F16               0x0000003c
-#define SQ_V_RCP_F16                   0x0000003d
-#define SQ_V_SQRT_F16                  0x0000003e
-#define SQ_V_RSQ_F16                   0x0000003f
-#define SQ_V_LOG_F16                   0x00000040
-#define SQ_V_EXP_F16                   0x00000041
-#define SQ_V_FREXP_MANT_F16            0x00000042
-#define SQ_V_FREXP_EXP_I16_F16         0x00000043
-#define SQ_V_FLOOR_F16                 0x00000044
-#define SQ_V_CEIL_F16                  0x00000045
-#define SQ_V_TRUNC_F16                 0x00000046
-#define SQ_V_RNDNE_F16                 0x00000047
-#define SQ_V_FRACT_F16                 0x00000048
-#define SQ_V_SIN_F16                   0x00000049
-#define SQ_V_COS_F16                   0x0000004a
-#define SQ_V_EXP_LEGACY_F32            0x0000004b
-#define SQ_V_LOG_LEGACY_F32            0x0000004c
-#define SQ_V_CVT_NORM_I16_F16          0x0000004d
-#define SQ_V_CVT_NORM_U16_F16          0x0000004e
-#define SQ_V_SAT_PK_U8_I16             0x0000004f
-#define SQ_V_WRITELANE_IMM32           0x00000050
-#define SQ_V_SWAP_B32                  0x00000051
-
-/*
- * VALUE_SQ_OP_MUBUF value
- */
-
-#define SQ_BUFFER_LOAD_FORMAT_X        0x00000000
-#define SQ_BUFFER_LOAD_FORMAT_XY       0x00000001
-#define SQ_BUFFER_LOAD_FORMAT_XYZ      0x00000002
-#define SQ_BUFFER_LOAD_FORMAT_XYZW     0x00000003
-#define SQ_BUFFER_STORE_FORMAT_X       0x00000004
-#define SQ_BUFFER_STORE_FORMAT_XY      0x00000005
-#define SQ_BUFFER_STORE_FORMAT_XYZ     0x00000006
-#define SQ_BUFFER_STORE_FORMAT_XYZW    0x00000007
-#define SQ_BUFFER_LOAD_FORMAT_D16_X    0x00000008
-#define SQ_BUFFER_LOAD_FORMAT_D16_XY   0x00000009
-#define SQ_BUFFER_LOAD_FORMAT_D16_XYZ  0x0000000a
-#define SQ_BUFFER_LOAD_FORMAT_D16_XYZW 0x0000000b
-#define SQ_BUFFER_STORE_FORMAT_D16_X   0x0000000c
-#define SQ_BUFFER_STORE_FORMAT_D16_XY  0x0000000d
-#define SQ_BUFFER_STORE_FORMAT_D16_XYZ 0x0000000e
-#define SQ_BUFFER_STORE_FORMAT_D16_XYZW 0x0000000f
-#define SQ_BUFFER_LOAD_UBYTE           0x00000010
-#define SQ_BUFFER_LOAD_SBYTE           0x00000011
-#define SQ_BUFFER_LOAD_USHORT          0x00000012
-#define SQ_BUFFER_LOAD_SSHORT          0x00000013
-#define SQ_BUFFER_LOAD_DWORD           0x00000014
-#define SQ_BUFFER_LOAD_DWORDX2         0x00000015
-#define SQ_BUFFER_LOAD_DWORDX3         0x00000016
-#define SQ_BUFFER_LOAD_DWORDX4         0x00000017
-#define SQ_BUFFER_STORE_BYTE           0x00000018
-#define SQ_BUFFER_STORE_SHORT          0x0000001a
-#define SQ_BUFFER_STORE_DWORD          0x0000001c
-#define SQ_BUFFER_STORE_DWORDX2        0x0000001d
-#define SQ_BUFFER_STORE_DWORDX3        0x0000001e
-#define SQ_BUFFER_STORE_DWORDX4        0x0000001f
-#define SQ_BUFFER_STORE_LDS_DWORD      0x0000003d
-#define SQ_BUFFER_WBINVL1              0x0000003e
-#define SQ_BUFFER_WBINVL1_VOL          0x0000003f
-#define SQ_BUFFER_ATOMIC_SWAP          0x00000040
-#define SQ_BUFFER_ATOMIC_CMPSWAP       0x00000041
-#define SQ_BUFFER_ATOMIC_ADD           0x00000042
-#define SQ_BUFFER_ATOMIC_SUB           0x00000043
-#define SQ_BUFFER_ATOMIC_SMIN          0x00000044
-#define SQ_BUFFER_ATOMIC_UMIN          0x00000045
-#define SQ_BUFFER_ATOMIC_SMAX          0x00000046
-#define SQ_BUFFER_ATOMIC_UMAX          0x00000047
-#define SQ_BUFFER_ATOMIC_AND           0x00000048
-#define SQ_BUFFER_ATOMIC_OR            0x00000049
-#define SQ_BUFFER_ATOMIC_XOR           0x0000004a
-#define SQ_BUFFER_ATOMIC_INC           0x0000004b
-#define SQ_BUFFER_ATOMIC_DEC           0x0000004c
-#define SQ_BUFFER_ATOMIC_SWAP_X2       0x00000060
-#define SQ_BUFFER_ATOMIC_CMPSWAP_X2    0x00000061
-#define SQ_BUFFER_ATOMIC_ADD_X2        0x00000062
-#define SQ_BUFFER_ATOMIC_SUB_X2        0x00000063
-#define SQ_BUFFER_ATOMIC_SMIN_X2       0x00000064
-#define SQ_BUFFER_ATOMIC_UMIN_X2       0x00000065
-#define SQ_BUFFER_ATOMIC_SMAX_X2       0x00000066
-#define SQ_BUFFER_ATOMIC_UMAX_X2       0x00000067
-#define SQ_BUFFER_ATOMIC_AND_X2        0x00000068
-#define SQ_BUFFER_ATOMIC_OR_X2         0x00000069
-#define SQ_BUFFER_ATOMIC_XOR_X2        0x0000006a
-#define SQ_BUFFER_ATOMIC_INC_X2        0x0000006b
-#define SQ_BUFFER_ATOMIC_DEC_X2        0x0000006c
-
-/*
- * VALUE_SQ_TRAP value
- */
-
-#define SQ_TTMP0                       0x0000006c
-#define SQ_TTMP1                       0x0000006d
-#define SQ_TTMP2                       0x0000006e
-#define SQ_TTMP3                       0x0000006f
-#define SQ_TTMP4                       0x00000070
-#define SQ_TTMP5                       0x00000071
-#define SQ_TTMP6                       0x00000072
-#define SQ_TTMP7                       0x00000073
-#define SQ_TTMP8                       0x00000074
-#define SQ_TTMP9                       0x00000075
-#define SQ_TTMP10                      0x00000076
-#define SQ_TTMP11                      0x00000077
-#define SQ_TTMP12                      0x00000078
-#define SQ_TTMP13                      0x00000079
-#define SQ_TTMP14                      0x0000007a
-#define SQ_TTMP15                      0x0000007b
-
-/*
- * VALUE_SQ_OP_VOPC value
- */
-
-#define SQ_V_CMP_CLASS_F32             0x00000010
-#define SQ_V_CMPX_CLASS_F32            0x00000011
-#define SQ_V_CMP_CLASS_F64             0x00000012
-#define SQ_V_CMPX_CLASS_F64            0x00000013
-#define SQ_V_CMP_CLASS_F16             0x00000014
-#define SQ_V_CMPX_CLASS_F16            0x00000015
-#define SQ_V_CMP_F_F16                 0x00000020
-#define SQ_V_CMP_LT_F16                0x00000021
-#define SQ_V_CMP_EQ_F16                0x00000022
-#define SQ_V_CMP_LE_F16                0x00000023
-#define SQ_V_CMP_GT_F16                0x00000024
-#define SQ_V_CMP_LG_F16                0x00000025
-#define SQ_V_CMP_GE_F16                0x00000026
-#define SQ_V_CMP_O_F16                 0x00000027
-#define SQ_V_CMP_U_F16                 0x00000028
-#define SQ_V_CMP_NGE_F16               0x00000029
-#define SQ_V_CMP_NLG_F16               0x0000002a
-#define SQ_V_CMP_NGT_F16               0x0000002b
-#define SQ_V_CMP_NLE_F16               0x0000002c
-#define SQ_V_CMP_NEQ_F16               0x0000002d
-#define SQ_V_CMP_NLT_F16               0x0000002e
-#define SQ_V_CMP_TRU_F16               0x0000002f
-#define SQ_V_CMPX_F_F16                0x00000030
-#define SQ_V_CMPX_LT_F16               0x00000031
-#define SQ_V_CMPX_EQ_F16               0x00000032
-#define SQ_V_CMPX_LE_F16               0x00000033
-#define SQ_V_CMPX_GT_F16               0x00000034
-#define SQ_V_CMPX_LG_F16               0x00000035
-#define SQ_V_CMPX_GE_F16               0x00000036
-#define SQ_V_CMPX_O_F16                0x00000037
-#define SQ_V_CMPX_U_F16                0x00000038
-#define SQ_V_CMPX_NGE_F16              0x00000039
-#define SQ_V_CMPX_NLG_F16              0x0000003a
-#define SQ_V_CMPX_NGT_F16              0x0000003b
-#define SQ_V_CMPX_NLE_F16              0x0000003c
-#define SQ_V_CMPX_NEQ_F16              0x0000003d
-#define SQ_V_CMPX_NLT_F16              0x0000003e
-#define SQ_V_CMPX_TRU_F16              0x0000003f
-#define SQ_V_CMP_F_F32                 0x00000040
-#define SQ_V_CMP_LT_F32                0x00000041
-#define SQ_V_CMP_EQ_F32                0x00000042
-#define SQ_V_CMP_LE_F32                0x00000043
-#define SQ_V_CMP_GT_F32                0x00000044
-#define SQ_V_CMP_LG_F32                0x00000045
-#define SQ_V_CMP_GE_F32                0x00000046
-#define SQ_V_CMP_O_F32                 0x00000047
-#define SQ_V_CMP_U_F32                 0x00000048
-#define SQ_V_CMP_NGE_F32               0x00000049
-#define SQ_V_CMP_NLG_F32               0x0000004a
-#define SQ_V_CMP_NGT_F32               0x0000004b
-#define SQ_V_CMP_NLE_F32               0x0000004c
-#define SQ_V_CMP_NEQ_F32               0x0000004d
-#define SQ_V_CMP_NLT_F32               0x0000004e
-#define SQ_V_CMP_TRU_F32               0x0000004f
-#define SQ_V_CMPX_F_F32                0x00000050
-#define SQ_V_CMPX_LT_F32               0x00000051
-#define SQ_V_CMPX_EQ_F32               0x00000052
-#define SQ_V_CMPX_LE_F32               0x00000053
-#define SQ_V_CMPX_GT_F32               0x00000054
-#define SQ_V_CMPX_LG_F32               0x00000055
-#define SQ_V_CMPX_GE_F32               0x00000056
-#define SQ_V_CMPX_O_F32                0x00000057
-#define SQ_V_CMPX_U_F32                0x00000058
-#define SQ_V_CMPX_NGE_F32              0x00000059
-#define SQ_V_CMPX_NLG_F32              0x0000005a
-#define SQ_V_CMPX_NGT_F32              0x0000005b
-#define SQ_V_CMPX_NLE_F32              0x0000005c
-#define SQ_V_CMPX_NEQ_F32              0x0000005d
-#define SQ_V_CMPX_NLT_F32              0x0000005e
-#define SQ_V_CMPX_TRU_F32              0x0000005f
-#define SQ_V_CMP_F_F64                 0x00000060
-#define SQ_V_CMP_LT_F64                0x00000061
-#define SQ_V_CMP_EQ_F64                0x00000062
-#define SQ_V_CMP_LE_F64                0x00000063
-#define SQ_V_CMP_GT_F64                0x00000064
-#define SQ_V_CMP_LG_F64                0x00000065
-#define SQ_V_CMP_GE_F64                0x00000066
-#define SQ_V_CMP_O_F64                 0x00000067
-#define SQ_V_CMP_U_F64                 0x00000068
-#define SQ_V_CMP_NGE_F64               0x00000069
-#define SQ_V_CMP_NLG_F64               0x0000006a
-#define SQ_V_CMP_NGT_F64               0x0000006b
-#define SQ_V_CMP_NLE_F64               0x0000006c
-#define SQ_V_CMP_NEQ_F64               0x0000006d
-#define SQ_V_CMP_NLT_F64               0x0000006e
-#define SQ_V_CMP_TRU_F64               0x0000006f
-#define SQ_V_CMPX_F_F64                0x00000070
-#define SQ_V_CMPX_LT_F64               0x00000071
-#define SQ_V_CMPX_EQ_F64               0x00000072
-#define SQ_V_CMPX_LE_F64               0x00000073
-#define SQ_V_CMPX_GT_F64               0x00000074
-#define SQ_V_CMPX_LG_F64               0x00000075
-#define SQ_V_CMPX_GE_F64               0x00000076
-#define SQ_V_CMPX_O_F64                0x00000077
-#define SQ_V_CMPX_U_F64                0x00000078
-#define SQ_V_CMPX_NGE_F64              0x00000079
-#define SQ_V_CMPX_NLG_F64              0x0000007a
-#define SQ_V_CMPX_NGT_F64              0x0000007b
-#define SQ_V_CMPX_NLE_F64              0x0000007c
-#define SQ_V_CMPX_NEQ_F64              0x0000007d
-#define SQ_V_CMPX_NLT_F64              0x0000007e
-#define SQ_V_CMPX_TRU_F64              0x0000007f
-#define SQ_V_CMP_F_I16                 0x000000a0
-#define SQ_V_CMP_LT_I16                0x000000a1
-#define SQ_V_CMP_EQ_I16                0x000000a2
-#define SQ_V_CMP_LE_I16                0x000000a3
-#define SQ_V_CMP_GT_I16                0x000000a4
-#define SQ_V_CMP_NE_I16                0x000000a5
-#define SQ_V_CMP_GE_I16                0x000000a6
-#define SQ_V_CMP_T_I16                 0x000000a7
-#define SQ_V_CMP_F_U16                 0x000000a8
-#define SQ_V_CMP_LT_U16                0x000000a9
-#define SQ_V_CMP_EQ_U16                0x000000aa
-#define SQ_V_CMP_LE_U16                0x000000ab
-#define SQ_V_CMP_GT_U16                0x000000ac
-#define SQ_V_CMP_NE_U16                0x000000ad
-#define SQ_V_CMP_GE_U16                0x000000ae
-#define SQ_V_CMP_T_U16                 0x000000af
-#define SQ_V_CMPX_F_I16                0x000000b0
-#define SQ_V_CMPX_LT_I16               0x000000b1
-#define SQ_V_CMPX_EQ_I16               0x000000b2
-#define SQ_V_CMPX_LE_I16               0x000000b3
-#define SQ_V_CMPX_GT_I16               0x000000b4
-#define SQ_V_CMPX_NE_I16               0x000000b5
-#define SQ_V_CMPX_GE_I16               0x000000b6
-#define SQ_V_CMPX_T_I16                0x000000b7
-#define SQ_V_CMPX_F_U16                0x000000b8
-#define SQ_V_CMPX_LT_U16               0x000000b9
-#define SQ_V_CMPX_EQ_U16               0x000000ba
-#define SQ_V_CMPX_LE_U16               0x000000bb
-#define SQ_V_CMPX_GT_U16               0x000000bc
-#define SQ_V_CMPX_NE_U16               0x000000bd
-#define SQ_V_CMPX_GE_U16               0x000000be
-#define SQ_V_CMPX_T_U16                0x000000bf
-#define SQ_V_CMP_F_I32                 0x000000c0
-#define SQ_V_CMP_LT_I32                0x000000c1
-#define SQ_V_CMP_EQ_I32                0x000000c2
-#define SQ_V_CMP_LE_I32                0x000000c3
-#define SQ_V_CMP_GT_I32                0x000000c4
-#define SQ_V_CMP_NE_I32                0x000000c5
-#define SQ_V_CMP_GE_I32                0x000000c6
-#define SQ_V_CMP_T_I32                 0x000000c7
-#define SQ_V_CMP_F_U32                 0x000000c8
-#define SQ_V_CMP_LT_U32                0x000000c9
-#define SQ_V_CMP_EQ_U32                0x000000ca
-#define SQ_V_CMP_LE_U32                0x000000cb
-#define SQ_V_CMP_GT_U32                0x000000cc
-#define SQ_V_CMP_NE_U32                0x000000cd
-#define SQ_V_CMP_GE_U32                0x000000ce
-#define SQ_V_CMP_T_U32                 0x000000cf
-#define SQ_V_CMPX_F_I32                0x000000d0
-#define SQ_V_CMPX_LT_I32               0x000000d1
-#define SQ_V_CMPX_EQ_I32               0x000000d2
-#define SQ_V_CMPX_LE_I32               0x000000d3
-#define SQ_V_CMPX_GT_I32               0x000000d4
-#define SQ_V_CMPX_NE_I32               0x000000d5
-#define SQ_V_CMPX_GE_I32               0x000000d6
-#define SQ_V_CMPX_T_I32                0x000000d7
-#define SQ_V_CMPX_F_U32                0x000000d8
-#define SQ_V_CMPX_LT_U32               0x000000d9
-#define SQ_V_CMPX_EQ_U32               0x000000da
-#define SQ_V_CMPX_LE_U32               0x000000db
-#define SQ_V_CMPX_GT_U32               0x000000dc
-#define SQ_V_CMPX_NE_U32               0x000000dd
-#define SQ_V_CMPX_GE_U32               0x000000de
-#define SQ_V_CMPX_T_U32                0x000000df
-#define SQ_V_CMP_F_I64                 0x000000e0
-#define SQ_V_CMP_LT_I64                0x000000e1
-#define SQ_V_CMP_EQ_I64                0x000000e2
-#define SQ_V_CMP_LE_I64                0x000000e3
-#define SQ_V_CMP_GT_I64                0x000000e4
-#define SQ_V_CMP_NE_I64                0x000000e5
-#define SQ_V_CMP_GE_I64                0x000000e6
-#define SQ_V_CMP_T_I64                 0x000000e7
-#define SQ_V_CMP_F_U64                 0x000000e8
-#define SQ_V_CMP_LT_U64                0x000000e9
-#define SQ_V_CMP_EQ_U64                0x000000ea
-#define SQ_V_CMP_LE_U64                0x000000eb
-#define SQ_V_CMP_GT_U64                0x000000ec
-#define SQ_V_CMP_NE_U64                0x000000ed
-#define SQ_V_CMP_GE_U64                0x000000ee
-#define SQ_V_CMP_T_U64                 0x000000ef
-#define SQ_V_CMPX_F_I64                0x000000f0
-#define SQ_V_CMPX_LT_I64               0x000000f1
-#define SQ_V_CMPX_EQ_I64               0x000000f2
-#define SQ_V_CMPX_LE_I64               0x000000f3
-#define SQ_V_CMPX_GT_I64               0x000000f4
-#define SQ_V_CMPX_NE_I64               0x000000f5
-#define SQ_V_CMPX_GE_I64               0x000000f6
-#define SQ_V_CMPX_T_I64                0x000000f7
-#define SQ_V_CMPX_F_U64                0x000000f8
-#define SQ_V_CMPX_LT_U64               0x000000f9
-#define SQ_V_CMPX_EQ_U64               0x000000fa
-#define SQ_V_CMPX_LE_U64               0x000000fb
-#define SQ_V_CMPX_GT_U64               0x000000fc
-#define SQ_V_CMPX_NE_U64               0x000000fd
-#define SQ_V_CMPX_GE_U64               0x000000fe
-#define SQ_V_CMPX_T_U64                0x000000ff
-
-/*
- * VALUE_SQ_DPP_CTRL_R_1_15 value
- */
-
-#define SQ_R1                          0x00000001
-#define SQ_R2                          0x00000002
-#define SQ_R3                          0x00000003
-#define SQ_R4                          0x00000004
-#define SQ_R5                          0x00000005
-#define SQ_R6                          0x00000006
-#define SQ_R7                          0x00000007
-#define SQ_R8                          0x00000008
-#define SQ_R9                          0x00000009
-#define SQ_R10                         0x0000000a
-#define SQ_R11                         0x0000000b
-#define SQ_R12                         0x0000000c
-#define SQ_R13                         0x0000000d
-#define SQ_R14                         0x0000000e
-#define SQ_R15                         0x0000000f
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_LDS value
- */
-
-#define SQ_SRC_LDS_DIRECT              0x000000fe
-
-/*
- * VALUE_SQ_OP_EXP value
- */
-
-#define SQ_EXP                         0x00000000
-
-/*
- * VALUE_SQ_SDST_M0 value
- */
-
-#define SQ_M0                          0x0000007c
-
-/*
- * VALUE_SQ_OP_MIMG value
- */
-
-#define SQ_IMAGE_LOAD                  0x00000000
-#define SQ_IMAGE_LOAD_MIP              0x00000001
-#define SQ_IMAGE_LOAD_PCK              0x00000002
-#define SQ_IMAGE_LOAD_PCK_SGN          0x00000003
-#define SQ_IMAGE_LOAD_MIP_PCK          0x00000004
-#define SQ_IMAGE_LOAD_MIP_PCK_SGN      0x00000005
-#define SQ_IMAGE_STORE                 0x00000008
-#define SQ_IMAGE_STORE_MIP             0x00000009
-#define SQ_IMAGE_STORE_PCK             0x0000000a
-#define SQ_IMAGE_STORE_MIP_PCK         0x0000000b
-#define SQ_IMAGE_GET_RESINFO           0x0000000e
-#define SQ_IMAGE_ATOMIC_SWAP           0x00000010
-#define SQ_IMAGE_ATOMIC_CMPSWAP        0x00000011
-#define SQ_IMAGE_ATOMIC_ADD            0x00000012
-#define SQ_IMAGE_ATOMIC_SUB            0x00000013
-#define SQ_IMAGE_ATOMIC_SMIN           0x00000014
-#define SQ_IMAGE_ATOMIC_UMIN           0x00000015
-#define SQ_IMAGE_ATOMIC_SMAX           0x00000016
-#define SQ_IMAGE_ATOMIC_UMAX           0x00000017
-#define SQ_IMAGE_ATOMIC_AND            0x00000018
-#define SQ_IMAGE_ATOMIC_OR             0x00000019
-#define SQ_IMAGE_ATOMIC_XOR            0x0000001a
-#define SQ_IMAGE_ATOMIC_INC            0x0000001b
-#define SQ_IMAGE_ATOMIC_DEC            0x0000001c
-#define SQ_IMAGE_SAMPLE                0x00000020
-#define SQ_IMAGE_SAMPLE_CL             0x00000021
-#define SQ_IMAGE_SAMPLE_D              0x00000022
-#define SQ_IMAGE_SAMPLE_D_CL           0x00000023
-#define SQ_IMAGE_SAMPLE_L              0x00000024
-#define SQ_IMAGE_SAMPLE_B              0x00000025
-#define SQ_IMAGE_SAMPLE_B_CL           0x00000026
-#define SQ_IMAGE_SAMPLE_LZ             0x00000027
-#define SQ_IMAGE_SAMPLE_C              0x00000028
-#define SQ_IMAGE_SAMPLE_C_CL           0x00000029
-#define SQ_IMAGE_SAMPLE_C_D            0x0000002a
-#define SQ_IMAGE_SAMPLE_C_D_CL         0x0000002b
-#define SQ_IMAGE_SAMPLE_C_L            0x0000002c
-#define SQ_IMAGE_SAMPLE_C_B            0x0000002d
-#define SQ_IMAGE_SAMPLE_C_B_CL         0x0000002e
-#define SQ_IMAGE_SAMPLE_C_LZ           0x0000002f
-#define SQ_IMAGE_SAMPLE_O              0x00000030
-#define SQ_IMAGE_SAMPLE_CL_O           0x00000031
-#define SQ_IMAGE_SAMPLE_D_O            0x00000032
-#define SQ_IMAGE_SAMPLE_D_CL_O         0x00000033
-#define SQ_IMAGE_SAMPLE_L_O            0x00000034
-#define SQ_IMAGE_SAMPLE_B_O            0x00000035
-#define SQ_IMAGE_SAMPLE_B_CL_O         0x00000036
-#define SQ_IMAGE_SAMPLE_LZ_O           0x00000037
-#define SQ_IMAGE_SAMPLE_C_O            0x00000038
-#define SQ_IMAGE_SAMPLE_C_CL_O         0x00000039
-#define SQ_IMAGE_SAMPLE_C_D_O          0x0000003a
-#define SQ_IMAGE_SAMPLE_C_D_CL_O       0x0000003b
-#define SQ_IMAGE_SAMPLE_C_L_O          0x0000003c
-#define SQ_IMAGE_SAMPLE_C_B_O          0x0000003d
-#define SQ_IMAGE_SAMPLE_C_B_CL_O       0x0000003e
-#define SQ_IMAGE_SAMPLE_C_LZ_O         0x0000003f
-#define SQ_IMAGE_GATHER4               0x00000040
-#define SQ_IMAGE_GATHER4_CL            0x00000041
-#define SQ_IMAGE_GATHER4H              0x00000042
-#define SQ_IMAGE_GATHER4_L             0x00000044
-#define SQ_IMAGE_GATHER4_B             0x00000045
-#define SQ_IMAGE_GATHER4_B_CL          0x00000046
-#define SQ_IMAGE_GATHER4_LZ            0x00000047
-#define SQ_IMAGE_GATHER4_C             0x00000048
-#define SQ_IMAGE_GATHER4_C_CL          0x00000049
-#define SQ_IMAGE_GATHER4H_PCK          0x0000004a
-#define SQ_IMAGE_GATHER8H_PCK          0x0000004b
-#define SQ_IMAGE_GATHER4_C_L           0x0000004c
-#define SQ_IMAGE_GATHER4_C_B           0x0000004d
-#define SQ_IMAGE_GATHER4_C_B_CL        0x0000004e
-#define SQ_IMAGE_GATHER4_C_LZ          0x0000004f
-#define SQ_IMAGE_GATHER4_O             0x00000050
-#define SQ_IMAGE_GATHER4_CL_O          0x00000051
-#define SQ_IMAGE_GATHER4_L_O           0x00000054
-#define SQ_IMAGE_GATHER4_B_O           0x00000055
-#define SQ_IMAGE_GATHER4_B_CL_O        0x00000056
-#define SQ_IMAGE_GATHER4_LZ_O          0x00000057
-#define SQ_IMAGE_GATHER4_C_O           0x00000058
-#define SQ_IMAGE_GATHER4_C_CL_O        0x00000059
-#define SQ_IMAGE_GATHER4_C_L_O         0x0000005c
-#define SQ_IMAGE_GATHER4_C_B_O         0x0000005d
-#define SQ_IMAGE_GATHER4_C_B_CL_O      0x0000005e
-#define SQ_IMAGE_GATHER4_C_LZ_O        0x0000005f
-#define SQ_IMAGE_GET_LOD               0x00000060
-#define SQ_IMAGE_SAMPLE_CD             0x00000068
-#define SQ_IMAGE_SAMPLE_CD_CL          0x00000069
-#define SQ_IMAGE_SAMPLE_C_CD           0x0000006a
-#define SQ_IMAGE_SAMPLE_C_CD_CL        0x0000006b
-#define SQ_IMAGE_SAMPLE_CD_O           0x0000006c
-#define SQ_IMAGE_SAMPLE_CD_CL_O        0x0000006d
-#define SQ_IMAGE_SAMPLE_C_CD_O         0x0000006e
-#define SQ_IMAGE_SAMPLE_C_CD_CL_O      0x0000006f
-#define SQ_IMAGE_RSRC256               0x0000007e
-#define SQ_IMAGE_SAMPLER               0x0000007f
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_NOLIT value
- */
-
-#define SQ_SRC_64_INT                  0x000000c0
-#define SQ_SRC_M_1_INT                 0x000000c1
-#define SQ_SRC_M_2_INT                 0x000000c2
-#define SQ_SRC_M_3_INT                 0x000000c3
-#define SQ_SRC_M_4_INT                 0x000000c4
-#define SQ_SRC_M_5_INT                 0x000000c5
-#define SQ_SRC_M_6_INT                 0x000000c6
-#define SQ_SRC_M_7_INT                 0x000000c7
-#define SQ_SRC_M_8_INT                 0x000000c8
-#define SQ_SRC_M_9_INT                 0x000000c9
-#define SQ_SRC_M_10_INT                0x000000ca
-#define SQ_SRC_M_11_INT                0x000000cb
-#define SQ_SRC_M_12_INT                0x000000cc
-#define SQ_SRC_M_13_INT                0x000000cd
-#define SQ_SRC_M_14_INT                0x000000ce
-#define SQ_SRC_M_15_INT                0x000000cf
-#define SQ_SRC_M_16_INT                0x000000d0
-#define SQ_SRC_0_5                     0x000000f0
-#define SQ_SRC_M_0_5                   0x000000f1
-#define SQ_SRC_1                       0x000000f2
-#define SQ_SRC_M_1                     0x000000f3
-#define SQ_SRC_2                       0x000000f4
-#define SQ_SRC_M_2                     0x000000f5
-#define SQ_SRC_4                       0x000000f6
-#define SQ_SRC_M_4                     0x000000f7
-#define SQ_SRC_INV_2PI                 0x000000f8
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_DPP value
- */
-
-#define SQ_SRC_DPP                     0x000000fa
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_APERTURE value
- */
-
-#define SQ_SRC_SHARED_BASE             0x000000eb
-#define SQ_SRC_SHARED_LIMIT            0x000000ec
-#define SQ_SRC_PRIVATE_BASE            0x000000ed
-#define SQ_SRC_PRIVATE_LIMIT           0x000000ee
-
-/*
- * VALUE_SQ_DPP_CTRL_L_1_15 value
- */
-
-#define SQ_L1                          0x00000001
-#define SQ_L2                          0x00000002
-#define SQ_L3                          0x00000003
-#define SQ_L4                          0x00000004
-#define SQ_L5                          0x00000005
-#define SQ_L6                          0x00000006
-#define SQ_L7                          0x00000007
-#define SQ_L8                          0x00000008
-#define SQ_L9                          0x00000009
-#define SQ_L10                         0x0000000a
-#define SQ_L11                         0x0000000b
-#define SQ_L12                         0x0000000c
-#define SQ_L13                         0x0000000d
-#define SQ_L14                         0x0000000e
-#define SQ_L15                         0x0000000f
-
-/*
- * VALUE_SQ_OP_SOP2 value
- */
-
-#define SQ_S_ADD_U32                   0x00000000
-#define SQ_S_SUB_U32                   0x00000001
-#define SQ_S_ADD_I32                   0x00000002
-#define SQ_S_SUB_I32                   0x00000003
-#define SQ_S_ADDC_U32                  0x00000004
-#define SQ_S_SUBB_U32                  0x00000005
-#define SQ_S_MIN_I32                   0x00000006
-#define SQ_S_MIN_U32                   0x00000007
-#define SQ_S_MAX_I32                   0x00000008
-#define SQ_S_MAX_U32                   0x00000009
-#define SQ_S_CSELECT_B32               0x0000000a
-#define SQ_S_CSELECT_B64               0x0000000b
-#define SQ_S_AND_B32                   0x0000000c
-#define SQ_S_AND_B64                   0x0000000d
-#define SQ_S_OR_B32                    0x0000000e
-#define SQ_S_OR_B64                    0x0000000f
-#define SQ_S_XOR_B32                   0x00000010
-#define SQ_S_XOR_B64                   0x00000011
-#define SQ_S_ANDN2_B32                 0x00000012
-#define SQ_S_ANDN2_B64                 0x00000013
-#define SQ_S_ORN2_B32                  0x00000014
-#define SQ_S_ORN2_B64                  0x00000015
-#define SQ_S_NAND_B32                  0x00000016
-#define SQ_S_NAND_B64                  0x00000017
-#define SQ_S_NOR_B32                   0x00000018
-#define SQ_S_NOR_B64                   0x00000019
-#define SQ_S_XNOR_B32                  0x0000001a
-#define SQ_S_XNOR_B64                  0x0000001b
-#define SQ_S_LSHL_B32                  0x0000001c
-#define SQ_S_LSHL_B64                  0x0000001d
-#define SQ_S_LSHR_B32                  0x0000001e
-#define SQ_S_LSHR_B64                  0x0000001f
-#define SQ_S_ASHR_I32                  0x00000020
-#define SQ_S_ASHR_I64                  0x00000021
-#define SQ_S_BFM_B32                   0x00000022
-#define SQ_S_BFM_B64                   0x00000023
-#define SQ_S_MUL_I32                   0x00000024
-#define SQ_S_BFE_U32                   0x00000025
-#define SQ_S_BFE_I32                   0x00000026
-#define SQ_S_BFE_U64                   0x00000027
-#define SQ_S_BFE_I64                   0x00000028
-#define SQ_S_CBRANCH_G_FORK            0x00000029
-#define SQ_S_ABSDIFF_I32               0x0000002a
-#define SQ_S_RFE_RESTORE_B64           0x0000002b
-#define SQ_S_MUL_HI_U32                0x0000002c
-#define SQ_S_MUL_HI_I32                0x0000002d
-#define SQ_S_LSHL1_ADD_U32             0x0000002e
-#define SQ_S_LSHL2_ADD_U32             0x0000002f
-#define SQ_S_LSHL3_ADD_U32             0x00000030
-#define SQ_S_LSHL4_ADD_U32             0x00000031
-#define SQ_S_PACK_LL_B32_B16           0x00000032
-#define SQ_S_PACK_LH_B32_B16           0x00000033
-#define SQ_S_PACK_HH_B32_B16           0x00000034
-
-/*
- * VALUE_SQ_SDST_EXEC value
- */
-
-#define SQ_EXEC_LO                     0x0000007e
-#define SQ_EXEC_HI                     0x0000007f
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_POPS_EXITING_WAVE_ID value
- */
-
-#define SQ_SRC_POPS_EXITING_WAVE_ID    0x000000ef
-
-/*
- * VALUE_SQ_COMPI value
- */
-
-#define SQ_F                           0x00000000
-#define SQ_LT                          0x00000001
-#define SQ_EQ                          0x00000002
-#define SQ_LE                          0x00000003
-#define SQ_GT                          0x00000004
-#define SQ_NE                          0x00000005
-#define SQ_GE                          0x00000006
-#define SQ_T                           0x00000007
-
-/*
- * VALUE_SQ_SGPR value
- */
-
-#define SQ_SGPR0                       0x00000000
-
-/*
- * VALUE_SQ_CHAN value
- */
-
-#define SQ_CHAN_X                      0x00000000
-#define SQ_CHAN_Y                      0x00000001
-#define SQ_CHAN_Z                      0x00000002
-#define SQ_CHAN_W                      0x00000003
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_SDWA value
- */
-
-#define SQ_SRC_SDWA                    0x000000f9
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_LIT value
- */
-
-#define SQ_SRC_LITERAL                 0x000000ff
-
-/*
- * VALUE_SQ_DPP_BOUND_CTRL value
- */
-
-#define SQ_DPP_BOUND_OFF               0x00000000
-#define SQ_DPP_BOUND_ZERO              0x00000001
-
-/*
- * VALUE_SQ_GS_OP value
- */
-
-#define SQ_GS_OP_NOP                   0x00000000
-#define SQ_GS_OP_CUT                   0x00000001
-#define SQ_GS_OP_EMIT                  0x00000002
-#define SQ_GS_OP_EMIT_CUT              0x00000003
-
-/*
- * VALUE_SQ_OP_MTBUF value
- */
-
-#define SQ_TBUFFER_LOAD_FORMAT_X       0x00000000
-#define SQ_TBUFFER_LOAD_FORMAT_XY      0x00000001
-#define SQ_TBUFFER_LOAD_FORMAT_XYZ     0x00000002
-#define SQ_TBUFFER_LOAD_FORMAT_XYZW    0x00000003
-#define SQ_TBUFFER_STORE_FORMAT_X      0x00000004
-#define SQ_TBUFFER_STORE_FORMAT_XY     0x00000005
-#define SQ_TBUFFER_STORE_FORMAT_XYZ    0x00000006
-#define SQ_TBUFFER_STORE_FORMAT_XYZW   0x00000007
-#define SQ_TBUFFER_LOAD_FORMAT_D16_X   0x00000008
-#define SQ_TBUFFER_LOAD_FORMAT_D16_XY  0x00000009
-#define SQ_TBUFFER_LOAD_FORMAT_D16_XYZ 0x0000000a
-#define SQ_TBUFFER_LOAD_FORMAT_D16_XYZW 0x0000000b
-#define SQ_TBUFFER_STORE_FORMAT_D16_X  0x0000000c
-#define SQ_TBUFFER_STORE_FORMAT_D16_XY 0x0000000d
-#define SQ_TBUFFER_STORE_FORMAT_D16_XYZ 0x0000000e
-#define SQ_TBUFFER_STORE_FORMAT_D16_XYZW 0x0000000f
-
-/*
- * VALUE_SQ_SSRC_SPECIAL_EXECZ value
- */
-
-#define SQ_SRC_EXECZ                   0x000000fc
-
-/*
- * VALUE_SQ_OP_VOP3P value
- */
-
-#define SQ_V_PK_MAD_I16                0x00000000
-#define SQ_V_PK_MUL_LO_U16             0x00000001
-#define SQ_V_PK_ADD_I16                0x00000002
-#define SQ_V_PK_SUB_I16                0x00000003
-#define SQ_V_PK_LSHLREV_B16            0x00000004
-#define SQ_V_PK_LSHRREV_B16            0x00000005
-#define SQ_V_PK_ASHRREV_I16            0x00000006
-#define SQ_V_PK_MAX_I16                0x00000007
-#define SQ_V_PK_MIN_I16                0x00000008
-#define SQ_V_PK_MAD_U16                0x00000009
-#define SQ_V_PK_ADD_U16                0x0000000a
-#define SQ_V_PK_SUB_U16                0x0000000b
-#define SQ_V_PK_MAX_U16                0x0000000c
-#define SQ_V_PK_MIN_U16                0x0000000d
-#define SQ_V_PK_MAD_F16                0x0000000e
-#define SQ_V_PK_ADD_F16                0x0000000f
-#define SQ_V_PK_MUL_F16                0x00000010
-#define SQ_V_PK_MIN_F16                0x00000011
-#define SQ_V_PK_MAX_F16                0x00000012
-#define SQ_V_MAD_MIX_F32               0x00000020
-#define SQ_V_MAD_MIXLO_F16             0x00000021
-#define SQ_V_MAD_MIXHI_F16             0x00000022
-
-/*
- * VALUE_SQ_SYSMSG_OP value
- */
-
-#define SQ_SYSMSG_OP_ECC_ERR_INTERRUPT 0x00000001
-#define SQ_SYSMSG_OP_REG_RD            0x00000002
-#define SQ_SYSMSG_OP_HOST_TRAP_ACK     0x00000003
-#define SQ_SYSMSG_OP_TTRACE_PC         0x00000004
-#define SQ_SYSMSG_OP_ILLEGAL_INST_INTERRUPT 0x00000005
-#define SQ_SYSMSG_OP_MEMVIOL_INTERRUPT 0x00000006
-
-/*
- * VALUE_SQ_VCC value
- */
-
-#define SQ_VCC_ALL                     0x00000000
-
-/*
- * VALUE_SQ_OP_SMEM value
- */
-
-#define SQ_S_LOAD_DWORD                0x00000000
-#define SQ_S_LOAD_DWORDX2              0x00000001
-#define SQ_S_LOAD_DWORDX4              0x00000002
-#define SQ_S_LOAD_DWORDX8              0x00000003
-#define SQ_S_LOAD_DWORDX16             0x00000004
-#define SQ_S_SCRATCH_LOAD_DWORD        0x00000005
-#define SQ_S_SCRATCH_LOAD_DWORDX2      0x00000006
-#define SQ_S_SCRATCH_LOAD_DWORDX4      0x00000007
-#define SQ_S_BUFFER_LOAD_DWORD         0x00000008
-#define SQ_S_BUFFER_LOAD_DWORDX2       0x00000009
-#define SQ_S_BUFFER_LOAD_DWORDX4       0x0000000a
-#define SQ_S_BUFFER_LOAD_DWORDX8       0x0000000b
-#define SQ_S_BUFFER_LOAD_DWORDX16      0x0000000c
-#define SQ_S_STORE_DWORD               0x00000010
-#define SQ_S_STORE_DWORDX2             0x00000011
-#define SQ_S_STORE_DWORDX4             0x00000012
-#define SQ_S_SCRATCH_STORE_DWORD       0x00000015
-#define SQ_S_SCRATCH_STORE_DWORDX2     0x00000016
-#define SQ_S_SCRATCH_STORE_DWORDX4     0x00000017
-#define SQ_S_BUFFER_STORE_DWORD        0x00000018
-#define SQ_S_BUFFER_STORE_DWORDX2      0x00000019
-#define SQ_S_BUFFER_STORE_DWORDX4      0x0000001a
-#define SQ_S_DCACHE_INV                0x00000020
-#define SQ_S_DCACHE_WB                 0x00000021
-#define SQ_S_DCACHE_INV_VOL            0x00000022
-#define SQ_S_DCACHE_WB_VOL             0x00000023
-#define SQ_S_MEMTIME                   0x00000024
-#define SQ_S_MEMREALTIME               0x00000025
-#define SQ_S_ATC_PROBE                 0x00000026
-#define SQ_S_ATC_PROBE_BUFFER          0x00000027
-#define SQ_S_BUFFER_ATOMIC_SWAP        0x00000040
-#define SQ_S_BUFFER_ATOMIC_CMPSWAP     0x00000041
-#define SQ_S_BUFFER_ATOMIC_ADD         0x00000042
-#define SQ_S_BUFFER_ATOMIC_SUB         0x00000043
-#define SQ_S_BUFFER_ATOMIC_SMIN        0x00000044
-#define SQ_S_BUFFER_ATOMIC_UMIN        0x00000045
-#define SQ_S_BUFFER_ATOMIC_SMAX        0x00000046
-#define SQ_S_BUFFER_ATOMIC_UMAX        0x00000047
-#define SQ_S_BUFFER_ATOMIC_AND         0x00000048
-#define SQ_S_BUFFER_ATOMIC_OR          0x00000049
-#define SQ_S_BUFFER_ATOMIC_XOR         0x0000004a
-#define SQ_S_BUFFER_ATOMIC_INC         0x0000004b
-#define SQ_S_BUFFER_ATOMIC_DEC         0x0000004c
-#define SQ_S_BUFFER_ATOMIC_SWAP_X2     0x00000060
-#define SQ_S_BUFFER_ATOMIC_CMPSWAP_X2  0x00000061
-#define SQ_S_BUFFER_ATOMIC_ADD_X2      0x00000062
-#define SQ_S_BUFFER_ATOMIC_SUB_X2      0x00000063
-#define SQ_S_BUFFER_ATOMIC_SMIN_X2     0x00000064
-#define SQ_S_BUFFER_ATOMIC_UMIN_X2     0x00000065
-#define SQ_S_BUFFER_ATOMIC_SMAX_X2     0x00000066
-#define SQ_S_BUFFER_ATOMIC_UMAX_X2     0x00000067
-#define SQ_S_BUFFER_ATOMIC_AND_X2      0x00000068
-#define SQ_S_BUFFER_ATOMIC_OR_X2       0x00000069
-#define SQ_S_BUFFER_ATOMIC_XOR_X2      0x0000006a
-#define SQ_S_BUFFER_ATOMIC_INC_X2      0x0000006b
-#define SQ_S_BUFFER_ATOMIC_DEC_X2      0x0000006c
-#define SQ_S_ATOMIC_SWAP               0x00000080
-#define SQ_S_ATOMIC_CMPSWAP            0x00000081
-#define SQ_S_ATOMIC_ADD                0x00000082
-#define SQ_S_ATOMIC_SUB                0x00000083
-#define SQ_S_ATOMIC_SMIN               0x00000084
-#define SQ_S_ATOMIC_UMIN               0x00000085
-#define SQ_S_ATOMIC_SMAX               0x00000086
-#define SQ_S_ATOMIC_UMAX               0x00000087
-#define SQ_S_ATOMIC_AND                0x00000088
-#define SQ_S_ATOMIC_OR                 0x00000089
-#define SQ_S_ATOMIC_XOR                0x0000008a
-#define SQ_S_ATOMIC_INC                0x0000008b
-#define SQ_S_ATOMIC_DEC                0x0000008c
-#define SQ_S_ATOMIC_SWAP_X2            0x000000a0
-#define SQ_S_ATOMIC_CMPSWAP_X2         0x000000a1
-#define SQ_S_ATOMIC_ADD_X2             0x000000a2
-#define SQ_S_ATOMIC_SUB_X2             0x000000a3
-#define SQ_S_ATOMIC_SMIN_X2            0x000000a4
-#define SQ_S_ATOMIC_UMIN_X2            0x000000a5
-#define SQ_S_ATOMIC_SMAX_X2            0x000000a6
-#define SQ_S_ATOMIC_UMAX_X2            0x000000a7
-#define SQ_S_ATOMIC_AND_X2             0x000000a8
-#define SQ_S_ATOMIC_OR_X2              0x000000a9
-#define SQ_S_ATOMIC_XOR_X2             0x000000aa
-#define SQ_S_ATOMIC_INC_X2             0x000000ab
-#define SQ_S_ATOMIC_DEC_X2             0x000000ac
-
-/*
- * VALUE_SQ_OP_DS value
- */
-
-#define SQ_DS_ADD_U32                  0x00000000
-#define SQ_DS_SUB_U32                  0x00000001
-#define SQ_DS_RSUB_U32                 0x00000002
-#define SQ_DS_INC_U32                  0x00000003
-#define SQ_DS_DEC_U32                  0x00000004
-#define SQ_DS_MIN_I32                  0x00000005
-#define SQ_DS_MAX_I32                  0x00000006
-#define SQ_DS_MIN_U32                  0x00000007
-#define SQ_DS_MAX_U32                  0x00000008
-#define SQ_DS_AND_B32                  0x00000009
-#define SQ_DS_OR_B32                   0x0000000a
-#define SQ_DS_XOR_B32                  0x0000000b
-#define SQ_DS_MSKOR_B32                0x0000000c
-#define SQ_DS_WRITE_B32                0x0000000d
-#define SQ_DS_WRITE2_B32               0x0000000e
-#define SQ_DS_WRITE2ST64_B32           0x0000000f
-#define SQ_DS_CMPST_B32                0x00000010
-#define SQ_DS_CMPST_F32                0x00000011
-#define SQ_DS_MIN_F32                  0x00000012
-#define SQ_DS_MAX_F32                  0x00000013
-#define SQ_DS_NOP                      0x00000014
-#define SQ_DS_ADD_F32                  0x00000015
-#define SQ_DS_WRITE_ADDTID_B32         0x0000001d
-#define SQ_DS_WRITE_B8                 0x0000001e
-#define SQ_DS_WRITE_B16                0x0000001f
-#define SQ_DS_ADD_RTN_U32              0x00000020
-#define SQ_DS_SUB_RTN_U32              0x00000021
-#define SQ_DS_RSUB_RTN_U32             0x00000022
-#define SQ_DS_INC_RTN_U32              0x00000023
-#define SQ_DS_DEC_RTN_U32              0x00000024
-#define SQ_DS_MIN_RTN_I32              0x00000025
-#define SQ_DS_MAX_RTN_I32              0x00000026
-#define SQ_DS_MIN_RTN_U32              0x00000027
-#define SQ_DS_MAX_RTN_U32              0x00000028
-#define SQ_DS_AND_RTN_B32              0x00000029
-#define SQ_DS_OR_RTN_B32               0x0000002a
-#define SQ_DS_XOR_RTN_B32              0x0000002b
-#define SQ_DS_MSKOR_RTN_B32            0x0000002c
-#define SQ_DS_WRXCHG_RTN_B32           0x0000002d
-#define SQ_DS_WRXCHG2_RTN_B32          0x0000002e
-#define SQ_DS_WRXCHG2ST64_RTN_B32      0x0000002f
-#define SQ_DS_CMPST_RTN_B32            0x00000030
-#define SQ_DS_CMPST_RTN_F32            0x00000031
-#define SQ_DS_MIN_RTN_F32              0x00000032
-#define SQ_DS_MAX_RTN_F32              0x00000033
-#define SQ_DS_WRAP_RTN_B32             0x00000034
-#define SQ_DS_ADD_RTN_F32              0x00000035
-#define SQ_DS_READ_B32                 0x00000036
-#define SQ_DS_READ2_B32                0x00000037
-#define SQ_DS_READ2ST64_B32            0x00000038
-#define SQ_DS_READ_I8                  0x00000039
-#define SQ_DS_READ_U8                  0x0000003a
-#define SQ_DS_READ_I16                 0x0000003b
-#define SQ_DS_READ_U16                 0x0000003c
-#define SQ_DS_SWIZZLE_B32              0x0000003d
-#define SQ_DS_PERMUTE_B32              0x0000003e
-#define SQ_DS_BPERMUTE_B32             0x0000003f
-#define SQ_DS_ADD_U64                  0x00000040
-#define SQ_DS_SUB_U64                  0x00000041
-#define SQ_DS_RSUB_U64                 0x00000042
-#define SQ_DS_INC_U64                  0x00000043
-#define SQ_DS_DEC_U64                  0x00000044
-#define SQ_DS_MIN_I64                  0x00000045
-#define SQ_DS_MAX_I64                  0x00000046
-#define SQ_DS_MIN_U64                  0x00000047
-#define SQ_DS_MAX_U64                  0x00000048
-#define SQ_DS_AND_B64                  0x00000049
-#define SQ_DS_OR_B64                   0x0000004a
-#define SQ_DS_XOR_B64                  0x0000004b
-#define SQ_DS_MSKOR_B64                0x0000004c
-#define SQ_DS_WRITE_B64                0x0000004d
-#define SQ_DS_WRITE2_B64               0x0000004e
-#define SQ_DS_WRITE2ST64_B64           0x0000004f
-#define SQ_DS_CMPST_B64                0x00000050
-#define SQ_DS_CMPST_F64                0x00000051
-#define SQ_DS_MIN_F64                  0x00000052
-#define SQ_DS_MAX_F64                  0x00000053
-#define SQ_DS_ADD_RTN_U64              0x00000060
-#define SQ_DS_SUB_RTN_U64              0x00000061
-#define SQ_DS_RSUB_RTN_U64             0x00000062
-#define SQ_DS_INC_RTN_U64              0x00000063
-#define SQ_DS_DEC_RTN_U64              0x00000064
-#define SQ_DS_MIN_RTN_I64              0x00000065
-#define SQ_DS_MAX_RTN_I64              0x00000066
-#define SQ_DS_MIN_RTN_U64              0x00000067
-#define SQ_DS_MAX_RTN_U64              0x00000068
-#define SQ_DS_AND_RTN_B64              0x00000069
-#define SQ_DS_OR_RTN_B64               0x0000006a
-#define SQ_DS_XOR_RTN_B64              0x0000006b
-#define SQ_DS_MSKOR_RTN_B64            0x0000006c
-#define SQ_DS_WRXCHG_RTN_B64           0x0000006d
-#define SQ_DS_WRXCHG2_RTN_B64          0x0000006e
-#define SQ_DS_WRXCHG2ST64_RTN_B64      0x0000006f
-#define SQ_DS_CMPST_RTN_B64            0x00000070
-#define SQ_DS_CMPST_RTN_F64            0x00000071
-#define SQ_DS_MIN_RTN_F64              0x00000072
-#define SQ_DS_MAX_RTN_F64              0x00000073
-#define SQ_DS_READ_B64                 0x00000076
-#define SQ_DS_READ2_B64                0x00000077
-#define SQ_DS_READ2ST64_B64            0x00000078
-#define SQ_DS_CONDXCHG32_RTN_B64       0x0000007e
-#define SQ_DS_ADD_SRC2_U32             0x00000080
-#define SQ_DS_SUB_SRC2_U32             0x00000081
-#define SQ_DS_RSUB_SRC2_U32            0x00000082
-#define SQ_DS_INC_SRC2_U32             0x00000083
-#define SQ_DS_DEC_SRC2_U32             0x00000084
-#define SQ_DS_MIN_SRC2_I32             0x00000085
-#define SQ_DS_MAX_SRC2_I32             0x00000086
-#define SQ_DS_MIN_SRC2_U32             0x00000087
-#define SQ_DS_MAX_SRC2_U32             0x00000088
-#define SQ_DS_AND_SRC2_B32             0x00000089
-#define SQ_DS_OR_SRC2_B32              0x0000008a
-#define SQ_DS_XOR_SRC2_B32             0x0000008b
-#define SQ_DS_WRITE_SRC2_B32           0x0000008d
-#define SQ_DS_MIN_SRC2_F32             0x00000092
-#define SQ_DS_MAX_SRC2_F32             0x00000093
-#define SQ_DS_ADD_SRC2_F32             0x00000095
-#define SQ_DS_GWS_SEMA_RELEASE_ALL     0x00000098
-#define SQ_DS_GWS_INIT                 0x00000099
-#define SQ_DS_GWS_SEMA_V               0x0000009a
-#define SQ_DS_GWS_SEMA_BR              0x0000009b
-#define SQ_DS_GWS_SEMA_P               0x0000009c
-#define SQ_DS_GWS_BARRIER              0x0000009d
-#define SQ_DS_READ_ADDTID_B32          0x000000b6
-#define SQ_DS_CONSUME                  0x000000bd
-#define SQ_DS_APPEND                   0x000000be
-#define SQ_DS_ORDERED_COUNT            0x000000bf
-#define SQ_DS_ADD_SRC2_U64             0x000000c0
-#define SQ_DS_SUB_SRC2_U64             0x000000c1
-#define SQ_DS_RSUB_SRC2_U64            0x000000c2
-#define SQ_DS_INC_SRC2_U64             0x000000c3
-#define SQ_DS_DEC_SRC2_U64             0x000000c4
-#define SQ_DS_MIN_SRC2_I64             0x000000c5
-#define SQ_DS_MAX_SRC2_I64             0x000000c6
-#define SQ_DS_MIN_SRC2_U64             0x000000c7
-#define SQ_DS_MAX_SRC2_U64             0x000000c8
-#define SQ_DS_AND_SRC2_B64             0x000000c9
-#define SQ_DS_OR_SRC2_B64              0x000000ca
-#define SQ_DS_XOR_SRC2_B64             0x000000cb
-#define SQ_DS_WRITE_SRC2_B64           0x000000cd
-#define SQ_DS_MIN_SRC2_F64             0x000000d2
-#define SQ_DS_MAX_SRC2_F64             0x000000d3
-#define SQ_DS_WRITE_B96                0x000000de
-#define SQ_DS_WRITE_B128               0x000000df
-#define SQ_DS_CONDXCHG32_RTN_B128      0x000000fd
-#define SQ_DS_READ_B96                 0x000000fe
-#define SQ_DS_READ_B128                0x000000ff
-
-/*
- * VALUE_SQ_SDWA_SEL value
- */
-
-#define SQ_SDWA_BYTE_0                 0x00000000
-#define SQ_SDWA_BYTE_1                 0x00000001
-#define SQ_SDWA_BYTE_2                 0x00000002
-#define SQ_SDWA_BYTE_3                 0x00000003
-#define SQ_SDWA_WORD_0                 0x00000004
-#define SQ_SDWA_WORD_1                 0x00000005
-#define SQ_SDWA_DWORD                  0x00000006
-
-/*
- * VALUE_SQ_OP_VOP2 value
- */
-
-#define SQ_V_CNDMASK_B32               0x00000000
-#define SQ_V_ADD_F32                   0x00000001
-#define SQ_V_SUB_F32                   0x00000002
-#define SQ_V_SUBREV_F32                0x00000003
-#define SQ_V_MUL_LEGACY_F32            0x00000004
-#define SQ_V_MUL_F32                   0x00000005
-#define SQ_V_MUL_I32_I24               0x00000006
-#define SQ_V_MUL_HI_I32_I24            0x00000007
-#define SQ_V_MUL_U32_U24               0x00000008
-#define SQ_V_MUL_HI_U32_U24            0x00000009
-#define SQ_V_MIN_F32                   0x0000000a
-#define SQ_V_MAX_F32                   0x0000000b
-#define SQ_V_MIN_I32                   0x0000000c
-#define SQ_V_MAX_I32                   0x0000000d
-#define SQ_V_MIN_U32                   0x0000000e
-#define SQ_V_MAX_U32                   0x0000000f
-#define SQ_V_LSHRREV_B32               0x00000010
-#define SQ_V_ASHRREV_I32               0x00000011
-#define SQ_V_LSHLREV_B32               0x00000012
-#define SQ_V_AND_B32                   0x00000013
-#define SQ_V_OR_B32                    0x00000014
-#define SQ_V_XOR_B32                   0x00000015
-#define SQ_V_MAC_F32                   0x00000016
-#define SQ_V_MADMK_F32                 0x00000017
-#define SQ_V_MADAK_F32                 0x00000018
-#define SQ_V_ADD_CO_U32                0x00000019
-#define SQ_V_SUB_CO_U32                0x0000001a
-#define SQ_V_SUBREV_CO_U32             0x0000001b
-#define SQ_V_ADDC_CO_U32               0x0000001c
-#define SQ_V_SUBB_CO_U32               0x0000001d
-#define SQ_V_SUBBREV_CO_U32            0x0000001e
-#define SQ_V_ADD_F16                   0x0000001f
-#define SQ_V_SUB_F16                   0x00000020
-#define SQ_V_SUBREV_F16                0x00000021
-#define SQ_V_MUL_F16                   0x00000022
-#define SQ_V_MAC_F16                   0x00000023
-#define SQ_V_MADMK_F16                 0x00000024
-#define SQ_V_MADAK_F16                 0x00000025
-#define SQ_V_ADD_U16                   0x00000026
-#define SQ_V_SUB_U16                   0x00000027
-#define SQ_V_SUBREV_U16                0x00000028
-#define SQ_V_MUL_LO_U16                0x00000029
-#define SQ_V_LSHLREV_B16               0x0000002a
-#define SQ_V_LSHRREV_B16               0x0000002b
-#define SQ_V_ASHRREV_I16               0x0000002c
-#define SQ_V_MAX_F16                   0x0000002d
-#define SQ_V_MIN_F16                   0x0000002e
-#define SQ_V_MAX_U16                   0x0000002f
-#define SQ_V_MAX_I16                   0x00000030
-#define SQ_V_MIN_U16                   0x00000031
-#define SQ_V_MIN_I16                   0x00000032
-#define SQ_V_LDEXP_F16                 0x00000033
-#define SQ_V_ADD_U32                   0x00000034
-#define SQ_V_SUB_U32                   0x00000035
-#define SQ_V_SUBREV_U32                0x00000036
-
-/*
- * VALUE_SQ_SRC_VGPR value
- */
-
-#define SQ_SRC_VGPR0                   0x00000100
-
-/*
- * VALUE_SQ_OP_SOPP value
- */
-
-#define SQ_S_NOP                       0x00000000
-#define SQ_S_ENDPGM                    0x00000001
-#define SQ_S_BRANCH                    0x00000002
-#define SQ_S_WAKEUP                    0x00000003
-#define SQ_S_CBRANCH_SCC0              0x00000004
-#define SQ_S_CBRANCH_SCC1              0x00000005
-#define SQ_S_CBRANCH_VCCZ              0x00000006
-#define SQ_S_CBRANCH_VCCNZ             0x00000007
-#define SQ_S_CBRANCH_EXECZ             0x00000008
-#define SQ_S_CBRANCH_EXECNZ            0x00000009
-#define SQ_S_BARRIER                   0x0000000a
-#define SQ_S_SETKILL                   0x0000000b
-#define SQ_S_WAITCNT                   0x0000000c
-#define SQ_S_SETHALT                   0x0000000d
-#define SQ_S_SLEEP                     0x0000000e
-#define SQ_S_SETPRIO                   0x0000000f
-#define SQ_S_SENDMSG                   0x00000010
-#define SQ_S_SENDMSGHALT               0x00000011
-#define SQ_S_TRAP                      0x00000012
-#define SQ_S_ICACHE_INV                0x00000013
-#define SQ_S_INCPERFLEVEL              0x00000014
-#define SQ_S_DECPERFLEVEL              0x00000015
-#define SQ_S_TTRACEDATA                0x00000016
-#define SQ_S_CBRANCH_CDBGSYS           0x00000017
-#define SQ_S_CBRANCH_CDBGUSER          0x00000018
-#define SQ_S_CBRANCH_CDBGSYS_OR_USER   0x00000019
-#define SQ_S_CBRANCH_CDBGSYS_AND_USER  0x0000001a
-#define SQ_S_ENDPGM_SAVED              0x0000001b
-#define SQ_S_SET_GPR_IDX_OFF           0x0000001c
-#define SQ_S_SET_GPR_IDX_MODE          0x0000001d
-#define SQ_S_ENDPGM_ORDERED_PS_DONE    0x0000001e
-
-/*
- * VALUE_SQ_XNACK_MASK_LOHI value
- */
-
-#define SQ_XNACK_MASK_LO               0x00000068
-#define SQ_XNACK_MASK_HI               0x00000069
-
-/*
- * VALUE_SQ_SDWA_UNUSED value
- */
-
-#define SQ_SDWA_UNUSED_PAD             0x00000000
-#define SQ_SDWA_UNUSED_SEXT            0x00000001
-#define SQ_SDWA_UNUSED_PRESERVE        0x00000002
-
-/*
- * VALUE_SQ_OP_FLAT value
- */
-
-#define SQ_FLAT_LOAD_UBYTE             0x00000010
-#define SQ_FLAT_LOAD_SBYTE             0x00000011
-#define SQ_FLAT_LOAD_USHORT            0x00000012
-#define SQ_FLAT_LOAD_SSHORT            0x00000013
-#define SQ_FLAT_LOAD_DWORD             0x00000014
-#define SQ_FLAT_LOAD_DWORDX2           0x00000015
-#define SQ_FLAT_LOAD_DWORDX3           0x00000016
-#define SQ_FLAT_LOAD_DWORDX4           0x00000017
-#define SQ_FLAT_STORE_BYTE             0x00000018
-#define SQ_FLAT_STORE_SHORT            0x0000001a
-#define SQ_FLAT_STORE_DWORD            0x0000001c
-#define SQ_FLAT_STORE_DWORDX2          0x0000001d
-#define SQ_FLAT_STORE_DWORDX3          0x0000001e
-#define SQ_FLAT_STORE_DWORDX4          0x0000001f
-#define SQ_FLAT_ATOMIC_SWAP            0x00000040
-#define SQ_FLAT_ATOMIC_CMPSWAP         0x00000041
-#define SQ_FLAT_ATOMIC_ADD             0x00000042
-#define SQ_FLAT_ATOMIC_SUB             0x00000043
-#define SQ_FLAT_ATOMIC_SMIN            0x00000044
-#define SQ_FLAT_ATOMIC_UMIN            0x00000045
-#define SQ_FLAT_ATOMIC_SMAX            0x00000046
-#define SQ_FLAT_ATOMIC_UMAX            0x00000047
-#define SQ_FLAT_ATOMIC_AND             0x00000048
-#define SQ_FLAT_ATOMIC_OR              0x00000049
-#define SQ_FLAT_ATOMIC_XOR             0x0000004a
-#define SQ_FLAT_ATOMIC_INC             0x0000004b
-#define SQ_FLAT_ATOMIC_DEC             0x0000004c
-#define SQ_FLAT_ATOMIC_SWAP_X2         0x00000060
-#define SQ_FLAT_ATOMIC_CMPSWAP_X2      0x00000061
-#define SQ_FLAT_ATOMIC_ADD_X2          0x00000062
-#define SQ_FLAT_ATOMIC_SUB_X2          0x00000063
-#define SQ_FLAT_ATOMIC_SMIN_X2         0x00000064
-#define SQ_FLAT_ATOMIC_UMIN_X2         0x00000065
-#define SQ_FLAT_ATOMIC_SMAX_X2         0x00000066
-#define SQ_FLAT_ATOMIC_UMAX_X2         0x00000067
-#define SQ_FLAT_ATOMIC_AND_X2          0x00000068
-#define SQ_FLAT_ATOMIC_OR_X2           0x00000069
-#define SQ_FLAT_ATOMIC_XOR_X2          0x0000006a
-#define SQ_FLAT_ATOMIC_INC_X2          0x0000006b
-#define SQ_FLAT_ATOMIC_DEC_X2          0x0000006c
-
-/*
- * VALUE_SQ_OP_SOPC value
- */
-
-#define SQ_S_CMP_EQ_I32                0x00000000
-#define SQ_S_CMP_LG_I32                0x00000001
-#define SQ_S_CMP_GT_I32                0x00000002
-#define SQ_S_CMP_GE_I32                0x00000003
-#define SQ_S_CMP_LT_I32                0x00000004
-#define SQ_S_CMP_LE_I32                0x00000005
-#define SQ_S_CMP_EQ_U32                0x00000006
-#define SQ_S_CMP_LG_U32                0x00000007
-#define SQ_S_CMP_GT_U32                0x00000008
-#define SQ_S_CMP_GE_U32                0x00000009
-#define SQ_S_CMP_LT_U32                0x0000000a
-#define SQ_S_CMP_LE_U32                0x0000000b
-#define SQ_S_BITCMP0_B32               0x0000000c
-#define SQ_S_BITCMP1_B32               0x0000000d
-#define SQ_S_BITCMP0_B64               0x0000000e
-#define SQ_S_BITCMP1_B64               0x0000000f
-#define SQ_S_SETVSKIP                  0x00000010
-#define SQ_S_SET_GPR_IDX_ON            0x00000011
-#define SQ_S_CMP_EQ_U64                0x00000012
-#define SQ_S_CMP_LG_U64                0x00000013
-
-/*
- * VALUE_SQ_PARAM value
- */
-
-#define SQ_PARAM_P10                   0x00000000
-#define SQ_PARAM_P20                   0x00000001
-#define SQ_PARAM_P0                    0x00000002
-
-/*
- * VALUE_SQ_OP_FLAT_SCRATCH value
- */
-
-#define SQ_SCRATCH_LOAD_UBYTE          0x00000010
-#define SQ_SCRATCH_LOAD_SBYTE          0x00000011
-#define SQ_SCRATCH_LOAD_USHORT         0x00000012
-#define SQ_SCRATCH_LOAD_SSHORT         0x00000013
-#define SQ_SCRATCH_LOAD_DWORD          0x00000014
-#define SQ_SCRATCH_LOAD_DWORDX2        0x00000015
-#define SQ_SCRATCH_LOAD_DWORDX3        0x00000016
-#define SQ_SCRATCH_LOAD_DWORDX4        0x00000017
-#define SQ_SCRATCH_STORE_BYTE          0x00000018
-#define SQ_SCRATCH_STORE_SHORT         0x0000001a
-#define SQ_SCRATCH_STORE_DWORD         0x0000001c
-#define SQ_SCRATCH_STORE_DWORDX2       0x0000001d
-#define SQ_SCRATCH_STORE_DWORDX3       0x0000001e
-#define SQ_SCRATCH_STORE_DWORDX4       0x0000001f
-
-/*
- * VALUE_SQ_SEG value
- */
-
-#define SQ_FLAT                        0x00000000
-#define SQ_SCRATCH                     0x00000001
-#define SQ_GLOBAL                      0x00000002
-
-/*
- * VALUE_SQ_SSRC_0_63_INLINES value
- */
-
-#define SQ_SRC_0                       0x00000080
-#define SQ_SRC_1_INT                   0x00000081
-#define SQ_SRC_2_INT                   0x00000082
-#define SQ_SRC_3_INT                   0x00000083
-#define SQ_SRC_4_INT                   0x00000084
-#define SQ_SRC_5_INT                   0x00000085
-#define SQ_SRC_6_INT                   0x00000086
-#define SQ_SRC_7_INT                   0x00000087
-#define SQ_SRC_8_INT                   0x00000088
-#define SQ_SRC_9_INT                   0x00000089
-#define SQ_SRC_10_INT                  0x0000008a
-#define SQ_SRC_11_INT                  0x0000008b
-#define SQ_SRC_12_INT                  0x0000008c
-#define SQ_SRC_13_INT                  0x0000008d
-#define SQ_SRC_14_INT                  0x0000008e
-#define SQ_SRC_15_INT                  0x0000008f
-#define SQ_SRC_16_INT                  0x00000090
-#define SQ_SRC_17_INT                  0x00000091
-#define SQ_SRC_18_INT                  0x00000092
-#define SQ_SRC_19_INT                  0x00000093
-#define SQ_SRC_20_INT                  0x00000094
-#define SQ_SRC_21_INT                  0x00000095
-#define SQ_SRC_22_INT                  0x00000096
-#define SQ_SRC_23_INT                  0x00000097
-#define SQ_SRC_24_INT                  0x00000098
-#define SQ_SRC_25_INT                  0x00000099
-#define SQ_SRC_26_INT                  0x0000009a
-#define SQ_SRC_27_INT                  0x0000009b
-#define SQ_SRC_28_INT                  0x0000009c
-#define SQ_SRC_29_INT                  0x0000009d
-#define SQ_SRC_30_INT                  0x0000009e
-#define SQ_SRC_31_INT                  0x0000009f
-#define SQ_SRC_32_INT                  0x000000a0
-#define SQ_SRC_33_INT                  0x000000a1
-#define SQ_SRC_34_INT                  0x000000a2
-#define SQ_SRC_35_INT                  0x000000a3
-#define SQ_SRC_36_INT                  0x000000a4
-#define SQ_SRC_37_INT                  0x000000a5
-#define SQ_SRC_38_INT                  0x000000a6
-#define SQ_SRC_39_INT                  0x000000a7
-#define SQ_SRC_40_INT                  0x000000a8
-#define SQ_SRC_41_INT                  0x000000a9
-#define SQ_SRC_42_INT                  0x000000aa
-#define SQ_SRC_43_INT                  0x000000ab
-#define SQ_SRC_44_INT                  0x000000ac
-#define SQ_SRC_45_INT                  0x000000ad
-#define SQ_SRC_46_INT                  0x000000ae
-#define SQ_SRC_47_INT                  0x000000af
-#define SQ_SRC_48_INT                  0x000000b0
-#define SQ_SRC_49_INT                  0x000000b1
-#define SQ_SRC_50_INT                  0x000000b2
-#define SQ_SRC_51_INT                  0x000000b3
-#define SQ_SRC_52_INT                  0x000000b4
-#define SQ_SRC_53_INT                  0x000000b5
-#define SQ_SRC_54_INT                  0x000000b6
-#define SQ_SRC_55_INT                  0x000000b7
-#define SQ_SRC_56_INT                  0x000000b8
-#define SQ_SRC_57_INT                  0x000000b9
-#define SQ_SRC_58_INT                  0x000000ba
-#define SQ_SRC_59_INT                  0x000000bb
-#define SQ_SRC_60_INT                  0x000000bc
-#define SQ_SRC_61_INT                  0x000000bd
-#define SQ_SRC_62_INT                  0x000000be
-#define SQ_SRC_63_INT                  0x000000bf
-
-/*
- * VALUE_SQ_CNT value
- */
-
-#define SQ_CNT1                        0x00000000
-#define SQ_CNT2                        0x00000001
-#define SQ_CNT3                        0x00000002
-#define SQ_CNT4                        0x00000003
-
-/*******************************************************
- * DIDT Enums
- *******************************************************/
-
-/*******************************************************
- * SX Enums
- *******************************************************/
-
-/*
- * SX_BLEND_OPT enum
- */
-
-typedef enum SX_BLEND_OPT {
-BLEND_OPT_PRESERVE_NONE_IGNORE_ALL       = 0x00000000,
-BLEND_OPT_PRESERVE_ALL_IGNORE_NONE       = 0x00000001,
-BLEND_OPT_PRESERVE_C1_IGNORE_C0          = 0x00000002,
-BLEND_OPT_PRESERVE_C0_IGNORE_C1          = 0x00000003,
-BLEND_OPT_PRESERVE_A1_IGNORE_A0          = 0x00000004,
-BLEND_OPT_PRESERVE_A0_IGNORE_A1          = 0x00000005,
-BLEND_OPT_PRESERVE_NONE_IGNORE_A0        = 0x00000006,
-BLEND_OPT_PRESERVE_NONE_IGNORE_NONE      = 0x00000007,
-} SX_BLEND_OPT;
-
-/*
- * SX_OPT_COMB_FCN enum
- */
-
-typedef enum SX_OPT_COMB_FCN {
-OPT_COMB_NONE                            = 0x00000000,
-OPT_COMB_ADD                             = 0x00000001,
-OPT_COMB_SUBTRACT                        = 0x00000002,
-OPT_COMB_MIN                             = 0x00000003,
-OPT_COMB_MAX                             = 0x00000004,
-OPT_COMB_REVSUBTRACT                     = 0x00000005,
-OPT_COMB_BLEND_DISABLED                  = 0x00000006,
-OPT_COMB_SAFE_ADD                        = 0x00000007,
-} SX_OPT_COMB_FCN;
-
-/*
- * SX_DOWNCONVERT_FORMAT enum
- */
-
-typedef enum SX_DOWNCONVERT_FORMAT {
-SX_RT_EXPORT_NO_CONVERSION               = 0x00000000,
-SX_RT_EXPORT_32_R                        = 0x00000001,
-SX_RT_EXPORT_32_A                        = 0x00000002,
-SX_RT_EXPORT_10_11_11                    = 0x00000003,
-SX_RT_EXPORT_2_10_10_10                  = 0x00000004,
-SX_RT_EXPORT_8_8_8_8                     = 0x00000005,
-SX_RT_EXPORT_5_6_5                       = 0x00000006,
-SX_RT_EXPORT_1_5_5_5                     = 0x00000007,
-SX_RT_EXPORT_4_4_4_4                     = 0x00000008,
-SX_RT_EXPORT_16_16_GR                    = 0x00000009,
-SX_RT_EXPORT_16_16_AR                    = 0x0000000a,
-} SX_DOWNCONVERT_FORMAT;
-
-/*
- * SX_PERFCOUNTER_VALS enum
- */
-
-typedef enum SX_PERFCOUNTER_VALS {
-SX_PERF_SEL_PA_IDLE_CYCLES               = 0x00000000,
-SX_PERF_SEL_PA_REQ                       = 0x00000001,
-SX_PERF_SEL_PA_POS                       = 0x00000002,
-SX_PERF_SEL_CLOCK                        = 0x00000003,
-SX_PERF_SEL_GATE_EN1                     = 0x00000004,
-SX_PERF_SEL_GATE_EN2                     = 0x00000005,
-SX_PERF_SEL_GATE_EN3                     = 0x00000006,
-SX_PERF_SEL_GATE_EN4                     = 0x00000007,
-SX_PERF_SEL_SH_POS_STARVE                = 0x00000008,
-SX_PERF_SEL_SH_COLOR_STARVE              = 0x00000009,
-SX_PERF_SEL_SH_POS_STALL                 = 0x0000000a,
-SX_PERF_SEL_SH_COLOR_STALL               = 0x0000000b,
-SX_PERF_SEL_DB0_PIXELS                   = 0x0000000c,
-SX_PERF_SEL_DB0_HALF_QUADS               = 0x0000000d,
-SX_PERF_SEL_DB0_PIXEL_STALL              = 0x0000000e,
-SX_PERF_SEL_DB0_PIXEL_IDLE               = 0x0000000f,
-SX_PERF_SEL_DB0_PRED_PIXELS              = 0x00000010,
-SX_PERF_SEL_DB1_PIXELS                   = 0x00000011,
-SX_PERF_SEL_DB1_HALF_QUADS               = 0x00000012,
-SX_PERF_SEL_DB1_PIXEL_STALL              = 0x00000013,
-SX_PERF_SEL_DB1_PIXEL_IDLE               = 0x00000014,
-SX_PERF_SEL_DB1_PRED_PIXELS              = 0x00000015,
-SX_PERF_SEL_DB2_PIXELS                   = 0x00000016,
-SX_PERF_SEL_DB2_HALF_QUADS               = 0x00000017,
-SX_PERF_SEL_DB2_PIXEL_STALL              = 0x00000018,
-SX_PERF_SEL_DB2_PIXEL_IDLE               = 0x00000019,
-SX_PERF_SEL_DB2_PRED_PIXELS              = 0x0000001a,
-SX_PERF_SEL_DB3_PIXELS                   = 0x0000001b,
-SX_PERF_SEL_DB3_HALF_QUADS               = 0x0000001c,
-SX_PERF_SEL_DB3_PIXEL_STALL              = 0x0000001d,
-SX_PERF_SEL_DB3_PIXEL_IDLE               = 0x0000001e,
-SX_PERF_SEL_DB3_PRED_PIXELS              = 0x0000001f,
-SX_PERF_SEL_COL_BUSY                     = 0x00000020,
-SX_PERF_SEL_POS_BUSY                     = 0x00000021,
-SX_PERF_SEL_DB0_A2M_DISCARD_QUADS        = 0x00000022,
-SX_PERF_SEL_DB0_MRT0_BLEND_BYPASS        = 0x00000023,
-SX_PERF_SEL_DB0_MRT0_DONT_RD_DEST        = 0x00000024,
-SX_PERF_SEL_DB0_MRT0_DISCARD_SRC         = 0x00000025,
-SX_PERF_SEL_DB0_MRT0_SINGLE_QUADS        = 0x00000026,
-SX_PERF_SEL_DB0_MRT0_DOUBLE_QUADS        = 0x00000027,
-SX_PERF_SEL_DB0_MRT1_BLEND_BYPASS        = 0x00000028,
-SX_PERF_SEL_DB0_MRT1_DONT_RD_DEST        = 0x00000029,
-SX_PERF_SEL_DB0_MRT1_DISCARD_SRC         = 0x0000002a,
-SX_PERF_SEL_DB0_MRT1_SINGLE_QUADS        = 0x0000002b,
-SX_PERF_SEL_DB0_MRT1_DOUBLE_QUADS        = 0x0000002c,
-SX_PERF_SEL_DB0_MRT2_BLEND_BYPASS        = 0x0000002d,
-SX_PERF_SEL_DB0_MRT2_DONT_RD_DEST        = 0x0000002e,
-SX_PERF_SEL_DB0_MRT2_DISCARD_SRC         = 0x0000002f,
-SX_PERF_SEL_DB0_MRT2_SINGLE_QUADS        = 0x00000030,
-SX_PERF_SEL_DB0_MRT2_DOUBLE_QUADS        = 0x00000031,
-SX_PERF_SEL_DB0_MRT3_BLEND_BYPASS        = 0x00000032,
-SX_PERF_SEL_DB0_MRT3_DONT_RD_DEST        = 0x00000033,
-SX_PERF_SEL_DB0_MRT3_DISCARD_SRC         = 0x00000034,
-SX_PERF_SEL_DB0_MRT3_SINGLE_QUADS        = 0x00000035,
-SX_PERF_SEL_DB0_MRT3_DOUBLE_QUADS        = 0x00000036,
-SX_PERF_SEL_DB0_MRT4_BLEND_BYPASS        = 0x00000037,
-SX_PERF_SEL_DB0_MRT4_DONT_RD_DEST        = 0x00000038,
-SX_PERF_SEL_DB0_MRT4_DISCARD_SRC         = 0x00000039,
-SX_PERF_SEL_DB0_MRT4_SINGLE_QUADS        = 0x0000003a,
-SX_PERF_SEL_DB0_MRT4_DOUBLE_QUADS        = 0x0000003b,
-SX_PERF_SEL_DB0_MRT5_BLEND_BYPASS        = 0x0000003c,
-SX_PERF_SEL_DB0_MRT5_DONT_RD_DEST        = 0x0000003d,
-SX_PERF_SEL_DB0_MRT5_DISCARD_SRC         = 0x0000003e,
-SX_PERF_SEL_DB0_MRT5_SINGLE_QUADS        = 0x0000003f,
-SX_PERF_SEL_DB0_MRT5_DOUBLE_QUADS        = 0x00000040,
-SX_PERF_SEL_DB0_MRT6_BLEND_BYPASS        = 0x00000041,
-SX_PERF_SEL_DB0_MRT6_DONT_RD_DEST        = 0x00000042,
-SX_PERF_SEL_DB0_MRT6_DISCARD_SRC         = 0x00000043,
-SX_PERF_SEL_DB0_MRT6_SINGLE_QUADS        = 0x00000044,
-SX_PERF_SEL_DB0_MRT6_DOUBLE_QUADS        = 0x00000045,
-SX_PERF_SEL_DB0_MRT7_BLEND_BYPASS        = 0x00000046,
-SX_PERF_SEL_DB0_MRT7_DONT_RD_DEST        = 0x00000047,
-SX_PERF_SEL_DB0_MRT7_DISCARD_SRC         = 0x00000048,
-SX_PERF_SEL_DB0_MRT7_SINGLE_QUADS        = 0x00000049,
-SX_PERF_SEL_DB0_MRT7_DOUBLE_QUADS        = 0x0000004a,
-SX_PERF_SEL_DB1_A2M_DISCARD_QUADS        = 0x0000004b,
-SX_PERF_SEL_DB1_MRT0_BLEND_BYPASS        = 0x0000004c,
-SX_PERF_SEL_DB1_MRT0_DONT_RD_DEST        = 0x0000004d,
-SX_PERF_SEL_DB1_MRT0_DISCARD_SRC         = 0x0000004e,
-SX_PERF_SEL_DB1_MRT0_SINGLE_QUADS        = 0x0000004f,
-SX_PERF_SEL_DB1_MRT0_DOUBLE_QUADS        = 0x00000050,
-SX_PERF_SEL_DB1_MRT1_BLEND_BYPASS        = 0x00000051,
-SX_PERF_SEL_DB1_MRT1_DONT_RD_DEST        = 0x00000052,
-SX_PERF_SEL_DB1_MRT1_DISCARD_SRC         = 0x00000053,
-SX_PERF_SEL_DB1_MRT1_SINGLE_QUADS        = 0x00000054,
-SX_PERF_SEL_DB1_MRT1_DOUBLE_QUADS        = 0x00000055,
-SX_PERF_SEL_DB1_MRT2_BLEND_BYPASS        = 0x00000056,
-SX_PERF_SEL_DB1_MRT2_DONT_RD_DEST        = 0x00000057,
-SX_PERF_SEL_DB1_MRT2_DISCARD_SRC         = 0x00000058,
-SX_PERF_SEL_DB1_MRT2_SINGLE_QUADS        = 0x00000059,
-SX_PERF_SEL_DB1_MRT2_DOUBLE_QUADS        = 0x0000005a,
-SX_PERF_SEL_DB1_MRT3_BLEND_BYPASS        = 0x0000005b,
-SX_PERF_SEL_DB1_MRT3_DONT_RD_DEST        = 0x0000005c,
-SX_PERF_SEL_DB1_MRT3_DISCARD_SRC         = 0x0000005d,
-SX_PERF_SEL_DB1_MRT3_SINGLE_QUADS        = 0x0000005e,
-SX_PERF_SEL_DB1_MRT3_DOUBLE_QUADS        = 0x0000005f,
-SX_PERF_SEL_DB1_MRT4_BLEND_BYPASS        = 0x00000060,
-SX_PERF_SEL_DB1_MRT4_DONT_RD_DEST        = 0x00000061,
-SX_PERF_SEL_DB1_MRT4_DISCARD_SRC         = 0x00000062,
-SX_PERF_SEL_DB1_MRT4_SINGLE_QUADS        = 0x00000063,
-SX_PERF_SEL_DB1_MRT4_DOUBLE_QUADS        = 0x00000064,
-SX_PERF_SEL_DB1_MRT5_BLEND_BYPASS        = 0x00000065,
-SX_PERF_SEL_DB1_MRT5_DONT_RD_DEST        = 0x00000066,
-SX_PERF_SEL_DB1_MRT5_DISCARD_SRC         = 0x00000067,
-SX_PERF_SEL_DB1_MRT5_SINGLE_QUADS        = 0x00000068,
-SX_PERF_SEL_DB1_MRT5_DOUBLE_QUADS        = 0x00000069,
-SX_PERF_SEL_DB1_MRT6_BLEND_BYPASS        = 0x0000006a,
-SX_PERF_SEL_DB1_MRT6_DONT_RD_DEST        = 0x0000006b,
-SX_PERF_SEL_DB1_MRT6_DISCARD_SRC         = 0x0000006c,
-SX_PERF_SEL_DB1_MRT6_SINGLE_QUADS        = 0x0000006d,
-SX_PERF_SEL_DB1_MRT6_DOUBLE_QUADS        = 0x0000006e,
-SX_PERF_SEL_DB1_MRT7_BLEND_BYPASS        = 0x0000006f,
-SX_PERF_SEL_DB1_MRT7_DONT_RD_DEST        = 0x00000070,
-SX_PERF_SEL_DB1_MRT7_DISCARD_SRC         = 0x00000071,
-SX_PERF_SEL_DB1_MRT7_SINGLE_QUADS        = 0x00000072,
-SX_PERF_SEL_DB1_MRT7_DOUBLE_QUADS        = 0x00000073,
-SX_PERF_SEL_DB2_A2M_DISCARD_QUADS        = 0x00000074,
-SX_PERF_SEL_DB2_MRT0_BLEND_BYPASS        = 0x00000075,
-SX_PERF_SEL_DB2_MRT0_DONT_RD_DEST        = 0x00000076,
-SX_PERF_SEL_DB2_MRT0_DISCARD_SRC         = 0x00000077,
-SX_PERF_SEL_DB2_MRT0_SINGLE_QUADS        = 0x00000078,
-SX_PERF_SEL_DB2_MRT0_DOUBLE_QUADS        = 0x00000079,
-SX_PERF_SEL_DB2_MRT1_BLEND_BYPASS        = 0x0000007a,
-SX_PERF_SEL_DB2_MRT1_DONT_RD_DEST        = 0x0000007b,
-SX_PERF_SEL_DB2_MRT1_DISCARD_SRC         = 0x0000007c,
-SX_PERF_SEL_DB2_MRT1_SINGLE_QUADS        = 0x0000007d,
-SX_PERF_SEL_DB2_MRT1_DOUBLE_QUADS        = 0x0000007e,
-SX_PERF_SEL_DB2_MRT2_BLEND_BYPASS        = 0x0000007f,
-SX_PERF_SEL_DB2_MRT2_DONT_RD_DEST        = 0x00000080,
-SX_PERF_SEL_DB2_MRT2_DISCARD_SRC         = 0x00000081,
-SX_PERF_SEL_DB2_MRT2_SINGLE_QUADS        = 0x00000082,
-SX_PERF_SEL_DB2_MRT2_DOUBLE_QUADS        = 0x00000083,
-SX_PERF_SEL_DB2_MRT3_BLEND_BYPASS        = 0x00000084,
-SX_PERF_SEL_DB2_MRT3_DONT_RD_DEST        = 0x00000085,
-SX_PERF_SEL_DB2_MRT3_DISCARD_SRC         = 0x00000086,
-SX_PERF_SEL_DB2_MRT3_SINGLE_QUADS        = 0x00000087,
-SX_PERF_SEL_DB2_MRT3_DOUBLE_QUADS        = 0x00000088,
-SX_PERF_SEL_DB2_MRT4_BLEND_BYPASS        = 0x00000089,
-SX_PERF_SEL_DB2_MRT4_DONT_RD_DEST        = 0x0000008a,
-SX_PERF_SEL_DB2_MRT4_DISCARD_SRC         = 0x0000008b,
-SX_PERF_SEL_DB2_MRT4_SINGLE_QUADS        = 0x0000008c,
-SX_PERF_SEL_DB2_MRT4_DOUBLE_QUADS        = 0x0000008d,
-SX_PERF_SEL_DB2_MRT5_BLEND_BYPASS        = 0x0000008e,
-SX_PERF_SEL_DB2_MRT5_DONT_RD_DEST        = 0x0000008f,
-SX_PERF_SEL_DB2_MRT5_DISCARD_SRC         = 0x00000090,
-SX_PERF_SEL_DB2_MRT5_SINGLE_QUADS        = 0x00000091,
-SX_PERF_SEL_DB2_MRT5_DOUBLE_QUADS        = 0x00000092,
-SX_PERF_SEL_DB2_MRT6_BLEND_BYPASS        = 0x00000093,
-SX_PERF_SEL_DB2_MRT6_DONT_RD_DEST        = 0x00000094,
-SX_PERF_SEL_DB2_MRT6_DISCARD_SRC         = 0x00000095,
-SX_PERF_SEL_DB2_MRT6_SINGLE_QUADS        = 0x00000096,
-SX_PERF_SEL_DB2_MRT6_DOUBLE_QUADS        = 0x00000097,
-SX_PERF_SEL_DB2_MRT7_BLEND_BYPASS        = 0x00000098,
-SX_PERF_SEL_DB2_MRT7_DONT_RD_DEST        = 0x00000099,
-SX_PERF_SEL_DB2_MRT7_DISCARD_SRC         = 0x0000009a,
-SX_PERF_SEL_DB2_MRT7_SINGLE_QUADS        = 0x0000009b,
-SX_PERF_SEL_DB2_MRT7_DOUBLE_QUADS        = 0x0000009c,
-SX_PERF_SEL_DB3_A2M_DISCARD_QUADS        = 0x0000009d,
-SX_PERF_SEL_DB3_MRT0_BLEND_BYPASS        = 0x0000009e,
-SX_PERF_SEL_DB3_MRT0_DONT_RD_DEST        = 0x0000009f,
-SX_PERF_SEL_DB3_MRT0_DISCARD_SRC         = 0x000000a0,
-SX_PERF_SEL_DB3_MRT0_SINGLE_QUADS        = 0x000000a1,
-SX_PERF_SEL_DB3_MRT0_DOUBLE_QUADS        = 0x000000a2,
-SX_PERF_SEL_DB3_MRT1_BLEND_BYPASS        = 0x000000a3,
-SX_PERF_SEL_DB3_MRT1_DONT_RD_DEST        = 0x000000a4,
-SX_PERF_SEL_DB3_MRT1_DISCARD_SRC         = 0x000000a5,
-SX_PERF_SEL_DB3_MRT1_SINGLE_QUADS        = 0x000000a6,
-SX_PERF_SEL_DB3_MRT1_DOUBLE_QUADS        = 0x000000a7,
-SX_PERF_SEL_DB3_MRT2_BLEND_BYPASS        = 0x000000a8,
-SX_PERF_SEL_DB3_MRT2_DONT_RD_DEST        = 0x000000a9,
-SX_PERF_SEL_DB3_MRT2_DISCARD_SRC         = 0x000000aa,
-SX_PERF_SEL_DB3_MRT2_SINGLE_QUADS        = 0x000000ab,
-SX_PERF_SEL_DB3_MRT2_DOUBLE_QUADS        = 0x000000ac,
-SX_PERF_SEL_DB3_MRT3_BLEND_BYPASS        = 0x000000ad,
-SX_PERF_SEL_DB3_MRT3_DONT_RD_DEST        = 0x000000ae,
-SX_PERF_SEL_DB3_MRT3_DISCARD_SRC         = 0x000000af,
-SX_PERF_SEL_DB3_MRT3_SINGLE_QUADS        = 0x000000b0,
-SX_PERF_SEL_DB3_MRT3_DOUBLE_QUADS        = 0x000000b1,
-SX_PERF_SEL_DB3_MRT4_BLEND_BYPASS        = 0x000000b2,
-SX_PERF_SEL_DB3_MRT4_DONT_RD_DEST        = 0x000000b3,
-SX_PERF_SEL_DB3_MRT4_DISCARD_SRC         = 0x000000b4,
-SX_PERF_SEL_DB3_MRT4_SINGLE_QUADS        = 0x000000b5,
-SX_PERF_SEL_DB3_MRT4_DOUBLE_QUADS        = 0x000000b6,
-SX_PERF_SEL_DB3_MRT5_BLEND_BYPASS        = 0x000000b7,
-SX_PERF_SEL_DB3_MRT5_DONT_RD_DEST        = 0x000000b8,
-SX_PERF_SEL_DB3_MRT5_DISCARD_SRC         = 0x000000b9,
-SX_PERF_SEL_DB3_MRT5_SINGLE_QUADS        = 0x000000ba,
-SX_PERF_SEL_DB3_MRT5_DOUBLE_QUADS        = 0x000000bb,
-SX_PERF_SEL_DB3_MRT6_BLEND_BYPASS        = 0x000000bc,
-SX_PERF_SEL_DB3_MRT6_DONT_RD_DEST        = 0x000000bd,
-SX_PERF_SEL_DB3_MRT6_DISCARD_SRC         = 0x000000be,
-SX_PERF_SEL_DB3_MRT6_SINGLE_QUADS        = 0x000000bf,
-SX_PERF_SEL_DB3_MRT6_DOUBLE_QUADS        = 0x000000c0,
-SX_PERF_SEL_DB3_MRT7_BLEND_BYPASS        = 0x000000c1,
-SX_PERF_SEL_DB3_MRT7_DONT_RD_DEST        = 0x000000c2,
-SX_PERF_SEL_DB3_MRT7_DISCARD_SRC         = 0x000000c3,
-SX_PERF_SEL_DB3_MRT7_SINGLE_QUADS        = 0x000000c4,
-SX_PERF_SEL_DB3_MRT7_DOUBLE_QUADS        = 0x000000c5,
-} SX_PERFCOUNTER_VALS;
-
-/*******************************************************
- * DB Enums
- *******************************************************/
-
-/*
- * ForceControl enum
- */
-
-typedef enum ForceControl {
-FORCE_OFF                                = 0x00000000,
-FORCE_ENABLE                             = 0x00000001,
-FORCE_DISABLE                            = 0x00000002,
-FORCE_RESERVED                           = 0x00000003,
-} ForceControl;
-
-/*
- * ZSamplePosition enum
- */
-
-typedef enum ZSamplePosition {
-Z_SAMPLE_CENTER                          = 0x00000000,
-Z_SAMPLE_CENTROID                        = 0x00000001,
-} ZSamplePosition;
-
-/*
- * ZOrder enum
- */
-
-typedef enum ZOrder {
-LATE_Z                                   = 0x00000000,
-EARLY_Z_THEN_LATE_Z                      = 0x00000001,
-RE_Z                                     = 0x00000002,
-EARLY_Z_THEN_RE_Z                        = 0x00000003,
-} ZOrder;
-
-/*
- * ZpassControl enum
- */
-
-typedef enum ZpassControl {
-ZPASS_DISABLE                            = 0x00000000,
-ZPASS_SAMPLES                            = 0x00000001,
-ZPASS_PIXELS                             = 0x00000002,
-} ZpassControl;
-
-/*
- * ZModeForce enum
- */
-
-typedef enum ZModeForce {
-NO_FORCE                                 = 0x00000000,
-FORCE_EARLY_Z                            = 0x00000001,
-FORCE_LATE_Z                             = 0x00000002,
-FORCE_RE_Z                               = 0x00000003,
-} ZModeForce;
-
-/*
- * ZLimitSumm enum
- */
-
-typedef enum ZLimitSumm {
-FORCE_SUMM_OFF                           = 0x00000000,
-FORCE_SUMM_MINZ                          = 0x00000001,
-FORCE_SUMM_MAXZ                          = 0x00000002,
-FORCE_SUMM_BOTH                          = 0x00000003,
-} ZLimitSumm;
-
-/*
- * CompareFrag enum
- */
-
-typedef enum CompareFrag {
-FRAG_NEVER                               = 0x00000000,
-FRAG_LESS                                = 0x00000001,
-FRAG_EQUAL                               = 0x00000002,
-FRAG_LEQUAL                              = 0x00000003,
-FRAG_GREATER                             = 0x00000004,
-FRAG_NOTEQUAL                            = 0x00000005,
-FRAG_GEQUAL                              = 0x00000006,
-FRAG_ALWAYS                              = 0x00000007,
-} CompareFrag;
-
-/*
- * StencilOp enum
- */
-
-typedef enum StencilOp {
-STENCIL_KEEP                             = 0x00000000,
-STENCIL_ZERO                             = 0x00000001,
-STENCIL_ONES                             = 0x00000002,
-STENCIL_REPLACE_TEST                     = 0x00000003,
-STENCIL_REPLACE_OP                       = 0x00000004,
-STENCIL_ADD_CLAMP                        = 0x00000005,
-STENCIL_SUB_CLAMP                        = 0x00000006,
-STENCIL_INVERT                           = 0x00000007,
-STENCIL_ADD_WRAP                         = 0x00000008,
-STENCIL_SUB_WRAP                         = 0x00000009,
-STENCIL_AND                              = 0x0000000a,
-STENCIL_OR                               = 0x0000000b,
-STENCIL_XOR                              = 0x0000000c,
-STENCIL_NAND                             = 0x0000000d,
-STENCIL_NOR                              = 0x0000000e,
-STENCIL_XNOR                             = 0x0000000f,
-} StencilOp;
-
-/*
- * ConservativeZExport enum
- */
-
-typedef enum ConservativeZExport {
-EXPORT_ANY_Z                             = 0x00000000,
-EXPORT_LESS_THAN_Z                       = 0x00000001,
-EXPORT_GREATER_THAN_Z                    = 0x00000002,
-EXPORT_RESERVED                          = 0x00000003,
-} ConservativeZExport;
-
-/*
- * DbPSLControl enum
- */
-
-typedef enum DbPSLControl {
-PSLC_AUTO                                = 0x00000000,
-PSLC_ON_HANG_ONLY                        = 0x00000001,
-PSLC_ASAP                                = 0x00000002,
-PSLC_COUNTDOWN                           = 0x00000003,
-} DbPSLControl;
-
-/*
- * DbPRTFaultBehavior enum
- */
-
-typedef enum DbPRTFaultBehavior {
-FAULT_ZERO                               = 0x00000000,
-FAULT_ONE                                = 0x00000001,
-FAULT_FAIL                               = 0x00000002,
-FAULT_PASS                               = 0x00000003,
-} DbPRTFaultBehavior;
-
-/*
- * PerfCounter_Vals enum
- */
-
-typedef enum PerfCounter_Vals {
-DB_PERF_SEL_SC_DB_tile_sends             = 0x00000000,
-DB_PERF_SEL_SC_DB_tile_busy              = 0x00000001,
-DB_PERF_SEL_SC_DB_tile_stalls            = 0x00000002,
-DB_PERF_SEL_SC_DB_tile_events            = 0x00000003,
-DB_PERF_SEL_SC_DB_tile_tiles             = 0x00000004,
-DB_PERF_SEL_SC_DB_tile_covered           = 0x00000005,
-DB_PERF_SEL_hiz_tc_read_starved          = 0x00000006,
-DB_PERF_SEL_hiz_tc_write_stall           = 0x00000007,
-DB_PERF_SEL_hiz_qtiles_culled            = 0x00000008,
-DB_PERF_SEL_his_qtiles_culled            = 0x00000009,
-DB_PERF_SEL_DB_SC_tile_sends             = 0x0000000a,
-DB_PERF_SEL_DB_SC_tile_busy              = 0x0000000b,
-DB_PERF_SEL_DB_SC_tile_stalls            = 0x0000000c,
-DB_PERF_SEL_DB_SC_tile_df_stalls         = 0x0000000d,
-DB_PERF_SEL_DB_SC_tile_tiles             = 0x0000000e,
-DB_PERF_SEL_DB_SC_tile_culled            = 0x0000000f,
-DB_PERF_SEL_DB_SC_tile_hier_kill         = 0x00000010,
-DB_PERF_SEL_DB_SC_tile_fast_ops          = 0x00000011,
-DB_PERF_SEL_DB_SC_tile_no_ops            = 0x00000012,
-DB_PERF_SEL_DB_SC_tile_tile_rate         = 0x00000013,
-DB_PERF_SEL_DB_SC_tile_ssaa_kill         = 0x00000014,
-DB_PERF_SEL_DB_SC_tile_fast_z_ops        = 0x00000015,
-DB_PERF_SEL_DB_SC_tile_fast_stencil_ops  = 0x00000016,
-DB_PERF_SEL_SC_DB_quad_sends             = 0x00000017,
-DB_PERF_SEL_SC_DB_quad_busy              = 0x00000018,
-DB_PERF_SEL_SC_DB_quad_squads            = 0x00000019,
-DB_PERF_SEL_SC_DB_quad_tiles             = 0x0000001a,
-DB_PERF_SEL_SC_DB_quad_pixels            = 0x0000001b,
-DB_PERF_SEL_SC_DB_quad_killed_tiles      = 0x0000001c,
-DB_PERF_SEL_DB_SC_quad_sends             = 0x0000001d,
-DB_PERF_SEL_DB_SC_quad_busy              = 0x0000001e,
-DB_PERF_SEL_DB_SC_quad_stalls            = 0x0000001f,
-DB_PERF_SEL_DB_SC_quad_tiles             = 0x00000020,
-DB_PERF_SEL_DB_SC_quad_lit_quad          = 0x00000021,
-DB_PERF_SEL_DB_CB_tile_sends             = 0x00000022,
-DB_PERF_SEL_DB_CB_tile_busy              = 0x00000023,
-DB_PERF_SEL_DB_CB_tile_stalls            = 0x00000024,
-DB_PERF_SEL_SX_DB_quad_sends             = 0x00000025,
-DB_PERF_SEL_SX_DB_quad_busy              = 0x00000026,
-DB_PERF_SEL_SX_DB_quad_stalls            = 0x00000027,
-DB_PERF_SEL_SX_DB_quad_quads             = 0x00000028,
-DB_PERF_SEL_SX_DB_quad_pixels            = 0x00000029,
-DB_PERF_SEL_SX_DB_quad_exports           = 0x0000002a,
-DB_PERF_SEL_SH_quads_outstanding_sum     = 0x0000002b,
-DB_PERF_SEL_DB_CB_lquad_sends            = 0x0000002c,
-DB_PERF_SEL_DB_CB_lquad_busy             = 0x0000002d,
-DB_PERF_SEL_DB_CB_lquad_stalls           = 0x0000002e,
-DB_PERF_SEL_DB_CB_lquad_quads            = 0x0000002f,
-DB_PERF_SEL_tile_rd_sends                = 0x00000030,
-DB_PERF_SEL_mi_tile_rd_outstanding_sum   = 0x00000031,
-DB_PERF_SEL_quad_rd_sends                = 0x00000032,
-DB_PERF_SEL_quad_rd_busy                 = 0x00000033,
-DB_PERF_SEL_quad_rd_mi_stall             = 0x00000034,
-DB_PERF_SEL_quad_rd_rw_collision         = 0x00000035,
-DB_PERF_SEL_quad_rd_tag_stall            = 0x00000036,
-DB_PERF_SEL_quad_rd_32byte_reqs          = 0x00000037,
-DB_PERF_SEL_quad_rd_panic                = 0x00000038,
-DB_PERF_SEL_mi_quad_rd_outstanding_sum   = 0x00000039,
-DB_PERF_SEL_quad_rdret_sends             = 0x0000003a,
-DB_PERF_SEL_quad_rdret_busy              = 0x0000003b,
-DB_PERF_SEL_tile_wr_sends                = 0x0000003c,
-DB_PERF_SEL_tile_wr_acks                 = 0x0000003d,
-DB_PERF_SEL_mi_tile_wr_outstanding_sum   = 0x0000003e,
-DB_PERF_SEL_quad_wr_sends                = 0x0000003f,
-DB_PERF_SEL_quad_wr_busy                 = 0x00000040,
-DB_PERF_SEL_quad_wr_mi_stall             = 0x00000041,
-DB_PERF_SEL_quad_wr_coherency_stall      = 0x00000042,
-DB_PERF_SEL_quad_wr_acks                 = 0x00000043,
-DB_PERF_SEL_mi_quad_wr_outstanding_sum   = 0x00000044,
-DB_PERF_SEL_Tile_Cache_misses            = 0x00000045,
-DB_PERF_SEL_Tile_Cache_hits              = 0x00000046,
-DB_PERF_SEL_Tile_Cache_flushes           = 0x00000047,
-DB_PERF_SEL_Tile_Cache_surface_stall     = 0x00000048,
-DB_PERF_SEL_Tile_Cache_starves           = 0x00000049,
-DB_PERF_SEL_Tile_Cache_mem_return_starve  = 0x0000004a,
-DB_PERF_SEL_tcp_dispatcher_reads         = 0x0000004b,
-DB_PERF_SEL_tcp_prefetcher_reads         = 0x0000004c,
-DB_PERF_SEL_tcp_preloader_reads          = 0x0000004d,
-DB_PERF_SEL_tcp_dispatcher_flushes       = 0x0000004e,
-DB_PERF_SEL_tcp_prefetcher_flushes       = 0x0000004f,
-DB_PERF_SEL_tcp_preloader_flushes        = 0x00000050,
-DB_PERF_SEL_Depth_Tile_Cache_sends       = 0x00000051,
-DB_PERF_SEL_Depth_Tile_Cache_busy        = 0x00000052,
-DB_PERF_SEL_Depth_Tile_Cache_starves     = 0x00000053,
-DB_PERF_SEL_Depth_Tile_Cache_dtile_locked  = 0x00000054,
-DB_PERF_SEL_Depth_Tile_Cache_alloc_stall  = 0x00000055,
-DB_PERF_SEL_Depth_Tile_Cache_misses      = 0x00000056,
-DB_PERF_SEL_Depth_Tile_Cache_hits        = 0x00000057,
-DB_PERF_SEL_Depth_Tile_Cache_flushes     = 0x00000058,
-DB_PERF_SEL_Depth_Tile_Cache_noop_tile   = 0x00000059,
-DB_PERF_SEL_Depth_Tile_Cache_detailed_noop  = 0x0000005a,
-DB_PERF_SEL_Depth_Tile_Cache_event       = 0x0000005b,
-DB_PERF_SEL_Depth_Tile_Cache_tile_frees  = 0x0000005c,
-DB_PERF_SEL_Depth_Tile_Cache_data_frees  = 0x0000005d,
-DB_PERF_SEL_Depth_Tile_Cache_mem_return_starve  = 0x0000005e,
-DB_PERF_SEL_Stencil_Cache_misses         = 0x0000005f,
-DB_PERF_SEL_Stencil_Cache_hits           = 0x00000060,
-DB_PERF_SEL_Stencil_Cache_flushes        = 0x00000061,
-DB_PERF_SEL_Stencil_Cache_starves        = 0x00000062,
-DB_PERF_SEL_Stencil_Cache_frees          = 0x00000063,
-DB_PERF_SEL_Z_Cache_separate_Z_misses    = 0x00000064,
-DB_PERF_SEL_Z_Cache_separate_Z_hits      = 0x00000065,
-DB_PERF_SEL_Z_Cache_separate_Z_flushes   = 0x00000066,
-DB_PERF_SEL_Z_Cache_separate_Z_starves   = 0x00000067,
-DB_PERF_SEL_Z_Cache_pmask_misses         = 0x00000068,
-DB_PERF_SEL_Z_Cache_pmask_hits           = 0x00000069,
-DB_PERF_SEL_Z_Cache_pmask_flushes        = 0x0000006a,
-DB_PERF_SEL_Z_Cache_pmask_starves        = 0x0000006b,
-DB_PERF_SEL_Z_Cache_frees                = 0x0000006c,
-DB_PERF_SEL_Plane_Cache_misses           = 0x0000006d,
-DB_PERF_SEL_Plane_Cache_hits             = 0x0000006e,
-DB_PERF_SEL_Plane_Cache_flushes          = 0x0000006f,
-DB_PERF_SEL_Plane_Cache_starves          = 0x00000070,
-DB_PERF_SEL_Plane_Cache_frees            = 0x00000071,
-DB_PERF_SEL_flush_expanded_stencil       = 0x00000072,
-DB_PERF_SEL_flush_compressed_stencil     = 0x00000073,
-DB_PERF_SEL_flush_single_stencil         = 0x00000074,
-DB_PERF_SEL_planes_flushed               = 0x00000075,
-DB_PERF_SEL_flush_1plane                 = 0x00000076,
-DB_PERF_SEL_flush_2plane                 = 0x00000077,
-DB_PERF_SEL_flush_3plane                 = 0x00000078,
-DB_PERF_SEL_flush_4plane                 = 0x00000079,
-DB_PERF_SEL_flush_5plane                 = 0x0000007a,
-DB_PERF_SEL_flush_6plane                 = 0x0000007b,
-DB_PERF_SEL_flush_7plane                 = 0x0000007c,
-DB_PERF_SEL_flush_8plane                 = 0x0000007d,
-DB_PERF_SEL_flush_9plane                 = 0x0000007e,
-DB_PERF_SEL_flush_10plane                = 0x0000007f,
-DB_PERF_SEL_flush_11plane                = 0x00000080,
-DB_PERF_SEL_flush_12plane                = 0x00000081,
-DB_PERF_SEL_flush_13plane                = 0x00000082,
-DB_PERF_SEL_flush_14plane                = 0x00000083,
-DB_PERF_SEL_flush_15plane                = 0x00000084,
-DB_PERF_SEL_flush_16plane                = 0x00000085,
-DB_PERF_SEL_flush_expanded_z             = 0x00000086,
-DB_PERF_SEL_earlyZ_waiting_for_postZ_done  = 0x00000087,
-DB_PERF_SEL_reZ_waiting_for_postZ_done   = 0x00000088,
-DB_PERF_SEL_dk_tile_sends                = 0x00000089,
-DB_PERF_SEL_dk_tile_busy                 = 0x0000008a,
-DB_PERF_SEL_dk_tile_quad_starves         = 0x0000008b,
-DB_PERF_SEL_dk_tile_stalls               = 0x0000008c,
-DB_PERF_SEL_dk_squad_sends               = 0x0000008d,
-DB_PERF_SEL_dk_squad_busy                = 0x0000008e,
-DB_PERF_SEL_dk_squad_stalls              = 0x0000008f,
-DB_PERF_SEL_Op_Pipe_Busy                 = 0x00000090,
-DB_PERF_SEL_Op_Pipe_MC_Read_stall        = 0x00000091,
-DB_PERF_SEL_qc_busy                      = 0x00000092,
-DB_PERF_SEL_qc_xfc                       = 0x00000093,
-DB_PERF_SEL_qc_conflicts                 = 0x00000094,
-DB_PERF_SEL_qc_full_stall                = 0x00000095,
-DB_PERF_SEL_qc_in_preZ_tile_stalls_postZ  = 0x00000096,
-DB_PERF_SEL_qc_in_postZ_tile_stalls_preZ  = 0x00000097,
-DB_PERF_SEL_tsc_insert_summarize_stall   = 0x00000098,
-DB_PERF_SEL_tl_busy                      = 0x00000099,
-DB_PERF_SEL_tl_dtc_read_starved          = 0x0000009a,
-DB_PERF_SEL_tl_z_fetch_stall             = 0x0000009b,
-DB_PERF_SEL_tl_stencil_stall             = 0x0000009c,
-DB_PERF_SEL_tl_z_decompress_stall        = 0x0000009d,
-DB_PERF_SEL_tl_stencil_locked_stall      = 0x0000009e,
-DB_PERF_SEL_tl_events                    = 0x0000009f,
-DB_PERF_SEL_tl_summarize_squads          = 0x000000a0,
-DB_PERF_SEL_tl_flush_expand_squads       = 0x000000a1,
-DB_PERF_SEL_tl_expand_squads             = 0x000000a2,
-DB_PERF_SEL_tl_preZ_squads               = 0x000000a3,
-DB_PERF_SEL_tl_postZ_squads              = 0x000000a4,
-DB_PERF_SEL_tl_preZ_noop_squads          = 0x000000a5,
-DB_PERF_SEL_tl_postZ_noop_squads         = 0x000000a6,
-DB_PERF_SEL_tl_tile_ops                  = 0x000000a7,
-DB_PERF_SEL_tl_in_xfc                    = 0x000000a8,
-DB_PERF_SEL_tl_in_single_stencil_expand_stall  = 0x000000a9,
-DB_PERF_SEL_tl_in_fast_z_stall           = 0x000000aa,
-DB_PERF_SEL_tl_out_xfc                   = 0x000000ab,
-DB_PERF_SEL_tl_out_squads                = 0x000000ac,
-DB_PERF_SEL_zf_plane_multicycle          = 0x000000ad,
-DB_PERF_SEL_PostZ_Samples_passing_Z      = 0x000000ae,
-DB_PERF_SEL_PostZ_Samples_failing_Z      = 0x000000af,
-DB_PERF_SEL_PostZ_Samples_failing_S      = 0x000000b0,
-DB_PERF_SEL_PreZ_Samples_passing_Z       = 0x000000b1,
-DB_PERF_SEL_PreZ_Samples_failing_Z       = 0x000000b2,
-DB_PERF_SEL_PreZ_Samples_failing_S       = 0x000000b3,
-DB_PERF_SEL_ts_tc_update_stall           = 0x000000b4,
-DB_PERF_SEL_sc_kick_start                = 0x000000b5,
-DB_PERF_SEL_sc_kick_end                  = 0x000000b6,
-DB_PERF_SEL_clock_reg_active             = 0x000000b7,
-DB_PERF_SEL_clock_main_active            = 0x000000b8,
-DB_PERF_SEL_clock_mem_export_active      = 0x000000b9,
-DB_PERF_SEL_esr_ps_out_busy              = 0x000000ba,
-DB_PERF_SEL_esr_ps_lqf_busy              = 0x000000bb,
-DB_PERF_SEL_esr_ps_lqf_stall             = 0x000000bc,
-DB_PERF_SEL_etr_out_send                 = 0x000000bd,
-DB_PERF_SEL_etr_out_busy                 = 0x000000be,
-DB_PERF_SEL_etr_out_ltile_probe_fifo_full_stall  = 0x000000bf,
-DB_PERF_SEL_etr_out_cb_tile_stall        = 0x000000c0,
-DB_PERF_SEL_etr_out_esr_stall            = 0x000000c1,
-DB_PERF_SEL_esr_ps_sqq_busy              = 0x000000c2,
-DB_PERF_SEL_esr_ps_sqq_stall             = 0x000000c3,
-DB_PERF_SEL_esr_eot_fwd_busy             = 0x000000c4,
-DB_PERF_SEL_esr_eot_fwd_holding_squad    = 0x000000c5,
-DB_PERF_SEL_esr_eot_fwd_forward          = 0x000000c6,
-DB_PERF_SEL_esr_sqq_zi_busy              = 0x000000c7,
-DB_PERF_SEL_esr_sqq_zi_stall             = 0x000000c8,
-DB_PERF_SEL_postzl_sq_pt_busy            = 0x000000c9,
-DB_PERF_SEL_postzl_sq_pt_stall           = 0x000000ca,
-DB_PERF_SEL_postzl_se_busy               = 0x000000cb,
-DB_PERF_SEL_postzl_se_stall              = 0x000000cc,
-DB_PERF_SEL_postzl_partial_launch        = 0x000000cd,
-DB_PERF_SEL_postzl_full_launch           = 0x000000ce,
-DB_PERF_SEL_postzl_partial_waiting       = 0x000000cf,
-DB_PERF_SEL_postzl_tile_mem_stall        = 0x000000d0,
-DB_PERF_SEL_postzl_tile_init_stall       = 0x000000d1,
-DB_PEFF_SEL_prezl_tile_mem_stall         = 0x000000d2,
-DB_PERF_SEL_prezl_tile_init_stall        = 0x000000d3,
-DB_PERF_SEL_dtt_sm_clash_stall           = 0x000000d4,
-DB_PERF_SEL_dtt_sm_slot_stall            = 0x000000d5,
-DB_PERF_SEL_dtt_sm_miss_stall            = 0x000000d6,
-DB_PERF_SEL_mi_rdreq_busy                = 0x000000d7,
-DB_PERF_SEL_mi_rdreq_stall               = 0x000000d8,
-DB_PERF_SEL_mi_wrreq_busy                = 0x000000d9,
-DB_PERF_SEL_mi_wrreq_stall               = 0x000000da,
-DB_PERF_SEL_recomp_tile_to_1zplane_no_fastop  = 0x000000db,
-DB_PERF_SEL_dkg_tile_rate_tile           = 0x000000dc,
-DB_PERF_SEL_prezl_src_in_sends           = 0x000000dd,
-DB_PERF_SEL_prezl_src_in_stall           = 0x000000de,
-DB_PERF_SEL_prezl_src_in_squads          = 0x000000df,
-DB_PERF_SEL_prezl_src_in_squads_unrolled  = 0x000000e0,
-DB_PERF_SEL_prezl_src_in_tile_rate       = 0x000000e1,
-DB_PERF_SEL_prezl_src_in_tile_rate_unrolled  = 0x000000e2,
-DB_PERF_SEL_prezl_src_out_stall          = 0x000000e3,
-DB_PERF_SEL_postzl_src_in_sends          = 0x000000e4,
-DB_PERF_SEL_postzl_src_in_stall          = 0x000000e5,
-DB_PERF_SEL_postzl_src_in_squads         = 0x000000e6,
-DB_PERF_SEL_postzl_src_in_squads_unrolled  = 0x000000e7,
-DB_PERF_SEL_postzl_src_in_tile_rate      = 0x000000e8,
-DB_PERF_SEL_postzl_src_in_tile_rate_unrolled  = 0x000000e9,
-DB_PERF_SEL_postzl_src_out_stall         = 0x000000ea,
-DB_PERF_SEL_esr_ps_src_in_sends          = 0x000000eb,
-DB_PERF_SEL_esr_ps_src_in_stall          = 0x000000ec,
-DB_PERF_SEL_esr_ps_src_in_squads         = 0x000000ed,
-DB_PERF_SEL_esr_ps_src_in_squads_unrolled  = 0x000000ee,
-DB_PERF_SEL_esr_ps_src_in_tile_rate      = 0x000000ef,
-DB_PERF_SEL_esr_ps_src_in_tile_rate_unrolled  = 0x000000f0,
-DB_PERF_SEL_esr_ps_src_in_tile_rate_unrolled_to_pixel_rate  = 0x000000f1,
-DB_PERF_SEL_esr_ps_src_out_stall         = 0x000000f2,
-DB_PERF_SEL_depth_bounds_qtiles_culled   = 0x000000f3,
-DB_PERF_SEL_PreZ_Samples_failing_DB      = 0x000000f4,
-DB_PERF_SEL_PostZ_Samples_failing_DB     = 0x000000f5,
-DB_PERF_SEL_flush_compressed             = 0x000000f6,
-DB_PERF_SEL_flush_plane_le4              = 0x000000f7,
-DB_PERF_SEL_tiles_z_fully_summarized     = 0x000000f8,
-DB_PERF_SEL_tiles_stencil_fully_summarized  = 0x000000f9,
-DB_PERF_SEL_tiles_z_clear_on_expclear    = 0x000000fa,
-DB_PERF_SEL_tiles_s_clear_on_expclear    = 0x000000fb,
-DB_PERF_SEL_tiles_decomp_on_expclear     = 0x000000fc,
-DB_PERF_SEL_tiles_compressed_to_decompressed  = 0x000000fd,
-DB_PERF_SEL_Op_Pipe_Prez_Busy            = 0x000000fe,
-DB_PERF_SEL_Op_Pipe_Postz_Busy           = 0x000000ff,
-DB_PERF_SEL_di_dt_stall                  = 0x00000100,
-DB_PERF_SEL_DB_SC_quad_double_quad       = 0x00000101,
-DB_PERF_SEL_SX_DB_quad_export_quads      = 0x00000102,
-DB_PERF_SEL_SX_DB_quad_double_format     = 0x00000103,
-DB_PERF_SEL_SX_DB_quad_fast_format       = 0x00000104,
-DB_PERF_SEL_SX_DB_quad_slow_format       = 0x00000105,
-DB_PERF_SEL_DB_CB_lquad_export_quads     = 0x00000106,
-DB_PERF_SEL_DB_CB_lquad_double_format    = 0x00000107,
-DB_PERF_SEL_DB_CB_lquad_fast_format      = 0x00000108,
-DB_PERF_SEL_DB_CB_lquad_slow_format      = 0x00000109,
-DB_PERF_SEL_CB_DB_rdreq_sends            = 0x0000010a,
-DB_PERF_SEL_CB_DB_rdreq_prt_sends        = 0x0000010b,
-DB_PERF_SEL_CB_DB_wrreq_sends            = 0x0000010c,
-DB_PERF_SEL_CB_DB_wrreq_prt_sends        = 0x0000010d,
-DB_PERF_SEL_DB_CB_rdret_ack              = 0x0000010e,
-DB_PERF_SEL_DB_CB_rdret_nack             = 0x0000010f,
-DB_PERF_SEL_DB_CB_wrret_ack              = 0x00000110,
-DB_PERF_SEL_DB_CB_wrret_nack             = 0x00000111,
-DB_PERF_SEL_DFSM_squads_in               = 0x00000112,
-DB_PERF_SEL_DFSM_full_cleared_squads_out  = 0x00000113,
-DB_PERF_SEL_DFSM_quads_in                = 0x00000114,
-DB_PERF_SEL_DFSM_fully_cleared_quads_out  = 0x00000115,
-DB_PERF_SEL_DFSM_lit_pixels_in           = 0x00000116,
-DB_PERF_SEL_DFSM_fully_cleared_pixels_out  = 0x00000117,
-DB_PERF_SEL_DFSM_lit_samples_in          = 0x00000118,
-DB_PERF_SEL_DFSM_lit_samples_out         = 0x00000119,
-DB_PERF_SEL_DFSM_cycles_above_watermark  = 0x0000011a,
-DB_PERF_SEL_DFSM_cant_accept_squads_but_not_stalled_by_downstream  = 0x0000011b,
-DB_PERF_SEL_DFSM_stalled_by_downstream   = 0x0000011c,
-DB_PERF_SEL_DFSM_evicted_squads_above_watermark  = 0x0000011d,
-DB_PERF_SEL_DFSM_collisions_due_to_POPS_overflow  = 0x0000011e,
-DB_PERF_SEL_DFSM_collisions_detected_within_POPS_FIFO  = 0x0000011f,
-DB_PERF_SEL_DFSM_evicted_squads_due_to_prim_watermark  = 0x00000120,
-} PerfCounter_Vals;
-
-/*
- * RingCounterControl enum
- */
-
-typedef enum RingCounterControl {
-COUNTER_RING_SPLIT                       = 0x00000000,
-COUNTER_RING_0                           = 0x00000001,
-COUNTER_RING_1                           = 0x00000002,
-} RingCounterControl;
-
-/*
- * DbMemArbWatermarks enum
- */
-
-typedef enum DbMemArbWatermarks {
-TRANSFERRED_64_BYTES                     = 0x00000000,
-TRANSFERRED_128_BYTES                    = 0x00000001,
-TRANSFERRED_256_BYTES                    = 0x00000002,
-TRANSFERRED_512_BYTES                    = 0x00000003,
-TRANSFERRED_1024_BYTES                   = 0x00000004,
-TRANSFERRED_2048_BYTES                   = 0x00000005,
-TRANSFERRED_4096_BYTES                   = 0x00000006,
-TRANSFERRED_8192_BYTES                   = 0x00000007,
-} DbMemArbWatermarks;
-
-/*
- * DFSMFlushEvents enum
- */
-
-typedef enum DFSMFlushEvents {
-DB_FLUSH_AND_INV_DB_DATA_TS              = 0x00000000,
-DB_FLUSH_AND_INV_DB_META                 = 0x00000001,
-DB_CACHE_FLUSH                           = 0x00000002,
-DB_CACHE_FLUSH_TS                        = 0x00000003,
-DB_CACHE_FLUSH_AND_INV_EVENT             = 0x00000004,
-DB_CACHE_FLUSH_AND_INV_TS_EVENT          = 0x00000005,
-} DFSMFlushEvents;
-
-/*
- * PixelPipeCounterId enum
- */
-
-typedef enum PixelPipeCounterId {
-PIXEL_PIPE_OCCLUSION_COUNT_0             = 0x00000000,
-PIXEL_PIPE_OCCLUSION_COUNT_1             = 0x00000001,
-PIXEL_PIPE_OCCLUSION_COUNT_2             = 0x00000002,
-PIXEL_PIPE_OCCLUSION_COUNT_3             = 0x00000003,
-PIXEL_PIPE_SCREEN_MIN_EXTENTS_0          = 0x00000004,
-PIXEL_PIPE_SCREEN_MAX_EXTENTS_0          = 0x00000005,
-PIXEL_PIPE_SCREEN_MIN_EXTENTS_1          = 0x00000006,
-PIXEL_PIPE_SCREEN_MAX_EXTENTS_1          = 0x00000007,
-} PixelPipeCounterId;
-
-/*
- * PixelPipeStride enum
- */
-
-typedef enum PixelPipeStride {
-PIXEL_PIPE_STRIDE_32_BITS                = 0x00000000,
-PIXEL_PIPE_STRIDE_64_BITS                = 0x00000001,
-PIXEL_PIPE_STRIDE_128_BITS               = 0x00000002,
-PIXEL_PIPE_STRIDE_256_BITS               = 0x00000003,
-} PixelPipeStride;
-
-/*******************************************************
- * TA Enums
- *******************************************************/
-
-/*
- * TEX_BORDER_COLOR_TYPE enum
- */
-
-typedef enum TEX_BORDER_COLOR_TYPE {
-TEX_BorderColor_TransparentBlack         = 0x00000000,
-TEX_BorderColor_OpaqueBlack              = 0x00000001,
-TEX_BorderColor_OpaqueWhite              = 0x00000002,
-TEX_BorderColor_Register                 = 0x00000003,
-} TEX_BORDER_COLOR_TYPE;
-
-/*
- * TEX_CHROMA_KEY enum
- */
-
-typedef enum TEX_CHROMA_KEY {
-TEX_ChromaKey_Disabled                   = 0x00000000,
-TEX_ChromaKey_Kill                       = 0x00000001,
-TEX_ChromaKey_Blend                      = 0x00000002,
-TEX_ChromaKey_RESERVED_3                 = 0x00000003,
-} TEX_CHROMA_KEY;
-
-/*
- * TEX_CLAMP enum
- */
-
-typedef enum TEX_CLAMP {
-TEX_Clamp_Repeat                         = 0x00000000,
-TEX_Clamp_Mirror                         = 0x00000001,
-TEX_Clamp_ClampToLast                    = 0x00000002,
-TEX_Clamp_MirrorOnceToLast               = 0x00000003,
-TEX_Clamp_ClampHalfToBorder              = 0x00000004,
-TEX_Clamp_MirrorOnceHalfToBorder         = 0x00000005,
-TEX_Clamp_ClampToBorder                  = 0x00000006,
-TEX_Clamp_MirrorOnceToBorder             = 0x00000007,
-} TEX_CLAMP;
-
-/*
- * TEX_COORD_TYPE enum
- */
-
-typedef enum TEX_COORD_TYPE {
-TEX_CoordType_Unnormalized               = 0x00000000,
-TEX_CoordType_Normalized                 = 0x00000001,
-} TEX_COORD_TYPE;
-
-/*
- * TEX_DEPTH_COMPARE_FUNCTION enum
- */
-
-typedef enum TEX_DEPTH_COMPARE_FUNCTION {
-TEX_DepthCompareFunction_Never           = 0x00000000,
-TEX_DepthCompareFunction_Less            = 0x00000001,
-TEX_DepthCompareFunction_Equal           = 0x00000002,
-TEX_DepthCompareFunction_LessEqual       = 0x00000003,
-TEX_DepthCompareFunction_Greater         = 0x00000004,
-TEX_DepthCompareFunction_NotEqual        = 0x00000005,
-TEX_DepthCompareFunction_GreaterEqual    = 0x00000006,
-TEX_DepthCompareFunction_Always          = 0x00000007,
-} TEX_DEPTH_COMPARE_FUNCTION;
-
-/*
- * TEX_DIM enum
- */
-
-typedef enum TEX_DIM {
-TEX_Dim_1D                               = 0x00000000,
-TEX_Dim_2D                               = 0x00000001,
-TEX_Dim_3D                               = 0x00000002,
-TEX_Dim_CubeMap                          = 0x00000003,
-TEX_Dim_1DArray                          = 0x00000004,
-TEX_Dim_2DArray                          = 0x00000005,
-TEX_Dim_2D_MSAA                          = 0x00000006,
-TEX_Dim_2DArray_MSAA                     = 0x00000007,
-} TEX_DIM;
-
-/*
- * TEX_FORMAT_COMP enum
- */
-
-typedef enum TEX_FORMAT_COMP {
-TEX_FormatComp_Unsigned                  = 0x00000000,
-TEX_FormatComp_Signed                    = 0x00000001,
-TEX_FormatComp_UnsignedBiased            = 0x00000002,
-TEX_FormatComp_RESERVED_3                = 0x00000003,
-} TEX_FORMAT_COMP;
-
-/*
- * TEX_MAX_ANISO_RATIO enum
- */
-
-typedef enum TEX_MAX_ANISO_RATIO {
-TEX_MaxAnisoRatio_1to1                   = 0x00000000,
-TEX_MaxAnisoRatio_2to1                   = 0x00000001,
-TEX_MaxAnisoRatio_4to1                   = 0x00000002,
-TEX_MaxAnisoRatio_8to1                   = 0x00000003,
-TEX_MaxAnisoRatio_16to1                  = 0x00000004,
-TEX_MaxAnisoRatio_RESERVED_5             = 0x00000005,
-TEX_MaxAnisoRatio_RESERVED_6             = 0x00000006,
-TEX_MaxAnisoRatio_RESERVED_7             = 0x00000007,
-} TEX_MAX_ANISO_RATIO;
-
-/*
- * TEX_MIP_FILTER enum
- */
-
-typedef enum TEX_MIP_FILTER {
-TEX_MipFilter_None                       = 0x00000000,
-TEX_MipFilter_Point                      = 0x00000001,
-TEX_MipFilter_Linear                     = 0x00000002,
-TEX_MipFilter_Point_Aniso_Adj            = 0x00000003,
-} TEX_MIP_FILTER;
-
-/*
- * TEX_REQUEST_SIZE enum
- */
-
-typedef enum TEX_REQUEST_SIZE {
-TEX_RequestSize_32B                      = 0x00000000,
-TEX_RequestSize_64B                      = 0x00000001,
-TEX_RequestSize_128B                     = 0x00000002,
-TEX_RequestSize_2X64B                    = 0x00000003,
-} TEX_REQUEST_SIZE;
-
-/*
- * TEX_SAMPLER_TYPE enum
- */
-
-typedef enum TEX_SAMPLER_TYPE {
-TEX_SamplerType_Invalid                  = 0x00000000,
-TEX_SamplerType_Valid                    = 0x00000001,
-} TEX_SAMPLER_TYPE;
-
-/*
- * TEX_XY_FILTER enum
- */
-
-typedef enum TEX_XY_FILTER {
-TEX_XYFilter_Point                       = 0x00000000,
-TEX_XYFilter_Linear                      = 0x00000001,
-TEX_XYFilter_AnisoPoint                  = 0x00000002,
-TEX_XYFilter_AnisoLinear                 = 0x00000003,
-} TEX_XY_FILTER;
-
-/*
- * TEX_Z_FILTER enum
- */
-
-typedef enum TEX_Z_FILTER {
-TEX_ZFilter_None                         = 0x00000000,
-TEX_ZFilter_Point                        = 0x00000001,
-TEX_ZFilter_Linear                       = 0x00000002,
-TEX_ZFilter_RESERVED_3                   = 0x00000003,
-} TEX_Z_FILTER;
-
-/*
- * VTX_CLAMP enum
- */
-
-typedef enum VTX_CLAMP {
-VTX_Clamp_ClampToZero                    = 0x00000000,
-VTX_Clamp_ClampToNAN                     = 0x00000001,
-} VTX_CLAMP;
-
-/*
- * VTX_FETCH_TYPE enum
- */
-
-typedef enum VTX_FETCH_TYPE {
-VTX_FetchType_VertexData                 = 0x00000000,
-VTX_FetchType_InstanceData               = 0x00000001,
-VTX_FetchType_NoIndexOffset              = 0x00000002,
-VTX_FetchType_RESERVED_3                 = 0x00000003,
-} VTX_FETCH_TYPE;
-
-/*
- * VTX_FORMAT_COMP_ALL enum
- */
-
-typedef enum VTX_FORMAT_COMP_ALL {
-VTX_FormatCompAll_Unsigned               = 0x00000000,
-VTX_FormatCompAll_Signed                 = 0x00000001,
-} VTX_FORMAT_COMP_ALL;
-
-/*
- * VTX_MEM_REQUEST_SIZE enum
- */
-
-typedef enum VTX_MEM_REQUEST_SIZE {
-VTX_MemRequestSize_32B                   = 0x00000000,
-VTX_MemRequestSize_64B                   = 0x00000001,
-} VTX_MEM_REQUEST_SIZE;
-
-/*
- * TVX_DATA_FORMAT enum
- */
-
-typedef enum TVX_DATA_FORMAT {
-TVX_FMT_INVALID                          = 0x00000000,
-TVX_FMT_8                                = 0x00000001,
-TVX_FMT_4_4                              = 0x00000002,
-TVX_FMT_3_3_2                            = 0x00000003,
-TVX_FMT_RESERVED_4                       = 0x00000004,
-TVX_FMT_16                               = 0x00000005,
-TVX_FMT_16_FLOAT                         = 0x00000006,
-TVX_FMT_8_8                              = 0x00000007,
-TVX_FMT_5_6_5                            = 0x00000008,
-TVX_FMT_6_5_5                            = 0x00000009,
-TVX_FMT_1_5_5_5                          = 0x0000000a,
-TVX_FMT_4_4_4_4                          = 0x0000000b,
-TVX_FMT_5_5_5_1                          = 0x0000000c,
-TVX_FMT_32                               = 0x0000000d,
-TVX_FMT_32_FLOAT                         = 0x0000000e,
-TVX_FMT_16_16                            = 0x0000000f,
-TVX_FMT_16_16_FLOAT                      = 0x00000010,
-TVX_FMT_8_24                             = 0x00000011,
-TVX_FMT_8_24_FLOAT                       = 0x00000012,
-TVX_FMT_24_8                             = 0x00000013,
-TVX_FMT_24_8_FLOAT                       = 0x00000014,
-TVX_FMT_10_11_11                         = 0x00000015,
-TVX_FMT_10_11_11_FLOAT                   = 0x00000016,
-TVX_FMT_11_11_10                         = 0x00000017,
-TVX_FMT_11_11_10_FLOAT                   = 0x00000018,
-TVX_FMT_2_10_10_10                       = 0x00000019,
-TVX_FMT_8_8_8_8                          = 0x0000001a,
-TVX_FMT_10_10_10_2                       = 0x0000001b,
-TVX_FMT_X24_8_32_FLOAT                   = 0x0000001c,
-TVX_FMT_32_32                            = 0x0000001d,
-TVX_FMT_32_32_FLOAT                      = 0x0000001e,
-TVX_FMT_16_16_16_16                      = 0x0000001f,
-TVX_FMT_16_16_16_16_FLOAT                = 0x00000020,
-TVX_FMT_RESERVED_33                      = 0x00000021,
-TVX_FMT_32_32_32_32                      = 0x00000022,
-TVX_FMT_32_32_32_32_FLOAT                = 0x00000023,
-TVX_FMT_RESERVED_36                      = 0x00000024,
-TVX_FMT_1                                = 0x00000025,
-TVX_FMT_1_REVERSED                       = 0x00000026,
-TVX_FMT_GB_GR                            = 0x00000027,
-TVX_FMT_BG_RG                            = 0x00000028,
-TVX_FMT_32_AS_8                          = 0x00000029,
-TVX_FMT_32_AS_8_8                        = 0x0000002a,
-TVX_FMT_5_9_9_9_SHAREDEXP                = 0x0000002b,
-TVX_FMT_8_8_8                            = 0x0000002c,
-TVX_FMT_16_16_16                         = 0x0000002d,
-TVX_FMT_16_16_16_FLOAT                   = 0x0000002e,
-TVX_FMT_32_32_32                         = 0x0000002f,
-TVX_FMT_32_32_32_FLOAT                   = 0x00000030,
-TVX_FMT_BC1                              = 0x00000031,
-TVX_FMT_BC2                              = 0x00000032,
-TVX_FMT_BC3                              = 0x00000033,
-TVX_FMT_BC4                              = 0x00000034,
-TVX_FMT_BC5                              = 0x00000035,
-TVX_FMT_APC0                             = 0x00000036,
-TVX_FMT_APC1                             = 0x00000037,
-TVX_FMT_APC2                             = 0x00000038,
-TVX_FMT_APC3                             = 0x00000039,
-TVX_FMT_APC4                             = 0x0000003a,
-TVX_FMT_APC5                             = 0x0000003b,
-TVX_FMT_APC6                             = 0x0000003c,
-TVX_FMT_APC7                             = 0x0000003d,
-TVX_FMT_CTX1                             = 0x0000003e,
-TVX_FMT_RESERVED_63                      = 0x0000003f,
-} TVX_DATA_FORMAT;
-
-/*
- * TVX_DST_SEL enum
- */
-
-typedef enum TVX_DST_SEL {
-TVX_DstSel_X                             = 0x00000000,
-TVX_DstSel_Y                             = 0x00000001,
-TVX_DstSel_Z                             = 0x00000002,
-TVX_DstSel_W                             = 0x00000003,
-TVX_DstSel_0f                            = 0x00000004,
-TVX_DstSel_1f                            = 0x00000005,
-TVX_DstSel_RESERVED_6                    = 0x00000006,
-TVX_DstSel_Mask                          = 0x00000007,
-} TVX_DST_SEL;
-
-/*
- * TVX_ENDIAN_SWAP enum
- */
-
-typedef enum TVX_ENDIAN_SWAP {
-TVX_EndianSwap_None                      = 0x00000000,
-TVX_EndianSwap_8in16                     = 0x00000001,
-TVX_EndianSwap_8in32                     = 0x00000002,
-TVX_EndianSwap_8in64                     = 0x00000003,
-} TVX_ENDIAN_SWAP;
-
-/*
- * TVX_INST enum
- */
-
-typedef enum TVX_INST {
-TVX_Inst_NormalVertexFetch               = 0x00000000,
-TVX_Inst_SemanticVertexFetch             = 0x00000001,
-TVX_Inst_RESERVED_2                      = 0x00000002,
-TVX_Inst_LD                              = 0x00000003,
-TVX_Inst_GetTextureResInfo               = 0x00000004,
-TVX_Inst_GetNumberOfSamples              = 0x00000005,
-TVX_Inst_GetLOD                          = 0x00000006,
-TVX_Inst_GetGradientsH                   = 0x00000007,
-TVX_Inst_GetGradientsV                   = 0x00000008,
-TVX_Inst_SetTextureOffsets               = 0x00000009,
-TVX_Inst_KeepGradients                   = 0x0000000a,
-TVX_Inst_SetGradientsH                   = 0x0000000b,
-TVX_Inst_SetGradientsV                   = 0x0000000c,
-TVX_Inst_Pass                            = 0x0000000d,
-TVX_Inst_GetBufferResInfo                = 0x0000000e,
-TVX_Inst_RESERVED_15                     = 0x0000000f,
-TVX_Inst_Sample                          = 0x00000010,
-TVX_Inst_Sample_L                        = 0x00000011,
-TVX_Inst_Sample_LB                       = 0x00000012,
-TVX_Inst_Sample_LZ                       = 0x00000013,
-TVX_Inst_Sample_G                        = 0x00000014,
-TVX_Inst_Gather4                         = 0x00000015,
-TVX_Inst_Sample_G_LB                     = 0x00000016,
-TVX_Inst_Gather4_O                       = 0x00000017,
-TVX_Inst_Sample_C                        = 0x00000018,
-TVX_Inst_Sample_C_L                      = 0x00000019,
-TVX_Inst_Sample_C_LB                     = 0x0000001a,
-TVX_Inst_Sample_C_LZ                     = 0x0000001b,
-TVX_Inst_Sample_C_G                      = 0x0000001c,
-TVX_Inst_Gather4_C                       = 0x0000001d,
-TVX_Inst_Sample_C_G_LB                   = 0x0000001e,
-TVX_Inst_Gather4_C_O                     = 0x0000001f,
-} TVX_INST;
-
-/*
- * TVX_NUM_FORMAT_ALL enum
- */
-
-typedef enum TVX_NUM_FORMAT_ALL {
-TVX_NumFormatAll_Norm                    = 0x00000000,
-TVX_NumFormatAll_Int                     = 0x00000001,
-TVX_NumFormatAll_Scaled                  = 0x00000002,
-TVX_NumFormatAll_RESERVED_3              = 0x00000003,
-} TVX_NUM_FORMAT_ALL;
-
-/*
- * TVX_SRC_SEL enum
- */
-
-typedef enum TVX_SRC_SEL {
-TVX_SrcSel_X                             = 0x00000000,
-TVX_SrcSel_Y                             = 0x00000001,
-TVX_SrcSel_Z                             = 0x00000002,
-TVX_SrcSel_W                             = 0x00000003,
-TVX_SrcSel_0f                            = 0x00000004,
-TVX_SrcSel_1f                            = 0x00000005,
-} TVX_SRC_SEL;
-
-/*
- * TVX_SRF_MODE_ALL enum
- */
-
-typedef enum TVX_SRF_MODE_ALL {
-TVX_SRFModeAll_ZCMO                      = 0x00000000,
-TVX_SRFModeAll_NZ                        = 0x00000001,
-} TVX_SRF_MODE_ALL;
-
-/*
- * TVX_TYPE enum
- */
-
-typedef enum TVX_TYPE {
-TVX_Type_InvalidTextureResource          = 0x00000000,
-TVX_Type_InvalidVertexBuffer             = 0x00000001,
-TVX_Type_ValidTextureResource            = 0x00000002,
-TVX_Type_ValidVertexBuffer               = 0x00000003,
-} TVX_TYPE;
-
-/*******************************************************
- * PA Enums
- *******************************************************/
-
-/*
- * SU_PERFCNT_SEL enum
- */
-
-typedef enum SU_PERFCNT_SEL {
-PERF_PAPC_PASX_REQ                       = 0x00000000,
-PERF_PAPC_PASX_DISABLE_PIPE              = 0x00000001,
-PERF_PAPC_PASX_FIRST_VECTOR              = 0x00000002,
-PERF_PAPC_PASX_SECOND_VECTOR             = 0x00000003,
-PERF_PAPC_PASX_FIRST_DEAD                = 0x00000004,
-PERF_PAPC_PASX_SECOND_DEAD               = 0x00000005,
-PERF_PAPC_PASX_VTX_KILL_DISCARD          = 0x00000006,
-PERF_PAPC_PASX_VTX_NAN_DISCARD           = 0x00000007,
-PERF_PAPC_PA_INPUT_PRIM                  = 0x00000008,
-PERF_PAPC_PA_INPUT_NULL_PRIM             = 0x00000009,
-PERF_PAPC_PA_INPUT_EVENT_FLAG            = 0x0000000a,
-PERF_PAPC_PA_INPUT_FIRST_PRIM_SLOT       = 0x0000000b,
-PERF_PAPC_PA_INPUT_END_OF_PACKET         = 0x0000000c,
-PERF_PAPC_PA_INPUT_EXTENDED_EVENT        = 0x0000000d,
-PERF_PAPC_CLPR_CULL_PRIM                 = 0x0000000e,
-PERF_PAPC_CLPR_VVUCP_CULL_PRIM           = 0x0000000f,
-PERF_PAPC_CLPR_VV_CULL_PRIM              = 0x00000010,
-PERF_PAPC_CLPR_UCP_CULL_PRIM             = 0x00000011,
-PERF_PAPC_CLPR_VTX_KILL_CULL_PRIM        = 0x00000012,
-PERF_PAPC_CLPR_VTX_NAN_CULL_PRIM         = 0x00000013,
-PERF_PAPC_CLPR_CULL_TO_NULL_PRIM         = 0x00000014,
-PERF_PAPC_CLPR_VVUCP_CLIP_PRIM           = 0x00000015,
-PERF_PAPC_CLPR_VV_CLIP_PRIM              = 0x00000016,
-PERF_PAPC_CLPR_UCP_CLIP_PRIM             = 0x00000017,
-PERF_PAPC_CLPR_POINT_CLIP_CANDIDATE      = 0x00000018,
-PERF_PAPC_CLPR_CLIP_PLANE_CNT_1          = 0x00000019,
-PERF_PAPC_CLPR_CLIP_PLANE_CNT_2          = 0x0000001a,
-PERF_PAPC_CLPR_CLIP_PLANE_CNT_3          = 0x0000001b,
-PERF_PAPC_CLPR_CLIP_PLANE_CNT_4          = 0x0000001c,
-PERF_PAPC_CLPR_CLIP_PLANE_CNT_5_8        = 0x0000001d,
-PERF_PAPC_CLPR_CLIP_PLANE_CNT_9_12       = 0x0000001e,
-PERF_PAPC_CLPR_CLIP_PLANE_NEAR           = 0x0000001f,
-PERF_PAPC_CLPR_CLIP_PLANE_FAR            = 0x00000020,
-PERF_PAPC_CLPR_CLIP_PLANE_LEFT           = 0x00000021,
-PERF_PAPC_CLPR_CLIP_PLANE_RIGHT          = 0x00000022,
-PERF_PAPC_CLPR_CLIP_PLANE_TOP            = 0x00000023,
-PERF_PAPC_CLPR_CLIP_PLANE_BOTTOM         = 0x00000024,
-PERF_PAPC_CLPR_GSC_KILL_CULL_PRIM        = 0x00000025,
-PERF_PAPC_CLPR_RASTER_KILL_CULL_PRIM     = 0x00000026,
-PERF_PAPC_CLSM_NULL_PRIM                 = 0x00000027,
-PERF_PAPC_CLSM_TOTALLY_VISIBLE_PRIM      = 0x00000028,
-PERF_PAPC_CLSM_CULL_TO_NULL_PRIM         = 0x00000029,
-PERF_PAPC_CLSM_OUT_PRIM_CNT_1            = 0x0000002a,
-PERF_PAPC_CLSM_OUT_PRIM_CNT_2            = 0x0000002b,
-PERF_PAPC_CLSM_OUT_PRIM_CNT_3            = 0x0000002c,
-PERF_PAPC_CLSM_OUT_PRIM_CNT_4            = 0x0000002d,
-PERF_PAPC_CLSM_OUT_PRIM_CNT_5_8          = 0x0000002e,
-PERF_PAPC_CLSM_OUT_PRIM_CNT_9_13         = 0x0000002f,
-PERF_PAPC_CLIPGA_VTE_KILL_PRIM           = 0x00000030,
-PERF_PAPC_SU_INPUT_PRIM                  = 0x00000031,
-PERF_PAPC_SU_INPUT_CLIP_PRIM             = 0x00000032,
-PERF_PAPC_SU_INPUT_NULL_PRIM             = 0x00000033,
-PERF_PAPC_SU_INPUT_PRIM_DUAL             = 0x00000034,
-PERF_PAPC_SU_INPUT_CLIP_PRIM_DUAL        = 0x00000035,
-PERF_PAPC_SU_ZERO_AREA_CULL_PRIM         = 0x00000036,
-PERF_PAPC_SU_BACK_FACE_CULL_PRIM         = 0x00000037,
-PERF_PAPC_SU_FRONT_FACE_CULL_PRIM        = 0x00000038,
-PERF_PAPC_SU_POLYMODE_FACE_CULL          = 0x00000039,
-PERF_PAPC_SU_POLYMODE_BACK_CULL          = 0x0000003a,
-PERF_PAPC_SU_POLYMODE_FRONT_CULL         = 0x0000003b,
-PERF_PAPC_SU_POLYMODE_INVALID_FILL       = 0x0000003c,
-PERF_PAPC_SU_OUTPUT_PRIM                 = 0x0000003d,
-PERF_PAPC_SU_OUTPUT_CLIP_PRIM            = 0x0000003e,
-PERF_PAPC_SU_OUTPUT_NULL_PRIM            = 0x0000003f,
-PERF_PAPC_SU_OUTPUT_EVENT_FLAG           = 0x00000040,
-PERF_PAPC_SU_OUTPUT_FIRST_PRIM_SLOT      = 0x00000041,
-PERF_PAPC_SU_OUTPUT_END_OF_PACKET        = 0x00000042,
-PERF_PAPC_SU_OUTPUT_POLYMODE_FACE        = 0x00000043,
-PERF_PAPC_SU_OUTPUT_POLYMODE_BACK        = 0x00000044,
-PERF_PAPC_SU_OUTPUT_POLYMODE_FRONT       = 0x00000045,
-PERF_PAPC_SU_OUT_CLIP_POLYMODE_FACE      = 0x00000046,
-PERF_PAPC_SU_OUT_CLIP_POLYMODE_BACK      = 0x00000047,
-PERF_PAPC_SU_OUT_CLIP_POLYMODE_FRONT     = 0x00000048,
-PERF_PAPC_SU_OUTPUT_PRIM_DUAL            = 0x00000049,
-PERF_PAPC_SU_OUTPUT_CLIP_PRIM_DUAL       = 0x0000004a,
-PERF_PAPC_SU_OUTPUT_POLYMODE_DUAL        = 0x0000004b,
-PERF_PAPC_SU_OUTPUT_CLIP_POLYMODE_DUAL   = 0x0000004c,
-PERF_PAPC_PASX_REQ_IDLE                  = 0x0000004d,
-PERF_PAPC_PASX_REQ_BUSY                  = 0x0000004e,
-PERF_PAPC_PASX_REQ_STALLED               = 0x0000004f,
-PERF_PAPC_PASX_REC_IDLE                  = 0x00000050,
-PERF_PAPC_PASX_REC_BUSY                  = 0x00000051,
-PERF_PAPC_PASX_REC_STARVED_SX            = 0x00000052,
-PERF_PAPC_PASX_REC_STALLED               = 0x00000053,
-PERF_PAPC_PASX_REC_STALLED_POS_MEM       = 0x00000054,
-PERF_PAPC_PASX_REC_STALLED_CCGSM_IN      = 0x00000055,
-PERF_PAPC_CCGSM_IDLE                     = 0x00000056,
-PERF_PAPC_CCGSM_BUSY                     = 0x00000057,
-PERF_PAPC_CCGSM_STALLED                  = 0x00000058,
-PERF_PAPC_CLPRIM_IDLE                    = 0x00000059,
-PERF_PAPC_CLPRIM_BUSY                    = 0x0000005a,
-PERF_PAPC_CLPRIM_STALLED                 = 0x0000005b,
-PERF_PAPC_CLPRIM_STARVED_CCGSM           = 0x0000005c,
-PERF_PAPC_CLIPSM_IDLE                    = 0x0000005d,
-PERF_PAPC_CLIPSM_BUSY                    = 0x0000005e,
-PERF_PAPC_CLIPSM_WAIT_CLIP_VERT_ENGH     = 0x0000005f,
-PERF_PAPC_CLIPSM_WAIT_HIGH_PRI_SEQ       = 0x00000060,
-PERF_PAPC_CLIPSM_WAIT_CLIPGA             = 0x00000061,
-PERF_PAPC_CLIPSM_WAIT_AVAIL_VTE_CLIP     = 0x00000062,
-PERF_PAPC_CLIPSM_WAIT_CLIP_OUTSM         = 0x00000063,
-PERF_PAPC_CLIPGA_IDLE                    = 0x00000064,
-PERF_PAPC_CLIPGA_BUSY                    = 0x00000065,
-PERF_PAPC_CLIPGA_STARVED_VTE_CLIP        = 0x00000066,
-PERF_PAPC_CLIPGA_STALLED                 = 0x00000067,
-PERF_PAPC_CLIP_IDLE                      = 0x00000068,
-PERF_PAPC_CLIP_BUSY                      = 0x00000069,
-PERF_PAPC_SU_IDLE                        = 0x0000006a,
-PERF_PAPC_SU_BUSY                        = 0x0000006b,
-PERF_PAPC_SU_STARVED_CLIP                = 0x0000006c,
-PERF_PAPC_SU_STALLED_SC                  = 0x0000006d,
-PERF_PAPC_CL_DYN_SCLK_VLD                = 0x0000006e,
-PERF_PAPC_SU_DYN_SCLK_VLD                = 0x0000006f,
-PERF_PAPC_PA_REG_SCLK_VLD                = 0x00000070,
-PERF_PAPC_SU_MULTI_GPU_PRIM_FILTER_CULL  = 0x00000071,
-PERF_PAPC_PASX_SE0_REQ                   = 0x00000072,
-PERF_PAPC_PASX_SE1_REQ                   = 0x00000073,
-PERF_PAPC_PASX_SE0_FIRST_VECTOR          = 0x00000074,
-PERF_PAPC_PASX_SE0_SECOND_VECTOR         = 0x00000075,
-PERF_PAPC_PASX_SE1_FIRST_VECTOR          = 0x00000076,
-PERF_PAPC_PASX_SE1_SECOND_VECTOR         = 0x00000077,
-PERF_PAPC_SU_SE0_PRIM_FILTER_CULL        = 0x00000078,
-PERF_PAPC_SU_SE1_PRIM_FILTER_CULL        = 0x00000079,
-PERF_PAPC_SU_SE01_PRIM_FILTER_CULL       = 0x0000007a,
-PERF_PAPC_SU_SE0_OUTPUT_PRIM             = 0x0000007b,
-PERF_PAPC_SU_SE1_OUTPUT_PRIM             = 0x0000007c,
-PERF_PAPC_SU_SE01_OUTPUT_PRIM            = 0x0000007d,
-PERF_PAPC_SU_SE0_OUTPUT_NULL_PRIM        = 0x0000007e,
-PERF_PAPC_SU_SE1_OUTPUT_NULL_PRIM        = 0x0000007f,
-PERF_PAPC_SU_SE01_OUTPUT_NULL_PRIM       = 0x00000080,
-PERF_PAPC_SU_SE0_OUTPUT_FIRST_PRIM_SLOT  = 0x00000081,
-PERF_PAPC_SU_SE1_OUTPUT_FIRST_PRIM_SLOT  = 0x00000082,
-PERF_PAPC_SU_SE0_STALLED_SC              = 0x00000083,
-PERF_PAPC_SU_SE1_STALLED_SC              = 0x00000084,
-PERF_PAPC_SU_SE01_STALLED_SC             = 0x00000085,
-PERF_PAPC_CLSM_CLIPPING_PRIM             = 0x00000086,
-PERF_PAPC_SU_CULLED_PRIM                 = 0x00000087,
-PERF_PAPC_SU_OUTPUT_EOPG                 = 0x00000088,
-PERF_PAPC_SU_SE2_PRIM_FILTER_CULL        = 0x00000089,
-PERF_PAPC_SU_SE3_PRIM_FILTER_CULL        = 0x0000008a,
-PERF_PAPC_SU_SE2_OUTPUT_PRIM             = 0x0000008b,
-PERF_PAPC_SU_SE3_OUTPUT_PRIM             = 0x0000008c,
-PERF_PAPC_SU_SE2_OUTPUT_NULL_PRIM        = 0x0000008d,
-PERF_PAPC_SU_SE3_OUTPUT_NULL_PRIM        = 0x0000008e,
-PERF_PAPC_SU_SE0_OUTPUT_END_OF_PACKET    = 0x0000008f,
-PERF_PAPC_SU_SE1_OUTPUT_END_OF_PACKET    = 0x00000090,
-PERF_PAPC_SU_SE2_OUTPUT_END_OF_PACKET    = 0x00000091,
-PERF_PAPC_SU_SE3_OUTPUT_END_OF_PACKET    = 0x00000092,
-PERF_PAPC_SU_SE0_OUTPUT_EOPG             = 0x00000093,
-PERF_PAPC_SU_SE1_OUTPUT_EOPG             = 0x00000094,
-PERF_PAPC_SU_SE2_OUTPUT_EOPG             = 0x00000095,
-PERF_PAPC_SU_SE3_OUTPUT_EOPG             = 0x00000096,
-PERF_PAPC_SU_SE2_STALLED_SC              = 0x00000097,
-PERF_PAPC_SU_SE3_STALLED_SC              = 0x00000098,
-} SU_PERFCNT_SEL;
-
-/*
- * SC_PERFCNT_SEL enum
- */
-
-typedef enum SC_PERFCNT_SEL {
-SC_SRPS_WINDOW_VALID                     = 0x00000000,
-SC_PSSW_WINDOW_VALID                     = 0x00000001,
-SC_TPQZ_WINDOW_VALID                     = 0x00000002,
-SC_QZQP_WINDOW_VALID                     = 0x00000003,
-SC_TRPK_WINDOW_VALID                     = 0x00000004,
-SC_SRPS_WINDOW_VALID_BUSY                = 0x00000005,
-SC_PSSW_WINDOW_VALID_BUSY                = 0x00000006,
-SC_TPQZ_WINDOW_VALID_BUSY                = 0x00000007,
-SC_QZQP_WINDOW_VALID_BUSY                = 0x00000008,
-SC_TRPK_WINDOW_VALID_BUSY                = 0x00000009,
-SC_STARVED_BY_PA                         = 0x0000000a,
-SC_STALLED_BY_PRIMFIFO                   = 0x0000000b,
-SC_STALLED_BY_DB_TILE                    = 0x0000000c,
-SC_STARVED_BY_DB_TILE                    = 0x0000000d,
-SC_STALLED_BY_TILEORDERFIFO              = 0x0000000e,
-SC_STALLED_BY_TILEFIFO                   = 0x0000000f,
-SC_STALLED_BY_DB_QUAD                    = 0x00000010,
-SC_STARVED_BY_DB_QUAD                    = 0x00000011,
-SC_STALLED_BY_QUADFIFO                   = 0x00000012,
-SC_STALLED_BY_BCI                        = 0x00000013,
-SC_STALLED_BY_SPI                        = 0x00000014,
-SC_SCISSOR_DISCARD                       = 0x00000015,
-SC_BB_DISCARD                            = 0x00000016,
-SC_SUPERTILE_COUNT                       = 0x00000017,
-SC_SUPERTILE_PER_PRIM_H0                 = 0x00000018,
-SC_SUPERTILE_PER_PRIM_H1                 = 0x00000019,
-SC_SUPERTILE_PER_PRIM_H2                 = 0x0000001a,
-SC_SUPERTILE_PER_PRIM_H3                 = 0x0000001b,
-SC_SUPERTILE_PER_PRIM_H4                 = 0x0000001c,
-SC_SUPERTILE_PER_PRIM_H5                 = 0x0000001d,
-SC_SUPERTILE_PER_PRIM_H6                 = 0x0000001e,
-SC_SUPERTILE_PER_PRIM_H7                 = 0x0000001f,
-SC_SUPERTILE_PER_PRIM_H8                 = 0x00000020,
-SC_SUPERTILE_PER_PRIM_H9                 = 0x00000021,
-SC_SUPERTILE_PER_PRIM_H10                = 0x00000022,
-SC_SUPERTILE_PER_PRIM_H11                = 0x00000023,
-SC_SUPERTILE_PER_PRIM_H12                = 0x00000024,
-SC_SUPERTILE_PER_PRIM_H13                = 0x00000025,
-SC_SUPERTILE_PER_PRIM_H14                = 0x00000026,
-SC_SUPERTILE_PER_PRIM_H15                = 0x00000027,
-SC_SUPERTILE_PER_PRIM_H16                = 0x00000028,
-SC_TILE_PER_PRIM_H0                      = 0x00000029,
-SC_TILE_PER_PRIM_H1                      = 0x0000002a,
-SC_TILE_PER_PRIM_H2                      = 0x0000002b,
-SC_TILE_PER_PRIM_H3                      = 0x0000002c,
-SC_TILE_PER_PRIM_H4                      = 0x0000002d,
-SC_TILE_PER_PRIM_H5                      = 0x0000002e,
-SC_TILE_PER_PRIM_H6                      = 0x0000002f,
-SC_TILE_PER_PRIM_H7                      = 0x00000030,
-SC_TILE_PER_PRIM_H8                      = 0x00000031,
-SC_TILE_PER_PRIM_H9                      = 0x00000032,
-SC_TILE_PER_PRIM_H10                     = 0x00000033,
-SC_TILE_PER_PRIM_H11                     = 0x00000034,
-SC_TILE_PER_PRIM_H12                     = 0x00000035,
-SC_TILE_PER_PRIM_H13                     = 0x00000036,
-SC_TILE_PER_PRIM_H14                     = 0x00000037,
-SC_TILE_PER_PRIM_H15                     = 0x00000038,
-SC_TILE_PER_PRIM_H16                     = 0x00000039,
-SC_TILE_PER_SUPERTILE_H0                 = 0x0000003a,
-SC_TILE_PER_SUPERTILE_H1                 = 0x0000003b,
-SC_TILE_PER_SUPERTILE_H2                 = 0x0000003c,
-SC_TILE_PER_SUPERTILE_H3                 = 0x0000003d,
-SC_TILE_PER_SUPERTILE_H4                 = 0x0000003e,
-SC_TILE_PER_SUPERTILE_H5                 = 0x0000003f,
-SC_TILE_PER_SUPERTILE_H6                 = 0x00000040,
-SC_TILE_PER_SUPERTILE_H7                 = 0x00000041,
-SC_TILE_PER_SUPERTILE_H8                 = 0x00000042,
-SC_TILE_PER_SUPERTILE_H9                 = 0x00000043,
-SC_TILE_PER_SUPERTILE_H10                = 0x00000044,
-SC_TILE_PER_SUPERTILE_H11                = 0x00000045,
-SC_TILE_PER_SUPERTILE_H12                = 0x00000046,
-SC_TILE_PER_SUPERTILE_H13                = 0x00000047,
-SC_TILE_PER_SUPERTILE_H14                = 0x00000048,
-SC_TILE_PER_SUPERTILE_H15                = 0x00000049,
-SC_TILE_PER_SUPERTILE_H16                = 0x0000004a,
-SC_TILE_PICKED_H1                        = 0x0000004b,
-SC_TILE_PICKED_H2                        = 0x0000004c,
-SC_TILE_PICKED_H3                        = 0x0000004d,
-SC_TILE_PICKED_H4                        = 0x0000004e,
-SC_QZ0_TILE_COUNT                        = 0x0000004f,
-SC_QZ1_TILE_COUNT                        = 0x00000050,
-SC_QZ2_TILE_COUNT                        = 0x00000051,
-SC_QZ3_TILE_COUNT                        = 0x00000052,
-SC_QZ0_TILE_COVERED_COUNT                = 0x00000053,
-SC_QZ1_TILE_COVERED_COUNT                = 0x00000054,
-SC_QZ2_TILE_COVERED_COUNT                = 0x00000055,
-SC_QZ3_TILE_COVERED_COUNT                = 0x00000056,
-SC_QZ0_TILE_NOT_COVERED_COUNT            = 0x00000057,
-SC_QZ1_TILE_NOT_COVERED_COUNT            = 0x00000058,
-SC_QZ2_TILE_NOT_COVERED_COUNT            = 0x00000059,
-SC_QZ3_TILE_NOT_COVERED_COUNT            = 0x0000005a,
-SC_QZ0_QUAD_PER_TILE_H0                  = 0x0000005b,
-SC_QZ0_QUAD_PER_TILE_H1                  = 0x0000005c,
-SC_QZ0_QUAD_PER_TILE_H2                  = 0x0000005d,
-SC_QZ0_QUAD_PER_TILE_H3                  = 0x0000005e,
-SC_QZ0_QUAD_PER_TILE_H4                  = 0x0000005f,
-SC_QZ0_QUAD_PER_TILE_H5                  = 0x00000060,
-SC_QZ0_QUAD_PER_TILE_H6                  = 0x00000061,
-SC_QZ0_QUAD_PER_TILE_H7                  = 0x00000062,
-SC_QZ0_QUAD_PER_TILE_H8                  = 0x00000063,
-SC_QZ0_QUAD_PER_TILE_H9                  = 0x00000064,
-SC_QZ0_QUAD_PER_TILE_H10                 = 0x00000065,
-SC_QZ0_QUAD_PER_TILE_H11                 = 0x00000066,
-SC_QZ0_QUAD_PER_TILE_H12                 = 0x00000067,
-SC_QZ0_QUAD_PER_TILE_H13                 = 0x00000068,
-SC_QZ0_QUAD_PER_TILE_H14                 = 0x00000069,
-SC_QZ0_QUAD_PER_TILE_H15                 = 0x0000006a,
-SC_QZ0_QUAD_PER_TILE_H16                 = 0x0000006b,
-SC_QZ1_QUAD_PER_TILE_H0                  = 0x0000006c,
-SC_QZ1_QUAD_PER_TILE_H1                  = 0x0000006d,
-SC_QZ1_QUAD_PER_TILE_H2                  = 0x0000006e,
-SC_QZ1_QUAD_PER_TILE_H3                  = 0x0000006f,
-SC_QZ1_QUAD_PER_TILE_H4                  = 0x00000070,
-SC_QZ1_QUAD_PER_TILE_H5                  = 0x00000071,
-SC_QZ1_QUAD_PER_TILE_H6                  = 0x00000072,
-SC_QZ1_QUAD_PER_TILE_H7                  = 0x00000073,
-SC_QZ1_QUAD_PER_TILE_H8                  = 0x00000074,
-SC_QZ1_QUAD_PER_TILE_H9                  = 0x00000075,
-SC_QZ1_QUAD_PER_TILE_H10                 = 0x00000076,
-SC_QZ1_QUAD_PER_TILE_H11                 = 0x00000077,
-SC_QZ1_QUAD_PER_TILE_H12                 = 0x00000078,
-SC_QZ1_QUAD_PER_TILE_H13                 = 0x00000079,
-SC_QZ1_QUAD_PER_TILE_H14                 = 0x0000007a,
-SC_QZ1_QUAD_PER_TILE_H15                 = 0x0000007b,
-SC_QZ1_QUAD_PER_TILE_H16                 = 0x0000007c,
-SC_QZ2_QUAD_PER_TILE_H0                  = 0x0000007d,
-SC_QZ2_QUAD_PER_TILE_H1                  = 0x0000007e,
-SC_QZ2_QUAD_PER_TILE_H2                  = 0x0000007f,
-SC_QZ2_QUAD_PER_TILE_H3                  = 0x00000080,
-SC_QZ2_QUAD_PER_TILE_H4                  = 0x00000081,
-SC_QZ2_QUAD_PER_TILE_H5                  = 0x00000082,
-SC_QZ2_QUAD_PER_TILE_H6                  = 0x00000083,
-SC_QZ2_QUAD_PER_TILE_H7                  = 0x00000084,
-SC_QZ2_QUAD_PER_TILE_H8                  = 0x00000085,
-SC_QZ2_QUAD_PER_TILE_H9                  = 0x00000086,
-SC_QZ2_QUAD_PER_TILE_H10                 = 0x00000087,
-SC_QZ2_QUAD_PER_TILE_H11                 = 0x00000088,
-SC_QZ2_QUAD_PER_TILE_H12                 = 0x00000089,
-SC_QZ2_QUAD_PER_TILE_H13                 = 0x0000008a,
-SC_QZ2_QUAD_PER_TILE_H14                 = 0x0000008b,
-SC_QZ2_QUAD_PER_TILE_H15                 = 0x0000008c,
-SC_QZ2_QUAD_PER_TILE_H16                 = 0x0000008d,
-SC_QZ3_QUAD_PER_TILE_H0                  = 0x0000008e,
-SC_QZ3_QUAD_PER_TILE_H1                  = 0x0000008f,
-SC_QZ3_QUAD_PER_TILE_H2                  = 0x00000090,
-SC_QZ3_QUAD_PER_TILE_H3                  = 0x00000091,
-SC_QZ3_QUAD_PER_TILE_H4                  = 0x00000092,
-SC_QZ3_QUAD_PER_TILE_H5                  = 0x00000093,
-SC_QZ3_QUAD_PER_TILE_H6                  = 0x00000094,
-SC_QZ3_QUAD_PER_TILE_H7                  = 0x00000095,
-SC_QZ3_QUAD_PER_TILE_H8                  = 0x00000096,
-SC_QZ3_QUAD_PER_TILE_H9                  = 0x00000097,
-SC_QZ3_QUAD_PER_TILE_H10                 = 0x00000098,
-SC_QZ3_QUAD_PER_TILE_H11                 = 0x00000099,
-SC_QZ3_QUAD_PER_TILE_H12                 = 0x0000009a,
-SC_QZ3_QUAD_PER_TILE_H13                 = 0x0000009b,
-SC_QZ3_QUAD_PER_TILE_H14                 = 0x0000009c,
-SC_QZ3_QUAD_PER_TILE_H15                 = 0x0000009d,
-SC_QZ3_QUAD_PER_TILE_H16                 = 0x0000009e,
-SC_QZ0_QUAD_COUNT                        = 0x0000009f,
-SC_QZ1_QUAD_COUNT                        = 0x000000a0,
-SC_QZ2_QUAD_COUNT                        = 0x000000a1,
-SC_QZ3_QUAD_COUNT                        = 0x000000a2,
-SC_P0_HIZ_TILE_COUNT                     = 0x000000a3,
-SC_P1_HIZ_TILE_COUNT                     = 0x000000a4,
-SC_P2_HIZ_TILE_COUNT                     = 0x000000a5,
-SC_P3_HIZ_TILE_COUNT                     = 0x000000a6,
-SC_P0_HIZ_QUAD_PER_TILE_H0               = 0x000000a7,
-SC_P0_HIZ_QUAD_PER_TILE_H1               = 0x000000a8,
-SC_P0_HIZ_QUAD_PER_TILE_H2               = 0x000000a9,
-SC_P0_HIZ_QUAD_PER_TILE_H3               = 0x000000aa,
-SC_P0_HIZ_QUAD_PER_TILE_H4               = 0x000000ab,
-SC_P0_HIZ_QUAD_PER_TILE_H5               = 0x000000ac,
-SC_P0_HIZ_QUAD_PER_TILE_H6               = 0x000000ad,
-SC_P0_HIZ_QUAD_PER_TILE_H7               = 0x000000ae,
-SC_P0_HIZ_QUAD_PER_TILE_H8               = 0x000000af,
-SC_P0_HIZ_QUAD_PER_TILE_H9               = 0x000000b0,
-SC_P0_HIZ_QUAD_PER_TILE_H10              = 0x000000b1,
-SC_P0_HIZ_QUAD_PER_TILE_H11              = 0x000000b2,
-SC_P0_HIZ_QUAD_PER_TILE_H12              = 0x000000b3,
-SC_P0_HIZ_QUAD_PER_TILE_H13              = 0x000000b4,
-SC_P0_HIZ_QUAD_PER_TILE_H14              = 0x000000b5,
-SC_P0_HIZ_QUAD_PER_TILE_H15              = 0x000000b6,
-SC_P0_HIZ_QUAD_PER_TILE_H16              = 0x000000b7,
-SC_P1_HIZ_QUAD_PER_TILE_H0               = 0x000000b8,
-SC_P1_HIZ_QUAD_PER_TILE_H1               = 0x000000b9,
-SC_P1_HIZ_QUAD_PER_TILE_H2               = 0x000000ba,
-SC_P1_HIZ_QUAD_PER_TILE_H3               = 0x000000bb,
-SC_P1_HIZ_QUAD_PER_TILE_H4               = 0x000000bc,
-SC_P1_HIZ_QUAD_PER_TILE_H5               = 0x000000bd,
-SC_P1_HIZ_QUAD_PER_TILE_H6               = 0x000000be,
-SC_P1_HIZ_QUAD_PER_TILE_H7               = 0x000000bf,
-SC_P1_HIZ_QUAD_PER_TILE_H8               = 0x000000c0,
-SC_P1_HIZ_QUAD_PER_TILE_H9               = 0x000000c1,
-SC_P1_HIZ_QUAD_PER_TILE_H10              = 0x000000c2,
-SC_P1_HIZ_QUAD_PER_TILE_H11              = 0x000000c3,
-SC_P1_HIZ_QUAD_PER_TILE_H12              = 0x000000c4,
-SC_P1_HIZ_QUAD_PER_TILE_H13              = 0x000000c5,
-SC_P1_HIZ_QUAD_PER_TILE_H14              = 0x000000c6,
-SC_P1_HIZ_QUAD_PER_TILE_H15              = 0x000000c7,
-SC_P1_HIZ_QUAD_PER_TILE_H16              = 0x000000c8,
-SC_P2_HIZ_QUAD_PER_TILE_H0               = 0x000000c9,
-SC_P2_HIZ_QUAD_PER_TILE_H1               = 0x000000ca,
-SC_P2_HIZ_QUAD_PER_TILE_H2               = 0x000000cb,
-SC_P2_HIZ_QUAD_PER_TILE_H3               = 0x000000cc,
-SC_P2_HIZ_QUAD_PER_TILE_H4               = 0x000000cd,
-SC_P2_HIZ_QUAD_PER_TILE_H5               = 0x000000ce,
-SC_P2_HIZ_QUAD_PER_TILE_H6               = 0x000000cf,
-SC_P2_HIZ_QUAD_PER_TILE_H7               = 0x000000d0,
-SC_P2_HIZ_QUAD_PER_TILE_H8               = 0x000000d1,
-SC_P2_HIZ_QUAD_PER_TILE_H9               = 0x000000d2,
-SC_P2_HIZ_QUAD_PER_TILE_H10              = 0x000000d3,
-SC_P2_HIZ_QUAD_PER_TILE_H11              = 0x000000d4,
-SC_P2_HIZ_QUAD_PER_TILE_H12              = 0x000000d5,
-SC_P2_HIZ_QUAD_PER_TILE_H13              = 0x000000d6,
-SC_P2_HIZ_QUAD_PER_TILE_H14              = 0x000000d7,
-SC_P2_HIZ_QUAD_PER_TILE_H15              = 0x000000d8,
-SC_P2_HIZ_QUAD_PER_TILE_H16              = 0x000000d9,
-SC_P3_HIZ_QUAD_PER_TILE_H0               = 0x000000da,
-SC_P3_HIZ_QUAD_PER_TILE_H1               = 0x000000db,
-SC_P3_HIZ_QUAD_PER_TILE_H2               = 0x000000dc,
-SC_P3_HIZ_QUAD_PER_TILE_H3               = 0x000000dd,
-SC_P3_HIZ_QUAD_PER_TILE_H4               = 0x000000de,
-SC_P3_HIZ_QUAD_PER_TILE_H5               = 0x000000df,
-SC_P3_HIZ_QUAD_PER_TILE_H6               = 0x000000e0,
-SC_P3_HIZ_QUAD_PER_TILE_H7               = 0x000000e1,
-SC_P3_HIZ_QUAD_PER_TILE_H8               = 0x000000e2,
-SC_P3_HIZ_QUAD_PER_TILE_H9               = 0x000000e3,
-SC_P3_HIZ_QUAD_PER_TILE_H10              = 0x000000e4,
-SC_P3_HIZ_QUAD_PER_TILE_H11              = 0x000000e5,
-SC_P3_HIZ_QUAD_PER_TILE_H12              = 0x000000e6,
-SC_P3_HIZ_QUAD_PER_TILE_H13              = 0x000000e7,
-SC_P3_HIZ_QUAD_PER_TILE_H14              = 0x000000e8,
-SC_P3_HIZ_QUAD_PER_TILE_H15              = 0x000000e9,
-SC_P3_HIZ_QUAD_PER_TILE_H16              = 0x000000ea,
-SC_P0_HIZ_QUAD_COUNT                     = 0x000000eb,
-SC_P1_HIZ_QUAD_COUNT                     = 0x000000ec,
-SC_P2_HIZ_QUAD_COUNT                     = 0x000000ed,
-SC_P3_HIZ_QUAD_COUNT                     = 0x000000ee,
-SC_P0_DETAIL_QUAD_COUNT                  = 0x000000ef,
-SC_P1_DETAIL_QUAD_COUNT                  = 0x000000f0,
-SC_P2_DETAIL_QUAD_COUNT                  = 0x000000f1,
-SC_P3_DETAIL_QUAD_COUNT                  = 0x000000f2,
-SC_P0_DETAIL_QUAD_WITH_1_PIX             = 0x000000f3,
-SC_P0_DETAIL_QUAD_WITH_2_PIX             = 0x000000f4,
-SC_P0_DETAIL_QUAD_WITH_3_PIX             = 0x000000f5,
-SC_P0_DETAIL_QUAD_WITH_4_PIX             = 0x000000f6,
-SC_P1_DETAIL_QUAD_WITH_1_PIX             = 0x000000f7,
-SC_P1_DETAIL_QUAD_WITH_2_PIX             = 0x000000f8,
-SC_P1_DETAIL_QUAD_WITH_3_PIX             = 0x000000f9,
-SC_P1_DETAIL_QUAD_WITH_4_PIX             = 0x000000fa,
-SC_P2_DETAIL_QUAD_WITH_1_PIX             = 0x000000fb,
-SC_P2_DETAIL_QUAD_WITH_2_PIX             = 0x000000fc,
-SC_P2_DETAIL_QUAD_WITH_3_PIX             = 0x000000fd,
-SC_P2_DETAIL_QUAD_WITH_4_PIX             = 0x000000fe,
-SC_P3_DETAIL_QUAD_WITH_1_PIX             = 0x000000ff,
-SC_P3_DETAIL_QUAD_WITH_2_PIX             = 0x00000100,
-SC_P3_DETAIL_QUAD_WITH_3_PIX             = 0x00000101,
-SC_P3_DETAIL_QUAD_WITH_4_PIX             = 0x00000102,
-SC_EARLYZ_QUAD_COUNT                     = 0x00000103,
-SC_EARLYZ_QUAD_WITH_1_PIX                = 0x00000104,
-SC_EARLYZ_QUAD_WITH_2_PIX                = 0x00000105,
-SC_EARLYZ_QUAD_WITH_3_PIX                = 0x00000106,
-SC_EARLYZ_QUAD_WITH_4_PIX                = 0x00000107,
-SC_PKR_QUAD_PER_ROW_H1                   = 0x00000108,
-SC_PKR_QUAD_PER_ROW_H2                   = 0x00000109,
-SC_PKR_4X2_QUAD_SPLIT                    = 0x0000010a,
-SC_PKR_4X2_FILL_QUAD                     = 0x0000010b,
-SC_PKR_END_OF_VECTOR                     = 0x0000010c,
-SC_PKR_CONTROL_XFER                      = 0x0000010d,
-SC_PKR_DBHANG_FORCE_EOV                  = 0x0000010e,
-SC_REG_SCLK_BUSY                         = 0x0000010f,
-SC_GRP0_DYN_SCLK_BUSY                    = 0x00000110,
-SC_GRP1_DYN_SCLK_BUSY                    = 0x00000111,
-SC_GRP2_DYN_SCLK_BUSY                    = 0x00000112,
-SC_GRP3_DYN_SCLK_BUSY                    = 0x00000113,
-SC_GRP4_DYN_SCLK_BUSY                    = 0x00000114,
-SC_PA0_SC_DATA_FIFO_RD                   = 0x00000115,
-SC_PA0_SC_DATA_FIFO_WE                   = 0x00000116,
-SC_PA1_SC_DATA_FIFO_RD                   = 0x00000117,
-SC_PA1_SC_DATA_FIFO_WE                   = 0x00000118,
-SC_PS_ARB_XFC_ALL_EVENT_OR_PRIM_CYCLES   = 0x00000119,
-SC_PS_ARB_XFC_ONLY_PRIM_CYCLES           = 0x0000011a,
-SC_PS_ARB_XFC_ONLY_ONE_INC_PER_PRIM      = 0x0000011b,
-SC_PS_ARB_STALLED_FROM_BELOW             = 0x0000011c,
-SC_PS_ARB_STARVED_FROM_ABOVE             = 0x0000011d,
-SC_PS_ARB_SC_BUSY                        = 0x0000011e,
-SC_PS_ARB_PA_SC_BUSY                     = 0x0000011f,
-SC_PA2_SC_DATA_FIFO_RD                   = 0x00000120,
-SC_PA2_SC_DATA_FIFO_WE                   = 0x00000121,
-SC_PA3_SC_DATA_FIFO_RD                   = 0x00000122,
-SC_PA3_SC_DATA_FIFO_WE                   = 0x00000123,
-SC_PA_SC_DEALLOC_0_0_WE                  = 0x00000124,
-SC_PA_SC_DEALLOC_0_1_WE                  = 0x00000125,
-SC_PA_SC_DEALLOC_1_0_WE                  = 0x00000126,
-SC_PA_SC_DEALLOC_1_1_WE                  = 0x00000127,
-SC_PA_SC_DEALLOC_2_0_WE                  = 0x00000128,
-SC_PA_SC_DEALLOC_2_1_WE                  = 0x00000129,
-SC_PA_SC_DEALLOC_3_0_WE                  = 0x0000012a,
-SC_PA_SC_DEALLOC_3_1_WE                  = 0x0000012b,
-SC_PA0_SC_EOP_WE                         = 0x0000012c,
-SC_PA0_SC_EOPG_WE                        = 0x0000012d,
-SC_PA0_SC_EVENT_WE                       = 0x0000012e,
-SC_PA1_SC_EOP_WE                         = 0x0000012f,
-SC_PA1_SC_EOPG_WE                        = 0x00000130,
-SC_PA1_SC_EVENT_WE                       = 0x00000131,
-SC_PA2_SC_EOP_WE                         = 0x00000132,
-SC_PA2_SC_EOPG_WE                        = 0x00000133,
-SC_PA2_SC_EVENT_WE                       = 0x00000134,
-SC_PA3_SC_EOP_WE                         = 0x00000135,
-SC_PA3_SC_EOPG_WE                        = 0x00000136,
-SC_PA3_SC_EVENT_WE                       = 0x00000137,
-SC_PS_ARB_OOO_THRESHOLD_SWITCH_TO_DESIRED_FIFO  = 0x00000138,
-SC_PS_ARB_OOO_FIFO_EMPTY_SWITCH          = 0x00000139,
-SC_PS_ARB_NULL_PRIM_BUBBLE_POP           = 0x0000013a,
-SC_PS_ARB_EOP_POP_SYNC_POP               = 0x0000013b,
-SC_PS_ARB_EVENT_SYNC_POP                 = 0x0000013c,
-SC_SC_PS_ENG_MULTICYCLE_BUBBLE           = 0x0000013d,
-SC_PA0_SC_FPOV_WE                        = 0x0000013e,
-SC_PA1_SC_FPOV_WE                        = 0x0000013f,
-SC_PA2_SC_FPOV_WE                        = 0x00000140,
-SC_PA3_SC_FPOV_WE                        = 0x00000141,
-SC_PA0_SC_LPOV_WE                        = 0x00000142,
-SC_PA1_SC_LPOV_WE                        = 0x00000143,
-SC_PA2_SC_LPOV_WE                        = 0x00000144,
-SC_PA3_SC_LPOV_WE                        = 0x00000145,
-SC_SC_SPI_DEALLOC_0_0                    = 0x00000146,
-SC_SC_SPI_DEALLOC_0_1                    = 0x00000147,
-SC_SC_SPI_DEALLOC_0_2                    = 0x00000148,
-SC_SC_SPI_DEALLOC_1_0                    = 0x00000149,
-SC_SC_SPI_DEALLOC_1_1                    = 0x0000014a,
-SC_SC_SPI_DEALLOC_1_2                    = 0x0000014b,
-SC_SC_SPI_DEALLOC_2_0                    = 0x0000014c,
-SC_SC_SPI_DEALLOC_2_1                    = 0x0000014d,
-SC_SC_SPI_DEALLOC_2_2                    = 0x0000014e,
-SC_SC_SPI_DEALLOC_3_0                    = 0x0000014f,
-SC_SC_SPI_DEALLOC_3_1                    = 0x00000150,
-SC_SC_SPI_DEALLOC_3_2                    = 0x00000151,
-SC_SC_SPI_FPOV_0                         = 0x00000152,
-SC_SC_SPI_FPOV_1                         = 0x00000153,
-SC_SC_SPI_FPOV_2                         = 0x00000154,
-SC_SC_SPI_FPOV_3                         = 0x00000155,
-SC_SC_SPI_EVENT                          = 0x00000156,
-SC_PS_TS_EVENT_FIFO_PUSH                 = 0x00000157,
-SC_PS_TS_EVENT_FIFO_POP                  = 0x00000158,
-SC_PS_CTX_DONE_FIFO_PUSH                 = 0x00000159,
-SC_PS_CTX_DONE_FIFO_POP                  = 0x0000015a,
-SC_MULTICYCLE_BUBBLE_FREEZE              = 0x0000015b,
-SC_EOP_SYNC_WINDOW                       = 0x0000015c,
-SC_PA0_SC_NULL_WE                        = 0x0000015d,
-SC_PA0_SC_NULL_DEALLOC_WE                = 0x0000015e,
-SC_PA0_SC_DATA_FIFO_EOPG_RD              = 0x0000015f,
-SC_PA0_SC_DATA_FIFO_EOP_RD               = 0x00000160,
-SC_PA0_SC_DEALLOC_0_RD                   = 0x00000161,
-SC_PA0_SC_DEALLOC_1_RD                   = 0x00000162,
-SC_PA1_SC_DATA_FIFO_EOPG_RD              = 0x00000163,
-SC_PA1_SC_DATA_FIFO_EOP_RD               = 0x00000164,
-SC_PA1_SC_DEALLOC_0_RD                   = 0x00000165,
-SC_PA1_SC_DEALLOC_1_RD                   = 0x00000166,
-SC_PA1_SC_NULL_WE                        = 0x00000167,
-SC_PA1_SC_NULL_DEALLOC_WE                = 0x00000168,
-SC_PA2_SC_DATA_FIFO_EOPG_RD              = 0x00000169,
-SC_PA2_SC_DATA_FIFO_EOP_RD               = 0x0000016a,
-SC_PA2_SC_DEALLOC_0_RD                   = 0x0000016b,
-SC_PA2_SC_DEALLOC_1_RD                   = 0x0000016c,
-SC_PA2_SC_NULL_WE                        = 0x0000016d,
-SC_PA2_SC_NULL_DEALLOC_WE                = 0x0000016e,
-SC_PA3_SC_DATA_FIFO_EOPG_RD              = 0x0000016f,
-SC_PA3_SC_DATA_FIFO_EOP_RD               = 0x00000170,
-SC_PA3_SC_DEALLOC_0_RD                   = 0x00000171,
-SC_PA3_SC_DEALLOC_1_RD                   = 0x00000172,
-SC_PA3_SC_NULL_WE                        = 0x00000173,
-SC_PA3_SC_NULL_DEALLOC_WE                = 0x00000174,
-SC_PS_PA0_SC_FIFO_EMPTY                  = 0x00000175,
-SC_PS_PA0_SC_FIFO_FULL                   = 0x00000176,
-SC_PA0_PS_DATA_SEND                      = 0x00000177,
-SC_PS_PA1_SC_FIFO_EMPTY                  = 0x00000178,
-SC_PS_PA1_SC_FIFO_FULL                   = 0x00000179,
-SC_PA1_PS_DATA_SEND                      = 0x0000017a,
-SC_PS_PA2_SC_FIFO_EMPTY                  = 0x0000017b,
-SC_PS_PA2_SC_FIFO_FULL                   = 0x0000017c,
-SC_PA2_PS_DATA_SEND                      = 0x0000017d,
-SC_PS_PA3_SC_FIFO_EMPTY                  = 0x0000017e,
-SC_PS_PA3_SC_FIFO_FULL                   = 0x0000017f,
-SC_PA3_PS_DATA_SEND                      = 0x00000180,
-SC_BUSY_PROCESSING_MULTICYCLE_PRIM       = 0x00000181,
-SC_BUSY_CNT_NOT_ZERO                     = 0x00000182,
-SC_BM_BUSY                               = 0x00000183,
-SC_BACKEND_BUSY                          = 0x00000184,
-SC_SCF_SCB_INTERFACE_BUSY                = 0x00000185,
-SC_SCB_BUSY                              = 0x00000186,
-SC_STARVED_BY_PA_WITH_UNSELECTED_PA_NOT_EMPTY  = 0x00000187,
-SC_STARVED_BY_PA_WITH_UNSELECTED_PA_FULL  = 0x00000188,
-SC_PBB_BIN_HIST_NUM_PRIMS                = 0x00000189,
-SC_PBB_BATCH_HIST_NUM_PRIMS              = 0x0000018a,
-SC_PBB_BIN_HIST_NUM_CONTEXTS             = 0x0000018b,
-SC_PBB_BATCH_HIST_NUM_CONTEXTS           = 0x0000018c,
-SC_PBB_BIN_HIST_NUM_PERSISTENT_STATES    = 0x0000018d,
-SC_PBB_BATCH_HIST_NUM_PERSISTENT_STATES  = 0x0000018e,
-SC_PBB_BATCH_HIST_NUM_PS_WAVE_BREAKS     = 0x0000018f,
-SC_PBB_BATCH_HIST_NUM_TRIV_REJECTED_PRIMS  = 0x00000190,
-SC_PBB_BATCH_HIST_NUM_ROWS_PER_PRIM      = 0x00000191,
-SC_PBB_BATCH_HIST_NUM_COLUMNS_PER_ROW    = 0x00000192,
-SC_PBB_BUSY                              = 0x00000193,
-SC_PBB_BUSY_AND_RTR                      = 0x00000194,
-SC_PBB_STALLS_PA_DUE_TO_NO_TILES         = 0x00000195,
-SC_PBB_NUM_BINS                          = 0x00000196,
-SC_PBB_END_OF_BIN                        = 0x00000197,
-SC_PBB_END_OF_BATCH                      = 0x00000198,
-SC_PBB_PRIMBIN_PROCESSED                 = 0x00000199,
-SC_PBB_PRIM_ADDED_TO_BATCH               = 0x0000019a,
-SC_PBB_NONBINNED_PRIM                    = 0x0000019b,
-SC_PBB_TOTAL_REAL_PRIMS_OUT_OF_PBB       = 0x0000019c,
-SC_PBB_TOTAL_NULL_PRIMS_OUT_OF_PBB       = 0x0000019d,
-SC_PBB_IDLE_CLK_DUE_TO_ROW_TO_COLUMN_TRANSITION  = 0x0000019e,
-SC_PBB_IDLE_CLK_DUE_TO_FALSE_POSITIVE_ON_ROW  = 0x0000019f,
-SC_PBB_IDLE_CLK_DUE_TO_FALSE_POSITIVE_ON_COLUMN  = 0x000001a0,
-SC_PBB_BATCH_BREAK_DUE_TO_PERSISTENT_STATE  = 0x000001a1,
-SC_PBB_BATCH_BREAK_DUE_TO_CONTEXT_STATE  = 0x000001a2,
-SC_PBB_BATCH_BREAK_DUE_TO_PRIM           = 0x000001a3,
-SC_PBB_BATCH_BREAK_DUE_TO_PC_STORAGE     = 0x000001a4,
-SC_PBB_BATCH_BREAK_DUE_TO_EVENT          = 0x000001a5,
-SC_PBB_BATCH_BREAK_DUE_TO_FPOV_LIMIT     = 0x000001a6,
-SC_POPS_INTRA_WAVE_OVERLAPS              = 0x000001a7,
-SC_POPS_FORCE_EOV                        = 0x000001a8,
-SC_PKR_QUAD_OVERLAP_NOT_FOUND_IN_WAVE_TABLE  = 0x000001a9,
-SC_PKR_QUAD_OVERLAP_FOUND_IN_WAVE_TABLE  = 0x000001aa,
-} SC_PERFCNT_SEL;
-
-/*
- * SePairXsel enum
- */
-
-typedef enum SePairXsel {
-RASTER_CONFIG_SE_PAIR_XSEL_8_WIDE_TILE   = 0x00000000,
-RASTER_CONFIG_SE_PAIR_XSEL_16_WIDE_TILE  = 0x00000001,
-RASTER_CONFIG_SE_PAIR_XSEL_32_WIDE_TILE  = 0x00000002,
-RASTER_CONFIG_SE_PAIR_XSEL_64_WIDE_TILE  = 0x00000003,
-RASTER_CONFIG_SE_PAIR_XSEL_128_WIDE_TILE  = 0x00000004,
-} SePairXsel;
-
-/*
- * SePairYsel enum
- */
-
-typedef enum SePairYsel {
-RASTER_CONFIG_SE_PAIR_YSEL_8_WIDE_TILE   = 0x00000000,
-RASTER_CONFIG_SE_PAIR_YSEL_16_WIDE_TILE  = 0x00000001,
-RASTER_CONFIG_SE_PAIR_YSEL_32_WIDE_TILE  = 0x00000002,
-RASTER_CONFIG_SE_PAIR_YSEL_64_WIDE_TILE  = 0x00000003,
-RASTER_CONFIG_SE_PAIR_YSEL_128_WIDE_TILE  = 0x00000004,
-} SePairYsel;
-
-/*
- * SePairMap enum
- */
-
-typedef enum SePairMap {
-RASTER_CONFIG_SE_PAIR_MAP_0              = 0x00000000,
-RASTER_CONFIG_SE_PAIR_MAP_1              = 0x00000001,
-RASTER_CONFIG_SE_PAIR_MAP_2              = 0x00000002,
-RASTER_CONFIG_SE_PAIR_MAP_3              = 0x00000003,
-} SePairMap;
-
-/*
- * SeXsel enum
- */
-
-typedef enum SeXsel {
-RASTER_CONFIG_SE_XSEL_8_WIDE_TILE        = 0x00000000,
-RASTER_CONFIG_SE_XSEL_16_WIDE_TILE       = 0x00000001,
-RASTER_CONFIG_SE_XSEL_32_WIDE_TILE       = 0x00000002,
-RASTER_CONFIG_SE_XSEL_64_WIDE_TILE       = 0x00000003,
-RASTER_CONFIG_SE_XSEL_128_WIDE_TILE      = 0x00000004,
-} SeXsel;
-
-/*
- * SeYsel enum
- */
-
-typedef enum SeYsel {
-RASTER_CONFIG_SE_YSEL_8_WIDE_TILE        = 0x00000000,
-RASTER_CONFIG_SE_YSEL_16_WIDE_TILE       = 0x00000001,
-RASTER_CONFIG_SE_YSEL_32_WIDE_TILE       = 0x00000002,
-RASTER_CONFIG_SE_YSEL_64_WIDE_TILE       = 0x00000003,
-RASTER_CONFIG_SE_YSEL_128_WIDE_TILE      = 0x00000004,
-} SeYsel;
-
-/*
- * SeMap enum
- */
-
-typedef enum SeMap {
-RASTER_CONFIG_SE_MAP_0                   = 0x00000000,
-RASTER_CONFIG_SE_MAP_1                   = 0x00000001,
-RASTER_CONFIG_SE_MAP_2                   = 0x00000002,
-RASTER_CONFIG_SE_MAP_3                   = 0x00000003,
-} SeMap;
-
-/*
- * ScXsel enum
- */
-
-typedef enum ScXsel {
-RASTER_CONFIG_SC_XSEL_8_WIDE_TILE        = 0x00000000,
-RASTER_CONFIG_SC_XSEL_16_WIDE_TILE       = 0x00000001,
-RASTER_CONFIG_SC_XSEL_32_WIDE_TILE       = 0x00000002,
-RASTER_CONFIG_SC_XSEL_64_WIDE_TILE       = 0x00000003,
-} ScXsel;
-
-/*
- * ScYsel enum
- */
-
-typedef enum ScYsel {
-RASTER_CONFIG_SC_YSEL_8_WIDE_TILE        = 0x00000000,
-RASTER_CONFIG_SC_YSEL_16_WIDE_TILE       = 0x00000001,
-RASTER_CONFIG_SC_YSEL_32_WIDE_TILE       = 0x00000002,
-RASTER_CONFIG_SC_YSEL_64_WIDE_TILE       = 0x00000003,
-} ScYsel;
-
-/*
- * ScMap enum
- */
-
-typedef enum ScMap {
-RASTER_CONFIG_SC_MAP_0                   = 0x00000000,
-RASTER_CONFIG_SC_MAP_1                   = 0x00000001,
-RASTER_CONFIG_SC_MAP_2                   = 0x00000002,
-RASTER_CONFIG_SC_MAP_3                   = 0x00000003,
-} ScMap;
-
-/*
- * PkrXsel2 enum
- */
-
-typedef enum PkrXsel2 {
-RASTER_CONFIG_PKR_XSEL2_0                = 0x00000000,
-RASTER_CONFIG_PKR_XSEL2_1                = 0x00000001,
-RASTER_CONFIG_PKR_XSEL2_2                = 0x00000002,
-RASTER_CONFIG_PKR_XSEL2_3                = 0x00000003,
-} PkrXsel2;
-
-/*
- * PkrXsel enum
- */
-
-typedef enum PkrXsel {
-RASTER_CONFIG_PKR_XSEL_0                 = 0x00000000,
-RASTER_CONFIG_PKR_XSEL_1                 = 0x00000001,
-RASTER_CONFIG_PKR_XSEL_2                 = 0x00000002,
-RASTER_CONFIG_PKR_XSEL_3                 = 0x00000003,
-} PkrXsel;
-
-/*
- * PkrYsel enum
- */
-
-typedef enum PkrYsel {
-RASTER_CONFIG_PKR_YSEL_0                 = 0x00000000,
-RASTER_CONFIG_PKR_YSEL_1                 = 0x00000001,
-RASTER_CONFIG_PKR_YSEL_2                 = 0x00000002,
-RASTER_CONFIG_PKR_YSEL_3                 = 0x00000003,
-} PkrYsel;
-
-/*
- * PkrMap enum
- */
-
-typedef enum PkrMap {
-RASTER_CONFIG_PKR_MAP_0                  = 0x00000000,
-RASTER_CONFIG_PKR_MAP_1                  = 0x00000001,
-RASTER_CONFIG_PKR_MAP_2                  = 0x00000002,
-RASTER_CONFIG_PKR_MAP_3                  = 0x00000003,
-} PkrMap;
-
-/*
- * RbXsel enum
- */
-
-typedef enum RbXsel {
-RASTER_CONFIG_RB_XSEL_0                  = 0x00000000,
-RASTER_CONFIG_RB_XSEL_1                  = 0x00000001,
-} RbXsel;
-
-/*
- * RbYsel enum
- */
-
-typedef enum RbYsel {
-RASTER_CONFIG_RB_YSEL_0                  = 0x00000000,
-RASTER_CONFIG_RB_YSEL_1                  = 0x00000001,
-} RbYsel;
-
-/*
- * RbXsel2 enum
- */
-
-typedef enum RbXsel2 {
-RASTER_CONFIG_RB_XSEL2_0                 = 0x00000000,
-RASTER_CONFIG_RB_XSEL2_1                 = 0x00000001,
-RASTER_CONFIG_RB_XSEL2_2                 = 0x00000002,
-RASTER_CONFIG_RB_XSEL2_3                 = 0x00000003,
-} RbXsel2;
-
-/*
- * RbMap enum
- */
-
-typedef enum RbMap {
-RASTER_CONFIG_RB_MAP_0                   = 0x00000000,
-RASTER_CONFIG_RB_MAP_1                   = 0x00000001,
-RASTER_CONFIG_RB_MAP_2                   = 0x00000002,
-RASTER_CONFIG_RB_MAP_3                   = 0x00000003,
-} RbMap;
-
-/*
- * BinningMode enum
- */
-
-typedef enum BinningMode {
-BINNING_ALLOWED                          = 0x00000000,
-FORCE_BINNING_ON                         = 0x00000001,
-DISABLE_BINNING_USE_NEW_SC               = 0x00000002,
-DISABLE_BINNING_USE_LEGACY_SC            = 0x00000003,
-} BinningMode;
-
-/*
- * BinEventCntl enum
- */
-
-typedef enum BinEventCntl {
-BINNER_BREAK_BATCH                       = 0x00000000,
-BINNER_PIPELINE                          = 0x00000001,
-BINNER_DROP_ASSERT                       = 0x00000002,
-} BinEventCntl;
-
-/*
- * CovToShaderSel enum
- */
-
-typedef enum CovToShaderSel {
-INPUT_COVERAGE                           = 0x00000000,
-INPUT_INNER_COVERAGE                     = 0x00000001,
-INPUT_DEPTH_COVERAGE                     = 0x00000002,
-RAW                                      = 0x00000003,
-} CovToShaderSel;
-
-/*******************************************************
- * RMI Enums
- *******************************************************/
-
-/*
- * RMIPerfSel enum
- */
-
-typedef enum RMIPerfSel {
-RMI_PERF_SEL_NONE                        = 0x00000000,
-RMI_PERF_SEL_BUSY                        = 0x00000001,
-RMI_PERF_SEL_REG_CLK_VLD                 = 0x00000002,
-RMI_PERF_SEL_DYN_CLK_CMN_VLD             = 0x00000003,
-RMI_PERF_SEL_DYN_CLK_RB_VLD              = 0x00000004,
-RMI_PERF_SEL_DYN_CLK_PERF_VLD            = 0x00000005,
-RMI_PERF_SEL_PERF_WINDOW                 = 0x00000006,
-RMI_PERF_SEL_EVENT_SEND                  = 0x00000007,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID0 = 0x00000008,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID1 = 0x00000009,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID2 = 0x0000000a,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID3 = 0x0000000b,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID4 = 0x0000000c,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID5 = 0x0000000d,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID6 = 0x0000000e,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID7 = 0x0000000f,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID8 = 0x00000010,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID9 = 0x00000011,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID10 = 0x00000012,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID11 = 0x00000013,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID12 = 0x00000014,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID13 = 0x00000015,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID14 = 0x00000016,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID15 = 0x00000017,
-RMI_PERF_SEL_RMI_INVALIDATION_ATC_REQ_VMID_ALL = 0x00000018,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID0 = 0x00000019,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID1 = 0x0000001a,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID2 = 0x0000001b,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID3 = 0x0000001c,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID4 = 0x0000001d,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID5 = 0x0000001e,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID6 = 0x0000001f,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID7 = 0x00000020,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID8 = 0x00000021,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID9 = 0x00000022,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID10 = 0x00000023,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID11 = 0x00000024,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID12 = 0x00000025,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID13 = 0x00000026,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID14 = 0x00000027,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID15 = 0x00000028,
-RMI_PERF_SEL_RMI_INVALIDATION_REQ_START_FINISH_VMID_ALL = 0x00000029,
-RMI_PERF_SEL_UTCL1_TRANSLATION_MISS      = 0x0000002a,
-RMI_PERF_SEL_UTCL1_PERMISSION_MISS       = 0x0000002b,
-RMI_PERF_SEL_UTCL1_REQUEST               = 0x0000002c,
-RMI_PERF_SEL_UTCL1_STALL_INFLIGHT_MAX    = 0x0000002d,
-RMI_PERF_SEL_UTCL1_STALL_LRU_INFLIGHT    = 0x0000002e,
-RMI_PERF_SEL_UTCL1_LFIFO_FULL            = 0x0000002f,
-RMI_PERF_SEL_UTCL1_STALL_LFIFO_NOT_RES   = 0x00000030,
-RMI_PERF_SEL_UTCL1_STALL_UTCL2_REQ_OUT_OF_CREDITS  = 0x00000031,
-RMI_PERF_SEL_UTCL1_STALL_MISSFIFO_FULL   = 0x00000032,
-RMI_PERF_SEL_UTCL1_HIT_FIFO_FULL         = 0x00000033,
-RMI_PERF_SEL_UTCL1_STALL_MULTI_MISS      = 0x00000034,
-RMI_PERF_SEL_RB_RMI_WRREQ_ALL_CID        = 0x00000035,
-RMI_PERF_SEL_RB_RMI_WRREQ_BUSY           = 0x00000036,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID0           = 0x00000037,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID1           = 0x00000038,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID2           = 0x00000039,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID3           = 0x0000003a,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID4           = 0x0000003b,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID5           = 0x0000003c,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID6           = 0x0000003d,
-RMI_PERF_SEL_RB_RMI_WRREQ_CID7           = 0x0000003e,
-RMI_PERF_SEL_RB_RMI_WRREQ_INFLIGHT_ALL_ORONE_CID = 0x0000003f,
-RMI_PERF_SEL_RB_RMI_WRREQ_BURST_LENGTH_ALL_ORONE_CID = 0x00000040,
-RMI_PERF_SEL_RB_RMI_WRREQ_BURST_ALL_ORONE_CID = 0x00000041,
-RMI_PERF_SEL_RB_RMI_WRREQ_RESIDENCY      = 0x00000042,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_ALL_CID  = 0x00000043,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID0     = 0x00000044,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID1     = 0x00000045,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID2     = 0x00000046,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID3     = 0x00000047,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID4     = 0x00000048,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID5     = 0x00000049,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID6     = 0x0000004a,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_CID7     = 0x0000004b,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_NACK0    = 0x0000004c,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_NACK1    = 0x0000004d,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_NACK2    = 0x0000004e,
-RMI_PERF_SEL_RMI_RB_WRRET_VALID_NACK3    = 0x0000004f,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_ALL_CID     = 0x00000050,
-RMI_PERF_SEL_RB_RMI_RDREQ_ALL_CID        = 0x00000051,
-RMI_PERF_SEL_RB_RMI_RDREQ_BUSY           = 0x00000052,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID0        = 0x00000053,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID1        = 0x00000054,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID2        = 0x00000055,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID3        = 0x00000056,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID4        = 0x00000057,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID5        = 0x00000058,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID6        = 0x00000059,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_CID7        = 0x0000005a,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID0           = 0x0000005b,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID1           = 0x0000005c,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID2           = 0x0000005d,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID3           = 0x0000005e,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID4           = 0x0000005f,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID5           = 0x00000060,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID6           = 0x00000061,
-RMI_PERF_SEL_RB_RMI_RDREQ_CID7           = 0x00000062,
-RMI_PERF_SEL_RB_RMI_32BRDREQ_INFLIGHT_ALL_ORONE_CID = 0x00000063,
-RMI_PERF_SEL_RB_RMI_RDREQ_BURST_LENGTH_ALL_ORONE_CID = 0x00000064,
-RMI_PERF_SEL_RB_RMI_RDREQ_BURST_ALL_ORONE_CID = 0x00000065,
-RMI_PERF_SEL_RB_RMI_RDREQ_RESIDENCY      = 0x00000066,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_ALL_CID = 0x00000067,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID0  = 0x00000068,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID1  = 0x00000069,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID2  = 0x0000006a,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID3  = 0x0000006b,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID4  = 0x0000006c,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID5  = 0x0000006d,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID6  = 0x0000006e,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_CID7  = 0x0000006f,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_NACK0 = 0x00000070,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_NACK1 = 0x00000071,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_NACK2 = 0x00000072,
-RMI_PERF_SEL_RMI_RB_32BRDRET_VALID_NACK3 = 0x00000073,
-RMI_PERF_SEL_RMI_TC_WRREQ_ALL_CID        = 0x00000074,
-RMI_PERF_SEL_RMI_TC_REQ_BUSY             = 0x00000075,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID0           = 0x00000076,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID1           = 0x00000077,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID2           = 0x00000078,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID3           = 0x00000079,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID4           = 0x0000007a,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID5           = 0x0000007b,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID6           = 0x0000007c,
-RMI_PERF_SEL_RMI_TC_WRREQ_CID7           = 0x0000007d,
-RMI_PERF_SEL_RMI_TC_WRREQ_INFLIGHT_ALL_CID = 0x0000007e,
-RMI_PERF_SEL_TC_RMI_WRRET_VALID_ALL_CID  = 0x0000007f,
-RMI_PERF_SEL_RMI_TC_RDREQ_ALL_CID        = 0x00000080,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID0           = 0x00000081,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID1           = 0x00000082,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID2           = 0x00000083,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID3           = 0x00000084,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID4           = 0x00000085,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID5           = 0x00000086,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID6           = 0x00000087,
-RMI_PERF_SEL_RMI_TC_RDREQ_CID7           = 0x00000088,
-RMI_PERF_SEL_RMI_TC_RDREQ_INFLIGHT_ALL_CID = 0x00000089,
-RMI_PERF_SEL_TC_RMI_RDRET_VALID_ALL_CID  = 0x0000008a,
-RMI_PERF_SEL_UTCL1_BUSY                  = 0x0000008b,
-RMI_PERF_SEL_RMI_UTC_REQ                 = 0x0000008c,
-RMI_PERF_SEL_RMI_UTC_BUSY                = 0x0000008d,
-RMI_PERF_SEL_UTCL1_UTCL2_REQ             = 0x0000008e,
-RMI_PERF_SEL_PROBE_UTCL1_XNACK_RETRY     = 0x0000008f,
-RMI_PERF_SEL_PROBE_UTCL1_ALL_FAULT       = 0x00000090,
-RMI_PERF_SEL_PROBE_UTCL1_PRT_FAULT       = 0x00000091,
-RMI_PERF_SEL_PROBE_UTCL1_VMID_BYPASS     = 0x00000092,
-RMI_PERF_SEL_PROBE_UTCL1_XNACK_NORETRY_FAULT = 0x00000093,
-RMI_PERF_SEL_XNACK_FIFO_NUM_USED         = 0x00000094,
-RMI_PERF_SEL_LAT_FIFO_NUM_USED           = 0x00000095,
-RMI_PERF_SEL_LAT_FIFO_BLOCKING_REQ       = 0x00000096,
-RMI_PERF_SEL_LAT_FIFO_NONBLOCKING_REQ    = 0x00000097,
-RMI_PERF_SEL_XNACK_FIFO_FULL             = 0x00000098,
-RMI_PERF_SEL_XNACK_FIFO_BUSY             = 0x00000099,
-RMI_PERF_SEL_LAT_FIFO_FULL               = 0x0000009a,
-RMI_PERF_SEL_SKID_FIFO_DEPTH             = 0x0000009b,
-RMI_PERF_SEL_TCIW_INFLIGHT_COUNT         = 0x0000009c,
-RMI_PERF_SEL_PRT_FIFO_NUM_USED           = 0x0000009d,
-RMI_PERF_SEL_PRT_FIFO_REQ                = 0x0000009e,
-RMI_PERF_SEL_PRT_FIFO_BUSY               = 0x0000009f,
-RMI_PERF_SEL_TCIW_REQ                    = 0x000000a0,
-RMI_PERF_SEL_TCIW_BUSY                   = 0x000000a1,
-RMI_PERF_SEL_SKID_FIFO_REQ               = 0x000000a2,
-RMI_PERF_SEL_SKID_FIFO_BUSY              = 0x000000a3,
-RMI_PERF_SEL_DEMUX_TCIW_RESIDENCY_NACK0  = 0x000000a4,
-RMI_PERF_SEL_DEMUX_TCIW_RESIDENCY_NACK1  = 0x000000a5,
-RMI_PERF_SEL_DEMUX_TCIW_RESIDENCY_NACK2  = 0x000000a6,
-RMI_PERF_SEL_DEMUX_TCIW_RESIDENCY_NACK3  = 0x000000a7,
-RMI_PERF_SEL_XBAR_PROBEGEN_RTS_RTR       = 0x000000a8,
-RMI_PERF_SEL_XBAR_PROBEGEN_RTSB_RTR      = 0x000000a9,
-RMI_PERF_SEL_XBAR_PROBEGEN_RTS_RTRB      = 0x000000aa,
-RMI_PERF_SEL_XBAR_PROBEGEN_RTSB_RTRB     = 0x000000ab,
-RMI_PERF_SEL_DEMUX_TCIW_FORMATTER_RTS_RTR = 0x000000ac,
-RMI_PERF_SEL_DEMUX_TCIW_FORMATTER_RTSB_RTR = 0x000000ad,
-RMI_PERF_SEL_DEMUX_TCIW_FORMATTER_RTS_RTRB = 0x000000ae,
-RMI_PERF_SEL_DEMUX_TCIW_FORMATTER_RTSB_RTRB = 0x000000af,
-RMI_PERF_SEL_WRREQCONSUMER_XBAR_WRREQ_RTS_RTR = 0x000000b0,
-RMI_PERF_SEL_WRREQCONSUMER_XBAR_WRREQ_RTSB_RTR = 0x000000b1,
-RMI_PERF_SEL_WRREQCONSUMER_XBAR_WRREQ_RTS_RTRB = 0x000000b2,
-RMI_PERF_SEL_WRREQCONSUMER_XBAR_WRREQ_RTSB_RTRB = 0x000000b3,
-RMI_PERF_SEL_RDREQCONSUMER_XBAR_RDREQ_RTS_RTR = 0x000000b4,
-RMI_PERF_SEL_RDREQCONSUMER_XBAR_RDREQ_RTSB_RTR = 0x000000b5,
-RMI_PERF_SEL_RDREQCONSUMER_XBAR_RDREQ_RTS_RTRB = 0x000000b6,
-RMI_PERF_SEL_RDREQCONSUMER_XBAR_RDREQ_RTSB_RTRB = 0x000000b7,
-RMI_PERF_SEL_POP_DEMUX_RTS_RTR           = 0x000000b8,
-RMI_PERF_SEL_POP_DEMUX_RTSB_RTR          = 0x000000b9,
-RMI_PERF_SEL_POP_DEMUX_RTS_RTRB          = 0x000000ba,
-RMI_PERF_SEL_POP_DEMUX_RTSB_RTRB         = 0x000000bb,
-RMI_PERF_SEL_PROBEGEN_UTC_RTS_RTR        = 0x000000bc,
-RMI_PERF_SEL_PROBEGEN_UTC_RTSB_RTR       = 0x000000bd,
-RMI_PERF_SEL_PROBEGEN_UTC_RTS_RTRB       = 0x000000be,
-RMI_PERF_SEL_PROBEGEN_UTC_RTSB_RTRB      = 0x000000bf,
-RMI_PERF_SEL_UTC_POP_RTS_RTR             = 0x000000c0,
-RMI_PERF_SEL_UTC_POP_RTSB_RTR            = 0x000000c1,
-RMI_PERF_SEL_UTC_POP_RTS_RTRB            = 0x000000c2,
-RMI_PERF_SEL_UTC_POP_RTSB_RTRB           = 0x000000c3,
-RMI_PERF_SEL_POP_XNACK_RTS_RTR           = 0x000000c4,
-RMI_PERF_SEL_POP_XNACK_RTSB_RTR          = 0x000000c5,
-RMI_PERF_SEL_POP_XNACK_RTS_RTRB          = 0x000000c6,
-RMI_PERF_SEL_POP_XNACK_RTSB_RTRB         = 0x000000c7,
-RMI_PERF_SEL_XNACK_PROBEGEN_RTS_RTR      = 0x000000c8,
-RMI_PERF_SEL_XNACK_PROBEGEN_RTSB_RTR     = 0x000000c9,
-RMI_PERF_SEL_XNACK_PROBEGEN_RTS_RTRB     = 0x000000ca,
-RMI_PERF_SEL_XNACK_PROBEGEN_RTSB_RTRB    = 0x000000cb,
-RMI_PERF_SEL_PRTFIFO_RTNFORMATTER_RTS_RTR = 0x000000cc,
-RMI_PERF_SEL_PRTFIFO_RTNFORMATTER_RTSB_RTR = 0x000000cd,
-RMI_PERF_SEL_PRTFIFO_RTNFORMATTER_RTS_RTRB = 0x000000ce,
-RMI_PERF_SEL_PRTFIFO_RTNFORMATTER_RTSB_RTRB = 0x000000cf,
-RMI_PERF_SEL_SKID_FIFO_IN_RTS            = 0x000000d0,
-RMI_PERF_SEL_SKID_FIFO_IN_RTSB           = 0x000000d1,
-RMI_PERF_SEL_SKID_FIFO_OUT_RTS           = 0x000000d2,
-RMI_PERF_SEL_SKID_FIFO_OUT_RTSB          = 0x000000d3,
-RMI_PERF_SEL_XBAR_PROBEGEN_READ_RTS_RTR  = 0x000000d4,
-RMI_PERF_SEL_XBAR_PROBEGEN_WRITE_RTS_RTR = 0x000000d5,
-RMI_PERF_SEL_XBAR_PROBEGEN_IN0_RTS_RTR   = 0x000000d6,
-RMI_PERF_SEL_XBAR_PROBEGEN_IN1_RTS_RTR   = 0x000000d7,
-RMI_PERF_SEL_XBAR_PROBEGEN_CB_RTS_RTR    = 0x000000d8,
-RMI_PERF_SEL_XBAR_PROBEGEN_DB_RTS_RTR    = 0x000000d9,
-RMI_PERF_SEL_REORDER_FIFO_REQ            = 0x000000da,
-RMI_PERF_SEL_REORDER_FIFO_BUSY           = 0x000000db,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_ALL_CID  = 0x000000dc,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID0     = 0x000000dd,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID1     = 0x000000de,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID2     = 0x000000df,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID3     = 0x000000e0,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID4     = 0x000000e1,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID5     = 0x000000e2,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID6     = 0x000000e3,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_CID7     = 0x000000e4,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_NACK0    = 0x000000e5,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_NACK1    = 0x000000e6,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_NACK2    = 0x000000e7,
-RMI_PERF_SEL_RMI_RB_EARLY_WRACK_NACK3    = 0x000000e8,
-} RMIPerfSel;
-
-
-#endif /*_vega10_ENUM_HEADER*/
-
diff --git a/src/amd/addrlib/gfx9/coord.cpp b/src/amd/addrlib/gfx9/coord.cpp
deleted file mode 100644 (file)
index 228d8f1..0000000
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * 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.
- */
-
-// Coordinate class implementation
-#include "addrcommon.h"
-#include "coord.h"
-
-Coordinate::Coordinate()
-{
-    dim = 'x';
-    ord = 0;
-}
-
-Coordinate::Coordinate(INT_8 c, INT_32 n)
-{
-    set(c, n);
-}
-
-VOID Coordinate::set(INT_8 c, INT_32 n)
-{
-    dim = c;
-    ord = static_cast<INT_8>(n);
-}
-
-UINT_32 Coordinate::ison(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
-{
-    UINT_32 bit = static_cast<UINT_32>(1ull << static_cast<UINT_32>(ord));
-    UINT_32 out = 0;
-
-    switch (dim)
-    {
-    case 'm': out = m & bit; break;
-    case 's': out = s & bit; break;
-    case 'x': out = x & bit; break;
-    case 'y': out = y & bit; break;
-    case 'z': out = z & bit; break;
-    }
-    return (out != 0) ? 1 : 0;
-}
-
-INT_8 Coordinate::getdim()
-{
-    return dim;
-}
-
-INT_8 Coordinate::getord()
-{
-    return ord;
-}
-
-BOOL_32 Coordinate::operator==(const Coordinate& b)
-{
-    return (dim == b.dim) && (ord == b.ord);
-}
-
-BOOL_32 Coordinate::operator<(const Coordinate& b)
-{
-    BOOL_32 ret;
-
-    if (dim == b.dim)
-    {
-        ret = ord < b.ord;
-    }
-    else
-    {
-        if (dim == 's' || b.dim == 'm')
-        {
-            ret = TRUE;
-        }
-        else if (b.dim == 's' || dim == 'm')
-        {
-            ret = FALSE;
-        }
-        else if (ord == b.ord)
-        {
-            ret = dim < b.dim;
-        }
-        else
-        {
-            ret = ord < b.ord;
-        }
-    }
-
-    return ret;
-}
-
-BOOL_32 Coordinate::operator>(const Coordinate& b)
-{
-    BOOL_32 lt = *this < b;
-    BOOL_32 eq = *this == b;
-    return !lt && !eq;
-}
-
-BOOL_32 Coordinate::operator<=(const Coordinate& b)
-{
-    return (*this < b) || (*this == b);
-}
-
-BOOL_32 Coordinate::operator>=(const Coordinate& b)
-{
-    return !(*this < b);
-}
-
-BOOL_32 Coordinate::operator!=(const Coordinate& b)
-{
-    return !(*this == b);
-}
-
-Coordinate& Coordinate::operator++(INT_32)
-{
-    ord++;
-    return *this;
-}
-
-// CoordTerm
-
-CoordTerm::CoordTerm()
-{
-    num_coords = 0;
-}
-
-VOID CoordTerm::Clear()
-{
-    num_coords = 0;
-}
-
-VOID CoordTerm::add(Coordinate& co)
-{
-    // This function adds a coordinate INT_32o the list
-    // It will prevent the same coordinate from appearing,
-    // and will keep the list ordered from smallest to largest
-    UINT_32 i;
-
-    for (i = 0; i < num_coords; i++)
-    {
-        if (m_coord[i] == co)
-        {
-            break;
-        }
-        if (m_coord[i] > co)
-        {
-            for (UINT_32 j = num_coords; j > i; j--)
-            {
-                m_coord[j] = m_coord[j - 1];
-            }
-            m_coord[i] = co;
-            num_coords++;
-            break;
-        }
-    }
-
-    if (i == num_coords)
-    {
-        m_coord[num_coords] = co;
-        num_coords++;
-    }
-}
-
-VOID CoordTerm::add(CoordTerm& cl)
-{
-    for (UINT_32 i = 0; i < cl.num_coords; i++)
-    {
-        add(cl.m_coord[i]);
-    }
-}
-
-BOOL_32 CoordTerm::remove(Coordinate& co)
-{
-    BOOL_32 remove = FALSE;
-    for (UINT_32 i = 0; i < num_coords; i++)
-    {
-        if (m_coord[i] == co)
-        {
-            remove = TRUE;
-            num_coords--;
-        }
-
-        if (remove)
-        {
-            m_coord[i] = m_coord[i + 1];
-        }
-    }
-    return remove;
-}
-
-BOOL_32 CoordTerm::Exists(Coordinate& co)
-{
-    BOOL_32 exists = FALSE;
-    for (UINT_32 i = 0; i < num_coords; i++)
-    {
-        if (m_coord[i] == co)
-        {
-            exists = TRUE;
-            break;
-        }
-    }
-    return exists;
-}
-
-VOID CoordTerm::copyto(CoordTerm& cl)
-{
-    cl.num_coords = num_coords;
-    for (UINT_32 i = 0; i < num_coords; i++)
-    {
-        cl.m_coord[i] = m_coord[i];
-    }
-}
-
-UINT_32 CoordTerm::getsize()
-{
-    return num_coords;
-}
-
-UINT_32 CoordTerm::getxor(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
-{
-    UINT_32 out = 0;
-    for (UINT_32 i = 0; i < num_coords; i++)
-    {
-        out = out ^ m_coord[i].ison(x, y, z, s, m);
-    }
-    return out;
-}
-
-VOID CoordTerm::getsmallest(Coordinate& co)
-{
-    co = m_coord[0];
-}
-
-UINT_32 CoordTerm::Filter(INT_8 f, Coordinate& co, UINT_32 start, INT_8 axis)
-{
-    for (UINT_32 i = start;  i < num_coords;)
-    {
-        if (((f == '<' && m_coord[i] < co) ||
-             (f == '>' && m_coord[i] > co) ||
-             (f == '=' && m_coord[i] == co)) &&
-            (axis == '\0' || axis == m_coord[i].getdim()))
-        {
-            for (UINT_32 j = i; j < num_coords - 1; j++)
-            {
-                m_coord[j] = m_coord[j + 1];
-            }
-            num_coords--;
-        }
-        else
-        {
-            i++;
-        }
-    }
-    return num_coords;
-}
-
-Coordinate& CoordTerm::operator[](UINT_32 i)
-{
-    return m_coord[i];
-}
-
-BOOL_32 CoordTerm::operator==(const CoordTerm& b)
-{
-    BOOL_32 ret = TRUE;
-
-    if (num_coords != b.num_coords)
-    {
-        ret = FALSE;
-    }
-    else
-    {
-        for (UINT_32 i = 0; i < num_coords; i++)
-        {
-            // Note: the lists will always be in order, so we can compare the two lists at time
-            if (m_coord[i] != b.m_coord[i])
-            {
-                ret = FALSE;
-                break;
-            }
-        }
-    }
-    return ret;
-}
-
-BOOL_32 CoordTerm::operator!=(const CoordTerm& b)
-{
-    return !(*this == b);
-}
-
-BOOL_32 CoordTerm::exceedRange(UINT_32 xRange, UINT_32 yRange, UINT_32 zRange, UINT_32 sRange)
-{
-    BOOL_32 exceed = FALSE;
-    for (UINT_32 i = 0; (i < num_coords) && (exceed == FALSE); i++)
-    {
-        UINT_32 subject;
-        switch (m_coord[i].getdim())
-        {
-            case 'x':
-                subject = xRange;
-                break;
-            case 'y':
-                subject = yRange;
-                break;
-            case 'z':
-                subject = zRange;
-                break;
-            case 's':
-                subject = sRange;
-                break;
-            case 'm':
-                subject = 0;
-                break;
-            default:
-                // Invalid input!
-                ADDR_ASSERT_ALWAYS();
-                subject = 0;
-                break;
-        }
-
-        exceed = ((1u << m_coord[i].getord()) <= subject);
-    }
-
-    return exceed;
-}
-
-// coordeq
-CoordEq::CoordEq()
-{
-    m_numBits = 0;
-}
-
-VOID CoordEq::remove(Coordinate& co)
-{
-    for (UINT_32 i = 0; i < m_numBits; i++)
-    {
-        m_eq[i].remove(co);
-    }
-}
-
-BOOL_32 CoordEq::Exists(Coordinate& co)
-{
-    BOOL_32 exists = FALSE;
-
-    for (UINT_32 i = 0; i < m_numBits; i++)
-    {
-        if (m_eq[i].Exists(co))
-        {
-            exists = TRUE;
-        }
-    }
-    return exists;
-}
-
-VOID CoordEq::resize(UINT_32 n)
-{
-    if (n > m_numBits)
-    {
-        for (UINT_32 i = m_numBits; i < n; i++)
-        {
-            m_eq[i].Clear();
-        }
-    }
-    m_numBits = n;
-}
-
-UINT_32 CoordEq::getsize()
-{
-    return m_numBits;
-}
-
-UINT_64 CoordEq::solve(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
-{
-    UINT_64 out = 0;
-    for (UINT_32 i = 0; i < m_numBits; i++)
-    {
-        if (m_eq[i].getxor(x, y, z, s, m) != 0)
-        {
-            out |= (1ULL << i);
-        }
-    }
-    return out;
-}
-
-VOID CoordEq::solveAddr(
-    UINT_64 addr, UINT_32 sliceInM,
-    UINT_32& x, UINT_32& y, UINT_32& z, UINT_32& s, UINT_32& m) const
-{
-    UINT_32 xBitsValid = 0;
-    UINT_32 yBitsValid = 0;
-    UINT_32 zBitsValid = 0;
-    UINT_32 sBitsValid = 0;
-    UINT_32 mBitsValid = 0;
-
-    CoordEq temp = *this;
-
-    x = y = z = s = m = 0;
-
-    UINT_32 bitsLeft = 0;
-
-    for (UINT_32 i = 0; i < temp.m_numBits; i++)
-    {
-        UINT_32 termSize = temp.m_eq[i].getsize();
-
-        if (termSize == 1)
-        {
-            INT_8 bit = (addr >> i) & 1;
-            INT_8 dim = temp.m_eq[i][0].getdim();
-            INT_8 ord = temp.m_eq[i][0].getord();
-
-            ADDR_ASSERT((ord < 32) || (bit == 0));
-
-            switch (dim)
-            {
-                case 'x':
-                    xBitsValid |= (1 << ord);
-                    x |= (bit << ord);
-                    break;
-                case 'y':
-                    yBitsValid |= (1 << ord);
-                    y |= (bit << ord);
-                    break;
-                case 'z':
-                    zBitsValid |= (1 << ord);
-                    z |= (bit << ord);
-                    break;
-                case 's':
-                    sBitsValid |= (1 << ord);
-                    s |= (bit << ord);
-                    break;
-                case 'm':
-                    mBitsValid |= (1 << ord);
-                    m |= (bit << ord);
-                    break;
-                default:
-                    break;
-            }
-
-            temp.m_eq[i].Clear();
-        }
-        else if (termSize > 1)
-        {
-            bitsLeft++;
-        }
-    }
-
-    if (bitsLeft > 0)
-    {
-        if (sliceInM != 0)
-        {
-            z = m / sliceInM;
-            zBitsValid = 0xffffffff;
-        }
-
-        do
-        {
-            bitsLeft = 0;
-
-            for (UINT_32 i = 0; i < temp.m_numBits; i++)
-            {
-                UINT_32 termSize = temp.m_eq[i].getsize();
-
-                if (termSize == 1)
-                {
-                    INT_8 bit = (addr >> i) & 1;
-                    INT_8 dim = temp.m_eq[i][0].getdim();
-                    INT_8 ord = temp.m_eq[i][0].getord();
-
-                    ADDR_ASSERT((ord < 32) || (bit == 0));
-
-                    switch (dim)
-                    {
-                        case 'x':
-                            xBitsValid |= (1 << ord);
-                            x |= (bit << ord);
-                            break;
-                        case 'y':
-                            yBitsValid |= (1 << ord);
-                            y |= (bit << ord);
-                            break;
-                        case 'z':
-                            zBitsValid |= (1 << ord);
-                            z |= (bit << ord);
-                            break;
-                        case 's':
-                            ADDR_ASSERT_ALWAYS();
-                            break;
-                        case 'm':
-                            ADDR_ASSERT_ALWAYS();
-                            break;
-                        default:
-                            break;
-                    }
-
-                    temp.m_eq[i].Clear();
-                }
-                else if (termSize > 1)
-                {
-                    CoordTerm tmpTerm = temp.m_eq[i];
-
-                    for (UINT_32 j = 0; j < termSize; j++)
-                    {
-                        INT_8 dim = temp.m_eq[i][j].getdim();
-                        INT_8 ord = temp.m_eq[i][j].getord();
-
-                        switch (dim)
-                        {
-                            case 'x':
-                                if (xBitsValid & (1 << ord))
-                                {
-                                    UINT_32 v = (((x >> ord) & 1) << i);
-                                    addr ^= static_cast<UINT_64>(v);
-                                    tmpTerm.remove(temp.m_eq[i][j]);
-                                }
-                                break;
-                            case 'y':
-                                if (yBitsValid & (1 << ord))
-                                {
-                                    UINT_32 v = (((y >> ord) & 1) << i);
-                                    addr ^= static_cast<UINT_64>(v);
-                                    tmpTerm.remove(temp.m_eq[i][j]);
-                                }
-                                break;
-                            case 'z':
-                                if (zBitsValid & (1 << ord))
-                                {
-                                    UINT_32 v = (((z >> ord) & 1) << i);
-                                    addr ^= static_cast<UINT_64>(v);
-                                    tmpTerm.remove(temp.m_eq[i][j]);
-                                }
-                                break;
-                            case 's':
-                                ADDR_ASSERT_ALWAYS();
-                                break;
-                            case 'm':
-                                ADDR_ASSERT_ALWAYS();
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-
-                    temp.m_eq[i] = tmpTerm;
-
-                    bitsLeft++;
-                }
-            }
-        } while (bitsLeft > 0);
-    }
-}
-
-VOID CoordEq::copy(CoordEq& o, UINT_32 start, UINT_32 num)
-{
-    o.m_numBits = (num == 0xFFFFFFFF) ? m_numBits : num;
-    for (UINT_32 i = 0; i < o.m_numBits; i++)
-    {
-        m_eq[start + i].copyto(o.m_eq[i]);
-    }
-}
-
-VOID CoordEq::reverse(UINT_32 start, UINT_32 num)
-{
-    UINT_32 n = (num == 0xFFFFFFFF) ? m_numBits : num;
-
-    for (UINT_32 i = 0; i < n / 2; i++)
-    {
-        CoordTerm temp;
-        m_eq[start + i].copyto(temp);
-        m_eq[start + n - 1 - i].copyto(m_eq[start + i]);
-        temp.copyto(m_eq[start + n - 1 - i]);
-    }
-}
-
-VOID CoordEq::xorin(CoordEq& x, UINT_32 start)
-{
-    UINT_32 n = ((m_numBits - start) < x.m_numBits) ? (m_numBits - start) : x.m_numBits;
-    for (UINT_32 i = 0; i < n; i++)
-    {
-        m_eq[start + i].add(x.m_eq[i]);
-    }
-}
-
-UINT_32 CoordEq::Filter(INT_8 f, Coordinate& co, UINT_32 start, INT_8 axis)
-{
-    for (UINT_32 i = start; i < m_numBits;)
-    {
-        UINT_32 m = m_eq[i].Filter(f, co, 0, axis);
-        if (m == 0)
-        {
-            for (UINT_32 j = i; j < m_numBits - 1; j++)
-            {
-                m_eq[j] = m_eq[j + 1];
-            }
-            m_numBits--;
-        }
-        else
-        {
-            i++;
-        }
-    }
-    return m_numBits;
-}
-
-VOID CoordEq::shift(INT_32 amount, INT_32 start)
-{
-    if (amount != 0)
-    {
-        INT_32 numBits = static_cast<INT_32>(m_numBits);
-        amount = -amount;
-        INT_32 inc = (amount < 0) ? -1 : 1;
-        INT_32 i = (amount < 0) ? numBits - 1 : start;
-        INT_32 end = (amount < 0) ? start - 1 : numBits;
-        for (; (inc > 0) ? i < end : i > end; i += inc)
-        {
-            if ((i + amount < start) || (i + amount >= numBits))
-            {
-                m_eq[i].Clear();
-            }
-            else
-            {
-                m_eq[i + amount].copyto(m_eq[i]);
-            }
-        }
-    }
-}
-
-CoordTerm& CoordEq::operator[](UINT_32 i)
-{
-    return m_eq[i];
-}
-
-VOID CoordEq::mort2d(Coordinate& c0, Coordinate& c1, UINT_32 start, UINT_32 end)
-{
-    if (end == 0)
-    {
-        ADDR_ASSERT(m_numBits > 0);
-        end = m_numBits - 1;
-    }
-    for (UINT_32 i = start; i <= end; i++)
-    {
-        UINT_32 select = (i - start) % 2;
-        Coordinate& c = (select == 0) ? c0 : c1;
-        m_eq[i].add(c);
-        c++;
-    }
-}
-
-VOID CoordEq::mort3d(Coordinate& c0, Coordinate& c1, Coordinate& c2, UINT_32 start, UINT_32 end)
-{
-    if (end == 0)
-    {
-        ADDR_ASSERT(m_numBits > 0);
-        end = m_numBits - 1;
-    }
-    for (UINT_32 i = start; i <= end; i++)
-    {
-        UINT_32 select = (i - start) % 3;
-        Coordinate& c = (select == 0) ? c0 : ((select == 1) ? c1 : c2);
-        m_eq[i].add(c);
-        c++;
-    }
-}
-
-BOOL_32 CoordEq::operator==(const CoordEq& b)
-{
-    BOOL_32 ret = TRUE;
-
-    if (m_numBits != b.m_numBits)
-    {
-        ret = FALSE;
-    }
-    else
-    {
-        for (UINT_32 i = 0; i < m_numBits; i++)
-        {
-            if (m_eq[i] != b.m_eq[i])
-            {
-                ret = FALSE;
-                break;
-            }
-        }
-    }
-    return ret;
-}
-
-BOOL_32 CoordEq::operator!=(const CoordEq& b)
-{
-    return !(*this == b);
-}
-
diff --git a/src/amd/addrlib/gfx9/coord.h b/src/amd/addrlib/gfx9/coord.h
deleted file mode 100644 (file)
index 4243d30..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-
-// Class used to define a coordinate bit
-
-#ifndef __COORD_H
-#define __COORD_H
-
-class Coordinate
-{
-public:
-    Coordinate();
-    Coordinate(INT_8 c, INT_32 n);
-
-    VOID set(INT_8 c, INT_32 n);
-    UINT_32 ison(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
-    INT_8   getdim();
-    INT_8   getord();
-
-    BOOL_32 operator==(const Coordinate& b);
-    BOOL_32 operator<(const Coordinate& b);
-    BOOL_32 operator>(const Coordinate& b);
-    BOOL_32 operator<=(const Coordinate& b);
-    BOOL_32 operator>=(const Coordinate& b);
-    BOOL_32 operator!=(const Coordinate& b);
-    Coordinate& operator++(INT_32);
-
-private:
-    INT_8 dim;
-    INT_8 ord;
-};
-
-class CoordTerm
-{
-public:
-    CoordTerm();
-    VOID Clear();
-    VOID add(Coordinate& co);
-    VOID add(CoordTerm& cl);
-    BOOL_32 remove(Coordinate& co);
-    BOOL_32 Exists(Coordinate& co);
-    VOID copyto(CoordTerm& cl);
-    UINT_32 getsize();
-    UINT_32 getxor(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
-
-    VOID getsmallest(Coordinate& co);
-    UINT_32 Filter(INT_8 f, Coordinate& co, UINT_32 start = 0, INT_8 axis = '\0');
-    Coordinate& operator[](UINT_32 i);
-    BOOL_32 operator==(const CoordTerm& b);
-    BOOL_32 operator!=(const CoordTerm& b);
-    BOOL_32 exceedRange(UINT_32 xRange, UINT_32 yRange = 0, UINT_32 zRange = 0, UINT_32 sRange = 0);
-
-private:
-    static const UINT_32 MaxCoords = 8;
-    UINT_32 num_coords;
-    Coordinate m_coord[MaxCoords];
-};
-
-class CoordEq
-{
-public:
-    CoordEq();
-    VOID remove(Coordinate& co);
-    BOOL_32 Exists(Coordinate& co);
-    VOID resize(UINT_32 n);
-    UINT_32 getsize();
-    virtual UINT_64 solve(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
-    virtual VOID solveAddr(UINT_64 addr, UINT_32 sliceInM,
-                           UINT_32& x, UINT_32& y, UINT_32& z, UINT_32& s, UINT_32& m) const;
-
-    VOID copy(CoordEq& o, UINT_32 start = 0, UINT_32 num = 0xFFFFFFFF);
-    VOID reverse(UINT_32 start = 0, UINT_32 num = 0xFFFFFFFF);
-    VOID xorin(CoordEq& x, UINT_32 start = 0);
-    UINT_32 Filter(INT_8 f, Coordinate& co, UINT_32 start = 0, INT_8 axis = '\0');
-    VOID shift(INT_32 amount, INT_32 start = 0);
-    virtual CoordTerm& operator[](UINT_32 i);
-    VOID mort2d(Coordinate& c0, Coordinate& c1, UINT_32 start = 0, UINT_32 end = 0);
-    VOID mort3d(Coordinate& c0, Coordinate& c1, Coordinate& c2, UINT_32 start = 0, UINT_32 end = 0);
-
-    BOOL_32 operator==(const CoordEq& b);
-    BOOL_32 operator!=(const CoordEq& b);
-
-private:
-    static const UINT_32 MaxEqBits = 64;
-    UINT_32 m_numBits;
-
-    CoordTerm m_eq[MaxEqBits];
-};
-
-#endif
-
diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.cpp b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
deleted file mode 100644 (file)
index f115242..0000000
+++ /dev/null
@@ -1,5016 +0,0 @@
-/*
- * 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  gfx9addrlib.cpp
-* @brief Contgfx9ns the implementation for the Gfx9Lib class.
-************************************************************************************************************************
-*/
-
-#include "gfx9addrlib.h"
-
-#include "gfx9_gb_reg.h"
-
-#include "amdgpu_asic_addr.h"
-
-#include "util/macros.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace Addr
-{
-
-/**
-************************************************************************************************************************
-*   Gfx9HwlInit
-*
-*   @brief
-*       Creates an Gfx9Lib object.
-*
-*   @return
-*       Returns an Gfx9Lib object pointer.
-************************************************************************************************************************
-*/
-Addr::Lib* Gfx9HwlInit(const Client* pClient)
-{
-    return V2::Gfx9Lib::CreateObj(pClient);
-}
-
-namespace V2
-{
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                               Static Const Member
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-const SwizzleModeFlags Gfx9Lib::SwizzleModeTable[ADDR_SW_MAX_TYPE] =
-{//Linear 256B  4KB  64KB   Var    Z    Std   Disp  Rot   XOR    T     RtOpt
-    {1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0}, // ADDR_SW_LINEAR
-    {0,    1,    0,    0,    0,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_256B_S
-    {0,    1,    0,    0,    0,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_256B_D
-    {0,    1,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_256B_R
-
-    {0,    0,    1,    0,    0,    1,    0,    0,    0,    0,    0,    0}, // ADDR_SW_4KB_Z
-    {0,    0,    1,    0,    0,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_4KB_S
-    {0,    0,    1,    0,    0,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_4KB_D
-    {0,    0,    1,    0,    0,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_4KB_R
-
-    {0,    0,    0,    1,    0,    1,    0,    0,    0,    0,    0,    0}, // ADDR_SW_64KB_Z
-    {0,    0,    0,    1,    0,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_64KB_S
-    {0,    0,    0,    1,    0,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_64KB_D
-    {0,    0,    0,    1,    0,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_64KB_R
-
-    {0,    0,    0,    0,    1,    1,    0,    0,    0,    0,    0,    0}, // ADDR_SW_VAR_Z
-    {0,    0,    0,    0,    1,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_VAR_S
-    {0,    0,    0,    0,    1,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_VAR_D
-    {0,    0,    0,    0,    1,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_VAR_R
-
-    {0,    0,    0,    1,    0,    1,    0,    0,    0,    1,    1,    0}, // ADDR_SW_64KB_Z_T
-    {0,    0,    0,    1,    0,    0,    1,    0,    0,    1,    1,    0}, // ADDR_SW_64KB_S_T
-    {0,    0,    0,    1,    0,    0,    0,    1,    0,    1,    1,    0}, // ADDR_SW_64KB_D_T
-    {0,    0,    0,    1,    0,    0,    0,    0,    1,    1,    1,    0}, // ADDR_SW_64KB_R_T
-
-    {0,    0,    1,    0,    0,    1,    0,    0,    0,    1,    0,    0}, // ADDR_SW_4KB_Z_x
-    {0,    0,    1,    0,    0,    0,    1,    0,    0,    1,    0,    0}, // ADDR_SW_4KB_S_x
-    {0,    0,    1,    0,    0,    0,    0,    1,    0,    1,    0,    0}, // ADDR_SW_4KB_D_x
-    {0,    0,    1,    0,    0,    0,    0,    0,    1,    1,    0,    0}, // ADDR_SW_4KB_R_x
-
-    {0,    0,    0,    1,    0,    1,    0,    0,    0,    1,    0,    0}, // ADDR_SW_64KB_Z_X
-    {0,    0,    0,    1,    0,    0,    1,    0,    0,    1,    0,    0}, // ADDR_SW_64KB_S_X
-    {0,    0,    0,    1,    0,    0,    0,    1,    0,    1,    0,    0}, // ADDR_SW_64KB_D_X
-    {0,    0,    0,    1,    0,    0,    0,    0,    1,    1,    0,    0}, // ADDR_SW_64KB_R_X
-
-    {0,    0,    0,    0,    1,    1,    0,    0,    0,    1,    0,    0}, // ADDR_SW_VAR_Z_X
-    {0,    0,    0,    0,    1,    0,    1,    0,    0,    1,    0,    0}, // ADDR_SW_VAR_S_X
-    {0,    0,    0,    0,    1,    0,    0,    1,    0,    1,    0,    0}, // ADDR_SW_VAR_D_X
-    {0,    0,    0,    0,    1,    0,    0,    0,    1,    1,    0,    0}, // ADDR_SW_VAR_R_X
-    {1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0}, // ADDR_SW_LINEAR_GENERAL
-};
-
-const UINT_32 Gfx9Lib::MipTailOffset256B[] = {2048, 1024, 512, 256, 128, 64, 32, 16,
-                                              8, 6, 5, 4, 3, 2, 1, 0};
-
-const Dim3d   Gfx9Lib::Block256_3dS[]  = {{16, 4, 4}, {8, 4, 4}, {4, 4, 4}, {2, 4, 4}, {1, 4, 4}};
-
-const Dim3d   Gfx9Lib::Block256_3dZ[]  = {{8, 4, 8}, {4, 4, 8}, {4, 4, 4}, {4, 2, 4}, {2, 2, 4}};
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::Gfx9Lib
-*
-*   @brief
-*       Constructor
-*
-************************************************************************************************************************
-*/
-Gfx9Lib::Gfx9Lib(const Client* pClient)
-    :
-    Lib(pClient),
-    m_numEquations(0)
-{
-    m_class = AI_ADDRLIB;
-    memset(&m_settings, 0, sizeof(m_settings));
-    memcpy(m_swizzleModeTable, SwizzleModeTable, sizeof(SwizzleModeTable));
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::~Gfx9Lib
-*
-*   @brief
-*       Destructor
-************************************************************************************************************************
-*/
-Gfx9Lib::~Gfx9Lib()
-{
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeHtileInfo
-*
-*   @brief
-*       Interface function stub of AddrComputeHtilenfo
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileInfo(
-    const ADDR2_COMPUTE_HTILE_INFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_HTILE_INFO_OUTPUT*         pOut    ///< [out] output structure
-    ) const
-{
-    UINT_32 numPipeTotal = GetPipeNumForMetaAddressing(pIn->hTileFlags.pipeAligned,
-                                                       pIn->swizzleMode);
-
-    UINT_32 numRbTotal = pIn->hTileFlags.rbAligned ? m_se * m_rbPerSe : 1;
-
-    UINT_32 numCompressBlkPerMetaBlk, numCompressBlkPerMetaBlkLog2;
-
-    if ((numPipeTotal == 1) && (numRbTotal == 1))
-    {
-        numCompressBlkPerMetaBlkLog2 = 10;
-    }
-    else
-    {
-        if (m_settings.applyAliasFix)
-        {
-            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + Max(10u, m_pipeInterleaveLog2);
-        }
-        else
-        {
-            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + 10;
-        }
-    }
-
-    numCompressBlkPerMetaBlk = 1 << numCompressBlkPerMetaBlkLog2;
-
-    Dim3d   metaBlkDim   = {8, 8, 1};
-    UINT_32 totalAmpBits = numCompressBlkPerMetaBlkLog2;
-    UINT_32 widthAmp     = (pIn->numMipLevels > 1) ? (totalAmpBits >> 1) : RoundHalf(totalAmpBits);
-    UINT_32 heightAmp    = totalAmpBits - widthAmp;
-    metaBlkDim.w <<= widthAmp;
-    metaBlkDim.h <<= heightAmp;
-
-#if DEBUG
-    Dim3d metaBlkDimDbg = {8, 8, 1};
-    for (UINT_32 index = 0; index < numCompressBlkPerMetaBlkLog2; index++)
-    {
-        if ((metaBlkDimDbg.h < metaBlkDimDbg.w) ||
-            ((pIn->numMipLevels > 1) && (metaBlkDimDbg.h == metaBlkDimDbg.w)))
-        {
-            metaBlkDimDbg.h <<= 1;
-        }
-        else
-        {
-            metaBlkDimDbg.w <<= 1;
-        }
-    }
-    ADDR_ASSERT((metaBlkDimDbg.w == metaBlkDim.w) && (metaBlkDimDbg.h == metaBlkDim.h));
-#endif
-
-    UINT_32 numMetaBlkX;
-    UINT_32 numMetaBlkY;
-    UINT_32 numMetaBlkZ;
-
-    GetMetaMipInfo(pIn->numMipLevels, &metaBlkDim, FALSE, pOut->pMipInfo,
-                   pIn->unalignedWidth, pIn->unalignedHeight, pIn->numSlices,
-                   &numMetaBlkX, &numMetaBlkY, &numMetaBlkZ);
-
-    const UINT_32 metaBlkSize = numCompressBlkPerMetaBlk << 2;
-    UINT_32       align       = numPipeTotal * numRbTotal * m_pipeInterleaveBytes;
-
-    if ((IsXor(pIn->swizzleMode) == FALSE) && (numPipeTotal > 2))
-    {
-        align *= (numPipeTotal >> 1);
-    }
-
-    align = Max(align, metaBlkSize);
-
-    if (m_settings.metaBaseAlignFix)
-    {
-        align = Max(align, GetBlockSize(pIn->swizzleMode));
-    }
-
-    if (m_settings.htileAlignFix)
-    {
-        const INT_32 metaBlkSizeLog2        = numCompressBlkPerMetaBlkLog2 + 2;
-        const INT_32 htileCachelineSizeLog2 = 11;
-        const INT_32 maxNumOfRbMaskBits     = 1 + Log2(numPipeTotal) + Log2(numRbTotal);
-
-        INT_32 rbMaskPadding = Max(0, htileCachelineSizeLog2 - (metaBlkSizeLog2 - maxNumOfRbMaskBits));
-
-        align <<= rbMaskPadding;
-    }
-
-    pOut->pitch      = numMetaBlkX * metaBlkDim.w;
-    pOut->height     = numMetaBlkY * metaBlkDim.h;
-    pOut->sliceSize  = numMetaBlkX * numMetaBlkY * metaBlkSize;
-
-    pOut->metaBlkWidth       = metaBlkDim.w;
-    pOut->metaBlkHeight      = metaBlkDim.h;
-    pOut->metaBlkNumPerSlice = numMetaBlkX * numMetaBlkY;
-
-    pOut->baseAlign  = align;
-    pOut->htileBytes = PowTwoAlign(pOut->sliceSize * numMetaBlkZ, align);
-
-    return ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeCmaskInfo
-*
-*   @brief
-*       Interface function stub of AddrComputeCmaskInfo
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskInfo(
-    const ADDR2_COMPUTE_CMASK_INFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_CMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
-    ) const
-{
-// TODO: Clarify with AddrLib team
-//     ADDR_ASSERT(pIn->resourceType == ADDR_RSRC_TEX_2D);
-
-    UINT_32 numPipeTotal = GetPipeNumForMetaAddressing(pIn->cMaskFlags.pipeAligned,
-                                                       pIn->swizzleMode);
-
-    UINT_32 numRbTotal = pIn->cMaskFlags.rbAligned ? m_se * m_rbPerSe : 1;
-
-    UINT_32 numCompressBlkPerMetaBlkLog2, numCompressBlkPerMetaBlk;
-
-    if ((numPipeTotal == 1) && (numRbTotal == 1))
-    {
-        numCompressBlkPerMetaBlkLog2 = 13;
-    }
-    else
-    {
-        if (m_settings.applyAliasFix)
-        {
-            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + Max(10u, m_pipeInterleaveLog2);
-        }
-        else
-        {
-            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + 10;
-        }
-
-        numCompressBlkPerMetaBlkLog2 = Max(numCompressBlkPerMetaBlkLog2, 13u);
-    }
-
-    numCompressBlkPerMetaBlk = 1 << numCompressBlkPerMetaBlkLog2;
-
-    Dim2d metaBlkDim = {8, 8};
-    UINT_32 totalAmpBits = numCompressBlkPerMetaBlkLog2;
-    UINT_32 heightAmp = totalAmpBits >> 1;
-    UINT_32 widthAmp = totalAmpBits - heightAmp;
-    metaBlkDim.w <<= widthAmp;
-    metaBlkDim.h <<= heightAmp;
-
-#if DEBUG
-    Dim2d metaBlkDimDbg = {8, 8};
-    for (UINT_32 index = 0; index < numCompressBlkPerMetaBlkLog2; index++)
-    {
-        if (metaBlkDimDbg.h < metaBlkDimDbg.w)
-        {
-            metaBlkDimDbg.h <<= 1;
-        }
-        else
-        {
-            metaBlkDimDbg.w <<= 1;
-        }
-    }
-    ADDR_ASSERT((metaBlkDimDbg.w == metaBlkDim.w) && (metaBlkDimDbg.h == metaBlkDim.h));
-#endif
-
-    UINT_32 numMetaBlkX = (pIn->unalignedWidth  + metaBlkDim.w - 1) / metaBlkDim.w;
-    UINT_32 numMetaBlkY = (pIn->unalignedHeight + metaBlkDim.h - 1) / metaBlkDim.h;
-    UINT_32 numMetaBlkZ = Max(pIn->numSlices, 1u);
-
-    UINT_32 sizeAlign = numPipeTotal * numRbTotal * m_pipeInterleaveBytes;
-
-    if (m_settings.metaBaseAlignFix)
-    {
-        sizeAlign = Max(sizeAlign, GetBlockSize(pIn->swizzleMode));
-    }
-
-    pOut->pitch      = numMetaBlkX * metaBlkDim.w;
-    pOut->height     = numMetaBlkY * metaBlkDim.h;
-    pOut->sliceSize  = (numMetaBlkX * numMetaBlkY * numCompressBlkPerMetaBlk) >> 1;
-    pOut->cmaskBytes = PowTwoAlign(pOut->sliceSize * numMetaBlkZ, sizeAlign);
-    pOut->baseAlign  = Max(numCompressBlkPerMetaBlk >> 1, sizeAlign);
-
-    pOut->metaBlkWidth = metaBlkDim.w;
-    pOut->metaBlkHeight = metaBlkDim.h;
-
-    pOut->metaBlkNumPerSlice = numMetaBlkX * numMetaBlkY;
-
-    return ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::GetMetaMipInfo
-*
-*   @brief
-*       Get meta mip info
-*
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::GetMetaMipInfo(
-    UINT_32 numMipLevels,           ///< [in]  number of mip levels
-    Dim3d* pMetaBlkDim,             ///< [in]  meta block dimension
-    BOOL_32 dataThick,              ///< [in]  data surface is thick
-    ADDR2_META_MIP_INFO* pInfo,     ///< [out] meta mip info
-    UINT_32 mip0Width,              ///< [in]  mip0 width
-    UINT_32 mip0Height,             ///< [in]  mip0 height
-    UINT_32 mip0Depth,              ///< [in]  mip0 depth
-    UINT_32* pNumMetaBlkX,          ///< [out] number of metablock X in mipchain
-    UINT_32* pNumMetaBlkY,          ///< [out] number of metablock Y in mipchain
-    UINT_32* pNumMetaBlkZ)          ///< [out] number of metablock Z in mipchain
-    const
-{
-    UINT_32 numMetaBlkX = (mip0Width  + pMetaBlkDim->w - 1) / pMetaBlkDim->w;
-    UINT_32 numMetaBlkY = (mip0Height + pMetaBlkDim->h - 1) / pMetaBlkDim->h;
-    UINT_32 numMetaBlkZ = (mip0Depth  + pMetaBlkDim->d - 1) / pMetaBlkDim->d;
-    UINT_32 tailWidth   = pMetaBlkDim->w;
-    UINT_32 tailHeight  = pMetaBlkDim->h >> 1;
-    UINT_32 tailDepth   = pMetaBlkDim->d;
-    BOOL_32 inTail      = FALSE;
-    AddrMajorMode major = ADDR_MAJOR_MAX_TYPE;
-
-    if (numMipLevels > 1)
-    {
-        if (dataThick && (numMetaBlkZ > numMetaBlkX) && (numMetaBlkZ > numMetaBlkY))
-        {
-            // Z major
-            major = ADDR_MAJOR_Z;
-        }
-        else if (numMetaBlkX >= numMetaBlkY)
-        {
-            // X major
-            major = ADDR_MAJOR_X;
-        }
-        else
-        {
-            // Y major
-            major = ADDR_MAJOR_Y;
-        }
-
-        inTail = ((mip0Width <= tailWidth) &&
-                  (mip0Height <= tailHeight) &&
-                  ((dataThick == FALSE) || (mip0Depth <= tailDepth)));
-
-        if (inTail == FALSE)
-        {
-            UINT_32 orderLimit;
-            UINT_32 *pMipDim;
-            UINT_32 *pOrderDim;
-
-            if (major == ADDR_MAJOR_Z)
-            {
-                // Z major
-                pMipDim = &numMetaBlkY;
-                pOrderDim = &numMetaBlkZ;
-                orderLimit = 4;
-            }
-            else if (major == ADDR_MAJOR_X)
-            {
-                // X major
-                pMipDim = &numMetaBlkY;
-                pOrderDim = &numMetaBlkX;
-                orderLimit = 4;
-            }
-            else
-            {
-                // Y major
-                pMipDim = &numMetaBlkX;
-                pOrderDim = &numMetaBlkY;
-                orderLimit = 2;
-            }
-
-            if ((*pMipDim < 3) && (*pOrderDim > orderLimit) && (numMipLevels > 3))
-            {
-                *pMipDim += 2;
-            }
-            else
-            {
-                *pMipDim += ((*pMipDim / 2) + (*pMipDim & 1));
-            }
-        }
-    }
-
-    if (pInfo != NULL)
-    {
-        UINT_32 mipWidth  = mip0Width;
-        UINT_32 mipHeight = mip0Height;
-        UINT_32 mipDepth  = mip0Depth;
-        Dim3d   mipCoord  = {0};
-
-        for (UINT_32 mip = 0; mip < numMipLevels; mip++)
-        {
-            if (inTail)
-            {
-                GetMetaMiptailInfo(&pInfo[mip], mipCoord, numMipLevels - mip,
-                                   pMetaBlkDim);
-                break;
-            }
-            else
-            {
-                mipWidth  = PowTwoAlign(mipWidth, pMetaBlkDim->w);
-                mipHeight = PowTwoAlign(mipHeight, pMetaBlkDim->h);
-                mipDepth  = PowTwoAlign(mipDepth, pMetaBlkDim->d);
-
-                pInfo[mip].inMiptail = FALSE;
-                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  = dataThick ? mipDepth : 1;
-
-                if ((mip >= 3) || (mip & 1))
-                {
-                    switch (major)
-                    {
-                        case ADDR_MAJOR_X:
-                            mipCoord.w += mipWidth;
-                            break;
-                        case ADDR_MAJOR_Y:
-                            mipCoord.h += mipHeight;
-                            break;
-                        case ADDR_MAJOR_Z:
-                            mipCoord.d += mipDepth;
-                            break;
-                        default:
-                            break;
-                    }
-                }
-                else
-                {
-                    switch (major)
-                    {
-                        case ADDR_MAJOR_X:
-                            mipCoord.h += mipHeight;
-                            break;
-                        case ADDR_MAJOR_Y:
-                            mipCoord.w += mipWidth;
-                            break;
-                        case ADDR_MAJOR_Z:
-                            mipCoord.h += mipHeight;
-                            break;
-                        default:
-                            break;
-                    }
-                }
-
-                mipWidth  = Max(mipWidth >> 1, 1u);
-                mipHeight = Max(mipHeight >> 1, 1u);
-                mipDepth = Max(mipDepth >> 1, 1u);
-
-                inTail = ((mipWidth <= tailWidth) &&
-                          (mipHeight <= tailHeight) &&
-                          ((dataThick == FALSE) || (mipDepth <= tailDepth)));
-            }
-        }
-    }
-
-    *pNumMetaBlkX = numMetaBlkX;
-    *pNumMetaBlkY = numMetaBlkY;
-    *pNumMetaBlkZ = numMetaBlkZ;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeDccInfo
-*
-*   @brief
-*       Interface function to compute DCC key info
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeDccInfo(
-    const ADDR2_COMPUTE_DCCINFO_INPUT*    pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_DCCINFO_OUTPUT*         pOut    ///< [out] output structure
-    ) const
-{
-    BOOL_32 dataLinear = IsLinear(pIn->swizzleMode);
-    BOOL_32 metaLinear = pIn->dccKeyFlags.linear;
-    BOOL_32 pipeAligned = pIn->dccKeyFlags.pipeAligned;
-
-    if (dataLinear)
-    {
-        metaLinear = TRUE;
-    }
-    else if (metaLinear == TRUE)
-    {
-        pipeAligned = FALSE;
-    }
-
-    UINT_32 numPipeTotal = GetPipeNumForMetaAddressing(pipeAligned, pIn->swizzleMode);
-
-    if (metaLinear)
-    {
-        // Linear metadata supporting was removed for GFX9! No one can use this feature on GFX9.
-        ADDR_ASSERT_ALWAYS();
-
-        pOut->dccRamBaseAlign = numPipeTotal * m_pipeInterleaveBytes;
-        pOut->dccRamSize = PowTwoAlign((pIn->dataSurfaceSize / 256), pOut->dccRamBaseAlign);
-    }
-    else
-    {
-        BOOL_32 dataThick = IsThick(pIn->resourceType, pIn->swizzleMode);
-
-        UINT_32 minMetaBlkSize = dataThick ? 65536 : 4096;
-
-        UINT_32 numFrags = Max(pIn->numFrags, 1u);
-        UINT_32 numSlices = Max(pIn->numSlices, 1u);
-
-        minMetaBlkSize /= numFrags;
-
-        UINT_32 numCompressBlkPerMetaBlk = minMetaBlkSize;
-
-        UINT_32 numRbTotal = pIn->dccKeyFlags.rbAligned ? m_se * m_rbPerSe : 1;
-
-        if ((numPipeTotal > 1) || (numRbTotal > 1))
-        {
-            const UINT_32 thinBlkSize = 1 << (m_settings.applyAliasFix ? Max(10u, m_pipeInterleaveLog2) : 10);
-
-            numCompressBlkPerMetaBlk =
-                Max(numCompressBlkPerMetaBlk, m_se * m_rbPerSe * (dataThick ? 262144 : thinBlkSize));
-
-            if (numCompressBlkPerMetaBlk > 65536 * pIn->bpp)
-            {
-                numCompressBlkPerMetaBlk = 65536 * pIn->bpp;
-            }
-        }
-
-        Dim3d compressBlkDim = GetDccCompressBlk(pIn->resourceType, pIn->swizzleMode, pIn->bpp);
-        Dim3d metaBlkDim = compressBlkDim;
-
-        for (UINT_32 index = 1; index < numCompressBlkPerMetaBlk; index <<= 1)
-        {
-            if ((metaBlkDim.h < metaBlkDim.w) ||
-                ((pIn->numMipLevels > 1) && (metaBlkDim.h == metaBlkDim.w)))
-            {
-                if ((dataThick == FALSE) || (metaBlkDim.h <= metaBlkDim.d))
-                {
-                    metaBlkDim.h <<= 1;
-                }
-                else
-                {
-                    metaBlkDim.d <<= 1;
-                }
-            }
-            else
-            {
-                if ((dataThick == FALSE) || (metaBlkDim.w <= metaBlkDim.d))
-                {
-                    metaBlkDim.w <<= 1;
-                }
-                else
-                {
-                    metaBlkDim.d <<= 1;
-                }
-            }
-        }
-
-        UINT_32 numMetaBlkX;
-        UINT_32 numMetaBlkY;
-        UINT_32 numMetaBlkZ;
-
-        GetMetaMipInfo(pIn->numMipLevels, &metaBlkDim, dataThick, pOut->pMipInfo,
-                       pIn->unalignedWidth, pIn->unalignedHeight, numSlices,
-                       &numMetaBlkX, &numMetaBlkY, &numMetaBlkZ);
-
-        UINT_32 sizeAlign = numPipeTotal * numRbTotal * m_pipeInterleaveBytes;
-
-        if (numFrags > m_maxCompFrag)
-        {
-            sizeAlign *= (numFrags / m_maxCompFrag);
-        }
-
-        if (m_settings.metaBaseAlignFix)
-        {
-            sizeAlign = Max(sizeAlign, GetBlockSize(pIn->swizzleMode));
-        }
-
-        pOut->dccRamSize = numMetaBlkX * numMetaBlkY * numMetaBlkZ *
-                           numCompressBlkPerMetaBlk * numFrags;
-        pOut->dccRamSize = PowTwoAlign(pOut->dccRamSize, sizeAlign);
-        pOut->dccRamBaseAlign = Max(numCompressBlkPerMetaBlk, sizeAlign);
-
-        pOut->pitch = numMetaBlkX * metaBlkDim.w;
-        pOut->height = numMetaBlkY * metaBlkDim.h;
-        pOut->depth = numMetaBlkZ * metaBlkDim.d;
-
-        pOut->compressBlkWidth = compressBlkDim.w;
-        pOut->compressBlkHeight = compressBlkDim.h;
-        pOut->compressBlkDepth = compressBlkDim.d;
-
-        pOut->metaBlkWidth = metaBlkDim.w;
-        pOut->metaBlkHeight = metaBlkDim.h;
-        pOut->metaBlkDepth = metaBlkDim.d;
-
-        pOut->metaBlkNumPerSlice = numMetaBlkX * numMetaBlkY;
-        pOut->fastClearSizePerSlice =
-            pOut->metaBlkNumPerSlice * numCompressBlkPerMetaBlk * Min(numFrags, m_maxCompFrag);
-    }
-
-    return ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeMaxBaseAlignments
-*
-*   @brief
-*       Gets maximum alignments
-*   @return
-*       maximum alignments
-************************************************************************************************************************
-*/
-UINT_32 Gfx9Lib::HwlComputeMaxBaseAlignments() const
-{
-    return ComputeSurfaceBaseAlignTiled(ADDR_SW_64KB);
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeMaxMetaBaseAlignments
-*
-*   @brief
-*       Gets maximum alignments for metadata
-*   @return
-*       maximum alignments for metadata
-************************************************************************************************************************
-*/
-UINT_32 Gfx9Lib::HwlComputeMaxMetaBaseAlignments() const
-{
-    // Max base alignment for Htile
-    const UINT_32 maxNumPipeTotal = GetPipeNumForMetaAddressing(TRUE, ADDR_SW_64KB_Z);
-    const UINT_32 maxNumRbTotal   = m_se * m_rbPerSe;
-
-    // If applyAliasFix was set, the extra bits should be MAX(10u, m_pipeInterleaveLog2),
-    // but we never saw any ASIC whose m_pipeInterleaveLog2 != 8, so just put an assertion and simply the logic.
-    ADDR_ASSERT((m_settings.applyAliasFix == FALSE) || (m_pipeInterleaveLog2 <= 10u));
-    const UINT_32 maxNumCompressBlkPerMetaBlk = 1u << (m_seLog2 + m_rbPerSeLog2 + 10u);
-
-    UINT_32 maxBaseAlignHtile = maxNumPipeTotal * maxNumRbTotal * m_pipeInterleaveBytes;
-
-    if (maxNumPipeTotal > 2)
-    {
-        maxBaseAlignHtile *= (maxNumPipeTotal >> 1);
-    }
-
-    maxBaseAlignHtile = Max(maxNumCompressBlkPerMetaBlk << 2, maxBaseAlignHtile);
-
-    if (m_settings.metaBaseAlignFix)
-    {
-        maxBaseAlignHtile = Max(maxBaseAlignHtile, GetBlockSize(ADDR_SW_64KB));
-    }
-
-    if (m_settings.htileAlignFix)
-    {
-        maxBaseAlignHtile *= maxNumPipeTotal;
-    }
-
-    // Max base alignment for Cmask will not be larger than that for Htile, no need to calculate
-
-    // Max base alignment for 2D Dcc will not be larger than that for 3D, no need to calculate
-    UINT_32 maxBaseAlignDcc3D = 65536;
-
-    if ((maxNumPipeTotal > 1) || (maxNumRbTotal > 1))
-    {
-        maxBaseAlignDcc3D = Min(m_se * m_rbPerSe * 262144, 65536 * 128u);
-    }
-
-    // Max base alignment for Msaa Dcc
-    UINT_32 maxBaseAlignDccMsaa = maxNumPipeTotal * maxNumRbTotal * m_pipeInterleaveBytes * (8 / m_maxCompFrag);
-
-    if (m_settings.metaBaseAlignFix)
-    {
-        maxBaseAlignDccMsaa = Max(maxBaseAlignDccMsaa, GetBlockSize(ADDR_SW_64KB));
-    }
-
-    return Max(maxBaseAlignHtile, Max(maxBaseAlignDccMsaa, maxBaseAlignDcc3D));
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeCmaskAddrFromCoord
-*
-*   @brief
-*       Interface function stub of AddrComputeCmaskAddrFromCoord
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskAddrFromCoord(
-    const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut)   ///< [out] output structure
-{
-    ADDR2_COMPUTE_CMASK_INFO_INPUT input = {0};
-    input.size            = sizeof(input);
-    input.cMaskFlags      = pIn->cMaskFlags;
-    input.colorFlags      = pIn->colorFlags;
-    input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
-    input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
-    input.numSlices       = Max(pIn->numSlices, 1u);
-    input.swizzleMode     = pIn->swizzleMode;
-    input.resourceType    = pIn->resourceType;
-
-    ADDR2_COMPUTE_CMASK_INFO_OUTPUT output = {0};
-    output.size = sizeof(output);
-
-    ADDR_E_RETURNCODE returnCode = ComputeCmaskInfo(&input, &output);
-
-    if (returnCode == ADDR_OK)
-    {
-        UINT_32 fmaskBpp              = GetFmaskBpp(pIn->numSamples, pIn->numFrags);
-        UINT_32 fmaskElementBytesLog2 = Log2(fmaskBpp >> 3);
-        UINT_32 metaBlkWidthLog2      = Log2(output.metaBlkWidth);
-        UINT_32 metaBlkHeightLog2     = Log2(output.metaBlkHeight);
-
-        MetaEqParams metaEqParams = {0, fmaskElementBytesLog2, 0, pIn->cMaskFlags,
-                                     Gfx9DataFmask, pIn->swizzleMode, pIn->resourceType,
-                                     metaBlkWidthLog2, metaBlkHeightLog2, 0, 3, 3, 0};
-
-        const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
-
-        UINT_32 xb = pIn->x / output.metaBlkWidth;
-        UINT_32 yb = pIn->y / output.metaBlkHeight;
-        UINT_32 zb = pIn->slice;
-
-        UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
-        UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
-        UINT_32 blockIndex       = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
-
-        UINT_64 address = pMetaEq->solve(pIn->x, pIn->y, pIn->slice, 0, blockIndex);
-
-        pOut->addr = address >> 1;
-        pOut->bitPosition = static_cast<UINT_32>((address & 1) << 2);
-
-
-        UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->cMaskFlags.pipeAligned,
-                                                           pIn->swizzleMode);
-
-        UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
-
-        pOut->addr ^= (pipeXor << m_pipeInterleaveLog2);
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeHtileAddrFromCoord
-*
-*   @brief
-*       Interface function stub of AddrComputeHtileAddrFromCoord
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileAddrFromCoord(
-    const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut)   ///< [out] output structure
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pIn->numMipLevels > 1)
-    {
-        returnCode = ADDR_NOTIMPLEMENTED;
-    }
-    else
-    {
-        ADDR2_COMPUTE_HTILE_INFO_INPUT input = {0};
-        input.size            = sizeof(input);
-        input.hTileFlags      = pIn->hTileFlags;
-        input.depthFlags      = pIn->depthflags;
-        input.swizzleMode     = pIn->swizzleMode;
-        input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
-        input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
-        input.numSlices       = Max(pIn->numSlices, 1u);
-        input.numMipLevels    = Max(pIn->numMipLevels, 1u);
-
-        ADDR2_COMPUTE_HTILE_INFO_OUTPUT output = {0};
-        output.size = sizeof(output);
-
-        returnCode = ComputeHtileInfo(&input, &output);
-
-        if (returnCode == ADDR_OK)
-        {
-            UINT_32 elementBytesLog2  = Log2(pIn->bpp >> 3);
-            UINT_32 metaBlkWidthLog2  = Log2(output.metaBlkWidth);
-            UINT_32 metaBlkHeightLog2 = Log2(output.metaBlkHeight);
-            UINT_32 numSamplesLog2    = Log2(pIn->numSamples);
-
-            MetaEqParams metaEqParams = {0, elementBytesLog2, numSamplesLog2, pIn->hTileFlags,
-                                         Gfx9DataDepthStencil, pIn->swizzleMode, ADDR_RSRC_TEX_2D,
-                                         metaBlkWidthLog2, metaBlkHeightLog2, 0, 3, 3, 0};
-
-            const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
-
-            UINT_32 xb = pIn->x / output.metaBlkWidth;
-            UINT_32 yb = pIn->y / output.metaBlkHeight;
-            UINT_32 zb = pIn->slice;
-
-            UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
-            UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
-            UINT_32 blockIndex       = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
-
-            UINT_64 address = pMetaEq->solve(pIn->x, pIn->y, pIn->slice, 0, blockIndex);
-
-            pOut->addr = address >> 1;
-
-            UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->hTileFlags.pipeAligned,
-                                                               pIn->swizzleMode);
-
-            UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
-
-            pOut->addr ^= (pipeXor << m_pipeInterleaveLog2);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeHtileCoordFromAddr
-*
-*   @brief
-*       Interface function stub of AddrComputeHtileCoordFromAddr
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileCoordFromAddr(
-    const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
-    ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut)   ///< [out] output structure
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (pIn->numMipLevels > 1)
-    {
-        returnCode = ADDR_NOTIMPLEMENTED;
-    }
-    else
-    {
-        ADDR2_COMPUTE_HTILE_INFO_INPUT input = {0};
-        input.size            = sizeof(input);
-        input.hTileFlags      = pIn->hTileFlags;
-        input.swizzleMode     = pIn->swizzleMode;
-        input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
-        input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
-        input.numSlices       = Max(pIn->numSlices, 1u);
-        input.numMipLevels    = Max(pIn->numMipLevels, 1u);
-
-        ADDR2_COMPUTE_HTILE_INFO_OUTPUT output = {0};
-        output.size = sizeof(output);
-
-        returnCode = ComputeHtileInfo(&input, &output);
-
-        if (returnCode == ADDR_OK)
-        {
-            UINT_32 elementBytesLog2  = Log2(pIn->bpp >> 3);
-            UINT_32 metaBlkWidthLog2  = Log2(output.metaBlkWidth);
-            UINT_32 metaBlkHeightLog2 = Log2(output.metaBlkHeight);
-            UINT_32 numSamplesLog2    = Log2(pIn->numSamples);
-
-            MetaEqParams metaEqParams = {0, elementBytesLog2, numSamplesLog2, pIn->hTileFlags,
-                                         Gfx9DataDepthStencil, pIn->swizzleMode, ADDR_RSRC_TEX_2D,
-                                         metaBlkWidthLog2, metaBlkHeightLog2, 0, 3, 3, 0};
-
-            const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
-
-            UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->hTileFlags.pipeAligned,
-                                                               pIn->swizzleMode);
-
-            UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
-
-            UINT_64 nibbleAddress = (pIn->addr ^ (pipeXor << m_pipeInterleaveLog2)) << 1;
-
-            UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
-            UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
-
-            UINT_32 x, y, z, s, m;
-            pMetaEq->solveAddr(nibbleAddress, sliceSizeInBlock, x, y, z, s, m);
-
-            pOut->slice = m / sliceSizeInBlock;
-            pOut->y     = ((m % sliceSizeInBlock) / pitchInBlock) * output.metaBlkHeight + y;
-            pOut->x     = (m % pitchInBlock) * output.metaBlkWidth + x;
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeDccAddrFromCoord
-*
-*   @brief
-*       Interface function stub of AddrComputeDccAddrFromCoord
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeDccAddrFromCoord(
-    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT*  pIn,
-    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut)
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if ((pIn->numMipLevels > 1) || (pIn->mipId > 1) || pIn->dccKeyFlags.linear)
-    {
-        returnCode = ADDR_NOTIMPLEMENTED;
-    }
-    else
-    {
-        ADDR2_COMPUTE_DCCINFO_INPUT input = {0};
-        input.size            = sizeof(input);
-        input.dccKeyFlags     = pIn->dccKeyFlags;
-        input.colorFlags      = pIn->colorFlags;
-        input.swizzleMode     = pIn->swizzleMode;
-        input.resourceType    = pIn->resourceType;
-        input.bpp             = pIn->bpp;
-        input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
-        input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
-        input.numSlices       = Max(pIn->numSlices, 1u);
-        input.numFrags        = Max(pIn->numFrags, 1u);
-        input.numMipLevels    = Max(pIn->numMipLevels, 1u);
-
-        ADDR2_COMPUTE_DCCINFO_OUTPUT output = {0};
-        output.size = sizeof(output);
-
-        returnCode = ComputeDccInfo(&input, &output);
-
-        if (returnCode == ADDR_OK)
-        {
-            UINT_32 elementBytesLog2  = Log2(pIn->bpp >> 3);
-            UINT_32 numSamplesLog2    = Log2(pIn->numFrags);
-            UINT_32 metaBlkWidthLog2  = Log2(output.metaBlkWidth);
-            UINT_32 metaBlkHeightLog2 = Log2(output.metaBlkHeight);
-            UINT_32 metaBlkDepthLog2  = Log2(output.metaBlkDepth);
-            UINT_32 compBlkWidthLog2  = Log2(output.compressBlkWidth);
-            UINT_32 compBlkHeightLog2 = Log2(output.compressBlkHeight);
-            UINT_32 compBlkDepthLog2  = Log2(output.compressBlkDepth);
-
-            MetaEqParams metaEqParams = {pIn->mipId, elementBytesLog2, numSamplesLog2, pIn->dccKeyFlags,
-                                         Gfx9DataColor, pIn->swizzleMode, pIn->resourceType,
-                                         metaBlkWidthLog2, metaBlkHeightLog2, metaBlkDepthLog2,
-                                         compBlkWidthLog2, compBlkHeightLog2, compBlkDepthLog2};
-
-            const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
-
-            UINT_32 xb = pIn->x / output.metaBlkWidth;
-            UINT_32 yb = pIn->y / output.metaBlkHeight;
-            UINT_32 zb = pIn->slice / output.metaBlkDepth;
-
-            UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
-            UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
-            UINT_32 blockIndex       = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
-
-            UINT_64 address = pMetaEq->solve(pIn->x, pIn->y, pIn->slice, pIn->sample, blockIndex);
-
-            pOut->addr = address >> 1;
-
-            UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->dccKeyFlags.pipeAligned,
-                                                               pIn->swizzleMode);
-
-            UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
-
-            pOut->addr ^= (pipeXor << m_pipeInterleaveLog2);
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlInitGlobalParams
-*
-*   @brief
-*       Initializes global parameters
-*
-*   @return
-*       TRUE if all settings are valid
-*
-************************************************************************************************************************
-*/
-BOOL_32 Gfx9Lib::HwlInitGlobalParams(
-    const ADDR_CREATE_INPUT* pCreateIn) ///< [in] create input
-{
-    BOOL_32 valid = TRUE;
-
-    if (m_settings.isArcticIsland)
-    {
-        GB_ADDR_CONFIG gbAddrConfig;
-
-        gbAddrConfig.u32All = pCreateIn->regValue.gbAddrConfig;
-
-        // These values are copied from CModel code
-        switch (gbAddrConfig.bits.NUM_PIPES)
-        {
-            case ADDR_CONFIG_1_PIPE:
-                m_pipes = 1;
-                m_pipesLog2 = 0;
-                break;
-            case ADDR_CONFIG_2_PIPE:
-                m_pipes = 2;
-                m_pipesLog2 = 1;
-                break;
-            case ADDR_CONFIG_4_PIPE:
-                m_pipes = 4;
-                m_pipesLog2 = 2;
-                break;
-            case ADDR_CONFIG_8_PIPE:
-                m_pipes = 8;
-                m_pipesLog2 = 3;
-                break;
-            case ADDR_CONFIG_16_PIPE:
-                m_pipes = 16;
-                m_pipesLog2 = 4;
-                break;
-            case ADDR_CONFIG_32_PIPE:
-                m_pipes = 32;
-                m_pipesLog2 = 5;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        switch (gbAddrConfig.bits.PIPE_INTERLEAVE_SIZE)
-        {
-            case ADDR_CONFIG_PIPE_INTERLEAVE_256B:
-                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_256B;
-                m_pipeInterleaveLog2 = 8;
-                break;
-            case ADDR_CONFIG_PIPE_INTERLEAVE_512B:
-                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_512B;
-                m_pipeInterleaveLog2 = 9;
-                break;
-            case ADDR_CONFIG_PIPE_INTERLEAVE_1KB:
-                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_1KB;
-                m_pipeInterleaveLog2 = 10;
-                break;
-            case ADDR_CONFIG_PIPE_INTERLEAVE_2KB:
-                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_2KB;
-                m_pipeInterleaveLog2 = 11;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        // Addr::V2::Lib::ComputePipeBankXor()/ComputeSlicePipeBankXor() requires pipe interleave to be exactly 8 bits,
-        // and any larger value requires a post-process (left shift) on the output pipeBankXor bits.
-        ADDR_ASSERT(m_pipeInterleaveBytes == ADDR_PIPEINTERLEAVE_256B);
-
-        switch (gbAddrConfig.bits.NUM_BANKS)
-        {
-            case ADDR_CONFIG_1_BANK:
-                m_banks = 1;
-                m_banksLog2 = 0;
-                break;
-            case ADDR_CONFIG_2_BANK:
-                m_banks = 2;
-                m_banksLog2 = 1;
-                break;
-            case ADDR_CONFIG_4_BANK:
-                m_banks = 4;
-                m_banksLog2 = 2;
-                break;
-            case ADDR_CONFIG_8_BANK:
-                m_banks = 8;
-                m_banksLog2 = 3;
-                break;
-            case ADDR_CONFIG_16_BANK:
-                m_banks = 16;
-                m_banksLog2 = 4;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        switch (gbAddrConfig.bits.NUM_SHADER_ENGINES)
-        {
-            case ADDR_CONFIG_1_SHADER_ENGINE:
-                m_se = 1;
-                m_seLog2 = 0;
-                break;
-            case ADDR_CONFIG_2_SHADER_ENGINE:
-                m_se = 2;
-                m_seLog2 = 1;
-                break;
-            case ADDR_CONFIG_4_SHADER_ENGINE:
-                m_se = 4;
-                m_seLog2 = 2;
-                break;
-            case ADDR_CONFIG_8_SHADER_ENGINE:
-                m_se = 8;
-                m_seLog2 = 3;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        switch (gbAddrConfig.bits.NUM_RB_PER_SE)
-        {
-            case ADDR_CONFIG_1_RB_PER_SHADER_ENGINE:
-                m_rbPerSe = 1;
-                m_rbPerSeLog2 = 0;
-                break;
-            case ADDR_CONFIG_2_RB_PER_SHADER_ENGINE:
-                m_rbPerSe = 2;
-                m_rbPerSeLog2 = 1;
-                break;
-            case ADDR_CONFIG_4_RB_PER_SHADER_ENGINE:
-                m_rbPerSe = 4;
-                m_rbPerSeLog2 = 2;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        switch (gbAddrConfig.bits.MAX_COMPRESSED_FRAGS)
-        {
-            case ADDR_CONFIG_1_MAX_COMPRESSED_FRAGMENTS:
-                m_maxCompFrag = 1;
-                m_maxCompFragLog2 = 0;
-                break;
-            case ADDR_CONFIG_2_MAX_COMPRESSED_FRAGMENTS:
-                m_maxCompFrag = 2;
-                m_maxCompFragLog2 = 1;
-                break;
-            case ADDR_CONFIG_4_MAX_COMPRESSED_FRAGMENTS:
-                m_maxCompFrag = 4;
-                m_maxCompFragLog2 = 2;
-                break;
-            case ADDR_CONFIG_8_MAX_COMPRESSED_FRAGMENTS:
-                m_maxCompFrag = 8;
-                m_maxCompFragLog2 = 3;
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        m_blockVarSizeLog2 = pCreateIn->regValue.blockVarSizeLog2;
-        ADDR_ASSERT((m_blockVarSizeLog2 == 0) ||
-                    ((m_blockVarSizeLog2 >= 17u) && (m_blockVarSizeLog2 <= 20u)));
-        m_blockVarSizeLog2 = Min(Max(17u, m_blockVarSizeLog2), 20u);
-
-        if ((m_rbPerSeLog2 == 1) &&
-            (((m_pipesLog2 == 1) && ((m_seLog2 == 2) || (m_seLog2 == 3))) ||
-             ((m_pipesLog2 == 2) && ((m_seLog2 == 1) || (m_seLog2 == 2)))))
-        {
-            ADDR_ASSERT(m_settings.isVega10 == FALSE);
-            ADDR_ASSERT(m_settings.isRaven == FALSE);
-            ADDR_ASSERT(m_settings.isVega20 == FALSE);
-
-            if (m_settings.isVega12)
-            {
-                m_settings.htileCacheRbConflict = 1;
-            }
-        }
-    }
-    else
-    {
-        valid = FALSE;
-        ADDR_NOT_IMPLEMENTED();
-    }
-
-    if (valid)
-    {
-        InitEquationTable();
-    }
-
-    return valid;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlConvertChipFamily
-*
-*   @brief
-*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
-*   @return
-*       ChipFamily
-************************************************************************************************************************
-*/
-ChipFamily Gfx9Lib::HwlConvertChipFamily(
-    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
-    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
-{
-    ChipFamily family = ADDR_CHIP_FAMILY_AI;
-
-    switch (uChipFamily)
-    {
-        case FAMILY_AI:
-            m_settings.isArcticIsland = 1;
-            m_settings.isVega10    = ASICREV_IS_VEGA10_P(uChipRevision);
-            m_settings.isVega12    = ASICREV_IS_VEGA12_P(uChipRevision);
-            m_settings.isVega20    = ASICREV_IS_VEGA20_P(uChipRevision);
-            m_settings.isDce12 = 1;
-
-            if (m_settings.isVega10 == 0)
-            {
-                m_settings.htileAlignFix = 1;
-                m_settings.applyAliasFix = 1;
-            }
-
-            m_settings.metaBaseAlignFix = 1;
-
-            m_settings.depthPipeXorDisable = 1;
-            break;
-        case FAMILY_RV:
-            m_settings.isArcticIsland = 1;
-            m_settings.isRaven        = ASICREV_IS_RAVEN(uChipRevision) || ASICREV_IS_RAVEN2(uChipRevision);
-
-            if (m_settings.isRaven)
-            {
-                m_settings.isDcn1   = 1;
-            }
-
-            m_settings.metaBaseAlignFix = 1;
-
-            if (ASICREV_IS_RAVEN(uChipRevision))
-            {
-                m_settings.depthPipeXorDisable = 1;
-            }
-            break;
-
-        default:
-            ADDR_ASSERT(!"This should be a Fusion");
-            break;
-    }
-
-    return family;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::InitRbEquation
-*
-*   @brief
-*       Init RB equation
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::GetRbEquation(
-    CoordEq* pRbEq,             ///< [out] rb equation
-    UINT_32  numRbPerSeLog2,    ///< [in] number of rb per shader engine
-    UINT_32  numSeLog2)         ///< [in] number of shader engine
-    const
-{
-    // RB's are distributed on 16x16, except when we have 1 rb per se, in which case its 32x32
-    UINT_32 rbRegion = (numRbPerSeLog2 == 0) ? 5 : 4;
-    Coordinate cx('x', rbRegion);
-    Coordinate cy('y', rbRegion);
-
-    UINT_32 start = 0;
-    UINT_32 numRbTotalLog2 = numRbPerSeLog2 + numSeLog2;
-
-    // Clear the rb equation
-    pRbEq->resize(0);
-    pRbEq->resize(numRbTotalLog2);
-
-    if ((numSeLog2 > 0) && (numRbPerSeLog2 == 1))
-    {
-        // Special case when more than 1 SE, and 2 RB per SE
-        (*pRbEq)[0].add(cx);
-        (*pRbEq)[0].add(cy);
-        cx++;
-        cy++;
-
-        if (m_settings.applyAliasFix == false)
-        {
-            (*pRbEq)[0].add(cy);
-        }
-
-        (*pRbEq)[0].add(cy);
-        start++;
-    }
-
-    UINT_32 numBits = 2 * (numRbTotalLog2 - start);
-
-    for (UINT_32 i = 0; i < numBits; i++)
-    {
-        UINT_32 idx =
-            start + (((start + i) >= numRbTotalLog2) ? (2 * (numRbTotalLog2 - start) - i - 1) : i);
-
-        if ((i % 2) == 1)
-        {
-            (*pRbEq)[idx].add(cx);
-            cx++;
-        }
-        else
-        {
-            (*pRbEq)[idx].add(cy);
-            cy++;
-        }
-    }
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::GetDataEquation
-*
-*   @brief
-*       Get data equation for fmask and Z
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::GetDataEquation(
-    CoordEq* pDataEq,               ///< [out] data surface equation
-    Gfx9DataType dataSurfaceType,   ///< [in] data surface type
-    AddrSwizzleMode swizzleMode,    ///< [in] data surface swizzle mode
-    AddrResourceType resourceType,  ///< [in] data surface resource type
-    UINT_32 elementBytesLog2,       ///< [in] data surface element bytes
-    UINT_32 numSamplesLog2)         ///< [in] data surface sample count
-    const
-{
-    Coordinate cx('x', 0);
-    Coordinate cy('y', 0);
-    Coordinate cz('z', 0);
-    Coordinate cs('s', 0);
-
-    // Clear the equation
-    pDataEq->resize(0);
-    pDataEq->resize(27);
-
-    if (dataSurfaceType == Gfx9DataColor)
-    {
-        if (IsLinear(swizzleMode))
-        {
-            Coordinate cm('m', 0);
-
-            pDataEq->resize(49);
-
-            for (UINT_32 i = 0; i < 49; i++)
-            {
-                (*pDataEq)[i].add(cm);
-                cm++;
-            }
-        }
-        else if (IsThick(resourceType, swizzleMode))
-        {
-            // Color 3d_S and 3d_Z modes, 3d_D is same as color 2d
-            UINT_32 i;
-            if (IsStandardSwizzle(resourceType, swizzleMode))
-            {
-                // Standard 3d swizzle
-                // Fill in bottom x bits
-                for (i = elementBytesLog2; i < 4; i++)
-                {
-                    (*pDataEq)[i].add(cx);
-                    cx++;
-                }
-                // Fill in 2 bits of y and then z
-                for (i = 4; i < 6; i++)
-                {
-                    (*pDataEq)[i].add(cy);
-                    cy++;
-                }
-                for (i = 6; i < 8; i++)
-                {
-                    (*pDataEq)[i].add(cz);
-                    cz++;
-                }
-                if (elementBytesLog2 < 2)
-                {
-                    // fill in z & y bit
-                    (*pDataEq)[8].add(cz);
-                    (*pDataEq)[9].add(cy);
-                    cz++;
-                    cy++;
-                }
-                else if (elementBytesLog2 == 2)
-                {
-                    // fill in y and x bit
-                    (*pDataEq)[8].add(cy);
-                    (*pDataEq)[9].add(cx);
-                    cy++;
-                    cx++;
-                }
-                else
-                {
-                    // fill in 2 x bits
-                    (*pDataEq)[8].add(cx);
-                    cx++;
-                    (*pDataEq)[9].add(cx);
-                    cx++;
-                }
-            }
-            else
-            {
-                // Z 3d swizzle
-                UINT_32 m2dEnd = (elementBytesLog2 ==0) ? 3 : ((elementBytesLog2 < 4) ? 4 : 5);
-                UINT_32 numZs = (elementBytesLog2 == 0 || elementBytesLog2 == 4) ?
-                                2 : ((elementBytesLog2 == 1) ? 3 : 1);
-                pDataEq->mort2d(cx, cy, elementBytesLog2, m2dEnd);
-                for (i = m2dEnd + 1; i <= m2dEnd + numZs; i++)
-                {
-                    (*pDataEq)[i].add(cz);
-                    cz++;
-                }
-                if ((elementBytesLog2 == 0) || (elementBytesLog2 == 3))
-                {
-                    // add an x and z
-                    (*pDataEq)[6].add(cx);
-                    (*pDataEq)[7].add(cz);
-                    cx++;
-                    cz++;
-                }
-                else if (elementBytesLog2 == 2)
-                {
-                    // add a y and z
-                    (*pDataEq)[6].add(cy);
-                    (*pDataEq)[7].add(cz);
-                    cy++;
-                    cz++;
-                }
-                // add y and x
-                (*pDataEq)[8].add(cy);
-                (*pDataEq)[9].add(cx);
-                cy++;
-                cx++;
-            }
-            // Fill in bit 10 and up
-            pDataEq->mort3d( cz, cy, cx, 10 );
-        }
-        else if (IsThin(resourceType, swizzleMode))
-        {
-            UINT_32 blockSizeLog2 = GetBlockSizeLog2(swizzleMode);
-            // Color 2D
-            UINT_32 microYBits = (8 - elementBytesLog2) / 2;
-            UINT_32 tileSplitStart = blockSizeLog2 - numSamplesLog2;
-            UINT_32 i;
-            // Fill in bottom x bits
-            for (i = elementBytesLog2; i < 4; i++)
-            {
-                (*pDataEq)[i].add(cx);
-                cx++;
-            }
-            // Fill in bottom y bits
-            for (i = 4; i < 4 + microYBits; i++)
-            {
-                (*pDataEq)[i].add(cy);
-                cy++;
-            }
-            // Fill in last of the micro_x bits
-            for (i = 4 + microYBits; i < 8; i++)
-            {
-                (*pDataEq)[i].add(cx);
-                cx++;
-            }
-            // Fill in x/y bits below sample split
-            pDataEq->mort2d(cy, cx, 8, tileSplitStart - 1);
-            // Fill in sample bits
-            for (i = 0; i < numSamplesLog2; i++)
-            {
-                cs.set('s', i);
-                (*pDataEq)[tileSplitStart + i].add(cs);
-            }
-            // Fill in x/y bits above sample split
-            if ((numSamplesLog2 & 1) ^ (blockSizeLog2 & 1))
-            {
-                pDataEq->mort2d(cx, cy, blockSizeLog2);
-            }
-            else
-            {
-                pDataEq->mort2d(cy, cx, blockSizeLog2);
-            }
-        }
-        else
-        {
-            ADDR_ASSERT_ALWAYS();
-        }
-    }
-    else
-    {
-        // Fmask or depth
-        UINT_32 sampleStart = elementBytesLog2;
-        UINT_32 pixelStart = elementBytesLog2 + numSamplesLog2;
-        UINT_32 ymajStart = 6 + numSamplesLog2;
-
-        for (UINT_32 s = 0; s < numSamplesLog2; s++)
-        {
-            cs.set('s', s);
-            (*pDataEq)[sampleStart + s].add(cs);
-        }
-
-        // Put in the x-major order pixel bits
-        pDataEq->mort2d(cx, cy, pixelStart, ymajStart - 1);
-        // Put in the y-major order pixel bits
-        pDataEq->mort2d(cy, cx, ymajStart);
-    }
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::GetPipeEquation
-*
-*   @brief
-*       Get pipe equation
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::GetPipeEquation(
-    CoordEq*         pPipeEq,            ///< [out] pipe equation
-    CoordEq*         pDataEq,            ///< [in] data equation
-    UINT_32          pipeInterleaveLog2, ///< [in] pipe interleave
-    UINT_32          numPipeLog2,        ///< [in] number of pipes
-    UINT_32          numSamplesLog2,     ///< [in] data surface sample count
-    Gfx9DataType     dataSurfaceType,    ///< [in] data surface type
-    AddrSwizzleMode  swizzleMode,        ///< [in] data surface swizzle mode
-    AddrResourceType resourceType        ///< [in] data surface resource type
-    ) const
-{
-    UINT_32 blockSizeLog2 = GetBlockSizeLog2(swizzleMode);
-    CoordEq dataEq;
-
-    pDataEq->copy(dataEq);
-
-    if (dataSurfaceType == Gfx9DataColor)
-    {
-        INT_32 shift = static_cast<INT_32>(numSamplesLog2);
-        dataEq.shift(-shift, blockSizeLog2 - numSamplesLog2);
-    }
-
-    dataEq.copy(*pPipeEq, pipeInterleaveLog2, numPipeLog2);
-
-    // This section should only apply to z/stencil, maybe fmask
-    // If the pipe bit is below the comp block size,
-    // then keep moving up the address until we find a bit that is above
-    UINT_32 pipeStart = 0;
-
-    if (dataSurfaceType != Gfx9DataColor)
-    {
-        Coordinate tileMin('x', 3);
-
-        while (dataEq[pipeInterleaveLog2 + pipeStart][0] < tileMin)
-        {
-            pipeStart++;
-        }
-
-        // if pipe is 0, then the first pipe bit is above the comp block size,
-        // so we don't need to do anything
-        // Note, this if condition is not necessary, since if we execute the loop when pipe==0,
-        // we will get the same pipe equation
-        if (pipeStart != 0)
-        {
-            for (UINT_32 i = 0; i < numPipeLog2; i++)
-            {
-                // Copy the jth bit above pipe interleave to the current pipe equation bit
-                dataEq[pipeInterleaveLog2 + pipeStart + i].copyto((*pPipeEq)[i]);
-            }
-        }
-    }
-
-    if (IsPrt(swizzleMode))
-    {
-        // Clear out bits above the block size if prt's are enabled
-        dataEq.resize(blockSizeLog2);
-        dataEq.resize(48);
-    }
-
-    if (IsXor(swizzleMode))
-    {
-        CoordEq xorMask;
-
-        if (IsThick(resourceType, swizzleMode))
-        {
-            CoordEq xorMask2;
-
-            dataEq.copy(xorMask2, pipeInterleaveLog2 + numPipeLog2, 2 * numPipeLog2);
-
-            xorMask.resize(numPipeLog2);
-
-            for (UINT_32 pipeIdx = 0; pipeIdx < numPipeLog2; pipeIdx++)
-            {
-                xorMask[pipeIdx].add(xorMask2[2 * pipeIdx]);
-                xorMask[pipeIdx].add(xorMask2[2 * pipeIdx + 1]);
-            }
-        }
-        else
-        {
-            // Xor in the bits above the pipe+gpu bits
-            dataEq.copy(xorMask, pipeInterleaveLog2 + pipeStart + numPipeLog2, numPipeLog2);
-
-            if ((numSamplesLog2 == 0) && (IsPrt(swizzleMode) == FALSE))
-            {
-                Coordinate co;
-                CoordEq xorMask2;
-                // if 1xaa and not prt, then xor in the z bits
-                xorMask2.resize(0);
-                xorMask2.resize(numPipeLog2);
-                for (UINT_32 pipeIdx = 0; pipeIdx < numPipeLog2; pipeIdx++)
-                {
-                    co.set('z', numPipeLog2 - 1 - pipeIdx);
-                    xorMask2[pipeIdx].add(co);
-                }
-
-                pPipeEq->xorin(xorMask2);
-            }
-        }
-
-        xorMask.reverse();
-        pPipeEq->xorin(xorMask);
-    }
-}
-/**
-************************************************************************************************************************
-*   Gfx9Lib::GetMetaEquation
-*
-*   @brief
-*       Get meta equation for cmask/htile/DCC
-*   @return
-*       Pointer to a calculated meta equation
-************************************************************************************************************************
-*/
-const CoordEq* Gfx9Lib::GetMetaEquation(
-    const MetaEqParams& metaEqParams)
-{
-    UINT_32 cachedMetaEqIndex;
-
-    for (cachedMetaEqIndex = 0; cachedMetaEqIndex < MaxCachedMetaEq; cachedMetaEqIndex++)
-    {
-        if (memcmp(&metaEqParams,
-                   &m_cachedMetaEqKey[cachedMetaEqIndex],
-                   static_cast<UINT_32>(sizeof(metaEqParams))) == 0)
-        {
-            break;
-        }
-    }
-
-    CoordEq* pMetaEq = NULL;
-
-    if (cachedMetaEqIndex < MaxCachedMetaEq)
-    {
-        pMetaEq = &m_cachedMetaEq[cachedMetaEqIndex];
-    }
-    else
-    {
-        m_cachedMetaEqKey[m_metaEqOverrideIndex] = metaEqParams;
-
-        pMetaEq = &m_cachedMetaEq[m_metaEqOverrideIndex++];
-
-        m_metaEqOverrideIndex %= MaxCachedMetaEq;
-
-        GenMetaEquation(pMetaEq,
-                        metaEqParams.maxMip,
-                        metaEqParams.elementBytesLog2,
-                        metaEqParams.numSamplesLog2,
-                        metaEqParams.metaFlag,
-                        metaEqParams.dataSurfaceType,
-                        metaEqParams.swizzleMode,
-                        metaEqParams.resourceType,
-                        metaEqParams.metaBlkWidthLog2,
-                        metaEqParams.metaBlkHeightLog2,
-                        metaEqParams.metaBlkDepthLog2,
-                        metaEqParams.compBlkWidthLog2,
-                        metaEqParams.compBlkHeightLog2,
-                        metaEqParams.compBlkDepthLog2);
-    }
-
-    return pMetaEq;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::GenMetaEquation
-*
-*   @brief
-*       Get meta equation for cmask/htile/DCC
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::GenMetaEquation(
-    CoordEq*         pMetaEq,               ///< [out] meta equation
-    UINT_32          maxMip,                ///< [in] max mip Id
-    UINT_32          elementBytesLog2,      ///< [in] data surface element bytes
-    UINT_32          numSamplesLog2,        ///< [in] data surface sample count
-    ADDR2_META_FLAGS metaFlag,              ///< [in] meta falg
-    Gfx9DataType     dataSurfaceType,       ///< [in] data surface type
-    AddrSwizzleMode  swizzleMode,           ///< [in] data surface swizzle mode
-    AddrResourceType resourceType,          ///< [in] data surface resource type
-    UINT_32          metaBlkWidthLog2,      ///< [in] meta block width
-    UINT_32          metaBlkHeightLog2,     ///< [in] meta block height
-    UINT_32          metaBlkDepthLog2,      ///< [in] meta block depth
-    UINT_32          compBlkWidthLog2,      ///< [in] compress block width
-    UINT_32          compBlkHeightLog2,     ///< [in] compress block height
-    UINT_32          compBlkDepthLog2)      ///< [in] compress block depth
-    const
-{
-    UINT_32 numPipeTotalLog2   = GetPipeLog2ForMetaAddressing(metaFlag.pipeAligned, swizzleMode);
-    UINT_32 pipeInterleaveLog2 = m_pipeInterleaveLog2;
-
-    // Get the correct data address and rb equation
-    CoordEq dataEq;
-    GetDataEquation(&dataEq, dataSurfaceType, swizzleMode, resourceType,
-                    elementBytesLog2, numSamplesLog2);
-
-    // Get pipe and rb equations
-    CoordEq pipeEquation;
-    GetPipeEquation(&pipeEquation, &dataEq, pipeInterleaveLog2, numPipeTotalLog2,
-                    numSamplesLog2, dataSurfaceType, swizzleMode, resourceType);
-    numPipeTotalLog2 = pipeEquation.getsize();
-
-    if (metaFlag.linear)
-    {
-        // Linear metadata supporting was removed for GFX9! No one can use this feature.
-        ADDR_ASSERT_ALWAYS();
-
-        ADDR_ASSERT(dataSurfaceType == Gfx9DataColor);
-
-        dataEq.copy(*pMetaEq);
-
-        if (IsLinear(swizzleMode))
-        {
-            if (metaFlag.pipeAligned)
-            {
-                // Remove the pipe bits
-                INT_32 shift = static_cast<INT_32>(numPipeTotalLog2);
-                pMetaEq->shift(-shift, pipeInterleaveLog2);
-            }
-            // Divide by comp block size, which for linear (which is always color) is 256 B
-            pMetaEq->shift(-8);
-
-            if (metaFlag.pipeAligned)
-            {
-                // Put pipe bits back in
-                pMetaEq->shift(numPipeTotalLog2, pipeInterleaveLog2);
-
-                for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
-                {
-                    pipeEquation[i].copyto((*pMetaEq)[pipeInterleaveLog2 + i]);
-                }
-            }
-        }
-
-        pMetaEq->shift(1);
-    }
-    else
-    {
-        UINT_32 maxCompFragLog2 = static_cast<INT_32>(m_maxCompFragLog2);
-        UINT_32 compFragLog2 =
-            ((dataSurfaceType == Gfx9DataColor) && (numSamplesLog2 > maxCompFragLog2)) ?
-            maxCompFragLog2 : numSamplesLog2;
-
-        UINT_32 uncompFragLog2 = numSamplesLog2 - compFragLog2;
-
-        // Make sure the metaaddr is cleared
-        pMetaEq->resize(0);
-        pMetaEq->resize(27);
-
-        if (IsThick(resourceType, swizzleMode))
-        {
-            Coordinate cx('x', 0);
-            Coordinate cy('y', 0);
-            Coordinate cz('z', 0);
-
-            if (maxMip > 0)
-            {
-                pMetaEq->mort3d(cy, cx, cz);
-            }
-            else
-            {
-                pMetaEq->mort3d(cx, cy, cz);
-            }
-        }
-        else
-        {
-            Coordinate cx('x', 0);
-            Coordinate cy('y', 0);
-            Coordinate cs;
-
-            if (maxMip > 0)
-            {
-                pMetaEq->mort2d(cy, cx, compFragLog2);
-            }
-            else
-            {
-                pMetaEq->mort2d(cx, cy, compFragLog2);
-            }
-
-            //------------------------------------------------------------------------------------------------------------------------
-            // Put the compressible fragments at the lsb
-            // the uncompressible frags will be at the msb of the micro address
-            //------------------------------------------------------------------------------------------------------------------------
-            for (UINT_32 s = 0; s < compFragLog2; s++)
-            {
-                cs.set('s', s);
-                (*pMetaEq)[s].add(cs);
-            }
-        }
-
-        // Keep a copy of the pipe equations
-        CoordEq origPipeEquation;
-        pipeEquation.copy(origPipeEquation);
-
-        Coordinate co;
-        // filter out everything under the compressed block size
-        co.set('x', compBlkWidthLog2);
-        pMetaEq->Filter('<', co, 0, 'x');
-        co.set('y', compBlkHeightLog2);
-        pMetaEq->Filter('<', co, 0, 'y');
-        co.set('z', compBlkDepthLog2);
-        pMetaEq->Filter('<', co, 0, 'z');
-
-        // For non-color, filter out sample bits
-        if (dataSurfaceType != Gfx9DataColor)
-        {
-            co.set('x', 0);
-            pMetaEq->Filter('<', co, 0, 's');
-        }
-
-        // filter out everything above the metablock size
-        co.set('x', metaBlkWidthLog2 - 1);
-        pMetaEq->Filter('>', co, 0, 'x');
-        co.set('y', metaBlkHeightLog2 - 1);
-        pMetaEq->Filter('>', co, 0, 'y');
-        co.set('z', metaBlkDepthLog2 - 1);
-        pMetaEq->Filter('>', co, 0, 'z');
-
-        // filter out everything above the metablock size for the channel bits
-        co.set('x', metaBlkWidthLog2 - 1);
-        pipeEquation.Filter('>', co, 0, 'x');
-        co.set('y', metaBlkHeightLog2 - 1);
-        pipeEquation.Filter('>', co, 0, 'y');
-        co.set('z', metaBlkDepthLog2 - 1);
-        pipeEquation.Filter('>', co, 0, 'z');
-
-        // Make sure we still have the same number of channel bits
-        if (pipeEquation.getsize() != numPipeTotalLog2)
-        {
-            ADDR_ASSERT_ALWAYS();
-        }
-
-        // Loop through all channel and rb bits,
-        // and make sure these components exist in the metadata address
-        for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
-        {
-            for (UINT_32 j = pipeEquation[i].getsize(); j > 0; j--)
-            {
-                if (pMetaEq->Exists(pipeEquation[i][j - 1]) == FALSE)
-                {
-                    ADDR_ASSERT_ALWAYS();
-                }
-            }
-        }
-
-        const UINT_32 numSeLog2     = metaFlag.rbAligned ? m_seLog2      : 0;
-        const UINT_32 numRbPeSeLog2 = metaFlag.rbAligned ? m_rbPerSeLog2 : 0;
-        const UINT_32 numRbTotalLog2 = numRbPeSeLog2 + numSeLog2;
-        CoordEq       origRbEquation;
-
-        GetRbEquation(&origRbEquation, numRbPeSeLog2, numSeLog2);
-
-        CoordEq rbEquation = origRbEquation;
-
-        for (UINT_32 i = 0; i < numRbTotalLog2; i++)
-        {
-            for (UINT_32 j = rbEquation[i].getsize(); j > 0; j--)
-            {
-                if (pMetaEq->Exists(rbEquation[i][j - 1]) == FALSE)
-                {
-                    ADDR_ASSERT_ALWAYS();
-                }
-            }
-        }
-
-        if (m_settings.applyAliasFix)
-        {
-            co.set('z', -1);
-        }
-
-        // Loop through each rb id bit; if it is equal to any of the filtered channel bits, clear it
-        for (UINT_32 i = 0; i < numRbTotalLog2; i++)
-        {
-            for (UINT_32 j = 0; j < numPipeTotalLog2; j++)
-            {
-                BOOL_32 isRbEquationInPipeEquation = FALSE;
-
-                if (m_settings.applyAliasFix)
-                {
-                    CoordTerm filteredPipeEq;
-                    filteredPipeEq = pipeEquation[j];
-
-                    filteredPipeEq.Filter('>', co, 0, 'z');
-
-                    isRbEquationInPipeEquation = (rbEquation[i] == filteredPipeEq);
-                }
-                else
-                {
-                    isRbEquationInPipeEquation = (rbEquation[i] == pipeEquation[j]);
-                }
-
-                if (isRbEquationInPipeEquation)
-                {
-                    rbEquation[i].Clear();
-                }
-            }
-        }
-
-         bool rbAppendedWithPipeBits[1 << (MaxSeLog2 + MaxRbPerSeLog2)] = {};
-
-        // Loop through each bit of the channel, get the smallest coordinate,
-        // and remove it from the metaaddr, and rb_equation
-        for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
-        {
-            pipeEquation[i].getsmallest(co);
-
-            UINT_32 old_size = pMetaEq->getsize();
-            pMetaEq->Filter('=', co);
-            UINT_32 new_size = pMetaEq->getsize();
-            if (new_size != old_size-1)
-            {
-                ADDR_ASSERT_ALWAYS();
-            }
-            pipeEquation.remove(co);
-            for (UINT_32 j = 0; j < numRbTotalLog2; j++)
-            {
-                if (rbEquation[j].remove(co))
-                {
-                    // if we actually removed something from this bit, then add the remaining
-                    // channel bits, as these can be removed for this bit
-                    for (UINT_32 k = 0; k < pipeEquation[i].getsize(); k++)
-                    {
-                        if (pipeEquation[i][k] != co)
-                        {
-                            rbEquation[j].add(pipeEquation[i][k]);
-                            rbAppendedWithPipeBits[j] = true;
-                        }
-                    }
-                }
-            }
-        }
-
-        // Loop through the rb bits and see what remain;
-        // filter out the smallest coordinate if it remains
-        UINT_32 rbBitsLeft = 0;
-        for (UINT_32 i = 0; i < numRbTotalLog2; i++)
-        {
-            BOOL_32 isRbEqAppended = FALSE;
-
-            if (m_settings.applyAliasFix)
-            {
-                isRbEqAppended = (rbEquation[i].getsize() > (rbAppendedWithPipeBits[i] ? 1 : 0));
-            }
-            else
-            {
-                isRbEqAppended = (rbEquation[i].getsize() > 0);
-            }
-
-            if (isRbEqAppended)
-            {
-                rbBitsLeft++;
-                rbEquation[i].getsmallest(co);
-                UINT_32 old_size = pMetaEq->getsize();
-                pMetaEq->Filter('=', co);
-                UINT_32 new_size = pMetaEq->getsize();
-                if (new_size != old_size - 1)
-                {
-                    // assert warning
-                }
-                for (UINT_32 j = i + 1; j < numRbTotalLog2; j++)
-                {
-                    if (rbEquation[j].remove(co))
-                    {
-                        // if we actually removed something from this bit, then add the remaining
-                        // rb bits, as these can be removed for this bit
-                        for (UINT_32 k = 0; k < rbEquation[i].getsize(); k++)
-                        {
-                            if (rbEquation[i][k] != co)
-                            {
-                                rbEquation[j].add(rbEquation[i][k]);
-                                rbAppendedWithPipeBits[j] |= rbAppendedWithPipeBits[i];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // capture the size of the metaaddr
-        UINT_32 metaSize = pMetaEq->getsize();
-        // resize to 49 bits...make this a nibble address
-        pMetaEq->resize(49);
-        // Concatenate the macro address above the current address
-        for (UINT_32 i = metaSize, j = 0; i < 49; i++, j++)
-        {
-            co.set('m', j);
-            (*pMetaEq)[i].add(co);
-        }
-
-        // Multiply by meta element size (in nibbles)
-        if (dataSurfaceType == Gfx9DataColor)
-        {
-            pMetaEq->shift(1);
-        }
-        else if (dataSurfaceType == Gfx9DataDepthStencil)
-        {
-            pMetaEq->shift(3);
-        }
-
-        //------------------------------------------------------------------------------------------
-        // Note the pipeInterleaveLog2+1 is because address is a nibble address
-        // Shift up from pipe interleave number of channel
-        // and rb bits left, and uncompressed fragments
-        //------------------------------------------------------------------------------------------
-
-        pMetaEq->shift(numPipeTotalLog2 + rbBitsLeft + uncompFragLog2, pipeInterleaveLog2 + 1);
-
-        // Put in the channel bits
-        for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
-        {
-            origPipeEquation[i].copyto((*pMetaEq)[pipeInterleaveLog2+1 + i]);
-        }
-
-        // Put in remaining rb bits
-        for (UINT_32 i = 0, j = 0; j < rbBitsLeft; i = (i + 1) % numRbTotalLog2)
-        {
-            BOOL_32 isRbEqAppended = FALSE;
-
-            if (m_settings.applyAliasFix)
-            {
-                isRbEqAppended = (rbEquation[i].getsize() > (rbAppendedWithPipeBits[i] ? 1 : 0));
-            }
-            else
-            {
-                isRbEqAppended = (rbEquation[i].getsize() > 0);
-            }
-
-            if (isRbEqAppended)
-            {
-                origRbEquation[i].copyto((*pMetaEq)[pipeInterleaveLog2 + 1 + numPipeTotalLog2 + j]);
-                // Mark any rb bit we add in to the rb mask
-                j++;
-            }
-        }
-
-        //------------------------------------------------------------------------------------------
-        // Put in the uncompressed fragment bits
-        //------------------------------------------------------------------------------------------
-        for (UINT_32 i = 0; i < uncompFragLog2; i++)
-        {
-            co.set('s', compFragLog2 + i);
-            (*pMetaEq)[pipeInterleaveLog2 + 1 + numPipeTotalLog2 + rbBitsLeft + i].add(co);
-        }
-    }
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::IsEquationSupported
-*
-*   @brief
-*       Check if equation is supported for given swizzle mode and resource type.
-*
-*   @return
-*       TRUE if supported
-************************************************************************************************************************
-*/
-BOOL_32 Gfx9Lib::IsEquationSupported(
-    AddrResourceType rsrcType,
-    AddrSwizzleMode  swMode,
-    UINT_32          elementBytesLog2) const
-{
-    BOOL_32 supported = (elementBytesLog2 < MaxElementBytesLog2) &&
-                        (IsLinear(swMode) == FALSE) &&
-                        (((IsTex2d(rsrcType) == TRUE) &&
-                          ((elementBytesLog2 < 4) ||
-                           ((IsRotateSwizzle(swMode) == FALSE) &&
-                            (IsZOrderSwizzle(swMode) == FALSE)))) ||
-                         ((IsTex3d(rsrcType) == TRUE) &&
-                          (IsRotateSwizzle(swMode) == FALSE) &&
-                          (IsBlock256b(swMode) == FALSE)));
-
-    return supported;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::InitEquationTable
-*
-*   @brief
-*       Initialize Equation table.
-*
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::InitEquationTable()
-{
-    memset(m_equationTable, 0, sizeof(m_equationTable));
-
-    // Loop all possible resource type (2D/3D)
-    for (UINT_32 rsrcTypeIdx = 0; rsrcTypeIdx < MaxRsrcType; rsrcTypeIdx++)
-    {
-        AddrResourceType rsrcType = static_cast<AddrResourceType>(rsrcTypeIdx + ADDR_RSRC_TEX_2D);
-
-        // Loop all possible swizzle mode
-        for (UINT_32 swModeIdx = 0; swModeIdx < MaxSwMode; swModeIdx++)
-        {
-            AddrSwizzleMode swMode = static_cast<AddrSwizzleMode>(swModeIdx);
-
-            // Loop all possible bpp
-            for (UINT_32 bppIdx = 0; bppIdx < MaxElementBytesLog2; bppIdx++)
-            {
-                UINT_32 equationIndex = ADDR_INVALID_EQUATION_INDEX;
-
-                // Check if the input is supported
-                if (IsEquationSupported(rsrcType, swMode, bppIdx))
-                {
-                    ADDR_EQUATION equation;
-                    ADDR_E_RETURNCODE retCode;
-
-                    memset(&equation, 0, sizeof(ADDR_EQUATION));
-
-                    // Generate the equation
-                    if (IsBlock256b(swMode) && IsTex2d(rsrcType))
-                    {
-                        retCode = ComputeBlock256Equation(rsrcType, swMode, bppIdx, &equation);
-                    }
-                    else if (IsThin(rsrcType, swMode))
-                    {
-                        retCode = ComputeThinEquation(rsrcType, swMode, bppIdx, &equation);
-                    }
-                    else
-                    {
-                        retCode = ComputeThickEquation(rsrcType, swMode, bppIdx, &equation);
-                    }
-
-                    // Only fill the equation into the table if the return code is ADDR_OK,
-                    // otherwise if the return code is not ADDR_OK, it indicates this is not
-                    // a valid input, we do nothing but just fill invalid equation index
-                    // into the lookup table.
-                    if (retCode == ADDR_OK)
-                    {
-                        equationIndex = m_numEquations;
-                        ADDR_ASSERT(equationIndex < EquationTableSize);
-
-                        m_equationTable[equationIndex] = equation;
-
-                        m_numEquations++;
-                    }
-                    else
-                    {
-                        ADDR_ASSERT_ALWAYS();
-                    }
-                }
-
-                // Fill the index into the lookup table, if the combination is not supported
-                // fill the invalid equation index
-                m_equationLookupTable[rsrcTypeIdx][swModeIdx][bppIdx] = equationIndex;
-            }
-        }
-    }
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlGetEquationIndex
-*
-*   @brief
-*       Interface function stub of GetEquationIndex
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-UINT_32 Gfx9Lib::HwlGetEquationIndex(
-    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut
-    ) const
-{
-    AddrResourceType rsrcType         = pIn->resourceType;
-    AddrSwizzleMode  swMode           = pIn->swizzleMode;
-    UINT_32          elementBytesLog2 = Log2(pIn->bpp >> 3);
-    UINT_32          index            = ADDR_INVALID_EQUATION_INDEX;
-
-    if (IsEquationSupported(rsrcType, swMode, elementBytesLog2))
-    {
-        UINT_32 rsrcTypeIdx = static_cast<UINT_32>(rsrcType) - 1;
-        UINT_32 swModeIdx   = static_cast<UINT_32>(swMode);
-
-        index = m_equationLookupTable[rsrcTypeIdx][swModeIdx][elementBytesLog2];
-    }
-
-    if (pOut->pMipInfo != NULL)
-    {
-        for (UINT_32 i = 0; i < pIn->numMipLevels; i++)
-        {
-            pOut->pMipInfo[i].equationIndex = index;
-        }
-    }
-
-    return index;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeBlock256Equation
-*
-*   @brief
-*       Interface function stub of ComputeBlock256Equation
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeBlock256Equation(
-    AddrResourceType rsrcType,
-    AddrSwizzleMode  swMode,
-    UINT_32          elementBytesLog2,
-    ADDR_EQUATION*   pEquation) const
-{
-    ADDR_E_RETURNCODE ret = ADDR_OK;
-
-    pEquation->numBits = 8;
-
-    UINT_32 i = 0;
-    for (; i < elementBytesLog2; i++)
-    {
-        InitChannel(1, 0 , i, &pEquation->addr[i]);
-    }
-
-    ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[elementBytesLog2];
-
-    const UINT_32 maxBitsUsed = 4;
-    ADDR_CHANNEL_SETTING x[maxBitsUsed] = {};
-    ADDR_CHANNEL_SETTING y[maxBitsUsed] = {};
-
-    for (i = 0; i < maxBitsUsed; i++)
-    {
-        InitChannel(1, 0, elementBytesLog2 + i, &x[i]);
-        InitChannel(1, 1, i, &y[i]);
-    }
-
-    if (IsStandardSwizzle(rsrcType, swMode))
-    {
-        switch (elementBytesLog2)
-        {
-            case 0:
-                pixelBit[0] = x[0];
-                pixelBit[1] = x[1];
-                pixelBit[2] = x[2];
-                pixelBit[3] = x[3];
-                pixelBit[4] = y[0];
-                pixelBit[5] = y[1];
-                pixelBit[6] = y[2];
-                pixelBit[7] = y[3];
-                break;
-            case 1:
-                pixelBit[0] = x[0];
-                pixelBit[1] = x[1];
-                pixelBit[2] = x[2];
-                pixelBit[3] = y[0];
-                pixelBit[4] = y[1];
-                pixelBit[5] = y[2];
-                pixelBit[6] = x[3];
-                break;
-            case 2:
-                pixelBit[0] = x[0];
-                pixelBit[1] = x[1];
-                pixelBit[2] = y[0];
-                pixelBit[3] = y[1];
-                pixelBit[4] = y[2];
-                pixelBit[5] = x[2];
-                break;
-            case 3:
-                pixelBit[0] = x[0];
-                pixelBit[1] = y[0];
-                pixelBit[2] = y[1];
-                pixelBit[3] = x[1];
-                pixelBit[4] = x[2];
-                break;
-            case 4:
-                pixelBit[0] = y[0];
-                pixelBit[1] = y[1];
-                pixelBit[2] = x[0];
-                pixelBit[3] = x[1];
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                ret = ADDR_INVALIDPARAMS;
-                break;
-        }
-    }
-    else if (IsDisplaySwizzle(rsrcType, swMode))
-    {
-        switch (elementBytesLog2)
-        {
-            case 0:
-                pixelBit[0] = x[0];
-                pixelBit[1] = x[1];
-                pixelBit[2] = x[2];
-                pixelBit[3] = y[1];
-                pixelBit[4] = y[0];
-                pixelBit[5] = y[2];
-                pixelBit[6] = x[3];
-                pixelBit[7] = y[3];
-                break;
-            case 1:
-                pixelBit[0] = x[0];
-                pixelBit[1] = x[1];
-                pixelBit[2] = x[2];
-                pixelBit[3] = y[0];
-                pixelBit[4] = y[1];
-                pixelBit[5] = y[2];
-                pixelBit[6] = x[3];
-                break;
-            case 2:
-                pixelBit[0] = x[0];
-                pixelBit[1] = x[1];
-                pixelBit[2] = y[0];
-                pixelBit[3] = x[2];
-                pixelBit[4] = y[1];
-                pixelBit[5] = y[2];
-                break;
-            case 3:
-                pixelBit[0] = x[0];
-                pixelBit[1] = y[0];
-                pixelBit[2] = x[1];
-                pixelBit[3] = x[2];
-                pixelBit[4] = y[1];
-                break;
-            case 4:
-                pixelBit[0] = x[0];
-                pixelBit[1] = y[0];
-                pixelBit[2] = x[1];
-                pixelBit[3] = y[1];
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                ret = ADDR_INVALIDPARAMS;
-                break;
-        }
-    }
-    else if (IsRotateSwizzle(swMode))
-    {
-        switch (elementBytesLog2)
-        {
-            case 0:
-                pixelBit[0] = y[0];
-                pixelBit[1] = y[1];
-                pixelBit[2] = y[2];
-                pixelBit[3] = x[1];
-                pixelBit[4] = x[0];
-                pixelBit[5] = x[2];
-                pixelBit[6] = x[3];
-                pixelBit[7] = y[3];
-                break;
-            case 1:
-                pixelBit[0] = y[0];
-                pixelBit[1] = y[1];
-                pixelBit[2] = y[2];
-                pixelBit[3] = x[0];
-                pixelBit[4] = x[1];
-                pixelBit[5] = x[2];
-                pixelBit[6] = x[3];
-                break;
-            case 2:
-                pixelBit[0] = y[0];
-                pixelBit[1] = y[1];
-                pixelBit[2] = x[0];
-                pixelBit[3] = y[2];
-                pixelBit[4] = x[1];
-                pixelBit[5] = x[2];
-                break;
-            case 3:
-                pixelBit[0] = y[0];
-                pixelBit[1] = x[0];
-                pixelBit[2] = y[1];
-                pixelBit[3] = x[1];
-                pixelBit[4] = x[2];
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-            case 4:
-                ret = ADDR_INVALIDPARAMS;
-                break;
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        ret = ADDR_INVALIDPARAMS;
-    }
-
-    // Post validation
-    if (ret == ADDR_OK)
-    {
-        MAYBE_UNUSED Dim2d microBlockDim = Block256_2d[elementBytesLog2];
-        ADDR_ASSERT((2u << GetMaxValidChannelIndex(pEquation->addr, 8, 0)) ==
-                    (microBlockDim.w * (1 << elementBytesLog2)));
-        ADDR_ASSERT((2u << GetMaxValidChannelIndex(pEquation->addr, 8, 1)) == microBlockDim.h);
-    }
-
-    return ret;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeThinEquation
-*
-*   @brief
-*       Interface function stub of ComputeThinEquation
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeThinEquation(
-    AddrResourceType rsrcType,
-    AddrSwizzleMode  swMode,
-    UINT_32          elementBytesLog2,
-    ADDR_EQUATION*   pEquation) const
-{
-    ADDR_E_RETURNCODE ret = ADDR_OK;
-
-    UINT_32 blockSizeLog2 = GetBlockSizeLog2(swMode);
-
-    UINT_32 maxXorBits = blockSizeLog2;
-    if (IsNonPrtXor(swMode))
-    {
-        // For non-prt-xor, maybe need to initialize some more bits for xor
-        // The highest xor bit used in equation will be max the following 3 items:
-        // 1. m_pipeInterleaveLog2 + 2 * pipeXorBits
-        // 2. m_pipeInterleaveLog2 + pipeXorBits + 2 * bankXorBits
-        // 3. blockSizeLog2
-
-        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 + 2 * GetPipeXorBits(blockSizeLog2));
-        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 +
-                                     GetPipeXorBits(blockSizeLog2) +
-                                     2 * GetBankXorBits(blockSizeLog2));
-    }
-
-    const UINT_32 maxBitsUsed = 14;
-    ADDR_ASSERT((2 * maxBitsUsed) >= maxXorBits);
-    ADDR_CHANNEL_SETTING x[maxBitsUsed] = {};
-    ADDR_CHANNEL_SETTING y[maxBitsUsed] = {};
-
-    const UINT_32 extraXorBits = 16;
-    ADDR_ASSERT(extraXorBits >= maxXorBits - blockSizeLog2);
-    ADDR_CHANNEL_SETTING xorExtra[extraXorBits] = {};
-
-    for (UINT_32 i = 0; i < maxBitsUsed; i++)
-    {
-        InitChannel(1, 0, elementBytesLog2 + i, &x[i]);
-        InitChannel(1, 1, i, &y[i]);
-    }
-
-    ADDR_CHANNEL_SETTING* pixelBit = pEquation->addr;
-
-    for (UINT_32 i = 0; i < elementBytesLog2; i++)
-    {
-        InitChannel(1, 0 , i, &pixelBit[i]);
-    }
-
-    UINT_32 xIdx = 0;
-    UINT_32 yIdx = 0;
-    UINT_32 lowBits = 0;
-
-    if (IsZOrderSwizzle(swMode))
-    {
-        if (elementBytesLog2 <= 3)
-        {
-            for (UINT_32 i = elementBytesLog2; i < 6; i++)
-            {
-                pixelBit[i] = (((i - elementBytesLog2) & 1) == 0) ? x[xIdx++] : y[yIdx++];
-            }
-
-            lowBits = 6;
-        }
-        else
-        {
-            ret = ADDR_INVALIDPARAMS;
-        }
-    }
-    else
-    {
-        ret = HwlComputeBlock256Equation(rsrcType, swMode, elementBytesLog2, pEquation);
-
-        if (ret == ADDR_OK)
-        {
-            Dim2d microBlockDim = Block256_2d[elementBytesLog2];
-            xIdx = Log2(microBlockDim.w);
-            yIdx = Log2(microBlockDim.h);
-            lowBits = 8;
-        }
-    }
-
-    if (ret == ADDR_OK)
-    {
-        for (UINT_32 i = lowBits; i < blockSizeLog2; i++)
-        {
-            pixelBit[i] = ((i & 1) == 0) ? y[yIdx++] : x[xIdx++];
-        }
-
-        for (UINT_32 i = blockSizeLog2; i < maxXorBits; i++)
-        {
-            xorExtra[i - blockSizeLog2] = ((i & 1) == 0) ? y[yIdx++] : x[xIdx++];
-        }
-
-        if (IsXor(swMode))
-        {
-            // Fill XOR bits
-            UINT_32 pipeStart = m_pipeInterleaveLog2;
-            UINT_32 pipeXorBits = GetPipeXorBits(blockSizeLog2);
-
-            UINT_32 bankStart = pipeStart + pipeXorBits;
-            UINT_32 bankXorBits = GetBankXorBits(blockSizeLog2);
-
-            for (UINT_32 i = 0; i < pipeXorBits; i++)
-            {
-                UINT_32               xor1BitPos = pipeStart + 2 * pipeXorBits - 1 - i;
-                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
-                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
-
-                InitChannel(&pEquation->xor1[pipeStart + i], pXor1Src);
-            }
-
-            for (UINT_32 i = 0; i < bankXorBits; i++)
-            {
-                UINT_32               xor1BitPos = bankStart + 2 * bankXorBits - 1 - i;
-                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
-                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
-
-                InitChannel(&pEquation->xor1[bankStart + i], pXor1Src);
-            }
-
-            if (IsPrt(swMode) == FALSE)
-            {
-                for (UINT_32 i = 0; i < pipeXorBits; i++)
-                {
-                    InitChannel(1, 2, pipeXorBits - i - 1, &pEquation->xor2[pipeStart + i]);
-                }
-
-                for (UINT_32 i = 0; i < bankXorBits; i++)
-                {
-                    InitChannel(1, 2, bankXorBits - i - 1 + pipeXorBits, &pEquation->xor2[bankStart + i]);
-                }
-            }
-        }
-
-        pEquation->numBits = blockSizeLog2;
-    }
-
-    return ret;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeThickEquation
-*
-*   @brief
-*       Interface function stub of ComputeThickEquation
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeThickEquation(
-    AddrResourceType rsrcType,
-    AddrSwizzleMode  swMode,
-    UINT_32          elementBytesLog2,
-    ADDR_EQUATION*   pEquation) const
-{
-    ADDR_E_RETURNCODE ret = ADDR_OK;
-
-    ADDR_ASSERT(IsTex3d(rsrcType));
-
-    UINT_32 blockSizeLog2 = GetBlockSizeLog2(swMode);
-
-    UINT_32 maxXorBits = blockSizeLog2;
-    if (IsNonPrtXor(swMode))
-    {
-        // For non-prt-xor, maybe need to initialize some more bits for xor
-        // The highest xor bit used in equation will be max the following 3:
-        // 1. m_pipeInterleaveLog2 + 3 * pipeXorBits
-        // 2. m_pipeInterleaveLog2 + pipeXorBits + 3 * bankXorBits
-        // 3. blockSizeLog2
-
-        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 + 3 * GetPipeXorBits(blockSizeLog2));
-        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 +
-                                     GetPipeXorBits(blockSizeLog2) +
-                                     3 * GetBankXorBits(blockSizeLog2));
-    }
-
-    for (UINT_32 i = 0; i < elementBytesLog2; i++)
-    {
-        InitChannel(1, 0 , i, &pEquation->addr[i]);
-    }
-
-    ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[elementBytesLog2];
-
-    const UINT_32 maxBitsUsed = 12;
-    ADDR_ASSERT((3 * maxBitsUsed) >= maxXorBits);
-    ADDR_CHANNEL_SETTING x[maxBitsUsed] = {};
-    ADDR_CHANNEL_SETTING y[maxBitsUsed] = {};
-    ADDR_CHANNEL_SETTING z[maxBitsUsed] = {};
-
-    const UINT_32 extraXorBits = 24;
-    ADDR_ASSERT(extraXorBits >= maxXorBits - blockSizeLog2);
-    ADDR_CHANNEL_SETTING xorExtra[extraXorBits] = {};
-
-    for (UINT_32 i = 0; i < maxBitsUsed; i++)
-    {
-        InitChannel(1, 0, elementBytesLog2 + i, &x[i]);
-        InitChannel(1, 1, i, &y[i]);
-        InitChannel(1, 2, i, &z[i]);
-    }
-
-    if (IsZOrderSwizzle(swMode))
-    {
-        switch (elementBytesLog2)
-        {
-            case 0:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = y[0];
-                pixelBit[2]  = x[1];
-                pixelBit[3]  = y[1];
-                pixelBit[4]  = z[0];
-                pixelBit[5]  = z[1];
-                pixelBit[6]  = x[2];
-                pixelBit[7]  = z[2];
-                pixelBit[8]  = y[2];
-                pixelBit[9]  = x[3];
-                break;
-            case 1:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = y[0];
-                pixelBit[2]  = x[1];
-                pixelBit[3]  = y[1];
-                pixelBit[4]  = z[0];
-                pixelBit[5]  = z[1];
-                pixelBit[6]  = z[2];
-                pixelBit[7]  = y[2];
-                pixelBit[8]  = x[2];
-                break;
-            case 2:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = y[0];
-                pixelBit[2]  = x[1];
-                pixelBit[3]  = z[0];
-                pixelBit[4]  = y[1];
-                pixelBit[5]  = z[1];
-                pixelBit[6]  = y[2];
-                pixelBit[7]  = x[2];
-                break;
-            case 3:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = y[0];
-                pixelBit[2]  = z[0];
-                pixelBit[3]  = x[1];
-                pixelBit[4]  = z[1];
-                pixelBit[5]  = y[1];
-                pixelBit[6]  = x[2];
-                break;
-            case 4:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = y[0];
-                pixelBit[2]  = z[0];
-                pixelBit[3]  = z[1];
-                pixelBit[4]  = y[1];
-                pixelBit[5]  = x[1];
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                ret = ADDR_INVALIDPARAMS;
-                break;
-        }
-    }
-    else if (IsStandardSwizzle(rsrcType, swMode))
-    {
-        switch (elementBytesLog2)
-        {
-            case 0:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = x[1];
-                pixelBit[2]  = x[2];
-                pixelBit[3]  = x[3];
-                pixelBit[4]  = y[0];
-                pixelBit[5]  = y[1];
-                pixelBit[6]  = z[0];
-                pixelBit[7]  = z[1];
-                pixelBit[8]  = z[2];
-                pixelBit[9]  = y[2];
-                break;
-            case 1:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = x[1];
-                pixelBit[2]  = x[2];
-                pixelBit[3]  = y[0];
-                pixelBit[4]  = y[1];
-                pixelBit[5]  = z[0];
-                pixelBit[6]  = z[1];
-                pixelBit[7]  = z[2];
-                pixelBit[8]  = y[2];
-                break;
-            case 2:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = x[1];
-                pixelBit[2]  = y[0];
-                pixelBit[3]  = y[1];
-                pixelBit[4]  = z[0];
-                pixelBit[5]  = z[1];
-                pixelBit[6]  = y[2];
-                pixelBit[7]  = x[2];
-                break;
-            case 3:
-                pixelBit[0]  = x[0];
-                pixelBit[1]  = y[0];
-                pixelBit[2]  = y[1];
-                pixelBit[3]  = z[0];
-                pixelBit[4]  = z[1];
-                pixelBit[5]  = x[1];
-                pixelBit[6]  = x[2];
-                break;
-            case 4:
-                pixelBit[0]  = y[0];
-                pixelBit[1]  = y[1];
-                pixelBit[2]  = z[0];
-                pixelBit[3]  = z[1];
-                pixelBit[4]  = x[0];
-                pixelBit[5]  = x[1];
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                ret = ADDR_INVALIDPARAMS;
-                break;
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        ret = ADDR_INVALIDPARAMS;
-    }
-
-    if (ret == ADDR_OK)
-    {
-        Dim3d microBlockDim = Block1K_3d[elementBytesLog2];
-        UINT_32 xIdx = Log2(microBlockDim.w);
-        UINT_32 yIdx = Log2(microBlockDim.h);
-        UINT_32 zIdx = Log2(microBlockDim.d);
-
-        pixelBit = pEquation->addr;
-
-        const UINT_32 lowBits = 10;
-        ADDR_ASSERT(pEquation->addr[lowBits - 1].valid == 1);
-        ADDR_ASSERT(pEquation->addr[lowBits].valid == 0);
-
-        for (UINT_32 i = lowBits; i < blockSizeLog2; i++)
-        {
-            if ((i % 3) == 0)
-            {
-                pixelBit[i] = x[xIdx++];
-            }
-            else if ((i % 3) == 1)
-            {
-                pixelBit[i] = z[zIdx++];
-            }
-            else
-            {
-                pixelBit[i] = y[yIdx++];
-            }
-        }
-
-        for (UINT_32 i = blockSizeLog2; i < maxXorBits; i++)
-        {
-            if ((i % 3) == 0)
-            {
-                xorExtra[i - blockSizeLog2] = x[xIdx++];
-            }
-            else if ((i % 3) == 1)
-            {
-                xorExtra[i - blockSizeLog2] = z[zIdx++];
-            }
-            else
-            {
-                xorExtra[i - blockSizeLog2] = y[yIdx++];
-            }
-        }
-
-        if (IsXor(swMode))
-        {
-            // Fill XOR bits
-            UINT_32 pipeStart = m_pipeInterleaveLog2;
-            UINT_32 pipeXorBits = GetPipeXorBits(blockSizeLog2);
-            for (UINT_32 i = 0; i < pipeXorBits; i++)
-            {
-                UINT_32               xor1BitPos = pipeStart + (3 * pipeXorBits) - 1 - (2 * i);
-                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
-                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
-
-                InitChannel(&pEquation->xor1[pipeStart + i], pXor1Src);
-
-                UINT_32               xor2BitPos = pipeStart + (3 * pipeXorBits) - 2 - (2 * i);
-                ADDR_CHANNEL_SETTING* pXor2Src   = (xor2BitPos < blockSizeLog2) ?
-                                                   &pEquation->addr[xor2BitPos] : &xorExtra[xor2BitPos - blockSizeLog2];
-
-                InitChannel(&pEquation->xor2[pipeStart + i], pXor2Src);
-            }
-
-            UINT_32 bankStart = pipeStart + pipeXorBits;
-            UINT_32 bankXorBits = GetBankXorBits(blockSizeLog2);
-            for (UINT_32 i = 0; i < bankXorBits; i++)
-            {
-                UINT_32               xor1BitPos = bankStart + (3 * bankXorBits) - 1 - (2 * i);
-                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
-                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
-
-                InitChannel(&pEquation->xor1[bankStart + i], pXor1Src);
-
-                UINT_32               xor2BitPos = bankStart + (3 * bankXorBits) - 2 - (2 * i);
-                ADDR_CHANNEL_SETTING* pXor2Src   = (xor2BitPos < blockSizeLog2) ?
-                                                   &pEquation->addr[xor2BitPos] : &xorExtra[xor2BitPos - blockSizeLog2];
-
-                InitChannel(&pEquation->xor2[bankStart + i], pXor2Src);
-            }
-        }
-
-        pEquation->numBits = blockSizeLog2;
-    }
-
-    return ret;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::IsValidDisplaySwizzleMode
-*
-*   @brief
-*       Check if a swizzle mode is supported by display engine
-*
-*   @return
-*       TRUE is swizzle mode is supported by display engine
-************************************************************************************************************************
-*/
-BOOL_32 Gfx9Lib::IsValidDisplaySwizzleMode(
-    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
-{
-    BOOL_32 support = FALSE;
-
-    const AddrResourceType resourceType = pIn->resourceType;
-    (void)resourceType;
-    const AddrSwizzleMode swizzleMode = pIn->swizzleMode;
-
-    if (m_settings.isDce12)
-    {
-        switch (swizzleMode)
-        {
-            case ADDR_SW_256B_D:
-            case ADDR_SW_256B_R:
-                support = (pIn->bpp == 32);
-                break;
-
-            case ADDR_SW_LINEAR:
-            case ADDR_SW_4KB_D:
-            case ADDR_SW_4KB_R:
-            case ADDR_SW_64KB_D:
-            case ADDR_SW_64KB_R:
-            case ADDR_SW_VAR_D:
-            case ADDR_SW_VAR_R:
-            case ADDR_SW_4KB_D_X:
-            case ADDR_SW_4KB_R_X:
-            case ADDR_SW_64KB_D_X:
-            case ADDR_SW_64KB_R_X:
-            case ADDR_SW_VAR_D_X:
-            case ADDR_SW_VAR_R_X:
-                support = (pIn->bpp <= 64);
-                break;
-
-            default:
-                break;
-        }
-    }
-    else if (m_settings.isDcn1)
-    {
-        switch (swizzleMode)
-        {
-            case ADDR_SW_4KB_D:
-            case ADDR_SW_64KB_D:
-            case ADDR_SW_VAR_D:
-            case ADDR_SW_64KB_D_T:
-            case ADDR_SW_4KB_D_X:
-            case ADDR_SW_64KB_D_X:
-            case ADDR_SW_VAR_D_X:
-                support = (pIn->bpp == 64);
-                break;
-
-            case ADDR_SW_LINEAR:
-            case ADDR_SW_4KB_S:
-            case ADDR_SW_64KB_S:
-            case ADDR_SW_VAR_S:
-            case ADDR_SW_64KB_S_T:
-            case ADDR_SW_4KB_S_X:
-            case ADDR_SW_64KB_S_X:
-            case ADDR_SW_VAR_S_X:
-                support = (pIn->bpp <= 64);
-                break;
-
-            default:
-                break;
-        }
-    }
-    else
-    {
-        ADDR_NOT_IMPLEMENTED();
-    }
-
-    return support;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputePipeBankXor
-*
-*   @brief
-*       Generate a PipeBankXor value to be ORed into bits above pipeInterleaveBits of address
-*
-*   @return
-*       PipeBankXor value
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputePipeBankXor(
-    const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
-    ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) const
-{
-    UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
-    UINT_32 pipeBits       = GetPipeXorBits(macroBlockBits);
-    UINT_32 bankBits       = GetBankXorBits(macroBlockBits);
-
-    UINT_32 pipeXor = 0;
-    UINT_32 bankXor = 0;
-
-    const UINT_32 bankMask = (1 << bankBits) - 1;
-    const UINT_32 index    = pIn->surfIndex & bankMask;
-
-    const UINT_32 bpp      = pIn->flags.fmask ?
-                             GetFmaskBpp(pIn->numSamples, pIn->numFrags) : GetElemLib()->GetBitsPerPixel(pIn->format);
-    if (bankBits == 4)
-    {
-        static const UINT_32 BankXorSmallBpp[] = {0, 7, 4, 3, 8, 15, 12, 11, 1, 6, 5, 2, 9, 14, 13, 10};
-        static const UINT_32 BankXorLargeBpp[] = {0, 7, 8, 15, 4, 3, 12, 11, 1, 6, 9, 14, 5, 2, 13, 10};
-
-        bankXor = (bpp <= 32) ? BankXorSmallBpp[index] : BankXorLargeBpp[index];
-    }
-    else if (bankBits > 0)
-    {
-        UINT_32 bankIncrease = (1 << (bankBits - 1)) - 1;
-        bankIncrease = (bankIncrease == 0) ? 1 : bankIncrease;
-        bankXor = (index * bankIncrease) & bankMask;
-    }
-
-    pOut->pipeBankXor = (bankXor << pipeBits) | pipeXor;
-
-    return ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeSlicePipeBankXor
-*
-*   @brief
-*       Generate slice PipeBankXor value based on base PipeBankXor value and slice id
-*
-*   @return
-*       PipeBankXor value
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSlicePipeBankXor(
-    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
-    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) const
-{
-    UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
-    UINT_32 pipeBits       = GetPipeXorBits(macroBlockBits);
-    UINT_32 bankBits       = GetBankXorBits(macroBlockBits);
-
-    UINT_32 pipeXor        = ReverseBitVector(pIn->slice, pipeBits);
-    UINT_32 bankXor        = ReverseBitVector(pIn->slice >> pipeBits, bankBits);
-
-    pOut->pipeBankXor = pIn->basePipeBankXor ^ (pipeXor | (bankXor << pipeBits));
-
-    return ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeSubResourceOffsetForSwizzlePattern
-*
-*   @brief
-*       Compute sub resource offset to support swizzle pattern
-*
-*   @return
-*       Offset
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSubResourceOffsetForSwizzlePattern(
-    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
-    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) const
-{
-    ADDR_ASSERT(IsThin(pIn->resourceType, pIn->swizzleMode));
-
-    UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
-    UINT_32 pipeBits       = GetPipeXorBits(macroBlockBits);
-    UINT_32 bankBits       = GetBankXorBits(macroBlockBits);
-    UINT_32 pipeXor        = ReverseBitVector(pIn->slice, pipeBits);
-    UINT_32 bankXor        = ReverseBitVector(pIn->slice >> pipeBits, bankBits);
-    UINT_32 pipeBankXor    = ((pipeXor | (bankXor << pipeBits)) ^ (pIn->pipeBankXor)) << m_pipeInterleaveLog2;
-
-    pOut->offset = pIn->slice * pIn->sliceSize +
-                   pIn->macroBlockOffset +
-                   (pIn->mipTailOffset ^ pipeBankXor) -
-                   static_cast<UINT_64>(pipeBankXor);
-    return ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeSurfaceInfoSanityCheck
-*
-*   @brief
-*       Compute surface info sanity check
-*
-*   @return
-*       Offset
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceInfoSanityCheck(
-    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
-{
-    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         = flags.prt;
-    BOOL_32          stereo      = flags.qbStereo;
-
-    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) || stereo;
-                break;
-            case ADDR_RSRC_TEX_2D:
-                invalid = (msaa && mipmap) || (stereo && msaa) || (stereo && mipmap);
-                break;
-            case ADDR_RSRC_TEX_3D:
-                invalid = msaa || zbuffer || display || stereo;
-                break;
-            default:
-                invalid = TRUE;
-                break;
-        }
-    }
-
-    if (invalid == FALSE)
-    {
-        if (display)
-        {
-            invalid = (IsValidDisplaySwizzleMode(pIn) == FALSE);
-        }
-    }
-
-    if (invalid == FALSE)
-    {
-        if (linear)
-        {
-            invalid = ((ADDR_RSRC_TEX_1D != rsrcType) && 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) || tex3d;
-                }
-                else
-                {
-                    ADDR_ASSERT(!"invalid swizzle mode");
-                    invalid = TRUE;
-                }
-            }
-        }
-    }
-
-    ADDR_ASSERT(invalid == FALSE);
-
-    return invalid ? ADDR_INVALIDPARAMS : ADDR_OK;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlGetPreferredSurfaceSetting
-*
-*   @brief
-*       Internal function to get suggested surface information for cliet to use
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting(
-    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,
-    };
-
-    enum AddrSwSet
-    {
-        AddrSwSetZ = 1 << ADDR_SW_Z,
-        AddrSwSetS = 1 << ADDR_SW_S,
-        AddrSwSetD = 1 << ADDR_SW_D,
-        AddrSwSetR = 1 << ADDR_SW_R,
-
-        AddrSwSetAll = AddrSwSetZ | AddrSwSetS | AddrSwSetD | AddrSwSetR,
-    };
-
-    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;
-    UINT_32 width   = pIn->width;
-    UINT_32 height  = pIn->height;
-
-    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 basePitch = 0;
-        GetElemLib()->AdjustSurfaceInfo(elemMode,
-                                        expandX,
-                                        expandY,
-                                        &bpp,
-                                        &basePitch,
-                                        &width,
-                                        &height);
-    }
-
-    UINT_32 numSamples   = Max(pIn->numSamples, 1u);
-    UINT_32 numFrags     = (pIn->numFrags == 0) ? numSamples : pIn->numFrags;
-    UINT_32 slice        = Max(pIn->numSlices, 1u);
-    UINT_32 numMipLevels = Max(pIn->numMipLevels, 1u);
-    UINT_32 minSizeAlign = NextPow2(pIn->minSizeAlign);
-
-    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 (bpp < 8)
-    {
-        ADDR_ASSERT_ALWAYS();
-
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-    else if (IsTex1d(pOut->resourceType))
-    {
-        pOut->swizzleMode         = ADDR_SW_LINEAR;
-        pOut->validBlockSet.value = AddrBlockSetLinear;
-        pOut->canXor              = FALSE;
-    }
-    else
-    {
-        ADDR2_BLOCK_SET blockSet;
-        blockSet.value = 0;
-
-        ADDR2_SWTYPE_SET addrPreferredSwSet, addrValidSwSet, clientPreferredSwSet;
-        addrPreferredSwSet.value = AddrSwSetS;
-        addrValidSwSet           = addrPreferredSwSet;
-        clientPreferredSwSet     = pIn->preferredSwSet;
-
-        if (clientPreferredSwSet.value == 0)
-        {
-            clientPreferredSwSet.value = AddrSwSetAll;
-        }
-
-        // prt Xor and non-xor will have less height align requirement for stereo surface
-        BOOL_32 prtXor          = (pIn->flags.prt || pIn->flags.qbStereo) && (pIn->noXor == FALSE);
-        BOOL_32 displayResource = FALSE;
-
-        pOut->canXor = (pIn->flags.prt == FALSE) && (pIn->noXor == FALSE);
-
-        // 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;
-            addrPreferredSwSet.value = AddrSwSetZ;
-            addrValidSwSet.value     = AddrSwSetZ;
-
-            if (pIn->flags.noMetadata == FALSE)
-            {
-                if (pIn->flags.depth &&
-                    pIn->flags.texture &&
-                    (((bpp == 16) && (numFrags >= 4)) || ((bpp == 32) && (numFrags >= 2))))
-                {
-                    // When _X/_T swizzle mode was used for MSAA depth texture, TC will get zplane
-                    // equation from wrong address within memory range a tile covered and use the
-                    // garbage data for compressed Z reading which finally leads to corruption.
-                    pOut->canXor = FALSE;
-                    prtXor       = FALSE;
-                }
-
-                if (m_settings.htileCacheRbConflict &&
-                    (pIn->flags.depth || pIn->flags.stencil) &&
-                    (slice > 1) &&
-                    (pIn->flags.metaRbUnaligned == FALSE) &&
-                    (pIn->flags.metaPipeUnaligned == FALSE))
-                {
-                    // Z_X 2D array with Rb/Pipe aligned HTile won't have metadata cache coherency
-                    pOut->canXor = FALSE;
-                }
-            }
-        }
-        else if (ElemLib::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;
-
-            // This isn't to be used as texture and caller doesn't allow macro tiled.
-            if ((pIn->flags.texture == FALSE) &&
-                (pIn->forbiddenBlock.macro4KB && pIn->forbiddenBlock.macro64KB))
-            {
-                blockSet.value |= AddrBlockSetLinear;
-            }
-
-            addrPreferredSwSet.value = AddrSwSetD;
-            addrValidSwSet.value     = AddrSwSetS | AddrSwSetD;
-        }
-        else if (ElemLib::IsMacroPixelPacked(pIn->format))
-        {
-            // macro pixel packed formats (BG_RG, GB_GR) does not support the Z modes.
-            // Its notclear under what circumstances the D or R modes would be appropriate
-            // since these formats are not displayable.
-            blockSet.value  = AddrBlockSetLinear | AddrBlockSetMacro;
-
-            addrPreferredSwSet.value = AddrSwSetS;
-            addrValidSwSet.value     = AddrSwSetS | AddrSwSetD | AddrSwSetR;
-        }
-        else if (IsTex3d(pOut->resourceType))
-        {
-            blockSet.value = AddrBlockSetLinear | AddrBlockSetMacro;
-
-            if (pIn->flags.prt)
-            {
-                // PRT cannot use SW_D which gives an unexpected block dimension
-                addrPreferredSwSet.value = AddrSwSetZ;
-                addrValidSwSet.value     = AddrSwSetZ | AddrSwSetS;
-            }
-            else if ((numMipLevels > 1) && (slice >= width) && (slice >= height))
-            {
-                // When depth (Z) is the maximum dimension then must use one of the SW_*_S
-                // or SW_*_Z modes if mipmapping is desired on a 3D surface
-                addrPreferredSwSet.value = AddrSwSetZ;
-                addrValidSwSet.value     = AddrSwSetZ | AddrSwSetS;
-            }
-            else if (pIn->flags.color)
-            {
-                addrPreferredSwSet.value = AddrSwSetD;
-                addrValidSwSet.value     = AddrSwSetZ | AddrSwSetS | AddrSwSetD;
-            }
-            else
-            {
-                addrPreferredSwSet.value = AddrSwSetZ;
-                addrValidSwSet.value     = AddrSwSetZ | AddrSwSetD;
-                if (bpp != 128)
-                {
-                    addrValidSwSet.value |= AddrSwSetS;
-                }
-            }
-        }
-        else
-        {
-            addrPreferredSwSet.value = ((pIn->flags.display == TRUE) ||
-                                        (pIn->flags.overlay == TRUE) ||
-                                        (pIn->bpp           == 128)) ? AddrSwSetD : AddrSwSetS;
-
-            addrValidSwSet.value     = AddrSwSetS | AddrSwSetD | AddrSwSetR;
-
-            if (numMipLevels > 1)
-            {
-                ADDR_ASSERT(numFrags == 1);
-                blockSet.value = AddrBlockSetLinear | AddrBlockSetMacro;
-            }
-            else if ((numFrags > 1) || (numSamples > 1))
-            {
-                ADDR_ASSERT(IsTex2d(pOut->resourceType));
-                blockSet.value = AddrBlockSetMacro;
-            }
-            else
-            {
-                ADDR_ASSERT(IsTex2d(pOut->resourceType));
-                blockSet.value = AddrBlockSetLinear | AddrBlockSetMicro | AddrBlockSetMacro;
-
-                displayResource = pIn->flags.rotated || pIn->flags.display;
-
-                if (displayResource)
-                {
-                    addrPreferredSwSet.value = pIn->flags.rotated ? AddrSwSetR : AddrSwSetD;
-
-                    if (pIn->bpp > 64)
-                    {
-                        blockSet.value = 0;
-                    }
-                    else if (m_settings.isDce12)
-                    {
-                        if (pIn->bpp != 32)
-                        {
-                            blockSet.micro = FALSE;
-                        }
-
-                        // DCE12 does not support display surface to be _T swizzle mode
-                        prtXor = FALSE;
-
-                        addrValidSwSet.value = AddrSwSetD | AddrSwSetR;
-                    }
-                    else if (m_settings.isDcn1)
-                    {
-                        // _R is not supported by Dcn1
-                        if (pIn->bpp == 64)
-                        {
-                            addrPreferredSwSet.value = AddrSwSetD;
-                            addrValidSwSet.value     = AddrSwSetS | AddrSwSetD;
-                        }
-                        else
-                        {
-                            addrPreferredSwSet.value = AddrSwSetS;
-                            addrValidSwSet.value     = AddrSwSetS;
-                        }
-
-                        blockSet.micro = FALSE;
-                    }
-                    else
-                    {
-                        ADDR_NOT_IMPLEMENTED();
-                        returnCode = ADDR_NOTSUPPORTED;
-                    }
-                }
-            }
-        }
-
-        ADDR_ASSERT((addrValidSwSet.value & addrPreferredSwSet.value) == addrPreferredSwSet.value);
-
-        pOut->clientPreferredSwSet = clientPreferredSwSet;
-
-        // Clamp client preferred set to valid set
-        clientPreferredSwSet.value &= addrValidSwSet.value;
-
-        pOut->validSwTypeSet = addrValidSwSet;
-
-        if (clientPreferredSwSet.value == 0)
-        {
-            // Client asks for an invalid swizzle type...
-            ADDR_ASSERT_ALWAYS();
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-        else
-        {
-            if (IsPow2(clientPreferredSwSet.value))
-            {
-                // Only one swizzle type left, use it directly
-                addrPreferredSwSet.value = clientPreferredSwSet.value;
-            }
-            else if ((clientPreferredSwSet.value & addrPreferredSwSet.value) == 0)
-            {
-                // Client wants 2 or more a valid swizzle type but none of them is addrlib preferred
-                if (clientPreferredSwSet.sw_D)
-                {
-                    addrPreferredSwSet.value = AddrSwSetD;
-                }
-                else if (clientPreferredSwSet.sw_Z)
-                {
-                    addrPreferredSwSet.value = AddrSwSetZ;
-                }
-                else if (clientPreferredSwSet.sw_R)
-                {
-                    addrPreferredSwSet.value = AddrSwSetR;
-                }
-                else
-                {
-                    ADDR_ASSERT(clientPreferredSwSet.sw_S);
-                    addrPreferredSwSet.value = AddrSwSetS;
-                }
-            }
-
-            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 &= AddrBlockSetMacro64KB;
-            }
-
-            // 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 blkAlign[AddrBlockMaxTiledType]  = {{0}, {0}, {0}};
-            Dim3d paddedDim[AddrBlockMaxTiledType] = {{0}, {0}, {0}};
-            UINT_64 padSize[AddrBlockMaxTiledType] = {0};
-
-            if (blockSet.micro)
-            {
-                returnCode = ComputeBlockDimensionForSurf(&blkAlign[AddrBlockMicro].w,
-                                                          &blkAlign[AddrBlockMicro].h,
-                                                          &blkAlign[AddrBlockMicro].d,
-                                                          bpp,
-                                                          numFrags,
-                                                          pOut->resourceType,
-                                                          ADDR_SW_256B);
-
-                if (returnCode == ADDR_OK)
-                {
-                    if (displayResource)
-                    {
-                        blkAlign[AddrBlockMicro].w = PowTwoAlign(blkAlign[AddrBlockMicro].w, 32);
-                    }
-                    else if ((blkAlign[AddrBlockMicro].w >= width) && (blkAlign[AddrBlockMicro].h >= height) &&
-                             (minSizeAlign <= GetBlockSize(ADDR_SW_256B)))
-                    {
-                        // 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(&blkAlign[AddrBlockMicro], width, height,
-                                                             slice, &paddedDim[AddrBlockMicro]);
-                }
-            }
-
-            if ((returnCode == ADDR_OK) && blockSet.macro4KB)
-            {
-                returnCode = ComputeBlockDimensionForSurf(&blkAlign[AddrBlock4KB].w,
-                                                          &blkAlign[AddrBlock4KB].h,
-                                                          &blkAlign[AddrBlock4KB].d,
-                                                          bpp,
-                                                          numFrags,
-                                                          pOut->resourceType,
-                                                          ADDR_SW_4KB);
-
-                if (returnCode == ADDR_OK)
-                {
-                    if (displayResource)
-                    {
-                        blkAlign[AddrBlock4KB].w = PowTwoAlign(blkAlign[AddrBlock4KB].w, 32);
-                    }
-
-                    padSize[AddrBlock4KB] = ComputePadSize(&blkAlign[AddrBlock4KB], width, height,
-                                                           slice, &paddedDim[AddrBlock4KB]);
-
-                    ADDR_ASSERT(padSize[AddrBlock4KB] >= padSize[AddrBlockMicro]);
-                }
-            }
-
-            if ((returnCode == ADDR_OK) && blockSet.macro64KB)
-            {
-                returnCode = ComputeBlockDimensionForSurf(&blkAlign[AddrBlock64KB].w,
-                                                          &blkAlign[AddrBlock64KB].h,
-                                                          &blkAlign[AddrBlock64KB].d,
-                                                          bpp,
-                                                          numFrags,
-                                                          pOut->resourceType,
-                                                          ADDR_SW_64KB);
-
-                if (returnCode == ADDR_OK)
-                {
-                    if (displayResource)
-                    {
-                        blkAlign[AddrBlock64KB].w = PowTwoAlign(blkAlign[AddrBlock64KB].w, 32);
-                    }
-
-                    padSize[AddrBlock64KB] = ComputePadSize(&blkAlign[AddrBlock64KB], width, height,
-                                                            slice, &paddedDim[AddrBlock64KB]);
-
-                    ADDR_ASSERT(padSize[AddrBlock64KB] >= padSize[AddrBlock4KB]);
-                    ADDR_ASSERT(padSize[AddrBlock64KB] >= padSize[AddrBlockMicro]);
-                }
-            }
-
-            if (returnCode == ADDR_OK)
-            {
-                UINT_64 minSizeAlignInElement = Max(minSizeAlign / (bpp >> 3), 1u);
-
-                for (UINT_32 i = AddrBlockMicro; i < AddrBlockMaxTiledType; i++)
-                {
-                    padSize[i] = PowTwoAlign(padSize[i], minSizeAlignInElement);
-                }
-
-                // 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;
-                    }
-                }
-                else
-                {
-                    if (blockSet.macro64KB &&
-                        (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 (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 = pOut->canXor &&
-                                   (blockSet.macro4KB || blockSet.macro64KB || blockSet.var);
-
-                    if (blockSet.macro64KB || blockSet.macro4KB)
-                    {
-                        if (addrPreferredSwSet.value == AddrSwSetZ)
-                        {
-                            pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_Z : ADDR_SW_4KB_Z;
-                        }
-                        else if (addrPreferredSwSet.value == AddrSwSetS)
-                        {
-                            pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_S : ADDR_SW_4KB_S;
-                        }
-                        else if (addrPreferredSwSet.value == AddrSwSetD)
-                        {
-                            pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_D : ADDR_SW_4KB_D;
-                        }
-                        else
-                        {
-                            ADDR_ASSERT(addrPreferredSwSet.value == AddrSwSetR);
-                            pOut->swizzleMode = blockSet.macro64KB ? ADDR_SW_64KB_R : ADDR_SW_4KB_R;
-                        }
-
-                        if (prtXor && blockSet.macro64KB)
-                        {
-                            // Client wants PRTXOR, give back _T swizzle mode if 64KB is available
-                            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
-                            const UINT_32 xorGap = ADDR_SW_4KB_Z_X - ADDR_SW_4KB_Z;
-                            pOut->swizzleMode = static_cast<AddrSwizzleMode>(pOut->swizzleMode + xorGap);
-                        }
-                    }
-                    else if (blockSet.micro)
-                    {
-                        if (addrPreferredSwSet.value == AddrSwSetS)
-                        {
-                            pOut->swizzleMode = ADDR_SW_256B_S;
-                        }
-                        else if (addrPreferredSwSet.value == AddrSwSetD)
-                        {
-                            pOut->swizzleMode = ADDR_SW_256B_D;
-                        }
-                        else
-                        {
-                            ADDR_ASSERT(addrPreferredSwSet.value == AddrSwSetR);
-                            pOut->swizzleMode = ADDR_SW_256B_R;
-                        }
-                    }
-                    else if (blockSet.linear)
-                    {
-                        // Fall into this branch doesn't mean linear is suitable, only no other choices!
-                        pOut->swizzleMode = ADDR_SW_LINEAR;
-                    }
-                    else
-                    {
-                        ADDR_ASSERT(blockSet.var);
-
-                        // Designer consider VAR swizzle mode is usless for most cases
-                        ADDR_UNHANDLED_CASE();
-
-                        returnCode = ADDR_NOTSUPPORTED;
-                    }
-
-#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;
-
-                        HwlComputeSurfaceInfoSanityCheck(&localIn);
-
-                    }
-#endif
-                }
-            }
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::ComputeStereoInfo
-*
-*   @brief
-*       Compute height alignment and right eye pipeBankXor for stereo surface
-*
-*   @return
-*       Error code
-*
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::ComputeStereoInfo(
-    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut,
-    UINT_32*                                pHeightAlign
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    UINT_32 eqIndex = HwlGetEquationIndex(pIn, pOut);
-
-    if (eqIndex < m_numEquations)
-    {
-        if (IsXor(pIn->swizzleMode))
-        {
-            const UINT_32        blkSizeLog2       = GetBlockSizeLog2(pIn->swizzleMode);
-            const UINT_32        numPipeBits       = GetPipeXorBits(blkSizeLog2);
-            const UINT_32        numBankBits       = GetBankXorBits(blkSizeLog2);
-            const UINT_32        bppLog2           = Log2(pIn->bpp >> 3);
-            const UINT_32        maxYCoordBlock256 = Log2(Block256_2d[bppLog2].h) - 1;
-            MAYBE_UNUSED const ADDR_EQUATION *pEqToCheck = &m_equationTable[eqIndex];
-
-            ADDR_ASSERT(maxYCoordBlock256 ==
-                        GetMaxValidChannelIndex(&pEqToCheck->addr[0], GetBlockSizeLog2(ADDR_SW_256B), 1));
-
-            const UINT_32 maxYCoordInBaseEquation =
-                (blkSizeLog2 - GetBlockSizeLog2(ADDR_SW_256B)) / 2 + maxYCoordBlock256;
-
-            ADDR_ASSERT(maxYCoordInBaseEquation ==
-                        GetMaxValidChannelIndex(&pEqToCheck->addr[0], blkSizeLog2, 1));
-
-            const UINT_32 maxYCoordInPipeXor = (numPipeBits == 0) ? 0 : maxYCoordBlock256 + numPipeBits;
-
-            ADDR_ASSERT(maxYCoordInPipeXor ==
-                        GetMaxValidChannelIndex(&pEqToCheck->xor1[m_pipeInterleaveLog2], numPipeBits, 1));
-
-            const UINT_32 maxYCoordInBankXor = (numBankBits == 0) ?
-                                               0 : maxYCoordBlock256 + (numPipeBits + 1) / 2 + numBankBits;
-
-            ADDR_ASSERT(maxYCoordInBankXor ==
-                        GetMaxValidChannelIndex(&pEqToCheck->xor1[m_pipeInterleaveLog2 + numPipeBits], numBankBits, 1));
-
-            const UINT_32 maxYCoordInPipeBankXor = Max(maxYCoordInPipeXor, maxYCoordInBankXor);
-
-            if (maxYCoordInPipeBankXor > maxYCoordInBaseEquation)
-            {
-                *pHeightAlign = 1u << maxYCoordInPipeBankXor;
-
-                if (pOut->pStereoInfo != NULL)
-                {
-                    pOut->pStereoInfo->rightSwizzle = 0;
-
-                    if ((PowTwoAlign(pIn->height, *pHeightAlign) % (*pHeightAlign * 2)) != 0)
-                    {
-                        if (maxYCoordInPipeXor == maxYCoordInPipeBankXor)
-                        {
-                            pOut->pStereoInfo->rightSwizzle |= (1u << 1);
-                        }
-
-                        if (maxYCoordInBankXor == maxYCoordInPipeBankXor)
-                        {
-                            pOut->pStereoInfo->rightSwizzle |=
-                                1u << ((numPipeBits % 2) ? numPipeBits : numPipeBits + 1);
-                        }
-
-                        ADDR_ASSERT(pOut->pStereoInfo->rightSwizzle ==
-                                    GetCoordActiveMask(&pEqToCheck->xor1[m_pipeInterleaveLog2],
-                                                       numPipeBits + numBankBits, 1, maxYCoordInPipeBankXor));
-                    }
-                }
-            }
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        returnCode = ADDR_ERROR;
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeSurfaceInfoTiled
-*
-*   @brief
-*       Internal function to calculate alignment for tiled surface
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceInfoTiled(
-     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)
-    {
-        UINT_32 pitchAlignInElement = pOut->blockWidth;
-
-        if ((IsTex2d(pIn->resourceType) == TRUE) &&
-            (pIn->flags.display || pIn->flags.rotated) &&
-            (pIn->numMipLevels <= 1) &&
-            (pIn->numSamples <= 1) &&
-            (pIn->numFrags <= 1))
-        {
-            // Display engine needs pitch align to be at least 32 pixels.
-            pitchAlignInElement = PowTwoAlign(pitchAlignInElement, 32);
-        }
-
-        pOut->pitch = PowTwoAlign(pIn->width, pitchAlignInElement);
-
-        if ((pIn->numMipLevels <= 1) && (pIn->pitchInElement > 0))
-        {
-            if ((pIn->pitchInElement % pitchAlignInElement) != 0)
-            {
-                returnCode = ADDR_INVALIDPARAMS;
-            }
-            else if (pIn->pitchInElement < pOut->pitch)
-            {
-                returnCode = ADDR_INVALIDPARAMS;
-            }
-            else
-            {
-                pOut->pitch = pIn->pitchInElement;
-            }
-        }
-
-        UINT_32 heightAlign = 0;
-
-        if (pIn->flags.qbStereo)
-        {
-            returnCode = ComputeStereoInfo(pIn, pOut, &heightAlign);
-        }
-
-        if (returnCode == ADDR_OK)
-        {
-            pOut->height = PowTwoAlign(pIn->height, pOut->blockHeight);
-
-            if (heightAlign > 1)
-            {
-                pOut->height = PowTwoAlign(pOut->height, heightAlign);
-            }
-
-            pOut->numSlices = PowTwoAlign(pIn->numSlices, pOut->blockSlices);
-
-            pOut->epitchIsHeight   = FALSE;
-            pOut->mipChainInTail   = FALSE;
-            pOut->firstMipIdInTail = pIn->numMipLevels;
-
-            pOut->mipChainPitch    = pOut->pitch;
-            pOut->mipChainHeight   = pOut->height;
-            pOut->mipChainSlice    = pOut->numSlices;
-
-            if (pIn->numMipLevels > 1)
-            {
-                pOut->firstMipIdInTail = GetMipChainInfo(pIn->resourceType,
-                                                         pIn->swizzleMode,
-                                                         pIn->bpp,
-                                                         pIn->width,
-                                                         pIn->height,
-                                                         pIn->numSlices,
-                                                         pOut->blockWidth,
-                                                         pOut->blockHeight,
-                                                         pOut->blockSlices,
-                                                         pIn->numMipLevels,
-                                                         pOut->pMipInfo);
-
-                const UINT_32 endingMipId = Min(pOut->firstMipIdInTail, pIn->numMipLevels - 1);
-
-                if (endingMipId == 0)
-                {
-                    const Dim3d tailMaxDim = GetMipTailDim(pIn->resourceType,
-                                                           pIn->swizzleMode,
-                                                           pOut->blockWidth,
-                                                           pOut->blockHeight,
-                                                           pOut->blockSlices);
-
-                    pOut->epitchIsHeight = TRUE;
-                    pOut->pitch          = tailMaxDim.w;
-                    pOut->height         = tailMaxDim.h;
-                    pOut->numSlices      = IsThick(pIn->resourceType, pIn->swizzleMode) ?
-                                           tailMaxDim.d : pIn->numSlices;
-                    pOut->mipChainInTail = 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) && (endingMipId > 2))
-                        {
-                            mip1WidthInBlk++;
-                        }
-
-                        pOut->mipChainPitch += (mip1WidthInBlk * pOut->blockWidth);
-
-                        pOut->epitchIsHeight = FALSE;
-                    }
-                    else
-                    {
-                        UINT_32 mip1HeightInBlk = RoundHalf(mip0HeightInBlk);
-
-                        if ((mip1HeightInBlk == 1) && (endingMipId > 2))
-                        {
-                            mip1HeightInBlk++;
-                        }
-
-                        pOut->mipChainHeight += (mip1HeightInBlk * pOut->blockHeight);
-
-                        pOut->epitchIsHeight = TRUE;
-                    }
-                }
-
-                if (pOut->pMipInfo != NULL)
-                {
-                    UINT_32 elementBytesLog2 = Log2(pIn->bpp >> 3);
-
-                    for (UINT_32 i = 0; i < pIn->numMipLevels; i++)
-                    {
-                        Dim3d   mipStartPos          = {0};
-                        UINT_32 mipTailOffsetInBytes = 0;
-
-                        mipStartPos = GetMipStartPos(pIn->resourceType,
-                                                     pIn->swizzleMode,
-                                                     pOut->pitch,
-                                                     pOut->height,
-                                                     pOut->numSlices,
-                                                     pOut->blockWidth,
-                                                     pOut->blockHeight,
-                                                     pOut->blockSlices,
-                                                     i,
-                                                     elementBytesLog2,
-                                                     &mipTailOffsetInBytes);
-
-                        UINT_32 pitchInBlock     =
-                            pOut->mipChainPitch / pOut->blockWidth;
-                        UINT_32 sliceInBlock     =
-                            (pOut->mipChainHeight / pOut->blockHeight) * pitchInBlock;
-                        UINT_64 blockIndex       =
-                            mipStartPos.d * sliceInBlock + mipStartPos.h * pitchInBlock + mipStartPos.w;
-                        UINT_64 macroBlockOffset =
-                            blockIndex << GetBlockSizeLog2(pIn->swizzleMode);
-
-                        pOut->pMipInfo[i].macroBlockOffset = macroBlockOffset;
-                        pOut->pMipInfo[i].mipTailOffset    = mipTailOffsetInBytes;
-                    }
-                }
-            }
-            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 = static_cast<UINT_64>(pOut->mipChainPitch) * pOut->mipChainHeight *
-                              (pIn->bpp >> 3) * pIn->numFrags;
-            pOut->surfSize  = pOut->sliceSize * pOut->mipChainSlice;
-            pOut->baseAlign = ComputeSurfaceBaseAlignTiled(pIn->swizzleMode);
-
-            if (pIn->flags.prt)
-            {
-                pOut->baseAlign = Max(pOut->baseAlign, PrtAlignment);
-            }
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeSurfaceInfoLinear
-*
-*   @brief
-*       Internal function to calculate alignment for linear surface
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceInfoLinear(
-     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;
-    const UINT_32     alignment    = pIn->flags.prt ? PrtAlignment : 256;
-
-    if (IsTex1d(pIn->resourceType))
-    {
-        if (pIn->height > 1)
-        {
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-        else
-        {
-            const UINT_32 pitchAlignInElement = alignment / elementBytes;
-
-            pitch        = PowTwoAlign(pIn->width, pitchAlignInElement);
-            actualHeight = pIn->numMipLevels;
-
-            if (pIn->flags.prt == FALSE)
-            {
-                returnCode = ApplyCustomizedPitchHeight(pIn, elementBytes, pitchAlignInElement,
-                                                        &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      = static_cast<UINT_64>(pOut->pitch) * actualHeight * elementBytes;
-        pOut->surfSize       = pOut->sliceSize * pOut->numSlices;
-        pOut->baseAlign      = (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL) ? (pIn->bpp / 8) : alignment;
-        pOut->blockWidth     = (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL) ? 1 : (256 / elementBytes);
-        pOut->blockHeight    = 1;
-        pOut->blockSlices    = 1;
-    }
-
-    // Post calculation validate
-    ADDR_ASSERT(pOut->sliceSize > 0);
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::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 Gfx9Lib::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 firstMipIdInTail = numMipLevel;
-    BOOL_32 inTail           = FALSE;
-    BOOL_32 finalDim         = FALSE;
-    BOOL_32 is3dThick        = IsThick(resourceType, swizzleMode);
-    BOOL_32 is3dThin         = IsTex3d(resourceType) && (is3dThick == FALSE);
-
-    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  = Block256_3dZ[index].w;
-                        mipHeight = Block256_3dZ[index].h;
-                        mipDepth  = Block256_3dZ[index].d;
-                    }
-                    else
-                    {
-                        mipPitch  = Block256_2d[index].w;
-                        mipHeight = Block256_2d[index].h;
-                    }
-
-                    finalDim = TRUE;
-                }
-            }
-        }
-        else
-        {
-            inTail = IsInMipTail(resourceType, swizzleMode, tailMaxDim,
-                                 mipPitch, mipHeight, mipDepth);
-
-            if (inTail)
-            {
-                firstMipIdInTail = 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);
-                }
-            }
-        }
-
-        if (pMipInfo != NULL)
-        {
-            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 firstMipIdInTail;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::GetMetaMiptailInfo
-*
-*   @brief
-*       Get mip tail coordinate information.
-*
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-VOID Gfx9Lib::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;
-            }
-        }
-    }
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::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 Gfx9Lib::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           log2ElementBytes,
-    UINT_32*          pMipTailBytesOffset) 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);
-    UINT_32 mipIndexInTail = mipId;
-
-    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;
-            mipIndexInTail = mipId - endingMip;
-        }
-    }
-
-    if (inMipTail)
-    {
-        UINT_32 index = mipIndexInTail + MaxMacroBits - log2blkSize;
-        ADDR_ASSERT(index < sizeof(MipTailOffset256B) / sizeof(UINT_32));
-        *pMipTailBytesOffset = MipTailOffset256B[index] << 8;
-    }
-
-    return mipStartPos;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::HwlComputeSurfaceAddrFromCoordTiled
-*
-*   @brief
-*       Internal function to calculate address from coord for tiled swizzle surface
-*
-*   @return
-*       ADDR_E_RETURNCODE
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceAddrFromCoordTiled(
-     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);
-    localIn.numSamples   = Max(pIn->numSamples, 1u);
-    localIn.numFrags     = Max(pIn->numFrags, 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)
-    {
-        UINT_32 log2ElementBytes   = Log2(pIn->bpp >> 3);
-        Dim3d   mipStartPos        = {0};
-        UINT_32 mipTailBytesOffset = 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,
-                                         log2ElementBytes,
-                                         &mipTailBytesOffset);
-        }
-
-        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);
-
-            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 < MaxNumOfBpp);
-                Dim2d microBlockDim = Block256_2d[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 | mipTailBytesOffset) == (blockOffset + mipTailBytesOffset));
-            ADDR_ASSERT((mipTailBytesOffset == 0u) || (blockOffset < (1u << log2blkSize)));
-
-            blockOffset |= mipTailBytesOffset;
-
-            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_64 macroBlockIndex =
-                (pIn->slice + mipStartPos.d) * sliceSizeInMacroBlock +
-                ((pIn->y / localOut.blockHeight) + mipStartPos.h) * pitchInMacroBlock +
-                ((pIn->x / localOut.blockWidth) + mipStartPos.w);
-
-            pOut->addr = blockOffset | (macroBlockIndex << log2blkSize);
-        }
-        else
-        {
-            UINT_32 log2blkSize = GetBlockSizeLog2(pIn->swizzleMode);
-
-            Dim3d microBlockDim = Block1K_3d[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 | mipTailBytesOffset) == (blockOffset + mipTailBytesOffset));
-            ADDR_ASSERT((mipTailBytesOffset == 0u) || (blockOffset < (1u << log2blkSize)));
-            blockOffset |= mipTailBytesOffset;
-
-            returnCode = ApplyCustomerPipeBankXor(pIn->swizzleMode, pIn->pipeBankXor,
-                                                  bankBits, pipeBits, &blockOffset);
-
-            blockOffset %= (1 << log2blkSize);
-
-            UINT_32 xb = pIn->x / localOut.blockWidth  + mipStartPos.w;
-            UINT_32 yb = pIn->y / localOut.blockHeight + mipStartPos.h;
-            UINT_32 zb = pIn->slice / localOut.blockSlices + + mipStartPos.d;
-
-            UINT_32 pitchInBlock = localOut.mipChainPitch / localOut.blockWidth;
-            UINT_32 sliceSizeInBlock =
-                (localOut.mipChainHeight / localOut.blockHeight) * pitchInBlock;
-            UINT_64 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
-
-            pOut->addr = blockOffset | (blockIndex << log2blkSize);
-        }
-    }
-    else
-    {
-        returnCode = ADDR_INVALIDPARAMS;
-    }
-
-    return returnCode;
-}
-
-/**
-************************************************************************************************************************
-*   Gfx9Lib::ComputeSurfaceInfoLinear
-*
-*   @brief
-*       Internal function to calculate padding for linear swizzle 2D/3D surface
-*
-*   @return
-*       N/A
-************************************************************************************************************************
-*/
-ADDR_E_RETURNCODE Gfx9Lib::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 pitchAlignInElement = 0;
-
-    if (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL)
-    {
-        ADDR_ASSERT(pIn->numMipLevels <= 1);
-        ADDR_ASSERT(pIn->numSlices <= 1);
-        pitchAlignInElement = 1;
-    }
-    else
-    {
-        pitchAlignInElement = (256 / elementBytes);
-    }
-
-    UINT_32 mipChainWidth      = PowTwoAlign(pIn->width, pitchAlignInElement);
-    UINT_32 slice0PaddedHeight = pIn->height;
-
-    returnCode = ApplyCustomizedPitchHeight(pIn, elementBytes, pitchAlignInElement,
-                                            &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;
-}
-
-} // V2
-} // Addr
diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.h b/src/amd/addrlib/gfx9/gfx9addrlib.h
deleted file mode 100644 (file)
index cf56507..0000000
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * 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  gfx9addrlib.h
-* @brief Contgfx9ns the Gfx9Lib class definition.
-************************************************************************************************************************
-*/
-
-#ifndef __GFX9_ADDR_LIB_H__
-#define __GFX9_ADDR_LIB_H__
-
-#include "addrlib2.h"
-#include "coord.h"
-
-namespace Addr
-{
-namespace V2
-{
-
-/**
-************************************************************************************************************************
-* @brief GFX9 specific settings structure.
-************************************************************************************************************************
-*/
-struct Gfx9ChipSettings
-{
-    struct
-    {
-        // Asic/Generation name
-        UINT_32 isArcticIsland      : 1;
-        UINT_32 isVega10            : 1;
-        UINT_32 isRaven             : 1;
-        UINT_32 isVega12            : 1;
-        UINT_32 isVega20            : 1;
-
-        // Display engine IP version name
-        UINT_32 isDce12             : 1;
-        UINT_32 isDcn1              : 1;
-
-        // Misc configuration bits
-        UINT_32 metaBaseAlignFix    : 1;
-        UINT_32 depthPipeXorDisable : 1;
-        UINT_32 htileAlignFix       : 1;
-        UINT_32 applyAliasFix       : 1;
-        UINT_32 htileCacheRbConflict: 1;
-        UINT_32 reserved2           : 27;
-    };
-};
-
-/**
-************************************************************************************************************************
-* @brief GFX9 data surface type.
-************************************************************************************************************************
-*/
-enum Gfx9DataType
-{
-    Gfx9DataColor,
-    Gfx9DataDepthStencil,
-    Gfx9DataFmask
-};
-
-/**
-************************************************************************************************************************
-* @brief GFX9 meta equation parameters
-************************************************************************************************************************
-*/
-struct MetaEqParams
-{
-    UINT_32          maxMip;
-    UINT_32          elementBytesLog2;
-    UINT_32          numSamplesLog2;
-    ADDR2_META_FLAGS metaFlag;
-    Gfx9DataType     dataSurfaceType;
-    AddrSwizzleMode  swizzleMode;
-    AddrResourceType resourceType;
-    UINT_32          metaBlkWidthLog2;
-    UINT_32          metaBlkHeightLog2;
-    UINT_32          metaBlkDepthLog2;
-    UINT_32          compBlkWidthLog2;
-    UINT_32          compBlkHeightLog2;
-    UINT_32          compBlkDepthLog2;
-};
-
-/**
-************************************************************************************************************************
-* @brief This class is the GFX9 specific address library
-*        function set.
-************************************************************************************************************************
-*/
-class Gfx9Lib : public Lib
-{
-public:
-    /// Creates Gfx9Lib object
-    static Addr::Lib* CreateObj(const Client* pClient)
-    {
-        VOID* pMem = Object::ClientAlloc(sizeof(Gfx9Lib), pClient);
-        return (pMem != NULL) ? new (pMem) Gfx9Lib(pClient) : NULL;
-    }
-
-protected:
-    Gfx9Lib(const Client* pClient);
-    virtual ~Gfx9Lib();
-
-    virtual BOOL_32 HwlIsStandardSwizzle(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        return m_swizzleModeTable[swizzleMode].isStd ||
-               (IsTex3d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp);
-    }
-
-    virtual BOOL_32 HwlIsDisplaySwizzle(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        return IsTex2d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp;
-    }
-
-    virtual BOOL_32 HwlIsThin(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        return ((IsTex2d(resourceType)  == TRUE) ||
-                ((IsTex3d(resourceType) == TRUE)                  &&
-                 (m_swizzleModeTable[swizzleMode].isZ   == FALSE) &&
-                 (m_swizzleModeTable[swizzleMode].isStd == FALSE)));
-    }
-
-    virtual BOOL_32 HwlIsThick(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode) const
-    {
-        return (IsTex3d(resourceType) &&
-                (m_swizzleModeTable[swizzleMode].isZ || m_swizzleModeTable[swizzleMode].isStd));
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputeHtileInfo(
-        const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
-        ADDR2_COMPUTE_HTILE_INFO_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeCmaskInfo(
-        const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
-        ADDR2_COMPUTE_CMASK_INFO_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
-        const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
-        ADDR2_COMPUTE_DCCINFO_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
-        const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*      pOut);
-
-    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
-        const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*      pOut);
-
-    virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
-        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
-        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*      pOut);
-
-    virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord(
-        const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut);
-
-    virtual UINT_32 HwlGetEquationIndex(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeBlock256Equation(
-        AddrResourceType rsrcType,
-        AddrSwizzleMode swMode,
-        UINT_32 elementBytesLog2,
-        ADDR_EQUATION* pEquation) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeThinEquation(
-        AddrResourceType rsrcType,
-        AddrSwizzleMode swMode,
-        UINT_32 elementBytesLog2,
-        ADDR_EQUATION* pEquation) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeThickEquation(
-        AddrResourceType rsrcType,
-        AddrSwizzleMode swMode,
-        UINT_32 elementBytesLog2,
-        ADDR_EQUATION* pEquation) const;
-
-    // Get equation table pointer and number of equations
-    virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
-    {
-        *ppEquationTable = m_equationTable;
-
-        return m_numEquations;
-    }
-
-    virtual BOOL_32 IsEquationSupported(
-        AddrResourceType rsrcType,
-        AddrSwizzleMode swMode,
-        UINT_32 elementBytesLog2) const;
-
-    UINT_32 ComputeSurfaceBaseAlignTiled(AddrSwizzleMode swizzleMode) const
-    {
-        UINT_32 baseAlign;
-
-        if (IsXor(swizzleMode))
-        {
-            baseAlign = GetBlockSize(swizzleMode);
-        }
-        else
-        {
-            baseAlign = 256;
-        }
-
-        return baseAlign;
-    }
-
-    virtual ADDR_E_RETURNCODE HwlComputePipeBankXor(
-        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
-        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
-        const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
-        ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
-        const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
-        ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
-        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
-        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
-         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
-         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
-        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) const;
-
-    // Initialize equation table
-    VOID InitEquationTable();
-
-    ADDR_E_RETURNCODE ComputeStereoInfo(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut,
-        UINT_32*                                pHeightAlign) const;
-
-    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;
-
-    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           log2ElementBytes,
-        UINT_32*          pMipTailBytesOffset) const;
-
-    AddrMajorMode GetMajorMode(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode,
-        UINT_32          mip0WidthInBlk,
-        UINT_32          mip0HeightInBlk,
-        UINT_32          mip0DepthInBlk) const
-    {
-        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;
-    }
-
-    Dim3d GetDccCompressBlk(
-        AddrResourceType resourceType,
-        AddrSwizzleMode  swizzleMode,
-        UINT_32          bpp) const
-    {
-        UINT_32 index = Log2(bpp >> 3);
-        Dim3d   compressBlkDim;
-
-        if (IsThin(resourceType, swizzleMode))
-        {
-            compressBlkDim.w = Block256_2d[index].w;
-            compressBlkDim.h = Block256_2d[index].h;
-            compressBlkDim.d = 1;
-        }
-        else if (IsStandardSwizzle(resourceType, swizzleMode))
-        {
-            compressBlkDim = Block256_3dS[index];
-        }
-        else
-        {
-            compressBlkDim = Block256_3dZ[index];
-        }
-
-        return compressBlkDim;
-    }
-
-
-    static const UINT_32          MaxSeLog2      = 3;
-    static const UINT_32          MaxRbPerSeLog2 = 2;
-
-    static const Dim3d            Block256_3dS[MaxNumOfBpp];
-    static const Dim3d            Block256_3dZ[MaxNumOfBpp];
-
-    static const UINT_32          MipTailOffset256B[];
-
-    static const SwizzleModeFlags SwizzleModeTable[ADDR_SW_MAX_TYPE];
-
-    // Max number of swizzle mode supported for equation
-    static const UINT_32    MaxSwMode = 32;
-    // Max number of resource type (2D/3D) supported for equation
-    static const UINT_32    MaxRsrcType = 2;
-    // Max number of bpp (8bpp/16bpp/32bpp/64bpp/128bpp)
-    static const UINT_32    MaxElementBytesLog2  = 5;
-    // Almost all swizzle mode + resource type support equation
-    static const UINT_32    EquationTableSize = MaxElementBytesLog2 * MaxSwMode * MaxRsrcType;
-    // Equation table
-    ADDR_EQUATION           m_equationTable[EquationTableSize];
-
-    // Number of equation entries in the table
-    UINT_32                 m_numEquations;
-    // Equation lookup table according to bpp and tile index
-    UINT_32                 m_equationLookupTable[MaxRsrcType][MaxSwMode][MaxElementBytesLog2];
-
-    static const UINT_32    MaxCachedMetaEq = 2;
-
-private:
-    virtual UINT_32 HwlComputeMaxBaseAlignments() const;
-
-    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
-
-    virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn);
-
-    VOID GetRbEquation(CoordEq* pRbEq, UINT_32 rbPerSeLog2, UINT_32 seLog2) const;
-
-    VOID GetDataEquation(CoordEq* pDataEq, Gfx9DataType dataSurfaceType,
-                         AddrSwizzleMode swizzleMode, AddrResourceType resourceType,
-                         UINT_32 elementBytesLog2, UINT_32 numSamplesLog2) const;
-
-    VOID GetPipeEquation(CoordEq* pPipeEq, CoordEq* pDataEq,
-                         UINT_32 pipeInterleaveLog2, UINT_32 numPipesLog2,
-                         UINT_32 numSamplesLog2, Gfx9DataType dataSurfaceType,
-                         AddrSwizzleMode swizzleMode, AddrResourceType resourceType) const;
-
-    VOID GenMetaEquation(CoordEq* pMetaEq, UINT_32 maxMip,
-                         UINT_32 elementBytesLog2, UINT_32 numSamplesLog2,
-                         ADDR2_META_FLAGS metaFlag, Gfx9DataType dataSurfaceType,
-                         AddrSwizzleMode swizzleMode, AddrResourceType resourceType,
-                         UINT_32 metaBlkWidthLog2, UINT_32 metaBlkHeightLog2,
-                         UINT_32 metaBlkDepthLog2, UINT_32 compBlkWidthLog2,
-                         UINT_32 compBlkHeightLog2, UINT_32 compBlkDepthLog2) const;
-
-    const CoordEq* GetMetaEquation(const MetaEqParams& metaEqParams);
-
-    virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
-
-    VOID GetMetaMipInfo(UINT_32 numMipLevels, Dim3d* pMetaBlkDim,
-                        BOOL_32 dataThick, ADDR2_META_MIP_INFO* pInfo,
-                        UINT_32 mip0Width, UINT_32 mip0Height, UINT_32 mip0Depth,
-                        UINT_32* pNumMetaBlkX, UINT_32* pNumMetaBlkY, UINT_32* pNumMetaBlkZ) const;
-
-    BOOL_32 IsValidDisplaySwizzleMode(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
-
-    ADDR_E_RETURNCODE ComputeSurfaceLinearPadding(
-        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        UINT_32*                                pMipmap0PaddedWidth,
-        UINT_32*                                pSlice0PaddedHeight,
-        ADDR2_MIP_INFO*                         pMipInfo = NULL) const;
-
-    Gfx9ChipSettings m_settings;
-
-    CoordEq      m_cachedMetaEq[MaxCachedMetaEq];
-    MetaEqParams m_cachedMetaEqKey[MaxCachedMetaEq];
-    UINT_32      m_metaEqOverrideIndex;
-};
-
-} // V2
-} // Addr
-
-#endif
-
diff --git a/src/amd/addrlib/inc/addrinterface.h b/src/amd/addrlib/inc/addrinterface.h
new file mode 100644 (file)
index 0000000..1a26909
--- /dev/null
@@ -0,0 +1,3715 @@
+/*
+ * Copyright © 2007-2018 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  addrinterface.h
+* @brief Contains the addrlib interfaces declaration and parameter defines
+****************************************************************************************************
+*/
+#ifndef __ADDR_INTERFACE_H__
+#define __ADDR_INTERFACE_H__
+
+#include "addrtypes.h"
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+#define ADDRLIB_VERSION_MAJOR 6
+#define ADDRLIB_VERSION_MINOR 2
+#define ADDRLIB_VERSION ((ADDRLIB_VERSION_MAJOR << 16) | ADDRLIB_VERSION_MINOR)
+
+/// Virtually all interface functions need ADDR_HANDLE as first parameter
+typedef VOID*   ADDR_HANDLE;
+
+/// Client handle used in callbacks
+typedef VOID*   ADDR_CLIENT_HANDLE;
+
+/**
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                                  Callback functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*    typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)(
+*         const ADDR_ALLOCSYSMEM_INPUT* pInput);
+*    typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)(
+*         VOID* pVirtAddr);
+*    typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)(
+*         const ADDR_DEBUGPRINT_INPUT* pInput);
+*
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                               Create/Destroy/Config functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*     AddrCreate()
+*     AddrDestroy()
+*
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                                  Surface functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*     AddrComputeSurfaceInfo()
+*     AddrComputeSurfaceAddrFromCoord()
+*     AddrComputeSurfaceCoordFromAddr()
+*
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                                   HTile functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*     AddrComputeHtileInfo()
+*     AddrComputeHtileAddrFromCoord()
+*     AddrComputeHtileCoordFromAddr()
+*
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                                   C-mask functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*     AddrComputeCmaskInfo()
+*     AddrComputeCmaskAddrFromCoord()
+*     AddrComputeCmaskCoordFromAddr()
+*
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                                   F-mask functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*     AddrComputeFmaskInfo()
+*     AddrComputeFmaskAddrFromCoord()
+*     AddrComputeFmaskCoordFromAddr()
+*
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+* //                               Element/Utility functions
+* /////////////////////////////////////////////////////////////////////////////////////////////////
+*     ElemFlt32ToDepthPixel()
+*     ElemFlt32ToColorPixel()
+*     AddrExtractBankPipeSwizzle()
+*     AddrCombineBankPipeSwizzle()
+*     AddrComputeSliceSwizzle()
+*     AddrConvertTileInfoToHW()
+*     AddrConvertTileIndex()
+*     AddrConvertTileIndex1()
+*     AddrGetTileIndex()
+*     AddrComputeBaseSwizzle()
+*     AddrUseTileIndex()
+*     AddrUseCombinedSwizzle()
+*
+**/
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                      Callback functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+* @brief channel setting structure
+****************************************************************************************************
+*/
+typedef union _ADDR_CHANNEL_SETTING
+{
+    struct
+    {
+        UINT_8 valid   : 1;    ///< Indicate whehter this channel setting is valid
+        UINT_8 channel : 2;    ///< 0 for x channel, 1 for y channel, 2 for z channel
+        UINT_8 index   : 5;    ///< Channel index
+    };
+    UINT_8 value;              ///< Value
+} ADDR_CHANNEL_SETTING;
+
+/**
+****************************************************************************************************
+* @brief address equation key structure
+****************************************************************************************************
+*/
+typedef union _ADDR_EQUATION_KEY
+{
+    struct
+    {
+        UINT_32 log2ElementBytes : 3; ///< Log2 of Bytes per pixel
+        UINT_32 tileMode         : 5; ///< Tile mode
+        UINT_32 microTileType    : 3; ///< Micro tile type
+        UINT_32 pipeConfig       : 5; ///< pipe config
+        UINT_32 numBanksLog2     : 3; ///< Number of banks log2
+        UINT_32 bankWidth        : 4; ///< Bank width
+        UINT_32 bankHeight       : 4; ///< Bank height
+        UINT_32 macroAspectRatio : 3; ///< Macro tile aspect ratio
+        UINT_32 prt              : 1; ///< SI only, indicate whether this equation is for prt
+        UINT_32 reserved         : 1; ///< Reserved bit
+    } fields;
+    UINT_32 value;
+} ADDR_EQUATION_KEY;
+
+/**
+****************************************************************************************************
+* @brief address equation structure
+****************************************************************************************************
+*/
+#define ADDR_MAX_EQUATION_BIT 20u
+
+// Invalid equation index
+#define ADDR_INVALID_EQUATION_INDEX 0xFFFFFFFF
+
+typedef struct _ADDR_EQUATION
+{
+    ADDR_CHANNEL_SETTING addr[ADDR_MAX_EQUATION_BIT];  ///< addr setting
+                                                       ///< each bit is result of addr ^ xor ^ xor2
+    ADDR_CHANNEL_SETTING xor1[ADDR_MAX_EQUATION_BIT];  ///< xor setting
+    ADDR_CHANNEL_SETTING xor2[ADDR_MAX_EQUATION_BIT];  ///< xor2 setting
+    UINT_32              numBits;                      ///< The number of bits in equation
+    BOOL_32              stackedDepthSlices;           ///< TRUE if depth slices are treated as being
+                                                       ///< stacked vertically prior to swizzling
+} ADDR_EQUATION;
+
+/**
+****************************************************************************************************
+* @brief Alloc system memory flags.
+* @note These flags are reserved for future use and if flags are added will minimize the impact
+*       of the client.
+****************************************************************************************************
+*/
+typedef union _ADDR_ALLOCSYSMEM_FLAGS
+{
+    struct
+    {
+        UINT_32 reserved    : 32;  ///< Reserved for future use.
+    } fields;
+    UINT_32 value;
+
+} ADDR_ALLOCSYSMEM_FLAGS;
+
+/**
+****************************************************************************************************
+* @brief Alloc system memory input structure
+****************************************************************************************************
+*/
+typedef struct _ADDR_ALLOCSYSMEM_INPUT
+{
+    UINT_32                 size;           ///< Size of this structure in bytes
+
+    ADDR_ALLOCSYSMEM_FLAGS  flags;          ///< System memory flags.
+    UINT_32                 sizeInBytes;    ///< System memory allocation size in bytes.
+    ADDR_CLIENT_HANDLE      hClient;        ///< Client handle
+} ADDR_ALLOCSYSMEM_INPUT;
+
+/**
+****************************************************************************************************
+* ADDR_ALLOCSYSMEM
+*   @brief
+*       Allocate system memory callback function. Returns valid pointer on success.
+****************************************************************************************************
+*/
+typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)(
+    const ADDR_ALLOCSYSMEM_INPUT* pInput);
+
+/**
+****************************************************************************************************
+* @brief Free system memory input structure
+****************************************************************************************************
+*/
+typedef struct _ADDR_FREESYSMEM_INPUT
+{
+    UINT_32                 size;           ///< Size of this structure in bytes
+
+    VOID*                   pVirtAddr;      ///< Virtual address
+    ADDR_CLIENT_HANDLE      hClient;        ///< Client handle
+} ADDR_FREESYSMEM_INPUT;
+
+/**
+****************************************************************************************************
+* ADDR_FREESYSMEM
+*   @brief
+*       Free system memory callback function.
+*       Returns ADDR_OK on success.
+****************************************************************************************************
+*/
+typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)(
+    const ADDR_FREESYSMEM_INPUT* pInput);
+
+/**
+****************************************************************************************************
+* @brief Print debug message input structure
+****************************************************************************************************
+*/
+typedef struct _ADDR_DEBUGPRINT_INPUT
+{
+    UINT_32             size;           ///< Size of this structure in bytes
+
+    CHAR*               pDebugString;   ///< Debug print string
+    va_list             ap;             ///< Variable argument list
+    ADDR_CLIENT_HANDLE  hClient;        ///< Client handle
+} ADDR_DEBUGPRINT_INPUT;
+
+/**
+****************************************************************************************************
+* ADDR_DEBUGPRINT
+*   @brief
+*       Print debug message callback function.
+*       Returns ADDR_OK on success.
+****************************************************************************************************
+*/
+typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)(
+    const ADDR_DEBUGPRINT_INPUT* pInput);
+
+/**
+****************************************************************************************************
+* ADDR_CALLBACKS
+*
+*   @brief
+*       Address Library needs client to provide system memory alloc/free routines.
+****************************************************************************************************
+*/
+typedef struct _ADDR_CALLBACKS
+{
+    ADDR_ALLOCSYSMEM allocSysMem;   ///< Routine to allocate system memory
+    ADDR_FREESYSMEM  freeSysMem;    ///< Routine to free system memory
+    ADDR_DEBUGPRINT  debugPrint;    ///< Routine to print debug message
+} ADDR_CALLBACKS;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Create/Destroy functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+* ADDR_CREATE_FLAGS
+*
+*   @brief
+*       This structure is used to pass some setup in creation of AddrLib
+*   @note
+****************************************************************************************************
+*/
+typedef union _ADDR_CREATE_FLAGS
+{
+    struct
+    {
+        UINT_32 noCubeMipSlicesPad     : 1;    ///< Turn cubemap faces padding off
+        UINT_32 fillSizeFields         : 1;    ///< If clients fill size fields in all input and
+                                               ///  output structure
+        UINT_32 useTileIndex           : 1;    ///< Make tileIndex field in input valid
+        UINT_32 useCombinedSwizzle     : 1;    ///< Use combined tile swizzle
+        UINT_32 checkLast2DLevel       : 1;    ///< Check the last 2D mip sub level
+        UINT_32 useHtileSliceAlign     : 1;    ///< Do htile single slice alignment
+        UINT_32 allowLargeThickTile    : 1;    ///< Allow 64*thickness*bytesPerPixel > rowSize
+        UINT_32 reserved               : 25;   ///< Reserved bits for future use
+    };
+
+    UINT_32 value;
+} ADDR_CREATE_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR_REGISTER_VALUE
+*
+*   @brief
+*       Data from registers to setup AddrLib global data, used in AddrCreate
+****************************************************************************************************
+*/
+typedef struct _ADDR_REGISTER_VALUE
+{
+    UINT_32  gbAddrConfig;       ///< For R8xx, use GB_ADDR_CONFIG register value.
+                                 ///  For R6xx/R7xx, use GB_TILING_CONFIG.
+                                 ///  But they can be treated as the same.
+                                 ///  if this value is 0, use chip to set default value
+    UINT_32  backendDisables;    ///< 1 bit per backend, starting with LSB. 1=disabled,0=enabled.
+                                 ///  Register value of CC_RB_BACKEND_DISABLE.BACKEND_DISABLE
+
+                                 ///  R800 registers-----------------------------------------------
+    UINT_32  noOfBanks;          ///< Number of h/w ram banks - For r800: MC_ARB_RAMCFG.NOOFBANK
+                                 ///  No enums for this value in h/w header files
+                                 ///  0: 4
+                                 ///  1: 8
+                                 ///  2: 16
+    UINT_32  noOfRanks;          ///  MC_ARB_RAMCFG.NOOFRANK
+                                 ///  0: 1
+                                 ///  1: 2
+                                 ///  SI (R1000) registers-----------------------------------------
+    const UINT_32* pTileConfig;  ///< Global tile setting tables
+    UINT_32  noOfEntries;        ///< Number of entries in pTileConfig
+
+                                 ///< 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;
+
+/**
+****************************************************************************************************
+* ADDR_CREATE_INPUT
+*
+*   @brief
+*       Parameters use to create an AddrLib Object. Caller must provide all fields.
+*
+****************************************************************************************************
+*/
+typedef struct _ADDR_CREATE_INPUT
+{
+    UINT_32             size;                ///< Size of this structure in bytes
+
+    UINT_32             chipEngine;          ///< Chip Engine
+    UINT_32             chipFamily;          ///< Chip Family
+    UINT_32             chipRevision;        ///< Chip Revision
+    ADDR_CALLBACKS      callbacks;           ///< Callbacks for sysmem alloc/free/print
+    ADDR_CREATE_FLAGS   createFlags;         ///< Flags to setup AddrLib
+    ADDR_REGISTER_VALUE regValue;            ///< Data from registers to setup AddrLib global data
+    ADDR_CLIENT_HANDLE  hClient;             ///< Client handle
+    UINT_32             minPitchAlignPixels; ///< Minimum pitch alignment in pixels
+} ADDR_CREATE_INPUT;
+
+/**
+****************************************************************************************************
+* ADDR_CREATEINFO_OUTPUT
+*
+*   @brief
+*       Return AddrLib handle to client driver
+*
+****************************************************************************************************
+*/
+typedef struct _ADDR_CREATE_OUTPUT
+{
+    UINT_32              size;            ///< Size of this structure in bytes
+
+    ADDR_HANDLE          hLib;            ///< Address lib handle
+
+    UINT_32              numEquations;    ///< Number of equations in the table
+    const ADDR_EQUATION* pEquationTable;  ///< Pointer to the equation table
+} ADDR_CREATE_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrCreate
+*
+*   @brief
+*       Create AddrLib object, must be called before any interface calls
+*
+*   @return
+*       ADDR_OK if successful
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrCreate(
+    const ADDR_CREATE_INPUT*    pAddrCreateIn,
+    ADDR_CREATE_OUTPUT*         pAddrCreateOut);
+
+/**
+****************************************************************************************************
+*   AddrDestroy
+*
+*   @brief
+*       Destroy AddrLib object, must be called to free internally allocated resources.
+*
+*   @return
+*      ADDR_OK if successful
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrDestroy(
+    ADDR_HANDLE hLib);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                    Surface functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+* @brief
+*       Bank/tiling parameters. On function input, these can be set as desired or
+*       left 0 for AddrLib to calculate/default. On function output, these are the actual
+*       parameters used.
+* @note
+*       Valid bankWidth/bankHeight value:
+*       1,2,4,8. They are factors instead of pixels or bytes.
+*
+*       The bank number remains constant across each row of the
+*       macro tile as each pipe is selected, so the number of
+*       tiles in the x direction with the same bank number will
+*       be bank_width * num_pipes.
+****************************************************************************************************
+*/
+typedef struct _ADDR_TILEINFO
+{
+    ///  Any of these parameters can be set to 0 to use the HW default.
+    UINT_32     banks;              ///< Number of banks, numerical value
+    UINT_32     bankWidth;          ///< Number of tiles in the X direction in the same bank
+    UINT_32     bankHeight;         ///< Number of tiles in the Y direction in the same bank
+    UINT_32     macroAspectRatio;   ///< Macro tile aspect ratio. 1-1:1, 2-4:1, 4-16:1, 8-64:1
+    UINT_32     tileSplitBytes;     ///< Tile split size, in bytes
+    AddrPipeCfg pipeConfig;         ///< Pipe Config = HW enum + 1
+} ADDR_TILEINFO;
+
+// Create a define to avoid client change. The removal of R800 is because we plan to implement SI
+// within 800 HWL - An AddrPipeCfg is added in above data structure
+typedef ADDR_TILEINFO ADDR_R800_TILEINFO;
+
+/**
+****************************************************************************************************
+* @brief
+*       Information needed by quad buffer stereo support
+****************************************************************************************************
+*/
+typedef struct _ADDR_QBSTEREOINFO
+{
+    UINT_32         eyeHeight;          ///< Height (in pixel rows) to right eye
+    UINT_32         rightOffset;        ///< Offset (in bytes) to right eye
+    UINT_32         rightSwizzle;       ///< TileSwizzle for right eyes
+} ADDR_QBSTEREOINFO;
+
+/**
+****************************************************************************************************
+*   ADDR_SURFACE_FLAGS
+*
+*   @brief
+*       Surface flags
+****************************************************************************************************
+*/
+typedef union _ADDR_SURFACE_FLAGS
+{
+    struct
+    {
+        UINT_32 color                : 1; ///< Flag indicates this is a color buffer
+        UINT_32 depth                : 1; ///< Flag indicates this is a depth/stencil buffer
+        UINT_32 stencil              : 1; ///< Flag indicates this is a stencil buffer
+        UINT_32 texture              : 1; ///< Flag indicates this is a texture
+        UINT_32 cube                 : 1; ///< Flag indicates this is a cubemap
+        UINT_32 volume               : 1; ///< Flag indicates this is a volume texture
+        UINT_32 fmask                : 1; ///< Flag indicates this is an fmask
+        UINT_32 cubeAsArray          : 1; ///< Flag indicates if treat cubemap as arrays
+        UINT_32 compressZ            : 1; ///< Flag indicates z buffer is compressed
+        UINT_32 overlay              : 1; ///< Flag indicates this is an overlay surface
+        UINT_32 noStencil            : 1; ///< Flag indicates this depth has no separate stencil
+        UINT_32 display              : 1; ///< Flag indicates this should match display controller req.
+        UINT_32 opt4Space            : 1; ///< Flag indicates this surface should be optimized for space
+                                          ///  i.e. save some memory but may lose performance
+        UINT_32 prt                  : 1; ///< Flag for partially resident texture
+        UINT_32 qbStereo             : 1; ///< Quad buffer stereo surface
+        UINT_32 pow2Pad              : 1; ///< SI: Pad to pow2, must set for mipmap (include level0)
+        UINT_32 interleaved          : 1; ///< Special flag for interleaved YUV surface padding
+        UINT_32 tcCompatible         : 1; ///< Flag indicates surface needs to be shader readable
+        UINT_32 dispTileType         : 1; ///< NI: force display Tiling for 128 bit shared resoruce
+        UINT_32 dccCompatible        : 1; ///< VI: whether to make MSAA surface support dcc fast clear
+        UINT_32 dccPipeWorkaround    : 1; ///< VI: whether to workaround the HW limit that
+                                          ///  dcc can't be enabled if pipe config of tile mode
+                                          ///  is different from that of ASIC, this flag
+                                          ///  is address lib internal flag, client should ignore it
+        UINT_32 czDispCompatible     : 1; ///< SI+: CZ family has a HW bug needs special alignment.
+                                          ///  This flag indicates we need to follow the
+                                          ///  alignment with CZ families or other ASICs under
+                                          ///  PX configuration + CZ.
+        UINT_32 nonSplit             : 1; ///< CI: depth texture should not be split
+        UINT_32 disableLinearOpt     : 1; ///< Disable tile mode optimization to linear
+        UINT_32 needEquation         : 1; ///< Make the surface tile setting equation compatible.
+                                          ///  This flag indicates we need to override tile
+                                          ///  mode to PRT_* tile mode to disable slice rotation,
+                                          ///  which is needed by swizzle pattern equation.
+        UINT_32 skipIndicesOutput    : 1; ///< Skipping indices in output.
+        UINT_32 rotateDisplay        : 1; ///< Rotate micro tile type
+        UINT_32 minimizeAlignment    : 1; ///< Minimize alignment
+        UINT_32 preferEquation       : 1; ///< Return equation index without adjusting tile mode
+        UINT_32 matchStencilTileCfg  : 1; ///< Select tile index of stencil as well as depth surface
+                                          ///  to make sure they share same tile config parameters
+        UINT_32 disallowLargeThickDegrade   : 1;    ///< Disallow large thick tile degrade
+        UINT_32 reserved             : 1; ///< Reserved bits
+    };
+
+    UINT_32 value;
+} ADDR_SURFACE_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SURFACE_INFO_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeSurfaceInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_SURFACE_INFO_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+
+    AddrTileMode        tileMode;           ///< Tile mode
+    AddrFormat          format;             ///< If format is set to valid one, bpp/width/height
+                                            ///  might be overwritten
+    UINT_32             bpp;                ///< Bits per pixel
+    UINT_32             numSamples;         ///< Number of samples
+    UINT_32             width;              ///< Width, in pixels
+    UINT_32             height;             ///< Height, in pixels
+    UINT_32             numSlices;          ///< Number of surface slices or depth
+    UINT_32             slice;              ///< Slice index
+    UINT_32             mipLevel;           ///< Current mipmap level
+    UINT_32             numMipLevels;       ///< Number of mips in mip chain
+    ADDR_SURFACE_FLAGS  flags;              ///< Surface type flags
+    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
+    /// r800 and later HWL parameters
+    // Needed by 2D tiling, for linear and 1D tiling, just keep them 0's
+    ADDR_TILEINFO*      pTileInfo;          ///< 2D tile parameters. Set to 0 to default/calculate
+    AddrTileType        tileType;           ///< Micro tiling type, not needed when tileIndex != -1
+    INT_32              tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
+                                            ///  while the global useTileIndex is set to 1
+    UINT_32             basePitch;          ///< Base level pitch in pixels, 0 means ignored, is a
+                                            ///  must for mip levels from SI+.
+                                            ///  Don't use pitch in blocks for compressed formats!
+    UINT_32             maxBaseAlign;       ///< Max base alignment request from client
+    UINT_32             pitchAlign;         ///< Pitch alignment request from client
+    UINT_32             heightAlign;        ///< Height alignment request from client
+} ADDR_COMPUTE_SURFACE_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SURFACE_INFO_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeSurfInfo
+*   @note
+        Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch
+        Pixel: Original pixel
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_SURFACE_INFO_OUTPUT
+{
+    UINT_32         size;           ///< Size of this structure in bytes
+
+    UINT_32         pitch;          ///< Pitch in elements (in blocks for compressed formats)
+    UINT_32         height;         ///< Height in elements (in blocks for compressed formats)
+    UINT_32         depth;          ///< Number of slice/depth
+    UINT_64         surfSize;       ///< Surface size in bytes
+    AddrTileMode    tileMode;       ///< Actual tile mode. May differ from that in input
+    UINT_32         baseAlign;      ///< Base address alignment
+    UINT_32         pitchAlign;     ///< Pitch alignment, in elements
+    UINT_32         heightAlign;    ///< Height alignment, in elements
+    UINT_32         depthAlign;     ///< Depth alignment, aligned to thickness, for 3d texture
+    UINT_32         bpp;            ///< Bits per elements (e.g. blocks for BCn, 1/3 for 96bit)
+    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_64         sliceSize;      ///< Size of slice specified by input's slice
+                                    ///  The result is controlled by surface flags & createFlags
+                                    ///  By default this value equals to surfSize for volume
+    UINT_32         pitchTileMax;   ///< PITCH_TILE_MAX value for h/w register
+    UINT_32         heightTileMax;  ///< HEIGHT_TILE_MAX value for h/w register
+    UINT_32         sliceTileMax;   ///< SLICE_TILE_MAX value for h/w register
+
+    UINT_32         numSamples;     ///< Pass the effective numSamples processed in this call
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*  pTileInfo;      ///< Tile parameters used. Filled in if 0 on input
+    AddrTileType    tileType;       ///< Micro tiling type, only valid when tileIndex != -1
+    INT_32          tileIndex;      ///< Tile index, MAY be "downgraded"
+
+    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+    /// Output flags
+    struct
+    {
+        /// Special information to work around SI mipmap swizzle bug UBTS #317508
+        UINT_32     last2DLevel  : 1;  ///< TRUE if this is the last 2D(3D) tiled
+                                       ///< Only meaningful when create flag checkLast2DLevel is set
+        UINT_32     tcCompatible : 1;  ///< If the surface can be shader compatible
+        UINT_32     dccUnsupport : 1;  ///< If the surface can support DCC compressed rendering
+        UINT_32     prtTileIndex : 1;  ///< SI only, indicate the returned tile index is for PRT
+                                       ///< If address lib return true for mip 0, client should set prt flag
+                                       ///< for child mips in subsequent compute surface info calls
+        UINT_32     reserved     :28;  ///< Reserved bits
+    };
+
+    UINT_32         equationIndex;     ///< Equation index in the equation table;
+
+    UINT_32         blockWidth;        ///< Width in element inside one block(1D->Micro, 2D->Macro)
+    UINT_32         blockHeight;       ///< Height in element inside one block(1D->Micro, 2D->Macro)
+    UINT_32         blockSlices;       ///< Slice number inside one block(1D->Micro, 2D->Macro)
+
+    /// Stereo info
+    ADDR_QBSTEREOINFO*  pStereoInfo;///< Stereo information, needed when .qbStereo flag is TRUE
+
+    INT_32          stencilTileIdx; ///< stencil tile index output when matchStencilTileCfg was set
+} ADDR_COMPUTE_SURFACE_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeSurfaceInfo
+*
+*   @brief
+*       Compute surface width/height/depth/alignments and suitable tiling mode
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceInfo(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeSurfaceAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_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         bpp;                ///< Bits per pixel
+    UINT_32         pitch;              ///< Surface pitch, in pixels
+    UINT_32         height;             ///< Surface height, in pixels
+    UINT_32         numSlices;          ///< Surface depth
+    UINT_32         numSamples;         ///< Number of samples
+
+    AddrTileMode    tileMode;           ///< Tile mode
+    BOOL_32         isDepth;            ///< TRUE if the surface uses depth sample ordering within
+                                        ///  micro tile. Textures can also choose depth sample order
+    UINT_32         tileBase;           ///< Base offset (in bits) inside micro tile which handles
+                                        ///  the case that components are stored separately
+    UINT_32         compBits;           ///< The component bits actually needed(for planar surface)
+
+    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
+    /// r800 and later HWL parameters
+    // Used for 1D tiling above
+    AddrTileType    tileType;           ///< See defintion of AddrTileType
+    struct
+    {
+        UINT_32     ignoreSE : 1;       ///< TRUE if shader engines are ignored. This is texture
+                                        ///  only flag. Only non-RT texture can set this to TRUE
+        UINT_32     reserved :31;       ///< Reserved for future use.
+    };
+    // 2D tiling needs following structure
+    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Client must provide all data
+    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    union
+    {
+        struct
+        {
+            UINT_32  bankSwizzle;       ///< Bank swizzle
+            UINT_32  pipeSwizzle;       ///< Pipe swizzle
+        };
+        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
+    };
+} ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeSurfaceAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_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)
+} ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeSurfaceAddrFromCoord
+*
+*   @brief
+*       Compute surface address from a given coordinate.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceAddrFromCoord(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeSurfaceCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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;
+    UINT_32         bpp;                ///< Bits per pixel
+    UINT_32         pitch;              ///< Pitch, in pixels
+    UINT_32         height;             ///< Height in pixels
+    UINT_32         numSlices;          ///< Surface depth
+    UINT_32         numSamples;         ///< Number of samples
+
+    AddrTileMode    tileMode;           ///< Tile mode
+    BOOL_32         isDepth;            ///< Surface uses depth sample ordering within micro tile.
+                                        ///  Note: Textures can choose depth sample order as well.
+    UINT_32         tileBase;           ///< Base offset (in bits) inside micro tile which handles
+                                        ///  the case that components are stored separately
+    UINT_32         compBits;           ///< The component bits actually needed(for planar surface)
+
+    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
+    /// r800 and later HWL parameters
+    // Used for 1D tiling above
+    AddrTileType    tileType;           ///< See defintion of AddrTileType
+    struct
+    {
+        UINT_32     ignoreSE : 1;       ///< TRUE if shader engines are ignored. This is texture
+                                        ///  only flag. Only non-RT texture can set this to TRUE
+        UINT_32     reserved :31;       ///< Reserved for future use.
+    };
+    // 2D tiling needs following structure
+    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Client must provide all data
+    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    union
+    {
+        struct
+        {
+            UINT_32  bankSwizzle;       ///< Bank swizzle
+            UINT_32  pipeSwizzle;       ///< Pipe swizzle
+        };
+        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
+    };
+} ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeSurfaceCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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
+} ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeSurfaceCoordFromAddr
+*
+*   @brief
+*       Compute coordinate from a given surface address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceCoordFromAddr(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
+    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                   HTile functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR_HTILE_FLAGS
+*
+*   @brief
+*       HTILE flags
+****************************************************************************************************
+*/
+typedef union _ADDR_HTILE_FLAGS
+{
+    struct
+    {
+        UINT_32 tcCompatible          : 1;  ///< Flag indicates surface needs to be shader readable
+        UINT_32 skipTcCompatSizeAlign : 1;  ///< Flag indicates that addrLib will not align htile
+                                            ///  size to 256xBankxPipe when computing tc-compatible
+                                            ///  htile info.
+        UINT_32 reserved              : 30; ///< Reserved bits
+    };
+
+    UINT_32 value;
+} ADDR_HTILE_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_HTILE_INFO_INPUT
+*
+*   @brief
+*       Input structure of AddrComputeHtileInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_HTILE_INFO_INPUT
+{
+    UINT_32            size;            ///< Size of this structure in bytes
+
+    ADDR_HTILE_FLAGS   flags;           ///< HTILE flags
+    UINT_32            pitch;           ///< Surface pitch, in pixels
+    UINT_32            height;          ///< Surface height, in pixels
+    UINT_32            numSlices;       ///< Number of slices
+    BOOL_32            isLinear;        ///< Linear or tiled HTILE layout
+    AddrHtileBlockSize blockWidth;      ///< 4 or 8. EG above only support 8
+    AddrHtileBlockSize blockHeight;     ///< 4 or 8. EG above only support 8
+    ADDR_TILEINFO*     pTileInfo;       ///< Tile info
+
+    INT_32             tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    INT_32             macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+                                        ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_HTILE_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_HTILE_INFO_OUTPUT
+*
+*   @brief
+*       Output structure of AddrComputeHtileInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_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_64 htileBytes;         ///< Size of HTILE buffer, in bytes
+    UINT_32 baseAlign;          ///< Base alignment
+    UINT_32 bpp;                ///< Bits per pixel for HTILE is how many bits for an 8x8 block!
+    UINT_32 macroWidth;         ///< Macro width in pixels, actually squared cache shape
+    UINT_32 macroHeight;        ///< Macro height in pixels
+    UINT_64 sliceSize;          ///< Slice size, in bytes.
+    BOOL_32 sliceInterleaved;   ///< Flag to indicate if different slice's htile is interleaved
+                                ///  Compute engine clear can't be used if htile is interleaved
+    BOOL_32 nextMipLevelCompressible;   ///< Flag to indicate whether HTILE can be enabled in
+                                        ///  next mip level, it also indicates if memory set based
+                                        ///  fast clear can be used for current mip level.
+} ADDR_COMPUTE_HTILE_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeHtileInfo
+*
+*   @brief
+*       Compute Htile pitch, height, base alignment and size in bytes
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeHtileInfo(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_HTILE_INFO_INPUT*    pIn,
+    ADDR_COMPUTE_HTILE_INFO_OUTPUT*         pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeHtileAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
+{
+    UINT_32            size;            ///< Size of this structure in bytes
+
+    UINT_32            pitch;           ///< Pitch, in pixels
+    UINT_32            height;          ///< Height in pixels
+    UINT_32            x;               ///< X coordinate
+    UINT_32            y;               ///< Y coordinate
+    UINT_32            slice;           ///< Index of slice
+    UINT_32            numSlices;       ///< Number of slices
+    BOOL_32            isLinear;        ///< Linear or tiled HTILE layout
+    ADDR_HTILE_FLAGS   flags;           ///< htile flags
+    AddrHtileBlockSize blockWidth;      ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
+    AddrHtileBlockSize blockHeight;     ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
+    ADDR_TILEINFO*     pTileInfo;       ///< Tile info
+
+    INT_32             tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    INT_32             macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+                                        ///< README: When tileIndex is not -1, this must be valid
+    UINT_32            bpp;             ///< depth/stencil buffer bit per pixel size
+    UINT_32            zStencilAddr;    ///< tcCompatible Z/Stencil surface address
+} ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeHtileAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
+{
+    UINT_32 size;           ///< Size of this structure in bytes
+
+    UINT_64 addr;           ///< Address in bytes
+    UINT_32 bitPosition;    ///< Bit position, 0 or 4. CMASK and HTILE shares some lib method.
+                            ///  So we keep bitPosition for HTILE as well
+} ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeHtileAddrFromCoord
+*
+*   @brief
+*       Compute Htile address according to coordinates (of depth buffer)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeHtileAddrFromCoord(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,
+    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeHtileCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
+{
+    UINT_32            size;            ///< Size of this structure in bytes
+
+    UINT_64            addr;            ///< Address
+    UINT_32            bitPosition;     ///< Bit position 0 or 4. CMASK and HTILE share some methods
+                                        ///  so we keep bitPosition for HTILE as well
+    UINT_32            pitch;           ///< Pitch, in pixels
+    UINT_32            height;          ///< Height, in pixels
+    UINT_32            numSlices;       ///< Number of slices
+    BOOL_32            isLinear;        ///< Linear or tiled HTILE layout
+    AddrHtileBlockSize blockWidth;      ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
+    AddrHtileBlockSize blockHeight;     ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
+    ADDR_TILEINFO*     pTileInfo;       ///< Tile info
+
+    INT_32             tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    INT_32             macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+                                        ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeHtileCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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;  ///< Slice index
+} ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeHtileCoordFromAddr
+*
+*   @brief
+*       Compute coordinates within depth buffer (1st pixel of a micro tile) according to
+*       Htile address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeHtileCoordFromAddr(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,
+    ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     C-mask functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR_CMASK_FLAGS
+*
+*   @brief
+*       CMASK flags
+****************************************************************************************************
+*/
+typedef union _ADDR_CMASK_FLAGS
+{
+    struct
+    {
+        UINT_32 tcCompatible  : 1; ///< Flag indicates surface needs to be shader readable
+        UINT_32 reserved      :31; ///< Reserved bits
+    };
+
+    UINT_32 value;
+} ADDR_CMASK_FLAGS;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_CMASK_INFO_INPUT
+*
+*   @brief
+*       Input structure of AddrComputeCmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_CMASKINFO_INPUT
+{
+    UINT_32             size;            ///< Size of this structure in bytes
+
+    ADDR_CMASK_FLAGS    flags;           ///< CMASK flags
+    UINT_32             pitch;           ///< Pitch, in pixels, of color buffer
+    UINT_32             height;          ///< Height, in pixels, of color buffer
+    UINT_32             numSlices;       ///< Number of slices, of color buffer
+    BOOL_32             isLinear;        ///< Linear or tiled layout, Only SI can be linear
+    ADDR_TILEINFO*      pTileInfo;       ///< Tile info
+
+    INT_32              tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
+                                         ///  while the global useTileIndex is set to 1
+    INT_32              macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+                                         ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_CMASK_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_CMASK_INFO_OUTPUT
+*
+*   @brief
+*       Output structure of AddrComputeCmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_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_64 cmaskBytes;     ///< Size in bytes of CMask buffer
+    UINT_32 baseAlign;      ///< Base alignment
+    UINT_32 blockMax;       ///< Cmask block size. Need this to set CB_COLORn_MASK register
+    UINT_32 macroWidth;     ///< Macro width in pixels, actually squared cache shape
+    UINT_32 macroHeight;    ///< Macro height in pixels
+    UINT_64 sliceSize;      ///< Slice size, in bytes.
+} ADDR_COMPUTE_CMASK_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeCmaskInfo
+*
+*   @brief
+*       Compute Cmask pitch, height, base alignment and size in bytes from color buffer
+*       info
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskInfo(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_CMASK_INFO_INPUT*    pIn,
+    ADDR_COMPUTE_CMASK_INFO_OUTPUT*         pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeCmaskAddrFromCoord
+*
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
+{
+    UINT_32          size;           ///< Size of this structure in bytes
+    UINT_32          x;              ///< X coordinate
+    UINT_32          y;              ///< Y coordinate
+    UINT_64          fmaskAddr;      ///< Fmask addr for tc compatible Cmask
+    UINT_32          slice;          ///< Slice index
+    UINT_32          pitch;          ///< Pitch in pixels, of color buffer
+    UINT_32          height;         ///< Height in pixels, of color buffer
+    UINT_32          numSlices;      ///< Number of slices
+    UINT_32          bpp;
+    BOOL_32          isLinear;       ///< Linear or tiled layout, Only SI can be linear
+    ADDR_CMASK_FLAGS flags;          ///< CMASK flags
+    ADDR_TILEINFO*   pTileInfo;      ///< Tile info
+
+    INT_32           tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
+                                     ///< while the global useTileIndex is set to 1
+    INT_32           macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+                                     ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeCmaskAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_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-7. CMASK is 4 bpp,
+                            ///  so the address may be located in bit 0 (0) or 4 (4)
+} ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Compute Cmask address according to coordinates (of MSAA color buffer)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskAddrFromCoord(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,
+    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeCmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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-7. CMASK is 4 bpp,
+                                    ///  so the address may be located in bit 0 (0) or 4 (4)
+    UINT_32        pitch;           ///< Pitch, in pixels
+    UINT_32        height;          ///< Height in pixels
+    UINT_32        numSlices;       ///< Number of slices
+    BOOL_32        isLinear;        ///< Linear or tiled layout, Only SI can be linear
+    ADDR_TILEINFO* pTileInfo;       ///< Tile info
+
+    INT_32         tileIndex;       ///< Tile index, MUST be -1 if you don't want to use it
+                                    ///  while the global useTileIndex is set to 1
+    INT_32         macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+                                    ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeCmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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;  ///< Slice index
+} ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeCmaskCoordFromAddr
+*
+*   @brief
+*       Compute coordinates within color buffer (1st pixel of a micro tile) according to
+*       Cmask address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskCoordFromAddr(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,
+    ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     F-mask functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_FMASK_INFO_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeFmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_FMASK_INFO_INPUT
+{
+    UINT_32         size;               ///< Size of this structure in bytes
+
+    AddrTileMode    tileMode;           ///< Tile mode
+    UINT_32         pitch;              ///< Surface pitch, in pixels
+    UINT_32         height;             ///< Surface height, in pixels
+    UINT_32         numSlices;          ///< Number of slice/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
+    /// r800 and later HWL parameters
+    struct
+    {
+        UINT_32 resolved:   1;          ///< TRUE if the surface is for resolved fmask, only used
+                                        ///  by H/W clients. S/W should always set it to FALSE.
+        UINT_32 reserved:  31;          ///< Reserved for future use.
+    };
+    ADDR_TILEINFO*  pTileInfo;          ///< 2D tiling parameters. Clients must give valid data
+    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+} ADDR_COMPUTE_FMASK_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_FMASK_INFO_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeFmaskInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_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         numSlices;      ///< Slices of fmask
+    UINT_64         fmaskBytes;     ///< Size of fmask in bytes
+    UINT_32         baseAlign;      ///< Base address alignment
+    UINT_32         pitchAlign;     ///< Pitch alignment
+    UINT_32         heightAlign;    ///< Height alignment
+    UINT_32         bpp;            ///< Bits per pixel of FMASK is: number of bit planes
+    UINT_32         numSamples;     ///< Number of samples, used for dump, export this since input
+                                    ///  may be changed in 9xx and above
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*  pTileInfo;      ///< Tile parameters used. Fmask can have different
+                                    ///  bank_height from color buffer
+    INT_32          tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
+                                    ///  while the global useTileIndex is set to 1
+    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+    UINT_64         sliceSize;      ///< Size of slice in bytes
+} ADDR_COMPUTE_FMASK_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeFmaskInfo
+*
+*   @brief
+*       Compute Fmask pitch/height/depth/alignments and size in bytes
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskInfo(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeFmaskAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_FMASK_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         plane;              ///< Plane number
+    UINT_32         sample;             ///< Sample index (fragment index for EQAA)
+
+    UINT_32         pitch;              ///< Surface pitch, in pixels
+    UINT_32         height;             ///< Surface height, in pixels
+    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
+
+    AddrTileMode    tileMode;           ///< Tile mode
+    union
+    {
+        struct
+        {
+            UINT_32  bankSwizzle;       ///< Bank swizzle
+            UINT_32  pipeSwizzle;       ///< Pipe swizzle
+        };
+        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
+    };
+
+    /// r800 and later HWL parameters
+    struct
+    {
+        UINT_32 resolved:   1;          ///< TRUE if this is a resolved fmask, used by H/W clients
+        UINT_32 ignoreSE:   1;          ///< TRUE if shader engines are ignored.
+        UINT_32 reserved:  30;          ///< Reserved for future use.
+    };
+    ADDR_TILEINFO*  pTileInfo;          ///< 2D tiling parameters. Client must provide all data
+
+} ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeFmaskAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR_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.
+} ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeFmaskAddrFromCoord
+*
+*   @brief
+*       Compute Fmask address according to coordinates (x,y,slice,sample,plane)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskAddrFromCoord(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,
+    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
+*
+*   @brief
+*       Input structure for AddrComputeFmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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.
+
+    UINT_32         pitch;              ///< Pitch, in pixels
+    UINT_32         height;             ///< Height in pixels
+    UINT_32         numSamples;         ///< Number of samples
+    UINT_32         numFrags;           ///< Number of fragments
+    AddrTileMode    tileMode;           ///< Tile mode
+    union
+    {
+        struct
+        {
+            UINT_32  bankSwizzle;       ///< Bank swizzle
+            UINT_32  pipeSwizzle;       ///< Pipe swizzle
+        };
+        UINT_32     tileSwizzle;        ///< Combined swizzle, if useCombinedSwizzle is TRUE
+    };
+
+    /// r800 and later HWL parameters
+    struct
+    {
+        UINT_32 resolved:   1;          ///< TRUE if this is a resolved fmask, used by HW components
+        UINT_32 ignoreSE:   1;          ///< TRUE if shader engines are ignored.
+        UINT_32 reserved:  30;          ///< Reserved for future use.
+    };
+    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Client must provide all data
+
+} ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
+*
+*   @brief
+*       Output structure for AddrComputeFmaskCoordFromAddr
+****************************************************************************************************
+*/
+typedef struct _ADDR_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 plane;      ///< Plane number
+    UINT_32 sample;     ///< Sample index (fragment index for EQAA)
+} ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeFmaskCoordFromAddr
+*
+*   @brief
+*       Compute FMASK coordinate from an given address
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskCoordFromAddr(
+    ADDR_HANDLE                                     hLib,
+    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,
+    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                          Element/utility functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrGetVersion
+*
+*   @brief
+*       Get AddrLib version number
+****************************************************************************************************
+*/
+UINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib);
+
+/**
+****************************************************************************************************
+*   AddrUseTileIndex
+*
+*   @brief
+*       Return TRUE if tileIndex is enabled in this address library
+****************************************************************************************************
+*/
+BOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib);
+
+/**
+****************************************************************************************************
+*   AddrUseCombinedSwizzle
+*
+*   @brief
+*       Return TRUE if combined swizzle is enabled in this address library
+****************************************************************************************************
+*/
+BOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib);
+
+/**
+****************************************************************************************************
+*   ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
+*
+*   @brief
+*       Input structure of AddrExtractBankPipeSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
+{
+    UINT_32         size;           ///< Size of this structure in bytes
+
+    UINT_32         base256b;       ///< Base256b value
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*  pTileInfo;      ///< 2D tile parameters. Client must provide all data
+
+    INT_32          tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
+                                    ///  while the global useTileIndex is set to 1
+    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+                                    ///< README: When tileIndex is not -1, this must be valid
+} ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
+*
+*   @brief
+*       Output structure of AddrExtractBankPipeSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
+{
+    UINT_32 size;           ///< Size of this structure in bytes
+
+    UINT_32 bankSwizzle;    ///< Bank swizzle
+    UINT_32 pipeSwizzle;    ///< Pipe swizzle
+} ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrExtractBankPipeSwizzle
+*
+*   @brief
+*       Extract Bank and Pipe swizzle from base256b
+*   @return
+*       ADDR_OK if no error
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle(
+    ADDR_HANDLE                                 hLib,
+    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,
+    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
+*
+*   @brief
+*       Input structure of AddrCombineBankPipeSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
+{
+    UINT_32         size;           ///< Size of this structure in bytes
+
+    UINT_32         bankSwizzle;    ///< Bank swizzle
+    UINT_32         pipeSwizzle;    ///< Pipe swizzle
+    UINT_64         baseAddr;       ///< Base address (leave it zero for driver clients)
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*  pTileInfo;      ///< 2D tile parameters. Client must provide all data
+
+    INT_32          tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
+                                    ///  while the global useTileIndex is set to 1
+    INT_32          macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+                                    ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
+*
+*   @brief
+*       Output structure of AddrCombineBankPipeSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
+{
+    UINT_32 size;           ///< Size of this structure in bytes
+
+    UINT_32 tileSwizzle;    ///< Combined swizzle
+} ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrCombineBankPipeSwizzle
+*
+*   @brief
+*       Combine Bank and Pipe swizzle
+*   @return
+*       ADDR_OK if no error
+*   @note
+*       baseAddr here is full MCAddress instead of base256b
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle(
+    ADDR_HANDLE                                 hLib,
+    const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,
+    ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT*       pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SLICESWIZZLE_INPUT
+*
+*   @brief
+*       Input structure of AddrComputeSliceSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_SLICESWIZZLE_INPUT
+{
+    UINT_32         size;               ///< Size of this structure in bytes
+
+    AddrTileMode    tileMode;           ///< Tile Mode
+    UINT_32         baseSwizzle;        ///< Base tile swizzle
+    UINT_32         slice;              ///< Slice index
+    UINT_64         baseAddr;           ///< Base address, driver should leave it 0 in most cases
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*  pTileInfo;          ///< 2D tile parameters. Actually banks needed here!
+
+    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    INT_32          macroModeIndex;     ///< Index in macro tile mode table if there is one (CI)
+                                        ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_SLICESWIZZLE_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
+*
+*   @brief
+*       Output structure of AddrComputeSliceSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
+{
+    UINT_32  size;           ///< Size of this structure in bytes
+
+    UINT_32  tileSwizzle;    ///< Recalculated tileSwizzle value
+} ADDR_COMPUTE_SLICESWIZZLE_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeSliceSwizzle
+*
+*   @brief
+*       Extract Bank and Pipe swizzle from base256b
+*   @return
+*       ADDR_OK if no error
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,
+    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut);
+
+/**
+****************************************************************************************************
+*   AddrSwizzleGenOption
+*
+*   @brief
+*       Which swizzle generating options: legacy or linear
+****************************************************************************************************
+*/
+typedef enum _AddrSwizzleGenOption
+{
+    ADDR_SWIZZLE_GEN_DEFAULT    = 0,    ///< As is in client driver implemention for swizzle
+    ADDR_SWIZZLE_GEN_LINEAR     = 1,    ///< Using a linear increment of swizzle
+} AddrSwizzleGenOption;
+
+/**
+****************************************************************************************************
+*   AddrSwizzleOption
+*
+*   @brief
+*       Controls how swizzle is generated
+****************************************************************************************************
+*/
+typedef union _ADDR_SWIZZLE_OPTION
+{
+    struct
+    {
+        UINT_32 genOption       : 1;    ///< The way swizzle is generated, see AddrSwizzleGenOption
+        UINT_32 reduceBankBit   : 1;    ///< TRUE if we need reduce swizzle bits
+        UINT_32 reserved        :30;    ///< Reserved bits
+    };
+
+    UINT_32 value;
+
+} ADDR_SWIZZLE_OPTION;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_BASE_SWIZZLE_INPUT
+*
+*   @brief
+*       Input structure of AddrComputeBaseSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_INPUT
+{
+    UINT_32             size;           ///< Size of this structure in bytes
+
+    ADDR_SWIZZLE_OPTION option;         ///< Swizzle option
+    UINT_32             surfIndex;      ///< Index of this surface type
+    AddrTileMode        tileMode;       ///< Tile Mode
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*      pTileInfo;      ///< 2D tile parameters. Actually banks needed here!
+
+    INT_32              tileIndex;      ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    INT_32              macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+                                        ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_BASE_SWIZZLE_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
+*
+*   @brief
+*       Output structure of AddrComputeBaseSwizzle
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
+{
+    UINT_32 size;           ///< Size of this structure in bytes
+
+    UINT_32 tileSwizzle;    ///< Combined swizzle
+} ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeBaseSwizzle
+*
+*   @brief
+*       Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
+*   @return
+*       ADDR_OK if no error
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
+    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT*       pOut);
+
+/**
+****************************************************************************************************
+*   ELEM_GETEXPORTNORM_INPUT
+*
+*   @brief
+*       Input structure for ElemGetExportNorm
+*
+****************************************************************************************************
+*/
+typedef struct _ELEM_GETEXPORTNORM_INPUT
+{
+    UINT_32             size;       ///< Size of this structure in bytes
+
+    AddrColorFormat     format;     ///< Color buffer format; Client should use ColorFormat
+    AddrSurfaceNumber   num;        ///< Surface number type; Client should use NumberType
+    AddrSurfaceSwap     swap;       ///< Surface swap byte swap; Client should use SurfaceSwap
+    UINT_32             numSamples; ///< Number of samples
+} ELEM_GETEXPORTNORM_INPUT;
+
+/**
+****************************************************************************************************
+*  ElemGetExportNorm
+*
+*   @brief
+*       Helper function to check one format can be EXPORT_NUM, which is a register
+*       CB_COLOR_INFO.SURFACE_FORMAT. FP16 can be reported as EXPORT_NORM for rv770 in r600
+*       family
+*   @note
+*       The implementation is only for r600.
+*       00 - EXPORT_FULL: PS exports are 4 pixels with 4 components with 32-bits-per-component. (two
+*       clocks per export)
+*       01 - EXPORT_NORM: PS exports are 4 pixels with 4 components with 16-bits-per-component. (one
+*       clock per export)
+*
+****************************************************************************************************
+*/
+BOOL_32 ADDR_API ElemGetExportNorm(
+    ADDR_HANDLE                     hLib,
+    const ELEM_GETEXPORTNORM_INPUT* pIn);
+
+/**
+****************************************************************************************************
+*   ELEM_FLT32TODEPTHPIXEL_INPUT
+*
+*   @brief
+*       Input structure for addrFlt32ToDepthPixel
+*
+****************************************************************************************************
+*/
+typedef struct _ELEM_FLT32TODEPTHPIXEL_INPUT
+{
+    UINT_32         size;           ///< Size of this structure in bytes
+
+    AddrDepthFormat format;         ///< Depth buffer format
+    ADDR_FLT_32     comps[2];       ///< Component values (Z/stencil)
+} ELEM_FLT32TODEPTHPIXEL_INPUT;
+
+/**
+****************************************************************************************************
+*   ELEM_FLT32TODEPTHPIXEL_INPUT
+*
+*   @brief
+*       Output structure for ElemFlt32ToDepthPixel
+*
+****************************************************************************************************
+*/
+typedef struct _ELEM_FLT32TODEPTHPIXEL_OUTPUT
+{
+    UINT_32 size;           ///< Size of this structure in bytes
+
+    UINT_8* pPixel;         ///< Real depth value. Same data type as depth buffer.
+                            ///  Client must provide enough storage for this type.
+    UINT_32 depthBase;      ///< Tile base in bits for depth bits
+    UINT_32 stencilBase;    ///< Tile base in bits for stencil bits
+    UINT_32 depthBits;      ///< Bits for depth
+    UINT_32 stencilBits;    ///< Bits for stencil
+} ELEM_FLT32TODEPTHPIXEL_OUTPUT;
+
+/**
+****************************************************************************************************
+*   ElemFlt32ToDepthPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a depth/stencil pixel value
+*
+*   @return
+*       Return code
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel(
+    ADDR_HANDLE                         hLib,
+    const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
+    ELEM_FLT32TODEPTHPIXEL_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ELEM_FLT32TOCOLORPIXEL_INPUT
+*
+*   @brief
+*       Input structure for addrFlt32ToColorPixel
+*
+****************************************************************************************************
+*/
+typedef struct _ELEM_FLT32TOCOLORPIXEL_INPUT
+{
+    UINT_32            size;           ///< Size of this structure in bytes
+
+    AddrColorFormat    format;         ///< Color buffer format
+    AddrSurfaceNumber  surfNum;        ///< Surface number
+    AddrSurfaceSwap    surfSwap;       ///< Surface swap
+    ADDR_FLT_32        comps[4];       ///< Component values (r/g/b/a)
+} ELEM_FLT32TOCOLORPIXEL_INPUT;
+
+/**
+****************************************************************************************************
+*   ELEM_FLT32TOCOLORPIXEL_INPUT
+*
+*   @brief
+*       Output structure for ElemFlt32ToColorPixel
+*
+****************************************************************************************************
+*/
+typedef struct _ELEM_FLT32TOCOLORPIXEL_OUTPUT
+{
+    UINT_32 size;       ///< Size of this structure in bytes
+
+    UINT_8* pPixel;     ///< Real color value. Same data type as color buffer.
+                        ///  Client must provide enough storage for this type.
+} ELEM_FLT32TOCOLORPIXEL_OUTPUT;
+
+/**
+****************************************************************************************************
+*   ElemFlt32ToColorPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
+*
+*   @return
+*       Return code
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel(
+    ADDR_HANDLE                         hLib,
+    const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
+    ELEM_FLT32TOCOLORPIXEL_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ElemSize
+*
+*   @brief
+*       Get bits-per-element for specified format
+*
+*   @return
+*       Bits-per-element of specified format
+*
+****************************************************************************************************
+*/
+UINT_32 ADDR_API ElemSize(
+    ADDR_HANDLE hLib,
+    AddrFormat  format);
+
+/**
+****************************************************************************************************
+*   ADDR_CONVERT_TILEINFOTOHW_INPUT
+*
+*   @brief
+*       Input structure for AddrConvertTileInfoToHW
+*   @note
+*       When reverse is TRUE, indices are igonred
+****************************************************************************************************
+*/
+typedef struct _ADDR_CONVERT_TILEINFOTOHW_INPUT
+{
+    UINT_32         size;               ///< Size of this structure in bytes
+    BOOL_32         reverse;            ///< Convert control flag.
+                                        ///  FALSE: convert from real value to HW value;
+                                        ///  TRUE: convert from HW value to real value.
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*  pTileInfo;          ///< Tile parameters with real value
+
+    INT_32          tileIndex;          ///< Tile index, MUST be -1 if you don't want to use it
+                                        ///  while the global useTileIndex is set to 1
+    INT_32          macroModeIndex;     ///< Index in macro tile mode table if there is one (CI)
+                                        ///< README: When tileIndex is not -1, this must be valid
+    UINT_32         bpp;                ///< Bits per pixel
+} ADDR_CONVERT_TILEINFOTOHW_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_CONVERT_TILEINFOTOHW_OUTPUT
+*
+*   @brief
+*       Output structure for AddrConvertTileInfoToHW
+****************************************************************************************************
+*/
+typedef struct _ADDR_CONVERT_TILEINFOTOHW_OUTPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+
+    /// r800 and later HWL parameters
+    ADDR_TILEINFO*      pTileInfo;          ///< Tile parameters with hardware register value
+
+} ADDR_CONVERT_TILEINFOTOHW_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrConvertTileInfoToHW
+*
+*   @brief
+*       Convert tile info from real value to hardware register value
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW(
+    ADDR_HANDLE                             hLib,
+    const ADDR_CONVERT_TILEINFOTOHW_INPUT*  pIn,
+    ADDR_CONVERT_TILEINFOTOHW_OUTPUT*       pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_CONVERT_TILEINDEX_INPUT
+*
+*   @brief
+*       Input structure for AddrConvertTileIndex
+****************************************************************************************************
+*/
+typedef struct _ADDR_CONVERT_TILEINDEX_INPUT
+{
+    UINT_32         size;               ///< Size of this structure in bytes
+
+    INT_32          tileIndex;          ///< Tile index
+    INT_32          macroModeIndex;     ///< Index in macro tile mode table if there is one (CI)
+    UINT_32         bpp;                ///< Bits per pixel
+    BOOL_32         tileInfoHw;         ///< Set to TRUE if client wants HW enum, otherwise actual
+} ADDR_CONVERT_TILEINDEX_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_CONVERT_TILEINDEX_OUTPUT
+*
+*   @brief
+*       Output structure for AddrConvertTileIndex
+****************************************************************************************************
+*/
+typedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT
+{
+    UINT_32             size;           ///< Size of this structure in bytes
+
+    AddrTileMode        tileMode;       ///< Tile mode
+    AddrTileType        tileType;       ///< Tile type
+    ADDR_TILEINFO*      pTileInfo;      ///< Tile info
+
+} ADDR_CONVERT_TILEINDEX_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrConvertTileIndex
+*
+*   @brief
+*       Convert tile index to tile mode/type/info
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
+    ADDR_HANDLE                         hLib,
+    const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
+    ADDR_CONVERT_TILEINDEX_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_GET_MACROMODEINDEX_INPUT
+*
+*   @brief
+*       Input structure for AddrGetMacroModeIndex
+****************************************************************************************************
+*/
+typedef struct _ADDR_GET_MACROMODEINDEX_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    ADDR_SURFACE_FLAGS  flags;              ///< Surface flag
+    INT_32              tileIndex;          ///< Tile index
+    UINT_32             bpp;                ///< Bits per pixel
+    UINT_32             numFrags;           ///< Number of color fragments
+} ADDR_GET_MACROMODEINDEX_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_GET_MACROMODEINDEX_OUTPUT
+*
+*   @brief
+*       Output structure for AddrGetMacroModeIndex
+****************************************************************************************************
+*/
+typedef struct _ADDR_GET_MACROMODEINDEX_OUTPUT
+{
+    UINT_32             size;            ///< Size of this structure in bytes
+    INT_32              macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+} ADDR_GET_MACROMODEINDEX_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrGetMacroModeIndex
+*
+*   @brief
+*       Get macro mode index based on input parameters
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
+    ADDR_HANDLE                          hLib,
+    const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
+    ADDR_GET_MACROMODEINDEX_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_CONVERT_TILEINDEX1_INPUT
+*
+*   @brief
+*       Input structure for AddrConvertTileIndex1 (without macro mode index)
+****************************************************************************************************
+*/
+typedef struct _ADDR_CONVERT_TILEINDEX1_INPUT
+{
+    UINT_32         size;               ///< Size of this structure in bytes
+
+    INT_32          tileIndex;          ///< Tile index
+    UINT_32         bpp;                ///< Bits per pixel
+    UINT_32         numSamples;         ///< Number of samples
+    BOOL_32         tileInfoHw;         ///< Set to TRUE if client wants HW enum, otherwise actual
+} ADDR_CONVERT_TILEINDEX1_INPUT;
+
+/**
+****************************************************************************************************
+*   AddrConvertTileIndex1
+*
+*   @brief
+*       Convert tile index to tile mode/type/info
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1(
+    ADDR_HANDLE                             hLib,
+    const ADDR_CONVERT_TILEINDEX1_INPUT*    pIn,
+    ADDR_CONVERT_TILEINDEX_OUTPUT*          pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_GET_TILEINDEX_INPUT
+*
+*   @brief
+*       Input structure for AddrGetTileIndex
+****************************************************************************************************
+*/
+typedef struct _ADDR_GET_TILEINDEX_INPUT
+{
+    UINT_32         size;           ///< Size of this structure in bytes
+
+    AddrTileMode    tileMode;       ///< Tile mode
+    AddrTileType    tileType;       ///< Tile-type: disp/non-disp/...
+    ADDR_TILEINFO*  pTileInfo;      ///< Pointer to tile-info structure, can be NULL for linear/1D
+} ADDR_GET_TILEINDEX_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_GET_TILEINDEX_OUTPUT
+*
+*   @brief
+*       Output structure for AddrGetTileIndex
+****************************************************************************************************
+*/
+typedef struct _ADDR_GET_TILEINDEX_OUTPUT
+{
+    UINT_32         size;           ///< Size of this structure in bytes
+
+    INT_32          index;          ///< index in table
+} ADDR_GET_TILEINDEX_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrGetTileIndex
+*
+*   @brief
+*       Get the tiling mode index in table
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetTileIndex(
+    ADDR_HANDLE                     hLib,
+    const ADDR_GET_TILEINDEX_INPUT* pIn,
+    ADDR_GET_TILEINDEX_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_PRT_INFO_INPUT
+*
+*   @brief
+*       Input structure for AddrComputePrtInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_PRT_INFO_INPUT
+{
+    AddrFormat          format;        ///< Surface format
+    UINT_32             baseMipWidth;  ///< Base mipmap width
+    UINT_32             baseMipHeight; ///< Base mipmap height
+    UINT_32             baseMipDepth;  ///< Base mipmap depth
+    UINT_32             numFrags;      ///< Number of fragments,
+} ADDR_PRT_INFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_PRT_INFO_OUTPUT
+*
+*   @brief
+*       Input structure for AddrComputePrtInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_PRT_INFO_OUTPUT
+{
+    UINT_32             prtTileWidth;
+    UINT_32             prtTileHeight;
+} ADDR_PRT_INFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputePrtInfo
+*
+*   @brief
+*       Compute prt surface related information
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo(
+    ADDR_HANDLE                 hLib,
+    const ADDR_PRT_INFO_INPUT*  pIn,
+    ADDR_PRT_INFO_OUTPUT*       pOut);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                     DCC key functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   _ADDR_COMPUTE_DCCINFO_INPUT
+*
+*   @brief
+*       Input structure of AddrComputeDccInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_DCCINFO_INPUT
+{
+    UINT_32             size;            ///< Size of this structure in bytes
+    UINT_32             bpp;             ///< BitPP of color surface
+    UINT_32             numSamples;      ///< Sample number of color surface
+    UINT_64             colorSurfSize;   ///< Size of color surface to which dcc key is bound
+    AddrTileMode        tileMode;        ///< Tile mode of color surface
+    ADDR_TILEINFO       tileInfo;        ///< Tile info of color surface
+    UINT_32             tileSwizzle;     ///< Tile swizzle
+    INT_32              tileIndex;       ///< Tile index of color surface,
+                                         ///< MUST be -1 if you don't want to use it
+                                         ///< while the global useTileIndex is set to 1
+    INT_32              macroModeIndex;  ///< Index in macro tile mode table if there is one (CI)
+                                         ///< README: When tileIndex is not -1, this must be valid
+} ADDR_COMPUTE_DCCINFO_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR_COMPUTE_DCCINFO_OUTPUT
+*
+*   @brief
+*       Output structure of AddrComputeDccInfo
+****************************************************************************************************
+*/
+typedef struct _ADDR_COMPUTE_DCCINFO_OUTPUT
+{
+    UINT_32 size;                 ///< Size of this structure in bytes
+    UINT_32 dccRamBaseAlign;      ///< Base alignment of dcc key
+    UINT_64 dccRamSize;           ///< Size of dcc key
+    UINT_64 dccFastClearSize;     ///< Size of dcc key portion that can be fast cleared
+    BOOL_32 subLvlCompressible;   ///< Whether sub resource is compressiable
+    BOOL_32 dccRamSizeAligned;    ///< Whether the dcc key size is aligned
+} ADDR_COMPUTE_DCCINFO_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrComputeDccInfo
+*
+*   @brief
+*       Compute DCC key size, base alignment
+*       info
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_DCCINFO_INPUT*       pIn,
+    ADDR_COMPUTE_DCCINFO_OUTPUT*            pOut);
+
+/**
+****************************************************************************************************
+*   ADDR_GET_MAX_ALINGMENTS_OUTPUT
+*
+*   @brief
+*       Output structure of AddrGetMaxAlignments
+****************************************************************************************************
+*/
+typedef struct _ADDR_GET_MAX_ALINGMENTS_OUTPUT
+{
+    UINT_32 size;                   ///< Size of this structure in bytes
+    UINT_32 baseAlign;              ///< Maximum base alignment in bytes
+} ADDR_GET_MAX_ALINGMENTS_OUTPUT;
+
+/**
+****************************************************************************************************
+*   AddrGetMaxAlignments
+*
+*   @brief
+*       Gets maximnum alignments
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
+    ADDR_HANDLE                     hLib,
+    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut);
+
+/**
+****************************************************************************************************
+*   AddrGetMaxMetaAlignments
+*
+*   @brief
+*       Gets maximnum alignments for metadata
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMaxMetaAlignments(
+    ADDR_HANDLE                     hLib,
+    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut);
+
+/**
+****************************************************************************************************
+*                                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 noMetadata        :  1; ///< This resource has no metadata
+        UINT_32 metaRbUnaligned   :  1; ///< This resource has rb unaligned metadata
+        UINT_32 metaPipeUnaligned :  1; ///< This resource has pipe unaligned metadata
+        UINT_32 view3dAs2dArray   :  1; ///< This resource is a 3D resource viewed as 2D array
+        UINT_32 reserved          : 13; ///< 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             pixelPitch;         ///< Pitch in pixels
+    UINT_32             pixelHeight;        ///< Padded height in pixels
+    UINT_32             equationIndex;      ///< Equation index in the equation table
+    UINT_64             offset;             ///< Offset in bytes from mip base, should only be used
+                                            ///< to setup vam surface descriptor, can't be used
+                                            ///< to setup swizzle pattern
+    UINT_64             macroBlockOffset;   ///< macro block offset in bytes from mip base
+    UINT_32             mipTailOffset;      ///< mip tail offset in bytes
+    UINT_32             mipTailCoordX;      ///< mip tail coord x
+    UINT_32             mipTailCoordY;      ///< mip tail coord y
+    UINT_32             mipTailCoordZ;      ///< mip tail coord z
+} 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_64             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             mipChainInTail;       ///< If whole mipchain falls into mip tail block
+    UINT_32             firstMipIdInTail;     ///< The id of first mip in tail, if there is no mip
+                                              ///  in tail, it will be set to number of mip levels
+} 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;
+    union
+    {
+        struct
+        {
+            UINT_32    startX;
+            UINT_32    startY;
+            UINT_32    startZ;
+            UINT_32    width;
+            UINT_32    height;
+            UINT_32    depth;
+        };
+
+        struct
+        {
+            UINT_32    offset;      ///< Metadata offset within one slice,
+                                    ///  the thickness of a slice is meta block depth.
+            UINT_32    sliceSize;   ///< Metadata size within one slice,
+                                    ///  the thickness of a slice is meta block 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
+    UINT_32             firstMipIdInTail;   ///  Id of the first mip in tail,
+                                            ///  if no mip is in tail, it should be set to
+                                            ///  number of mip levels
+} 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
+    UINT_32             firstMipIdInTail;   ///< The id of first mip in tail, if no mip is in tail,
+                                            ///  it should be number of mip levels
+} 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    metaBlkNumPerSlice; ///< Number of metablock within one slice
+
+    union
+    {
+        UINT_32 fastClearSizePerSlice;  ///< Size of DCC within a slice should be fast cleared
+        UINT_32 dccRamSliceSize;        ///< DCC ram size per slice. For mipmap, it's
+                                        ///  the slize size of a mip chain, the thickness of a
+                                        ///  a slice is meta block depth
+    };
+
+    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);
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT
+*
+*   @brief
+*       Input structure for Addr2ComputeDccAddrFromCoord
+*
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_DCC_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             sample;              ///< Index of samples, means fragment index for EQAA
+    UINT_32             mipId;               ///< mipmap level id
+
+    ADDR2_META_FLAGS    dccKeyFlags;         ///< DCC flags
+    ADDR2_SURFACE_FLAGS colorFlags;          ///< Color surface flags
+    AddrResourceType    resourceType;        ///< Color surface type
+    AddrSwizzleMode     swizzleMode;         ///< Color surface swizzle mode
+    UINT_32             bpp;                 ///< Color surface bits per pixel
+    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 mipmap levels
+    UINT_32             numFrags;            ///< Color surface fragment number
+
+    UINT_32             pipeXor;             ///< pipe Xor setting
+} ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
+*
+*   @brief
+*       Output structure for Addr2ComputeDccAddrFromCoord
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
+{
+    UINT_32    size;           ///< Size of this structure in bytes
+
+    UINT_64    addr;           ///< DCC address in bytes
+} ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeDccAddrFromCoord
+*
+*   @brief
+*       Compute DCC address according to coordinates (of MSAA color buffer)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccAddrFromCoord(
+    ADDR_HANDLE                                    hLib,
+    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT*   pIn,
+    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_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
+    AddrFormat          format;             ///< Surface format
+    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_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_COMPUTE_SLICE_PIPEBANKXOR_INPUT
+*
+*   @brief
+*       Input structure of Addr2ComputeSlicePipeBankXor
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    AddrSwizzleMode     swizzleMode;        ///< Surface swizzle mode
+    AddrResourceType    resourceType;       ///< Surface resource type
+    UINT_32             basePipeBankXor;    ///< Base pipe bank xor
+    UINT_32             slice;              ///< Slice id
+    UINT_32             numSamples;         ///< Number of samples
+} ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2ComputeSlicePipeBankXor
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    UINT_32             pipeBankXor;        ///< Pipe bank xor
+} ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSlicePipeBankXor
+*
+*   @brief
+*       Calculate slice pipe bank xor value based on base pipe bank xor and slice id.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSlicePipeBankXor(
+    ADDR_HANDLE                                  hLib,
+    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
+    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
+*
+*   @brief
+*       Input structure of Addr2ComputeSubResourceOffsetForSwizzlePattern
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    AddrSwizzleMode     swizzleMode;        ///< Surface swizzle mode
+    AddrResourceType    resourceType;       ///< Surface resource type
+    UINT_32             pipeBankXor;        ///< Per resource xor
+    UINT_32             slice;              ///< Slice id
+    UINT_64             sliceSize;          ///< Slice size of a mip chain
+    UINT_64             macroBlockOffset;   ///< Macro block offset, returned in ADDR2_MIP_INFO
+    UINT_32             mipTailOffset;      ///< Mip tail offset, returned in ADDR2_MIP_INFO
+} ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT;
+
+/**
+****************************************************************************************************
+*   ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
+*
+*   @brief
+*       Output structure of Addr2ComputeSubResourceOffsetForSwizzlePattern
+****************************************************************************************************
+*/
+typedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
+{
+    UINT_32             size;               ///< Size of this structure in bytes
+    UINT_64             offset;             ///< offset
+} ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT;
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSubResourceOffsetForSwizzlePattern
+*
+*   @brief
+*       Calculate sub resource offset to support swizzle pattern.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSubResourceOffsetForSwizzlePattern(
+    ADDR_HANDLE                                                     hLib,
+    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
+    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut);
+
+/**
+****************************************************************************************************
+*   ADDR2_BLOCK_SET
+*
+*   @brief
+*       Bit field that defines 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_SWTYPE_SET
+*
+*   @brief
+*       Bit field that defines swizzle type
+****************************************************************************************************
+*/
+typedef union _ADDR2_SWTYPE_SET
+{
+    struct
+    {
+        UINT_32 sw_Z     : 1;   // SW_*_Z_*
+        UINT_32 sw_S     : 1;   // SW_*_S_*
+        UINT_32 sw_D     : 1;   // SW_*_D_*
+        UINT_32 sw_R     : 1;   // SW_*_R_*
+        UINT_32 reserved : 28;
+    };
+
+    UINT_32 value;
+} ADDR2_SWTYPE_SET;
+
+/**
+****************************************************************************************************
+*   ADDR2_SWMODE_SET
+*
+*   @brief
+*       Bit field that defines swizzle type
+****************************************************************************************************
+*/
+typedef union _ADDR2_SWMODE_SET
+{
+    struct
+    {
+        UINT_32 swLinear   : 1;
+        UINT_32 sw256B_S   : 1;
+        UINT_32 sw256B_D   : 1;
+        UINT_32 sw256B_R   : 1;
+        UINT_32 sw4KB_Z    : 1;
+        UINT_32 sw4KB_S    : 1;
+        UINT_32 sw4KB_D    : 1;
+        UINT_32 sw4KB_R    : 1;
+        UINT_32 sw64KB_Z   : 1;
+        UINT_32 sw64KB_S   : 1;
+        UINT_32 sw64KB_D   : 1;
+        UINT_32 sw64KB_R   : 1;
+        UINT_32 swVar_Z    : 1;
+        UINT_32 swVar_S    : 1;
+        UINT_32 swVar_D    : 1;
+        UINT_32 swVar_R    : 1;
+        UINT_32 sw64KB_Z_T : 1;
+        UINT_32 sw64KB_S_T : 1;
+        UINT_32 sw64KB_D_T : 1;
+        UINT_32 sw64KB_R_T : 1;
+        UINT_32 sw4KB_Z_X  : 1;
+        UINT_32 sw4KB_S_X  : 1;
+        UINT_32 sw4KB_D_X  : 1;
+        UINT_32 sw4KB_R_X  : 1;
+        UINT_32 sw64KB_Z_X : 1;
+        UINT_32 sw64KB_S_X : 1;
+        UINT_32 sw64KB_D_X : 1;
+        UINT_32 sw64KB_R_X : 1;
+        UINT_32 swVar_Z_X  : 1;
+        UINT_32 swVar_S_X  : 1;
+        UINT_32 swVar_D_X  : 1;
+        UINT_32 swVar_R_X  : 1;
+    };
+
+    UINT_32 value;
+} ADDR2_SWMODE_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
+    ADDR2_SWTYPE_SET      preferredSwSet;    ///< Client can use it to specify sw type(s) wanted
+    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
+    UINT_32               minSizeAlign;      ///< memory allocated for surface in client driver will
+                                             ///  be padded to multiple of this value (in bytes)
+} 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_SWTYPE_SET      validSwTypeSet;       ///< Valid swizzle type bit combination
+    ADDR2_SWTYPE_SET      clientPreferredSwSet; ///< Client-preferred swizzle type bit combination
+    ADDR2_SWMODE_SET      validSwModeSet;       ///< Valid swizzle mode bit combination
+} 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);
+
+/**
+****************************************************************************************************
+*   Addr2IsValidDisplaySwizzleMode
+*
+*   @brief
+*       Return whether the swizzle mode is supported by DCE / DCN.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
+    ADDR_HANDLE     hLib,
+    AddrSwizzleMode swizzleMode,
+    UINT_32         bpp,
+    bool            *result);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // __ADDR_INTERFACE_H__
diff --git a/src/amd/addrlib/inc/addrtypes.h b/src/amd/addrlib/inc/addrtypes.h
new file mode 100644 (file)
index 0000000..c939357
--- /dev/null
@@ -0,0 +1,746 @@
+/*
+ * Copyright © 2007-2018 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  addrtypes.h
+* @brief Contains the helper function and constants
+****************************************************************************************************
+*/
+#ifndef __ADDR_TYPES_H__
+#define __ADDR_TYPES_H__
+
+#if defined(__APPLE__) && !defined(HAVE_TSERVER)
+// External definitions header maintained by Apple driver team, but not for diag team under Mac.
+// Helps address compilation issues & reduces code covered by NDA
+#include "addrExtDef.h"
+
+#else
+
+// Windows and/or Linux
+#if !defined(VOID)
+typedef void           VOID;
+#endif
+
+#if !defined(FLOAT)
+typedef float          FLOAT;
+#endif
+
+#if !defined(CHAR)
+typedef char           CHAR;
+#endif
+
+#if !defined(INT)
+typedef int            INT;
+#endif
+
+#include <stdarg.h> // va_list...etc need this header
+
+#endif // defined (__APPLE__) && !defined(HAVE_TSERVER)
+
+/**
+****************************************************************************************************
+*   Calling conventions
+****************************************************************************************************
+*/
+#ifndef ADDR_CDECL
+    #if defined(__GNUC__)
+        #define ADDR_CDECL __attribute__((cdecl))
+    #else
+        #define ADDR_CDECL __cdecl
+    #endif
+#endif
+
+#ifndef ADDR_STDCALL
+    #if defined(__GNUC__)
+        #if defined(__amd64__) || defined(__x86_64__)
+            #define ADDR_STDCALL
+        #else
+            #define ADDR_STDCALL __attribute__((stdcall))
+        #endif
+    #else
+        #define ADDR_STDCALL __stdcall
+    #endif
+#endif
+
+#ifndef ADDR_FASTCALL
+    #if defined(BRAHMA_ARM)
+        #define ADDR_FASTCALL
+    #elif defined(__GNUC__)
+        #if defined(__i386__)
+            #define ADDR_FASTCALL __attribute__((regparm(0)))
+        #else
+            #define ADDR_FASTCALL
+        #endif
+    #else
+        #define ADDR_FASTCALL __fastcall
+    #endif
+#endif
+
+#ifndef GC_CDECL
+    #define GC_CDECL  ADDR_CDECL
+#endif
+
+#ifndef GC_STDCALL
+    #define GC_STDCALL  ADDR_STDCALL
+#endif
+
+#ifndef GC_FASTCALL
+    #define GC_FASTCALL  ADDR_FASTCALL
+#endif
+
+#if defined(__GNUC__)
+    #define ADDR_INLINE static inline   // inline needs to be static to link
+#else
+    // win32, win64, other platforms
+    #define ADDR_INLINE   __inline
+#endif // #if defined(__GNUC__)
+
+#define ADDR_API ADDR_FASTCALL //default call convention is fast call
+
+/**
+****************************************************************************************************
+* Global defines used by other modules
+****************************************************************************************************
+*/
+#if !defined(TILEINDEX_INVALID)
+#define TILEINDEX_INVALID                -1
+#endif
+
+#if !defined(TILEINDEX_LINEAR_GENERAL)
+#define TILEINDEX_LINEAR_GENERAL         -2
+#endif
+
+#if !defined(TILEINDEX_LINEAR_ALIGNED)
+#define TILEINDEX_LINEAR_ALIGNED          8
+#endif
+
+/**
+****************************************************************************************************
+* Return codes
+****************************************************************************************************
+*/
+typedef enum _ADDR_E_RETURNCODE
+{
+    // General Return
+    ADDR_OK    = 0,
+    ADDR_ERROR = 1,
+
+    // Specific Errors
+    ADDR_OUTOFMEMORY,
+    ADDR_INVALIDPARAMS,
+    ADDR_NOTSUPPORTED,
+    ADDR_NOTIMPLEMENTED,
+    ADDR_PARAMSIZEMISMATCH,
+    ADDR_INVALIDGBREGVALUES,
+
+} ADDR_E_RETURNCODE;
+
+/**
+****************************************************************************************************
+* @brief
+*   Neutral enums that define tile modes for all H/W
+* @note
+*   R600/R800 tiling mode can be cast to hw enums directly but never cast into HW enum from
+*   ADDR_TM_2D_TILED_XTHICK
+*
+****************************************************************************************************
+*/
+typedef enum _AddrTileMode
+{
+    ADDR_TM_LINEAR_GENERAL      = 0,    ///< Least restrictions, pitch: multiple of 8 if not buffer
+    ADDR_TM_LINEAR_ALIGNED      = 1,    ///< Requests pitch or slice to be multiple of 64 pixels
+    ADDR_TM_1D_TILED_THIN1      = 2,    ///< Linear array of 8x8 tiles
+    ADDR_TM_1D_TILED_THICK      = 3,    ///< Linear array of 8x8x4 tiles
+    ADDR_TM_2D_TILED_THIN1      = 4,    ///< A set of macro tiles consist of 8x8 tiles
+    ADDR_TM_2D_TILED_THIN2      = 5,    ///< 600 HWL only, macro tile ratio is 1:4
+    ADDR_TM_2D_TILED_THIN4      = 6,    ///< 600 HWL only, macro tile ratio is 1:16
+    ADDR_TM_2D_TILED_THICK      = 7,    ///< A set of macro tiles consist of 8x8x4 tiles
+    ADDR_TM_2B_TILED_THIN1      = 8,    ///< 600 HWL only, with bank swap
+    ADDR_TM_2B_TILED_THIN2      = 9,    ///< 600 HWL only, with bank swap and ratio is 1:4
+    ADDR_TM_2B_TILED_THIN4      = 10,   ///< 600 HWL only, with bank swap and ratio is 1:16
+    ADDR_TM_2B_TILED_THICK      = 11,   ///< 600 HWL only, with bank swap, consists of 8x8x4 tiles
+    ADDR_TM_3D_TILED_THIN1      = 12,   ///< Macro tiling w/ pipe rotation between slices
+    ADDR_TM_3D_TILED_THICK      = 13,   ///< Macro tiling w/ pipe rotation bwtween slices, thick
+    ADDR_TM_3B_TILED_THIN1      = 14,   ///< 600 HWL only, with bank swap
+    ADDR_TM_3B_TILED_THICK      = 15,   ///< 600 HWL only, with bank swap, thick
+    ADDR_TM_2D_TILED_XTHICK     = 16,   ///< Tile is 8x8x8, valid from NI
+    ADDR_TM_3D_TILED_XTHICK     = 17,   ///< Tile is 8x8x8, valid from NI
+    ADDR_TM_POWER_SAVE          = 18,   ///< Power save mode, only used by KMD on NI
+    ADDR_TM_PRT_TILED_THIN1     = 19,   ///< No bank/pipe rotation or hashing beyond macrotile size
+    ADDR_TM_PRT_2D_TILED_THIN1  = 20,   ///< Same as 2D_TILED_THIN1, PRT only
+    ADDR_TM_PRT_3D_TILED_THIN1  = 21,   ///< Same as 3D_TILED_THIN1, PRT only
+    ADDR_TM_PRT_TILED_THICK     = 22,   ///< No bank/pipe rotation or hashing beyond macrotile size
+    ADDR_TM_PRT_2D_TILED_THICK  = 23,   ///< Same as 2D_TILED_THICK, PRT only
+    ADDR_TM_PRT_3D_TILED_THICK  = 24,   ///< Same as 3D_TILED_THICK, PRT only
+    ADDR_TM_UNKNOWN             = 25,   ///< Unkown tile mode, should be decided by address lib
+    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
+*
+*   @brief
+*       Neutral enum for SurfaceFormat
+*
+****************************************************************************************************
+*/
+typedef enum _AddrFormat {
+    ADDR_FMT_INVALID                              = 0x00000000,
+    ADDR_FMT_8                                    = 0x00000001,
+    ADDR_FMT_4_4                                  = 0x00000002,
+    ADDR_FMT_3_3_2                                = 0x00000003,
+    ADDR_FMT_RESERVED_4                           = 0x00000004,
+    ADDR_FMT_16                                   = 0x00000005,
+    ADDR_FMT_16_FLOAT                             = ADDR_FMT_16,
+    ADDR_FMT_8_8                                  = 0x00000007,
+    ADDR_FMT_5_6_5                                = 0x00000008,
+    ADDR_FMT_6_5_5                                = 0x00000009,
+    ADDR_FMT_1_5_5_5                              = 0x0000000a,
+    ADDR_FMT_4_4_4_4                              = 0x0000000b,
+    ADDR_FMT_5_5_5_1                              = 0x0000000c,
+    ADDR_FMT_32                                   = 0x0000000d,
+    ADDR_FMT_32_FLOAT                             = ADDR_FMT_32,
+    ADDR_FMT_16_16                                = 0x0000000f,
+    ADDR_FMT_16_16_FLOAT                          = ADDR_FMT_16_16,
+    ADDR_FMT_8_24                                 = 0x00000011,
+    ADDR_FMT_8_24_FLOAT                           = ADDR_FMT_8_24,
+    ADDR_FMT_24_8                                 = 0x00000013,
+    ADDR_FMT_24_8_FLOAT                           = ADDR_FMT_24_8,
+    ADDR_FMT_10_11_11                             = 0x00000015,
+    ADDR_FMT_10_11_11_FLOAT                       = ADDR_FMT_10_11_11,
+    ADDR_FMT_11_11_10                             = 0x00000017,
+    ADDR_FMT_11_11_10_FLOAT                       = ADDR_FMT_11_11_10,
+    ADDR_FMT_2_10_10_10                           = 0x00000019,
+    ADDR_FMT_8_8_8_8                              = 0x0000001a,
+    ADDR_FMT_10_10_10_2                           = 0x0000001b,
+    ADDR_FMT_X24_8_32_FLOAT                       = 0x0000001c,
+    ADDR_FMT_32_32                                = 0x0000001d,
+    ADDR_FMT_32_32_FLOAT                          = ADDR_FMT_32_32,
+    ADDR_FMT_16_16_16_16                          = 0x0000001f,
+    ADDR_FMT_16_16_16_16_FLOAT                    = ADDR_FMT_16_16_16_16,
+    ADDR_FMT_RESERVED_33                          = 0x00000021,
+    ADDR_FMT_32_32_32_32                          = 0x00000022,
+    ADDR_FMT_32_32_32_32_FLOAT                    = ADDR_FMT_32_32_32_32,
+    ADDR_FMT_RESERVED_36                          = 0x00000024,
+    ADDR_FMT_1                                    = 0x00000025,
+    ADDR_FMT_1_REVERSED                           = 0x00000026,
+    ADDR_FMT_GB_GR                                = 0x00000027,
+    ADDR_FMT_BG_RG                                = 0x00000028,
+    ADDR_FMT_32_AS_8                              = 0x00000029,
+    ADDR_FMT_32_AS_8_8                            = 0x0000002a,
+    ADDR_FMT_5_9_9_9_SHAREDEXP                    = 0x0000002b,
+    ADDR_FMT_8_8_8                                = 0x0000002c,
+    ADDR_FMT_16_16_16                             = 0x0000002d,
+    ADDR_FMT_16_16_16_FLOAT                       = ADDR_FMT_16_16_16,
+    ADDR_FMT_32_32_32                             = 0x0000002f,
+    ADDR_FMT_32_32_32_FLOAT                       = ADDR_FMT_32_32_32,
+    ADDR_FMT_BC1                                  = 0x00000031,
+    ADDR_FMT_BC2                                  = 0x00000032,
+    ADDR_FMT_BC3                                  = 0x00000033,
+    ADDR_FMT_BC4                                  = 0x00000034,
+    ADDR_FMT_BC5                                  = 0x00000035,
+    ADDR_FMT_BC6                                  = 0x00000036,
+    ADDR_FMT_BC7                                  = 0x00000037,
+    ADDR_FMT_32_AS_32_32_32_32                    = 0x00000038,
+    ADDR_FMT_APC3                                 = 0x00000039,
+    ADDR_FMT_APC4                                 = 0x0000003a,
+    ADDR_FMT_APC5                                 = 0x0000003b,
+    ADDR_FMT_APC6                                 = 0x0000003c,
+    ADDR_FMT_APC7                                 = 0x0000003d,
+    ADDR_FMT_CTX1                                 = 0x0000003e,
+    ADDR_FMT_RESERVED_63                          = 0x0000003f,
+    ADDR_FMT_ASTC_4x4                             = 0x00000040,
+    ADDR_FMT_ASTC_5x4                             = 0x00000041,
+    ADDR_FMT_ASTC_5x5                             = 0x00000042,
+    ADDR_FMT_ASTC_6x5                             = 0x00000043,
+    ADDR_FMT_ASTC_6x6                             = 0x00000044,
+    ADDR_FMT_ASTC_8x5                             = 0x00000045,
+    ADDR_FMT_ASTC_8x6                             = 0x00000046,
+    ADDR_FMT_ASTC_8x8                             = 0x00000047,
+    ADDR_FMT_ASTC_10x5                            = 0x00000048,
+    ADDR_FMT_ASTC_10x6                            = 0x00000049,
+    ADDR_FMT_ASTC_10x8                            = 0x0000004a,
+    ADDR_FMT_ASTC_10x10                           = 0x0000004b,
+    ADDR_FMT_ASTC_12x10                           = 0x0000004c,
+    ADDR_FMT_ASTC_12x12                           = 0x0000004d,
+    ADDR_FMT_ETC2_64BPP                           = 0x0000004e,
+    ADDR_FMT_ETC2_128BPP                          = 0x0000004f,
+} AddrFormat;
+
+/**
+****************************************************************************************************
+*   AddrDepthFormat
+*
+*   @brief
+*       Neutral enum for addrFlt32ToDepthPixel
+*
+****************************************************************************************************
+*/
+typedef enum _AddrDepthFormat
+{
+    ADDR_DEPTH_INVALID                            = 0x00000000,
+    ADDR_DEPTH_16                                 = 0x00000001,
+    ADDR_DEPTH_X8_24                              = 0x00000002,
+    ADDR_DEPTH_8_24                               = 0x00000003,
+    ADDR_DEPTH_X8_24_FLOAT                        = 0x00000004,
+    ADDR_DEPTH_8_24_FLOAT                         = 0x00000005,
+    ADDR_DEPTH_32_FLOAT                           = 0x00000006,
+    ADDR_DEPTH_X24_8_32_FLOAT                     = 0x00000007,
+
+} AddrDepthFormat;
+
+/**
+****************************************************************************************************
+*   AddrColorFormat
+*
+*   @brief
+*       Neutral enum for ColorFormat
+*
+****************************************************************************************************
+*/
+typedef enum _AddrColorFormat
+{
+    ADDR_COLOR_INVALID                            = 0x00000000,
+    ADDR_COLOR_8                                  = 0x00000001,
+    ADDR_COLOR_4_4                                = 0x00000002,
+    ADDR_COLOR_3_3_2                              = 0x00000003,
+    ADDR_COLOR_RESERVED_4                         = 0x00000004,
+    ADDR_COLOR_16                                 = 0x00000005,
+    ADDR_COLOR_16_FLOAT                           = 0x00000006,
+    ADDR_COLOR_8_8                                = 0x00000007,
+    ADDR_COLOR_5_6_5                              = 0x00000008,
+    ADDR_COLOR_6_5_5                              = 0x00000009,
+    ADDR_COLOR_1_5_5_5                            = 0x0000000a,
+    ADDR_COLOR_4_4_4_4                            = 0x0000000b,
+    ADDR_COLOR_5_5_5_1                            = 0x0000000c,
+    ADDR_COLOR_32                                 = 0x0000000d,
+    ADDR_COLOR_32_FLOAT                           = 0x0000000e,
+    ADDR_COLOR_16_16                              = 0x0000000f,
+    ADDR_COLOR_16_16_FLOAT                        = 0x00000010,
+    ADDR_COLOR_8_24                               = 0x00000011,
+    ADDR_COLOR_8_24_FLOAT                         = 0x00000012,
+    ADDR_COLOR_24_8                               = 0x00000013,
+    ADDR_COLOR_24_8_FLOAT                         = 0x00000014,
+    ADDR_COLOR_10_11_11                           = 0x00000015,
+    ADDR_COLOR_10_11_11_FLOAT                     = 0x00000016,
+    ADDR_COLOR_11_11_10                           = 0x00000017,
+    ADDR_COLOR_11_11_10_FLOAT                     = 0x00000018,
+    ADDR_COLOR_2_10_10_10                         = 0x00000019,
+    ADDR_COLOR_8_8_8_8                            = 0x0000001a,
+    ADDR_COLOR_10_10_10_2                         = 0x0000001b,
+    ADDR_COLOR_X24_8_32_FLOAT                     = 0x0000001c,
+    ADDR_COLOR_32_32                              = 0x0000001d,
+    ADDR_COLOR_32_32_FLOAT                        = 0x0000001e,
+    ADDR_COLOR_16_16_16_16                        = 0x0000001f,
+    ADDR_COLOR_16_16_16_16_FLOAT                  = 0x00000020,
+    ADDR_COLOR_RESERVED_33                        = 0x00000021,
+    ADDR_COLOR_32_32_32_32                        = 0x00000022,
+    ADDR_COLOR_32_32_32_32_FLOAT                  = 0x00000023,
+} AddrColorFormat;
+
+/**
+****************************************************************************************************
+*   AddrSurfaceNumber
+*
+*   @brief
+*       Neutral enum for SurfaceNumber
+*
+****************************************************************************************************
+*/
+typedef enum _AddrSurfaceNumber {
+    ADDR_NUMBER_UNORM                             = 0x00000000,
+    ADDR_NUMBER_SNORM                             = 0x00000001,
+    ADDR_NUMBER_USCALED                           = 0x00000002,
+    ADDR_NUMBER_SSCALED                           = 0x00000003,
+    ADDR_NUMBER_UINT                              = 0x00000004,
+    ADDR_NUMBER_SINT                              = 0x00000005,
+    ADDR_NUMBER_SRGB                              = 0x00000006,
+    ADDR_NUMBER_FLOAT                             = 0x00000007,
+} AddrSurfaceNumber;
+
+/**
+****************************************************************************************************
+*   AddrSurfaceSwap
+*
+*   @brief
+*       Neutral enum for SurfaceSwap
+*
+****************************************************************************************************
+*/
+typedef enum _AddrSurfaceSwap {
+    ADDR_SWAP_STD                                 = 0x00000000,
+    ADDR_SWAP_ALT                                 = 0x00000001,
+    ADDR_SWAP_STD_REV                             = 0x00000002,
+    ADDR_SWAP_ALT_REV                             = 0x00000003,
+} AddrSurfaceSwap;
+
+/**
+****************************************************************************************************
+*   AddrHtileBlockSize
+*
+*   @brief
+*       Size of HTILE blocks, valid values are 4 or 8 for now
+****************************************************************************************************
+*/
+typedef enum _AddrHtileBlockSize
+{
+    ADDR_HTILE_BLOCKSIZE_4 = 4,
+    ADDR_HTILE_BLOCKSIZE_8 = 8,
+} AddrHtileBlockSize;
+
+/**
+****************************************************************************************************
+*   AddrPipeCfg
+*
+*   @brief
+*       The pipe configuration field specifies both the number of pipes and
+*       how pipes are interleaved on the surface.
+*       The expression of number of pipes, the shader engine tile size, and packer tile size
+*       is encoded in a PIPE_CONFIG register field.
+*       In general the number of pipes usually matches the number of memory channels of the
+*       hardware configuration.
+*       For hw configurations w/ non-pow2 memory number of memory channels, it usually matches
+*       the number of ROP units(? TODO: which registers??)
+*       The enum value = hw enum + 1 which is to reserve 0 for requesting default.
+****************************************************************************************************
+*/
+typedef enum _AddrPipeCfg
+{
+    ADDR_PIPECFG_INVALID         = 0,
+    ADDR_PIPECFG_P2              = 1, /// 2 pipes,
+    ADDR_PIPECFG_P4_8x16         = 5, /// 4 pipes,
+    ADDR_PIPECFG_P4_16x16        = 6,
+    ADDR_PIPECFG_P4_16x32        = 7,
+    ADDR_PIPECFG_P4_32x32        = 8,
+    ADDR_PIPECFG_P8_16x16_8x16   = 9, /// 8 pipes
+    ADDR_PIPECFG_P8_16x32_8x16   = 10,
+    ADDR_PIPECFG_P8_32x32_8x16   = 11,
+    ADDR_PIPECFG_P8_16x32_16x16  = 12,
+    ADDR_PIPECFG_P8_32x32_16x16  = 13,
+    ADDR_PIPECFG_P8_32x32_16x32  = 14,
+    ADDR_PIPECFG_P8_32x64_32x32  = 15,
+    ADDR_PIPECFG_P16_32x32_8x16  = 17, /// 16 pipes
+    ADDR_PIPECFG_P16_32x32_16x16 = 18,
+    ADDR_PIPECFG_RESERVED        = 19, /// reserved for internal use
+    ADDR_PIPECFG_MAX             = 20,
+} AddrPipeCfg;
+
+/**
+****************************************************************************************************
+* AddrTileType
+*
+*   @brief
+*       Neutral enums that specifies micro tile type (MICRO_TILE_MODE)
+****************************************************************************************************
+*/
+typedef enum _AddrTileType
+{
+    ADDR_DISPLAYABLE        = 0,    ///< Displayable tiling
+    ADDR_NON_DISPLAYABLE    = 1,    ///< Non-displayable tiling, a.k.a thin micro tiling
+    ADDR_DEPTH_SAMPLE_ORDER = 2,    ///< Same as non-displayable plus depth-sample-order
+    ADDR_ROTATED            = 3,    ///< Rotated displayable tiling
+    ADDR_THICK              = 4,    ///< Thick micro-tiling, only valid for THICK and XTHICK
+} AddrTileType;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+//  Type definitions: short system-independent names for address library types
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#if !defined(__APPLE__) || defined(HAVE_TSERVER)
+
+#ifndef BOOL_32        // no bool type in C
+/// @brief Boolean type, since none is defined in C
+/// @ingroup type
+#define BOOL_32 int
+#endif
+
+#ifndef INT_32
+#define INT_32  int
+#endif
+
+#ifndef UINT_32
+#define UINT_32 unsigned int
+#endif
+
+#ifndef INT_16
+#define INT_16  short
+#endif
+
+#ifndef UINT_16
+#define UINT_16 unsigned short
+#endif
+
+#ifndef INT_8
+#define INT_8   char
+#endif
+
+#ifndef UINT_8
+#define UINT_8  unsigned char
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+//
+//  64-bit integer types depend on the compiler
+//
+#if defined( __GNUC__ ) || defined( __WATCOMC__ )
+#define INT_64   long long
+#define UINT_64  unsigned long long
+
+#elif defined( _WIN32 )
+#define INT_64   __int64
+#define UINT_64  unsigned __int64
+
+#else
+#error Unsupported compiler and/or operating system for 64-bit integers
+
+/// @brief 64-bit signed integer type (compiler dependent)
+/// @ingroup type
+///
+/// The addrlib defines a 64-bit signed integer type for either
+/// Gnu/Watcom compilers (which use the first syntax) or for
+/// the Windows VCC compiler (which uses the second syntax).
+#define INT_64  long long OR __int64
+
+/// @brief 64-bit unsigned integer type (compiler dependent)
+/// @ingroup type
+///
+/// The addrlib defines a 64-bit unsigned integer type for either
+/// Gnu/Watcom compilers (which use the first syntax) or for
+/// the Windows VCC compiler (which uses the second syntax).
+///
+#define UINT_64  unsigned long long OR unsigned __int64
+#endif
+
+#endif // #if !defined(__APPLE__) || defined(HAVE_TSERVER)
+
+//  ADDR64X is used to print addresses in hex form on both Windows and Linux
+//
+#if defined( __GNUC__ ) || defined( __WATCOMC__ )
+#define ADDR64X "llx"
+#define ADDR64D "lld"
+
+#elif defined( _WIN32 )
+#define ADDR64X "I64x"
+#define ADDR64D "I64d"
+
+#else
+#error Unsupported compiler and/or operating system for 64-bit integers
+
+/// @brief Addrlib device address 64-bit printf tag  (compiler dependent)
+/// @ingroup type
+///
+/// This allows printf to display an ADDR_64 for either the Windows VCC compiler
+/// (which used this value) or the Gnu/Watcom compilers (which use "llx".
+/// An example of use is printf("addr 0x%"ADDR64X"\n", address);
+///
+#define ADDR64X "llx" OR "I64x"
+#define ADDR64D "lld" OR "I64d"
+#endif
+
+/// @brief Union for storing a 32-bit float or 32-bit integer
+/// @ingroup type
+///
+/// This union provides a simple way to convert between a 32-bit float
+/// and a 32-bit integer. It also prevents the compiler from producing
+/// code that alters NaN values when assiging or coying floats.
+/// Therefore, all address library routines that pass or return 32-bit
+/// floating point data do so by passing or returning a FLT_32.
+///
+typedef union {
+    INT_32   i;
+    UINT_32  u;
+    float    f;
+} ADDR_FLT_32;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+//  Macros for controlling linking and building on multiple systems
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#if defined(_MSC_VER)
+#if defined(va_copy)
+#undef va_copy  //redefine va_copy to support VC2013
+#endif
+#endif
+
+#if !defined(va_copy)
+#define va_copy(dst, src) \
+    ((void) memcpy(&(dst), &(src), sizeof(va_list)))
+#endif
+
+#endif // __ADDR_TYPES_H__
+
diff --git a/src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h b/src/amd/addrlib/inc/chip/gfx9/gfx9_gb_reg.h
deleted file mode 100644 (file)
index 49cc65a..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#if !defined (__GFX9_GB_REG_H__)
-#define __GFX9_GB_REG_H__
-
-/*
- * 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.
- */
-
-#include "util/u_endian.h"
-
-#if defined(PIPE_ARCH_LITTLE_ENDIAN)
-#define LITTLEENDIAN_CPU
-#elif defined(PIPE_ARCH_BIG_ENDIAN)
-#define BIGENDIAN_CPU
-#endif
-
-//
-// Make sure the necessary endian defines are there.
-//
-#if defined(LITTLEENDIAN_CPU)
-#elif defined(BIGENDIAN_CPU)
-#else
-#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
-#endif
-
-union GB_ADDR_CONFIG {
-    struct {
-#if        defined(LITTLEENDIAN_CPU)
-        unsigned int                       NUM_PIPES : 3;
-        unsigned int            PIPE_INTERLEAVE_SIZE : 3;
-        unsigned int            MAX_COMPRESSED_FRAGS : 2;
-        unsigned int            BANK_INTERLEAVE_SIZE : 3;
-        unsigned int                                 : 1;
-        unsigned int                       NUM_BANKS : 3;
-        unsigned int                                 : 1;
-        unsigned int         SHADER_ENGINE_TILE_SIZE : 3;
-        unsigned int              NUM_SHADER_ENGINES : 2;
-        unsigned int                        NUM_GPUS : 3;
-        unsigned int             MULTI_GPU_TILE_SIZE : 2;
-        unsigned int                   NUM_RB_PER_SE : 2;
-        unsigned int                        ROW_SIZE : 2;
-        unsigned int                 NUM_LOWER_PIPES : 1;
-        unsigned int                       SE_ENABLE : 1;
-#elif        defined(BIGENDIAN_CPU)
-        unsigned int                       SE_ENABLE : 1;
-        unsigned int                 NUM_LOWER_PIPES : 1;
-        unsigned int                        ROW_SIZE : 2;
-        unsigned int                   NUM_RB_PER_SE : 2;
-        unsigned int             MULTI_GPU_TILE_SIZE : 2;
-        unsigned int                        NUM_GPUS : 3;
-        unsigned int              NUM_SHADER_ENGINES : 2;
-        unsigned int         SHADER_ENGINE_TILE_SIZE : 3;
-        unsigned int                                 : 1;
-        unsigned int                       NUM_BANKS : 3;
-        unsigned int                                 : 1;
-        unsigned int            BANK_INTERLEAVE_SIZE : 3;
-        unsigned int            MAX_COMPRESSED_FRAGS : 2;
-        unsigned int            PIPE_INTERLEAVE_SIZE : 3;
-        unsigned int                       NUM_PIPES : 3;
-#endif
-    } bitfields, bits;
-    unsigned int    u32All;
-    signed int    i32All;
-    float    f32All;
-};
-
-#endif
-
diff --git a/src/amd/addrlib/inc/chip/r800/si_gb_reg.h b/src/amd/addrlib/inc/chip/r800/si_gb_reg.h
deleted file mode 100644 (file)
index 793edbc..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-#if !defined (__SI_GB_REG_H__)
-#define __SI_GB_REG_H__
-
-/*
- * Copyright © 2014 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.
- */
-
-#include "util/u_endian.h"
-
-#if defined(PIPE_ARCH_LITTLE_ENDIAN)
-#define LITTLEENDIAN_CPU
-#elif defined(PIPE_ARCH_BIG_ENDIAN)
-#define BIGENDIAN_CPU
-#endif
-
-//
-// Make sure the necessary endian defines are there.
-//
-#if defined(LITTLEENDIAN_CPU)
-#elif defined(BIGENDIAN_CPU)
-#else
-#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
-#endif
-
-/*
- * GB_ADDR_CONFIG struct
- */
-
-#if     defined(LITTLEENDIAN_CPU)
-
-     typedef struct _GB_ADDR_CONFIG_T {
-          unsigned int num_pipes                      : 3;
-          unsigned int                                : 1;
-          unsigned int pipe_interleave_size           : 3;
-          unsigned int                                : 1;
-          unsigned int bank_interleave_size           : 3;
-          unsigned int                                : 1;
-          unsigned int num_shader_engines             : 2;
-          unsigned int                                : 2;
-          unsigned int shader_engine_tile_size        : 3;
-          unsigned int                                : 1;
-          unsigned int num_gpus                       : 3;
-          unsigned int                                : 1;
-          unsigned int multi_gpu_tile_size            : 2;
-          unsigned int                                : 2;
-          unsigned int row_size                       : 2;
-          unsigned int num_lower_pipes                : 1;
-          unsigned int                                : 1;
-     } GB_ADDR_CONFIG_T;
-
-#elif       defined(BIGENDIAN_CPU)
-
-     typedef struct _GB_ADDR_CONFIG_T {
-          unsigned int                                : 1;
-          unsigned int num_lower_pipes                : 1;
-          unsigned int row_size                       : 2;
-          unsigned int                                : 2;
-          unsigned int multi_gpu_tile_size            : 2;
-          unsigned int                                : 1;
-          unsigned int num_gpus                       : 3;
-          unsigned int                                : 1;
-          unsigned int shader_engine_tile_size        : 3;
-          unsigned int                                : 2;
-          unsigned int num_shader_engines             : 2;
-          unsigned int                                : 1;
-          unsigned int bank_interleave_size           : 3;
-          unsigned int                                : 1;
-          unsigned int pipe_interleave_size           : 3;
-          unsigned int                                : 1;
-          unsigned int num_pipes                      : 3;
-     } GB_ADDR_CONFIG_T;
-
-#endif
-
-typedef union {
-     unsigned int val : 32;
-     GB_ADDR_CONFIG_T f;
-} GB_ADDR_CONFIG;
-
-#if       defined(LITTLEENDIAN_CPU)
-
-     typedef struct _GB_TILE_MODE_T {
-          unsigned int micro_tile_mode                : 2;
-          unsigned int array_mode                     : 4;
-          unsigned int pipe_config                    : 5;
-          unsigned int tile_split                     : 3;
-          unsigned int bank_width                     : 2;
-          unsigned int bank_height                    : 2;
-          unsigned int macro_tile_aspect              : 2;
-          unsigned int num_banks                      : 2;
-          unsigned int micro_tile_mode_new            : 3;
-          unsigned int sample_split                   : 2;
-          unsigned int                                : 5;
-     } GB_TILE_MODE_T;
-
-     typedef struct _GB_MACROTILE_MODE_T {
-          unsigned int bank_width                     : 2;
-          unsigned int bank_height                    : 2;
-          unsigned int macro_tile_aspect              : 2;
-          unsigned int num_banks                      : 2;
-          unsigned int                                : 24;
-     } GB_MACROTILE_MODE_T;
-
-#elif          defined(BIGENDIAN_CPU)
-
-     typedef struct _GB_TILE_MODE_T {
-          unsigned int                                : 5;
-          unsigned int sample_split                   : 2;
-          unsigned int micro_tile_mode_new            : 3;
-          unsigned int num_banks                      : 2;
-          unsigned int macro_tile_aspect              : 2;
-          unsigned int bank_height                    : 2;
-          unsigned int bank_width                     : 2;
-          unsigned int tile_split                     : 3;
-          unsigned int pipe_config                    : 5;
-          unsigned int array_mode                     : 4;
-          unsigned int micro_tile_mode                : 2;
-     } GB_TILE_MODE_T;
-
-     typedef struct _GB_MACROTILE_MODE_T {
-          unsigned int                                : 24;
-          unsigned int num_banks                      : 2;
-          unsigned int macro_tile_aspect              : 2;
-          unsigned int bank_height                    : 2;
-          unsigned int bank_width                     : 2;
-     } GB_MACROTILE_MODE_T;
-
-#endif
-
-typedef union {
-     unsigned int val : 32;
-     GB_TILE_MODE_T f;
-} GB_TILE_MODE;
-
-typedef union {
-     unsigned int val : 32;
-     GB_MACROTILE_MODE_T f;
-} GB_MACROTILE_MODE;
-
-#endif
-
index b9550afd2ab9b1be879ba112349bd16e57bfa0ba..edf190d12dc464cfbcb50b9ba7062979adff3b73 100644 (file)
 # SOFTWARE.
 
 files_addrlib = files(
-  'addrinterface.cpp',
-  'addrinterface.h',
-  'addrtypes.h',
-  'core/addrcommon.h',
-  'core/addrelemlib.cpp',
-  'core/addrelemlib.h',
-  'core/addrlib.cpp',
-  'core/addrlib.h',
-  'core/addrlib1.cpp',
-  'core/addrlib1.h',
-  'core/addrlib2.cpp',
-  'core/addrlib2.h',
-  'core/addrobject.cpp',
-  'core/addrobject.h',
-  'gfx9/chip/gfx9_enum.h',
-  'gfx9/coord.cpp',
-  'gfx9/coord.h',
-  'gfx9/gfx9addrlib.cpp',
-  'gfx9/gfx9addrlib.h',
-  'amdgpu_asic_addr.h',
-  'inc/chip/gfx9/gfx9_gb_reg.h',
-  'inc/chip/r800/si_gb_reg.h',
-  'r800/chip/si_ci_vi_merged_enum.h',
-  'r800/ciaddrlib.cpp',
-  'r800/ciaddrlib.h',
-  'r800/egbaddrlib.cpp',
-  'r800/egbaddrlib.h',
-  'r800/siaddrlib.cpp',
-  'r800/siaddrlib.h',
+  'inc/addrinterface.h',
+  'inc/addrtypes.h',
+  'src/addrinterface.cpp',
+  'src/core/addrcommon.h',
+  'src/core/addrelemlib.cpp',
+  'src/core/addrelemlib.h',
+  'src/core/addrlib.cpp',
+  'src/core/addrlib.h',
+  'src/core/addrlib1.cpp',
+  'src/core/addrlib1.h',
+  'src/core/addrlib2.cpp',
+  'src/core/addrlib2.h',
+  'src/core/addrobject.cpp',
+  'src/core/addrobject.h',
+  'src/core/coord.cpp',
+  'src/core/coord.h',
+  'src/gfx9/gfx9addrlib.cpp',
+  'src/gfx9/gfx9addrlib.h',
+  'src/amdgpu_asic_addr.h',
+  'src/chip/gfx9/gfx9_gb_reg.h',
+  'src/chip/r800/si_gb_reg.h',
+  'src/r800/ciaddrlib.cpp',
+  'src/r800/ciaddrlib.h',
+  'src/r800/egbaddrlib.cpp',
+  'src/r800/egbaddrlib.h',
+  'src/r800/siaddrlib.cpp',
+  'src/r800/siaddrlib.h',
 )
 
 libamdgpu_addrlib = static_library(
@@ -55,7 +53,7 @@ libamdgpu_addrlib = static_library(
   files_addrlib,
   include_directories : [
     include_directories(
-      'core', 'inc/chip/gfx9', 'inc/chip/r800', 'gfx9/chip', 'r800/chip',
+      'inc', 'src', 'src/core', 'src/chip/gfx9', 'src/chip/r800',
     ),
     inc_amd_common, inc_common, inc_src,
   ],
diff --git a/src/amd/addrlib/r800/chip/si_ci_vi_merged_enum.h b/src/amd/addrlib/r800/chip/si_ci_vi_merged_enum.h
deleted file mode 100644 (file)
index 5ed81ad..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2014 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 (SI_CI_VI_MERGED_ENUM_HEADER)
-#define SI_CI_VI_MERGED_ENUM_HEADER
-
-typedef enum PipeInterleaveSize {
-ADDR_CONFIG_PIPE_INTERLEAVE_256B         = 0x00000000,
-ADDR_CONFIG_PIPE_INTERLEAVE_512B         = 0x00000001,
-} PipeInterleaveSize;
-
-typedef enum RowSize {
-ADDR_CONFIG_1KB_ROW                      = 0x00000000,
-ADDR_CONFIG_2KB_ROW                      = 0x00000001,
-ADDR_CONFIG_4KB_ROW                      = 0x00000002,
-} RowSize;
-
-#endif
diff --git a/src/amd/addrlib/r800/ciaddrlib.cpp b/src/amd/addrlib/r800/ciaddrlib.cpp
deleted file mode 100644 (file)
index 3c5e29f..0000000
+++ /dev/null
@@ -1,2341 +0,0 @@
-/*
- * Copyright © 2014 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  ciaddrlib.cpp
-* @brief Contains the implementation for the CiLib class.
-****************************************************************************************************
-*/
-
-#include "ciaddrlib.h"
-
-#include "si_gb_reg.h"
-
-#include "amdgpu_asic_addr.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace Addr
-{
-
-/**
-****************************************************************************************************
-*   CiHwlInit
-*
-*   @brief
-*       Creates an CiLib object.
-*
-*   @return
-*       Returns an CiLib object pointer.
-****************************************************************************************************
-*/
-Lib* CiHwlInit(const Client* pClient)
-{
-    return V1::CiLib::CreateObj(pClient);
-}
-
-namespace V1
-{
-
-/**
-****************************************************************************************************
-*   Mask
-*
-*   @brief
-*       Gets a mask of "width"
-*   @return
-*       Bit mask
-****************************************************************************************************
-*/
-static UINT_64 Mask(
-    UINT_32 width)  ///< Width of bits
-{
-    UINT_64 ret;
-
-    if (width >= sizeof(UINT_64)*8)
-    {
-        ret = ~((UINT_64) 0);
-    }
-    else
-    {
-        return (((UINT_64) 1) << width) - 1;
-    }
-    return ret;
-}
-
-/**
-****************************************************************************************************
-*   GetBits
-*
-*   @brief
-*       Gets bits within a range of [msb, lsb]
-*   @return
-*       Bits of this range
-****************************************************************************************************
-*/
-static UINT_64 GetBits(
-    UINT_64 bits,   ///< Source bits
-    UINT_32 msb,    ///< Most signicant bit
-    UINT_32 lsb)    ///< Least signicant bit
-{
-    UINT_64 ret = 0;
-
-    if (msb >= lsb)
-    {
-        ret = (bits >> lsb) & (Mask(1 + msb - lsb));
-    }
-    return ret;
-}
-
-/**
-****************************************************************************************************
-*   RemoveBits
-*
-*   @brief
-*       Removes bits within the range of [msb, lsb]
-*   @return
-*       Modified bits
-****************************************************************************************************
-*/
-static UINT_64 RemoveBits(
-    UINT_64 bits,   ///< Source bits
-    UINT_32 msb,    ///< Most signicant bit
-    UINT_32 lsb)    ///< Least signicant bit
-{
-    UINT_64 ret = bits;
-
-    if (msb >= lsb)
-    {
-        ret = GetBits(bits, lsb - 1, 0) // low bits
-            | (GetBits(bits, 8 * sizeof(bits) - 1, msb + 1) << lsb); //high bits
-    }
-    return ret;
-}
-
-/**
-****************************************************************************************************
-*   InsertBits
-*
-*   @brief
-*       Inserts new bits into the range of [msb, lsb]
-*   @return
-*       Modified bits
-****************************************************************************************************
-*/
-static UINT_64 InsertBits(
-    UINT_64 bits,       ///< Source bits
-    UINT_64 newBits,    ///< New bits to be inserted
-    UINT_32 msb,        ///< Most signicant bit
-    UINT_32 lsb)        ///< Least signicant bit
-{
-    UINT_64 ret = bits;
-
-    if (msb >= lsb)
-    {
-        ret = GetBits(bits, lsb - 1, 0) // old low bitss
-             | (GetBits(newBits, msb - lsb, 0) << lsb) //new bits
-             | (GetBits(bits, 8 * sizeof(bits) - 1, lsb) << (msb + 1)); //old high bits
-    }
-    return ret;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::CiLib
-*
-*   @brief
-*       Constructor
-*
-****************************************************************************************************
-*/
-CiLib::CiLib(const Client* pClient)
-    :
-    SiLib(pClient),
-    m_noOfMacroEntries(0),
-    m_allowNonDispThickModes(FALSE)
-{
-    m_class = CI_ADDRLIB;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::~CiLib
-*
-*   @brief
-*       Destructor
-****************************************************************************************************
-*/
-CiLib::~CiLib()
-{
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeDccInfo
-*
-*   @brief
-*       Compute DCC key size, base alignment
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE CiLib::HwlComputeDccInfo(
-    const ADDR_COMPUTE_DCCINFO_INPUT*  pIn,
-    ADDR_COMPUTE_DCCINFO_OUTPUT*       pOut) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    if (m_settings.isVolcanicIslands && IsMacroTiled(pIn->tileMode))
-    {
-        UINT_64 dccFastClearSize = pIn->colorSurfSize >> 8;
-
-        ADDR_ASSERT(0 == (pIn->colorSurfSize & 0xff));
-
-        if (pIn->numSamples > 1)
-        {
-            UINT_32 tileSizePerSample = BITS_TO_BYTES(pIn->bpp * MicroTileWidth * MicroTileHeight);
-            UINT_32 samplesPerSplit  = pIn->tileInfo.tileSplitBytes / tileSizePerSample;
-
-            if (samplesPerSplit < pIn->numSamples)
-            {
-                UINT_32 numSplits = pIn->numSamples / samplesPerSplit;
-                UINT_32 fastClearBaseAlign = HwlGetPipes(&pIn->tileInfo) * m_pipeInterleaveBytes;
-
-                ADDR_ASSERT(IsPow2(fastClearBaseAlign));
-
-                dccFastClearSize /= numSplits;
-
-                if (0 != (dccFastClearSize & (fastClearBaseAlign - 1)))
-                {
-                    // Disable dcc fast clear
-                    // if key size of fisrt sample split is not pipe*interleave aligned
-                    dccFastClearSize = 0;
-                }
-            }
-        }
-
-        pOut->dccRamSize          = pIn->colorSurfSize >> 8;
-        pOut->dccRamBaseAlign     = pIn->tileInfo.banks *
-                                    HwlGetPipes(&pIn->tileInfo) *
-                                    m_pipeInterleaveBytes;
-        pOut->dccFastClearSize    = dccFastClearSize;
-        pOut->dccRamSizeAligned   = TRUE;
-
-        ADDR_ASSERT(IsPow2(pOut->dccRamBaseAlign));
-
-        if (0 == (pOut->dccRamSize & (pOut->dccRamBaseAlign - 1)))
-        {
-            pOut->subLvlCompressible = TRUE;
-        }
-        else
-        {
-            UINT_64 dccRamSizeAlign = HwlGetPipes(&pIn->tileInfo) * m_pipeInterleaveBytes;
-
-            if (pOut->dccRamSize == pOut->dccFastClearSize)
-            {
-                pOut->dccFastClearSize = PowTwoAlign(pOut->dccRamSize, dccRamSizeAlign);
-            }
-            if ((pOut->dccRamSize & (dccRamSizeAlign - 1)) != 0)
-            {
-                pOut->dccRamSizeAligned = FALSE;
-            }
-            pOut->dccRamSize          = PowTwoAlign(pOut->dccRamSize, dccRamSizeAlign);
-            pOut->subLvlCompressible  = FALSE;
-        }
-    }
-    else
-    {
-        returnCode = ADDR_NOTSUPPORTED;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeCmaskAddrFromCoord
-*
-*   @brief
-*       Compute tc compatible Cmask address from fmask ram address
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE CiLib::HwlComputeCmaskAddrFromCoord(
-    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*  pIn,  ///< [in] fmask addr/bpp/tile input
-    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*       pOut  ///< [out] cmask address
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_NOTSUPPORTED;
-
-    if ((m_settings.isVolcanicIslands == TRUE) &&
-        (pIn->flags.tcCompatible == TRUE))
-    {
-        UINT_32 numOfPipes   = HwlGetPipes(pIn->pTileInfo);
-        UINT_32 numOfBanks   = pIn->pTileInfo->banks;
-        UINT_64 fmaskAddress = pIn->fmaskAddr;
-        UINT_32 elemBits     = pIn->bpp;
-        UINT_32 blockByte    = 64 * elemBits / 8;
-        UINT_64 metaNibbleAddress = HwlComputeMetadataNibbleAddress(fmaskAddress,
-                                                                    0,
-                                                                    0,
-                                                                    4,   // cmask 4 bits
-                                                                    elemBits,
-                                                                    blockByte,
-                                                                    m_pipeInterleaveBytes,
-                                                                    numOfPipes,
-                                                                    numOfBanks,
-                                                                    1);
-        pOut->addr = (metaNibbleAddress >> 1);
-        pOut->bitPosition = (metaNibbleAddress % 2) ? 4 : 0;
-        returnCode = ADDR_OK;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeHtileAddrFromCoord
-*
-*   @brief
-*       Compute tc compatible Htile address from depth/stencil address
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE CiLib::HwlComputeHtileAddrFromCoord(
-    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,  ///< [in] depth/stencil addr/bpp/tile input
-    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*       pOut  ///< [out] htile address
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_NOTSUPPORTED;
-
-    if ((m_settings.isVolcanicIslands == TRUE) &&
-        (pIn->flags.tcCompatible == TRUE))
-    {
-        UINT_32 numOfPipes   = HwlGetPipes(pIn->pTileInfo);
-        UINT_32 numOfBanks   = pIn->pTileInfo->banks;
-        UINT_64 zStencilAddr = pIn->zStencilAddr;
-        UINT_32 elemBits     = pIn->bpp;
-        UINT_32 blockByte    = 64 * elemBits / 8;
-        UINT_64 metaNibbleAddress = HwlComputeMetadataNibbleAddress(zStencilAddr,
-                                                                    0,
-                                                                    0,
-                                                                    32,  // htile 32 bits
-                                                                    elemBits,
-                                                                    blockByte,
-                                                                    m_pipeInterleaveBytes,
-                                                                    numOfPipes,
-                                                                    numOfBanks,
-                                                                    1);
-        pOut->addr = (metaNibbleAddress >> 1);
-        pOut->bitPosition = 0;
-        returnCode = ADDR_OK;
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlConvertChipFamily
-*
-*   @brief
-*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
-*   @return
-*       ChipFamily
-****************************************************************************************************
-*/
-ChipFamily CiLib::HwlConvertChipFamily(
-    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
-    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
-{
-    ChipFamily family = ADDR_CHIP_FAMILY_CI;
-
-    switch (uChipFamily)
-    {
-        case FAMILY_CI:
-            m_settings.isSeaIsland  = 1;
-            m_settings.isBonaire    = ASICREV_IS_BONAIRE_M(uChipRevision);
-            m_settings.isHawaii     = ASICREV_IS_HAWAII_P(uChipRevision);
-            break;
-        case FAMILY_KV:
-            m_settings.isKaveri     = 1;
-            m_settings.isSpectre    = ASICREV_IS_SPECTRE(uChipRevision);
-            m_settings.isSpooky     = ASICREV_IS_SPOOKY(uChipRevision);
-            m_settings.isKalindi    = ASICREV_IS_KALINDI(uChipRevision);
-            break;
-        case FAMILY_VI:
-            m_settings.isVolcanicIslands = 1;
-            m_settings.isIceland         = ASICREV_IS_ICELAND_M(uChipRevision);
-            m_settings.isTonga           = ASICREV_IS_TONGA_P(uChipRevision);
-            m_settings.isFiji            = ASICREV_IS_FIJI_P(uChipRevision);
-            m_settings.isPolaris10       = ASICREV_IS_POLARIS10_P(uChipRevision);
-            m_settings.isPolaris11       = ASICREV_IS_POLARIS11_M(uChipRevision);
-            m_settings.isPolaris12       = ASICREV_IS_POLARIS12_V(uChipRevision);
-            m_settings.isVegaM           = ASICREV_IS_VEGAM_P(uChipRevision);
-            family = ADDR_CHIP_FAMILY_VI;
-            break;
-        case FAMILY_CZ:
-            m_settings.isCarrizo         = 1;
-            m_settings.isVolcanicIslands = 1;
-            family = ADDR_CHIP_FAMILY_VI;
-            break;
-        default:
-            ADDR_ASSERT(!"This should be a unexpected Fusion");
-            break;
-    }
-
-    return family;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlInitGlobalParams
-*
-*   @brief
-*       Initializes global parameters
-*
-*   @return
-*       TRUE if all settings are valid
-*
-****************************************************************************************************
-*/
-BOOL_32 CiLib::HwlInitGlobalParams(
-    const ADDR_CREATE_INPUT* pCreateIn) ///< [in] create input
-{
-    BOOL_32  valid = TRUE;
-
-    const ADDR_REGISTER_VALUE* pRegValue = &pCreateIn->regValue;
-
-    valid = DecodeGbRegs(pRegValue);
-
-    // The following assignments for m_pipes is only for fail-safe, InitTileSettingTable should
-    // read the correct pipes from tile mode table
-    if (m_settings.isHawaii)
-    {
-        m_pipes = 16;
-    }
-    else if (m_settings.isBonaire || m_settings.isSpectre)
-    {
-        m_pipes = 4;
-    }
-    else // Treat other KV asics to be 2-pipe
-    {
-        m_pipes = 2;
-    }
-
-    // @todo: VI
-    // Move this to VI code path once created
-    if (m_settings.isTonga || m_settings.isPolaris10)
-    {
-        m_pipes = 8;
-    }
-    else if (m_settings.isIceland)
-    {
-        m_pipes = 2;
-    }
-    else if (m_settings.isFiji)
-    {
-        m_pipes = 16;
-    }
-    else if (m_settings.isPolaris11 || m_settings.isPolaris12)
-    {
-        m_pipes = 4;
-    }
-    else if (m_settings.isVegaM)
-    {
-        m_pipes = 16;
-    }
-
-    if (valid)
-    {
-        valid = InitTileSettingTable(pRegValue->pTileConfig, pRegValue->noOfEntries);
-    }
-    if (valid)
-    {
-        valid = InitMacroTileCfgTable(pRegValue->pMacroTileConfig, pRegValue->noOfMacroEntries);
-    }
-
-    if (valid)
-    {
-        InitEquationTable();
-    }
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlPostCheckTileIndex
-*
-*   @brief
-*       Map a tile setting to index if curIndex is invalid, otherwise check if curIndex matches
-*       tile mode/type/info and change the index if needed
-*   @return
-*       Tile index.
-****************************************************************************************************
-*/
-INT_32 CiLib::HwlPostCheckTileIndex(
-    const ADDR_TILEINFO* pInfo,     ///< [in] Tile Info
-    AddrTileMode         mode,      ///< [in] Tile mode
-    AddrTileType         type,      ///< [in] Tile type
-    INT                  curIndex   ///< [in] Current index assigned in HwlSetupTileInfo
-    ) const
-{
-    INT_32 index = curIndex;
-
-    if (mode == ADDR_TM_LINEAR_GENERAL)
-    {
-        index = TileIndexLinearGeneral;
-    }
-    else
-    {
-        BOOL_32 macroTiled = IsMacroTiled(mode);
-
-        // We need to find a new index if either of them is true
-        // 1. curIndex is invalid
-        // 2. tile mode is changed
-        // 3. tile info does not match for macro tiled
-        if ((index == TileIndexInvalid)         ||
-            (mode != m_tileTable[index].mode)   ||
-            (macroTiled && pInfo->pipeConfig != m_tileTable[index].info.pipeConfig))
-        {
-            for (index = 0; index < static_cast<INT_32>(m_noOfEntries); index++)
-            {
-                if (macroTiled)
-                {
-                    // macro tile modes need all to match
-                    if ((pInfo->pipeConfig == m_tileTable[index].info.pipeConfig) &&
-                        (mode == m_tileTable[index].mode) &&
-                        (type == m_tileTable[index].type))
-                    {
-                        // tileSplitBytes stored in m_tileTable is only valid for depth entries
-                        if (type == ADDR_DEPTH_SAMPLE_ORDER)
-                        {
-                            if (Min(m_tileTable[index].info.tileSplitBytes,
-                                    m_rowSize) == pInfo->tileSplitBytes)
-                            {
-                                break;
-                            }
-                        }
-                        else // other entries are determined by other 3 fields
-                        {
-                            break;
-                        }
-                    }
-                }
-                else if (mode == ADDR_TM_LINEAR_ALIGNED)
-                {
-                    // linear mode only needs tile mode to match
-                    if (mode == m_tileTable[index].mode)
-                    {
-                        break;
-                    }
-                }
-                else
-                {
-                    // micro tile modes only need tile mode and tile type to match
-                    if (mode == m_tileTable[index].mode &&
-                        type == m_tileTable[index].type)
-                    {
-                        break;
-                    }
-                }
-            }
-        }
-    }
-
-    ADDR_ASSERT(index < static_cast<INT_32>(m_noOfEntries));
-
-    if (index >= static_cast<INT_32>(m_noOfEntries))
-    {
-        index = TileIndexInvalid;
-    }
-
-    return index;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlSetupTileCfg
-*
-*   @brief
-*       Map tile index to tile setting.
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE CiLib::HwlSetupTileCfg(
-    UINT_32         bpp,            ///< Bits per pixel
-    INT_32          index,          ///< Tile index
-    INT_32          macroModeIndex, ///< Index in macro tile mode table(CI)
-    ADDR_TILEINFO*  pInfo,          ///< [out] Tile Info
-    AddrTileMode*   pMode,          ///< [out] Tile mode
-    AddrTileType*   pType           ///< [out] Tile type
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    // Global flag to control usage of tileIndex
-    if (UseTileIndex(index))
-    {
-        if (index == TileIndexLinearGeneral)
-        {
-            pInfo->banks = 2;
-            pInfo->bankWidth = 1;
-            pInfo->bankHeight = 1;
-            pInfo->macroAspectRatio = 1;
-            pInfo->tileSplitBytes = 64;
-            pInfo->pipeConfig = ADDR_PIPECFG_P2;
-        }
-        else if (static_cast<UINT_32>(index) >= m_noOfEntries)
-        {
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-        else
-        {
-            const TileConfig* pCfgTable = GetTileSetting(index);
-
-            if (pInfo != NULL)
-            {
-                if (IsMacroTiled(pCfgTable->mode))
-                {
-                    ADDR_ASSERT((macroModeIndex != TileIndexInvalid) &&
-                                (macroModeIndex != TileIndexNoMacroIndex));
-
-                    UINT_32 tileSplit;
-
-                    *pInfo = m_macroTileTable[macroModeIndex];
-
-                    if (pCfgTable->type == ADDR_DEPTH_SAMPLE_ORDER)
-                    {
-                        tileSplit = pCfgTable->info.tileSplitBytes;
-                    }
-                    else
-                    {
-                        if (bpp > 0)
-                        {
-                            UINT_32 thickness = Thickness(pCfgTable->mode);
-                            UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
-                            // Non-depth entries store a split factor
-                            UINT_32 sampleSplit = m_tileTable[index].info.tileSplitBytes;
-                            tileSplit = Max(256u, sampleSplit * tileBytes1x);
-                        }
-                        else
-                        {
-                            // Return tileBytes instead if not enough info
-                            tileSplit = pInfo->tileSplitBytes;
-                        }
-                    }
-
-                    // Clamp to row_size
-                    pInfo->tileSplitBytes = Min(m_rowSize, tileSplit);
-
-                    pInfo->pipeConfig = pCfgTable->info.pipeConfig;
-                }
-                else // 1D and linear modes, we return default value stored in table
-                {
-                    *pInfo = pCfgTable->info;
-                }
-            }
-
-            if (pMode != NULL)
-            {
-                *pMode = pCfgTable->mode;
-            }
-
-            if (pType != NULL)
-            {
-                *pType = pCfgTable->type;
-            }
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeSurfaceInfo
-*
-*   @brief
-*       Entry of CI's ComputeSurfaceInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE CiLib::HwlComputeSurfaceInfo(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    // If tileIndex is invalid, force macroModeIndex to be invalid, too
-    if (pIn->tileIndex == TileIndexInvalid)
-    {
-        pOut->macroModeIndex = TileIndexInvalid;
-    }
-
-    ADDR_E_RETURNCODE retCode = SiLib::HwlComputeSurfaceInfo(pIn, pOut);
-
-    if ((pIn->mipLevel > 0) &&
-        (pOut->tcCompatible == TRUE) &&
-        (pOut->tileMode != pIn->tileMode) &&
-        (m_settings.isVolcanicIslands == TRUE))
-    {
-        pOut->tcCompatible = CheckTcCompatibility(pOut->pTileInfo, pIn->bpp, pOut->tileMode, pOut->tileType, pOut);
-    }
-
-    if (pOut->macroModeIndex == TileIndexNoMacroIndex)
-    {
-        pOut->macroModeIndex = TileIndexInvalid;
-    }
-
-    if ((pIn->flags.matchStencilTileCfg == TRUE) &&
-        (pIn->flags.depth == TRUE))
-    {
-        pOut->stencilTileIdx = TileIndexInvalid;
-
-        if ((MinDepth2DThinIndex <= pOut->tileIndex) &&
-            (MaxDepth2DThinIndex >= pOut->tileIndex))
-        {
-            BOOL_32 depthStencil2DTileConfigMatch = DepthStencilTileCfgMatch(pIn, pOut);
-
-            if ((depthStencil2DTileConfigMatch == FALSE) &&
-                (pOut->tcCompatible == TRUE))
-            {
-                pOut->macroModeIndex = TileIndexInvalid;
-
-                ADDR_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
-                localIn.tileIndex = TileIndexInvalid;
-                localIn.pTileInfo = NULL;
-                localIn.flags.tcCompatible = FALSE;
-
-                SiLib::HwlComputeSurfaceInfo(&localIn, pOut);
-
-                ADDR_ASSERT((MinDepth2DThinIndex <= pOut->tileIndex) && (MaxDepth2DThinIndex >= pOut->tileIndex));
-
-                depthStencil2DTileConfigMatch = DepthStencilTileCfgMatch(pIn, pOut);
-            }
-
-            if ((depthStencil2DTileConfigMatch == FALSE) &&
-                (pIn->numSamples <= 1))
-            {
-                pOut->macroModeIndex = TileIndexInvalid;
-
-                ADDR_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
-                localIn.tileMode = ADDR_TM_1D_TILED_THIN1;
-                localIn.tileIndex = TileIndexInvalid;
-                localIn.pTileInfo = NULL;
-
-                retCode = SiLib::HwlComputeSurfaceInfo(&localIn, pOut);
-            }
-        }
-
-        if (pOut->tileIndex == Depth1DThinIndex)
-        {
-            pOut->stencilTileIdx = Depth1DThinIndex;
-        }
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlFmaskSurfaceInfo
-*   @brief
-*       Entry of r800's ComputeFmaskInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE CiLib::HwlComputeFmaskInfo(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut   ///< [out] output structure
-    )
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    ADDR_TILEINFO tileInfo = {0};
-    ADDR_COMPUTE_FMASK_INFO_INPUT fmaskIn;
-    fmaskIn = *pIn;
-
-    AddrTileMode tileMode = pIn->tileMode;
-
-    // Use internal tile info if pOut does not have a valid pTileInfo
-    if (pOut->pTileInfo == NULL)
-    {
-        pOut->pTileInfo = &tileInfo;
-    }
-
-    ADDR_ASSERT(tileMode == ADDR_TM_2D_TILED_THIN1     ||
-                tileMode == ADDR_TM_3D_TILED_THIN1     ||
-                tileMode == ADDR_TM_PRT_TILED_THIN1    ||
-                tileMode == ADDR_TM_PRT_2D_TILED_THIN1 ||
-                tileMode == ADDR_TM_PRT_3D_TILED_THIN1);
-
-    ADDR_ASSERT(m_tileTable[14].mode == ADDR_TM_2D_TILED_THIN1);
-    ADDR_ASSERT(m_tileTable[15].mode == ADDR_TM_3D_TILED_THIN1);
-
-    // The only valid tile modes for fmask are 2D_THIN1 and 3D_THIN1 plus non-displayable
-    INT_32 tileIndex = tileMode == ADDR_TM_2D_TILED_THIN1 ? 14 : 15;
-    ADDR_SURFACE_FLAGS flags = {{0}};
-    flags.fmask = 1;
-
-    INT_32 macroModeIndex = TileIndexInvalid;
-
-    UINT_32 numSamples = pIn->numSamples;
-    UINT_32 numFrags = pIn->numFrags == 0 ? numSamples : pIn->numFrags;
-
-    UINT_32 bpp = QLog2(numFrags);
-
-    // EQAA needs one more bit
-    if (numSamples > numFrags)
-    {
-        bpp++;
-    }
-
-    if (bpp == 3)
-    {
-        bpp = 4;
-    }
-
-    bpp = Max(8u, bpp * numSamples);
-
-    macroModeIndex = HwlComputeMacroModeIndex(tileIndex, flags, bpp, numSamples, pOut->pTileInfo);
-
-    fmaskIn.tileIndex = tileIndex;
-    fmaskIn.pTileInfo = pOut->pTileInfo;
-    pOut->macroModeIndex = macroModeIndex;
-    pOut->tileIndex = tileIndex;
-
-    retCode = DispatchComputeFmaskInfo(&fmaskIn, pOut);
-
-    if (retCode == ADDR_OK)
-    {
-        pOut->tileIndex =
-            HwlPostCheckTileIndex(pOut->pTileInfo, pIn->tileMode, ADDR_NON_DISPLAYABLE,
-                                  pOut->tileIndex);
-    }
-
-    // Resets pTileInfo to NULL if the internal tile info is used
-    if (pOut->pTileInfo == &tileInfo)
-    {
-        pOut->pTileInfo = NULL;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlFmaskPreThunkSurfInfo
-*
-*   @brief
-*       Some preparation before thunking a ComputeSurfaceInfo call for Fmask
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-VOID CiLib::HwlFmaskPreThunkSurfInfo(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pFmaskIn,   ///< [in] Input of fmask info
-    const ADDR_COMPUTE_FMASK_INFO_OUTPUT*   pFmaskOut,  ///< [in] Output of fmask info
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*        pSurfIn,    ///< [out] Input of thunked surface info
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pSurfOut    ///< [out] Output of thunked surface info
-    ) const
-{
-    pSurfIn->tileIndex = pFmaskIn->tileIndex;
-    pSurfOut->macroModeIndex  = pFmaskOut->macroModeIndex;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlFmaskPostThunkSurfInfo
-*
-*   @brief
-*       Copy hwl extra field after calling thunked ComputeSurfaceInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-VOID CiLib::HwlFmaskPostThunkSurfInfo(
-    const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,   ///< [in] Output of surface info
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut           ///< [out] Output of fmask info
-    ) const
-{
-    pFmaskOut->tileIndex = pSurfOut->tileIndex;
-    pFmaskOut->macroModeIndex = pSurfOut->macroModeIndex;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlDegradeThickTileMode
-*
-*   @brief
-*       Degrades valid tile mode for thick modes if needed
-*
-*   @return
-*       Suitable tile mode
-****************************************************************************************************
-*/
-AddrTileMode CiLib::HwlDegradeThickTileMode(
-    AddrTileMode        baseTileMode,   ///< [in] base tile mode
-    UINT_32             numSlices,      ///< [in] current number of slices
-    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
-    ) const
-{
-    return baseTileMode;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlOptimizeTileMode
-*
-*   @brief
-*       Optimize tile mode on CI
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID CiLib::HwlOptimizeTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut      ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode = pInOut->tileMode;
-
-    // Override 2D/3D macro tile mode to PRT_* tile mode if
-    // client driver requests this surface is equation compatible
-    if (IsMacroTiled(tileMode) == TRUE)
-    {
-        if ((pInOut->flags.needEquation == TRUE) &&
-            (pInOut->numSamples <= 1) &&
-            (IsPrtTileMode(tileMode) == FALSE))
-        {
-            if ((pInOut->numSlices > 1) && ((pInOut->maxBaseAlign == 0) || (pInOut->maxBaseAlign >= Block64K)))
-            {
-                UINT_32 thickness = Thickness(tileMode);
-
-                if (thickness == 1)
-                {
-                    tileMode = ADDR_TM_PRT_TILED_THIN1;
-                }
-                else
-                {
-                    static const UINT_32 PrtTileBytes = 0x10000;
-                    // First prt thick tile index in the tile mode table
-                    static const UINT_32 PrtThickTileIndex = 22;
-                    ADDR_TILEINFO tileInfo = {0};
-
-                    HwlComputeMacroModeIndex(PrtThickTileIndex,
-                                             pInOut->flags,
-                                             pInOut->bpp,
-                                             pInOut->numSamples,
-                                             &tileInfo);
-
-                    UINT_32 macroTileBytes = ((pInOut->bpp) >> 3) * 64 * pInOut->numSamples *
-                                             thickness * HwlGetPipes(&tileInfo) *
-                                             tileInfo.banks * tileInfo.bankWidth *
-                                             tileInfo.bankHeight;
-
-                    if (macroTileBytes <= PrtTileBytes)
-                    {
-                        tileMode = ADDR_TM_PRT_TILED_THICK;
-                    }
-                    else
-                    {
-                        tileMode = ADDR_TM_PRT_TILED_THIN1;
-                    }
-                }
-            }
-        }
-
-        if (pInOut->maxBaseAlign != 0)
-        {
-            pInOut->flags.dccPipeWorkaround = FALSE;
-        }
-    }
-
-    if (tileMode != pInOut->tileMode)
-    {
-        pInOut->tileMode = tileMode;
-    }
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlOverrideTileMode
-*
-*   @brief
-*       Override THICK to THIN, for specific formats on CI
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID CiLib::HwlOverrideTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut      ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode = pInOut->tileMode;
-    AddrTileType tileType = pInOut->tileType;
-
-    // currently, all CI/VI family do not
-    // support ADDR_TM_PRT_2D_TILED_THICK,ADDR_TM_PRT_3D_TILED_THICK and
-    // ADDR_TM_PRT_2D_TILED_THIN1, ADDR_TM_PRT_3D_TILED_THIN1
-    switch (tileMode)
-    {
-        case ADDR_TM_PRT_2D_TILED_THICK:
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            tileMode = ADDR_TM_PRT_TILED_THICK;
-            break;
-        case ADDR_TM_PRT_2D_TILED_THIN1:
-        case ADDR_TM_PRT_3D_TILED_THIN1:
-            tileMode = ADDR_TM_PRT_TILED_THIN1;
-            break;
-        default:
-            break;
-    }
-
-    // UBTS#404321, we do not need such overriding, as THICK+THICK entries removed from the tile-mode table
-    if (!m_settings.isBonaire)
-    {
-        UINT_32 thickness = Thickness(tileMode);
-
-        // tile_thickness = (array_mode == XTHICK) ? 8 : ((array_mode == THICK) ? 4 : 1)
-        if (thickness > 1)
-        {
-            switch (pInOut->format)
-            {
-                // see //gfxip/gcB/devel/cds/src/verif/tc/models/csim/tcp.cpp
-                // tcpError("Thick micro tiling is not supported for format...
-                case ADDR_FMT_X24_8_32_FLOAT:
-                case ADDR_FMT_32_AS_8:
-                case ADDR_FMT_32_AS_8_8:
-                case ADDR_FMT_32_AS_32_32_32_32:
-
-                // packed formats
-                case ADDR_FMT_GB_GR:
-                case ADDR_FMT_BG_RG:
-                case ADDR_FMT_1_REVERSED:
-                case ADDR_FMT_1:
-                case ADDR_FMT_BC1:
-                case ADDR_FMT_BC2:
-                case ADDR_FMT_BC3:
-                case ADDR_FMT_BC4:
-                case ADDR_FMT_BC5:
-                case ADDR_FMT_BC6:
-                case ADDR_FMT_BC7:
-                    switch (tileMode)
-                    {
-                        case ADDR_TM_1D_TILED_THICK:
-                            tileMode = ADDR_TM_1D_TILED_THIN1;
-                            break;
-
-                        case ADDR_TM_2D_TILED_XTHICK:
-                        case ADDR_TM_2D_TILED_THICK:
-                            tileMode = ADDR_TM_2D_TILED_THIN1;
-                            break;
-
-                        case ADDR_TM_3D_TILED_XTHICK:
-                        case ADDR_TM_3D_TILED_THICK:
-                            tileMode = ADDR_TM_3D_TILED_THIN1;
-                            break;
-
-                        case ADDR_TM_PRT_TILED_THICK:
-                            tileMode = ADDR_TM_PRT_TILED_THIN1;
-                            break;
-
-                        case ADDR_TM_PRT_2D_TILED_THICK:
-                            tileMode = ADDR_TM_PRT_2D_TILED_THIN1;
-                            break;
-
-                        case ADDR_TM_PRT_3D_TILED_THICK:
-                            tileMode = ADDR_TM_PRT_3D_TILED_THIN1;
-                            break;
-
-                        default:
-                            break;
-
-                    }
-
-                    // Switch tile type from thick to thin
-                    if (tileMode != pInOut->tileMode)
-                    {
-                        // see tileIndex: 13-18
-                        tileType = ADDR_NON_DISPLAYABLE;
-                    }
-
-                    break;
-                default:
-                    break;
-            }
-        }
-    }
-
-    if (tileMode != pInOut->tileMode)
-    {
-        pInOut->tileMode = tileMode;
-        pInOut->tileType = tileType;
-    }
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlSelectTileMode
-*
-*   @brief
-*       Select tile modes.
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID CiLib::HwlSelectTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode;
-    AddrTileType tileType;
-
-    if (pInOut->flags.rotateDisplay)
-    {
-        tileMode = ADDR_TM_2D_TILED_THIN1;
-        tileType = ADDR_ROTATED;
-    }
-    else if (pInOut->flags.volume)
-    {
-        BOOL_32 bThin = (m_settings.isBonaire == TRUE) ||
-                        ((m_allowNonDispThickModes == TRUE) && (pInOut->flags.color == TRUE));
-
-        if (pInOut->numSlices >= 8)
-        {
-            tileMode = ADDR_TM_2D_TILED_XTHICK;
-            tileType = (bThin == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
-        }
-        else if (pInOut->numSlices >= 4)
-        {
-            tileMode = ADDR_TM_2D_TILED_THICK;
-            tileType = (bThin == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
-        }
-        else
-        {
-            tileMode = ADDR_TM_2D_TILED_THIN1;
-            tileType = ADDR_NON_DISPLAYABLE;
-        }
-    }
-    else
-    {
-        tileMode = ADDR_TM_2D_TILED_THIN1;
-
-        if (pInOut->flags.depth || pInOut->flags.stencil)
-        {
-            tileType = ADDR_DEPTH_SAMPLE_ORDER;
-        }
-        else if ((pInOut->bpp <= 32) ||
-                 (pInOut->flags.display == TRUE) ||
-                 (pInOut->flags.overlay == TRUE))
-        {
-            tileType = ADDR_DISPLAYABLE;
-        }
-        else
-        {
-            tileType = ADDR_NON_DISPLAYABLE;
-        }
-    }
-
-    if (pInOut->flags.prt)
-    {
-        if (Thickness(tileMode) > 1)
-        {
-            tileMode = ADDR_TM_PRT_TILED_THICK;
-            tileType = (m_settings.isBonaire == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
-        }
-        else
-        {
-            tileMode = ADDR_TM_PRT_TILED_THIN1;
-        }
-    }
-
-    pInOut->tileMode = tileMode;
-    pInOut->tileType = tileType;
-
-    if ((pInOut->flags.dccCompatible == FALSE) &&
-        (pInOut->flags.tcCompatible == FALSE))
-    {
-        pInOut->flags.opt4Space = TRUE;
-        pInOut->maxBaseAlign = Block64K;
-    }
-
-    // Optimize tile mode if possible
-    OptimizeTileMode(pInOut);
-
-    HwlOverrideTileMode(pInOut);
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlSetPrtTileMode
-*
-*   @brief
-*       Set PRT tile mode.
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID CiLib::HwlSetPrtTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode = pInOut->tileMode;
-    AddrTileType tileType = pInOut->tileType;
-
-    if (Thickness(tileMode) > 1)
-    {
-        tileMode = ADDR_TM_PRT_TILED_THICK;
-        tileType = (m_settings.isBonaire == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
-    }
-    else
-    {
-        tileMode = ADDR_TM_PRT_TILED_THIN1;
-        tileType = (tileType == ADDR_THICK) ? ADDR_NON_DISPLAYABLE : tileType;
-    }
-
-    pInOut->tileMode = tileMode;
-    pInOut->tileType = tileType;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlSetupTileInfo
-*
-*   @brief
-*       Setup default value of tile info for SI
-****************************************************************************************************
-*/
-VOID CiLib::HwlSetupTileInfo(
-    AddrTileMode                        tileMode,       ///< [in] Tile mode
-    ADDR_SURFACE_FLAGS                  flags,          ///< [in] Surface type flags
-    UINT_32                             bpp,            ///< [in] Bits per pixel
-    UINT_32                             pitch,          ///< [in] Pitch in pixels
-    UINT_32                             height,         ///< [in] Height in pixels
-    UINT_32                             numSamples,     ///< [in] Number of samples
-    ADDR_TILEINFO*                      pTileInfoIn,    ///< [in] Tile info input: NULL for default
-    ADDR_TILEINFO*                      pTileInfoOut,   ///< [out] Tile info output
-    AddrTileType                        inTileType,     ///< [in] Tile type
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*   pOut            ///< [out] Output
-    ) const
-{
-    UINT_32 thickness = Thickness(tileMode);
-    ADDR_TILEINFO* pTileInfo = pTileInfoOut;
-    INT index = TileIndexInvalid;
-    INT macroModeIndex = TileIndexInvalid;
-
-    // Fail-safe code
-    if (IsLinear(tileMode) == FALSE)
-    {
-        // Thick tile modes must use thick micro tile mode but Bonaire does not support due to
-        // old derived netlists (UBTS 404321)
-        if (thickness > 1)
-        {
-            if (m_settings.isBonaire)
-            {
-                inTileType = ADDR_NON_DISPLAYABLE;
-            }
-            else if ((m_allowNonDispThickModes == FALSE) ||
-                     (inTileType != ADDR_NON_DISPLAYABLE) ||
-                     // There is no PRT_THICK + THIN entry in tile mode table except Bonaire
-                     (IsPrtTileMode(tileMode) == TRUE))
-            {
-                inTileType = ADDR_THICK;
-            }
-        }
-        // 128 bpp tiling must be non-displayable.
-        // Fmask reuse color buffer's entry but bank-height field can be from another entry
-        // To simplify the logic, fmask entry should be picked from non-displayable ones
-        else if (bpp == 128 || flags.fmask)
-        {
-            inTileType = ADDR_NON_DISPLAYABLE;
-        }
-        // These two modes only have non-disp entries though they can be other micro tile modes
-        else if (tileMode == ADDR_TM_3D_TILED_THIN1 || tileMode == ADDR_TM_PRT_3D_TILED_THIN1)
-        {
-            inTileType = ADDR_NON_DISPLAYABLE;
-        }
-
-        if (flags.depth || flags.stencil)
-        {
-            inTileType = ADDR_DEPTH_SAMPLE_ORDER;
-        }
-    }
-
-    // tcCompatible flag is only meaningful for gfx8.
-    if (m_settings.isVolcanicIslands == FALSE)
-    {
-        flags.tcCompatible = FALSE;
-    }
-
-    if (IsTileInfoAllZero(pTileInfo))
-    {
-        // See table entries 0-4
-        if (flags.depth || flags.stencil)
-        {
-            // tileSize = thickness * bpp * numSamples * 8 * 8 / 8
-            UINT_32 tileSize = thickness * bpp * numSamples * 8;
-
-            // Turn off tc compatible if row_size is smaller than tile size (tile split occurs).
-            if (m_rowSize < tileSize)
-            {
-                flags.tcCompatible = FALSE;
-            }
-
-            if (flags.nonSplit | flags.tcCompatible | flags.needEquation)
-            {
-                // Texture readable depth surface should not be split
-                switch (tileSize)
-                {
-                    case 64:
-                        index = 0;
-                        break;
-                    case 128:
-                        index = 1;
-                        break;
-                    case 256:
-                        index = 2;
-                        break;
-                    case 512:
-                        index = 3;
-                        break;
-                    default:
-                        index = 4;
-                        break;
-                }
-            }
-            else
-            {
-                // Depth and stencil need to use the same index, thus the pre-defined tile_split
-                // can meet the requirement to choose the same macro mode index
-                // uncompressed depth/stencil are not supported for now
-                switch (numSamples)
-                {
-                    case 1:
-                        index = 0;
-                        break;
-                    case 2:
-                    case 4:
-                        index = 1;
-                        break;
-                    case 8:
-                        index = 2;
-                        break;
-                    default:
-                        break;
-                }
-            }
-        }
-
-        // See table entries 5-6
-        if (inTileType == ADDR_DEPTH_SAMPLE_ORDER)
-        {
-            switch (tileMode)
-            {
-                case ADDR_TM_1D_TILED_THIN1:
-                    index = 5;
-                    break;
-                case ADDR_TM_PRT_TILED_THIN1:
-                    index = 6;
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        // See table entries 8-12
-        if (inTileType == ADDR_DISPLAYABLE)
-        {
-            switch (tileMode)
-            {
-                case ADDR_TM_1D_TILED_THIN1:
-                    index = 9;
-                    break;
-                case ADDR_TM_2D_TILED_THIN1:
-                    index = 10;
-                    break;
-                case ADDR_TM_PRT_TILED_THIN1:
-                    index = 11;
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        // See table entries 13-18
-        if (inTileType == ADDR_NON_DISPLAYABLE)
-        {
-            switch (tileMode)
-            {
-                case ADDR_TM_1D_TILED_THIN1:
-                    index = 13;
-                    break;
-                case ADDR_TM_2D_TILED_THIN1:
-                    index = 14;
-                    break;
-                case ADDR_TM_3D_TILED_THIN1:
-                    index = 15;
-                    break;
-                case ADDR_TM_PRT_TILED_THIN1:
-                    index = 16;
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        // See table entries 19-26
-        if (thickness > 1)
-        {
-            switch (tileMode)
-            {
-                case ADDR_TM_1D_TILED_THICK:
-                    // special check for bonaire, for the compatablity between old KMD and new UMD
-                    index = ((inTileType == ADDR_THICK) || m_settings.isBonaire) ? 19 : 18;
-                    break;
-                case ADDR_TM_2D_TILED_THICK:
-                    // special check for bonaire, for the compatablity between old KMD and new UMD
-                    index = ((inTileType == ADDR_THICK) || m_settings.isBonaire) ? 20 : 24;
-                    break;
-                case ADDR_TM_3D_TILED_THICK:
-                    index = 21;
-                    break;
-                case ADDR_TM_PRT_TILED_THICK:
-                    index = 22;
-                    break;
-                case ADDR_TM_2D_TILED_XTHICK:
-                    index = 25;
-                    break;
-                case ADDR_TM_3D_TILED_XTHICK:
-                    index = 26;
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        // See table entries 27-30
-        if (inTileType == ADDR_ROTATED)
-        {
-            switch (tileMode)
-            {
-                case ADDR_TM_1D_TILED_THIN1:
-                    index = 27;
-                    break;
-                case ADDR_TM_2D_TILED_THIN1:
-                    index = 28;
-                    break;
-                case ADDR_TM_PRT_TILED_THIN1:
-                    index = 29;
-                    break;
-                case ADDR_TM_PRT_2D_TILED_THIN1:
-                    index = 30;
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        if (m_pipes >= 8)
-        {
-            ADDR_ASSERT((index + 1) < static_cast<INT_32>(m_noOfEntries));
-            // Only do this when tile mode table is updated.
-            if (((tileMode == ADDR_TM_PRT_TILED_THIN1) || (tileMode == ADDR_TM_PRT_TILED_THICK)) &&
-                (m_tileTable[index + 1].mode == tileMode))
-            {
-                static const UINT_32 PrtTileBytes = 0x10000;
-                ADDR_TILEINFO tileInfo = {0};
-
-                HwlComputeMacroModeIndex(index, flags, bpp, numSamples, &tileInfo);
-
-                UINT_32 macroTileBytes = (bpp >> 3) * 64 * numSamples * thickness *
-                                         HwlGetPipes(&tileInfo) * tileInfo.banks *
-                                         tileInfo.bankWidth * tileInfo.bankHeight;
-
-                if (macroTileBytes != PrtTileBytes)
-                {
-                    // Switching to next tile mode entry to make sure macro tile size is 64KB
-                    index += 1;
-
-                    tileInfo.pipeConfig = m_tileTable[index].info.pipeConfig;
-
-                    macroTileBytes = (bpp >> 3) * 64 * numSamples * thickness *
-                                     HwlGetPipes(&tileInfo) * tileInfo.banks *
-                                     tileInfo.bankWidth * tileInfo.bankHeight;
-
-                    ADDR_ASSERT(macroTileBytes == PrtTileBytes);
-
-                    flags.tcCompatible = FALSE;
-                    pOut->dccUnsupport = TRUE;
-                }
-            }
-        }
-    }
-    else
-    {
-        // A pre-filled tile info is ready
-        index = pOut->tileIndex;
-        macroModeIndex = pOut->macroModeIndex;
-
-        // pass tile type back for post tile index compute
-        pOut->tileType = inTileType;
-
-        if (flags.depth || flags.stencil)
-        {
-            // tileSize = thickness * bpp * numSamples * 8 * 8 / 8
-            UINT_32 tileSize = thickness * bpp * numSamples * 8;
-
-            // Turn off tc compatible if row_size is smaller than tile size (tile split occurs).
-            if (m_rowSize < tileSize)
-            {
-                flags.tcCompatible = FALSE;
-            }
-        }
-
-        UINT_32 numPipes = GetPipePerSurf(pTileInfo->pipeConfig);
-
-        if (m_pipes != numPipes)
-        {
-            pOut->dccUnsupport = TRUE;
-        }
-    }
-
-    // We only need to set up tile info if there is a valid index but macroModeIndex is invalid
-    if ((index != TileIndexInvalid) && (macroModeIndex == TileIndexInvalid))
-    {
-        macroModeIndex = HwlComputeMacroModeIndex(index, flags, bpp, numSamples, pTileInfo);
-
-        // Copy to pOut->tileType/tileIndex/macroModeIndex
-        pOut->tileIndex = index;
-        pOut->tileType = m_tileTable[index].type; // Or inTileType, the samea
-        pOut->macroModeIndex = macroModeIndex;
-    }
-    else if (tileMode == ADDR_TM_LINEAR_GENERAL)
-    {
-        pOut->tileIndex = TileIndexLinearGeneral;
-
-        // Copy linear-aligned entry??
-        *pTileInfo = m_tileTable[8].info;
-    }
-    else if (tileMode == ADDR_TM_LINEAR_ALIGNED)
-    {
-        pOut->tileIndex = 8;
-        *pTileInfo = m_tileTable[8].info;
-    }
-
-    if (flags.tcCompatible)
-    {
-        flags.tcCompatible = CheckTcCompatibility(pTileInfo, bpp, tileMode, inTileType, pOut);
-    }
-
-    pOut->tcCompatible = flags.tcCompatible;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::ReadGbTileMode
-*
-*   @brief
-*       Convert GB_TILE_MODE HW value to ADDR_TILE_CONFIG.
-****************************************************************************************************
-*/
-VOID CiLib::ReadGbTileMode(
-    UINT_32       regValue,   ///< [in] GB_TILE_MODE register
-    TileConfig*   pCfg        ///< [out] output structure
-    ) const
-{
-    GB_TILE_MODE gbTileMode;
-    gbTileMode.val = regValue;
-
-    pCfg->type = static_cast<AddrTileType>(gbTileMode.f.micro_tile_mode_new);
-    pCfg->info.pipeConfig = static_cast<AddrPipeCfg>(gbTileMode.f.pipe_config + 1);
-
-    if (pCfg->type == ADDR_DEPTH_SAMPLE_ORDER)
-    {
-        pCfg->info.tileSplitBytes = 64 << gbTileMode.f.tile_split;
-    }
-    else
-    {
-        pCfg->info.tileSplitBytes = 1 << gbTileMode.f.sample_split;
-    }
-
-    UINT_32 regArrayMode = gbTileMode.f.array_mode;
-
-    pCfg->mode = static_cast<AddrTileMode>(regArrayMode);
-
-    switch (regArrayMode)
-    {
-        case 5:
-            pCfg->mode = ADDR_TM_PRT_TILED_THIN1;
-            break;
-        case 6:
-            pCfg->mode = ADDR_TM_PRT_2D_TILED_THIN1;
-            break;
-        case 8:
-            pCfg->mode = ADDR_TM_2D_TILED_XTHICK;
-            break;
-        case 9:
-            pCfg->mode = ADDR_TM_PRT_TILED_THICK;
-            break;
-        case 0xa:
-            pCfg->mode = ADDR_TM_PRT_2D_TILED_THICK;
-            break;
-        case 0xb:
-            pCfg->mode = ADDR_TM_PRT_3D_TILED_THIN1;
-            break;
-        case 0xe:
-            pCfg->mode = ADDR_TM_3D_TILED_XTHICK;
-            break;
-        case 0xf:
-            pCfg->mode = ADDR_TM_PRT_3D_TILED_THICK;
-            break;
-        default:
-            break;
-    }
-
-    // Fail-safe code for these always convert tile info, as the non-macro modes
-    // return the entry of tile mode table directly without looking up macro mode table
-    if (!IsMacroTiled(pCfg->mode))
-    {
-        pCfg->info.banks = 2;
-        pCfg->info.bankWidth = 1;
-        pCfg->info.bankHeight = 1;
-        pCfg->info.macroAspectRatio = 1;
-        pCfg->info.tileSplitBytes = 64;
-    }
-}
-
-/**
-****************************************************************************************************
-*   CiLib::InitTileSettingTable
-*
-*   @brief
-*       Initialize the ADDR_TILE_CONFIG table.
-*   @return
-*       TRUE if tile table is correctly initialized
-****************************************************************************************************
-*/
-BOOL_32 CiLib::InitTileSettingTable(
-    const UINT_32*  pCfg,           ///< [in] Pointer to table of tile configs
-    UINT_32         noOfEntries     ///< [in] Numbe of entries in the table above
-    )
-{
-    BOOL_32 initOk = TRUE;
-
-    ADDR_ASSERT(noOfEntries <= TileTableSize);
-
-    memset(m_tileTable, 0, sizeof(m_tileTable));
-
-    if (noOfEntries != 0)
-    {
-        m_noOfEntries = noOfEntries;
-    }
-    else
-    {
-        m_noOfEntries = TileTableSize;
-    }
-
-    if (pCfg) // From Client
-    {
-        for (UINT_32 i = 0; i < m_noOfEntries; i++)
-        {
-            ReadGbTileMode(*(pCfg + i), &m_tileTable[i]);
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        initOk = FALSE;
-    }
-
-    if (initOk)
-    {
-        ADDR_ASSERT(m_tileTable[TILEINDEX_LINEAR_ALIGNED].mode == ADDR_TM_LINEAR_ALIGNED);
-
-        if (m_settings.isBonaire == FALSE)
-        {
-            // Check if entry 18 is "thick+thin" combination
-            if ((m_tileTable[18].mode == ADDR_TM_1D_TILED_THICK) &&
-                (m_tileTable[18].type == ADDR_NON_DISPLAYABLE))
-            {
-                m_allowNonDispThickModes = TRUE;
-                ADDR_ASSERT(m_tileTable[24].mode == ADDR_TM_2D_TILED_THICK);
-            }
-        }
-        else
-        {
-            m_allowNonDispThickModes = TRUE;
-        }
-
-        // Assume the first entry is always programmed with full pipes
-        m_pipes = HwlGetPipes(&m_tileTable[0].info);
-    }
-
-    return initOk;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::ReadGbMacroTileCfg
-*
-*   @brief
-*       Convert GB_MACRO_TILE_CFG HW value to ADDR_TILE_CONFIG.
-****************************************************************************************************
-*/
-VOID CiLib::ReadGbMacroTileCfg(
-    UINT_32             regValue,   ///< [in] GB_MACRO_TILE_MODE register
-    ADDR_TILEINFO*      pCfg        ///< [out] output structure
-    ) const
-{
-    GB_MACROTILE_MODE gbTileMode;
-    gbTileMode.val = regValue;
-
-    pCfg->bankHeight = 1 << gbTileMode.f.bank_height;
-    pCfg->bankWidth = 1 << gbTileMode.f.bank_width;
-    pCfg->banks = 1 << (gbTileMode.f.num_banks + 1);
-    pCfg->macroAspectRatio = 1 << gbTileMode.f.macro_tile_aspect;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::InitMacroTileCfgTable
-*
-*   @brief
-*       Initialize the ADDR_MACRO_TILE_CONFIG table.
-*   @return
-*       TRUE if macro tile table is correctly initialized
-****************************************************************************************************
-*/
-BOOL_32 CiLib::InitMacroTileCfgTable(
-    const UINT_32*  pCfg,           ///< [in] Pointer to table of tile configs
-    UINT_32         noOfMacroEntries     ///< [in] Numbe of entries in the table above
-    )
-{
-    BOOL_32 initOk = TRUE;
-
-    ADDR_ASSERT(noOfMacroEntries <= MacroTileTableSize);
-
-    memset(m_macroTileTable, 0, sizeof(m_macroTileTable));
-
-    if (noOfMacroEntries != 0)
-    {
-        m_noOfMacroEntries = noOfMacroEntries;
-    }
-    else
-    {
-        m_noOfMacroEntries = MacroTileTableSize;
-    }
-
-    if (pCfg) // From Client
-    {
-        for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
-        {
-            ReadGbMacroTileCfg(*(pCfg + i), &m_macroTileTable[i]);
-
-            m_macroTileTable[i].tileSplitBytes = 64 << (i % 8);
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        initOk = FALSE;
-    }
-    return initOk;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeMacroModeIndex
-*
-*   @brief
-*       Computes macro tile mode index
-*   @return
-*       TRUE if macro tile table is correctly initialized
-****************************************************************************************************
-*/
-INT_32 CiLib::HwlComputeMacroModeIndex(
-    INT_32              tileIndex,      ///< [in] Tile mode index
-    ADDR_SURFACE_FLAGS  flags,          ///< [in] Surface flags
-    UINT_32             bpp,            ///< [in] Bit per pixel
-    UINT_32             numSamples,     ///< [in] Number of samples
-    ADDR_TILEINFO*      pTileInfo,      ///< [out] Pointer to ADDR_TILEINFO
-    AddrTileMode*       pTileMode,      ///< [out] Pointer to AddrTileMode
-    AddrTileType*       pTileType       ///< [out] Pointer to AddrTileType
-    ) const
-{
-    INT_32 macroModeIndex = TileIndexInvalid;
-
-    AddrTileMode tileMode = m_tileTable[tileIndex].mode;
-    AddrTileType tileType = m_tileTable[tileIndex].type;
-    UINT_32 thickness = Thickness(tileMode);
-
-    if (!IsMacroTiled(tileMode))
-    {
-        *pTileInfo = m_tileTable[tileIndex].info;
-        macroModeIndex = TileIndexNoMacroIndex;
-    }
-    else
-    {
-        UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
-        UINT_32 tileSplit;
-
-        if (m_tileTable[tileIndex].type == ADDR_DEPTH_SAMPLE_ORDER)
-        {
-            // Depth entries store real tileSplitBytes
-            tileSplit = m_tileTable[tileIndex].info.tileSplitBytes;
-        }
-        else
-        {
-            // Non-depth entries store a split factor
-            UINT_32 sampleSplit = m_tileTable[tileIndex].info.tileSplitBytes;
-            UINT_32 colorTileSplit = Max(256u, sampleSplit * tileBytes1x);
-
-            tileSplit = colorTileSplit;
-        }
-
-        UINT_32 tileSplitC = Min(m_rowSize, tileSplit);
-        UINT_32 tileBytes;
-
-        if (flags.fmask)
-        {
-            tileBytes = Min(tileSplitC, tileBytes1x);
-        }
-        else
-        {
-            tileBytes = Min(tileSplitC, numSamples * tileBytes1x);
-        }
-
-        if (tileBytes < 64)
-        {
-            tileBytes = 64;
-        }
-
-        macroModeIndex = Log2(tileBytes / 64);
-
-        if (flags.prt || IsPrtTileMode(tileMode))
-        {
-            macroModeIndex += PrtMacroModeOffset;
-            *pTileInfo = m_macroTileTable[macroModeIndex];
-        }
-        else
-        {
-            *pTileInfo = m_macroTileTable[macroModeIndex];
-        }
-
-        pTileInfo->pipeConfig = m_tileTable[tileIndex].info.pipeConfig;
-
-        pTileInfo->tileSplitBytes = tileSplitC;
-    }
-
-    if (NULL != pTileMode)
-    {
-        *pTileMode = tileMode;
-    }
-
-    if (NULL != pTileType)
-    {
-        *pTileType = tileType;
-    }
-
-    return macroModeIndex;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeTileDataWidthAndHeightLinear
-*
-*   @brief
-*       Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
-*
-*   @note
-*       MacroWidth and macroHeight are measured in pixels
-****************************************************************************************************
-*/
-VOID CiLib::HwlComputeTileDataWidthAndHeightLinear(
-    UINT_32*        pMacroWidth,     ///< [out] macro tile width
-    UINT_32*        pMacroHeight,    ///< [out] macro tile height
-    UINT_32         bpp,             ///< [in] bits per pixel
-    ADDR_TILEINFO*  pTileInfo        ///< [in] tile info
-    ) const
-{
-    ADDR_ASSERT(pTileInfo != NULL);
-
-    UINT_32 numTiles;
-
-    switch (pTileInfo->pipeConfig)
-    {
-        case ADDR_PIPECFG_P16_32x32_8x16:
-        case ADDR_PIPECFG_P16_32x32_16x16:
-        case ADDR_PIPECFG_P8_32x64_32x32:
-        case ADDR_PIPECFG_P8_32x32_16x32:
-        case ADDR_PIPECFG_P8_32x32_16x16:
-        case ADDR_PIPECFG_P8_32x32_8x16:
-        case ADDR_PIPECFG_P4_32x32:
-            numTiles = 8;
-            break;
-        default:
-            numTiles = 4;
-            break;
-    }
-
-    *pMacroWidth    = numTiles * MicroTileWidth;
-    *pMacroHeight   = numTiles * MicroTileHeight;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeMetadataNibbleAddress
-*
-*   @brief
-*        calculate meta data address based on input information
-*
-*   &parameter
-*        uncompressedDataByteAddress - address of a pixel in color surface
-*        dataBaseByteAddress         - base address of color surface
-*        metadataBaseByteAddress     - base address of meta ram
-*        metadataBitSize             - meta key size, 8 for DCC, 4 for cmask
-*        elementBitSize              - element size of color surface
-*        blockByteSize               - compression block size, 256 for DCC
-*        pipeInterleaveBytes         - pipe interleave size
-*        numOfPipes                  - number of pipes
-*        numOfBanks                  - number of banks
-*        numOfSamplesPerSplit        - number of samples per tile split
-*   @return
-*        meta data nibble address (nibble address is used to support DCC compatible cmask)
-*
-****************************************************************************************************
-*/
-UINT_64 CiLib::HwlComputeMetadataNibbleAddress(
-    UINT_64 uncompressedDataByteAddress,
-    UINT_64 dataBaseByteAddress,
-    UINT_64 metadataBaseByteAddress,
-    UINT_32 metadataBitSize,
-    UINT_32 elementBitSize,
-    UINT_32 blockByteSize,
-    UINT_32 pipeInterleaveBytes,
-    UINT_32 numOfPipes,
-    UINT_32 numOfBanks,
-    UINT_32 numOfSamplesPerSplit) const
-{
-    ///--------------------------------------------------------------------------------------------
-    /// Get pipe interleave, bank and pipe bits
-    ///--------------------------------------------------------------------------------------------
-    UINT_32 pipeInterleaveBits  = Log2(pipeInterleaveBytes);
-    UINT_32 pipeBits            = Log2(numOfPipes);
-    UINT_32 bankBits            = Log2(numOfBanks);
-
-    ///--------------------------------------------------------------------------------------------
-    /// Clear pipe and bank swizzles
-    ///--------------------------------------------------------------------------------------------
-    UINT_32 dataMacrotileBits        = pipeInterleaveBits + pipeBits + bankBits;
-    UINT_32 metadataMacrotileBits    = pipeInterleaveBits + pipeBits + bankBits;
-
-    UINT_64 dataMacrotileClearMask     = ~((1L << dataMacrotileBits) - 1);
-    UINT_64 metadataMacrotileClearMask = ~((1L << metadataMacrotileBits) - 1);
-
-    UINT_64 dataBaseByteAddressNoSwizzle = dataBaseByteAddress & dataMacrotileClearMask;
-    UINT_64 metadataBaseByteAddressNoSwizzle = metadataBaseByteAddress & metadataMacrotileClearMask;
-
-    ///--------------------------------------------------------------------------------------------
-    /// Modify metadata base before adding in so that when final address is divided by data ratio,
-    /// the base address returns to where it should be
-    ///--------------------------------------------------------------------------------------------
-    ADDR_ASSERT((0 != metadataBitSize));
-    UINT_64 metadataBaseShifted = metadataBaseByteAddressNoSwizzle * blockByteSize * 8 /
-                                  metadataBitSize;
-    UINT_64 offset = uncompressedDataByteAddress -
-                     dataBaseByteAddressNoSwizzle +
-                     metadataBaseShifted;
-
-    ///--------------------------------------------------------------------------------------------
-    /// Save bank data bits
-    ///--------------------------------------------------------------------------------------------
-    UINT_32 lsb = pipeBits + pipeInterleaveBits;
-    UINT_32 msb = bankBits - 1 + lsb;
-
-    UINT_64 bankDataBits = GetBits(offset, msb, lsb);
-
-    ///--------------------------------------------------------------------------------------------
-    /// Save pipe data bits
-    ///--------------------------------------------------------------------------------------------
-    lsb = pipeInterleaveBits;
-    msb = pipeBits - 1 + lsb;
-
-    UINT_64 pipeDataBits = GetBits(offset, msb, lsb);
-
-    ///--------------------------------------------------------------------------------------------
-    /// Remove pipe and bank bits
-    ///--------------------------------------------------------------------------------------------
-    lsb = pipeInterleaveBits;
-    msb = dataMacrotileBits - 1;
-
-    UINT_64 offsetWithoutPipeBankBits = RemoveBits(offset, msb, lsb);
-
-    ADDR_ASSERT((0 != blockByteSize));
-    UINT_64 blockInBankpipe = offsetWithoutPipeBankBits / blockByteSize;
-
-    UINT_32 tileSize = 8 * 8 * elementBitSize/8 * numOfSamplesPerSplit;
-    UINT_32 blocksInTile = tileSize / blockByteSize;
-
-    if (0 == blocksInTile)
-    {
-        lsb = 0;
-    }
-    else
-    {
-        lsb = Log2(blocksInTile);
-    }
-    msb = bankBits - 1 + lsb;
-
-    UINT_64 blockInBankpipeWithBankBits = InsertBits(blockInBankpipe, bankDataBits, msb, lsb);
-
-    /// NOTE *2 because we are converting to Nibble address in this step
-    UINT_64 metaAddressInPipe = blockInBankpipeWithBankBits * 2 * metadataBitSize / 8;
-
-
-    ///--------------------------------------------------------------------------------------------
-    /// Reinsert pipe bits back into the final address
-    ///--------------------------------------------------------------------------------------------
-    lsb = pipeInterleaveBits + 1; ///<+1 due to Nibble address now gives interleave bits extra lsb.
-    msb = pipeBits - 1 + lsb;
-    UINT_64 metadataAddress = InsertBits(metaAddressInPipe, pipeDataBits, msb, lsb);
-
-    return metadataAddress;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeSurfaceAlignmentsMacroTiled
-*
-*   @brief
-*       Hardware layer function to compute alignment request for macro tile mode
-*
-****************************************************************************************************
-*/
-VOID CiLib::HwlComputeSurfaceAlignmentsMacroTiled(
-    AddrTileMode                      tileMode,           ///< [in] tile mode
-    UINT_32                           bpp,                ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
-    UINT_32                           mipLevel,           ///< [in] mip level
-    UINT_32                           numSamples,         ///< [in] number of samples
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
-    ) const
-{
-    // This is to workaround a H/W limitation that DCC doesn't work when pipe config is switched to
-    // P4. In theory, all asics that have such switching should be patched but we now only know what
-    // to pad for Fiji.
-    if ((m_settings.isFiji == TRUE) &&
-        (flags.dccPipeWorkaround == TRUE) &&
-        (flags.prt == FALSE) &&
-        (mipLevel == 0) &&
-        (tileMode == ADDR_TM_PRT_TILED_THIN1) &&
-        (pOut->dccUnsupport == TRUE))
-    {
-        pOut->pitchAlign   = PowTwoAlign(pOut->pitchAlign, 256);
-        // In case the client still requests DCC usage.
-        pOut->dccUnsupport = FALSE;
-    }
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlPadDimensions
-*
-*   @brief
-*       Helper function to pad dimensions
-*
-****************************************************************************************************
-*/
-VOID CiLib::HwlPadDimensions(
-    AddrTileMode        tileMode,    ///< [in] tile mode
-    UINT_32             bpp,         ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,       ///< [in] surface flags
-    UINT_32             numSamples,  ///< [in] number of samples
-    ADDR_TILEINFO*      pTileInfo,   ///< [in] tile info
-    UINT_32             mipLevel,    ///< [in] mip level
-    UINT_32*            pPitch,      ///< [in,out] pitch in pixels
-    UINT_32*            pPitchAlign, ///< [in,out] pitch alignment
-    UINT_32             height,      ///< [in] height in pixels
-    UINT_32             heightAlign  ///< [in] height alignment
-    ) const
-{
-    if ((m_settings.isVolcanicIslands == TRUE) &&
-        (flags.dccCompatible == TRUE) &&
-        (numSamples > 1) &&
-        (mipLevel == 0) &&
-        (IsMacroTiled(tileMode) == TRUE))
-    {
-        UINT_32 tileSizePerSample = BITS_TO_BYTES(bpp * MicroTileWidth * MicroTileHeight);
-        UINT_32 samplesPerSplit  = pTileInfo->tileSplitBytes / tileSizePerSample;
-
-        if (samplesPerSplit < numSamples)
-        {
-            UINT_32 dccFastClearByteAlign = HwlGetPipes(pTileInfo) * m_pipeInterleaveBytes * 256;
-            UINT_32 bytesPerSplit = BITS_TO_BYTES((*pPitch) * height * bpp * samplesPerSplit);
-
-            ADDR_ASSERT(IsPow2(dccFastClearByteAlign));
-
-            if (0 != (bytesPerSplit & (dccFastClearByteAlign - 1)))
-            {
-                UINT_32 dccFastClearPixelAlign = dccFastClearByteAlign /
-                                                BITS_TO_BYTES(bpp) /
-                                                samplesPerSplit;
-                UINT_32 macroTilePixelAlign = (*pPitchAlign) * heightAlign;
-
-                if ((dccFastClearPixelAlign >= macroTilePixelAlign) &&
-                    ((dccFastClearPixelAlign % macroTilePixelAlign) == 0))
-                {
-                    UINT_32 dccFastClearPitchAlignInMacroTile =
-                        dccFastClearPixelAlign / macroTilePixelAlign;
-                    UINT_32 heightInMacroTile = height / heightAlign;
-
-                    while ((heightInMacroTile > 1) &&
-                           ((heightInMacroTile % 2) == 0) &&
-                           (dccFastClearPitchAlignInMacroTile > 1) &&
-                           ((dccFastClearPitchAlignInMacroTile % 2) == 0))
-                    {
-                        heightInMacroTile >>= 1;
-                        dccFastClearPitchAlignInMacroTile >>= 1;
-                    }
-
-                    UINT_32 dccFastClearPitchAlignInPixels =
-                        (*pPitchAlign) * dccFastClearPitchAlignInMacroTile;
-
-                    if (IsPow2(dccFastClearPitchAlignInPixels))
-                    {
-                        *pPitch = PowTwoAlign((*pPitch), dccFastClearPitchAlignInPixels);
-                    }
-                    else
-                    {
-                        *pPitch += (dccFastClearPitchAlignInPixels - 1);
-                        *pPitch /= dccFastClearPitchAlignInPixels;
-                        *pPitch *= dccFastClearPitchAlignInPixels;
-                    }
-
-                    *pPitchAlign = dccFastClearPitchAlignInPixels;
-                }
-            }
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeMaxBaseAlignments
-*
-*   @brief
-*       Gets maximum alignments
-*   @return
-*       maximum alignments
-****************************************************************************************************
-*/
-UINT_32 CiLib::HwlComputeMaxBaseAlignments() const
-{
-    const UINT_32 pipes = HwlGetPipes(&m_tileTable[0].info);
-
-    // Initial size is 64 KiB for PRT.
-    UINT_32 maxBaseAlign = 64 * 1024;
-
-    for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
-    {
-        // The maximum tile size is 16 byte-per-pixel and either 8-sample or 8-slice.
-        UINT_32 tileSize = m_macroTileTable[i].tileSplitBytes;
-
-        UINT_32 baseAlign = tileSize * pipes * m_macroTileTable[i].banks *
-                            m_macroTileTable[i].bankWidth * m_macroTileTable[i].bankHeight;
-
-        if (baseAlign > maxBaseAlign)
-        {
-            maxBaseAlign = baseAlign;
-        }
-    }
-
-    return maxBaseAlign;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::HwlComputeMaxMetaBaseAlignments
-*
-*   @brief
-*       Gets maximum alignments for metadata
-*   @return
-*       maximum alignments for metadata
-****************************************************************************************************
-*/
-UINT_32 CiLib::HwlComputeMaxMetaBaseAlignments() const
-{
-    UINT_32 maxBank = 1;
-
-    for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
-    {
-        if ((m_settings.isVolcanicIslands) && IsMacroTiled(m_tileTable[i].mode))
-        {
-            maxBank = Max(maxBank, m_macroTileTable[i].banks);
-        }
-    }
-
-    return SiLib::HwlComputeMaxMetaBaseAlignments() * maxBank;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::DepthStencilTileCfgMatch
-*
-*   @brief
-*       Try to find a tile index for stencil which makes its tile config parameters matches to depth
-*   @return
-*       TRUE if such tile index for stencil can be found
-****************************************************************************************************
-*/
-BOOL_32 CiLib::DepthStencilTileCfgMatch(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    BOOL_32 depthStencil2DTileConfigMatch = FALSE;
-
-    for (INT_32 stencilTileIndex = MinDepth2DThinIndex;
-         stencilTileIndex <= MaxDepth2DThinIndex;
-         stencilTileIndex++)
-    {
-        ADDR_TILEINFO tileInfo = {0};
-        INT_32 stencilMacroIndex = HwlComputeMacroModeIndex(stencilTileIndex,
-                                                            pIn->flags,
-                                                            8,
-                                                            pIn->numSamples,
-                                                            &tileInfo);
-
-        if (stencilMacroIndex != TileIndexNoMacroIndex)
-        {
-            if ((m_macroTileTable[stencilMacroIndex].banks ==
-                 m_macroTileTable[pOut->macroModeIndex].banks) &&
-                (m_macroTileTable[stencilMacroIndex].bankWidth ==
-                 m_macroTileTable[pOut->macroModeIndex].bankWidth) &&
-                (m_macroTileTable[stencilMacroIndex].bankHeight ==
-                 m_macroTileTable[pOut->macroModeIndex].bankHeight) &&
-                (m_macroTileTable[stencilMacroIndex].macroAspectRatio ==
-                 m_macroTileTable[pOut->macroModeIndex].macroAspectRatio) &&
-                (m_macroTileTable[stencilMacroIndex].pipeConfig ==
-                 m_macroTileTable[pOut->macroModeIndex].pipeConfig))
-            {
-                if ((pOut->tcCompatible == FALSE) ||
-                    (tileInfo.tileSplitBytes >= MicroTileWidth * MicroTileHeight * pIn->numSamples))
-                {
-                    depthStencil2DTileConfigMatch = TRUE;
-                    pOut->stencilTileIdx = stencilTileIndex;
-                    break;
-                }
-            }
-        }
-        else
-        {
-            ADDR_ASSERT_ALWAYS();
-        }
-    }
-
-    return depthStencil2DTileConfigMatch;
-}
-
-/**
-****************************************************************************************************
-*   CiLib::DepthStencilTileCfgMatch
-*
-*   @brief
-*       Check if tc compatibility is available
-*   @return
-*       If tc compatibility is not available
-****************************************************************************************************
-*/
-BOOL_32 CiLib::CheckTcCompatibility(
-    const ADDR_TILEINFO*                    pTileInfo,    ///< [in] input tile info
-    UINT_32                                 bpp,          ///< [in] Bits per pixel
-    AddrTileMode                            tileMode,     ///< [in] input tile mode
-    AddrTileType                            tileType,     ///< [in] input tile type
-    const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut          ///< [in] output surf info
-    ) const
-{
-    BOOL_32 tcCompatible = TRUE;
-
-    if (IsMacroTiled(tileMode))
-    {
-        if (tileType != ADDR_DEPTH_SAMPLE_ORDER)
-        {
-            // Turn off tcCompatible for color surface if tileSplit happens. Depth/stencil
-            // tileSplit case was handled at tileIndex selecting time.
-            INT_32 tileIndex = pOut->tileIndex;
-
-            if ((tileIndex == TileIndexInvalid) && (IsTileInfoAllZero(pTileInfo) == FALSE))
-            {
-                tileIndex = HwlPostCheckTileIndex(pTileInfo, tileMode, tileType, tileIndex);
-            }
-
-            if (tileIndex != TileIndexInvalid)
-            {
-                UINT_32 thickness = Thickness(tileMode);
-
-                ADDR_ASSERT(static_cast<UINT_32>(tileIndex) < TileTableSize);
-                // Non-depth entries store a split factor
-                UINT_32 sampleSplit = m_tileTable[tileIndex].info.tileSplitBytes;
-                UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
-                UINT_32 colorTileSplit = Max(256u, sampleSplit * tileBytes1x);
-
-                if (m_rowSize < colorTileSplit)
-                {
-                    tcCompatible = FALSE;
-                }
-            }
-        }
-    }
-    else
-    {
-        // Client should not enable tc compatible for linear and 1D tile modes.
-        tcCompatible = FALSE;
-    }
-
-    return tcCompatible;
-}
-
-} // V1
-} // Addr
diff --git a/src/amd/addrlib/r800/ciaddrlib.h b/src/amd/addrlib/r800/ciaddrlib.h
deleted file mode 100644 (file)
index 28c19f0..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright © 2014 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  ciaddrlib.h
-* @brief Contains the CiLib class definition.
-****************************************************************************************************
-*/
-
-#ifndef __CI_ADDR_LIB_H__
-#define __CI_ADDR_LIB_H__
-
-#include "addrlib1.h"
-#include "siaddrlib.h"
-
-namespace Addr
-{
-namespace V1
-{
-
-/**
-****************************************************************************************************
-* @brief This class is the CI specific address library
-*        function set.
-****************************************************************************************************
-*/
-class CiLib : public SiLib
-{
-public:
-    /// Creates CiLib object
-    static Addr::Lib* CreateObj(const Client* pClient)
-    {
-        VOID* pMem = Object::ClientAlloc(sizeof(CiLib), pClient);
-        return (pMem != NULL) ? new (pMem) CiLib(pClient) : NULL;
-    }
-
-private:
-    CiLib(const Client* pClient);
-    virtual ~CiLib();
-
-protected:
-
-    // Hwl interface - defined in AddrLib1
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
-
-    virtual ChipFamily HwlConvertChipFamily(
-        UINT_32 uChipFamily, UINT_32 uChipRevision);
-
-    virtual BOOL_32 HwlInitGlobalParams(
-        const ADDR_CREATE_INPUT* pCreateIn);
-
-    virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
-        UINT_32 bpp, INT_32 index, INT_32 macroModeIndex, ADDR_TILEINFO* pInfo,
-        AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
-
-    virtual VOID HwlComputeTileDataWidthAndHeightLinear(
-        UINT_32* pMacroWidth, UINT_32* pMacroHeight,
-        UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
-
-    virtual INT_32 HwlComputeMacroModeIndex(
-        INT_32 tileIndex, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
-        ADDR_TILEINFO* pTileInfo, AddrTileMode* pTileMode = NULL, AddrTileType* pTileType = NULL
-        ) const;
-
-    // Sub-hwl interface - defined in EgBasedLib
-    virtual VOID HwlSetupTileInfo(
-        AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
-        AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    virtual INT_32 HwlPostCheckTileIndex(
-        const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
-        INT curIndex = TileIndexInvalid) const;
-
-    virtual VOID HwlFmaskPreThunkSurfInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
-        const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
-
-    virtual VOID HwlFmaskPostThunkSurfInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
-
-    virtual AddrTileMode HwlDegradeThickTileMode(
-        AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
-
-    virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    /// Overwrite tile setting to PRT
-    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
-        const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
-        ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
-        const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
-        const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
-        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*       pOut) const;
-
-    virtual UINT_32 HwlComputeMaxBaseAlignments() const;
-
-    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
-
-    virtual VOID HwlPadDimensions(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
-        UINT_32* pPitch, UINT_32 *PitchAlign, UINT_32 height, UINT_32 heightAlign) const;
-
-    virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-private:
-    VOID ReadGbTileMode(
-        UINT_32 regValue, TileConfig* pCfg) const;
-
-    VOID ReadGbMacroTileCfg(
-        UINT_32 regValue, ADDR_TILEINFO* pCfg) const;
-
-    BOOL_32 InitTileSettingTable(
-        const UINT_32 *pSetting, UINT_32 noOfEntries);
-
-    BOOL_32 InitMacroTileCfgTable(
-        const UINT_32 *pSetting, UINT_32 noOfEntries);
-
-    UINT_64 HwlComputeMetadataNibbleAddress(
-        UINT_64 uncompressedDataByteAddress,
-        UINT_64 dataBaseByteAddress,
-        UINT_64 metadataBaseByteAddress,
-        UINT_32 metadataBitSize,
-        UINT_32 elementBitSize,
-        UINT_32 blockByteSize,
-        UINT_32 pipeInterleaveBytes,
-        UINT_32 numOfPipes,
-        UINT_32 numOfBanks,
-        UINT_32 numOfSamplesPerSplit) const;
-
-    BOOL_32 DepthStencilTileCfgMatch(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut) const;
-
-    BOOL_32 CheckTcCompatibility(const ADDR_TILEINFO* pTileInfo, UINT_32 bpp, AddrTileMode tileMode,
-                                 AddrTileType tileType, const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    static const UINT_32    MacroTileTableSize = 16;
-    static const UINT_32    PrtMacroModeOffset = MacroTileTableSize / 2;
-    static const INT_32     MinDepth2DThinIndex = 0;
-    static const INT_32     MaxDepth2DThinIndex = 4;
-    static const INT_32     Depth1DThinIndex = 5;
-
-    ADDR_TILEINFO           m_macroTileTable[MacroTileTableSize];
-    UINT_32                 m_noOfMacroEntries;
-    BOOL_32                 m_allowNonDispThickModes;
-};
-
-} // V1
-} // Addr
-
-#endif
-
-
diff --git a/src/amd/addrlib/r800/egbaddrlib.cpp b/src/amd/addrlib/r800/egbaddrlib.cpp
deleted file mode 100644 (file)
index ed11618..0000000
+++ /dev/null
@@ -1,4168 +0,0 @@
-/*
- * Copyright © 2014 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  egbaddrlib.cpp
-* @brief Contains the EgBasedLib class implementation.
-****************************************************************************************************
-*/
-
-#include "egbaddrlib.h"
-
-#include "util/macros.h"
-
-namespace Addr
-{
-namespace V1
-{
-
-/**
-****************************************************************************************************
-*   EgBasedLib::EgBasedLib
-*
-*   @brief
-*       Constructor
-*
-*   @note
-*
-****************************************************************************************************
-*/
-EgBasedLib::EgBasedLib(const Client* pClient)
-    :
-    Lib(pClient),
-    m_ranks(0),
-    m_logicalBanks(0),
-    m_bankInterleave(1)
-{
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::~EgBasedLib
-*
-*   @brief
-*       Destructor
-****************************************************************************************************
-*/
-EgBasedLib::~EgBasedLib()
-{
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::DispatchComputeSurfaceInfo
-*
-*   @brief
-*       Compute surface sizes include padded pitch,height,slices,total size in bytes,
-*       meanwhile output suitable tile mode and base alignment might be changed in this
-*       call as well. Results are returned through output parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::DispatchComputeSurfaceInfo(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    AddrTileMode        tileMode      = pIn->tileMode;
-    UINT_32             bpp           = pIn->bpp;
-    UINT_32             numSamples    = pIn->numSamples;
-    UINT_32             numFrags      = ((pIn->numFrags == 0) ? numSamples : pIn->numFrags);
-    UINT_32             pitch         = pIn->width;
-    UINT_32             height        = pIn->height;
-    UINT_32             numSlices     = pIn->numSlices;
-    UINT_32             mipLevel      = pIn->mipLevel;
-    ADDR_SURFACE_FLAGS  flags         = pIn->flags;
-
-    ADDR_TILEINFO       tileInfoDef   = {0};
-    ADDR_TILEINFO*      pTileInfo     = &tileInfoDef;
-    UINT_32             padDims       = 0;
-    BOOL_32             valid;
-
-    if (pIn->flags.disallowLargeThickDegrade == 0)
-    {
-        tileMode = DegradeLargeThickTile(tileMode, bpp);
-    }
-
-    // Only override numSamples for NI above
-    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
-    {
-        if (numFrags != numSamples) // This means EQAA
-        {
-            // The real surface size needed is determined by number of fragments
-            numSamples = numFrags;
-        }
-
-        // Save altered numSamples in pOut
-        pOut->numSamples = numSamples;
-    }
-
-    // Caller makes sure pOut->pTileInfo is not NULL, see HwlComputeSurfaceInfo
-    ADDR_ASSERT(pOut->pTileInfo);
-
-    if (pOut->pTileInfo != NULL)
-    {
-        pTileInfo = pOut->pTileInfo;
-    }
-
-    // Set default values
-    if (pIn->pTileInfo != NULL)
-    {
-        if (pTileInfo != pIn->pTileInfo)
-        {
-            *pTileInfo = *pIn->pTileInfo;
-        }
-    }
-    else
-    {
-        memset(pTileInfo, 0, sizeof(ADDR_TILEINFO));
-    }
-
-    // For macro tile mode, we should calculate default tiling parameters
-    HwlSetupTileInfo(tileMode,
-                     flags,
-                     bpp,
-                     pitch,
-                     height,
-                     numSamples,
-                     pIn->pTileInfo,
-                     pTileInfo,
-                     pIn->tileType,
-                     pOut);
-
-    if (flags.cube)
-    {
-        if (mipLevel == 0)
-        {
-            padDims = 2;
-        }
-
-        if (numSlices == 1)
-        {
-            // This is calculating one face, remove cube flag
-            flags.cube = 0;
-        }
-    }
-
-    switch (tileMode)
-    {
-        case ADDR_TM_LINEAR_GENERAL://fall through
-        case ADDR_TM_LINEAR_ALIGNED:
-            valid = ComputeSurfaceInfoLinear(pIn, pOut, padDims);
-            break;
-
-        case ADDR_TM_1D_TILED_THIN1://fall through
-        case ADDR_TM_1D_TILED_THICK:
-            valid = ComputeSurfaceInfoMicroTiled(pIn, pOut, padDims, tileMode);
-            break;
-
-        case ADDR_TM_2D_TILED_THIN1:    //fall through
-        case ADDR_TM_2D_TILED_THICK:    //fall through
-        case ADDR_TM_3D_TILED_THIN1:    //fall through
-        case ADDR_TM_3D_TILED_THICK:    //fall through
-        case ADDR_TM_2D_TILED_XTHICK:   //fall through
-        case ADDR_TM_3D_TILED_XTHICK:   //fall through
-        case ADDR_TM_PRT_TILED_THIN1:   //fall through
-        case ADDR_TM_PRT_2D_TILED_THIN1://fall through
-        case ADDR_TM_PRT_3D_TILED_THIN1://fall through
-        case ADDR_TM_PRT_TILED_THICK:   //fall through
-        case ADDR_TM_PRT_2D_TILED_THICK://fall through
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            valid = ComputeSurfaceInfoMacroTiled(pIn, pOut, padDims, tileMode);
-            break;
-
-        default:
-            valid = FALSE;
-            ADDR_ASSERT_ALWAYS();
-            break;
-    }
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceInfoLinear
-*
-*   @brief
-*       Compute linear surface sizes include padded pitch, height, slices, total size in
-*       bytes, meanwhile alignments as well. Since it is linear mode, so output tile mode
-*       will not be changed here. Results are returned through output parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::ComputeSurfaceInfoLinear(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] Input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,   ///< [out] Output structure
-    UINT_32                                 padDims ///< [in] Dimensions to padd
-    ) const
-{
-    UINT_32 expPitch = pIn->width;
-    UINT_32 expHeight = pIn->height;
-    UINT_32 expNumSlices = pIn->numSlices;
-
-    // No linear MSAA on real H/W, keep this for TGL
-    UINT_32 numSamples = pOut->numSamples;
-
-    const UINT_32 microTileThickness = 1;
-
-    //
-    // Compute the surface alignments.
-    //
-    ComputeSurfaceAlignmentsLinear(pIn->tileMode,
-                                   pIn->bpp,
-                                   pIn->flags,
-                                   &pOut->baseAlign,
-                                   &pOut->pitchAlign,
-                                   &pOut->heightAlign);
-
-    if ((pIn->tileMode == ADDR_TM_LINEAR_GENERAL) && pIn->flags.color && (pIn->height > 1))
-    {
-#if !ALT_TEST
-        // When linear_general surface is accessed in multiple lines, it requires 8 pixels in pitch
-        // alignment since PITCH_TILE_MAX is in unit of 8 pixels.
-        // It is OK if it is accessed per line.
-        ADDR_ASSERT((pIn->width % 8) == 0);
-#endif
-    }
-
-    pOut->depthAlign = microTileThickness;
-
-    expPitch = HwlPreHandleBaseLvl3xPitch(pIn, expPitch);
-
-    //
-    // Pad pitch and height to the required granularities.
-    //
-    PadDimensions(pIn->tileMode,
-                  pIn->bpp,
-                  pIn->flags,
-                  numSamples,
-                  pOut->pTileInfo,
-                  padDims,
-                  pIn->mipLevel,
-                  &expPitch, &pOut->pitchAlign,
-                  &expHeight, pOut->heightAlign,
-                  &expNumSlices, microTileThickness);
-
-    expPitch = HwlPostHandleBaseLvl3xPitch(pIn, expPitch);
-
-    //
-    // Adjust per HWL
-    //
-
-    UINT_64 logicalSliceSize;
-
-    logicalSliceSize = HwlGetSizeAdjustmentLinear(pIn->tileMode,
-                                                  pIn->bpp,
-                                                  numSamples,
-                                                  pOut->baseAlign,
-                                                  pOut->pitchAlign,
-                                                  &expPitch,
-                                                  &expHeight,
-                                                  &pOut->heightAlign);
-
-    if ((pIn->pitchAlign != 0) || (pIn->heightAlign != 0))
-    {
-        if (pIn->pitchAlign != 0)
-        {
-           ADDR_ASSERT((pIn->pitchAlign % pOut->pitchAlign) == 0);
-           pOut->pitchAlign = pIn->pitchAlign;
-
-            if (IsPow2(pOut->pitchAlign))
-            {
-                expPitch = PowTwoAlign(expPitch, pOut->pitchAlign);
-            }
-            else
-            {
-                expPitch += pOut->pitchAlign - 1;
-                expPitch /= pOut->pitchAlign;
-                expPitch *= pOut->pitchAlign;
-            }
-        }
-
-        if (pIn->heightAlign != 0)
-        {
-           ADDR_ASSERT((pIn->heightAlign % pOut->heightAlign) == 0);
-           pOut->heightAlign = pIn->heightAlign;
-
-            if (IsPow2(pOut->heightAlign))
-            {
-                expHeight = PowTwoAlign(expHeight, pOut->heightAlign);
-            }
-            else
-            {
-                expHeight += pOut->heightAlign - 1;
-                expHeight /= pOut->heightAlign;
-                expHeight *= pOut->heightAlign;
-            }
-        }
-
-        logicalSliceSize = BITS_TO_BYTES(expPitch * expHeight * pIn->bpp);
-    }
-
-    pOut->pitch = expPitch;
-    pOut->height = expHeight;
-    pOut->depth = expNumSlices;
-
-    pOut->surfSize = logicalSliceSize * expNumSlices;
-
-    pOut->tileMode = pIn->tileMode;
-
-    return TRUE;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceInfoMicroTiled
-*
-*   @brief
-*       Compute 1D/Micro Tiled surface sizes include padded pitch, height, slices, total
-*       size in bytes, meanwhile alignments as well. Results are returned through output
-*       parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::ComputeSurfaceInfoMicroTiled(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] Input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,       ///< [out] Output structure
-    UINT_32                                 padDims,    ///< [in] Dimensions to padd
-    AddrTileMode                            expTileMode ///< [in] Expected tile mode
-    ) const
-{
-    BOOL_32 valid = TRUE;
-
-    UINT_32 microTileThickness;
-    UINT_32 expPitch = pIn->width;
-    UINT_32 expHeight = pIn->height;
-    UINT_32 expNumSlices = pIn->numSlices;
-
-    // No 1D MSAA on real H/W, keep this for TGL
-    UINT_32 numSamples = pOut->numSamples;
-
-    //
-    // Compute the micro tile thickness.
-    //
-    microTileThickness = Thickness(expTileMode);
-
-    //
-    // Extra override for mip levels
-    //
-    if (pIn->mipLevel > 0)
-    {
-        //
-        // Reduce tiling mode from thick to thin if the number of slices is less than the
-        // micro tile thickness.
-        //
-        if ((expTileMode == ADDR_TM_1D_TILED_THICK) &&
-            (expNumSlices < ThickTileThickness))
-        {
-            expTileMode = HwlDegradeThickTileMode(ADDR_TM_1D_TILED_THICK, expNumSlices, NULL);
-            if (expTileMode != ADDR_TM_1D_TILED_THICK)
-            {
-                microTileThickness = 1;
-            }
-        }
-    }
-
-    //
-    // Compute the surface restrictions.
-    //
-    ComputeSurfaceAlignmentsMicroTiled(expTileMode,
-                                       pIn->bpp,
-                                       pIn->flags,
-                                       pIn->mipLevel,
-                                       numSamples,
-                                       &pOut->baseAlign,
-                                       &pOut->pitchAlign,
-                                       &pOut->heightAlign);
-
-    pOut->depthAlign = microTileThickness;
-
-    //
-    // Pad pitch and height to the required granularities.
-    // Compute surface size.
-    // Return parameters.
-    //
-    PadDimensions(expTileMode,
-                  pIn->bpp,
-                  pIn->flags,
-                  numSamples,
-                  pOut->pTileInfo,
-                  padDims,
-                  pIn->mipLevel,
-                  &expPitch, &pOut->pitchAlign,
-                  &expHeight, pOut->heightAlign,
-                  &expNumSlices, microTileThickness);
-
-    //
-    // Get HWL specific pitch adjustment
-    //
-    UINT_64 logicalSliceSize = HwlGetSizeAdjustmentMicroTiled(microTileThickness,
-                                                              pIn->bpp,
-                                                              pIn->flags,
-                                                              numSamples,
-                                                              pOut->baseAlign,
-                                                              pOut->pitchAlign,
-                                                              &expPitch,
-                                                              &expHeight);
-
-
-    pOut->pitch = expPitch;
-    pOut->height = expHeight;
-    pOut->depth = expNumSlices;
-
-    pOut->surfSize = logicalSliceSize * expNumSlices;
-
-    pOut->tileMode = expTileMode;
-
-    return valid;
-}
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceInfoMacroTiled
-*
-*   @brief
-*       Compute 2D/macro tiled surface sizes include padded pitch, height, slices, total
-*       size in bytes, meanwhile output suitable tile mode and alignments might be changed
-*       in this call as well. Results are returned through output parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::ComputeSurfaceInfoMacroTiled(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] Input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,       ///< [out] Output structure
-    UINT_32                                 padDims,    ///< [in] Dimensions to padd
-    AddrTileMode                            expTileMode ///< [in] Expected tile mode
-    ) const
-{
-    BOOL_32 valid = TRUE;
-
-    AddrTileMode origTileMode = expTileMode;
-    UINT_32 microTileThickness;
-
-    UINT_32 paddedPitch;
-    UINT_32 paddedHeight;
-    UINT_64 bytesPerSlice;
-
-    UINT_32 expPitch     = pIn->width;
-    UINT_32 expHeight    = pIn->height;
-    UINT_32 expNumSlices = pIn->numSlices;
-
-    UINT_32 numSamples = pOut->numSamples;
-
-    //
-    // Compute the surface restrictions as base
-    // SanityCheckMacroTiled is called in ComputeSurfaceAlignmentsMacroTiled
-    //
-    valid = ComputeSurfaceAlignmentsMacroTiled(expTileMode,
-                                               pIn->bpp,
-                                               pIn->flags,
-                                               pIn->mipLevel,
-                                               numSamples,
-                                               pOut);
-
-    if (valid)
-    {
-        //
-        // Compute the micro tile thickness.
-        //
-        microTileThickness = Thickness(expTileMode);
-
-        //
-        // Find the correct tiling mode for mip levels
-        //
-        if (pIn->mipLevel > 0)
-        {
-            //
-            // Try valid tile mode
-            //
-            expTileMode = ComputeSurfaceMipLevelTileMode(expTileMode,
-                                                         pIn->bpp,
-                                                         expPitch,
-                                                         expHeight,
-                                                         expNumSlices,
-                                                         numSamples,
-                                                         pOut->blockWidth,
-                                                         pOut->blockHeight,
-                                                         pOut->pTileInfo);
-
-            if (!IsMacroTiled(expTileMode)) // Downgraded to micro-tiled
-            {
-                return ComputeSurfaceInfoMicroTiled(pIn, pOut, padDims, expTileMode);
-            }
-            else if (microTileThickness != Thickness(expTileMode))
-            {
-                //
-                // Re-compute if thickness changed since bank-height may be changed!
-                //
-                return ComputeSurfaceInfoMacroTiled(pIn, pOut, padDims, expTileMode);
-            }
-        }
-
-        paddedPitch     = expPitch;
-        paddedHeight    = expHeight;
-
-        //
-        // Re-cal alignment
-        //
-        if (expTileMode != origTileMode) // Tile mode is changed but still macro-tiled
-        {
-            valid = ComputeSurfaceAlignmentsMacroTiled(expTileMode,
-                                                       pIn->bpp,
-                                                       pIn->flags,
-                                                       pIn->mipLevel,
-                                                       numSamples,
-                                                       pOut);
-        }
-
-        //
-        // Do padding
-        //
-        PadDimensions(expTileMode,
-                      pIn->bpp,
-                      pIn->flags,
-                      numSamples,
-                      pOut->pTileInfo,
-                      padDims,
-                      pIn->mipLevel,
-                      &paddedPitch, &pOut->pitchAlign,
-                      &paddedHeight, pOut->heightAlign,
-                      &expNumSlices, microTileThickness);
-
-        if (pIn->flags.qbStereo &&
-            (pOut->pStereoInfo != NULL))
-        {
-            UINT_32 stereoHeightAlign = HwlStereoCheckRightOffsetPadding(pOut->pTileInfo);
-
-            if (stereoHeightAlign != 0)
-            {
-                paddedHeight = PowTwoAlign(paddedHeight, stereoHeightAlign);
-            }
-        }
-
-        if ((pIn->flags.needEquation == TRUE) &&
-            (m_chipFamily == ADDR_CHIP_FAMILY_SI) &&
-            (pIn->numMipLevels > 1) &&
-            (pIn->mipLevel == 0))
-        {
-            BOOL_32 convertTo1D = FALSE;
-
-            ADDR_ASSERT(Thickness(expTileMode) == 1);
-
-            for (UINT_32 i = 1; i < pIn->numMipLevels; i++)
-            {
-                UINT_32 mipPitch = Max(1u, paddedPitch >> i);
-                UINT_32 mipHeight = Max(1u, pIn->height >> i);
-                UINT_32 mipSlices = pIn->flags.volume ?
-                                    Max(1u, pIn->numSlices >> i) : pIn->numSlices;
-                expTileMode = ComputeSurfaceMipLevelTileMode(expTileMode,
-                                                             pIn->bpp,
-                                                             mipPitch,
-                                                             mipHeight,
-                                                             mipSlices,
-                                                             numSamples,
-                                                             pOut->blockWidth,
-                                                             pOut->blockHeight,
-                                                             pOut->pTileInfo);
-
-                if (IsMacroTiled(expTileMode))
-                {
-                    if (PowTwoAlign(mipPitch, pOut->blockWidth) !=
-                        PowTwoAlign(mipPitch, pOut->pitchAlign))
-                    {
-                        convertTo1D = TRUE;
-                        break;
-                    }
-                }
-                else
-                {
-                    break;
-                }
-            }
-
-            if (convertTo1D)
-            {
-                return ComputeSurfaceInfoMicroTiled(pIn, pOut, padDims, ADDR_TM_1D_TILED_THIN1);
-            }
-        }
-
-        pOut->pitch = paddedPitch;
-        // Put this check right here to workaround special mipmap cases which the original height
-        // is needed.
-        // The original height is pre-stored in pOut->height in PostComputeMipLevel and
-        // pOut->pitch is needed in HwlCheckLastMacroTiledLvl, too.
-        if (m_configFlags.checkLast2DLevel && (numSamples == 1)) // Don't check MSAA
-        {
-            // Set a TRUE in pOut if next Level is the first 1D sub level
-            HwlCheckLastMacroTiledLvl(pIn, pOut);
-        }
-        pOut->height = paddedHeight;
-
-        pOut->depth = expNumSlices;
-
-        //
-        // Compute the size of a slice.
-        //
-        bytesPerSlice = BITS_TO_BYTES(static_cast<UINT_64>(paddedPitch) *
-                                      paddedHeight * NextPow2(pIn->bpp) * numSamples);
-
-        pOut->surfSize = bytesPerSlice * expNumSlices;
-
-        pOut->tileMode = expTileMode;
-
-        pOut->depthAlign = microTileThickness;
-
-    } // if (valid)
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceAlignmentsLinear
-*
-*   @brief
-*       Compute linear surface alignment, calculation results are returned through
-*       output parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsLinear(
-    AddrTileMode        tileMode,          ///< [in] tile mode
-    UINT_32             bpp,               ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
-    UINT_32*            pBaseAlign,        ///< [out] base address alignment in bytes
-    UINT_32*            pPitchAlign,       ///< [out] pitch alignment in pixels
-    UINT_32*            pHeightAlign       ///< [out] height alignment in pixels
-    ) const
-{
-    BOOL_32 valid = TRUE;
-
-    switch (tileMode)
-    {
-        case ADDR_TM_LINEAR_GENERAL:
-            //
-            // The required base alignment and pitch and height granularities is to 1 element.
-            //
-            *pBaseAlign   = (bpp > 8) ? bpp / 8 : 1;
-            *pPitchAlign  = 1;
-            *pHeightAlign = 1;
-            break;
-        case ADDR_TM_LINEAR_ALIGNED:
-            //
-            // The required alignment for base is the pipe interleave size.
-            // The required granularity for pitch is hwl dependent.
-            // The required granularity for height is one row.
-            //
-            *pBaseAlign     = m_pipeInterleaveBytes;
-            *pPitchAlign    = HwlGetPitchAlignmentLinear(bpp, flags);
-            *pHeightAlign   = 1;
-            break;
-        default:
-            *pBaseAlign     = 1;
-            *pPitchAlign    = 1;
-            *pHeightAlign   = 1;
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    AdjustPitchAlignment(flags, pPitchAlign);
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceAlignmentsMicroTiled
-*
-*   @brief
-*       Compute 1D tiled surface alignment, calculation results are returned through
-*       output parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMicroTiled(
-    AddrTileMode        tileMode,          ///< [in] tile mode
-    UINT_32             bpp,               ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
-    UINT_32             mipLevel,          ///< [in] mip level
-    UINT_32             numSamples,        ///< [in] number of samples
-    UINT_32*            pBaseAlign,        ///< [out] base address alignment in bytes
-    UINT_32*            pPitchAlign,       ///< [out] pitch alignment in pixels
-    UINT_32*            pHeightAlign       ///< [out] height alignment in pixels
-    ) const
-{
-    BOOL_32 valid = TRUE;
-
-    //
-    // The required alignment for base is the pipe interleave size.
-    //
-    *pBaseAlign   = m_pipeInterleaveBytes;
-
-    *pPitchAlign  = HwlGetPitchAlignmentMicroTiled(tileMode, bpp, flags, numSamples);
-
-    *pHeightAlign = MicroTileHeight;
-
-    AdjustPitchAlignment(flags, pPitchAlign);
-
-    // Workaround 2 for 1D tiling -  There is HW bug for Carrizo,
-    // where it requires the following alignments for 1D tiling.
-    if (flags.czDispCompatible && (mipLevel == 0))
-    {
-        *pBaseAlign  = PowTwoAlign(*pBaseAlign, 4096);                         //Base address MOD 4096 = 0
-        *pPitchAlign = PowTwoAlign(*pPitchAlign, 512 / (BITS_TO_BYTES(bpp)));  //(8 lines * pitch * bytes per pixel) MOD 4096 = 0
-    }
-    // end Carrizo workaround for 1D tilling
-
-    return valid;
-}
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlReduceBankWidthHeight
-*
-*   @brief
-*       Additional checks, reduce bankHeight/bankWidth if needed and possible
-*       tileSize*BANK_WIDTH*BANK_HEIGHT <= ROW_SIZE
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::HwlReduceBankWidthHeight(
-    UINT_32             tileSize,           ///< [in] tile size
-    UINT_32             bpp,                ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,              ///< [in] surface flags
-    UINT_32             numSamples,         ///< [in] number of samples
-    UINT_32             bankHeightAlign,    ///< [in] bank height alignment
-    UINT_32             pipes,              ///< [in] pipes
-    ADDR_TILEINFO*      pTileInfo           ///< [in,out] bank structure.
-    ) const
-{
-    UINT_32 macroAspectAlign;
-    BOOL_32 valid = TRUE;
-
-    if (tileSize * pTileInfo->bankWidth * pTileInfo->bankHeight > m_rowSize)
-    {
-        BOOL_32 stillGreater = TRUE;
-
-        // Try reducing bankWidth first
-        if (stillGreater && pTileInfo->bankWidth > 1)
-        {
-            while (stillGreater && pTileInfo->bankWidth > 0)
-            {
-                pTileInfo->bankWidth >>= 1;
-
-                if (pTileInfo->bankWidth == 0)
-                {
-                    pTileInfo->bankWidth = 1;
-                    break;
-                }
-
-                stillGreater =
-                    tileSize * pTileInfo->bankWidth * pTileInfo->bankHeight > m_rowSize;
-            }
-
-            // bankWidth is reduced above, so we need to recalculate bankHeight and ratio
-            bankHeightAlign = Max(1u,
-                                  m_pipeInterleaveBytes * m_bankInterleave /
-                                  (tileSize * pTileInfo->bankWidth)
-                                  );
-
-            // We cannot increase bankHeight so just assert this case.
-            ADDR_ASSERT((pTileInfo->bankHeight % bankHeightAlign) == 0);
-
-            if (numSamples == 1)
-            {
-                macroAspectAlign = Max(1u,
-                                   m_pipeInterleaveBytes * m_bankInterleave /
-                                   (tileSize * pipes * pTileInfo->bankWidth)
-                                   );
-                pTileInfo->macroAspectRatio = PowTwoAlign(pTileInfo->macroAspectRatio,
-                                                          macroAspectAlign);
-            }
-        }
-
-        // Early quit bank_height degradation for "64" bit z buffer
-        if (flags.depth && bpp >= 64)
-        {
-            stillGreater = FALSE;
-        }
-
-        // Then try reducing bankHeight
-        if (stillGreater && pTileInfo->bankHeight > bankHeightAlign)
-        {
-            while (stillGreater && pTileInfo->bankHeight > bankHeightAlign)
-            {
-                pTileInfo->bankHeight >>= 1;
-
-                if (pTileInfo->bankHeight < bankHeightAlign)
-                {
-                    pTileInfo->bankHeight = bankHeightAlign;
-                    break;
-                }
-
-                stillGreater =
-                    tileSize * pTileInfo->bankWidth * pTileInfo->bankHeight > m_rowSize;
-            }
-        }
-
-        valid = !stillGreater;
-
-        // Generate a warning if we still fail to meet this constraint
-        if (valid == FALSE)
-        {
-            ADDR_WARN(
-                0, ("TILE_SIZE(%d)*BANK_WIDTH(%d)*BANK_HEIGHT(%d) <= ROW_SIZE(%d)",
-                tileSize, pTileInfo->bankWidth, pTileInfo->bankHeight, m_rowSize));
-        }
-    }
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceAlignmentsMacroTiled
-*
-*   @brief
-*       Compute 2D tiled surface alignment, calculation results are returned through
-*       output parameters.
-*
-*   @return
-*       TRUE if no error occurs
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMacroTiled(
-    AddrTileMode                      tileMode,           ///< [in] tile mode
-    UINT_32                           bpp,                ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
-    UINT_32                           mipLevel,           ///< [in] mip level
-    UINT_32                           numSamples,         ///< [in] number of samples
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
-    ) const
-{
-    ADDR_TILEINFO* pTileInfo = pOut->pTileInfo;
-
-    BOOL_32 valid = SanityCheckMacroTiled(pTileInfo);
-
-    if (valid)
-    {
-        UINT_32 macroTileWidth;
-        UINT_32 macroTileHeight;
-
-        UINT_32 tileSize;
-        UINT_32 bankHeightAlign;
-        UINT_32 macroAspectAlign;
-
-        UINT_32 thickness = Thickness(tileMode);
-        UINT_32 pipes = HwlGetPipes(pTileInfo);
-
-        //
-        // Align bank height first according to latest h/w spec
-        //
-
-        // tile_size = MIN(tile_split, 64 * tile_thickness * element_bytes * num_samples)
-        tileSize = Min(pTileInfo->tileSplitBytes,
-                       BITS_TO_BYTES(64 * thickness * bpp * numSamples));
-
-        // bank_height_align =
-        // MAX(1, (pipe_interleave_bytes * bank_interleave)/(tile_size*bank_width))
-        bankHeightAlign = Max(1u,
-                              m_pipeInterleaveBytes * m_bankInterleave /
-                              (tileSize * pTileInfo->bankWidth)
-                              );
-
-        pTileInfo->bankHeight = PowTwoAlign(pTileInfo->bankHeight, bankHeightAlign);
-
-        // num_pipes * bank_width * macro_tile_aspect >=
-        // (pipe_interleave_size * bank_interleave) / tile_size
-        if (numSamples == 1)
-        {
-            // this restriction is only for mipmap (mipmap's numSamples must be 1)
-            macroAspectAlign = Max(1u,
-                                   m_pipeInterleaveBytes * m_bankInterleave /
-                                   (tileSize * pipes * pTileInfo->bankWidth)
-                                   );
-            pTileInfo->macroAspectRatio = PowTwoAlign(pTileInfo->macroAspectRatio, macroAspectAlign);
-        }
-
-        valid = HwlReduceBankWidthHeight(tileSize,
-                                         bpp,
-                                         flags,
-                                         numSamples,
-                                         bankHeightAlign,
-                                         pipes,
-                                         pTileInfo);
-
-        //
-        // The required granularity for pitch is the macro tile width.
-        //
-        macroTileWidth = MicroTileWidth * pTileInfo->bankWidth * pipes *
-            pTileInfo->macroAspectRatio;
-
-        pOut->pitchAlign = macroTileWidth;
-        pOut->blockWidth = macroTileWidth;
-
-        AdjustPitchAlignment(flags, &pOut->pitchAlign);
-
-        //
-        // The required granularity for height is the macro tile height.
-        //
-        macroTileHeight = MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
-            pTileInfo->macroAspectRatio;
-
-        pOut->heightAlign = macroTileHeight;
-        pOut->blockHeight = macroTileHeight;
-
-        //
-        // Compute base alignment
-        //
-        pOut->baseAlign =
-            pipes * pTileInfo->bankWidth * pTileInfo->banks * pTileInfo->bankHeight * tileSize;
-
-        HwlComputeSurfaceAlignmentsMacroTiled(tileMode, bpp, flags, mipLevel, numSamples, pOut);
-    }
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::SanityCheckMacroTiled
-*
-*   @brief
-*       Check if macro-tiled parameters are valid
-*   @return
-*       TRUE if valid
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::SanityCheckMacroTiled(
-    ADDR_TILEINFO* pTileInfo   ///< [in] macro-tiled parameters
-    ) const
-{
-    BOOL_32 valid       = TRUE;
-    MAYBE_UNUSED UINT_32 numPipes = HwlGetPipes(pTileInfo);
-
-    switch (pTileInfo->banks)
-    {
-        case 2: //fall through
-        case 4: //fall through
-        case 8: //fall through
-        case 16:
-            break;
-        default:
-            valid = FALSE;
-            break;
-
-    }
-
-    if (valid)
-    {
-        switch (pTileInfo->bankWidth)
-        {
-            case 1: //fall through
-            case 2: //fall through
-            case 4: //fall through
-            case 8:
-                break;
-            default:
-                valid = FALSE;
-                break;
-        }
-    }
-
-    if (valid)
-    {
-        switch (pTileInfo->bankHeight)
-        {
-            case 1: //fall through
-            case 2: //fall through
-            case 4: //fall through
-            case 8:
-                break;
-            default:
-                valid = FALSE;
-                break;
-        }
-    }
-
-    if (valid)
-    {
-        switch (pTileInfo->macroAspectRatio)
-        {
-            case 1: //fall through
-            case 2: //fall through
-            case 4: //fall through
-            case 8:
-                break;
-            default:
-                valid = FALSE;
-                break;
-        }
-    }
-
-    if (valid)
-    {
-        if (pTileInfo->banks < pTileInfo->macroAspectRatio)
-        {
-            // This will generate macro tile height <= 1
-            valid = FALSE;
-        }
-    }
-
-    if (valid)
-    {
-        if (pTileInfo->tileSplitBytes > m_rowSize)
-        {
-            ADDR_WARN(0, ("tileSplitBytes is bigger than row size"));
-        }
-    }
-
-    if (valid)
-    {
-        valid = HwlSanityCheckMacroTiled(pTileInfo);
-    }
-
-    ADDR_ASSERT(valid == TRUE);
-
-    // Add this assert for guidance
-    ADDR_ASSERT(numPipes * pTileInfo->banks >= 4);
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceMipLevelTileMode
-*
-*   @brief
-*       Compute valid tile mode for surface mipmap sub-levels
-*
-*   @return
-*       Suitable tile mode
-****************************************************************************************************
-*/
-AddrTileMode EgBasedLib::ComputeSurfaceMipLevelTileMode(
-    AddrTileMode        baseTileMode,   ///< [in] base tile mode
-    UINT_32             bpp,            ///< [in] bits per pixels
-    UINT_32             pitch,          ///< [in] current level pitch
-    UINT_32             height,         ///< [in] current level height
-    UINT_32             numSlices,      ///< [in] current number of slices
-    UINT_32             numSamples,     ///< [in] number of samples
-    UINT_32             pitchAlign,     ///< [in] pitch alignment
-    UINT_32             heightAlign,    ///< [in] height alignment
-    ADDR_TILEINFO*      pTileInfo       ///< [in] ptr to bank structure
-    ) const
-{
-    UINT_64 bytesPerSlice;
-    (void)bytesPerSlice;
-    UINT_32 bytesPerTile;
-
-    AddrTileMode expTileMode = baseTileMode;
-    UINT_32 microTileThickness = Thickness(expTileMode);
-    UINT_32 interleaveSize = m_pipeInterleaveBytes * m_bankInterleave;
-
-    //
-    // Compute the size of a slice.
-    //
-    bytesPerSlice = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
-    bytesPerTile = BITS_TO_BYTES(MicroTilePixels * microTileThickness * NextPow2(bpp) * numSamples);
-
-    //
-    // Reduce tiling mode from thick to thin if the number of slices is less than the
-    // micro tile thickness.
-    //
-    if (numSlices < microTileThickness)
-    {
-        expTileMode = HwlDegradeThickTileMode(expTileMode, numSlices, &bytesPerTile);
-    }
-
-    if (bytesPerTile > pTileInfo->tileSplitBytes)
-    {
-        bytesPerTile = pTileInfo->tileSplitBytes;
-    }
-
-    UINT_32 threshold1 =
-        bytesPerTile * HwlGetPipes(pTileInfo) * pTileInfo->bankWidth * pTileInfo->macroAspectRatio;
-
-    UINT_32 threshold2 =
-        bytesPerTile * pTileInfo->bankWidth * pTileInfo->bankHeight;
-
-    //
-    // Reduce the tile mode from 2D/3D to 1D in following conditions
-    //
-    switch (expTileMode)
-    {
-        case ADDR_TM_2D_TILED_THIN1: //fall through
-        case ADDR_TM_3D_TILED_THIN1:
-        case ADDR_TM_PRT_TILED_THIN1:
-        case ADDR_TM_PRT_2D_TILED_THIN1:
-        case ADDR_TM_PRT_3D_TILED_THIN1:
-            if ((pitch < pitchAlign) ||
-                (height < heightAlign) ||
-                (interleaveSize > threshold1) ||
-                (interleaveSize > threshold2))
-            {
-                expTileMode = ADDR_TM_1D_TILED_THIN1;
-            }
-            break;
-        case ADDR_TM_2D_TILED_THICK: //fall through
-        case ADDR_TM_3D_TILED_THICK:
-        case ADDR_TM_2D_TILED_XTHICK:
-        case ADDR_TM_3D_TILED_XTHICK:
-        case ADDR_TM_PRT_TILED_THICK:
-        case ADDR_TM_PRT_2D_TILED_THICK:
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            if ((pitch < pitchAlign) ||
-                (height < heightAlign))
-            {
-                expTileMode = ADDR_TM_1D_TILED_THICK;
-            }
-            break;
-        default:
-            break;
-    }
-
-    return expTileMode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlGetAlignmentInfoMacroTiled
-*   @brief
-*       Get alignment info for giving tile mode
-*   @return
-*       TRUE if getting alignment is OK
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::HwlGetAlignmentInfoMacroTiled(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,             ///< [in] create surface info
-    UINT_32*                               pPitchAlign,     ///< [out] pitch alignment
-    UINT_32*                               pHeightAlign,    ///< [out] height alignment
-    UINT_32*                               pSizeAlign       ///< [out] size alignment
-    ) const
-{
-    BOOL_32 valid = TRUE;
-
-    ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
-
-    UINT_32 numSamples = (pIn->numFrags == 0) ? pIn->numSamples : pIn->numFrags;
-
-    ADDR_ASSERT(pIn->pTileInfo);
-    ADDR_TILEINFO tileInfo = *pIn->pTileInfo;
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT out = {0};
-    out.pTileInfo = &tileInfo;
-
-    if (UseTileIndex(pIn->tileIndex))
-    {
-        out.tileIndex = pIn->tileIndex;
-        out.macroModeIndex = TileIndexInvalid;
-    }
-
-    HwlSetupTileInfo(pIn->tileMode,
-                     pIn->flags,
-                     pIn->bpp,
-                     pIn->width,
-                     pIn->height,
-                     numSamples,
-                     &tileInfo,
-                     &tileInfo,
-                     pIn->tileType,
-                     &out);
-
-    valid = ComputeSurfaceAlignmentsMacroTiled(pIn->tileMode,
-                                               pIn->bpp,
-                                               pIn->flags,
-                                               pIn->mipLevel,
-                                               numSamples,
-                                               &out);
-
-    if (valid)
-    {
-        *pPitchAlign  = out.pitchAlign;
-        *pHeightAlign = out.heightAlign;
-        *pSizeAlign   = out.baseAlign;
-    }
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlDegradeThickTileMode
-*
-*   @brief
-*       Degrades valid tile mode for thick modes if needed
-*
-*   @return
-*       Suitable tile mode
-****************************************************************************************************
-*/
-AddrTileMode EgBasedLib::HwlDegradeThickTileMode(
-    AddrTileMode        baseTileMode,   ///< [in] base tile mode
-    UINT_32             numSlices,      ///< [in] current number of slices
-    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
-    ) const
-{
-    ADDR_ASSERT(numSlices < Thickness(baseTileMode));
-    // if pBytesPerTile is NULL, this is a don't-care....
-    UINT_32 bytesPerTile = pBytesPerTile != NULL ? *pBytesPerTile : 64;
-
-    AddrTileMode expTileMode = baseTileMode;
-    switch (baseTileMode)
-    {
-        case ADDR_TM_1D_TILED_THICK:
-            expTileMode = ADDR_TM_1D_TILED_THIN1;
-            bytesPerTile >>= 2;
-            break;
-        case ADDR_TM_2D_TILED_THICK:
-            expTileMode = ADDR_TM_2D_TILED_THIN1;
-            bytesPerTile >>= 2;
-            break;
-        case ADDR_TM_3D_TILED_THICK:
-            expTileMode = ADDR_TM_3D_TILED_THIN1;
-            bytesPerTile >>= 2;
-            break;
-        case ADDR_TM_2D_TILED_XTHICK:
-            if (numSlices < ThickTileThickness)
-            {
-                expTileMode = ADDR_TM_2D_TILED_THIN1;
-                bytesPerTile >>= 3;
-            }
-            else
-            {
-                expTileMode = ADDR_TM_2D_TILED_THICK;
-                bytesPerTile >>= 1;
-            }
-            break;
-        case ADDR_TM_3D_TILED_XTHICK:
-            if (numSlices < ThickTileThickness)
-            {
-                expTileMode = ADDR_TM_3D_TILED_THIN1;
-                bytesPerTile >>= 3;
-            }
-            else
-            {
-                expTileMode = ADDR_TM_3D_TILED_THICK;
-                bytesPerTile >>= 1;
-            }
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-            break;
-    }
-
-    if (pBytesPerTile != NULL)
-    {
-        *pBytesPerTile = bytesPerTile;
-    }
-
-    return expTileMode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::DispatchComputeSurfaceAddrFromCoord
-*
-*   @brief
-*       Compute surface address from given coord (x, y, slice,sample)
-*
-*   @return
-*       Address in bytes
-****************************************************************************************************
-*/
-UINT_64 EgBasedLib::DispatchComputeSurfaceAddrFromCoord(
-    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
-    ) const
-{
-    UINT_32             x                  = pIn->x;
-    UINT_32             y                  = pIn->y;
-    UINT_32             slice              = pIn->slice;
-    UINT_32             sample             = pIn->sample;
-    UINT_32             bpp                = pIn->bpp;
-    UINT_32             pitch              = pIn->pitch;
-    UINT_32             height             = pIn->height;
-    UINT_32             numSlices          = pIn->numSlices;
-    UINT_32             numSamples         = ((pIn->numSamples == 0) ? 1 : pIn->numSamples);
-    UINT_32             numFrags           = ((pIn->numFrags == 0) ? numSamples : pIn->numFrags);
-    AddrTileMode        tileMode           = pIn->tileMode;
-    AddrTileType        microTileType      = pIn->tileType;
-    BOOL_32             ignoreSE           = pIn->ignoreSE;
-    BOOL_32             isDepthSampleOrder = pIn->isDepth;
-    ADDR_TILEINFO*      pTileInfo          = pIn->pTileInfo;
-
-    UINT_32*            pBitPosition       = &pOut->bitPosition;
-    UINT_64             addr;
-
-    // ADDR_DEPTH_SAMPLE_ORDER = non-disp + depth-sample-order
-    if (microTileType == ADDR_DEPTH_SAMPLE_ORDER)
-    {
-        isDepthSampleOrder = TRUE;
-    }
-
-    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
-    {
-        if (numFrags != numSamples)
-        {
-            numSamples = numFrags;
-            ADDR_ASSERT(sample < numSamples);
-        }
-
-        /// @note
-        /// 128 bit/thick tiled surface doesn't support display tiling and
-        /// mipmap chain must have the same tileType, so please fill tileType correctly
-        if (IsLinear(pIn->tileMode) == FALSE)
-        {
-            if (bpp >= 128 || Thickness(tileMode) > 1)
-            {
-                ADDR_ASSERT(microTileType != ADDR_DISPLAYABLE);
-            }
-        }
-    }
-
-    switch (tileMode)
-    {
-        case ADDR_TM_LINEAR_GENERAL://fall through
-        case ADDR_TM_LINEAR_ALIGNED:
-            addr = ComputeSurfaceAddrFromCoordLinear(x,
-                                                     y,
-                                                     slice,
-                                                     sample,
-                                                     bpp,
-                                                     pitch,
-                                                     height,
-                                                     numSlices,
-                                                     pBitPosition);
-            break;
-        case ADDR_TM_1D_TILED_THIN1://fall through
-        case ADDR_TM_1D_TILED_THICK:
-            addr = ComputeSurfaceAddrFromCoordMicroTiled(x,
-                                                         y,
-                                                         slice,
-                                                         sample,
-                                                         bpp,
-                                                         pitch,
-                                                         height,
-                                                         numSamples,
-                                                         tileMode,
-                                                         microTileType,
-                                                         isDepthSampleOrder,
-                                                         pBitPosition);
-            break;
-        case ADDR_TM_2D_TILED_THIN1:    //fall through
-        case ADDR_TM_2D_TILED_THICK:    //fall through
-        case ADDR_TM_3D_TILED_THIN1:    //fall through
-        case ADDR_TM_3D_TILED_THICK:    //fall through
-        case ADDR_TM_2D_TILED_XTHICK:   //fall through
-        case ADDR_TM_3D_TILED_XTHICK:   //fall through
-        case ADDR_TM_PRT_TILED_THIN1:   //fall through
-        case ADDR_TM_PRT_2D_TILED_THIN1://fall through
-        case ADDR_TM_PRT_3D_TILED_THIN1://fall through
-        case ADDR_TM_PRT_TILED_THICK:   //fall through
-        case ADDR_TM_PRT_2D_TILED_THICK://fall through
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            UINT_32 pipeSwizzle;
-            UINT_32 bankSwizzle;
-
-            if (m_configFlags.useCombinedSwizzle)
-            {
-                ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
-                                       &bankSwizzle, &pipeSwizzle);
-            }
-            else
-            {
-                pipeSwizzle = pIn->pipeSwizzle;
-                bankSwizzle = pIn->bankSwizzle;
-            }
-
-            addr = ComputeSurfaceAddrFromCoordMacroTiled(x,
-                                                         y,
-                                                         slice,
-                                                         sample,
-                                                         bpp,
-                                                         pitch,
-                                                         height,
-                                                         numSamples,
-                                                         tileMode,
-                                                         microTileType,
-                                                         ignoreSE,
-                                                         isDepthSampleOrder,
-                                                         pipeSwizzle,
-                                                         bankSwizzle,
-                                                         pTileInfo,
-                                                         pBitPosition);
-            break;
-        default:
-            addr = 0;
-            ADDR_ASSERT_ALWAYS();
-            break;
-    }
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeMacroTileEquation
-*
-*   @brief
-*       Computes the address equation in macro tile
-*   @return
-*       If equation can be computed
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::ComputeMacroTileEquation(
-    UINT_32             log2BytesPP,            ///< [in] log2 of bytes per pixel
-    AddrTileMode        tileMode,               ///< [in] tile mode
-    AddrTileType        microTileType,          ///< [in] micro tiling type
-    ADDR_TILEINFO*      pTileInfo,              ///< [in] bank structure
-    ADDR_EQUATION*      pEquation               ///< [out] Equation for addressing in macro tile
-    ) const
-{
-    ADDR_E_RETURNCODE retCode;
-
-    // Element equation within a tile
-    retCode = ComputeMicroTileEquation(log2BytesPP, tileMode, microTileType, pEquation);
-
-    if (retCode == ADDR_OK)
-    {
-        // Tile equesiton with signle pipe bank
-        UINT_32 numPipes              = HwlGetPipes(pTileInfo);
-        UINT_32 numPipeBits           = Log2(numPipes);
-
-        for (UINT_32 i = 0; i < Log2(pTileInfo->bankWidth); i++)
-        {
-            pEquation->addr[pEquation->numBits].valid = 1;
-            pEquation->addr[pEquation->numBits].channel = 0;
-            pEquation->addr[pEquation->numBits].index = i + log2BytesPP + 3 + numPipeBits;
-            pEquation->numBits++;
-        }
-
-        for (UINT_32 i = 0; i < Log2(pTileInfo->bankHeight); i++)
-        {
-            pEquation->addr[pEquation->numBits].valid = 1;
-            pEquation->addr[pEquation->numBits].channel = 1;
-            pEquation->addr[pEquation->numBits].index = i + 3;
-            pEquation->numBits++;
-        }
-
-        ADDR_EQUATION equation;
-        memset(&equation, 0, sizeof(ADDR_EQUATION));
-
-        UINT_32 thresholdX = 32;
-        UINT_32 thresholdY = 32;
-
-        if (IsPrtNoRotationTileMode(tileMode))
-        {
-            UINT_32 macroTilePitch  =
-                (MicroTileWidth  * pTileInfo->bankWidth  * numPipes) * pTileInfo->macroAspectRatio;
-            UINT_32 macroTileHeight =
-                (MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks) /
-                pTileInfo->macroAspectRatio;
-            thresholdX = Log2(macroTilePitch);
-            thresholdY = Log2(macroTileHeight);
-        }
-
-        // Pipe equation
-        retCode = ComputePipeEquation(log2BytesPP, thresholdX, thresholdY, pTileInfo, &equation);
-
-        if (retCode == ADDR_OK)
-        {
-            UINT_32 pipeBitStart = Log2(m_pipeInterleaveBytes);
-
-            if (pEquation->numBits > pipeBitStart)
-            {
-                UINT_32 numLeftShift = pEquation->numBits - pipeBitStart;
-
-                for (UINT_32 i = 0; i < numLeftShift; i++)
-                {
-                    pEquation->addr[pEquation->numBits + equation.numBits - i - 1] =
-                        pEquation->addr[pEquation->numBits - i - 1];
-                    pEquation->xor1[pEquation->numBits + equation.numBits - i - 1] =
-                        pEquation->xor1[pEquation->numBits - i - 1];
-                    pEquation->xor2[pEquation->numBits + equation.numBits - i - 1] =
-                        pEquation->xor2[pEquation->numBits - i - 1];
-                }
-            }
-
-            for (UINT_32 i = 0; i < equation.numBits; i++)
-            {
-                pEquation->addr[pipeBitStart + i] = equation.addr[i];
-                pEquation->xor1[pipeBitStart + i] = equation.xor1[i];
-                pEquation->xor2[pipeBitStart + i] = equation.xor2[i];
-                pEquation->numBits++;
-            }
-
-            // Bank equation
-            memset(&equation, 0, sizeof(ADDR_EQUATION));
-
-            retCode = ComputeBankEquation(log2BytesPP, thresholdX, thresholdY,
-                                          pTileInfo, &equation);
-
-            if (retCode == ADDR_OK)
-            {
-                UINT_32 bankBitStart = pipeBitStart + numPipeBits + Log2(m_bankInterleave);
-
-                if (pEquation->numBits > bankBitStart)
-                {
-                    UINT_32 numLeftShift = pEquation->numBits - bankBitStart;
-
-                    for (UINT_32 i = 0; i < numLeftShift; i++)
-                    {
-                        pEquation->addr[pEquation->numBits + equation.numBits - i - 1] =
-                            pEquation->addr[pEquation->numBits - i - 1];
-                        pEquation->xor1[pEquation->numBits + equation.numBits - i - 1] =
-                            pEquation->xor1[pEquation->numBits - i - 1];
-                        pEquation->xor2[pEquation->numBits + equation.numBits - i - 1] =
-                            pEquation->xor2[pEquation->numBits - i - 1];
-                    }
-                }
-
-                for (UINT_32 i = 0; i < equation.numBits; i++)
-                {
-                    pEquation->addr[bankBitStart + i] = equation.addr[i];
-                    pEquation->xor1[bankBitStart + i] = equation.xor1[i];
-                    pEquation->xor2[bankBitStart + i] = equation.xor2[i];
-                    pEquation->numBits++;
-                }
-            }
-        }
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
-*
-*   @brief
-*       Computes the surface address and bit position from a
-*       coordinate for 2D tilied (macro tiled)
-*   @return
-*       The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMacroTiled(
-    UINT_32             x,                      ///< [in] x coordinate
-    UINT_32             y,                      ///< [in] y coordinate
-    UINT_32             slice,                  ///< [in] slice index
-    UINT_32             sample,                 ///< [in] sample index
-    UINT_32             bpp,                    ///< [in] bits per pixel
-    UINT_32             pitch,                  ///< [in] surface pitch, in pixels
-    UINT_32             height,                 ///< [in] surface height, in pixels
-    UINT_32             numSamples,             ///< [in] number of samples
-    AddrTileMode        tileMode,               ///< [in] tile mode
-    AddrTileType        microTileType,          ///< [in] micro tiling type
-    BOOL_32             ignoreSE,               ///< [in] TRUE if shader enginers can be ignored
-    BOOL_32             isDepthSampleOrder,     ///< [in] TRUE if it depth sample ordering is used
-    UINT_32             pipeSwizzle,            ///< [in] pipe swizzle
-    UINT_32             bankSwizzle,            ///< [in] bank swizzle
-    ADDR_TILEINFO*      pTileInfo,              ///< [in] bank structure
-                                                ///  **All fields to be valid on entry**
-    UINT_32*            pBitPosition            ///< [out] bit position, e.g. FMT_1 will use this
-    ) const
-{
-    UINT_64 addr;
-
-    UINT_32 microTileBytes;
-    UINT_32 microTileBits;
-    UINT_32 sampleOffset;
-    UINT_32 pixelIndex;
-    UINT_32 pixelOffset;
-    UINT_32 elementOffset;
-    UINT_32 tileSplitSlice;
-    UINT_32 pipe;
-    UINT_32 bank;
-    UINT_64 sliceBytes;
-    UINT_64 sliceOffset;
-    UINT_32 macroTilePitch;
-    UINT_32 macroTileHeight;
-    UINT_32 macroTilesPerRow;
-    UINT_32 macroTilesPerSlice;
-    UINT_64 macroTileBytes;
-    UINT_32 macroTileIndexX;
-    UINT_32 macroTileIndexY;
-    UINT_64 macroTileOffset;
-    UINT_64 totalOffset;
-    UINT_64 pipeInterleaveMask;
-    UINT_64 bankInterleaveMask;
-    UINT_64 pipeInterleaveOffset;
-    UINT_32 bankInterleaveOffset;
-    UINT_64 offset;
-    UINT_32 tileRowIndex;
-    UINT_32 tileColumnIndex;
-    UINT_32 tileIndex;
-    UINT_32 tileOffset;
-
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    //
-    // Compute the number of group, pipe, and bank bits.
-    //
-    UINT_32 numPipes              = HwlGetPipes(pTileInfo);
-    UINT_32 numPipeInterleaveBits = Log2(m_pipeInterleaveBytes);
-    UINT_32 numPipeBits           = Log2(numPipes);
-    UINT_32 numBankInterleaveBits = Log2(m_bankInterleave);
-    UINT_32 numBankBits           = Log2(pTileInfo->banks);
-
-    //
-    // Compute the micro tile size.
-    //
-    microTileBits = MicroTilePixels * microTileThickness * bpp * numSamples;
-
-    microTileBytes = microTileBits / 8;
-    //
-    // Compute the pixel index within the micro tile.
-    //
-    pixelIndex = ComputePixelIndexWithinMicroTile(x,
-                                                  y,
-                                                  slice,
-                                                  bpp,
-                                                  tileMode,
-                                                  microTileType);
-
-    //
-    // Compute the sample offset and pixel offset.
-    //
-    if (isDepthSampleOrder)
-    {
-        //
-        // For depth surfaces, samples are stored contiguously for each element, so the sample
-        // offset is the sample number times the element size.
-        //
-        sampleOffset = sample * bpp;
-        pixelOffset  = pixelIndex * bpp * numSamples;
-    }
-    else
-    {
-        //
-        // For color surfaces, all elements for a particular sample are stored contiguously, so
-        // the sample offset is the sample number times the micro tile size divided yBit the number
-        // of samples.
-        //
-        sampleOffset = sample * (microTileBits / numSamples);
-        pixelOffset  = pixelIndex * bpp;
-    }
-
-    //
-    // Compute the element offset.
-    //
-    elementOffset = pixelOffset + sampleOffset;
-
-    *pBitPosition = static_cast<UINT_32>(elementOffset % 8);
-
-    elementOffset /= 8; //bit-to-byte
-
-    //
-    // Determine if tiles need to be split across slices.
-    //
-    // If the size of the micro tile is larger than the tile split size, then the tile will be
-    // split across multiple slices.
-    //
-    UINT_32 slicesPerTile = 1;
-
-    if ((microTileBytes > pTileInfo->tileSplitBytes) && (microTileThickness == 1))
-    {   //don't support for thick mode
-
-        //
-        // Compute the number of slices per tile.
-        //
-        slicesPerTile = microTileBytes / pTileInfo->tileSplitBytes;
-
-        //
-        // Compute the tile split slice number for use in rotating the bank.
-        //
-        tileSplitSlice = elementOffset / pTileInfo->tileSplitBytes;
-
-        //
-        // Adjust the element offset to account for the portion of the tile that is being moved to
-        // a new slice..
-        //
-        elementOffset %= pTileInfo->tileSplitBytes;
-
-        //
-        // Adjust the microTileBytes size to tileSplitBytes size since
-        // a new slice..
-        //
-        microTileBytes = pTileInfo->tileSplitBytes;
-    }
-    else
-    {
-        tileSplitSlice = 0;
-    }
-
-    //
-    // Compute macro tile pitch and height.
-    //
-    macroTilePitch  =
-        (MicroTileWidth  * pTileInfo->bankWidth  * numPipes) * pTileInfo->macroAspectRatio;
-    macroTileHeight =
-        (MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks) / pTileInfo->macroAspectRatio;
-
-    //
-    // Compute the number of bytes per macro tile. Note: bytes of the same bank/pipe actually
-    //
-    macroTileBytes =
-        static_cast<UINT_64>(microTileBytes) *
-        (macroTilePitch / MicroTileWidth) * (macroTileHeight / MicroTileHeight) /
-        (numPipes * pTileInfo->banks);
-
-    //
-    // Compute the number of macro tiles per row.
-    //
-    macroTilesPerRow = pitch / macroTilePitch;
-
-    //
-    // Compute the offset to the macro tile containing the specified coordinate.
-    //
-    macroTileIndexX = x / macroTilePitch;
-    macroTileIndexY = y / macroTileHeight;
-    macroTileOffset = ((macroTileIndexY * macroTilesPerRow) + macroTileIndexX) * macroTileBytes;
-
-    //
-    // Compute the number of macro tiles per slice.
-    //
-    macroTilesPerSlice = macroTilesPerRow  * (height / macroTileHeight);
-
-    //
-    // Compute the slice size.
-    //
-    sliceBytes = macroTilesPerSlice * macroTileBytes;
-
-    //
-    // Compute the slice offset.
-    //
-    sliceOffset = sliceBytes * (tileSplitSlice + slicesPerTile * (slice / microTileThickness));
-
-    //
-    // Compute tile offest
-    //
-    tileRowIndex    = (y / MicroTileHeight) % pTileInfo->bankHeight;
-    tileColumnIndex = ((x / MicroTileWidth) / numPipes) % pTileInfo->bankWidth;
-    tileIndex        = (tileRowIndex * pTileInfo->bankWidth) + tileColumnIndex;
-    tileOffset       = tileIndex * microTileBytes;
-
-    //
-    // Combine the slice offset and macro tile offset with the pixel and sample offsets, accounting
-    // for the pipe and bank bits in the middle of the address.
-    //
-    totalOffset = sliceOffset + macroTileOffset + elementOffset + tileOffset;
-
-    //
-    // Get the pipe and bank.
-    //
-
-    // when the tileMode is PRT type, then adjust x and y coordinates
-    if (IsPrtNoRotationTileMode(tileMode))
-    {
-        x = x % macroTilePitch;
-        y = y % macroTileHeight;
-    }
-
-    pipe = ComputePipeFromCoord(x,
-                                y,
-                                slice,
-                                tileMode,
-                                pipeSwizzle,
-                                ignoreSE,
-                                pTileInfo);
-
-    bank = ComputeBankFromCoord(x,
-                                y,
-                                slice,
-                                tileMode,
-                                bankSwizzle,
-                                tileSplitSlice,
-                                pTileInfo);
-
-
-    //
-    // Split the offset to put some bits below the pipe+bank bits and some above.
-    //
-    pipeInterleaveMask = (1 << numPipeInterleaveBits) - 1;
-    bankInterleaveMask = (1 << numBankInterleaveBits) - 1;
-    pipeInterleaveOffset = totalOffset & pipeInterleaveMask;
-    bankInterleaveOffset = static_cast<UINT_32>((totalOffset >> numPipeInterleaveBits) &
-                                                bankInterleaveMask);
-    offset               =  totalOffset >> (numPipeInterleaveBits + numBankInterleaveBits);
-
-    //
-    // Assemble the address from its components.
-    //
-    addr  = pipeInterleaveOffset;
-    // This is to remove /analyze warnings
-    UINT_32 pipeBits            = pipe                 <<  numPipeInterleaveBits;
-    UINT_32 bankInterleaveBits  = bankInterleaveOffset << (numPipeInterleaveBits + numPipeBits);
-    UINT_32 bankBits            = bank                 << (numPipeInterleaveBits + numPipeBits +
-                                                           numBankInterleaveBits);
-    UINT_64 offsetBits          = offset               << (numPipeInterleaveBits + numPipeBits +
-                                                           numBankInterleaveBits + numBankBits);
-
-    addr |= pipeBits;
-    addr |= bankInterleaveBits;
-    addr |= bankBits;
-    addr |= offsetBits;
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
-*
-*   @brief
-*       Computes the surface address and bit position from a coordinate for 1D tilied
-*       (micro tiled)
-*   @return
-*       The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled(
-    UINT_32             x,                      ///< [in] x coordinate
-    UINT_32             y,                      ///< [in] y coordinate
-    UINT_32             slice,                  ///< [in] slice index
-    UINT_32             sample,                 ///< [in] sample index
-    UINT_32             bpp,                    ///< [in] bits per pixel
-    UINT_32             pitch,                  ///< [in] pitch, in pixels
-    UINT_32             height,                 ///< [in] height, in pixels
-    UINT_32             numSamples,             ///< [in] number of samples
-    AddrTileMode        tileMode,               ///< [in] tile mode
-    AddrTileType        microTileType,          ///< [in] micro tiling type
-    BOOL_32             isDepthSampleOrder,     ///< [in] TRUE if depth sample ordering is used
-    UINT_32*            pBitPosition            ///< [out] bit position, e.g. FMT_1 will use this
-    ) const
-{
-    UINT_64 addr = 0;
-
-    UINT_32 microTileBytes;
-    UINT_64 sliceBytes;
-    UINT_32 microTilesPerRow;
-    UINT_32 microTileIndexX;
-    UINT_32 microTileIndexY;
-    UINT_32 microTileIndexZ;
-    UINT_64 sliceOffset;
-    UINT_64 microTileOffset;
-    UINT_32 sampleOffset;
-    UINT_32 pixelIndex;
-    UINT_32 pixelOffset;
-
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    //
-    // Compute the micro tile size.
-    //
-    microTileBytes = BITS_TO_BYTES(MicroTilePixels * microTileThickness * bpp * numSamples);
-
-    //
-    // Compute the slice size.
-    //
-    sliceBytes =
-        BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * microTileThickness * bpp * numSamples);
-
-    //
-    // Compute the number of micro tiles per row.
-    //
-    microTilesPerRow = pitch / MicroTileWidth;
-
-    //
-    // Compute the micro tile index.
-    //
-    microTileIndexX = x     / MicroTileWidth;
-    microTileIndexY = y     / MicroTileHeight;
-    microTileIndexZ = slice / microTileThickness;
-
-    //
-    // Compute the slice offset.
-    //
-    sliceOffset = static_cast<UINT_64>(microTileIndexZ) * sliceBytes;
-
-    //
-    // Compute the offset to the micro tile containing the specified coordinate.
-    //
-    microTileOffset = (static_cast<UINT_64>(microTileIndexY) * microTilesPerRow + microTileIndexX) *
-        microTileBytes;
-
-    //
-    // Compute the pixel index within the micro tile.
-    //
-    pixelIndex = ComputePixelIndexWithinMicroTile(x,
-                                                  y,
-                                                  slice,
-                                                  bpp,
-                                                  tileMode,
-                                                  microTileType);
-
-    // Compute the sample offset.
-    //
-    if (isDepthSampleOrder)
-    {
-        //
-        // For depth surfaces, samples are stored contiguously for each element, so the sample
-        // offset is the sample number times the element size.
-        //
-        sampleOffset = sample * bpp;
-        pixelOffset = pixelIndex * bpp * numSamples;
-    }
-    else
-    {
-        //
-        // For color surfaces, all elements for a particular sample are stored contiguously, so
-        // the sample offset is the sample number times the micro tile size divided yBit the number
-        // of samples.
-        //
-        sampleOffset = sample * (microTileBytes*8 / numSamples);
-        pixelOffset = pixelIndex * bpp;
-    }
-
-    //
-    // Compute the bit position of the pixel.  Each element is stored with one bit per sample.
-    //
-
-    UINT_32 elemOffset = sampleOffset + pixelOffset;
-
-    *pBitPosition = elemOffset % 8;
-    elemOffset /= 8;
-
-    //
-    // Combine the slice offset, micro tile offset, sample offset, and pixel offsets.
-    //
-    addr = sliceOffset + microTileOffset + elemOffset;
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputePixelCoordFromOffset
-*
-*   @brief
-*       Compute pixel coordinate from offset inside a micro tile
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID EgBasedLib::HwlComputePixelCoordFromOffset(
-    UINT_32         offset,             ///< [in] offset inside micro tile in bits
-    UINT_32         bpp,                ///< [in] bits per pixel
-    UINT_32         numSamples,         ///< [in] number of samples
-    AddrTileMode    tileMode,           ///< [in] tile mode
-    UINT_32         tileBase,           ///< [in] base offset within a tile
-    UINT_32         compBits,           ///< [in] component bits actually needed(for planar surface)
-    UINT_32*        pX,                 ///< [out] x coordinate
-    UINT_32*        pY,                 ///< [out] y coordinate
-    UINT_32*        pSlice,             ///< [out] slice index
-    UINT_32*        pSample,            ///< [out] sample index
-    AddrTileType    microTileType,      ///< [in] micro tiling type
-    BOOL_32         isDepthSampleOrder  ///< [in] TRUE if depth sample order in microtile is used
-    ) const
-{
-    UINT_32 x = 0;
-    UINT_32 y = 0;
-    UINT_32 z = 0;
-    UINT_32 thickness = Thickness(tileMode);
-
-    // For planar surface, we adjust offset acoording to tile base
-    if ((bpp != compBits) && (compBits != 0) && isDepthSampleOrder)
-    {
-        offset -= tileBase;
-
-        ADDR_ASSERT(microTileType == ADDR_NON_DISPLAYABLE ||
-                    microTileType == ADDR_DEPTH_SAMPLE_ORDER);
-
-        bpp = compBits;
-    }
-
-    UINT_32 sampleTileBits;
-    UINT_32 samplePixelBits;
-    UINT_32 pixelIndex;
-
-    if (isDepthSampleOrder)
-    {
-        samplePixelBits = bpp * numSamples;
-        pixelIndex = offset / samplePixelBits;
-        *pSample = (offset % samplePixelBits) / bpp;
-    }
-    else
-    {
-        sampleTileBits = MicroTilePixels * bpp * thickness;
-        *pSample = offset / sampleTileBits;
-        pixelIndex = (offset % sampleTileBits) / bpp;
-    }
-
-    if (microTileType != ADDR_THICK)
-    {
-        if (microTileType == ADDR_DISPLAYABLE) // displayable
-        {
-            switch (bpp)
-            {
-                case 8:
-                    x = pixelIndex & 0x7;
-                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,3),_BIT(pixelIndex,4));
-                    break;
-                case 16:
-                    x = pixelIndex & 0x7;
-                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,3));
-                    break;
-                case 32:
-                    x = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,1),_BIT(pixelIndex,0));
-                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,2));
-                    break;
-                case 64:
-                    x = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
-                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,1));
-                    break;
-                case 128:
-                    x = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,2),_BIT(pixelIndex,1));
-                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,0));
-                    break;
-                default:
-                    break;
-            }
-        }
-        else if (microTileType == ADDR_NON_DISPLAYABLE || microTileType == ADDR_DEPTH_SAMPLE_ORDER)
-        {
-            x = Bits2Number(3, _BIT(pixelIndex,4),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
-            y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,3),_BIT(pixelIndex,1));
-        }
-        else if (microTileType == ADDR_ROTATED)
-        {
-            /*
-                8-Bit Elements
-                element_index[5:0] = { x[2], x[0], x[1], y[2], y[1], y[0] }
-
-                16-Bit Elements
-                element_index[5:0] = { x[2], x[1], x[0], y[2], y[1], y[0] }
-
-                32-Bit Elements
-                element_index[5:0] = { x[2], x[1], y[2], x[0], y[1], y[0] }
-
-                64-Bit Elements
-                element_index[5:0] = { y[2], x[2], x[1], y[1], x[0], y[0] }
-            */
-            switch(bpp)
-            {
-                case 8:
-                    x = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,3),_BIT(pixelIndex,4));
-                    y = pixelIndex & 0x7;
-                    break;
-                case 16:
-                    x = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,3));
-                    y = pixelIndex & 0x7;
-                    break;
-                case 32:
-                    x = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,2));
-                    y = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,1),_BIT(pixelIndex,0));
-                    break;
-                case 64:
-                    x = Bits2Number(3, _BIT(pixelIndex,4),_BIT(pixelIndex,3),_BIT(pixelIndex,1));
-                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    break;
-            }
-        }
-
-        if (thickness > 1) // thick
-        {
-            z = Bits2Number(3, _BIT(pixelIndex,8),_BIT(pixelIndex,7),_BIT(pixelIndex,6));
-        }
-    }
-    else
-    {
-        ADDR_ASSERT((m_chipFamily >= ADDR_CHIP_FAMILY_CI) && (thickness > 1));
-        /*
-            8-Bit Elements and 16-Bit Elements
-            element_index[7:0] = { y[2], x[2], z[1], z[0], y[1], x[1], y[0], x[0] }
-
-            32-Bit Elements
-            element_index[7:0] = { y[2], x[2], z[1], y[1], z[0], x[1], y[0], x[0] }
-
-            64-Bit Elements and 128-Bit Elements
-            element_index[7:0] = { y[2], x[2], z[1], y[1], x[1], z[0], y[0], x[0] }
-
-            The equation to compute the element index for the extra thick tile:
-            element_index[8] = z[2]
-        */
-        switch (bpp)
-        {
-            case 8:
-            case 16: // fall-through
-                x = Bits2Number(3, _BIT(pixelIndex,6),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
-                y = Bits2Number(3, _BIT(pixelIndex,7),_BIT(pixelIndex,3),_BIT(pixelIndex,1));
-                z = Bits2Number(2, _BIT(pixelIndex,5),_BIT(pixelIndex,4));
-                break;
-            case 32:
-                x = Bits2Number(3, _BIT(pixelIndex,6),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
-                y = Bits2Number(3, _BIT(pixelIndex,7),_BIT(pixelIndex,4),_BIT(pixelIndex,1));
-                z = Bits2Number(2, _BIT(pixelIndex,5),_BIT(pixelIndex,3));
-                break;
-            case 64:
-            case 128: // fall-through
-                x = Bits2Number(3, _BIT(pixelIndex,6),_BIT(pixelIndex,3),_BIT(pixelIndex,0));
-                y = Bits2Number(3, _BIT(pixelIndex,7),_BIT(pixelIndex,4),_BIT(pixelIndex,1));
-                z = Bits2Number(2, _BIT(pixelIndex,5),_BIT(pixelIndex,2));
-                break;
-            default:
-                ADDR_ASSERT_ALWAYS();
-                break;
-        }
-
-        if (thickness == 8)
-        {
-            z += Bits2Number(3,_BIT(pixelIndex,8),0,0);
-        }
-    }
-
-    *pX = x;
-    *pY = y;
-    *pSlice += z;
-}
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::DispatchComputeSurfaceCoordFromAddrDispatch
-*
-*   @brief
-*       Compute (x,y,slice,sample) coordinates from surface address
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID EgBasedLib::DispatchComputeSurfaceCoordFromAddr(
-    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
-    ) const
-{
-    UINT_64             addr               = pIn->addr;
-    UINT_32             bitPosition        = pIn->bitPosition;
-    UINT_32             bpp                = pIn->bpp;
-    UINT_32             pitch              = pIn->pitch;
-    UINT_32             height             = pIn->height;
-    UINT_32             numSlices          = pIn->numSlices;
-    UINT_32             numSamples         = ((pIn->numSamples == 0) ? 1 : pIn->numSamples);
-    UINT_32             numFrags           = ((pIn->numFrags == 0) ? numSamples : pIn->numFrags);
-    AddrTileMode        tileMode           = pIn->tileMode;
-    UINT_32             tileBase           = pIn->tileBase;
-    UINT_32             compBits           = pIn->compBits;
-    AddrTileType        microTileType      = pIn->tileType;
-    BOOL_32             ignoreSE           = pIn->ignoreSE;
-    BOOL_32             isDepthSampleOrder = pIn->isDepth;
-    ADDR_TILEINFO*      pTileInfo          = pIn->pTileInfo;
-
-    UINT_32*            pX                 = &pOut->x;
-    UINT_32*            pY                 = &pOut->y;
-    UINT_32*            pSlice             = &pOut->slice;
-    UINT_32*            pSample            = &pOut->sample;
-
-    if (microTileType == ADDR_DEPTH_SAMPLE_ORDER)
-    {
-        isDepthSampleOrder = TRUE;
-    }
-
-    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
-    {
-        if (numFrags != numSamples)
-        {
-            numSamples = numFrags;
-        }
-
-        /// @note
-        /// 128 bit/thick tiled surface doesn't support display tiling and
-        /// mipmap chain must have the same tileType, so please fill tileType correctly
-        if (IsLinear(pIn->tileMode) == FALSE)
-        {
-            if (bpp >= 128 || Thickness(tileMode) > 1)
-            {
-                ADDR_ASSERT(microTileType != ADDR_DISPLAYABLE);
-            }
-        }
-    }
-
-    switch (tileMode)
-    {
-        case ADDR_TM_LINEAR_GENERAL://fall through
-        case ADDR_TM_LINEAR_ALIGNED:
-            ComputeSurfaceCoordFromAddrLinear(addr,
-                                              bitPosition,
-                                              bpp,
-                                              pitch,
-                                              height,
-                                              numSlices,
-                                              pX,
-                                              pY,
-                                              pSlice,
-                                              pSample);
-            break;
-        case ADDR_TM_1D_TILED_THIN1://fall through
-        case ADDR_TM_1D_TILED_THICK:
-            ComputeSurfaceCoordFromAddrMicroTiled(addr,
-                                                  bitPosition,
-                                                  bpp,
-                                                  pitch,
-                                                  height,
-                                                  numSamples,
-                                                  tileMode,
-                                                  tileBase,
-                                                  compBits,
-                                                  pX,
-                                                  pY,
-                                                  pSlice,
-                                                  pSample,
-                                                  microTileType,
-                                                  isDepthSampleOrder);
-            break;
-        case ADDR_TM_2D_TILED_THIN1:    //fall through
-        case ADDR_TM_2D_TILED_THICK:    //fall through
-        case ADDR_TM_3D_TILED_THIN1:    //fall through
-        case ADDR_TM_3D_TILED_THICK:    //fall through
-        case ADDR_TM_2D_TILED_XTHICK:   //fall through
-        case ADDR_TM_3D_TILED_XTHICK:   //fall through
-        case ADDR_TM_PRT_TILED_THIN1:   //fall through
-        case ADDR_TM_PRT_2D_TILED_THIN1://fall through
-        case ADDR_TM_PRT_3D_TILED_THIN1://fall through
-        case ADDR_TM_PRT_TILED_THICK:   //fall through
-        case ADDR_TM_PRT_2D_TILED_THICK://fall through
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            UINT_32 pipeSwizzle;
-            UINT_32 bankSwizzle;
-
-            if (m_configFlags.useCombinedSwizzle)
-            {
-                ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
-                                       &bankSwizzle, &pipeSwizzle);
-            }
-            else
-            {
-                pipeSwizzle = pIn->pipeSwizzle;
-                bankSwizzle = pIn->bankSwizzle;
-            }
-
-            ComputeSurfaceCoordFromAddrMacroTiled(addr,
-                                                  bitPosition,
-                                                  bpp,
-                                                  pitch,
-                                                  height,
-                                                  numSamples,
-                                                  tileMode,
-                                                  tileBase,
-                                                  compBits,
-                                                  microTileType,
-                                                  ignoreSE,
-                                                  isDepthSampleOrder,
-                                                  pipeSwizzle,
-                                                  bankSwizzle,
-                                                  pTileInfo,
-                                                  pX,
-                                                  pY,
-                                                  pSlice,
-                                                  pSample);
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-    }
-}
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled
-*
-*   @brief
-*       Compute surface coordinates from address for macro tiled surface
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled(
-    UINT_64             addr,               ///< [in] byte address
-    UINT_32             bitPosition,        ///< [in] bit position
-    UINT_32             bpp,                ///< [in] bits per pixel
-    UINT_32             pitch,              ///< [in] pitch in pixels
-    UINT_32             height,             ///< [in] height in pixels
-    UINT_32             numSamples,         ///< [in] number of samples
-    AddrTileMode        tileMode,           ///< [in] tile mode
-    UINT_32             tileBase,           ///< [in] tile base offset
-    UINT_32             compBits,           ///< [in] component bits (for planar surface)
-    AddrTileType        microTileType,      ///< [in] micro tiling type
-    BOOL_32             ignoreSE,           ///< [in] TRUE if shader engines can be ignored
-    BOOL_32             isDepthSampleOrder, ///< [in] TRUE if depth sample order is used
-    UINT_32             pipeSwizzle,        ///< [in] pipe swizzle
-    UINT_32             bankSwizzle,        ///< [in] bank swizzle
-    ADDR_TILEINFO*      pTileInfo,          ///< [in] bank structure.
-                                            ///  **All fields to be valid on entry**
-    UINT_32*            pX,                 ///< [out] X coord
-    UINT_32*            pY,                 ///< [out] Y coord
-    UINT_32*            pSlice,             ///< [out] slice index
-    UINT_32*            pSample             ///< [out] sample index
-    ) const
-{
-    UINT_32 mx;
-    UINT_32 my;
-    UINT_64 tileBits;
-    UINT_64 macroTileBits;
-    UINT_32 slices;
-    UINT_32 tileSlices;
-    UINT_64 elementOffset;
-    UINT_64 macroTileIndex;
-    UINT_32 tileIndex;
-    UINT_64 totalOffset;
-
-
-    UINT_32 bank;
-    UINT_32 pipe;
-    UINT_32 groupBits = m_pipeInterleaveBytes << 3;
-    UINT_32 pipes = HwlGetPipes(pTileInfo);
-    UINT_32 banks = pTileInfo->banks;
-
-    UINT_32 bankInterleave = m_bankInterleave;
-
-    UINT_64 addrBits = BYTES_TO_BITS(addr) + bitPosition;
-
-    //
-    // remove bits for bank and pipe
-    //
-    totalOffset = (addrBits % groupBits) +
-        (((addrBits / groupBits / pipes) % bankInterleave) * groupBits) +
-        (((addrBits / groupBits / pipes) / bankInterleave) / banks) * groupBits * bankInterleave;
-
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    UINT_32 microTileBits = bpp * microTileThickness * MicroTilePixels * numSamples;
-
-    UINT_32 microTileBytes = BITS_TO_BYTES(microTileBits);
-    //
-    // Determine if tiles need to be split across slices.
-    //
-    // If the size of the micro tile is larger than the tile split size, then the tile will be
-    // split across multiple slices.
-    //
-    UINT_32 slicesPerTile = 1; //_State->TileSlices
-
-    if ((microTileBytes > pTileInfo->tileSplitBytes) && (microTileThickness == 1))
-    {   //don't support for thick mode
-
-        //
-        // Compute the number of slices per tile.
-        //
-        slicesPerTile = microTileBytes / pTileInfo->tileSplitBytes;
-    }
-
-    tileBits = microTileBits / slicesPerTile; // micro tile bits
-
-    // in micro tiles because not MicroTileWidth timed.
-    UINT_32 macroWidth  = pTileInfo->bankWidth * pipes * pTileInfo->macroAspectRatio;
-    // in micro tiles as well
-    UINT_32 macroHeight = pTileInfo->bankHeight * banks / pTileInfo->macroAspectRatio;
-
-    UINT_32 pitchInMacroTiles = pitch / MicroTileWidth / macroWidth;
-
-    macroTileBits = (macroWidth * macroHeight) * tileBits / (banks * pipes);
-
-    macroTileIndex = totalOffset / macroTileBits;
-
-    // pitchMacros * height / heightMacros;  macroTilesPerSlice == _State->SliceMacros
-    UINT_32 macroTilesPerSlice = (pitch / (macroWidth * MicroTileWidth)) * height /
-        (macroHeight * MicroTileWidth);
-
-    slices = static_cast<UINT_32>(macroTileIndex / macroTilesPerSlice);
-
-    *pSlice = static_cast<UINT_32>(slices / slicesPerTile * microTileThickness);
-
-    //
-    // calculate element offset and x[2:0], y[2:0], z[1:0] for thick
-    //
-    tileSlices = slices % slicesPerTile;
-
-    elementOffset  = tileSlices * tileBits;
-    elementOffset += totalOffset % tileBits;
-
-    UINT_32 coordZ = 0;
-
-    HwlComputePixelCoordFromOffset(static_cast<UINT_32>(elementOffset),
-                                   bpp,
-                                   numSamples,
-                                   tileMode,
-                                   tileBase,
-                                   compBits,
-                                   pX,
-                                   pY,
-                                   &coordZ,
-                                   pSample,
-                                   microTileType,
-                                   isDepthSampleOrder);
-
-    macroTileIndex = macroTileIndex % macroTilesPerSlice;
-    *pY += static_cast<UINT_32>(macroTileIndex / pitchInMacroTiles * macroHeight * MicroTileHeight);
-    *pX += static_cast<UINT_32>(macroTileIndex % pitchInMacroTiles * macroWidth * MicroTileWidth);
-
-    *pSlice += coordZ;
-
-    tileIndex = static_cast<UINT_32>((totalOffset % macroTileBits) / tileBits);
-
-    my = (tileIndex / pTileInfo->bankWidth) % pTileInfo->bankHeight * MicroTileHeight;
-    mx = (tileIndex % pTileInfo->bankWidth) * pipes * MicroTileWidth;
-
-    *pY += my;
-    *pX += mx;
-
-    bank = ComputeBankFromAddr(addr, banks, pipes);
-    pipe = ComputePipeFromAddr(addr, pipes);
-
-    HwlComputeSurfaceCoord2DFromBankPipe(tileMode,
-                                         pX,
-                                         pY,
-                                         *pSlice,
-                                         bank,
-                                         pipe,
-                                         bankSwizzle,
-                                         pipeSwizzle,
-                                         tileSlices,
-                                         ignoreSE,
-                                         pTileInfo);
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSurfaceCoord2DFromBankPipe
-*
-*   @brief
-*       Compute surface x,y coordinates from bank/pipe info
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID EgBasedLib::ComputeSurfaceCoord2DFromBankPipe(
-    AddrTileMode        tileMode,   ///< [in] tile mode
-    UINT_32             x,          ///< [in] x coordinate
-    UINT_32             y,          ///< [in] y coordinate
-    UINT_32             slice,      ///< [in] slice index
-    UINT_32             bank,       ///< [in] bank number
-    UINT_32             pipe,       ///< [in] pipe number
-    UINT_32             bankSwizzle,///< [in] bank swizzle
-    UINT_32             pipeSwizzle,///< [in] pipe swizzle
-    UINT_32             tileSlices, ///< [in] slices in a micro tile
-    ADDR_TILEINFO*      pTileInfo,  ///< [in] bank structure. **All fields to be valid on entry**
-    CoordFromBankPipe*  pOutput     ///< [out] pointer to extracted x/y bits
-    ) const
-{
-    UINT_32 yBit3 = 0;
-    UINT_32 yBit4 = 0;
-    UINT_32 yBit5 = 0;
-    UINT_32 yBit6 = 0;
-
-    UINT_32 xBit3 = 0;
-    UINT_32 xBit4 = 0;
-    UINT_32 xBit5 = 0;
-
-    UINT_32 tileSplitRotation;
-
-    UINT_32 numPipes = HwlGetPipes(pTileInfo);
-
-    UINT_32 bankRotation = ComputeBankRotation(tileMode,
-                                               pTileInfo->banks, numPipes);
-
-    UINT_32 pipeRotation = ComputePipeRotation(tileMode, numPipes);
-
-    UINT_32 xBit = x / (MicroTileWidth * pTileInfo->bankWidth * numPipes);
-    UINT_32 yBit = y / (MicroTileHeight * pTileInfo->bankHeight);
-
-    //calculate the bank and pipe before rotation and swizzle
-
-    switch (tileMode)
-    {
-        case ADDR_TM_2D_TILED_THIN1:  //fall through
-        case ADDR_TM_2D_TILED_THICK:  //fall through
-        case ADDR_TM_2D_TILED_XTHICK: //fall through
-        case ADDR_TM_3D_TILED_THIN1:  //fall through
-        case ADDR_TM_3D_TILED_THICK:  //fall through
-        case ADDR_TM_3D_TILED_XTHICK:
-            tileSplitRotation = ((pTileInfo->banks / 2) + 1);
-            break;
-        default:
-            tileSplitRotation =  0;
-            break;
-    }
-
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    bank ^= tileSplitRotation * tileSlices;
-    if (pipeRotation == 0)
-    {
-        bank ^= bankRotation * (slice / microTileThickness) + bankSwizzle;
-        bank %= pTileInfo->banks;
-        pipe ^= pipeSwizzle;
-    }
-    else
-    {
-        bank ^= bankRotation * (slice / microTileThickness) / numPipes + bankSwizzle;
-        bank %= pTileInfo->banks;
-        pipe ^= pipeRotation * (slice / microTileThickness) + pipeSwizzle;
-    }
-
-    if (pTileInfo->macroAspectRatio == 1)
-    {
-        switch (pTileInfo->banks)
-        {
-            case 2:
-                yBit3 = _BIT(bank, 0) ^ _BIT(xBit,0);
-                break;
-            case 4:
-                yBit4 = _BIT(bank, 0) ^ _BIT(xBit,0);
-                yBit3 = _BIT(bank, 1) ^ _BIT(xBit,1);
-                break;
-            case 8:
-                yBit3 = _BIT(bank, 2) ^ _BIT(xBit,2);
-                yBit5 = _BIT(bank, 0) ^ _BIT(xBit,0);
-                yBit4 = _BIT(bank, 1) ^ _BIT(xBit,1) ^ yBit5;
-                break;
-            case 16:
-                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3);
-                yBit4 = _BIT(bank, 2) ^ _BIT(xBit, 2);
-                yBit6 = _BIT(bank, 0) ^ _BIT(xBit, 0);
-                yBit5 = _BIT(bank, 1) ^ _BIT(xBit, 1) ^ yBit6;
-                break;
-            default:
-                break;
-        }
-
-    }
-    else if (pTileInfo->macroAspectRatio == 2)
-    {
-        switch (pTileInfo->banks)
-        {
-            case 2: //xBit3 = yBit3^b0
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,0);
-                break;
-            case 4: //xBit3=yBit4^b0; yBit3=xBit4^b1
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,1);
-                yBit3 = _BIT(bank, 1) ^ _BIT(xBit,1);
-                break;
-            case 8: //xBit4, xBit5, yBit5 are known
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,2);
-                yBit3 = _BIT(bank, 2) ^ _BIT(xBit,2);
-                yBit4 = _BIT(bank, 1) ^ _BIT(xBit,1) ^ _BIT(yBit, 2);
-                break;
-            case 16://x4,x5,x6,y6 are known
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit, 3); //x3 = y6 ^ b0
-                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3); //y3 = x6 ^ b3
-                yBit4 = _BIT(bank, 2) ^ _BIT(xBit, 2); //y4 = x5 ^ b2
-                yBit5 = _BIT(bank, 1) ^ _BIT(xBit, 1) ^ _BIT(yBit, 3); //y5=x4^y6^b1
-                break;
-            default:
-                break;
-        }
-    }
-    else if (pTileInfo->macroAspectRatio == 4)
-    {
-        switch (pTileInfo->banks)
-        {
-            case 4: //yBit3, yBit4
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,1);
-                xBit4 = _BIT(bank, 1) ^ _BIT(yBit,0);
-                break;
-            case 8: //xBit5, yBit4, yBit5
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,2);
-                yBit3 = _BIT(bank, 2) ^ _BIT(xBit,2);
-                xBit4 = _BIT(bank, 1) ^ _BIT(yBit,1) ^  _BIT(yBit,2);
-                break;
-            case 16: //xBit5, xBit6, yBit5, yBit6
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit, 3);//x3 = b0 ^ y6
-                xBit4 = _BIT(bank, 1) ^ _BIT(yBit, 2) ^ _BIT(yBit, 3);//x4 = b1 ^ y5 ^ y6;
-                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3); //y3 = b3 ^ x6;
-                yBit4 = _BIT(bank, 2) ^ _BIT(xBit, 2); //y4 = b2 ^ x5;
-                break;
-            default:
-                break;
-        }
-    }
-    else if (pTileInfo->macroAspectRatio == 8)
-    {
-        switch (pTileInfo->banks)
-        {
-            case 8: //yBit3, yBit4, yBit5
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,2); //x3 = b0 ^ y5;
-                xBit4 = _BIT(bank, 1) ^ _BIT(yBit,1) ^ _BIT(yBit, 2);//x4 = b1 ^ y4 ^ y5;
-                xBit5 = _BIT(bank, 2) ^ _BIT(yBit,0);
-                break;
-            case 16: //xBit6, yBit4, yBit5, yBit6
-                xBit3 = _BIT(bank, 0) ^ _BIT(yBit, 3);//x3 = y6 ^ b0
-                xBit4 = _BIT(bank, 1) ^ _BIT(yBit, 2) ^ _BIT(yBit, 3);//x4 = y5 ^ y6 ^ b1
-                xBit5 = _BIT(bank, 2) ^ _BIT(yBit, 1);//x5 = y4 ^ b2
-                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3); //y3 = x6 ^ b3
-                break;
-            default:
-                break;
-        }
-    }
-
-    pOutput->xBits = xBit;
-    pOutput->yBits = yBit;
-
-    pOutput->xBit3 = xBit3;
-    pOutput->xBit4 = xBit4;
-    pOutput->xBit5 = xBit5;
-    pOutput->yBit3 = yBit3;
-    pOutput->yBit4 = yBit4;
-    pOutput->yBit5 = yBit5;
-    pOutput->yBit6 = yBit6;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlExtractBankPipeSwizzle
-*   @brief
-*       Entry of EgBasedLib ExtractBankPipeSwizzle
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlExtractBankPipeSwizzle(
-    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,   ///< [in] input structure
-    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut   ///< [out] output structure
-    ) const
-{
-    ExtractBankPipeSwizzle(pIn->base256b,
-                           pIn->pTileInfo,
-                           &pOut->bankSwizzle,
-                           &pOut->pipeSwizzle);
-
-    return ADDR_OK;
-}
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlCombineBankPipeSwizzle
-*   @brief
-*       Combine bank/pipe swizzle
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlCombineBankPipeSwizzle(
-    UINT_32         bankSwizzle,    ///< [in] bank swizzle
-    UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
-    ADDR_TILEINFO*  pTileInfo,      ///< [in] tile info
-    UINT_64         baseAddr,       ///< [in] base address
-    UINT_32*        pTileSwizzle    ///< [out] combined swizzle
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    if (pTileSwizzle)
-    {
-        *pTileSwizzle = GetBankPipeSwizzle(bankSwizzle, pipeSwizzle, baseAddr, pTileInfo);
-    }
-    else
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeBaseSwizzle
-*   @brief
-*       Compute base swizzle
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeBaseSwizzle(
-    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
-    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut
-    ) const
-{
-    UINT_32 bankSwizzle = 0;
-    UINT_32 pipeSwizzle = 0;
-    ADDR_TILEINFO* pTileInfo = pIn->pTileInfo;
-
-    ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
-    ADDR_ASSERT(pIn->pTileInfo);
-
-    /// This is a legacy misreading of h/w doc, use it as it doesn't hurt.
-    static const UINT_8 bankRotationArray[4][16] = {
-        { 0, 0,  0, 0,  0, 0,  0, 0, 0,  0, 0,  0, 0,  0, 0, 0 }, // ADDR_SURF_2_BANK
-        { 0, 1,  2, 3,  0, 0,  0, 0, 0,  0, 0,  0, 0,  0, 0, 0 }, // ADDR_SURF_4_BANK
-        { 0, 3,  6, 1,  4, 7,  2, 5, 0,  0, 0,  0, 0,  0, 0, 0 }, // ADDR_SURF_8_BANK
-        { 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 }, // ADDR_SURF_16_BANK
-    };
-
-    UINT_32 pipes = HwlGetPipes(pTileInfo);
-    (void)pipes;
-    UINT_32 banks = pTileInfo ? pTileInfo->banks : 2;
-    UINT_32 hwNumBanks;
-
-    // Uses less bank swizzle bits
-    if (pIn->option.reduceBankBit && banks > 2)
-    {
-        banks >>= 1;
-    }
-
-    switch (banks)
-    {
-        case 2:
-            hwNumBanks = 0;
-            break;
-        case 4:
-            hwNumBanks = 1;
-            break;
-        case 8:
-            hwNumBanks = 2;
-            break;
-        case 16:
-            hwNumBanks = 3;
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-            hwNumBanks = 0;
-            break;
-    }
-
-    if (pIn->option.genOption == ADDR_SWIZZLE_GEN_LINEAR)
-    {
-        bankSwizzle = pIn->surfIndex & (banks - 1);
-    }
-    else // (pIn->option.genOption == ADDR_SWIZZLE_GEN_DEFAULT)
-    {
-        bankSwizzle = bankRotationArray[hwNumBanks][pIn->surfIndex & (banks - 1)];
-    }
-
-    if (IsMacro3dTiled(pIn->tileMode))
-    {
-        pipeSwizzle = pIn->surfIndex & (HwlGetPipes(pTileInfo) - 1);
-    }
-
-    return HwlCombineBankPipeSwizzle(bankSwizzle, pipeSwizzle, pTileInfo, 0, &pOut->tileSwizzle);
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ExtractBankPipeSwizzle
-*   @brief
-*       Extract bank/pipe swizzle from base256b
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID EgBasedLib::ExtractBankPipeSwizzle(
-    UINT_32         base256b,       ///< [in] input base256b register value
-    ADDR_TILEINFO*  pTileInfo,      ///< [in] 2D tile parameters. Client must provide all data
-    UINT_32*        pBankSwizzle,   ///< [out] bank swizzle
-    UINT_32*        pPipeSwizzle    ///< [out] pipe swizzle
-    ) const
-{
-    UINT_32 bankSwizzle = 0;
-    UINT_32 pipeSwizzle = 0;
-
-    if (base256b != 0)
-    {
-        UINT_32 numPipes        = HwlGetPipes(pTileInfo);
-        UINT_32 bankBits        = QLog2(pTileInfo->banks);
-        UINT_32 pipeBits        = QLog2(numPipes);
-        UINT_32 groupBytes      = m_pipeInterleaveBytes;
-        UINT_32 bankInterleave  = m_bankInterleave;
-
-        pipeSwizzle =
-            (base256b / (groupBytes >> 8)) & ((1<<pipeBits)-1);
-
-        bankSwizzle =
-            (base256b / (groupBytes >> 8) / numPipes / bankInterleave) & ((1 << bankBits) - 1);
-    }
-
-    *pPipeSwizzle = pipeSwizzle;
-    *pBankSwizzle = bankSwizzle;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::GetBankPipeSwizzle
-*   @brief
-*       Combine bank/pipe swizzle
-*   @return
-*       Base256b bits (only filled bank/pipe bits)
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::GetBankPipeSwizzle(
-    UINT_32         bankSwizzle,    ///< [in] bank swizzle
-    UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
-    UINT_64         baseAddr,       ///< [in] base address
-    ADDR_TILEINFO*  pTileInfo       ///< [in] tile info
-    ) const
-{
-    UINT_32 pipeBits = QLog2(HwlGetPipes(pTileInfo));
-    UINT_32 bankInterleaveBits = QLog2(m_bankInterleave);
-    UINT_32 tileSwizzle = pipeSwizzle + ((bankSwizzle << bankInterleaveBits) << pipeBits);
-
-    baseAddr ^= tileSwizzle * m_pipeInterleaveBytes;
-    baseAddr >>= 8;
-
-    return static_cast<UINT_32>(baseAddr);
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeSliceTileSwizzle
-*   @brief
-*       Compute cubemap/3d texture faces/slices tile swizzle
-*   @return
-*       Tile swizzle
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputeSliceTileSwizzle(
-    AddrTileMode        tileMode,       ///< [in] Tile mode
-    UINT_32             baseSwizzle,    ///< [in] Base swizzle
-    UINT_32             slice,          ///< [in] Slice index, Cubemap face index, 0 means +X
-    UINT_64             baseAddr,       ///< [in] Base address
-    ADDR_TILEINFO* pTileInfo       ///< [in] Bank structure
-    ) const
-{
-    UINT_32 tileSwizzle = 0;
-
-    if (IsMacroTiled(tileMode)) // Swizzle only for macro tile mode
-    {
-        UINT_32 firstSlice = slice / Thickness(tileMode);
-
-        UINT_32 numPipes = HwlGetPipes(pTileInfo);
-        UINT_32 numBanks = pTileInfo->banks;
-
-        UINT_32 pipeRotation;
-        UINT_32 bankRotation;
-
-        UINT_32 bankSwizzle = 0;
-        UINT_32 pipeSwizzle = 0;
-
-        pipeRotation = ComputePipeRotation(tileMode, numPipes);
-        bankRotation = ComputeBankRotation(tileMode, numBanks, numPipes);
-
-        if (baseSwizzle != 0)
-        {
-            ExtractBankPipeSwizzle(baseSwizzle,
-                                   pTileInfo,
-                                   &bankSwizzle,
-                                   &pipeSwizzle);
-        }
-
-        if (pipeRotation == 0) //2D mode
-        {
-            bankSwizzle += firstSlice * bankRotation;
-            bankSwizzle %= numBanks;
-        }
-        else //3D mode
-        {
-            pipeSwizzle += firstSlice * pipeRotation;
-            pipeSwizzle %= numPipes;
-            bankSwizzle += firstSlice * bankRotation / numPipes;
-            bankSwizzle %= numBanks;
-        }
-
-        tileSwizzle = GetBankPipeSwizzle(bankSwizzle,
-                                         pipeSwizzle,
-                                         baseAddr,
-                                         pTileInfo);
-    }
-
-    return tileSwizzle;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeQbStereoRightSwizzle
-*
-*   @brief
-*       Compute right eye swizzle
-*   @return
-*       swizzle
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::HwlComputeQbStereoRightSwizzle(
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo  ///< [in] Surface info, must be valid
-    ) const
-{
-    UINT_32 bankBits    = 0;
-    UINT_32 swizzle     = 0;
-
-    // The assumption is default swizzle for left eye is 0
-    if (IsMacroTiled(pInfo->tileMode) && pInfo->pStereoInfo && pInfo->pTileInfo)
-    {
-        bankBits = ComputeBankFromCoord(0, pInfo->height, 0,
-                                        pInfo->tileMode, 0, 0, pInfo->pTileInfo);
-
-        if (bankBits)
-        {
-            HwlCombineBankPipeSwizzle(bankBits, 0, pInfo->pTileInfo, 0, &swizzle);
-        }
-    }
-
-    return swizzle;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeBankFromCoord
-*
-*   @brief
-*       Compute bank number from coordinates
-*   @return
-*       Bank number
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputeBankFromCoord(
-    UINT_32         x,              ///< [in] x coordinate
-    UINT_32         y,              ///< [in] y coordinate
-    UINT_32         slice,          ///< [in] slice index
-    AddrTileMode    tileMode,       ///< [in] tile mode
-    UINT_32         bankSwizzle,    ///< [in] bank swizzle
-    UINT_32         tileSplitSlice, ///< [in] If the size of the pixel offset is larger than the
-                                    ///  tile split size, then the pixel will be moved to a separate
-                                    ///  slice. This value equals pixelOffset / tileSplitBytes
-                                    ///  in this case. Otherwise this is 0.
-    ADDR_TILEINFO*  pTileInfo       ///< [in] tile info
-    ) const
-{
-    UINT_32 pipes = HwlGetPipes(pTileInfo);
-    UINT_32 bankBit0 = 0;
-    UINT_32 bankBit1 = 0;
-    UINT_32 bankBit2 = 0;
-    UINT_32 bankBit3 = 0;
-    UINT_32 sliceRotation;
-    UINT_32 tileSplitRotation;
-    UINT_32 bank;
-    UINT_32 numBanks    = pTileInfo->banks;
-    UINT_32 bankWidth   = pTileInfo->bankWidth;
-    UINT_32 bankHeight  = pTileInfo->bankHeight;
-
-    UINT_32 tx = x / MicroTileWidth / (bankWidth * pipes);
-    UINT_32 ty = y / MicroTileHeight / bankHeight;
-
-    UINT_32 x3 = _BIT(tx,0);
-    UINT_32 x4 = _BIT(tx,1);
-    UINT_32 x5 = _BIT(tx,2);
-    UINT_32 x6 = _BIT(tx,3);
-    UINT_32 y3 = _BIT(ty,0);
-    UINT_32 y4 = _BIT(ty,1);
-    UINT_32 y5 = _BIT(ty,2);
-    UINT_32 y6 = _BIT(ty,3);
-
-    switch (numBanks)
-    {
-        case 16:
-            bankBit0 = x3 ^ y6;
-            bankBit1 = x4 ^ y5 ^ y6;
-            bankBit2 = x5 ^ y4;
-            bankBit3 = x6 ^ y3;
-            break;
-        case 8:
-            bankBit0 = x3 ^ y5;
-            bankBit1 = x4 ^ y4 ^ y5;
-            bankBit2 = x5 ^ y3;
-            break;
-        case 4:
-            bankBit0 = x3 ^ y4;
-            bankBit1 = x4 ^ y3;
-            break;
-        case 2:
-            bankBit0 = x3 ^ y3;
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-            break;
-    }
-
-    bank = bankBit0 | (bankBit1 << 1) | (bankBit2 << 2) | (bankBit3 << 3);
-
-    //Bits2Number(4, bankBit3, bankBit2, bankBit1, bankBit0);
-
-    bank = HwlPreAdjustBank((x / MicroTileWidth), bank, pTileInfo);
-    //
-    // Compute bank rotation for the slice.
-    //
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    switch (tileMode)
-    {
-        case ADDR_TM_2D_TILED_THIN1:  // fall through
-        case ADDR_TM_2D_TILED_THICK:  // fall through
-        case ADDR_TM_2D_TILED_XTHICK:
-            sliceRotation = ((numBanks / 2) - 1) * (slice / microTileThickness);
-            break;
-        case ADDR_TM_3D_TILED_THIN1:  // fall through
-        case ADDR_TM_3D_TILED_THICK:  // fall through
-        case ADDR_TM_3D_TILED_XTHICK:
-            sliceRotation =
-                Max(1u, (pipes / 2) - 1) * (slice / microTileThickness) / pipes;
-            break;
-        default:
-            sliceRotation =  0;
-            break;
-    }
-
-
-    //
-    // Compute bank rotation for the tile split slice.
-    //
-    // The sample slice will be non-zero if samples must be split across multiple slices.
-    // This situation arises when the micro tile size multiplied yBit the number of samples exceeds
-    // the split size (set in GB_ADDR_CONFIG).
-    //
-    switch (tileMode)
-    {
-        case ADDR_TM_2D_TILED_THIN1: //fall through
-        case ADDR_TM_3D_TILED_THIN1: //fall through
-        case ADDR_TM_PRT_2D_TILED_THIN1: //fall through
-        case ADDR_TM_PRT_3D_TILED_THIN1: //fall through
-            tileSplitRotation = ((numBanks / 2) + 1) * tileSplitSlice;
-            break;
-        default:
-            tileSplitRotation =  0;
-            break;
-    }
-
-    //
-    // Apply bank rotation for the slice and tile split slice.
-    //
-    bank ^= bankSwizzle + sliceRotation;
-    bank ^= tileSplitRotation;
-
-    bank &= (numBanks - 1);
-
-    return bank;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeBankFromAddr
-*
-*   @brief
-*       Compute the bank number from an address
-*   @return
-*       Bank number
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputeBankFromAddr(
-    UINT_64 addr,       ///< [in] address
-    UINT_32 numBanks,   ///< [in] number of banks
-    UINT_32 numPipes    ///< [in] number of pipes
-    ) const
-{
-    UINT_32 bank;
-
-    //
-    // The LSBs of the address are arranged as follows:
-    //   bank | bankInterleave | pipe | pipeInterleave
-    //
-    // To get the bank number, shift off the pipe interleave, pipe, and bank interlave bits and
-    // mask the bank bits.
-    //
-    bank = static_cast<UINT_32>(
-        (addr >> Log2(m_pipeInterleaveBytes * numPipes * m_bankInterleave)) &
-        (numBanks - 1)
-        );
-
-    return bank;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputePipeRotation
-*
-*   @brief
-*       Compute pipe rotation value
-*   @return
-*       Pipe rotation
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputePipeRotation(
-    AddrTileMode tileMode,  ///< [in] tile mode
-    UINT_32      numPipes   ///< [in] number of pipes
-    ) const
-{
-   UINT_32 rotation;
-
-    switch (tileMode)
-    {
-        case ADDR_TM_3D_TILED_THIN1:        //fall through
-        case ADDR_TM_3D_TILED_THICK:        //fall through
-        case ADDR_TM_3D_TILED_XTHICK:       //fall through
-        case ADDR_TM_PRT_3D_TILED_THIN1:    //fall through
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            rotation = (numPipes < 4) ? 1 : (numPipes / 2 - 1);
-            break;
-        default:
-            rotation = 0;
-    }
-
-    return rotation;
-}
-
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeBankRotation
-*
-*   @brief
-*       Compute bank rotation value
-*   @return
-*       Bank rotation
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputeBankRotation(
-    AddrTileMode tileMode,  ///< [in] tile mode
-    UINT_32      numBanks,  ///< [in] number of banks
-    UINT_32      numPipes   ///< [in] number of pipes
-    ) const
-{
-    UINT_32 rotation;
-
-    switch (tileMode)
-    {
-        case ADDR_TM_2D_TILED_THIN1: // fall through
-        case ADDR_TM_2D_TILED_THICK: // fall through
-        case ADDR_TM_2D_TILED_XTHICK:
-        case ADDR_TM_PRT_2D_TILED_THIN1:
-        case ADDR_TM_PRT_2D_TILED_THICK:
-            // Rotate banks per Z-slice yBit 1 for 4-bank or 3 for 8-bank
-            rotation =  numBanks / 2 - 1;
-            break;
-        case ADDR_TM_3D_TILED_THIN1: // fall through
-        case ADDR_TM_3D_TILED_THICK: // fall through
-        case ADDR_TM_3D_TILED_XTHICK:
-        case ADDR_TM_PRT_3D_TILED_THIN1:
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            rotation = (numPipes < 4) ? 1 : (numPipes / 2 - 1);    // rotate pipes & banks
-            break;
-        default:
-            rotation = 0;
-    }
-
-    return rotation;
-}
-
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeHtileBytes
-*
-*   @brief
-*       Compute htile size in bytes
-*
-*   @return
-*       Htile size in bytes
-****************************************************************************************************
-*/
-UINT_64 EgBasedLib::ComputeHtileBytes(
-    UINT_32 pitch,        ///< [in] pitch
-    UINT_32 height,       ///< [in] height
-    UINT_32 bpp,          ///< [in] bits per pixel
-    BOOL_32 isLinear,     ///< [in] if it is linear mode
-    UINT_32 numSlices,    ///< [in] number of slices
-    UINT_64* sliceBytes,  ///< [out] bytes per slice
-    UINT_32 baseAlign     ///< [in] base alignments
-    ) const
-{
-    UINT_64 surfBytes;
-
-    const UINT_64 HtileCacheLineSize = BITS_TO_BYTES(HtileCacheBits);
-
-    *sliceBytes = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp / 64);
-
-    if (m_configFlags.useHtileSliceAlign)
-    {
-        // Align the sliceSize to htilecachelinesize * pipes at first
-        *sliceBytes = PowTwoAlign(*sliceBytes, HtileCacheLineSize * m_pipes);
-        surfBytes  = *sliceBytes * numSlices;
-    }
-    else
-    {
-        // Align the surfSize to htilecachelinesize * pipes at last
-        surfBytes  = *sliceBytes * numSlices;
-        surfBytes  = PowTwoAlign(surfBytes, HtileCacheLineSize * m_pipes);
-    }
-
-    return surfBytes;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::DispatchComputeFmaskInfo
-*
-*   @brief
-*       Compute fmask sizes include padded pitch, height, slices, total size in bytes,
-*       meanwhile output suitable tile mode and alignments as well. Results are returned
-*       through output parameters.
-*
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::DispatchComputeFmaskInfo(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut)  ///< [out] output structure
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    ADDR_COMPUTE_SURFACE_INFO_INPUT  surfIn     = {0};
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT surfOut    = {0};
-
-    // Setup input structure
-    surfIn.tileMode          = pIn->tileMode;
-    surfIn.width             = pIn->pitch;
-    surfIn.height            = pIn->height;
-    surfIn.numSlices         = pIn->numSlices;
-    surfIn.pTileInfo         = pIn->pTileInfo;
-    surfIn.tileType          = ADDR_NON_DISPLAYABLE;
-    surfIn.flags.fmask       = 1;
-
-    // Setup output structure
-    surfOut.pTileInfo       = pOut->pTileInfo;
-
-    // Setup hwl specific fields
-    HwlFmaskPreThunkSurfInfo(pIn, pOut, &surfIn, &surfOut);
-
-    surfIn.bpp = HwlComputeFmaskBits(pIn, &surfIn.numSamples);
-
-    // ComputeSurfaceInfo needs numSamples in surfOut as surface routines need adjusted numSamples
-    surfOut.numSamples = surfIn.numSamples;
-
-    retCode = HwlComputeSurfaceInfo(&surfIn, &surfOut);
-
-    // Save bpp field for surface dump support
-    surfOut.bpp = surfIn.bpp;
-
-    if (retCode == ADDR_OK)
-    {
-        pOut->bpp               = surfOut.bpp;
-        pOut->pitch             = surfOut.pitch;
-        pOut->height            = surfOut.height;
-        pOut->numSlices         = surfOut.depth;
-        pOut->fmaskBytes        = surfOut.surfSize;
-        pOut->baseAlign         = surfOut.baseAlign;
-        pOut->pitchAlign        = surfOut.pitchAlign;
-        pOut->heightAlign       = surfOut.heightAlign;
-
-        if (surfOut.depth > 1)
-        {
-            // For fmask, expNumSlices is stored in depth.
-            pOut->sliceSize = surfOut.surfSize / surfOut.depth;
-        }
-        else
-        {
-            pOut->sliceSize = surfOut.surfSize;
-        }
-
-        // Save numSamples field for surface dump support
-        pOut->numSamples        = surfOut.numSamples;
-
-        HwlFmaskPostThunkSurfInfo(&surfOut, pOut);
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlFmaskSurfaceInfo
-*   @brief
-*       Entry of EgBasedLib ComputeFmaskInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskInfo(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut   ///< [out] output structure
-    )
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    ADDR_TILEINFO tileInfo = {0};
-
-    // Use internal tile info if pOut does not have a valid pTileInfo
-    if (pOut->pTileInfo == NULL)
-    {
-        pOut->pTileInfo = &tileInfo;
-    }
-
-    retCode = DispatchComputeFmaskInfo(pIn, pOut);
-
-    if (retCode == ADDR_OK)
-    {
-        pOut->tileIndex =
-            HwlPostCheckTileIndex(pOut->pTileInfo, pIn->tileMode, ADDR_NON_DISPLAYABLE,
-                                  pOut->tileIndex);
-    }
-
-    // Resets pTileInfo to NULL if the internal tile info is used
-    if (pOut->pTileInfo == &tileInfo)
-    {
-        pOut->pTileInfo = NULL;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeFmaskAddrFromCoord
-*   @brief
-*       Entry of EgBasedLib ComputeFmaskAddrFromCoord
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskAddrFromCoord(
-    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeFmaskCoordFromAddr
-*   @brief
-*       Entry of EgBasedLib ComputeFmaskCoordFromAddr
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskCoordFromAddr(
-    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
-    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeFmaskNumPlanesFromNumSamples
-*
-*   @brief
-*       Compute fmask number of planes from number of samples
-*
-*   @return
-*       Number of planes
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputeFmaskNumPlanesFromNumSamples(
-    UINT_32 numSamples)     ///< [in] number of samples
-{
-    UINT_32 numPlanes;
-
-    //
-    // FMASK is stored such that each micro tile is composed of elements containing N bits, where
-    // N is the number of samples.  There is a micro tile for each bit in the FMASK address, and
-    // micro tiles for each address bit, sometimes referred to as a plane, are stored sequentially.
-    // The FMASK for a 2-sample surface looks like a general surface with 2 bits per element.
-    // The FMASK for a 4-sample surface looks like a general surface with 4 bits per element and
-    // 2 samples.  The FMASK for an 8-sample surface looks like a general surface with 8 bits per
-    // element and 4 samples.  R6xx and R7xx only stored 3 planes for 8-sample FMASK surfaces.
-    // This was changed for R8xx to simplify the logic in the CB.
-    //
-    switch (numSamples)
-    {
-        case 2:
-            numPlanes = 1;
-            break;
-        case 4:
-            numPlanes = 2;
-            break;
-        case 8:
-            numPlanes = 4;
-            break;
-        default:
-            ADDR_UNHANDLED_CASE();
-            numPlanes = 0;
-            break;
-    }
-    return numPlanes;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::ComputeFmaskResolvedBppFromNumSamples
-*
-*   @brief
-*       Compute resolved fmask effective bpp based on number of samples
-*
-*   @return
-*       bpp
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::ComputeFmaskResolvedBppFromNumSamples(
-    UINT_32 numSamples)     ///< number of samples
-{
-    UINT_32 bpp;
-
-    //
-    // Resolved FMASK surfaces are generated yBit the CB and read yBit the texture unit
-    // so that the texture unit can read compressed multi-sample color data.
-    // These surfaces store each index value packed per element.
-    // Each element contains at least num_samples * log2(num_samples) bits.
-    // Resolved FMASK surfaces are addressed as follows:
-    // 2-sample Addressed similarly to a color surface with 8 bits per element and 1 sample.
-    // 4-sample Addressed similarly to a color surface with 8 bits per element and 1 sample.
-    // 8-sample Addressed similarly to a color surface with 32 bits per element and 1 sample.
-
-    switch (numSamples)
-    {
-        case 2:
-            bpp = 8;
-            break;
-        case 4:
-            bpp = 8;
-            break;
-        case 8:
-            bpp = 32;
-            break;
-        default:
-            ADDR_UNHANDLED_CASE();
-            bpp = 0;
-            break;
-    }
-    return bpp;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::IsTileInfoAllZero
-*
-*   @brief
-*       Return TRUE if all field are zero
-*   @note
-*       Since NULL input is consider to be all zero
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::IsTileInfoAllZero(
-    const ADDR_TILEINFO* pTileInfo)
-{
-    BOOL_32 allZero = TRUE;
-
-    if (pTileInfo)
-    {
-        if ((pTileInfo->banks            != 0)  ||
-            (pTileInfo->bankWidth        != 0)  ||
-            (pTileInfo->bankHeight       != 0)  ||
-            (pTileInfo->macroAspectRatio != 0)  ||
-            (pTileInfo->tileSplitBytes   != 0)  ||
-            (pTileInfo->pipeConfig       != 0)
-            )
-        {
-            allZero = FALSE;
-        }
-    }
-
-    return allZero;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlTileInfoEqual
-*
-*   @brief
-*       Return TRUE if all field are equal
-*   @note
-*       Only takes care of current HWL's data
-****************************************************************************************************
-*/
-BOOL_32 EgBasedLib::HwlTileInfoEqual(
-    const ADDR_TILEINFO* pLeft, ///<[in] Left compare operand
-    const ADDR_TILEINFO* pRight ///<[in] Right compare operand
-    ) const
-{
-    BOOL_32 equal = FALSE;
-
-    if (pLeft->banks == pRight->banks           &&
-        pLeft->bankWidth == pRight->bankWidth   &&
-        pLeft->bankHeight == pRight->bankHeight &&
-        pLeft->macroAspectRatio == pRight->macroAspectRatio &&
-        pLeft->tileSplitBytes == pRight->tileSplitBytes)
-    {
-        equal = TRUE;
-    }
-
-    return equal;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlConvertTileInfoToHW
-*   @brief
-*       Entry of EgBasedLib ConvertTileInfoToHW
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlConvertTileInfoToHW(
-    const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
-    ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode   = ADDR_OK;
-
-    ADDR_TILEINFO *pTileInfoIn  = pIn->pTileInfo;
-    ADDR_TILEINFO *pTileInfoOut = pOut->pTileInfo;
-
-    if ((pTileInfoIn != NULL) && (pTileInfoOut != NULL))
-    {
-        if (pIn->reverse == FALSE)
-        {
-            switch (pTileInfoIn->banks)
-            {
-                case 2:
-                    pTileInfoOut->banks = 0;
-                    break;
-                case 4:
-                    pTileInfoOut->banks = 1;
-                    break;
-                case 8:
-                    pTileInfoOut->banks = 2;
-                    break;
-                case 16:
-                    pTileInfoOut->banks = 3;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->banks = 0;
-                    break;
-            }
-
-            switch (pTileInfoIn->bankWidth)
-            {
-                case 1:
-                    pTileInfoOut->bankWidth = 0;
-                    break;
-                case 2:
-                    pTileInfoOut->bankWidth = 1;
-                    break;
-                case 4:
-                    pTileInfoOut->bankWidth = 2;
-                    break;
-                case 8:
-                    pTileInfoOut->bankWidth = 3;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->bankWidth = 0;
-                    break;
-            }
-
-            switch (pTileInfoIn->bankHeight)
-            {
-                case 1:
-                    pTileInfoOut->bankHeight = 0;
-                    break;
-                case 2:
-                    pTileInfoOut->bankHeight = 1;
-                    break;
-                case 4:
-                    pTileInfoOut->bankHeight = 2;
-                    break;
-                case 8:
-                    pTileInfoOut->bankHeight = 3;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->bankHeight = 0;
-                    break;
-            }
-
-            switch (pTileInfoIn->macroAspectRatio)
-            {
-                case 1:
-                    pTileInfoOut->macroAspectRatio = 0;
-                    break;
-                case 2:
-                    pTileInfoOut->macroAspectRatio = 1;
-                    break;
-                case 4:
-                    pTileInfoOut->macroAspectRatio = 2;
-                    break;
-                case 8:
-                    pTileInfoOut->macroAspectRatio = 3;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->macroAspectRatio = 0;
-                    break;
-            }
-
-            switch (pTileInfoIn->tileSplitBytes)
-            {
-                case 64:
-                    pTileInfoOut->tileSplitBytes = 0;
-                    break;
-                case 128:
-                    pTileInfoOut->tileSplitBytes = 1;
-                    break;
-                case 256:
-                    pTileInfoOut->tileSplitBytes = 2;
-                    break;
-                case 512:
-                    pTileInfoOut->tileSplitBytes = 3;
-                    break;
-                case 1024:
-                    pTileInfoOut->tileSplitBytes = 4;
-                    break;
-                case 2048:
-                    pTileInfoOut->tileSplitBytes = 5;
-                    break;
-                case 4096:
-                    pTileInfoOut->tileSplitBytes = 6;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->tileSplitBytes = 0;
-                    break;
-            }
-        }
-        else
-        {
-            switch (pTileInfoIn->banks)
-            {
-                case 0:
-                    pTileInfoOut->banks = 2;
-                    break;
-                case 1:
-                    pTileInfoOut->banks = 4;
-                    break;
-                case 2:
-                    pTileInfoOut->banks = 8;
-                    break;
-                case 3:
-                    pTileInfoOut->banks = 16;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->banks = 2;
-                    break;
-            }
-
-            switch (pTileInfoIn->bankWidth)
-            {
-                case 0:
-                    pTileInfoOut->bankWidth = 1;
-                    break;
-                case 1:
-                    pTileInfoOut->bankWidth = 2;
-                    break;
-                case 2:
-                    pTileInfoOut->bankWidth = 4;
-                    break;
-                case 3:
-                    pTileInfoOut->bankWidth = 8;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->bankWidth = 1;
-                    break;
-            }
-
-            switch (pTileInfoIn->bankHeight)
-            {
-                case 0:
-                    pTileInfoOut->bankHeight = 1;
-                    break;
-                case 1:
-                    pTileInfoOut->bankHeight = 2;
-                    break;
-                case 2:
-                    pTileInfoOut->bankHeight = 4;
-                    break;
-                case 3:
-                    pTileInfoOut->bankHeight = 8;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->bankHeight = 1;
-                    break;
-            }
-
-            switch (pTileInfoIn->macroAspectRatio)
-            {
-                case 0:
-                    pTileInfoOut->macroAspectRatio = 1;
-                    break;
-                case 1:
-                    pTileInfoOut->macroAspectRatio = 2;
-                    break;
-                case 2:
-                    pTileInfoOut->macroAspectRatio = 4;
-                    break;
-                case 3:
-                    pTileInfoOut->macroAspectRatio = 8;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->macroAspectRatio = 1;
-                    break;
-            }
-
-            switch (pTileInfoIn->tileSplitBytes)
-            {
-                case 0:
-                    pTileInfoOut->tileSplitBytes = 64;
-                    break;
-                case 1:
-                    pTileInfoOut->tileSplitBytes = 128;
-                    break;
-                case 2:
-                    pTileInfoOut->tileSplitBytes = 256;
-                    break;
-                case 3:
-                    pTileInfoOut->tileSplitBytes = 512;
-                    break;
-                case 4:
-                    pTileInfoOut->tileSplitBytes = 1024;
-                    break;
-                case 5:
-                    pTileInfoOut->tileSplitBytes = 2048;
-                    break;
-                case 6:
-                    pTileInfoOut->tileSplitBytes = 4096;
-                    break;
-                default:
-                    ADDR_ASSERT_ALWAYS();
-                    retCode = ADDR_INVALIDPARAMS;
-                    pTileInfoOut->tileSplitBytes = 64;
-                    break;
-            }
-        }
-
-        if (pTileInfoIn != pTileInfoOut)
-        {
-            pTileInfoOut->pipeConfig = pTileInfoIn->pipeConfig;
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        retCode = ADDR_INVALIDPARAMS;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeSurfaceInfo
-*   @brief
-*       Entry of EgBasedLib ComputeSurfaceInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceInfo(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    if (pIn->numSamples < pIn->numFrags)
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-
-    ADDR_TILEINFO tileInfo = {0};
-
-    if (retCode == ADDR_OK)
-    {
-        // Uses internal tile info if pOut does not have a valid pTileInfo
-        if (pOut->pTileInfo == NULL)
-        {
-            pOut->pTileInfo = &tileInfo;
-        }
-
-        if (DispatchComputeSurfaceInfo(pIn, pOut) == FALSE)
-        {
-            retCode = ADDR_INVALIDPARAMS;
-        }
-
-        // In case client uses tile info as input and would like to calculate a correct size and
-        // alignment together with tile info as output when the tile info is not suppose to have any
-        // matching indices in tile mode tables.
-        if (pIn->flags.skipIndicesOutput == FALSE)
-        {
-            // Returns an index
-            pOut->tileIndex = HwlPostCheckTileIndex(pOut->pTileInfo,
-                                                    pOut->tileMode,
-                                                    pOut->tileType,
-                                                    pOut->tileIndex);
-
-            if (IsMacroTiled(pOut->tileMode) && (pOut->macroModeIndex == TileIndexInvalid))
-            {
-                pOut->macroModeIndex = HwlComputeMacroModeIndex(pOut->tileIndex,
-                                                                pIn->flags,
-                                                                pIn->bpp,
-                                                                pIn->numSamples,
-                                                                pOut->pTileInfo);
-            }
-        }
-
-        // Resets pTileInfo to NULL if the internal tile info is used
-        if (pOut->pTileInfo == &tileInfo)
-        {
-#if DEBUG
-            // Client does not pass in a valid pTileInfo
-            if (IsMacroTiled(pOut->tileMode))
-            {
-                // If a valid index is returned, then no pTileInfo is okay
-                ADDR_ASSERT((m_configFlags.useTileIndex == FALSE) ||
-                            (pOut->tileIndex != TileIndexInvalid));
-
-                if (IsTileInfoAllZero(pIn->pTileInfo) == FALSE)
-                {
-                    // The initial value of pIn->pTileInfo is copied to tileInfo
-                    // We do not expect any of these value to be changed nor any 0 of inputs
-                    ADDR_ASSERT(tileInfo.banks == pIn->pTileInfo->banks);
-                    ADDR_ASSERT(tileInfo.bankWidth == pIn->pTileInfo->bankWidth);
-                    ADDR_ASSERT(tileInfo.bankHeight == pIn->pTileInfo->bankHeight);
-                    ADDR_ASSERT(tileInfo.macroAspectRatio == pIn->pTileInfo->macroAspectRatio);
-                    ADDR_ASSERT(tileInfo.tileSplitBytes == pIn->pTileInfo->tileSplitBytes);
-                }
-            }
-#endif
-            pOut->pTileInfo = NULL;
-        }
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeSurfaceAddrFromCoord
-*   @brief
-*       Entry of EgBasedLib ComputeSurfaceAddrFromCoord
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceAddrFromCoord(
-    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    if (
-#if !ALT_TEST // Overflow test needs this out-of-boundary coord
-        (pIn->x > pIn->pitch)   ||
-        (pIn->y > pIn->height)  ||
-#endif
-        (pIn->numSamples > m_maxSamples))
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        pOut->addr = DispatchComputeSurfaceAddrFromCoord(pIn, pOut);
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeSurfaceCoordFromAddr
-*   @brief
-*       Entry of EgBasedLib ComputeSurfaceCoordFromAddr
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceCoordFromAddr(
-    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    if ((pIn->bitPosition >= 8) ||
-        (pIn->numSamples > m_maxSamples))
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-    else
-    {
-        DispatchComputeSurfaceCoordFromAddr(pIn, pOut);
-    }
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeSliceTileSwizzle
-*   @brief
-*       Entry of EgBasedLib ComputeSurfaceCoordFromAddr
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE EgBasedLib::HwlComputeSliceTileSwizzle(
-    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    if (pIn->pTileInfo && (pIn->pTileInfo->banks > 0))
-    {
-
-        pOut->tileSwizzle = ComputeSliceTileSwizzle(pIn->tileMode,
-                                                    pIn->baseSwizzle,
-                                                    pIn->slice,
-                                                    pIn->baseAddr,
-                                                    pIn->pTileInfo);
-    }
-    else
-    {
-        retCode = ADDR_INVALIDPARAMS;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeHtileBpp
-*
-*   @brief
-*       Compute htile bpp
-*
-*   @return
-*       Htile bpp
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::HwlComputeHtileBpp(
-    BOOL_32 isWidth8,   ///< [in] TRUE if block width is 8
-    BOOL_32 isHeight8   ///< [in] TRUE if block height is 8
-    ) const
-{
-    // only support 8x8 mode
-    ADDR_ASSERT(isWidth8 && isHeight8);
-    return 32;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlComputeHtileBaseAlign
-*
-*   @brief
-*       Compute htile base alignment
-*
-*   @return
-*       Htile base alignment
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::HwlComputeHtileBaseAlign(
-    BOOL_32         isTcCompatible, ///< [in] if TC compatible
-    BOOL_32         isLinear,       ///< [in] if it is linear mode
-    ADDR_TILEINFO*  pTileInfo       ///< [in] Tile info
-    ) const
-{
-    UINT_32 baseAlign = m_pipeInterleaveBytes * HwlGetPipes(pTileInfo);
-
-    if (isTcCompatible)
-    {
-        ADDR_ASSERT(pTileInfo != NULL);
-        if (pTileInfo)
-        {
-            baseAlign *= pTileInfo->banks;
-        }
-    }
-
-    return baseAlign;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlGetPitchAlignmentMicroTiled
-*
-*   @brief
-*       Compute 1D tiled surface pitch alignment, calculation results are returned through
-*       output parameters.
-*
-*   @return
-*       pitch alignment
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::HwlGetPitchAlignmentMicroTiled(
-    AddrTileMode        tileMode,          ///< [in] tile mode
-    UINT_32             bpp,               ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
-    UINT_32             numSamples         ///< [in] number of samples
-    ) const
-{
-    UINT_32 pitchAlign;
-
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    UINT_32 pixelsPerMicroTile;
-    UINT_32 pixelsPerPipeInterleave;
-    UINT_32 microTilesPerPipeInterleave;
-
-    //
-    // Special workaround for depth/stencil buffer, use 8 bpp to meet larger requirement for
-    // stencil buffer since pitch alignment is related to bpp.
-    // For a depth only buffer do not set this.
-    //
-    // Note: this actually does not work for mipmap but mipmap depth texture is not really
-    // sampled with mipmap.
-    //
-    if (flags.depth && (flags.noStencil == FALSE))
-    {
-        bpp = 8;
-    }
-
-    pixelsPerMicroTile = MicroTilePixels * microTileThickness;
-    pixelsPerPipeInterleave = BYTES_TO_BITS(m_pipeInterleaveBytes) / (bpp * numSamples);
-    microTilesPerPipeInterleave = pixelsPerPipeInterleave / pixelsPerMicroTile;
-
-    pitchAlign = Max(MicroTileWidth, microTilesPerPipeInterleave * MicroTileWidth);
-
-    return pitchAlign;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlGetSizeAdjustmentMicroTiled
-*
-*   @brief
-*       Adjust 1D tiled surface pitch and slice size
-*
-*   @return
-*       Logical slice size in bytes
-****************************************************************************************************
-*/
-UINT_64 EgBasedLib::HwlGetSizeAdjustmentMicroTiled(
-    UINT_32             thickness,      ///< [in] thickness
-    UINT_32             bpp,            ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,          ///< [in] surface flags
-    UINT_32             numSamples,     ///< [in] number of samples
-    UINT_32             baseAlign,      ///< [in] base alignment
-    UINT_32             pitchAlign,     ///< [in] pitch alignment
-    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
-    UINT_32*            pHeight         ///< [in,out] pointer to height
-    ) const
-{
-    UINT_64 logicalSliceSize;
-    MAYBE_UNUSED UINT_64 physicalSliceSize;
-
-    UINT_32 pitch   = *pPitch;
-    UINT_32 height  = *pHeight;
-
-    // Logical slice: pitch * height * bpp * numSamples (no 1D MSAA so actually numSamples == 1)
-    logicalSliceSize = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
-
-    // Physical slice: multiplied by thickness
-    physicalSliceSize =  logicalSliceSize * thickness;
-
-    //
-    // R800 will always pad physical slice size to baseAlign which is pipe_interleave_bytes
-    //
-    ADDR_ASSERT((physicalSliceSize % baseAlign) == 0);
-
-    return logicalSliceSize;
-}
-
-/**
-****************************************************************************************************
-*   EgBasedLib::HwlStereoCheckRightOffsetPadding
-*
-*   @brief
-*       check if the height needs extra padding for stereo right eye offset, to avoid swizzling
-*
-*   @return
-*       TRUE is the extra padding is needed
-*
-****************************************************************************************************
-*/
-UINT_32 EgBasedLib::HwlStereoCheckRightOffsetPadding(
-    ADDR_TILEINFO* pTileInfo    ///< Tiling info
-    ) const
-{
-    UINT_32 stereoHeightAlign = 0;
-
-    if (pTileInfo->macroAspectRatio > 2)
-    {
-        // Since 3D rendering treats right eye surface starting from y == "eye height" while
-        // display engine treats it to be 0, so the bank bits may be different.
-        // Additional padding in height is required to make sure it's possible
-        // to achieve synonym by adjusting bank swizzle of right eye surface.
-
-        static const UINT_32 StereoAspectRatio = 2;
-        stereoHeightAlign = pTileInfo->banks *
-            pTileInfo->bankHeight *
-            MicroTileHeight /
-            StereoAspectRatio;
-    }
-
-    return stereoHeightAlign;
-}
-
-} // V1
-} // Addr
diff --git a/src/amd/addrlib/r800/egbaddrlib.h b/src/amd/addrlib/r800/egbaddrlib.h
deleted file mode 100644 (file)
index ee2c689..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Copyright © 2014 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  egbaddrlib.h
-* @brief Contains the EgBasedLib class definition.
-****************************************************************************************************
-*/
-
-#ifndef __EG_BASED_ADDR_LIB_H__
-#define __EG_BASED_ADDR_LIB_H__
-
-#include "addrlib1.h"
-
-namespace Addr
-{
-namespace V1
-{
-/// Structures for functions
-struct CoordFromBankPipe
-{
-    UINT_32 xBits : 3;
-    UINT_32 yBits : 4;
-
-    UINT_32 xBit3 : 1;
-    UINT_32 xBit4 : 1;
-    UINT_32 xBit5 : 1;
-    UINT_32 yBit3 : 1;
-    UINT_32 yBit4 : 1;
-    UINT_32 yBit5 : 1;
-    UINT_32 yBit6 : 1;
-};
-
-/**
-****************************************************************************************************
-* @brief This class is the Evergreen based address library
-* @note  Abstract class
-****************************************************************************************************
-*/
-class EgBasedLib : public Lib
-{
-protected:
-    EgBasedLib(const Client* pClient);
-    virtual ~EgBasedLib();
-
-public:
-
-    /// Surface info functions
-
-    // NOTE: DispatchComputeSurfaceInfo using TileInfo takes both an input and an output.
-    //       On input:
-    //       One or more fields may be 0 to be calculated/defaulted - pre-SI h/w.
-    //       H/W using tile mode index only accepts none or all 0's - SI and newer h/w.
-    //       It then returns the actual tiling configuration used.
-    //       Other methods' TileInfo must be valid on entry
-    BOOL_32 DispatchComputeSurfaceInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    ADDR_E_RETURNCODE DispatchComputeFmaskInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
-
-protected:
-    // Hwl interface
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoord(
-        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceCoordFromAddr(
-        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeSliceTileSwizzle(
-        const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
-        ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlExtractBankPipeSwizzle(
-        const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
-        ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlCombineBankPipeSwizzle(
-        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, ADDR_TILEINFO*  pTileInfo,
-        UINT_64 baseAddr, UINT_32* pTileSwizzle) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeBaseSwizzle(
-        const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
-        ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
-        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
-        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
-
-    virtual UINT_32 HwlComputeHtileBpp(
-        BOOL_32 isWidth8, BOOL_32 isHeight8) const;
-
-    virtual UINT_32 HwlComputeHtileBaseAlign(
-        BOOL_32 isTcCompatible, BOOL_32 isLinear, ADDR_TILEINFO* pTileInfo) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
-
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskAddrFromCoord(
-        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlComputeFmaskCoordFromAddr(
-        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
-
-    virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const;
-
-    virtual UINT_32 HwlComputeQbStereoRightSwizzle(
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo) const;
-
-    virtual VOID HwlComputePixelCoordFromOffset(
-        UINT_32 offset, UINT_32 bpp, UINT_32 numSamples,
-        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
-        AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const;
-
-    /// Return Cmask block max
-    virtual BOOL_32 HwlGetMaxCmaskBlockMax() const
-    {
-        return 0x3FFF; // 14 bits, 0n16383
-    }
-
-    // Sub-hwl interface
-    /// Pure virtual function to setup tile info (indices) if client requests to do so
-    virtual VOID HwlSetupTileInfo(
-        AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
-        AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
-
-    /// Pure virtual function to get pitch alignment for linear modes
-    virtual UINT_32 HwlGetPitchAlignmentLinear(UINT_32 bpp, ADDR_SURFACE_FLAGS flags) const = 0;
-
-    /// Pure virtual function to get size adjustment for linear modes
-    virtual UINT_64 HwlGetSizeAdjustmentLinear(
-        AddrTileMode tileMode,
-        UINT_32 bpp, UINT_32 numSamples, UINT_32 baseAlign, UINT_32 pitchAlign,
-        UINT_32 *pPitch, UINT_32 *pHeight, UINT_32 *pHeightAlign) const = 0;
-
-    virtual UINT_32 HwlGetPitchAlignmentMicroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples) const;
-
-    virtual UINT_64 HwlGetSizeAdjustmentMicroTiled(
-        UINT_32 thickness, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
-        UINT_32 baseAlign, UINT_32 pitchAlign,
-        UINT_32 *pPitch, UINT_32 *pHeight) const;
-
-        /// Pure virtual function to do extra sanity check
-    virtual BOOL_32 HwlSanityCheckMacroTiled(
-        ADDR_TILEINFO* pTileInfo) const = 0;
-
-    /// Pure virtual function to check current level to be the last macro tiled one
-    virtual VOID HwlCheckLastMacroTiledLvl(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
-
-    /// Adjusts bank before bank is modified by rotation
-    virtual UINT_32 HwlPreAdjustBank(
-        UINT_32 tileX, UINT_32 bank, ADDR_TILEINFO*  pTileInfo) const = 0;
-
-    virtual VOID HwlComputeSurfaceCoord2DFromBankPipe(
-        AddrTileMode tileMode, UINT_32* pX, UINT_32* pY, UINT_32 slice,
-        UINT_32 bank, UINT_32 pipe,
-        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
-        BOOL_32 ignoreSE,
-        ADDR_TILEINFO* pTileInfo) const = 0;
-
-    virtual BOOL_32 HwlTileInfoEqual(
-        const ADDR_TILEINFO* pLeft, const ADDR_TILEINFO* pRight) const;
-
-    virtual AddrTileMode HwlDegradeThickTileMode(
-        AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
-
-    virtual INT_32 HwlPostCheckTileIndex(
-        const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
-        INT curIndex = TileIndexInvalid) const
-    {
-        return TileIndexInvalid;
-    }
-
-    virtual VOID HwlFmaskPreThunkSurfInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
-        const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const
-    {
-    }
-
-    virtual VOID HwlFmaskPostThunkSurfInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const
-    {
-    }
-
-    virtual UINT_32 HwlStereoCheckRightOffsetPadding(ADDR_TILEINFO* pTileInfo) const;
-
-    virtual BOOL_32 HwlReduceBankWidthHeight(
-        UINT_32 tileSize, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
-        UINT_32 bankHeightAlign, UINT_32 pipes,
-        ADDR_TILEINFO* pTileInfo) const;
-
-    // Protected non-virtual functions
-
-    /// Mip level functions
-    AddrTileMode ComputeSurfaceMipLevelTileMode(
-        AddrTileMode baseTileMode, UINT_32 bpp,
-        UINT_32 pitch, UINT_32 height, UINT_32 numSlices, UINT_32 numSamples,
-        UINT_32 pitchAlign, UINT_32 heightAlign,
-        ADDR_TILEINFO* pTileInfo) const;
-
-    /// Swizzle functions
-    VOID ExtractBankPipeSwizzle(
-        UINT_32 base256b, ADDR_TILEINFO* pTileInfo,
-        UINT_32* pBankSwizzle, UINT_32* pPipeSwizzle) const;
-
-    UINT_32 GetBankPipeSwizzle(
-        UINT_32 bankSwizzle, UINT_32 pipeSwizzle,
-        UINT_64 baseAddr, ADDR_TILEINFO*  pTileInfo) const;
-
-    UINT_32 ComputeSliceTileSwizzle(
-        AddrTileMode tileMode, UINT_32 baseSwizzle, UINT_32 slice, UINT_64 baseAddr,
-        ADDR_TILEINFO* pTileInfo) const;
-
-    /// Addressing functions
-    virtual ADDR_E_RETURNCODE ComputeBankEquation(
-        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
-        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const
-    {
-        return ADDR_NOTSUPPORTED;
-    }
-
-    UINT_32 ComputeBankFromCoord(
-        UINT_32 x, UINT_32 y, UINT_32 slice,
-        AddrTileMode tileMode, UINT_32 bankSwizzle, UINT_32 tileSpitSlice,
-        ADDR_TILEINFO* pTileInfo) const;
-
-    UINT_32 ComputeBankFromAddr(
-        UINT_64 addr, UINT_32 numBanks, UINT_32 numPipes) const;
-
-    UINT_32 ComputePipeRotation(
-        AddrTileMode tileMode, UINT_32 numPipes) const;
-
-    UINT_32 ComputeBankRotation(
-        AddrTileMode tileMode, UINT_32 numBanks,
-        UINT_32 numPipes) const;
-
-    VOID ComputeSurfaceCoord2DFromBankPipe(
-        AddrTileMode tileMode, UINT_32 x, UINT_32 y, UINT_32 slice,
-        UINT_32 bank, UINT_32 pipe,
-        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
-        ADDR_TILEINFO* pTileInfo,
-        CoordFromBankPipe *pOutput) const;
-
-    /// Htile/Cmask functions
-    UINT_64 ComputeHtileBytes(
-        UINT_32 pitch, UINT_32 height, UINT_32 bpp,
-        BOOL_32 isLinear, UINT_32 numSlices, UINT_64* sliceBytes, UINT_32 baseAlign) const;
-
-    ADDR_E_RETURNCODE ComputeMacroTileEquation(
-        UINT_32 log2BytesPP, AddrTileMode tileMode, AddrTileType microTileType,
-        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
-
-    // Static functions
-    static BOOL_32 IsTileInfoAllZero(const ADDR_TILEINFO* pTileInfo);
-    static UINT_32 ComputeFmaskNumPlanesFromNumSamples(UINT_32 numSamples);
-    static UINT_32 ComputeFmaskResolvedBppFromNumSamples(UINT_32 numSamples);
-
-    virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
-    {
-    }
-
-private:
-
-    BOOL_32 ComputeSurfaceInfoLinear(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
-        UINT_32 padDims) const;
-
-    BOOL_32 ComputeSurfaceInfoMicroTiled(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
-        UINT_32 padDims,
-        AddrTileMode expTileMode) const;
-
-    BOOL_32 ComputeSurfaceInfoMacroTiled(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
-        UINT_32 padDims,
-        AddrTileMode expTileMode) const;
-
-    BOOL_32 ComputeSurfaceAlignmentsLinear(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32* pBaseAlign, UINT_32* pPitchAlign, UINT_32* pHeightAlign) const;
-
-    BOOL_32 ComputeSurfaceAlignmentsMicroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 mipLevel, UINT_32 numSamples,
-        UINT_32* pBaseAlign, UINT_32* pPitchAlign, UINT_32* pHeightAlign) const;
-
-    BOOL_32 ComputeSurfaceAlignmentsMacroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 mipLevel, UINT_32 numSamples,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    /// Surface addressing functions
-    UINT_64 DispatchComputeSurfaceAddrFromCoord(
-        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    VOID DispatchComputeSurfaceCoordFromAddr(
-        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
-
-    UINT_64 ComputeSurfaceAddrFromCoordMicroTiled(
-        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        AddrTileMode tileMode,
-        AddrTileType microTileType, BOOL_32 isDepthSampleOrder,
-        UINT_32* pBitPosition) const;
-
-    UINT_64 ComputeSurfaceAddrFromCoordMacroTiled(
-        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        AddrTileMode tileMode,
-        AddrTileType microTileType, BOOL_32 ignoreSE, BOOL_32 isDepthSampleOrder,
-        UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
-        ADDR_TILEINFO* pTileInfo,
-        UINT_32* pBitPosition) const;
-
-    VOID ComputeSurfaceCoordFromAddrMacroTiled(
-        UINT_64 addr, UINT_32 bitPosition,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
-        AddrTileType microTileType, BOOL_32 ignoreSE, BOOL_32 isDepthSampleOrder,
-        UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
-        ADDR_TILEINFO* pTileInfo,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample) const;
-
-    /// Fmask functions
-    UINT_64 DispatchComputeFmaskAddrFromCoord(
-        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
-
-    VOID DispatchComputeFmaskCoordFromAddr(
-        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
-        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
-
-    // FMASK related methods - private
-    UINT_64 ComputeFmaskAddrFromCoordMicroTiled(
-        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample, UINT_32 plane,
-        UINT_32 pitch, UINT_32 height, UINT_32 numSamples, AddrTileMode tileMode,
-        BOOL_32 resolved, UINT_32* pBitPosition) const;
-
-    VOID ComputeFmaskCoordFromAddrMicroTiled(
-        UINT_64 addr, UINT_32 bitPosition,
-        UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        AddrTileMode tileMode, BOOL_32 resolved,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample, UINT_32* pPlane) const;
-
-    VOID ComputeFmaskCoordFromAddrMacroTiled(
-        UINT_64 addr, UINT_32 bitPosition,
-        UINT_32 pitch, UINT_32 height, UINT_32 numSamples, AddrTileMode tileMode,
-        UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
-        BOOL_32 ignoreSE,
-        ADDR_TILEINFO* pTileInfo,
-        BOOL_32 resolved,
-        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample, UINT_32* pPlane) const;
-
-    UINT_64 ComputeFmaskAddrFromCoordMacroTiled(
-        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample, UINT_32 plane,
-        UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        AddrTileMode tileMode, UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
-        BOOL_32 ignoreSE,
-        ADDR_TILEINFO* pTileInfo,
-        BOOL_32 resolved,
-        UINT_32* pBitPosition) const;
-
-    /// Sanity check functions
-    BOOL_32 SanityCheckMacroTiled(
-        ADDR_TILEINFO* pTileInfo) const;
-
-protected:
-    UINT_32 m_ranks;                ///< Number of ranks - MC_ARB_RAMCFG.NOOFRANK
-    UINT_32 m_logicalBanks;         ///< Logical banks = m_banks * m_ranks if m_banks != 16
-    UINT_32 m_bankInterleave;       ///< Bank interleave, as a multiple of pipe interleave size
-};
-
-} // V1
-} // Addr
-
-#endif
-
diff --git a/src/amd/addrlib/r800/siaddrlib.cpp b/src/amd/addrlib/r800/siaddrlib.cpp
deleted file mode 100644 (file)
index bc009f5..0000000
+++ /dev/null
@@ -1,3872 +0,0 @@
-/*
- * Copyright © 2014 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  siaddrlib.cpp
-* @brief Contains the implementation for the SiLib class.
-****************************************************************************************************
-*/
-
-#include "siaddrlib.h"
-#include "si_gb_reg.h"
-
-#include "amdgpu_asic_addr.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-namespace Addr
-{
-
-/**
-****************************************************************************************************
-*   SiHwlInit
-*
-*   @brief
-*       Creates an SiLib object.
-*
-*   @return
-*       Returns an SiLib object pointer.
-****************************************************************************************************
-*/
-Lib* SiHwlInit(const Client* pClient)
-{
-    return V1::SiLib::CreateObj(pClient);
-}
-
-namespace V1
-{
-
-// We don't support MSAA for equation
-const BOOL_32 SiLib::m_EquationSupport[SiLib::TileTableSize][SiLib::MaxNumElementBytes] =
-{
-    {TRUE,  TRUE,  TRUE,  FALSE, FALSE},    //  0, non-AA compressed depth or any stencil
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  1, 2xAA/4xAA compressed depth with or without stencil
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  2, 8xAA compressed depth with or without stencil
-    {FALSE, TRUE,  FALSE, FALSE, FALSE},    //  3, 16 bpp depth PRT (non-MSAA), don't support uncompressed depth
-    {TRUE,  TRUE,  TRUE,  FALSE, FALSE},    //  4, 1D depth
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  5, 16 bpp depth PRT (4xMSAA)
-    {FALSE, FALSE, TRUE,  FALSE, FALSE},    //  6, 32 bpp depth PRT (non-MSAA)
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  7, 32 bpp depth PRT (4xMSAA)
-    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    //  8, Linear
-    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    //  9, 1D display
-    {TRUE,  FALSE, FALSE, FALSE, FALSE},    // 10, 8 bpp color (displayable)
-    {FALSE, TRUE,  FALSE, FALSE, FALSE},    // 11, 16 bpp color (displayable)
-    {FALSE, FALSE, TRUE,  TRUE,  FALSE},    // 12, 32/64 bpp color (displayable)
-    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    // 13, 1D thin
-    {TRUE,  FALSE, FALSE, FALSE, FALSE},    // 14, 8 bpp color non-displayable
-    {FALSE, TRUE,  FALSE, FALSE, FALSE},    // 15, 16 bpp color non-displayable
-    {FALSE, FALSE, TRUE,  FALSE, FALSE},    // 16, 32 bpp color non-displayable
-    {FALSE, FALSE, FALSE, TRUE,  TRUE },    // 17, 64/128 bpp color non-displayable
-    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    // 18, 1D THICK
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 19, 2D XTHICK
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 20, 2D THICK
-    {TRUE,  FALSE, FALSE, FALSE, FALSE},    // 21, 8 bpp 2D PRTs (non-MSAA)
-    {FALSE, TRUE,  FALSE, FALSE, FALSE},    // 22, 16 bpp 2D PRTs (non-MSAA)
-    {FALSE, FALSE, TRUE,  FALSE, FALSE},    // 23, 32 bpp 2D PRTs (non-MSAA)
-    {FALSE, FALSE, FALSE, TRUE,  FALSE},    // 24, 64 bpp 2D PRTs (non-MSAA)
-    {FALSE, FALSE, FALSE, FALSE, TRUE },    // 25, 128bpp 2D PRTs (non-MSAA)
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 26, none
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 27, none
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 28, none
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 29, none
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 30, 64bpp 2D PRTs (4xMSAA)
-    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 31, none
-};
-
-/**
-****************************************************************************************************
-*   SiLib::SiLib
-*
-*   @brief
-*       Constructor
-*
-****************************************************************************************************
-*/
-SiLib::SiLib(const Client* pClient)
-    :
-    EgBasedLib(pClient),
-    m_noOfEntries(0),
-    m_numEquations(0)
-{
-    m_class = SI_ADDRLIB;
-    memset(&m_settings, 0, sizeof(m_settings));
-}
-
-/**
-****************************************************************************************************
-*   SiLib::~SiLib
-*
-*   @brief
-*       Destructor
-****************************************************************************************************
-*/
-SiLib::~SiLib()
-{
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlGetPipes
-*
-*   @brief
-*       Get number pipes
-*   @return
-*       num pipes
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlGetPipes(
-    const ADDR_TILEINFO* pTileInfo    ///< [in] Tile info
-    ) const
-{
-    UINT_32 numPipes;
-
-    if (pTileInfo)
-    {
-        numPipes = GetPipePerSurf(pTileInfo->pipeConfig);
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        numPipes = m_pipes; // Suppose we should still have a global pipes
-    }
-
-    return numPipes;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::GetPipePerSurf
-*   @brief
-*       get pipe num base on inputing tileinfo->pipeconfig
-*   @return
-*       pipe number
-****************************************************************************************************
-*/
-UINT_32 SiLib::GetPipePerSurf(
-    AddrPipeCfg pipeConfig   ///< [in] pipe config
-    ) const
-{
-    UINT_32 numPipes = 0;
-
-    switch (pipeConfig)
-    {
-        case ADDR_PIPECFG_P2:
-            numPipes = 2;
-            break;
-        case ADDR_PIPECFG_P4_8x16:
-        case ADDR_PIPECFG_P4_16x16:
-        case ADDR_PIPECFG_P4_16x32:
-        case ADDR_PIPECFG_P4_32x32:
-            numPipes = 4;
-            break;
-        case ADDR_PIPECFG_P8_16x16_8x16:
-        case ADDR_PIPECFG_P8_16x32_8x16:
-        case ADDR_PIPECFG_P8_32x32_8x16:
-        case ADDR_PIPECFG_P8_16x32_16x16:
-        case ADDR_PIPECFG_P8_32x32_16x16:
-        case ADDR_PIPECFG_P8_32x32_16x32:
-        case ADDR_PIPECFG_P8_32x64_32x32:
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P16_32x32_8x16:
-        case ADDR_PIPECFG_P16_32x32_16x16:
-            numPipes = 16;
-            break;
-        default:
-            ADDR_ASSERT(!"Invalid pipe config");
-            numPipes = m_pipes;
-    }
-    return numPipes;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::ComputeBankEquation
-*
-*   @brief
-*       Compute bank equation
-*
-*   @return
-*       If equation can be computed
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE SiLib::ComputeBankEquation(
-    UINT_32         log2BytesPP,    ///< [in] log2 of bytes per pixel
-    UINT_32         threshX,        ///< [in] threshold for x channel
-    UINT_32         threshY,        ///< [in] threshold for y channel
-    ADDR_TILEINFO*  pTileInfo,      ///< [in] tile info
-    ADDR_EQUATION*  pEquation       ///< [out] bank equation
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    UINT_32 pipes = HwlGetPipes(pTileInfo);
-    UINT_32 bankXStart = 3 + Log2(pipes) + Log2(pTileInfo->bankWidth);
-    UINT_32 bankYStart = 3 + Log2(pTileInfo->bankHeight);
-
-    ADDR_CHANNEL_SETTING x3 = InitChannel(1, 0, log2BytesPP + bankXStart);
-    ADDR_CHANNEL_SETTING x4 = InitChannel(1, 0, log2BytesPP + bankXStart + 1);
-    ADDR_CHANNEL_SETTING x5 = InitChannel(1, 0, log2BytesPP + bankXStart + 2);
-    ADDR_CHANNEL_SETTING x6 = InitChannel(1, 0, log2BytesPP + bankXStart + 3);
-    ADDR_CHANNEL_SETTING y3 = InitChannel(1, 1, bankYStart);
-    ADDR_CHANNEL_SETTING y4 = InitChannel(1, 1, bankYStart + 1);
-    ADDR_CHANNEL_SETTING y5 = InitChannel(1, 1, bankYStart + 2);
-    ADDR_CHANNEL_SETTING y6 = InitChannel(1, 1, bankYStart + 3);
-
-    x3.value = (threshX > bankXStart)     ? x3.value : 0;
-    x4.value = (threshX > bankXStart + 1) ? x4.value : 0;
-    x5.value = (threshX > bankXStart + 2) ? x5.value : 0;
-    x6.value = (threshX > bankXStart + 3) ? x6.value : 0;
-    y3.value = (threshY > bankYStart)     ? y3.value : 0;
-    y4.value = (threshY > bankYStart + 1) ? y4.value : 0;
-    y5.value = (threshY > bankYStart + 2) ? y5.value : 0;
-    y6.value = (threshY > bankYStart + 3) ? y6.value : 0;
-
-    switch (pTileInfo->banks)
-    {
-        case 16:
-            if (pTileInfo->macroAspectRatio == 1)
-            {
-                pEquation->addr[0] = y6;
-                pEquation->xor1[0] = x3;
-                pEquation->addr[1] = y5;
-                pEquation->xor1[1] = y6;
-                pEquation->xor2[1] = x4;
-                pEquation->addr[2] = y4;
-                pEquation->xor1[2] = x5;
-                pEquation->addr[3] = y3;
-                pEquation->xor1[3] = x6;
-            }
-            else if (pTileInfo->macroAspectRatio == 2)
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y6;
-                pEquation->addr[1] = y5;
-                pEquation->xor1[1] = y6;
-                pEquation->xor2[1] = x4;
-                pEquation->addr[2] = y4;
-                pEquation->xor1[2] = x5;
-                pEquation->addr[3] = y3;
-                pEquation->xor1[3] = x6;
-            }
-            else if (pTileInfo->macroAspectRatio == 4)
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y6;
-                pEquation->addr[1] = x4;
-                pEquation->xor1[1] = y5;
-                pEquation->xor2[1] = y6;
-                pEquation->addr[2] = y4;
-                pEquation->xor1[2] = x5;
-                pEquation->addr[3] = y3;
-                pEquation->xor1[3] = x6;
-            }
-            else if (pTileInfo->macroAspectRatio == 8)
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y6;
-                pEquation->addr[1] = x4;
-                pEquation->xor1[1] = y5;
-                pEquation->xor2[1] = y6;
-                pEquation->addr[2] = x5;
-                pEquation->xor1[2] = y4;
-                pEquation->addr[3] = y3;
-                pEquation->xor1[3] = x6;
-            }
-            else
-            {
-                ADDR_ASSERT_ALWAYS();
-            }
-            pEquation->numBits = 4;
-            break;
-        case 8:
-            if (pTileInfo->macroAspectRatio == 1)
-            {
-                pEquation->addr[0] = y5;
-                pEquation->xor1[0] = x3;
-                pEquation->addr[1] = y4;
-                pEquation->xor1[1] = y5;
-                pEquation->xor2[1] = x4;
-                pEquation->addr[2] = y3;
-                pEquation->xor1[2] = x5;
-            }
-            else if (pTileInfo->macroAspectRatio == 2)
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y5;
-                pEquation->addr[1] = y4;
-                pEquation->xor1[1] = y5;
-                pEquation->xor2[1] = x4;
-                pEquation->addr[2] = y3;
-                pEquation->xor1[2] = x5;
-            }
-            else if (pTileInfo->macroAspectRatio == 4)
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y5;
-                pEquation->addr[1] = x4;
-                pEquation->xor1[1] = y4;
-                pEquation->xor2[1] = y5;
-                pEquation->addr[2] = y3;
-                pEquation->xor1[2] = x5;
-            }
-            else
-            {
-                ADDR_ASSERT_ALWAYS();
-            }
-            pEquation->numBits = 3;
-            break;
-        case 4:
-            if (pTileInfo->macroAspectRatio == 1)
-            {
-                pEquation->addr[0] = y4;
-                pEquation->xor1[0] = x3;
-                pEquation->addr[1] = y3;
-                pEquation->xor1[1] = x4;
-            }
-            else if (pTileInfo->macroAspectRatio == 2)
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y4;
-                pEquation->addr[1] = y3;
-                pEquation->xor1[1] = x4;
-            }
-            else
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y4;
-                pEquation->addr[1] = x4;
-                pEquation->xor1[1] = y3;
-            }
-            pEquation->numBits = 2;
-            break;
-        case 2:
-            if (pTileInfo->macroAspectRatio == 1)
-            {
-                pEquation->addr[0] = y3;
-                pEquation->xor1[0] = x3;
-            }
-            else
-            {
-                pEquation->addr[0] = x3;
-                pEquation->xor1[0] = y3;
-            }
-            pEquation->numBits = 1;
-            break;
-        default:
-            pEquation->numBits = 0;
-            retCode = ADDR_NOTSUPPORTED;
-            ADDR_ASSERT_ALWAYS();
-            break;
-    }
-
-    for (UINT_32 i = 0; i < pEquation->numBits; i++)
-    {
-        if (pEquation->addr[i].value == 0)
-        {
-            if (pEquation->xor1[i].value == 0)
-            {
-                // 00X -> X00
-                pEquation->addr[i].value = pEquation->xor2[i].value;
-                pEquation->xor2[i].value = 0;
-            }
-            else
-            {
-                pEquation->addr[i].value = pEquation->xor1[i].value;
-
-                if (pEquation->xor2[i].value != 0)
-                {
-                    // 0XY -> XY0
-                    pEquation->xor1[i].value = pEquation->xor2[i].value;
-                    pEquation->xor2[i].value = 0;
-                }
-                else
-                {
-                    // 0X0 -> X00
-                    pEquation->xor1[i].value = 0;
-                }
-            }
-        }
-        else if (pEquation->xor1[i].value == 0)
-        {
-            if (pEquation->xor2[i].value != 0)
-            {
-                // X0Y -> XY0
-                pEquation->xor1[i].value = pEquation->xor2[i].value;
-                pEquation->xor2[i].value = 0;
-            }
-        }
-    }
-
-    if ((pTileInfo->bankWidth == 1) &&
-        ((pTileInfo->pipeConfig == ADDR_PIPECFG_P4_32x32) ||
-         (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32)))
-    {
-        retCode = ADDR_NOTSUPPORTED;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::ComputePipeEquation
-*
-*   @brief
-*       Compute pipe equation
-*
-*   @return
-*       If equation can be computed
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE SiLib::ComputePipeEquation(
-    UINT_32        log2BytesPP, ///< [in] Log2 of bytes per pixel
-    UINT_32        threshX,     ///< [in] Threshold for X channel
-    UINT_32        threshY,     ///< [in] Threshold for Y channel
-    ADDR_TILEINFO* pTileInfo,   ///< [in] Tile info
-    ADDR_EQUATION* pEquation    ///< [out] Pipe configure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode = ADDR_OK;
-
-    ADDR_CHANNEL_SETTING* pAddr = pEquation->addr;
-    ADDR_CHANNEL_SETTING* pXor1 = pEquation->xor1;
-    ADDR_CHANNEL_SETTING* pXor2 = pEquation->xor2;
-
-    ADDR_CHANNEL_SETTING x3 = InitChannel(1, 0, 3 + log2BytesPP);
-    ADDR_CHANNEL_SETTING x4 = InitChannel(1, 0, 4 + log2BytesPP);
-    ADDR_CHANNEL_SETTING x5 = InitChannel(1, 0, 5 + log2BytesPP);
-    ADDR_CHANNEL_SETTING x6 = InitChannel(1, 0, 6 + log2BytesPP);
-    ADDR_CHANNEL_SETTING y3 = InitChannel(1, 1, 3);
-    ADDR_CHANNEL_SETTING y4 = InitChannel(1, 1, 4);
-    ADDR_CHANNEL_SETTING y5 = InitChannel(1, 1, 5);
-    ADDR_CHANNEL_SETTING y6 = InitChannel(1, 1, 6);
-
-    x3.value = (threshX > 3) ? x3.value : 0;
-    x4.value = (threshX > 4) ? x4.value : 0;
-    x5.value = (threshX > 5) ? x5.value : 0;
-    x6.value = (threshX > 6) ? x6.value : 0;
-    y3.value = (threshY > 3) ? y3.value : 0;
-    y4.value = (threshY > 4) ? y4.value : 0;
-    y5.value = (threshY > 5) ? y5.value : 0;
-    y6.value = (threshY > 6) ? y6.value : 0;
-
-    switch (pTileInfo->pipeConfig)
-    {
-        case ADDR_PIPECFG_P2:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pEquation->numBits = 1;
-            break;
-        case ADDR_PIPECFG_P4_8x16:
-            pAddr[0] = x4;
-            pXor1[0] = y3;
-            pAddr[1] = x3;
-            pXor1[1] = y4;
-            pEquation->numBits = 2;
-            break;
-        case ADDR_PIPECFG_P4_16x16:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x4;
-            pAddr[1] = x4;
-            pXor1[1] = y4;
-            pEquation->numBits = 2;
-            break;
-        case ADDR_PIPECFG_P4_16x32:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x4;
-            pAddr[1] = x4;
-            pXor1[1] = y5;
-            pEquation->numBits = 2;
-            break;
-        case ADDR_PIPECFG_P4_32x32:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x5;
-            pAddr[1] = x5;
-            pXor1[1] = y5;
-            pEquation->numBits = 2;
-            break;
-        case ADDR_PIPECFG_P8_16x16_8x16:
-            pAddr[0] = x4;
-            pXor1[0] = y3;
-            pXor2[0] = x5;
-            pAddr[1] = x3;
-            pXor1[1] = y5;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P8_16x32_8x16:
-            pAddr[0] = x4;
-            pXor1[0] = y3;
-            pXor2[0] = x5;
-            pAddr[1] = x3;
-            pXor1[1] = y4;
-            pAddr[2] = x4;
-            pXor1[2] = y5;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P8_16x32_16x16:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x4;
-            pAddr[1] = x5;
-            pXor1[1] = y4;
-            pAddr[2] = x4;
-            pXor1[2] = y5;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P8_32x32_8x16:
-            pAddr[0] = x4;
-            pXor1[0] = y3;
-            pXor2[0] = x5;
-            pAddr[1] = x3;
-            pXor1[1] = y4;
-            pAddr[2] = x5;
-            pXor1[2] = y5;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x16:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x4;
-            pAddr[1] = x4;
-            pXor1[1] = y4;
-            pAddr[2] = x5;
-            pXor1[2] = y5;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x32:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x4;
-            pAddr[1] = x4;
-            pXor1[1] = y6;
-            pAddr[2] = x5;
-            pXor1[2] = y5;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P8_32x64_32x32:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x5;
-            pAddr[1] = x6;
-            pXor1[1] = y5;
-            pAddr[2] = x5;
-            pXor1[2] = y6;
-            pEquation->numBits = 3;
-            break;
-        case ADDR_PIPECFG_P16_32x32_8x16:
-            pAddr[0] = x4;
-            pXor1[0] = y3;
-            pAddr[1] = x3;
-            pXor1[1] = y4;
-            pAddr[2] = x5;
-            pXor1[2] = y6;
-            pAddr[3] = x6;
-            pXor1[3] = y5;
-            pEquation->numBits = 4;
-            break;
-        case ADDR_PIPECFG_P16_32x32_16x16:
-            pAddr[0] = x3;
-            pXor1[0] = y3;
-            pXor2[0] = x4;
-            pAddr[1] = x4;
-            pXor1[1] = y4;
-            pAddr[2] = x5;
-            pXor1[2] = y6;
-            pAddr[3] = x6;
-            pXor1[3] = y5;
-            pEquation->numBits = 4;
-            break;
-        default:
-            ADDR_UNHANDLED_CASE();
-            pEquation->numBits = 0;
-            retCode = ADDR_NOTSUPPORTED;
-            break;
-    }
-
-    if (m_settings.isVegaM && (pEquation->numBits == 4))
-    {
-        ADDR_CHANNEL_SETTING addeMsb = pAddr[0];
-        ADDR_CHANNEL_SETTING xor1Msb = pXor1[0];
-        ADDR_CHANNEL_SETTING xor2Msb = pXor2[0];
-
-        pAddr[0] = pAddr[1];
-        pXor1[0] = pXor1[1];
-        pXor2[0] = pXor2[1];
-
-        pAddr[1] = pAddr[2];
-        pXor1[1] = pXor1[2];
-        pXor2[1] = pXor2[2];
-
-        pAddr[2] = pAddr[3];
-        pXor1[2] = pXor1[3];
-        pXor2[2] = pXor2[3];
-
-        pAddr[3] = addeMsb;
-        pXor1[3] = xor1Msb;
-        pXor2[3] = xor2Msb;
-    }
-
-    for (UINT_32 i = 0; i < pEquation->numBits; i++)
-    {
-        if (pAddr[i].value == 0)
-        {
-            if (pXor1[i].value == 0)
-            {
-                pAddr[i].value = pXor2[i].value;
-            }
-            else
-            {
-                pAddr[i].value = pXor1[i].value;
-                pXor1[i].value = 0;
-            }
-        }
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::ComputePipeFromCoord
-*
-*   @brief
-*       Compute pipe number from coordinates
-*   @return
-*       Pipe number
-****************************************************************************************************
-*/
-UINT_32 SiLib::ComputePipeFromCoord(
-    UINT_32         x,              ///< [in] x coordinate
-    UINT_32         y,              ///< [in] y coordinate
-    UINT_32         slice,          ///< [in] slice index
-    AddrTileMode    tileMode,       ///< [in] tile mode
-    UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
-    BOOL_32         ignoreSE,       ///< [in] TRUE if shader engines are ignored
-    ADDR_TILEINFO*  pTileInfo       ///< [in] Tile info
-    ) const
-{
-    UINT_32 pipe;
-    UINT_32 pipeBit0 = 0;
-    UINT_32 pipeBit1 = 0;
-    UINT_32 pipeBit2 = 0;
-    UINT_32 pipeBit3 = 0;
-    UINT_32 sliceRotation;
-    UINT_32 numPipes = 0;
-
-    UINT_32 tx = x / MicroTileWidth;
-    UINT_32 ty = y / MicroTileHeight;
-    UINT_32 x3 = _BIT(tx,0);
-    UINT_32 x4 = _BIT(tx,1);
-    UINT_32 x5 = _BIT(tx,2);
-    UINT_32 x6 = _BIT(tx,3);
-    UINT_32 y3 = _BIT(ty,0);
-    UINT_32 y4 = _BIT(ty,1);
-    UINT_32 y5 = _BIT(ty,2);
-    UINT_32 y6 = _BIT(ty,3);
-
-    switch (pTileInfo->pipeConfig)
-    {
-        case ADDR_PIPECFG_P2:
-            pipeBit0 = x3 ^ y3;
-            numPipes = 2;
-            break;
-        case ADDR_PIPECFG_P4_8x16:
-            pipeBit0 = x4 ^ y3;
-            pipeBit1 = x3 ^ y4;
-            numPipes = 4;
-            break;
-        case ADDR_PIPECFG_P4_16x16:
-            pipeBit0 = x3 ^ y3 ^ x4;
-            pipeBit1 = x4 ^ y4;
-            numPipes = 4;
-            break;
-        case ADDR_PIPECFG_P4_16x32:
-            pipeBit0 = x3 ^ y3 ^ x4;
-            pipeBit1 = x4 ^ y5;
-            numPipes = 4;
-            break;
-        case ADDR_PIPECFG_P4_32x32:
-            pipeBit0 = x3 ^ y3 ^ x5;
-            pipeBit1 = x5 ^ y5;
-            numPipes = 4;
-            break;
-        case ADDR_PIPECFG_P8_16x16_8x16:
-            pipeBit0 = x4 ^ y3 ^ x5;
-            pipeBit1 = x3 ^ y5;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P8_16x32_8x16:
-            pipeBit0 = x4 ^ y3 ^ x5;
-            pipeBit1 = x3 ^ y4;
-            pipeBit2 = x4 ^ y5;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P8_16x32_16x16:
-            pipeBit0 = x3 ^ y3 ^ x4;
-            pipeBit1 = x5 ^ y4;
-            pipeBit2 = x4 ^ y5;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P8_32x32_8x16:
-            pipeBit0 = x4 ^ y3 ^ x5;
-            pipeBit1 = x3 ^ y4;
-            pipeBit2 = x5 ^ y5;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x16:
-            pipeBit0 = x3 ^ y3 ^ x4;
-            pipeBit1 = x4 ^ y4;
-            pipeBit2 = x5 ^ y5;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x32:
-            pipeBit0 = x3 ^ y3 ^ x4;
-            pipeBit1 = x4 ^ y6;
-            pipeBit2 = x5 ^ y5;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P8_32x64_32x32:
-            pipeBit0 = x3 ^ y3 ^ x5;
-            pipeBit1 = x6 ^ y5;
-            pipeBit2 = x5 ^ y6;
-            numPipes = 8;
-            break;
-        case ADDR_PIPECFG_P16_32x32_8x16:
-            pipeBit0 = x4 ^ y3;
-            pipeBit1 = x3 ^ y4;
-            pipeBit2 = x5 ^ y6;
-            pipeBit3 = x6 ^ y5;
-            numPipes = 16;
-            break;
-        case ADDR_PIPECFG_P16_32x32_16x16:
-            pipeBit0 = x3 ^ y3 ^ x4;
-            pipeBit1 = x4 ^ y4;
-            pipeBit2 = x5 ^ y6;
-            pipeBit3 = x6 ^ y5;
-            numPipes = 16;
-            break;
-        default:
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    if (m_settings.isVegaM && (numPipes == 16))
-    {
-        UINT_32 pipeMsb = pipeBit0;
-        pipeBit0 = pipeBit1;
-        pipeBit1 = pipeBit2;
-        pipeBit2 = pipeBit3;
-        pipeBit3 = pipeMsb;
-    }
-
-    pipe = pipeBit0 | (pipeBit1 << 1) | (pipeBit2 << 2) | (pipeBit3 << 3);
-
-    UINT_32 microTileThickness = Thickness(tileMode);
-
-    //
-    // Apply pipe rotation for the slice.
-    //
-    switch (tileMode)
-    {
-        case ADDR_TM_3D_TILED_THIN1:    //fall through thin
-        case ADDR_TM_3D_TILED_THICK:    //fall through thick
-        case ADDR_TM_3D_TILED_XTHICK:
-            sliceRotation =
-                Max(1, static_cast<INT_32>(numPipes / 2) - 1) * (slice / microTileThickness);
-            break;
-        default:
-            sliceRotation = 0;
-            break;
-    }
-    pipeSwizzle += sliceRotation;
-    pipeSwizzle &= (numPipes - 1);
-
-    pipe = pipe ^ pipeSwizzle;
-
-    return pipe;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::ComputeTileCoordFromPipeAndElemIdx
-*
-*   @brief
-*       Compute (x,y) of a tile within a macro tile from address
-*   @return
-*       Pipe number
-****************************************************************************************************
-*/
-VOID SiLib::ComputeTileCoordFromPipeAndElemIdx(
-    UINT_32         elemIdx,          ///< [in] per pipe element index within a macro tile
-    UINT_32         pipe,             ///< [in] pipe index
-    AddrPipeCfg     pipeCfg,          ///< [in] pipe config
-    UINT_32         pitchInMacroTile, ///< [in] surface pitch in macro tile
-    UINT_32         x,                ///< [in] x coordinate of the (0,0) tile in a macro tile
-    UINT_32         y,                ///< [in] y coordinate of the (0,0) tile in a macro tile
-    UINT_32*        pX,               ///< [out] x coordinate
-    UINT_32*        pY                ///< [out] y coordinate
-    ) const
-{
-    UINT_32 pipebit0 = _BIT(pipe,0);
-    UINT_32 pipebit1 = _BIT(pipe,1);
-    UINT_32 pipebit2 = _BIT(pipe,2);
-    UINT_32 pipebit3 = _BIT(pipe,3);
-    UINT_32 elemIdx0 = _BIT(elemIdx,0);
-    UINT_32 elemIdx1 = _BIT(elemIdx,1);
-    UINT_32 elemIdx2 = _BIT(elemIdx,2);
-    UINT_32 x3 = 0;
-    UINT_32 x4 = 0;
-    UINT_32 x5 = 0;
-    UINT_32 x6 = 0;
-    UINT_32 y3 = 0;
-    UINT_32 y4 = 0;
-    UINT_32 y5 = 0;
-    UINT_32 y6 = 0;
-
-    switch(pipeCfg)
-    {
-        case ADDR_PIPECFG_P2:
-            x4 = elemIdx2;
-            y4 = elemIdx1 ^ x4;
-            y3 = elemIdx0 ^ x4;
-            x3 = pipebit0 ^ y3;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P4_8x16:
-            x4 = elemIdx1;
-            y4 = elemIdx0 ^ x4;
-            x3 = pipebit1 ^ y4;
-            y3 = pipebit0 ^ x4;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P4_16x16:
-            x4 = elemIdx1;
-            y3 = elemIdx0 ^ x4;
-            y4 = pipebit1 ^ x4;
-            x3 = pipebit0 ^ y3 ^ x4;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P4_16x32:
-            x3 = elemIdx0 ^ pipebit0;
-            y5 = _BIT(y,5);
-            x4 = pipebit1 ^ y5;
-            y3 = pipebit0 ^ x3 ^ x4;
-            y4 = elemIdx1 ^ x4;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P4_32x32:
-            x4 = elemIdx2;
-            y3 = elemIdx0 ^ x4;
-            y4 = elemIdx1 ^ x4;
-            if((pitchInMacroTile % 2) == 0)
-            {   //even
-                y5 = _BIT(y,5);
-                x5 = pipebit1 ^ y5;
-                x3 = pipebit0 ^ y3 ^ x5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            else
-            {   //odd
-                x5 = _BIT(x,5);
-                x3 = pipebit0 ^ y3 ^ x5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(2, x4, x3);
-            }
-            break;
-        case ADDR_PIPECFG_P8_16x16_8x16:
-            x4 = elemIdx0;
-            y5 = _BIT(y,5);
-            x5 = _BIT(x,5);
-            x3 = pipebit1 ^ y5;
-            y4 = pipebit2 ^ x4;
-            y3 = pipebit0 ^ x5 ^ x4;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P8_16x32_8x16:
-            x3 = elemIdx0;
-            y4 = pipebit1 ^ x3;
-            y5 = _BIT(y,5);
-            x5 = _BIT(x,5);
-            x4 = pipebit2 ^ y5;
-            y3 = pipebit0 ^ x4 ^ x5;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P8_32x32_8x16:
-            x4 = elemIdx1;
-            y4 = elemIdx0 ^ x4;
-            x3 = pipebit1 ^ y4;
-            if((pitchInMacroTile % 2) == 0)
-            {  //even
-                y5 = _BIT(y,5);
-                x5 = _BIT(x,5);
-                x5 = pipebit2 ^ y5;
-                y3 = pipebit0 ^ x4 ^ x5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            else
-            {  //odd
-                x5 = _BIT(x,5);
-                y3 = pipebit0 ^ x4 ^ x5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(2, x4, x3);
-            }
-            break;
-        case ADDR_PIPECFG_P8_16x32_16x16:
-            x3 = elemIdx0;
-            x5 = _BIT(x,5);
-            y5 = _BIT(y,5);
-            x4 = pipebit2 ^ y5;
-            y4 = pipebit1 ^ x5;
-            y3 = pipebit0 ^ x3 ^ x4;
-            *pY = Bits2Number(2, y4, y3);
-            *pX = Bits2Number(2, x4, x3);
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x16:
-            x4 = elemIdx1;
-            y3 = elemIdx0 ^ x4;
-            x3 = y3^x4^pipebit0;
-            y4 = pipebit1 ^ x4;
-            if((pitchInMacroTile % 2) == 0)
-            {   //even
-                y5 = _BIT(y,5);
-                x5 = pipebit2 ^ y5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            else
-            {   //odd
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(2, x4, x3);
-            }
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x32:
-            if((pitchInMacroTile % 2) == 0)
-            {   //even
-                y5 = _BIT(y,5);
-                y6 = _BIT(y,6);
-                x4 = pipebit1 ^ y6;
-                y3 = elemIdx0 ^ x4;
-                y4 = elemIdx1 ^ x4;
-                x3 = pipebit0 ^ y3 ^ x4;
-                x5 = pipebit2 ^ y5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            else
-            {   //odd
-                y6 = _BIT(y,6);
-                x4 = pipebit1 ^ y6;
-                y3 = elemIdx0 ^ x4;
-                y4 = elemIdx1 ^ x4;
-                x3 = pipebit0 ^ y3 ^ x4;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(2, x4, x3);
-            }
-            break;
-        case ADDR_PIPECFG_P8_32x64_32x32:
-            x4 = elemIdx2;
-            y3 = elemIdx0 ^ x4;
-            y4 = elemIdx1 ^ x4;
-            if((pitchInMacroTile % 4) == 0)
-            {   //multiple of 4
-                y5 = _BIT(y,5);
-                y6 = _BIT(y,6);
-                x5 = pipebit2 ^ y6;
-                x6 = pipebit1 ^ y5;
-                x3 = pipebit0 ^ y3 ^ x5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(4, x6, x5, x4, x3);
-            }
-            else
-            {
-                y6 = _BIT(y,6);
-                x5 = pipebit2 ^ y6;
-                x3 = pipebit0 ^ y3 ^ x5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            break;
-        case ADDR_PIPECFG_P16_32x32_8x16:
-            x4 = elemIdx1;
-            y4 = elemIdx0 ^ x4;
-            y3 = pipebit0 ^ x4;
-            x3 = pipebit1 ^ y4;
-            if((pitchInMacroTile % 4) == 0)
-            {   //multiple of 4
-                y5 = _BIT(y,5);
-                y6 = _BIT(y,6);
-                x5 = pipebit2 ^ y6;
-                x6 = pipebit3 ^ y5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(4, x6, x5,x4, x3);
-            }
-            else
-            {
-                y6 = _BIT(y,6);
-                x5 = pipebit2 ^ y6;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            break;
-        case ADDR_PIPECFG_P16_32x32_16x16:
-            x4 = elemIdx1;
-            y3 = elemIdx0 ^ x4;
-            y4 = pipebit1 ^ x4;
-            x3 = pipebit0 ^ y3 ^ x4;
-            if((pitchInMacroTile % 4) == 0)
-            {   //multiple of 4
-                y5 = _BIT(y,5);
-                y6 = _BIT(y,6);
-                x5 = pipebit2 ^ y6;
-                x6 = pipebit3 ^ y5;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(4, x6, x5, x4, x3);
-            }
-            else
-            {
-                y6 = _BIT(y,6);
-                x5 = pipebit2 ^ y6;
-                *pY = Bits2Number(2, y4, y3);
-                *pX = Bits2Number(3, x5, x4, x3);
-            }
-            break;
-        default:
-            ADDR_UNHANDLED_CASE();
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::TileCoordToMaskElementIndex
-*
-*   @brief
-*       Compute element index from coordinates in tiles
-*   @return
-*       Element index
-****************************************************************************************************
-*/
-UINT_32 SiLib::TileCoordToMaskElementIndex(
-    UINT_32         tx,                 ///< [in] x coord, in Tiles
-    UINT_32         ty,                 ///< [in] y coord, in Tiles
-    AddrPipeCfg     pipeConfig,         ///< [in] pipe config
-    UINT_32*        macroShift,         ///< [out] macro shift
-    UINT_32*        elemIdxBits         ///< [out] tile offset bits
-    ) const
-{
-    UINT_32 elemIdx = 0;
-    UINT_32 elemIdx0, elemIdx1, elemIdx2;
-    UINT_32 tx0, tx1;
-    UINT_32 ty0, ty1;
-
-    tx0 = _BIT(tx,0);
-    tx1 = _BIT(tx,1);
-    ty0 = _BIT(ty,0);
-    ty1 = _BIT(ty,1);
-
-    switch(pipeConfig)
-    {
-        case ADDR_PIPECFG_P2:
-            *macroShift = 3;
-            *elemIdxBits =3;
-            elemIdx2 = tx1;
-            elemIdx1 = tx1 ^ ty1;
-            elemIdx0 = tx1 ^ ty0;
-            elemIdx = Bits2Number(3,elemIdx2,elemIdx1,elemIdx0);
-            break;
-        case ADDR_PIPECFG_P4_8x16:
-            *macroShift = 2;
-            *elemIdxBits =2;
-            elemIdx1 = tx1;
-            elemIdx0 = tx1 ^ ty1;
-            elemIdx = Bits2Number(2,elemIdx1,elemIdx0);
-            break;
-        case ADDR_PIPECFG_P4_16x16:
-            *macroShift = 2;
-            *elemIdxBits =2;
-            elemIdx0 = tx1^ty0;
-            elemIdx1 = tx1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P4_16x32:
-            *macroShift = 2;
-            *elemIdxBits =2;
-            elemIdx0 = tx1^ty0;
-            elemIdx1 = tx1^ty1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P4_32x32:
-            *macroShift = 2;
-            *elemIdxBits =3;
-            elemIdx0 = tx1^ty0;
-            elemIdx1 = tx1^ty1;
-            elemIdx2 = tx1;
-            elemIdx = Bits2Number(3, elemIdx2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P8_16x16_8x16:
-            *macroShift = 1;
-            *elemIdxBits =1;
-            elemIdx0 = tx1;
-            elemIdx = elemIdx0;
-            break;
-        case ADDR_PIPECFG_P8_16x32_8x16:
-            *macroShift = 1;
-            *elemIdxBits =1;
-            elemIdx0 = tx0;
-            elemIdx = elemIdx0;
-            break;
-        case ADDR_PIPECFG_P8_32x32_8x16:
-            *macroShift = 1;
-            *elemIdxBits =2;
-            elemIdx1 = tx1;
-            elemIdx0 = tx1^ty1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P8_16x32_16x16:
-            *macroShift = 1;
-            *elemIdxBits =1;
-            elemIdx0 = tx0;
-            elemIdx = elemIdx0;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x16:
-            *macroShift = 1;
-            *elemIdxBits =2;
-            elemIdx0 = tx1^ty0;
-            elemIdx1 = tx1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x32:
-            *macroShift = 1;
-            *elemIdxBits =2;
-            elemIdx0 =  tx1^ty0;
-            elemIdx1 = tx1^ty1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P8_32x64_32x32:
-            *macroShift = 1;
-            *elemIdxBits =3;
-            elemIdx0 = tx1^ty0;
-            elemIdx1 = tx1^ty1;
-            elemIdx2 = tx1;
-            elemIdx = Bits2Number(3, elemIdx2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P16_32x32_8x16:
-            *macroShift = 0;
-            *elemIdxBits =2;
-            elemIdx0 = tx1^ty1;
-            elemIdx1 = tx1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        case ADDR_PIPECFG_P16_32x32_16x16:
-            *macroShift = 0;
-            *elemIdxBits =2;
-            elemIdx0 = tx1^ty0;
-            elemIdx1 = tx1;
-            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
-            break;
-        default:
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    return elemIdx;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeTileDataWidthAndHeightLinear
-*
-*   @brief
-*       Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
-*
-*   @return
-*       N/A
-*
-*   @note
-*       MacroWidth and macroHeight are measured in pixels
-****************************************************************************************************
-*/
-VOID SiLib::HwlComputeTileDataWidthAndHeightLinear(
-    UINT_32*        pMacroWidth,     ///< [out] macro tile width
-    UINT_32*        pMacroHeight,    ///< [out] macro tile height
-    UINT_32         bpp,             ///< [in] bits per pixel
-    ADDR_TILEINFO*  pTileInfo        ///< [in] tile info
-    ) const
-{
-    ADDR_ASSERT(pTileInfo != NULL);
-    UINT_32 macroWidth;
-    UINT_32 macroHeight;
-
-    /// In linear mode, the htile or cmask buffer must be padded out to 4 tiles
-    /// but for P8_32x64_32x32, it must be padded out to 8 tiles
-    /// Actually there are more pipe configs which need 8-tile padding but SI family
-    /// has a bug which is fixed in CI family
-    if ((pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32) ||
-        (pTileInfo->pipeConfig == ADDR_PIPECFG_P16_32x32_8x16) ||
-        (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x32_16x16))
-    {
-        macroWidth  = 8*MicroTileWidth;
-        macroHeight = 8*MicroTileHeight;
-    }
-    else
-    {
-        macroWidth  = 4*MicroTileWidth;
-        macroHeight = 4*MicroTileHeight;
-    }
-
-    *pMacroWidth    = macroWidth;
-    *pMacroHeight   = macroHeight;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeHtileBytes
-*
-*   @brief
-*       Compute htile size in bytes
-*
-*   @return
-*       Htile size in bytes
-****************************************************************************************************
-*/
-UINT_64 SiLib::HwlComputeHtileBytes(
-    UINT_32     pitch,          ///< [in] pitch
-    UINT_32     height,         ///< [in] height
-    UINT_32     bpp,            ///< [in] bits per pixel
-    BOOL_32     isLinear,       ///< [in] if it is linear mode
-    UINT_32     numSlices,      ///< [in] number of slices
-    UINT_64*    pSliceBytes,    ///< [out] bytes per slice
-    UINT_32     baseAlign       ///< [in] base alignments
-    ) const
-{
-    return ComputeHtileBytes(pitch, height, bpp, isLinear, numSlices, pSliceBytes, baseAlign);
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeXmaskAddrFromCoord
-*
-*   @brief
-*       Compute address from coordinates for htile/cmask
-*   @return
-*       Byte address
-****************************************************************************************************
-*/
-UINT_64 SiLib::HwlComputeXmaskAddrFromCoord(
-    UINT_32        pitch,          ///< [in] pitch
-    UINT_32        height,         ///< [in] height
-    UINT_32        x,              ///< [in] x coord
-    UINT_32        y,              ///< [in] y coord
-    UINT_32        slice,          ///< [in] slice/depth index
-    UINT_32        numSlices,      ///< [in] number of slices
-    UINT_32        factor,         ///< [in] factor that indicates cmask(2) or htile(1)
-    BOOL_32        isLinear,       ///< [in] linear or tiled HTILE layout
-    BOOL_32        isWidth8,       ///< [in] TRUE if width is 8, FALSE means 4. It's register value
-    BOOL_32        isHeight8,      ///< [in] TRUE if width is 8, FALSE means 4. It's register value
-    ADDR_TILEINFO* pTileInfo,      ///< [in] Tile info
-    UINT_32*       pBitPosition    ///< [out] bit position inside a byte
-    ) const
-{
-    UINT_32 tx = x / MicroTileWidth;
-    UINT_32 ty = y / MicroTileHeight;
-    UINT_32 newPitch;
-    UINT_32 newHeight;
-    UINT_64 totalBytes;
-    UINT_32 macroWidth;
-    UINT_32 macroHeight;
-    UINT_64 pSliceBytes;
-    UINT_32 pBaseAlign;
-    UINT_32 tileNumPerPipe;
-    UINT_32 elemBits;
-
-    if (factor == 2) //CMASK
-    {
-        ADDR_CMASK_FLAGS flags = {{0}};
-
-        tileNumPerPipe = 256;
-
-        ComputeCmaskInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         pTileInfo,
-                         &newPitch,
-                         &newHeight,
-                         &totalBytes,
-                         &macroWidth,
-                         &macroHeight);
-        elemBits = CmaskElemBits;
-    }
-    else //HTile
-    {
-        ADDR_HTILE_FLAGS flags = {{0}};
-
-        tileNumPerPipe = 512;
-
-        ComputeHtileInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         TRUE,
-                         TRUE,
-                         pTileInfo,
-                         &newPitch,
-                         &newHeight,
-                         &totalBytes,
-                         &macroWidth,
-                         &macroHeight,
-                         &pSliceBytes,
-                         &pBaseAlign);
-        elemBits = 32;
-    }
-
-    const UINT_32 pitchInTile = newPitch / MicroTileWidth;
-    const UINT_32 heightInTile = newHeight / MicroTileWidth;
-    UINT_64 macroOffset; // Per pipe starting offset of the macro tile in which this tile lies.
-    UINT_64 microNumber; // Per pipe starting offset of the macro tile in which this tile lies.
-    UINT_32 microX;
-    UINT_32 microY;
-    UINT_64 microOffset;
-    UINT_32 microShift;
-    UINT_64 totalOffset;
-    UINT_32 elemIdxBits;
-    UINT_32 elemIdx =
-        TileCoordToMaskElementIndex(tx, ty, pTileInfo->pipeConfig, &microShift, &elemIdxBits);
-
-    UINT_32 numPipes = HwlGetPipes(pTileInfo);
-
-    if (isLinear)
-    {   //linear addressing
-        // Linear addressing is extremelly wasting memory if slice > 1, since each pipe has the full
-        // slice memory foot print instead of divided by numPipes.
-        microX = tx / 4; // Macro Tile is 4x4
-        microY = ty / 4 ;
-        microNumber = static_cast<UINT_64>(microX + microY * (pitchInTile / 4)) << microShift;
-
-        UINT_32 sliceBits = pitchInTile * heightInTile;
-
-        // do htile single slice alignment if the flag is true
-        if (m_configFlags.useHtileSliceAlign && (factor == 1))  //Htile
-        {
-            sliceBits = PowTwoAlign(sliceBits, BITS_TO_BYTES(HtileCacheBits) * numPipes / elemBits);
-        }
-        macroOffset = slice * (sliceBits / numPipes) * elemBits ;
-    }
-    else
-    {   //tiled addressing
-        const UINT_32 macroWidthInTile = macroWidth / MicroTileWidth; // Now in unit of Tiles
-        const UINT_32 macroHeightInTile = macroHeight / MicroTileHeight;
-        const UINT_32 pitchInCL = pitchInTile / macroWidthInTile;
-        const UINT_32 heightInCL = heightInTile / macroHeightInTile;
-
-        const UINT_32 macroX = x / macroWidth;
-        const UINT_32 macroY = y / macroHeight;
-        const UINT_32 macroNumber = macroX + macroY * pitchInCL + slice * pitchInCL * heightInCL;
-
-        // Per pipe starting offset of the cache line in which this tile lies.
-        microX = (x % macroWidth) / MicroTileWidth / 4; // Macro Tile is 4x4
-        microY = (y % macroHeight) / MicroTileHeight / 4 ;
-        microNumber = static_cast<UINT_64>(microX + microY * (macroWidth / MicroTileWidth / 4)) << microShift;
-
-        macroOffset = macroNumber * tileNumPerPipe * elemBits;
-    }
-
-    if(elemIdxBits == microShift)
-    {
-        microNumber += elemIdx;
-    }
-    else
-    {
-        microNumber >>= elemIdxBits;
-        microNumber <<= elemIdxBits;
-        microNumber += elemIdx;
-    }
-
-    microOffset = elemBits * microNumber;
-    totalOffset = microOffset + macroOffset;
-
-    UINT_32 pipe = ComputePipeFromCoord(x, y, 0, ADDR_TM_2D_TILED_THIN1, 0, FALSE, pTileInfo);
-    UINT_64 addrInBits = totalOffset % (m_pipeInterleaveBytes * 8) +
-                   pipe * (m_pipeInterleaveBytes * 8) +
-                   totalOffset / (m_pipeInterleaveBytes * 8) * (m_pipeInterleaveBytes * 8) * numPipes;
-    *pBitPosition = static_cast<UINT_32>(addrInBits) % 8;
-    UINT_64 addr = addrInBits / 8;
-
-    return addr;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeXmaskCoordFromAddr
-*
-*   @brief
-*       Compute the coord from an address of a cmask/htile
-*
-*   @return
-*       N/A
-*
-*   @note
-*       This method is reused by htile, so rename to Xmask
-****************************************************************************************************
-*/
-VOID SiLib::HwlComputeXmaskCoordFromAddr(
-    UINT_64         addr,           ///< [in] address
-    UINT_32         bitPosition,    ///< [in] bitPosition in a byte
-    UINT_32         pitch,          ///< [in] pitch
-    UINT_32         height,         ///< [in] height
-    UINT_32         numSlices,      ///< [in] number of slices
-    UINT_32         factor,         ///< [in] factor that indicates cmask or htile
-    BOOL_32         isLinear,       ///< [in] linear or tiled HTILE layout
-    BOOL_32         isWidth8,       ///< [in] Not used by SI
-    BOOL_32         isHeight8,      ///< [in] Not used by SI
-    ADDR_TILEINFO*  pTileInfo,      ///< [in] Tile info
-    UINT_32*        pX,             ///< [out] x coord
-    UINT_32*        pY,             ///< [out] y coord
-    UINT_32*        pSlice          ///< [out] slice index
-    ) const
-{
-    UINT_32 newPitch;
-    UINT_32 newHeight;
-    UINT_64 totalBytes;
-    UINT_32 clWidth;
-    UINT_32 clHeight;
-    UINT_32 tileNumPerPipe;
-    UINT_64 sliceBytes;
-
-    *pX = 0;
-    *pY = 0;
-    *pSlice = 0;
-
-    if (factor == 2) //CMASK
-    {
-        ADDR_CMASK_FLAGS flags = {{0}};
-
-        tileNumPerPipe = 256;
-
-        ComputeCmaskInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         pTileInfo,
-                         &newPitch,
-                         &newHeight,
-                         &totalBytes,
-                         &clWidth,
-                         &clHeight);
-    }
-    else //HTile
-    {
-        ADDR_HTILE_FLAGS flags = {{0}};
-
-        tileNumPerPipe = 512;
-
-        ComputeHtileInfo(flags,
-                         pitch,
-                         height,
-                         numSlices,
-                         isLinear,
-                         TRUE,
-                         TRUE,
-                         pTileInfo,
-                         &newPitch,
-                         &newHeight,
-                         &totalBytes,
-                         &clWidth,
-                         &clHeight,
-                         &sliceBytes);
-    }
-
-    const UINT_32 pitchInTile = newPitch / MicroTileWidth;
-    const UINT_32 heightInTile = newHeight / MicroTileWidth;
-    const UINT_32 pitchInMacroTile = pitchInTile / 4;
-    UINT_32 macroShift;
-    UINT_32 elemIdxBits;
-    // get macroShift and elemIdxBits
-    TileCoordToMaskElementIndex(0, 0, pTileInfo->pipeConfig, &macroShift, &elemIdxBits);
-
-    const UINT_32 numPipes = HwlGetPipes(pTileInfo);
-    const UINT_32 pipe = (UINT_32)((addr / m_pipeInterleaveBytes) % numPipes);
-    // per pipe
-    UINT_64 localOffset = (addr % m_pipeInterleaveBytes) +
-        (addr / m_pipeInterleaveBytes / numPipes)* m_pipeInterleaveBytes;
-
-    UINT_32 tileIndex;
-    if (factor == 2) //CMASK
-    {
-        tileIndex = (UINT_32)(localOffset * 2 + (bitPosition != 0));
-    }
-    else
-    {
-        tileIndex = (UINT_32)(localOffset / 4);
-    }
-
-    UINT_32 macroOffset;
-    if (isLinear)
-    {
-        UINT_32 sliceSizeInTile = pitchInTile * heightInTile;
-
-        // do htile single slice alignment if the flag is true
-        if (m_configFlags.useHtileSliceAlign && (factor == 1))  //Htile
-        {
-            sliceSizeInTile = PowTwoAlign(sliceSizeInTile, static_cast<UINT_32>(sliceBytes) / 64);
-        }
-        *pSlice = tileIndex / (sliceSizeInTile / numPipes);
-        macroOffset = tileIndex % (sliceSizeInTile / numPipes);
-    }
-    else
-    {
-        const UINT_32 clWidthInTile = clWidth / MicroTileWidth; // Now in unit of Tiles
-        const UINT_32 clHeightInTile = clHeight / MicroTileHeight;
-        const UINT_32 pitchInCL = pitchInTile / clWidthInTile;
-        const UINT_32 heightInCL = heightInTile / clHeightInTile;
-        const UINT_32 clIndex = tileIndex / tileNumPerPipe;
-
-        UINT_32 clX = clIndex % pitchInCL;
-        UINT_32 clY = (clIndex % (heightInCL * pitchInCL)) / pitchInCL;
-
-        *pX = clX * clWidthInTile * MicroTileWidth;
-        *pY = clY * clHeightInTile * MicroTileHeight;
-        *pSlice = clIndex / (heightInCL * pitchInCL);
-
-        macroOffset = tileIndex % tileNumPerPipe;
-    }
-
-    UINT_32 elemIdx = macroOffset & 7;
-    macroOffset >>= elemIdxBits;
-
-    if (elemIdxBits != macroShift)
-    {
-        macroOffset <<= (elemIdxBits - macroShift);
-
-        UINT_32 pipebit1 = _BIT(pipe,1);
-        UINT_32 pipebit2 = _BIT(pipe,2);
-        UINT_32 pipebit3 = _BIT(pipe,3);
-        if (pitchInMacroTile % 2)
-        {   //odd
-            switch (pTileInfo->pipeConfig)
-            {
-                case ADDR_PIPECFG_P4_32x32:
-                    macroOffset |= pipebit1;
-                    break;
-                case ADDR_PIPECFG_P8_32x32_8x16:
-                case ADDR_PIPECFG_P8_32x32_16x16:
-                case ADDR_PIPECFG_P8_32x32_16x32:
-                    macroOffset |= pipebit2;
-                    break;
-                default:
-                    break;
-            }
-
-        }
-
-        if (pitchInMacroTile % 4)
-        {
-            if (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32)
-            {
-                macroOffset |= (pipebit1<<1);
-            }
-            if((pTileInfo->pipeConfig == ADDR_PIPECFG_P16_32x32_8x16) ||
-               (pTileInfo->pipeConfig == ADDR_PIPECFG_P16_32x32_16x16))
-            {
-                macroOffset |= (pipebit3<<1);
-            }
-        }
-    }
-
-    UINT_32 macroX;
-    UINT_32 macroY;
-
-    if (isLinear)
-    {
-        macroX = macroOffset % pitchInMacroTile;
-        macroY = macroOffset / pitchInMacroTile;
-    }
-    else
-    {
-        const UINT_32 clWidthInMacroTile = clWidth / (MicroTileWidth * 4);
-        macroX = macroOffset % clWidthInMacroTile;
-        macroY = macroOffset / clWidthInMacroTile;
-    }
-
-    *pX += macroX * 4 * MicroTileWidth;
-    *pY += macroY * 4 * MicroTileHeight;
-
-    UINT_32 microX;
-    UINT_32 microY;
-    ComputeTileCoordFromPipeAndElemIdx(elemIdx, pipe, pTileInfo->pipeConfig, pitchInMacroTile,
-                                       *pX, *pY, &microX, &microY);
-
-    *pX += microX * MicroTileWidth;
-    *pY += microY * MicroTileWidth;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlGetPitchAlignmentLinear
-*   @brief
-*       Get pitch alignment
-*   @return
-*       pitch alignment
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlGetPitchAlignmentLinear(
-    UINT_32             bpp,    ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags   ///< [in] surface flags
-    ) const
-{
-    UINT_32 pitchAlign;
-
-    // Interleaved access requires a 256B aligned pitch, so fall back to pre-SI alignment
-    if (flags.interleaved)
-    {
-        pitchAlign = Max(64u, m_pipeInterleaveBytes / BITS_TO_BYTES(bpp));
-
-    }
-    else
-    {
-        pitchAlign = Max(8u, 64 / BITS_TO_BYTES(bpp));
-    }
-
-    return pitchAlign;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlGetSizeAdjustmentLinear
-*
-*   @brief
-*       Adjust linear surface pitch and slice size
-*
-*   @return
-*       Logical slice size in bytes
-****************************************************************************************************
-*/
-UINT_64 SiLib::HwlGetSizeAdjustmentLinear(
-    AddrTileMode        tileMode,       ///< [in] tile mode
-    UINT_32             bpp,            ///< [in] bits per pixel
-    UINT_32             numSamples,     ///< [in] number of samples
-    UINT_32             baseAlign,      ///< [in] base alignment
-    UINT_32             pitchAlign,     ///< [in] pitch alignment
-    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
-    UINT_32*            pHeight,        ///< [in,out] pointer to height
-    UINT_32*            pHeightAlign    ///< [in,out] pointer to height align
-    ) const
-{
-    UINT_64 sliceSize;
-    if (tileMode == ADDR_TM_LINEAR_GENERAL)
-    {
-        sliceSize = BITS_TO_BYTES(static_cast<UINT_64>(*pPitch) * (*pHeight) * bpp * numSamples);
-    }
-    else
-    {
-        UINT_32 pitch   = *pPitch;
-        UINT_32 height  = *pHeight;
-
-        UINT_32 pixelsPerPipeInterleave = m_pipeInterleaveBytes / BITS_TO_BYTES(bpp);
-        UINT_32 sliceAlignInPixel = pixelsPerPipeInterleave < 64 ? 64 : pixelsPerPipeInterleave;
-
-        // numSamples should be 1 in real cases (no MSAA for linear but TGL may pass non 1 value)
-        UINT_64 pixelPerSlice = static_cast<UINT_64>(pitch) * height * numSamples;
-
-        while (pixelPerSlice % sliceAlignInPixel)
-        {
-            pitch += pitchAlign;
-            pixelPerSlice = static_cast<UINT_64>(pitch) * height * numSamples;
-        }
-
-        *pPitch = pitch;
-
-        UINT_32 heightAlign = 1;
-
-        while ((pitch * heightAlign) % sliceAlignInPixel)
-        {
-            heightAlign++;
-        }
-
-        *pHeightAlign = heightAlign;
-
-        sliceSize = BITS_TO_BYTES(pixelPerSlice * bpp);
-    }
-
-    return sliceSize;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlPreHandleBaseLvl3xPitch
-*
-*   @brief
-*       Pre-handler of 3x pitch (96 bit) adjustment
-*
-*   @return
-*       Expected pitch
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlPreHandleBaseLvl3xPitch(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
-    UINT_32                                 expPitch    ///< [in] pitch
-    ) const
-{
-    ADDR_ASSERT(pIn->width == expPitch);
-
-    // From SI, if pow2Pad is 1 the pitch is expanded 3x first, then padded to pow2, so nothing to
-    // do here
-    if (pIn->flags.pow2Pad == FALSE)
-    {
-        Addr::V1::Lib::HwlPreHandleBaseLvl3xPitch(pIn, expPitch);
-    }
-    else
-    {
-        ADDR_ASSERT(IsPow2(expPitch));
-    }
-
-    return expPitch;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlPostHandleBaseLvl3xPitch
-*
-*   @brief
-*       Post-handler of 3x pitch adjustment
-*
-*   @return
-*       Expected pitch
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlPostHandleBaseLvl3xPitch(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
-    UINT_32                                 expPitch    ///< [in] pitch
-    ) const
-{
-    /**
-     * @note The pitch will be divided by 3 in the end so the value will look odd but h/w should
-     *  be able to compute a correct pitch from it as h/w address library is doing the job.
-     */
-    // From SI, the pitch is expanded 3x first, then padded to pow2, so no special handler here
-    if (pIn->flags.pow2Pad == FALSE)
-    {
-        Addr::V1::Lib::HwlPostHandleBaseLvl3xPitch(pIn, expPitch);
-    }
-
-    return expPitch;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlGetPitchAlignmentMicroTiled
-*
-*   @brief
-*       Compute 1D tiled surface pitch alignment
-*
-*   @return
-*       pitch alignment
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlGetPitchAlignmentMicroTiled(
-    AddrTileMode        tileMode,          ///< [in] tile mode
-    UINT_32             bpp,               ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
-    UINT_32             numSamples         ///< [in] number of samples
-    ) const
-{
-    UINT_32 pitchAlign;
-
-    if (flags.qbStereo)
-    {
-        pitchAlign = EgBasedLib::HwlGetPitchAlignmentMicroTiled(tileMode,bpp,flags,numSamples);
-    }
-    else
-    {
-        pitchAlign = 8;
-    }
-
-    return pitchAlign;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlGetSizeAdjustmentMicroTiled
-*
-*   @brief
-*       Adjust 1D tiled surface pitch and slice size
-*
-*   @return
-*       Logical slice size in bytes
-****************************************************************************************************
-*/
-UINT_64 SiLib::HwlGetSizeAdjustmentMicroTiled(
-    UINT_32             thickness,      ///< [in] thickness
-    UINT_32             bpp,            ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS  flags,          ///< [in] surface flags
-    UINT_32             numSamples,     ///< [in] number of samples
-    UINT_32             baseAlign,      ///< [in] base alignment
-    UINT_32             pitchAlign,     ///< [in] pitch alignment
-    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
-    UINT_32*            pHeight         ///< [in,out] pointer to height
-    ) const
-{
-    UINT_64 logicalSliceSize;
-    UINT_64 physicalSliceSize;
-
-    UINT_32 pitch   = *pPitch;
-    UINT_32 height  = *pHeight;
-
-    // Logical slice: pitch * height * bpp * numSamples (no 1D MSAA so actually numSamples == 1)
-    logicalSliceSize = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
-
-    // Physical slice: multiplied by thickness
-    physicalSliceSize =  logicalSliceSize * thickness;
-
-    // Pitch alignment is always 8, so if slice size is not padded to base alignment
-    // (pipe_interleave_size), we need to increase pitch
-    while ((physicalSliceSize % baseAlign) != 0)
-    {
-        pitch += pitchAlign;
-
-        logicalSliceSize = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
-
-        physicalSliceSize =  logicalSliceSize * thickness;
-    }
-
-#if !ALT_TEST
-    //
-    // Special workaround for depth/stencil buffer, use 8 bpp to align depth buffer again since
-    // the stencil plane may have larger pitch if the slice size is smaller than base alignment.
-    //
-    // Note: this actually does not work for mipmap but mipmap depth texture is not really
-    // sampled with mipmap.
-    //
-    if (flags.depth && (flags.noStencil == FALSE))
-    {
-        ADDR_ASSERT(numSamples == 1);
-
-        UINT_64 logicalSiceSizeStencil = static_cast<UINT_64>(pitch) * height; // 1 byte stencil
-
-        while ((logicalSiceSizeStencil % baseAlign) != 0)
-        {
-            pitch += pitchAlign; // Stencil plane's pitch alignment is the same as depth plane's
-
-            logicalSiceSizeStencil = static_cast<UINT_64>(pitch) * height;
-        }
-
-        if (pitch != *pPitch)
-        {
-            // If this is a mipmap, this padded one cannot be sampled as a whole mipmap!
-            logicalSliceSize = logicalSiceSizeStencil * BITS_TO_BYTES(bpp);
-        }
-    }
-#endif
-    *pPitch = pitch;
-
-    // No adjust for pHeight
-
-    return logicalSliceSize;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlConvertChipFamily
-*
-*   @brief
-*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
-*   @return
-*       ChipFamily
-****************************************************************************************************
-*/
-ChipFamily SiLib::HwlConvertChipFamily(
-    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
-    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
-{
-    ChipFamily family = ADDR_CHIP_FAMILY_SI;
-
-    switch (uChipFamily)
-    {
-        case FAMILY_SI:
-            m_settings.isSouthernIsland = 1;
-            m_settings.isTahiti     = ASICREV_IS_TAHITI_P(uChipRevision);
-            m_settings.isPitCairn   = ASICREV_IS_PITCAIRN_PM(uChipRevision);
-            m_settings.isCapeVerde  = ASICREV_IS_CAPEVERDE_M(uChipRevision);
-            m_settings.isOland      = ASICREV_IS_OLAND_M(uChipRevision);
-            m_settings.isHainan     = ASICREV_IS_HAINAN_V(uChipRevision);
-            break;
-        default:
-            ADDR_ASSERT(!"This should be a Fusion");
-            break;
-    }
-
-    return family;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlSetupTileInfo
-*
-*   @brief
-*       Setup default value of tile info for SI
-****************************************************************************************************
-*/
-VOID SiLib::HwlSetupTileInfo(
-    AddrTileMode                        tileMode,       ///< [in] Tile mode
-    ADDR_SURFACE_FLAGS                  flags,          ///< [in] Surface type flags
-    UINT_32                             bpp,            ///< [in] Bits per pixel
-    UINT_32                             pitch,          ///< [in] Pitch in pixels
-    UINT_32                             height,         ///< [in] Height in pixels
-    UINT_32                             numSamples,     ///< [in] Number of samples
-    ADDR_TILEINFO*                      pTileInfoIn,    ///< [in] Tile info input: NULL for default
-    ADDR_TILEINFO*                      pTileInfoOut,   ///< [out] Tile info output
-    AddrTileType                        inTileType,     ///< [in] Tile type
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*   pOut            ///< [out] Output
-    ) const
-{
-    UINT_32 thickness = Thickness(tileMode);
-    ADDR_TILEINFO* pTileInfo = pTileInfoOut;
-    INT index = TileIndexInvalid;
-
-    // Fail-safe code
-    if (IsLinear(tileMode) == FALSE)
-    {
-        // 128 bpp/thick tiling must be non-displayable.
-        // Fmask reuse color buffer's entry but bank-height field can be from another entry
-        // To simplify the logic, fmask entry should be picked from non-displayable ones
-        if (bpp == 128 || thickness > 1 || flags.fmask || flags.prt)
-        {
-            inTileType = ADDR_NON_DISPLAYABLE;
-        }
-
-        if (flags.depth || flags.stencil)
-        {
-            inTileType = ADDR_DEPTH_SAMPLE_ORDER;
-        }
-    }
-
-    // Partial valid fields are not allowed for SI.
-    if (IsTileInfoAllZero(pTileInfo))
-    {
-        if (IsMacroTiled(tileMode))
-        {
-            if (flags.prt)
-            {
-                if (numSamples == 1)
-                {
-                    if (flags.depth)
-                    {
-                        switch (bpp)
-                        {
-                            case 16:
-                                index = 3;
-                                break;
-                            case 32:
-                                index = 6;
-                                break;
-                            default:
-                                ADDR_ASSERT_ALWAYS();
-                                break;
-                        }
-                    }
-                    else
-                    {
-                        switch (bpp)
-                        {
-                            case 8:
-                                index = 21;
-                                break;
-                            case 16:
-                                index = 22;
-                                break;
-                            case 32:
-                                index = 23;
-                                break;
-                            case 64:
-                                index = 24;
-                                break;
-                            case 128:
-                                index = 25;
-                                break;
-                            default:
-                                break;
-                        }
-
-                        if (thickness > 1)
-                        {
-                            ADDR_ASSERT(bpp != 128);
-                            index += 5;
-                        }
-                    }
-                }
-                else
-                {
-                    ADDR_ASSERT(numSamples == 4);
-
-                    if (flags.depth)
-                    {
-                        switch (bpp)
-                        {
-                            case 16:
-                                index = 5;
-                                break;
-                            case 32:
-                                index = 7;
-                                break;
-                            default:
-                                ADDR_ASSERT_ALWAYS();
-                                break;
-                        }
-                    }
-                    else
-                    {
-                        switch (bpp)
-                        {
-                            case 8:
-                                index = 23;
-                                break;
-                            case 16:
-                                index = 24;
-                                break;
-                            case 32:
-                                index = 25;
-                                break;
-                            case 64:
-                                index = 30;
-                                break;
-                            default:
-                                ADDR_ASSERT_ALWAYS();
-                                break;
-                        }
-                    }
-                }
-            }//end of PRT part
-            // See table entries 0-7
-            else if (flags.depth || flags.stencil)
-            {
-                if (flags.compressZ)
-                {
-                    if (flags.stencil)
-                    {
-                        index = 0;
-                    }
-                    else
-                    {
-                        // optimal tile index for compressed depth/stencil.
-                        switch (numSamples)
-                        {
-                            case 1:
-                                index = 0;
-                                break;
-                            case 2:
-                            case 4:
-                                index = 1;
-                                break;
-                            case 8:
-                                index = 2;
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-                }
-                else // unCompressZ
-                {
-                    index = 3;
-                }
-            }
-            else //non PRT & non Depth & non Stencil
-            {
-                // See table entries 9-12
-                if (inTileType == ADDR_DISPLAYABLE)
-                {
-                    switch (bpp)
-                    {
-                        case 8:
-                            index = 10;
-                            break;
-                        case 16:
-                            index = 11;
-                            break;
-                        case 32:
-                            index = 12;
-                            break;
-                        case 64:
-                            index = 12;
-                            break;
-                        default:
-                            break;
-                    }
-                }
-                else
-                {
-                    // See table entries 13-17
-                    if (thickness == 1)
-                    {
-                        if (flags.fmask)
-                        {
-                            UINT_32 fmaskPixelSize = bpp * numSamples;
-
-                            switch (fmaskPixelSize)
-                            {
-                                case 8:
-                                    index = 14;
-                                    break;
-                                case 16:
-                                    index = 15;
-                                    break;
-                                case 32:
-                                    index = 16;
-                                    break;
-                                case 64:
-                                    index = 17;
-                                    break;
-                                default:
-                                    ADDR_ASSERT_ALWAYS();
-                            }
-                        }
-                        else
-                        {
-                            switch (bpp)
-                            {
-                                case 8:
-                                    index = 14;
-                                    break;
-                                case 16:
-                                    index = 15;
-                                    break;
-                                case 32:
-                                    index = 16;
-                                    break;
-                                case 64:
-                                    index = 17;
-                                    break;
-                                case 128:
-                                    index = 17;
-                                    break;
-                                default:
-                                    break;
-                            }
-                        }
-                    }
-                    else // thick tiling - entries 18-20
-                    {
-                        switch (thickness)
-                        {
-                            case 4:
-                                index = 20;
-                                break;
-                            case 8:
-                                index = 19;
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-                }
-            }
-        }
-        else
-        {
-            if (tileMode == ADDR_TM_LINEAR_ALIGNED)
-            {
-                index = 8;
-            }
-            else if (tileMode == ADDR_TM_LINEAR_GENERAL)
-            {
-                index = TileIndexLinearGeneral;
-            }
-            else
-            {
-                if (flags.depth || flags.stencil)
-                {
-                    index = 4;
-                }
-                else if (inTileType == ADDR_DISPLAYABLE)
-                {
-                    index = 9;
-                }
-                else if (thickness == 1)
-                {
-                    index = 13;
-                }
-                else
-                {
-                    index = 18;
-                }
-            }
-        }
-
-        if (index >= 0 && index <= 31)
-        {
-            *pTileInfo      = m_tileTable[index].info;
-            pOut->tileType  = m_tileTable[index].type;
-        }
-
-        if (index == TileIndexLinearGeneral)
-        {
-            *pTileInfo      = m_tileTable[8].info;
-            pOut->tileType  = m_tileTable[8].type;
-        }
-    }
-    else
-    {
-        if (pTileInfoIn)
-        {
-            if (flags.stencil && pTileInfoIn->tileSplitBytes == 0)
-            {
-                // Stencil always uses index 0
-                *pTileInfo = m_tileTable[0].info;
-            }
-        }
-        // Pass through tile type
-        pOut->tileType = inTileType;
-    }
-
-    pOut->tileIndex = index;
-    pOut->prtTileIndex = flags.prt;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::DecodeGbRegs
-*
-*   @brief
-*       Decodes GB_ADDR_CONFIG and noOfBanks/noOfRanks
-*
-*   @return
-*       TRUE if all settings are valid
-*
-****************************************************************************************************
-*/
-BOOL_32 SiLib::DecodeGbRegs(
-    const ADDR_REGISTER_VALUE* pRegValue) ///< [in] create input
-{
-    GB_ADDR_CONFIG  reg;
-    BOOL_32         valid = TRUE;
-
-    reg.val = pRegValue->gbAddrConfig;
-
-    switch (reg.f.pipe_interleave_size)
-    {
-        case ADDR_CONFIG_PIPE_INTERLEAVE_256B:
-            m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_256B;
-            break;
-        case ADDR_CONFIG_PIPE_INTERLEAVE_512B:
-            m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_512B;
-            break;
-        default:
-            valid = FALSE;
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    switch (reg.f.row_size)
-    {
-        case ADDR_CONFIG_1KB_ROW:
-            m_rowSize = ADDR_ROWSIZE_1KB;
-            break;
-        case ADDR_CONFIG_2KB_ROW:
-            m_rowSize = ADDR_ROWSIZE_2KB;
-            break;
-        case ADDR_CONFIG_4KB_ROW:
-            m_rowSize = ADDR_ROWSIZE_4KB;
-            break;
-        default:
-            valid = FALSE;
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    switch (pRegValue->noOfBanks)
-    {
-        case 0:
-            m_banks = 4;
-            break;
-        case 1:
-            m_banks = 8;
-            break;
-        case 2:
-            m_banks = 16;
-            break;
-        default:
-            valid = FALSE;
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    switch (pRegValue->noOfRanks)
-    {
-        case 0:
-            m_ranks = 1;
-            break;
-        case 1:
-            m_ranks = 2;
-            break;
-        default:
-            valid = FALSE;
-            ADDR_UNHANDLED_CASE();
-            break;
-    }
-
-    m_logicalBanks = m_banks * m_ranks;
-
-    ADDR_ASSERT(m_logicalBanks <= 16);
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlInitGlobalParams
-*
-*   @brief
-*       Initializes global parameters
-*
-*   @return
-*       TRUE if all settings are valid
-*
-****************************************************************************************************
-*/
-BOOL_32 SiLib::HwlInitGlobalParams(
-    const ADDR_CREATE_INPUT* pCreateIn) ///< [in] create input
-{
-    BOOL_32 valid = TRUE;
-    const ADDR_REGISTER_VALUE* pRegValue = &pCreateIn->regValue;
-
-    valid = DecodeGbRegs(pRegValue);
-
-    if (valid)
-    {
-        if (m_settings.isTahiti || m_settings.isPitCairn)
-        {
-            m_pipes = 8;
-        }
-        else if (m_settings.isCapeVerde || m_settings.isOland)
-        {
-            m_pipes = 4;
-        }
-        else
-        {
-            // Hainan is 2-pipe (m_settings.isHainan == 1)
-            m_pipes = 2;
-        }
-
-        valid = InitTileSettingTable(pRegValue->pTileConfig, pRegValue->noOfEntries);
-
-        if (valid)
-        {
-            InitEquationTable();
-        }
-
-        m_maxSamples = 16;
-    }
-
-    return valid;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlConvertTileInfoToHW
-*   @brief
-*       Entry of si's ConvertTileInfoToHW
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE SiLib::HwlConvertTileInfoToHW(
-    const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
-    ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
-    ) const
-{
-    ADDR_E_RETURNCODE retCode   = ADDR_OK;
-
-    retCode = EgBasedLib::HwlConvertTileInfoToHW(pIn, pOut);
-
-    if (retCode == ADDR_OK)
-    {
-        if (pIn->reverse == FALSE)
-        {
-            if (pIn->pTileInfo->pipeConfig == ADDR_PIPECFG_INVALID)
-            {
-                retCode = ADDR_INVALIDPARAMS;
-            }
-            else
-            {
-                pOut->pTileInfo->pipeConfig =
-                    static_cast<AddrPipeCfg>(pIn->pTileInfo->pipeConfig - 1);
-            }
-        }
-        else
-        {
-            pOut->pTileInfo->pipeConfig =
-                static_cast<AddrPipeCfg>(pIn->pTileInfo->pipeConfig + 1);
-        }
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeXmaskCoordYFrom8Pipe
-*
-*   @brief
-*       Compute the Y coord which will be added to Xmask Y
-*       coord.
-*   @return
-*       Y coord
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlComputeXmaskCoordYFrom8Pipe(
-    UINT_32         pipe,       ///< [in] pipe id
-    UINT_32         x           ///< [in] tile coord x, which is original x coord / 8
-    ) const
-{
-    // This function should never be called since it is 6xx/8xx specfic.
-    // Keep this empty implementation to avoid any mis-use.
-    ADDR_ASSERT_ALWAYS();
-
-    return 0;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeSurfaceCoord2DFromBankPipe
-*
-*   @brief
-*       Compute surface x,y coordinates from bank/pipe info
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID SiLib::HwlComputeSurfaceCoord2DFromBankPipe(
-    AddrTileMode        tileMode,   ///< [in] tile mode
-    UINT_32*            pX,         ///< [in,out] x coordinate
-    UINT_32*            pY,         ///< [in,out] y coordinate
-    UINT_32             slice,      ///< [in] slice index
-    UINT_32             bank,       ///< [in] bank number
-    UINT_32             pipe,       ///< [in] pipe number
-    UINT_32             bankSwizzle,///< [in] bank swizzle
-    UINT_32             pipeSwizzle,///< [in] pipe swizzle
-    UINT_32             tileSlices, ///< [in] slices in a micro tile
-    BOOL_32             ignoreSE,   ///< [in] TRUE if shader engines are ignored
-    ADDR_TILEINFO*      pTileInfo   ///< [in] bank structure. **All fields to be valid on entry**
-    ) const
-{
-    UINT_32 xBit;
-    UINT_32 yBit;
-    UINT_32 yBit3 = 0;
-    UINT_32 yBit4 = 0;
-    UINT_32 yBit5 = 0;
-    UINT_32 yBit6 = 0;
-
-    UINT_32 xBit3 = 0;
-    UINT_32 xBit4 = 0;
-    UINT_32 xBit5 = 0;
-
-    UINT_32 numPipes = GetPipePerSurf(pTileInfo->pipeConfig);
-
-    CoordFromBankPipe xyBits = {0};
-    ComputeSurfaceCoord2DFromBankPipe(tileMode, *pX, *pY, slice, bank, pipe,
-                                      bankSwizzle, pipeSwizzle, tileSlices, pTileInfo,
-                                      &xyBits);
-    yBit3 = xyBits.yBit3;
-    yBit4 = xyBits.yBit4;
-    yBit5 = xyBits.yBit5;
-    yBit6 = xyBits.yBit6;
-
-    xBit3 = xyBits.xBit3;
-    xBit4 = xyBits.xBit4;
-    xBit5 = xyBits.xBit5;
-
-    yBit = xyBits.yBits;
-
-    UINT_32 yBitTemp = 0;
-
-    if ((pTileInfo->pipeConfig == ADDR_PIPECFG_P4_32x32) ||
-        (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32))
-    {
-        ADDR_ASSERT(pTileInfo->bankWidth == 1 && pTileInfo->macroAspectRatio > 1);
-        UINT_32 yBitToCheck = QLog2(pTileInfo->banks) - 1;
-
-        ADDR_ASSERT(yBitToCheck <= 3);
-
-        yBitTemp = _BIT(yBit, yBitToCheck);
-
-        xBit3 = 0;
-    }
-
-    yBit = Bits2Number(4, yBit6, yBit5, yBit4, yBit3);
-    xBit = Bits2Number(3, xBit5, xBit4, xBit3);
-
-    *pY += yBit * pTileInfo->bankHeight * MicroTileHeight;
-    *pX += xBit * numPipes * pTileInfo->bankWidth * MicroTileWidth;
-
-    //calculate the bank and pipe bits in x, y
-    UINT_32 xTile; //x in micro tile
-    UINT_32 x3 = 0;
-    UINT_32 x4 = 0;
-    UINT_32 x5 = 0;
-    UINT_32 x6 = 0;
-    UINT_32 y = *pY;
-
-    UINT_32 pipeBit0 = _BIT(pipe,0);
-    UINT_32 pipeBit1 = _BIT(pipe,1);
-    UINT_32 pipeBit2 = _BIT(pipe,2);
-
-    UINT_32 y3 = _BIT(y, 3);
-    UINT_32 y4 = _BIT(y, 4);
-    UINT_32 y5 = _BIT(y, 5);
-    UINT_32 y6 = _BIT(y, 6);
-
-    // bankbit0 after ^x4^x5
-    UINT_32 bankBit00 = _BIT(bank,0);
-    UINT_32 bankBit0 = 0;
-
-    switch (pTileInfo->pipeConfig)
-    {
-        case ADDR_PIPECFG_P2:
-            x3 = pipeBit0 ^ y3;
-            break;
-        case ADDR_PIPECFG_P4_8x16:
-            x4 = pipeBit0 ^ y3;
-            x3 = pipeBit0 ^ y4;
-            break;
-        case ADDR_PIPECFG_P4_16x16:
-            x4 = pipeBit1 ^ y4;
-            x3 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P4_16x32:
-            x4 = pipeBit1 ^ y4;
-            x3 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P4_32x32:
-            x5 = pipeBit1 ^ y5;
-            x3 = pipeBit0 ^ y3 ^ x5;
-            bankBit0 = yBitTemp ^ x5;
-            x4 = bankBit00 ^ x5 ^ bankBit0;
-            *pX += x5 * 4 * 1 * 8; // x5 * num_pipes * bank_width * 8;
-            break;
-        case ADDR_PIPECFG_P8_16x16_8x16:
-            x3 = pipeBit1 ^ y5;
-            x4 = pipeBit2 ^ y4;
-            x5 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P8_16x32_8x16:
-            x3 = pipeBit1 ^ y4;
-            x4 = pipeBit2 ^ y5;
-            x5 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P8_32x32_8x16:
-            x3 = pipeBit1 ^ y4;
-            x5 = pipeBit2 ^ y5;
-            x4 = pipeBit0 ^ y3 ^ x5;
-            break;
-        case ADDR_PIPECFG_P8_16x32_16x16:
-            x4 = pipeBit2 ^ y5;
-            x5 = pipeBit1 ^ y4;
-            x3 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x16:
-            x5 = pipeBit2 ^ y5;
-            x4 = pipeBit1 ^ y4;
-            x3 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P8_32x32_16x32:
-            x5 = pipeBit2 ^ y5;
-            x4 = pipeBit1 ^ y6;
-            x3 = pipeBit0 ^ y3 ^ x4;
-            break;
-        case ADDR_PIPECFG_P8_32x64_32x32:
-            x6 = pipeBit1 ^ y5;
-            x5 = pipeBit2 ^ y6;
-            x3 = pipeBit0 ^ y3 ^ x5;
-            bankBit0 = yBitTemp ^ x6;
-            x4 = bankBit00 ^ x5 ^ bankBit0;
-            *pX += x6 * 8 * 1 * 8; // x6 * num_pipes * bank_width * 8;
-            break;
-        default:
-            ADDR_ASSERT_ALWAYS();
-    }
-
-    xTile = Bits2Number(3, x5, x4, x3);
-
-    *pX += xTile << 3;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlPreAdjustBank
-*
-*   @brief
-*       Adjust bank before calculating address acoording to bank/pipe
-*   @return
-*       Adjusted bank
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlPreAdjustBank(
-    UINT_32         tileX,      ///< [in] x coordinate in unit of tile
-    UINT_32         bank,       ///< [in] bank
-    ADDR_TILEINFO*  pTileInfo   ///< [in] tile info
-    ) const
-{
-    if (((pTileInfo->pipeConfig == ADDR_PIPECFG_P4_32x32) ||
-        (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32)) && (pTileInfo->bankWidth == 1))
-    {
-        UINT_32 bankBit0 = _BIT(bank, 0);
-        UINT_32 x4 = _BIT(tileX, 1);
-        UINT_32 x5 = _BIT(tileX, 2);
-
-        bankBit0 = bankBit0 ^ x4 ^ x5;
-        bank |= bankBit0;
-
-        ADDR_ASSERT(pTileInfo->macroAspectRatio > 1);
-    }
-
-    return bank;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeSurfaceInfo
-*
-*   @brief
-*       Entry of si's ComputeSurfaceInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE SiLib::HwlComputeSurfaceInfo(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
-    ) const
-{
-    pOut->tileIndex = pIn->tileIndex;
-
-    ADDR_E_RETURNCODE retCode = EgBasedLib::HwlComputeSurfaceInfo(pIn, pOut);
-
-    UINT_32 tileIndex = static_cast<UINT_32>(pOut->tileIndex);
-
-    if (((pIn->flags.needEquation   == TRUE) ||
-         (pIn->flags.preferEquation == TRUE)) &&
-        (pIn->numSamples <= 1) &&
-        (tileIndex < TileTableSize))
-    {
-        static const UINT_32 SiUncompressDepthTileIndex = 3;
-
-        if ((pIn->numSlices > 1) &&
-            (IsMacroTiled(pOut->tileMode) == TRUE) &&
-            ((m_chipFamily == ADDR_CHIP_FAMILY_SI) ||
-             (IsPrtTileMode(pOut->tileMode) == FALSE)))
-        {
-            pOut->equationIndex = ADDR_INVALID_EQUATION_INDEX;
-        }
-        else if ((pIn->flags.prt == FALSE) &&
-                 (m_uncompressDepthEqIndex != 0) &&
-                 (tileIndex == SiUncompressDepthTileIndex))
-        {
-            pOut->equationIndex = m_uncompressDepthEqIndex + Log2(pIn->bpp >> 3);
-        }
-        else
-        {
-
-            pOut->equationIndex = m_equationLookupTable[Log2(pIn->bpp >> 3)][tileIndex];
-        }
-
-        if (pOut->equationIndex != ADDR_INVALID_EQUATION_INDEX)
-        {
-            pOut->blockWidth = m_blockWidth[pOut->equationIndex];
-
-            pOut->blockHeight = m_blockHeight[pOut->equationIndex];
-
-            pOut->blockSlices = m_blockSlices[pOut->equationIndex];
-        }
-    }
-    else
-    {
-        pOut->equationIndex = ADDR_INVALID_EQUATION_INDEX;
-    }
-
-    return retCode;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeMipLevel
-*   @brief
-*       Compute MipLevel info (including level 0)
-*   @return
-*       TRUE if HWL's handled
-****************************************************************************************************
-*/
-BOOL_32 SiLib::HwlComputeMipLevel(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn ///< [in,out] Input structure
-    ) const
-{
-    // basePitch is calculated from level 0 so we only check this for mipLevel > 0
-    if (pIn->mipLevel > 0)
-    {
-        // Note: Don't check expand 3x formats(96 bit) as the basePitch is not pow2 even if
-        // we explicity set pow2Pad flag. The 3x base pitch is padded to pow2 but after being
-        // divided by expandX factor (3) - to program texture pitch, the basePitch is never pow2.
-        if (ElemLib::IsExpand3x(pIn->format) == FALSE)
-        {
-            // Sublevel pitches are generated from base level pitch instead of width on SI
-            // If pow2Pad is 0, we don't assert - as this is not really used for a mip chain
-            ADDR_ASSERT((pIn->flags.pow2Pad == FALSE) ||
-                        ((pIn->basePitch != 0) && IsPow2(pIn->basePitch)));
-        }
-
-        if (pIn->basePitch != 0)
-        {
-            pIn->width = Max(1u, pIn->basePitch >> pIn->mipLevel);
-        }
-    }
-
-    // pow2Pad is done in PostComputeMipLevel
-
-    return TRUE;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlCheckLastMacroTiledLvl
-*
-*   @brief
-*       Sets pOut->last2DLevel to TRUE if it is
-*   @note
-*
-****************************************************************************************************
-*/
-VOID SiLib::HwlCheckLastMacroTiledLvl(
-    const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] Input structure
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut      ///< [in,out] Output structure (used as input, too)
-    ) const
-{
-    // pow2Pad covers all mipmap cases
-    if (pIn->flags.pow2Pad)
-    {
-        ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
-
-        UINT_32 nextPitch;
-        UINT_32 nextHeight;
-        UINT_32 nextSlices;
-
-        AddrTileMode nextTileMode;
-
-        if (pIn->mipLevel == 0 || pIn->basePitch == 0)
-        {
-            // Base level or fail-safe case (basePitch == 0)
-            nextPitch = pOut->pitch >> 1;
-        }
-        else
-        {
-            // Sub levels
-            nextPitch = pIn->basePitch >> (pIn->mipLevel + 1);
-        }
-
-        // nextHeight must be shifted from this level's original height rather than a pow2 padded
-        // one but this requires original height stored somewhere (pOut->height)
-        ADDR_ASSERT(pOut->height != 0);
-
-        // next level's height is just current level's >> 1 in pixels
-        nextHeight = pOut->height >> 1;
-        // Special format such as FMT_1 and FMT_32_32_32 can be linear only so we consider block
-        // compressed foramts
-        if (ElemLib::IsBlockCompressed(pIn->format))
-        {
-            nextHeight = (nextHeight + 3) / 4;
-        }
-        nextHeight = NextPow2(nextHeight);
-
-        // nextSlices may be 0 if this level's is 1
-        if (pIn->flags.volume)
-        {
-            nextSlices = Max(1u, pIn->numSlices >> 1);
-        }
-        else
-        {
-            nextSlices = pIn->numSlices;
-        }
-
-        nextTileMode = ComputeSurfaceMipLevelTileMode(pIn->tileMode,
-                                                      pIn->bpp,
-                                                      nextPitch,
-                                                      nextHeight,
-                                                      nextSlices,
-                                                      pIn->numSamples,
-                                                      pOut->blockWidth,
-                                                      pOut->blockHeight,
-                                                      pOut->pTileInfo);
-
-        pOut->last2DLevel = IsMicroTiled(nextTileMode);
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlDegradeThickTileMode
-*
-*   @brief
-*       Degrades valid tile mode for thick modes if needed
-*
-*   @return
-*       Suitable tile mode
-****************************************************************************************************
-*/
-AddrTileMode SiLib::HwlDegradeThickTileMode(
-    AddrTileMode        baseTileMode,   ///< base tile mode
-    UINT_32             numSlices,      ///< current number of slices
-    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
-    ) const
-{
-    return EgBasedLib::HwlDegradeThickTileMode(baseTileMode, numSlices, pBytesPerTile);
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlTileInfoEqual
-*
-*   @brief
-*       Return TRUE if all field are equal
-*   @note
-*       Only takes care of current HWL's data
-****************************************************************************************************
-*/
-BOOL_32 SiLib::HwlTileInfoEqual(
-    const ADDR_TILEINFO* pLeft, ///<[in] Left compare operand
-    const ADDR_TILEINFO* pRight ///<[in] Right compare operand
-    ) const
-{
-    BOOL_32 equal = FALSE;
-
-    if (pLeft->pipeConfig == pRight->pipeConfig)
-    {
-        equal =  EgBasedLib::HwlTileInfoEqual(pLeft, pRight);
-    }
-
-    return equal;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::GetTileSettings
-*
-*   @brief
-*       Get tile setting infos by index.
-*   @return
-*       Tile setting info.
-****************************************************************************************************
-*/
-const TileConfig* SiLib::GetTileSetting(
-    UINT_32 index          ///< [in] Tile index
-    ) const
-{
-    ADDR_ASSERT(index < m_noOfEntries);
-    return &m_tileTable[index];
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlPostCheckTileIndex
-*
-*   @brief
-*       Map a tile setting to index if curIndex is invalid, otherwise check if curIndex matches
-*       tile mode/type/info and change the index if needed
-*   @return
-*       Tile index.
-****************************************************************************************************
-*/
-INT_32 SiLib::HwlPostCheckTileIndex(
-    const ADDR_TILEINFO* pInfo,     ///< [in] Tile Info
-    AddrTileMode         mode,      ///< [in] Tile mode
-    AddrTileType         type,      ///< [in] Tile type
-    INT                  curIndex   ///< [in] Current index assigned in HwlSetupTileInfo
-    ) const
-{
-    INT_32 index = curIndex;
-
-    if (mode == ADDR_TM_LINEAR_GENERAL)
-    {
-        index = TileIndexLinearGeneral;
-    }
-    else
-    {
-        BOOL_32 macroTiled = IsMacroTiled(mode);
-
-        // We need to find a new index if either of them is true
-        // 1. curIndex is invalid
-        // 2. tile mode is changed
-        // 3. tile info does not match for macro tiled
-        if ((index == TileIndexInvalid         ||
-            (mode != m_tileTable[index].mode)  ||
-            (macroTiled && (HwlTileInfoEqual(pInfo, &m_tileTable[index].info) == FALSE))))
-        {
-            for (index = 0; index < static_cast<INT_32>(m_noOfEntries); index++)
-            {
-                if (macroTiled)
-                {
-                    // macro tile modes need all to match
-                    if (HwlTileInfoEqual(pInfo, &m_tileTable[index].info) &&
-                        (mode == m_tileTable[index].mode)                 &&
-                        (type == m_tileTable[index].type))
-                    {
-                        break;
-                    }
-                }
-                else if (mode == ADDR_TM_LINEAR_ALIGNED)
-                {
-                    // linear mode only needs tile mode to match
-                    if (mode == m_tileTable[index].mode)
-                    {
-                        break;
-                    }
-                }
-                else
-                {
-                    // micro tile modes only need tile mode and tile type to match
-                    if (mode == m_tileTable[index].mode &&
-                        type == m_tileTable[index].type)
-                    {
-                        break;
-                    }
-                }
-            }
-        }
-    }
-
-    ADDR_ASSERT(index < static_cast<INT_32>(m_noOfEntries));
-
-    if (index >= static_cast<INT_32>(m_noOfEntries))
-    {
-        index = TileIndexInvalid;
-    }
-
-    return index;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlSetupTileCfg
-*
-*   @brief
-*       Map tile index to tile setting.
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE SiLib::HwlSetupTileCfg(
-    UINT_32         bpp,            ///< Bits per pixel
-    INT_32          index,          ///< Tile index
-    INT_32          macroModeIndex, ///< Index in macro tile mode table(CI)
-    ADDR_TILEINFO*  pInfo,          ///< [out] Tile Info
-    AddrTileMode*   pMode,          ///< [out] Tile mode
-    AddrTileType*   pType           ///< [out] Tile type
-    ) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    // Global flag to control usage of tileIndex
-    if (UseTileIndex(index))
-    {
-        if (index == TileIndexLinearGeneral)
-        {
-            if (pMode)
-            {
-                *pMode = ADDR_TM_LINEAR_GENERAL;
-            }
-
-            if (pType)
-            {
-                *pType = ADDR_DISPLAYABLE;
-            }
-
-            if (pInfo)
-            {
-                pInfo->banks = 2;
-                pInfo->bankWidth = 1;
-                pInfo->bankHeight = 1;
-                pInfo->macroAspectRatio = 1;
-                pInfo->tileSplitBytes = 64;
-                pInfo->pipeConfig = ADDR_PIPECFG_P2;
-            }
-        }
-        else if (static_cast<UINT_32>(index) >= m_noOfEntries)
-        {
-            returnCode = ADDR_INVALIDPARAMS;
-        }
-        else
-        {
-            const TileConfig* pCfgTable = GetTileSetting(index);
-
-            if (pInfo)
-            {
-                *pInfo = pCfgTable->info;
-            }
-            else
-            {
-                if (IsMacroTiled(pCfgTable->mode))
-                {
-                    returnCode = ADDR_INVALIDPARAMS;
-                }
-            }
-
-            if (pMode)
-            {
-                *pMode = pCfgTable->mode;
-            }
-
-            if (pType)
-            {
-                *pType = pCfgTable->type;
-            }
-        }
-    }
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::ReadGbTileMode
-*
-*   @brief
-*       Convert GB_TILE_MODE HW value to TileConfig.
-*   @return
-*       NA.
-****************************************************************************************************
-*/
-VOID SiLib::ReadGbTileMode(
-    UINT_32     regValue,   ///< [in] GB_TILE_MODE register
-    TileConfig* pCfg        ///< [out] output structure
-    ) const
-{
-    GB_TILE_MODE gbTileMode;
-    gbTileMode.val = regValue;
-
-    pCfg->type = static_cast<AddrTileType>(gbTileMode.f.micro_tile_mode);
-    pCfg->info.bankHeight = 1 << gbTileMode.f.bank_height;
-    pCfg->info.bankWidth = 1 << gbTileMode.f.bank_width;
-    pCfg->info.banks = 1 << (gbTileMode.f.num_banks + 1);
-    pCfg->info.macroAspectRatio = 1 << gbTileMode.f.macro_tile_aspect;
-    pCfg->info.tileSplitBytes = 64 << gbTileMode.f.tile_split;
-    pCfg->info.pipeConfig = static_cast<AddrPipeCfg>(gbTileMode.f.pipe_config + 1);
-
-    UINT_32 regArrayMode = gbTileMode.f.array_mode;
-
-    pCfg->mode = static_cast<AddrTileMode>(regArrayMode);
-
-    if (regArrayMode == 8) //ARRAY_2D_TILED_XTHICK
-    {
-        pCfg->mode = ADDR_TM_2D_TILED_XTHICK;
-    }
-    else if (regArrayMode >= 14) //ARRAY_3D_TILED_XTHICK
-    {
-        pCfg->mode = static_cast<AddrTileMode>(pCfg->mode + 3);
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::InitTileSettingTable
-*
-*   @brief
-*       Initialize the ADDR_TILE_CONFIG table.
-*   @return
-*       TRUE if tile table is correctly initialized
-****************************************************************************************************
-*/
-BOOL_32 SiLib::InitTileSettingTable(
-    const UINT_32*  pCfg,           ///< [in] Pointer to table of tile configs
-    UINT_32         noOfEntries     ///< [in] Numbe of entries in the table above
-    )
-{
-    BOOL_32 initOk = TRUE;
-
-    ADDR_ASSERT(noOfEntries <= TileTableSize);
-
-    memset(m_tileTable, 0, sizeof(m_tileTable));
-
-    if (noOfEntries != 0)
-    {
-        m_noOfEntries = noOfEntries;
-    }
-    else
-    {
-        m_noOfEntries = TileTableSize;
-    }
-
-    if (pCfg) // From Client
-    {
-        for (UINT_32 i = 0; i < m_noOfEntries; i++)
-        {
-            ReadGbTileMode(*(pCfg + i), &m_tileTable[i]);
-        }
-    }
-    else
-    {
-        ADDR_ASSERT_ALWAYS();
-        initOk = FALSE;
-    }
-
-    if (initOk)
-    {
-        ADDR_ASSERT(m_tileTable[TILEINDEX_LINEAR_ALIGNED].mode == ADDR_TM_LINEAR_ALIGNED);
-    }
-
-    return initOk;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlGetTileIndex
-*
-*   @brief
-*       Return the virtual/real index for given mode/type/info
-*   @return
-*       ADDR_OK if successful.
-****************************************************************************************************
-*/
-ADDR_E_RETURNCODE SiLib::HwlGetTileIndex(
-    const ADDR_GET_TILEINDEX_INPUT* pIn,
-    ADDR_GET_TILEINDEX_OUTPUT*      pOut) const
-{
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
-
-    pOut->index = HwlPostCheckTileIndex(pIn->pTileInfo, pIn->tileMode, pIn->tileType);
-
-    return returnCode;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlFmaskPreThunkSurfInfo
-*
-*   @brief
-*       Some preparation before thunking a ComputeSurfaceInfo call for Fmask
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-VOID SiLib::HwlFmaskPreThunkSurfInfo(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pFmaskIn,   ///< [in] Input of fmask info
-    const ADDR_COMPUTE_FMASK_INFO_OUTPUT*   pFmaskOut,  ///< [in] Output of fmask info
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*        pSurfIn,    ///< [out] Input of thunked surface info
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pSurfOut    ///< [out] Output of thunked surface info
-    ) const
-{
-    pSurfIn->tileIndex = pFmaskIn->tileIndex;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlFmaskPostThunkSurfInfo
-*
-*   @brief
-*       Copy hwl extra field after calling thunked ComputeSurfaceInfo
-*   @return
-*       ADDR_E_RETURNCODE
-****************************************************************************************************
-*/
-VOID SiLib::HwlFmaskPostThunkSurfInfo(
-    const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,   ///< [in] Output of surface info
-    ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut           ///< [out] Output of fmask info
-    ) const
-{
-    pFmaskOut->macroModeIndex = TileIndexInvalid;
-    pFmaskOut->tileIndex = pSurfOut->tileIndex;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeFmaskBits
-*   @brief
-*       Computes fmask bits
-*   @return
-*       Fmask bits
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlComputeFmaskBits(
-    const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-    UINT_32* pNumSamples
-    ) const
-{
-    UINT_32 numSamples = pIn->numSamples;
-    UINT_32 numFrags = GetNumFragments(numSamples, pIn->numFrags);
-    UINT_32 bpp;
-
-    if (numFrags != numSamples) // EQAA
-    {
-        ADDR_ASSERT(numFrags <= 8);
-
-        if (pIn->resolved == FALSE)
-        {
-            if (numFrags == 1)
-            {
-                bpp          = 1;
-                numSamples   = numSamples == 16 ? 16 : 8;
-            }
-            else if (numFrags == 2)
-            {
-                ADDR_ASSERT(numSamples >= 4);
-
-                bpp          = 2;
-                numSamples   = numSamples;
-            }
-            else if (numFrags == 4)
-            {
-                ADDR_ASSERT(numSamples >= 4);
-
-                bpp          = 4;
-                numSamples   = numSamples;
-            }
-            else // numFrags == 8
-            {
-                ADDR_ASSERT(numSamples == 16);
-
-                bpp          = 4;
-                numSamples   = numSamples;
-            }
-        }
-        else
-        {
-            if (numFrags == 1)
-            {
-                bpp          = (numSamples == 16) ? 16 : 8;
-                numSamples   = 1;
-            }
-            else if (numFrags == 2)
-            {
-                ADDR_ASSERT(numSamples >= 4);
-
-                bpp          = numSamples*2;
-                numSamples   = 1;
-            }
-            else if (numFrags == 4)
-            {
-                ADDR_ASSERT(numSamples >= 4);
-
-                bpp          = numSamples*4;
-                numSamples   = 1;
-            }
-            else // numFrags == 8
-            {
-                ADDR_ASSERT(numSamples >= 16);
-
-                bpp          = 16*4;
-                numSamples   = 1;
-            }
-        }
-    }
-    else // Normal AA
-    {
-        if (pIn->resolved == FALSE)
-        {
-            bpp          = ComputeFmaskNumPlanesFromNumSamples(numSamples);
-            numSamples   = numSamples == 2 ? 8 : numSamples;
-        }
-        else
-        {
-            // The same as 8XX
-            bpp          = ComputeFmaskResolvedBppFromNumSamples(numSamples);
-            numSamples   = 1; // 1x sample
-        }
-    }
-
-    SafeAssign(pNumSamples, numSamples);
-
-    return bpp;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlOptimizeTileMode
-*
-*   @brief
-*       Optimize tile mode on SI
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID SiLib::HwlOptimizeTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut      ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode = pInOut->tileMode;
-
-    if ((pInOut->flags.needEquation == TRUE) &&
-        (IsMacroTiled(tileMode) == TRUE) &&
-        (pInOut->numSamples <= 1))
-    {
-        UINT_32 thickness = Thickness(tileMode);
-
-        if (thickness > 1)
-        {
-            tileMode = ADDR_TM_1D_TILED_THICK;
-        }
-        else if (pInOut->numSlices > 1)
-        {
-            tileMode = ADDR_TM_1D_TILED_THIN1;
-        }
-        else
-        {
-            tileMode = ADDR_TM_2D_TILED_THIN1;
-        }
-    }
-
-    if (tileMode != pInOut->tileMode)
-    {
-        pInOut->tileMode = tileMode;
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlOverrideTileMode
-*
-*   @brief
-*       Override tile modes (for PRT only, avoid client passes in an invalid PRT mode for SI.
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID SiLib::HwlOverrideTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut          ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode = pInOut->tileMode;
-
-    switch (tileMode)
-    {
-        case ADDR_TM_PRT_TILED_THIN1:
-            tileMode = ADDR_TM_2D_TILED_THIN1;
-            break;
-
-        case ADDR_TM_PRT_TILED_THICK:
-            tileMode = ADDR_TM_2D_TILED_THICK;
-            break;
-
-        case ADDR_TM_PRT_2D_TILED_THICK:
-            tileMode = ADDR_TM_2D_TILED_THICK;
-            break;
-
-        case ADDR_TM_PRT_3D_TILED_THICK:
-            tileMode = ADDR_TM_3D_TILED_THICK;
-            break;
-
-        default:
-            break;
-    }
-
-    if (tileMode != pInOut->tileMode)
-    {
-        pInOut->tileMode  = tileMode;
-        // Only PRT tile modes are overridden for now. Revisit this once new modes are added above.
-        pInOut->flags.prt = TRUE;
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlSetPrtTileMode
-*
-*   @brief
-*       Set prt tile modes.
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID SiLib::HwlSetPrtTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
-    ) const
-{
-    pInOut->tileMode = ADDR_TM_2D_TILED_THIN1;
-    pInOut->tileType = (pInOut->tileType == ADDR_DEPTH_SAMPLE_ORDER) ?
-                       ADDR_DEPTH_SAMPLE_ORDER : ADDR_NON_DISPLAYABLE;
-    pInOut->flags.prt = TRUE;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlSelectTileMode
-*
-*   @brief
-*       Select tile modes.
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID SiLib::HwlSelectTileMode(
-    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
-    ) const
-{
-    AddrTileMode tileMode;
-    AddrTileType tileType;
-
-    if (pInOut->flags.volume)
-    {
-        if (pInOut->numSlices >= 8)
-        {
-            tileMode = ADDR_TM_2D_TILED_XTHICK;
-        }
-        else if (pInOut->numSlices >= 4)
-        {
-            tileMode = ADDR_TM_2D_TILED_THICK;
-        }
-        else
-        {
-            tileMode = ADDR_TM_2D_TILED_THIN1;
-        }
-        tileType = ADDR_NON_DISPLAYABLE;
-    }
-    else
-    {
-        tileMode = ADDR_TM_2D_TILED_THIN1;
-
-        if (pInOut->flags.depth || pInOut->flags.stencil)
-        {
-            tileType = ADDR_DEPTH_SAMPLE_ORDER;
-        }
-        else if ((pInOut->bpp <= 32) ||
-                 (pInOut->flags.display == TRUE) ||
-                 (pInOut->flags.overlay == TRUE))
-        {
-            tileType = ADDR_DISPLAYABLE;
-        }
-        else
-        {
-            tileType = ADDR_NON_DISPLAYABLE;
-        }
-    }
-
-    if (pInOut->flags.prt)
-    {
-        tileMode = ADDR_TM_2D_TILED_THIN1;
-        tileType = (tileType == ADDR_DISPLAYABLE) ? ADDR_NON_DISPLAYABLE : tileType;
-    }
-
-    pInOut->tileMode = tileMode;
-    pInOut->tileType = tileType;
-
-    // Optimize tile mode if possible
-    pInOut->flags.opt4Space = TRUE;
-
-    // Optimize tile mode if possible
-    OptimizeTileMode(pInOut);
-
-    HwlOverrideTileMode(pInOut);
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeMaxBaseAlignments
-*
-*   @brief
-*       Gets maximum alignments
-*   @return
-*       maximum alignments
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlComputeMaxBaseAlignments() const
-{
-    const UINT_32 pipes = HwlGetPipes(&m_tileTable[0].info);
-
-    // Initial size is 64 KiB for PRT.
-    UINT_32 maxBaseAlign = 64 * 1024;
-
-    for (UINT_32 i = 0; i < m_noOfEntries; i++)
-    {
-        if ((IsMacroTiled(m_tileTable[i].mode) == TRUE) &&
-            (IsPrtTileMode(m_tileTable[i].mode) == FALSE))
-        {
-            // The maximum tile size is 16 byte-per-pixel and either 8-sample or 8-slice.
-            UINT_32 tileSize = Min(m_tileTable[i].info.tileSplitBytes,
-                                   MicroTilePixels * 8 * 16);
-
-            UINT_32 baseAlign = tileSize * pipes * m_tileTable[i].info.banks *
-                                m_tileTable[i].info.bankWidth * m_tileTable[i].info.bankHeight;
-
-            if (baseAlign > maxBaseAlign)
-            {
-                maxBaseAlign = baseAlign;
-            }
-        }
-    }
-
-    return maxBaseAlign;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeMaxMetaBaseAlignments
-*
-*   @brief
-*       Gets maximum alignments for metadata
-*   @return
-*       maximum alignments for metadata
-****************************************************************************************************
-*/
-UINT_32 SiLib::HwlComputeMaxMetaBaseAlignments() const
-{
-    UINT_32 maxPipe = 1;
-
-    for (UINT_32 i = 0; i < m_noOfEntries; i++)
-    {
-        maxPipe = Max(maxPipe, HwlGetPipes(&m_tileTable[i].info));
-    }
-
-    return m_pipeInterleaveBytes * maxPipe;
-}
-
-/**
-****************************************************************************************************
-*   SiLib::HwlComputeSurfaceAlignmentsMacroTiled
-*
-*   @brief
-*       Hardware layer function to compute alignment request for macro tile mode
-*
-*   @return
-*       N/A
-*
-****************************************************************************************************
-*/
-VOID SiLib::HwlComputeSurfaceAlignmentsMacroTiled(
-    AddrTileMode                      tileMode,           ///< [in] tile mode
-    UINT_32                           bpp,                ///< [in] bits per pixel
-    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
-    UINT_32                           mipLevel,           ///< [in] mip level
-    UINT_32                           numSamples,         ///< [in] number of samples
-    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
-    ) const
-{
-    if ((mipLevel == 0) && (flags.prt))
-    {
-        UINT_32 macroTileSize = pOut->blockWidth * pOut->blockHeight * numSamples * bpp / 8;
-
-        if (macroTileSize < PrtTileSize)
-        {
-            UINT_32 numMacroTiles = PrtTileSize / macroTileSize;
-
-            ADDR_ASSERT((PrtTileSize % macroTileSize) == 0);
-
-            pOut->pitchAlign *= numMacroTiles;
-            pOut->baseAlign  *= numMacroTiles;
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::InitEquationTable
-*
-*   @brief
-*       Initialize Equation table.
-*
-*   @return
-*       N/A
-****************************************************************************************************
-*/
-VOID SiLib::InitEquationTable()
-{
-    ADDR_EQUATION_KEY equationKeyTable[EquationTableSize];
-    memset(equationKeyTable, 0, sizeof(equationKeyTable));
-
-    memset(m_equationTable, 0, sizeof(m_equationTable));
-
-    memset(m_blockWidth, 0, sizeof(m_blockWidth));
-
-    memset(m_blockHeight, 0, sizeof(m_blockHeight));
-
-    memset(m_blockSlices, 0, sizeof(m_blockSlices));
-
-    // Loop all possible bpp
-    for (UINT_32 log2ElementBytes = 0; log2ElementBytes < MaxNumElementBytes; log2ElementBytes++)
-    {
-        // Get bits per pixel
-        UINT_32 bpp = 1 << (log2ElementBytes + 3);
-
-        // Loop all possible tile index
-        for (INT_32 tileIndex = 0; tileIndex < static_cast<INT_32>(m_noOfEntries); tileIndex++)
-        {
-            UINT_32 equationIndex = ADDR_INVALID_EQUATION_INDEX;
-
-            TileConfig tileConfig = m_tileTable[tileIndex];
-
-            ADDR_SURFACE_FLAGS flags = {{0}};
-
-            // Compute tile info, hardcode numSamples to 1 because MSAA is not supported
-            // in swizzle pattern equation
-            HwlComputeMacroModeIndex(tileIndex, flags, bpp, 1, &tileConfig.info, NULL, NULL);
-
-            // Check if the input is supported
-            if (IsEquationSupported(bpp, tileConfig, tileIndex, log2ElementBytes) == TRUE)
-            {
-                ADDR_EQUATION_KEY  key   = {{0}};
-
-                // Generate swizzle equation key from bpp and tile config
-                key.fields.log2ElementBytes = log2ElementBytes;
-                key.fields.tileMode         = tileConfig.mode;
-                // Treat depth micro tile type and non-display micro tile type as the same key
-                // because they have the same equation actually
-                key.fields.microTileType    = (tileConfig.type == ADDR_DEPTH_SAMPLE_ORDER) ?
-                                              ADDR_NON_DISPLAYABLE : tileConfig.type;
-                key.fields.pipeConfig       = tileConfig.info.pipeConfig;
-                key.fields.numBanksLog2     = Log2(tileConfig.info.banks);
-                key.fields.bankWidth        = tileConfig.info.bankWidth;
-                key.fields.bankHeight       = tileConfig.info.bankHeight;
-                key.fields.macroAspectRatio = tileConfig.info.macroAspectRatio;
-                key.fields.prt              = ((m_chipFamily == ADDR_CHIP_FAMILY_SI) &&
-                                               ((1 << tileIndex) & SiPrtTileIndexMask)) ? 1 : 0;
-
-                // Find in the table if the equation has been built based on the key
-                for (UINT_32 i = 0; i < m_numEquations; i++)
-                {
-                    if (key.value == equationKeyTable[i].value)
-                    {
-                        equationIndex = i;
-                        break;
-                    }
-                }
-
-                // If found, just fill the index into the lookup table and no need
-                // to generate the equation again. Otherwise, generate the equation.
-                if (equationIndex == ADDR_INVALID_EQUATION_INDEX)
-                {
-                    ADDR_EQUATION equation;
-                    ADDR_E_RETURNCODE retCode;
-
-                    memset(&equation, 0, sizeof(ADDR_EQUATION));
-
-                    // Generate the equation
-                    if (IsMicroTiled(tileConfig.mode))
-                    {
-                        retCode = ComputeMicroTileEquation(log2ElementBytes,
-                                                           tileConfig.mode,
-                                                           tileConfig.type,
-                                                           &equation);
-                    }
-                    else
-                    {
-                        retCode = ComputeMacroTileEquation(log2ElementBytes,
-                                                           tileConfig.mode,
-                                                           tileConfig.type,
-                                                           &tileConfig.info,
-                                                           &equation);
-                    }
-                    // Only fill the equation into the table if the return code is ADDR_OK,
-                    // otherwise if the return code is not ADDR_OK, it indicates this is not
-                    // a valid input, we do nothing but just fill invalid equation index
-                    // into the lookup table.
-                    if (retCode == ADDR_OK)
-                    {
-                        equationIndex = m_numEquations;
-                        ADDR_ASSERT(equationIndex < EquationTableSize);
-
-                        m_blockSlices[equationIndex] = Thickness(tileConfig.mode);
-
-                        if (IsMicroTiled(tileConfig.mode))
-                        {
-                            m_blockWidth[equationIndex]  = MicroTileWidth;
-                            m_blockHeight[equationIndex] = MicroTileHeight;
-                        }
-                        else
-                        {
-                            const ADDR_TILEINFO* pTileInfo = &tileConfig.info;
-
-                            m_blockWidth[equationIndex]  =
-                                HwlGetPipes(pTileInfo) * MicroTileWidth * pTileInfo->bankWidth *
-                                pTileInfo->macroAspectRatio;
-                            m_blockHeight[equationIndex] =
-                                MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
-                                pTileInfo->macroAspectRatio;
-
-                            if (key.fields.prt)
-                            {
-                                UINT_32 macroTileSize =
-                                    m_blockWidth[equationIndex] * m_blockHeight[equationIndex] *
-                                    bpp / 8;
-
-                                if (macroTileSize < PrtTileSize)
-                                {
-                                    UINT_32 numMacroTiles = PrtTileSize / macroTileSize;
-
-                                    ADDR_ASSERT(macroTileSize == (1u << equation.numBits));
-                                    ADDR_ASSERT((PrtTileSize % macroTileSize) == 0);
-
-                                    UINT_32 numBits = Log2(numMacroTiles);
-
-                                    UINT_32 xStart = Log2(m_blockWidth[equationIndex]) +
-                                                     log2ElementBytes;
-
-                                    m_blockWidth[equationIndex] *= numMacroTiles;
-
-                                    for (UINT_32 i = 0; i < numBits; i++)
-                                    {
-                                        equation.addr[equation.numBits + i].valid = 1;
-                                        equation.addr[equation.numBits + i].index = xStart + i;
-                                    }
-
-                                    equation.numBits += numBits;
-                                }
-                            }
-                        }
-
-                        equationKeyTable[equationIndex] = key;
-                        m_equationTable[equationIndex]  = equation;
-
-                        m_numEquations++;
-                    }
-                }
-            }
-
-            // Fill the index into the lookup table, if the combination is not supported
-            // fill the invalid equation index
-            m_equationLookupTable[log2ElementBytes][tileIndex] = equationIndex;
-        }
-
-        if (m_chipFamily == ADDR_CHIP_FAMILY_SI)
-        {
-            // For tile index 3 which is shared between PRT depth and uncompressed depth
-            m_uncompressDepthEqIndex = m_numEquations;
-
-            for (UINT_32 log2ElemBytes = 0; log2ElemBytes < MaxNumElementBytes; log2ElemBytes++)
-            {
-                TileConfig        tileConfig = m_tileTable[3];
-                ADDR_EQUATION     equation;
-                ADDR_E_RETURNCODE retCode;
-
-                memset(&equation, 0, sizeof(ADDR_EQUATION));
-
-                retCode = ComputeMacroTileEquation(log2ElemBytes,
-                                                   tileConfig.mode,
-                                                   tileConfig.type,
-                                                   &tileConfig.info,
-                                                   &equation);
-
-                if (retCode == ADDR_OK)
-                {
-                    UINT_32 equationIndex = m_numEquations;
-                    ADDR_ASSERT(equationIndex < EquationTableSize);
-
-                    m_blockSlices[equationIndex] = 1;
-
-                    const ADDR_TILEINFO* pTileInfo = &tileConfig.info;
-
-                    m_blockWidth[equationIndex]  =
-                        HwlGetPipes(pTileInfo) * MicroTileWidth * pTileInfo->bankWidth *
-                        pTileInfo->macroAspectRatio;
-                    m_blockHeight[equationIndex] =
-                        MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
-                        pTileInfo->macroAspectRatio;
-
-                    m_equationTable[equationIndex] = equation;
-
-                    m_numEquations++;
-                }
-            }
-        }
-    }
-}
-
-/**
-****************************************************************************************************
-*   SiLib::IsEquationSupported
-*
-*   @brief
-*       Check if it is supported for given bpp and tile config to generate a equation.
-*
-*   @return
-*       TRUE if supported
-****************************************************************************************************
-*/
-BOOL_32 SiLib::IsEquationSupported(
-    UINT_32    bpp,             ///< Bits per pixel
-    TileConfig tileConfig,      ///< Tile config
-    INT_32     tileIndex,       ///< Tile index
-    UINT_32    elementBytesLog2 ///< Log2 of element bytes
-    ) const
-{
-    BOOL_32 supported = TRUE;
-
-    // Linear tile mode is not supported in swizzle pattern equation
-    if (IsLinear(tileConfig.mode))
-    {
-        supported = FALSE;
-    }
-    // These tile modes are for Tex2DArray and Tex3D which has depth (num_slice > 1) use,
-    // which is not supported in swizzle pattern equation due to slice rotation
-    else if ((tileConfig.mode == ADDR_TM_2D_TILED_THICK)  ||
-             (tileConfig.mode == ADDR_TM_2D_TILED_XTHICK) ||
-             (tileConfig.mode == ADDR_TM_3D_TILED_THIN1)  ||
-             (tileConfig.mode == ADDR_TM_3D_TILED_THICK)  ||
-             (tileConfig.mode == ADDR_TM_3D_TILED_XTHICK))
-    {
-        supported = FALSE;
-    }
-    // Only 8bpp(stencil), 16bpp and 32bpp is supported for depth
-    else if ((tileConfig.type == ADDR_DEPTH_SAMPLE_ORDER) && (bpp > 32))
-    {
-        supported = FALSE;
-    }
-    // Tile split is not supported in swizzle pattern equation
-    else if (IsMacroTiled(tileConfig.mode))
-    {
-        UINT_32 thickness = Thickness(tileConfig.mode);
-        if (((bpp >> 3) * MicroTilePixels * thickness) > tileConfig.info.tileSplitBytes)
-        {
-            supported = FALSE;
-        }
-
-        if ((supported == TRUE) && (m_chipFamily == ADDR_CHIP_FAMILY_SI))
-        {
-            supported = m_EquationSupport[tileIndex][elementBytesLog2];
-        }
-    }
-
-    return supported;
-}
-
-} // V1
-} // Addr
diff --git a/src/amd/addrlib/r800/siaddrlib.h b/src/amd/addrlib/r800/siaddrlib.h
deleted file mode 100644 (file)
index d363df8..0000000
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Copyright © 2014 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  siaddrlib.h
-* @brief Contains the R800Lib class definition.
-****************************************************************************************************
-*/
-
-#ifndef __SI_ADDR_LIB_H__
-#define __SI_ADDR_LIB_H__
-
-#include "addrlib1.h"
-#include "egbaddrlib.h"
-
-namespace Addr
-{
-namespace V1
-{
-
-/**
-****************************************************************************************************
-* @brief Describes the information in tile mode table
-****************************************************************************************************
-*/
-struct TileConfig
-{
-    AddrTileMode  mode;
-    AddrTileType  type;
-    ADDR_TILEINFO info;
-};
-
-/**
-****************************************************************************************************
-* @brief SI specific settings structure.
-****************************************************************************************************
-*/
-struct SiChipSettings
-{
-    UINT_32 isSouthernIsland  : 1;
-    UINT_32 isTahiti          : 1;
-    UINT_32 isPitCairn        : 1;
-    UINT_32 isCapeVerde       : 1;
-    // Oland/Hainan are of GFXIP 6.0, similar with SI
-    UINT_32 isOland           : 1;
-    UINT_32 isHainan          : 1;
-
-    // CI
-    UINT_32 isSeaIsland       : 1;
-    UINT_32 isBonaire         : 1;
-    UINT_32 isKaveri          : 1;
-    UINT_32 isSpectre         : 1;
-    UINT_32 isSpooky          : 1;
-    UINT_32 isKalindi         : 1;
-    // Hawaii is GFXIP 7.2
-    UINT_32 isHawaii          : 1;
-
-    // VI
-    UINT_32 isVolcanicIslands : 1;
-    UINT_32 isIceland         : 1;
-    UINT_32 isTonga           : 1;
-    UINT_32 isFiji            : 1;
-    UINT_32 isPolaris10       : 1;
-    UINT_32 isPolaris11       : 1;
-    UINT_32 isPolaris12       : 1;
-    UINT_32 isVegaM           : 1;
-    // VI fusion
-    UINT_32 isCarrizo         : 1;
-};
-
-/**
-****************************************************************************************************
-* @brief This class is the SI specific address library
-*        function set.
-****************************************************************************************************
-*/
-class SiLib : public EgBasedLib
-{
-public:
-    /// Creates SiLib object
-    static Addr::Lib* CreateObj(const Client* pClient)
-    {
-        VOID* pMem = Object::ClientAlloc(sizeof(SiLib), pClient);
-        return (pMem != NULL) ? new (pMem) SiLib(pClient) : NULL;
-    }
-
-protected:
-    SiLib(const Client* pClient);
-    virtual ~SiLib();
-
-    // Hwl interface - defined in AddrLib1
-    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
-        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
-        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
-
-    virtual UINT_64 HwlComputeXmaskAddrFromCoord(
-        UINT_32 pitch, UINT_32 height, UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 numSlices,
-        UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
-        ADDR_TILEINFO* pTileInfo, UINT_32* pBitPosition) const;
-
-    virtual VOID HwlComputeXmaskCoordFromAddr(
-        UINT_64 addr, UINT_32 bitPosition, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
-        UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
-        ADDR_TILEINFO* pTileInfo, UINT_32* pX, UINT_32* pY, UINT_32* pSlice) const;
-
-    virtual ADDR_E_RETURNCODE HwlGetTileIndex(
-        const ADDR_GET_TILEINDEX_INPUT* pIn,
-        ADDR_GET_TILEINDEX_OUTPUT*      pOut) const;
-
-    virtual BOOL_32 HwlComputeMipLevel(
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
-
-    virtual ChipFamily HwlConvertChipFamily(
-        UINT_32 uChipFamily, UINT_32 uChipRevision);
-
-    virtual BOOL_32 HwlInitGlobalParams(
-        const ADDR_CREATE_INPUT* pCreateIn);
-
-    virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
-        UINT_32 bpp, INT_32 index, INT_32 macroModeIndex,
-        ADDR_TILEINFO* pInfo, AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
-
-    virtual VOID HwlComputeTileDataWidthAndHeightLinear(
-        UINT_32* pMacroWidth, UINT_32* pMacroHeight,
-        UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
-
-    virtual UINT_64 HwlComputeHtileBytes(
-        UINT_32 pitch, UINT_32 height, UINT_32 bpp,
-        BOOL_32 isLinear, UINT_32 numSlices, UINT_64* pSliceBytes, UINT_32 baseAlign) const;
-
-    virtual ADDR_E_RETURNCODE ComputeBankEquation(
-        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
-        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
-
-    virtual ADDR_E_RETURNCODE ComputePipeEquation(
-        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
-        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
-
-    virtual UINT_32 ComputePipeFromCoord(
-        UINT_32 x, UINT_32 y, UINT_32 slice,
-        AddrTileMode tileMode, UINT_32 pipeSwizzle, BOOL_32 ignoreSE,
-        ADDR_TILEINFO* pTileInfo) const;
-
-    virtual UINT_32 HwlGetPipes(const ADDR_TILEINFO* pTileInfo) const;
-
-    /// Pre-handler of 3x pitch (96 bit) adjustment
-    virtual UINT_32 HwlPreHandleBaseLvl3xPitch(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
-    /// Post-handler of 3x pitch adjustment
-    virtual UINT_32 HwlPostHandleBaseLvl3xPitch(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
-
-    /// Dummy function to finalize the inheritance
-    virtual UINT_32 HwlComputeXmaskCoordYFrom8Pipe(
-        UINT_32 pipe, UINT_32 x) const;
-
-    // Sub-hwl interface - defined in EgBasedLib
-    virtual VOID HwlSetupTileInfo(
-        AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
-        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
-        ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
-        AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    virtual UINT_32 HwlGetPitchAlignmentMicroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples) const;
-
-    virtual UINT_64 HwlGetSizeAdjustmentMicroTiled(
-        UINT_32 thickness, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
-        UINT_32 baseAlign, UINT_32 pitchAlign,
-        UINT_32 *pPitch, UINT_32 *pHeight) const;
-
-    virtual VOID HwlCheckLastMacroTiledLvl(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    virtual BOOL_32 HwlTileInfoEqual(
-        const ADDR_TILEINFO* pLeft, const ADDR_TILEINFO* pRight) const;
-
-    virtual AddrTileMode HwlDegradeThickTileMode(
-        AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
-
-    virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    /// Overwrite tile setting to PRT
-    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
-
-    virtual BOOL_32 HwlSanityCheckMacroTiled(
-        ADDR_TILEINFO* pTileInfo) const
-    {
-        return TRUE;
-    }
-
-    virtual UINT_32 HwlGetPitchAlignmentLinear(UINT_32 bpp, ADDR_SURFACE_FLAGS flags) const;
-
-    virtual UINT_64 HwlGetSizeAdjustmentLinear(
-        AddrTileMode tileMode,
-        UINT_32 bpp, UINT_32 numSamples, UINT_32 baseAlign, UINT_32 pitchAlign,
-        UINT_32 *pPitch, UINT_32 *pHeight, UINT_32 *pHeightAlign) const;
-
-    virtual VOID HwlComputeSurfaceCoord2DFromBankPipe(
-        AddrTileMode tileMode, UINT_32* pX, UINT_32* pY, UINT_32 slice,
-        UINT_32 bank, UINT_32 pipe,
-        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
-        BOOL_32 ignoreSE,
-        ADDR_TILEINFO* pTileInfo) const;
-
-    virtual UINT_32 HwlPreAdjustBank(
-        UINT_32 tileX, UINT_32 bank, ADDR_TILEINFO* pTileInfo) const;
-
-    virtual INT_32 HwlPostCheckTileIndex(
-        const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
-        INT curIndex = TileIndexInvalid) const;
-
-    virtual VOID HwlFmaskPreThunkSurfInfo(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
-        const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
-        ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
-        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
-
-    virtual VOID HwlFmaskPostThunkSurfInfo(
-        const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
-        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
-
-    virtual UINT_32 HwlComputeFmaskBits(
-        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
-        UINT_32* pNumSamples) const;
-
-    virtual BOOL_32 HwlReduceBankWidthHeight(
-        UINT_32 tileSize, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
-        UINT_32 bankHeightAlign, UINT_32 pipes,
-        ADDR_TILEINFO* pTileInfo) const
-    {
-        return TRUE;
-    }
-
-    virtual UINT_32 HwlComputeMaxBaseAlignments() const;
-
-    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
-
-    virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
-        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
-
-    // Get equation table pointer and number of equations
-    virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
-    {
-        *ppEquationTable = m_equationTable;
-
-        return m_numEquations;
-    }
-
-    // Check if it is supported for given bpp and tile config to generate an equation
-    BOOL_32 IsEquationSupported(
-        UINT_32 bpp, TileConfig tileConfig, INT_32 tileIndex, UINT_32 elementBytesLog2) const;
-
-    // Protected non-virtual functions
-    VOID ComputeTileCoordFromPipeAndElemIdx(
-        UINT_32 elemIdx, UINT_32 pipe, AddrPipeCfg pipeCfg, UINT_32 pitchInMacroTile,
-        UINT_32 x, UINT_32 y, UINT_32* pX, UINT_32* pY) const;
-
-    UINT_32 TileCoordToMaskElementIndex(
-        UINT_32 tx, UINT_32 ty, AddrPipeCfg  pipeConfig,
-        UINT_32 *macroShift, UINT_32 *elemIdxBits) const;
-
-    BOOL_32 DecodeGbRegs(
-        const ADDR_REGISTER_VALUE* pRegValue);
-
-    const TileConfig* GetTileSetting(
-        UINT_32 index) const;
-
-    // Initialize equation table
-    VOID InitEquationTable();
-
-    UINT_32 GetPipePerSurf(AddrPipeCfg pipeConfig) const;
-
-    static const UINT_32    TileTableSize = 32;
-    TileConfig              m_tileTable[TileTableSize];
-    UINT_32                 m_noOfEntries;
-
-    // Max number of bpp (8bpp/16bpp/32bpp/64bpp/128bpp)
-    static const UINT_32    MaxNumElementBytes  = 5;
-
-    static const BOOL_32    m_EquationSupport[TileTableSize][MaxNumElementBytes];
-
-    // Prt tile mode index mask
-    static const UINT_32    SiPrtTileIndexMask = ((1 << 3)  | (1 << 5)  | (1 << 6)  | (1 << 7)  |
-                                                  (1 << 21) | (1 << 22) | (1 << 23) | (1 << 24) |
-                                                  (1 << 25) | (1 << 30));
-
-    // More than half slots in tile mode table can't support equation
-    static const UINT_32    EquationTableSize   = (MaxNumElementBytes * TileTableSize) / 2;
-    // Equation table
-    ADDR_EQUATION           m_equationTable[EquationTableSize];
-    UINT_32                 m_numMacroBits[EquationTableSize];
-    UINT_32                 m_blockWidth[EquationTableSize];
-    UINT_32                 m_blockHeight[EquationTableSize];
-    UINT_32                 m_blockSlices[EquationTableSize];
-    // Number of equation entries in the table
-    UINT_32                 m_numEquations;
-    // Equation lookup table according to bpp and tile index
-    UINT_32                 m_equationLookupTable[MaxNumElementBytes][TileTableSize];
-
-    UINT_32                 m_uncompressDepthEqIndex;
-
-    SiChipSettings          m_settings;
-
-private:
-
-    VOID ReadGbTileMode(UINT_32 regValue, TileConfig* pCfg) const;
-    BOOL_32 InitTileSettingTable(const UINT_32 *pSetting, UINT_32 noOfEntries);
-};
-
-} // V1
-} // Addr
-
-#endif
-
diff --git a/src/amd/addrlib/src/addrinterface.cpp b/src/amd/addrlib/src/addrinterface.cpp
new file mode 100644 (file)
index 0000000..b4eabd5
--- /dev/null
@@ -0,0 +1,1740 @@
+/*
+ * Copyright © 2007-2018 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  addrinterface.cpp
+* @brief Contains the addrlib interface functions
+****************************************************************************************************
+*/
+#include "addrinterface.h"
+#include "addrlib1.h"
+#include "addrlib2.h"
+
+#include "addrcommon.h"
+
+#include "util/macros.h"
+
+using namespace Addr;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Create/Destroy/Config functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrCreate
+*
+*   @brief
+*       Create address lib object
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrCreate(
+    const ADDR_CREATE_INPUT*    pAddrCreateIn,  ///< [in] infomation for creating address lib object
+    ADDR_CREATE_OUTPUT*         pAddrCreateOut) ///< [out] address lib handle
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    {
+        returnCode = Lib::Create(pAddrCreateIn, pAddrCreateOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrDestroy
+*
+*   @brief
+*       Destroy address lib object
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrDestroy(
+    ADDR_HANDLE hLib) ///< address lib handle
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (hLib)
+    {
+        Lib* pLib = Lib::GetLib(hLib);
+        pLib->Destroy();
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                    Surface functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrComputeSurfaceInfo
+*
+*   @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 AddrComputeSurfaceInfo(
+    ADDR_HANDLE                             hLib, ///< address lib handle
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,  ///< [in] surface information
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut) ///< [out] surface parameters and alignments
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSurfaceInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeSurfaceAddrFromCoord
+*
+*   @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 AddrComputeSurfaceAddrFromCoord(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,  ///< [in] surface info and coordinates
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) ///< [out] surface address
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSurfaceAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeSurfaceCoordFromAddr
+*
+*   @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 AddrComputeSurfaceCoordFromAddr(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,  ///< [in] surface info and address
+    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut) ///< [out] coordinates
+{
+    V1::Lib* pLib = V1::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
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrComputeHtileInfo
+*
+*   @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 AddrComputeHtileInfo(
+    ADDR_HANDLE                             hLib, ///< address lib handle
+    const ADDR_COMPUTE_HTILE_INFO_INPUT*    pIn,  ///< [in] Htile information
+    ADDR_COMPUTE_HTILE_INFO_OUTPUT*         pOut) ///< [out] Htile pitch, height and size in bytes
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeHtileInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeHtileAddrFromCoord
+*
+*   @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 AddrComputeHtileAddrFromCoord(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,  ///< [in] Htile info and coordinates
+    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut) ///< [out] Htile address
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeHtileAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeHtileCoordFromAddr
+*
+*   @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 AddrComputeHtileCoordFromAddr(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,  ///< [in] Htile info and address
+    ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut) ///< [out] Htile coordinates
+{
+    V1::Lib* pLib = V1::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
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrComputeCmaskInfo
+*
+*   @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 AddrComputeCmaskInfo(
+    ADDR_HANDLE                             hLib, ///< address lib handle
+    const ADDR_COMPUTE_CMASK_INFO_INPUT*    pIn,  ///< [in] Cmask pitch and height
+    ADDR_COMPUTE_CMASK_INFO_OUTPUT*         pOut) ///< [out] Cmask pitch, height and size in bytes
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeCmaskInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeCmaskAddrFromCoord
+*
+*   @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 AddrComputeCmaskAddrFromCoord(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,  ///< [in] Cmask info and coordinates
+    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut) ///< [out] Cmask address
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeCmaskAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeCmaskCoordFromAddr
+*
+*   @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 AddrComputeCmaskCoordFromAddr(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,  ///< [in] Cmask info and address
+    ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut) ///< [out] Cmask coordinates
+{
+    V1::Lib* pLib = V1::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
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrComputeFmaskInfo
+*
+*   @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 AddrComputeFmaskInfo(
+    ADDR_HANDLE                             hLib, ///< address lib handle
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,  ///< [in] Fmask information
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut) ///< [out] Fmask pitch and height
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeFmaskInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeFmaskAddrFromCoord
+*
+*   @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 AddrComputeFmaskAddrFromCoord(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,  ///< [in] Fmask info and coordinates
+    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut) ///< [out] Fmask address
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeFmaskAddrFromCoord(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeFmaskCoordFromAddr
+*
+*   @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 AddrComputeFmaskCoordFromAddr(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,  ///< [in] Fmask info and address
+    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut) ///< [out] Fmask coordinates
+{
+    V1::Lib* pLib = V1::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
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrComputeDccInfo
+*
+*   @brief
+*       Compute DCC key size, base alignment based on color surface size, tile info or tile index
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo(
+    ADDR_HANDLE                             hLib,   ///< handle of addrlib
+    const ADDR_COMPUTE_DCCINFO_INPUT*       pIn,    ///< [in] input
+    ADDR_COMPUTE_DCCINFO_OUTPUT*            pOut)   ///< [out] output
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeDccInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Below functions are element related or helper functions
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrGetVersion
+*
+*   @brief
+*       Get AddrLib version number. Client may check this return value against ADDRLIB_VERSION
+*       defined in addrinterface.h to see if there is a mismatch.
+****************************************************************************************************
+*/
+UINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib)
+{
+    UINT_32 version = 0;
+
+    Addr::Lib* pLib = Lib::GetLib(hLib);
+
+    ADDR_ASSERT(pLib != NULL);
+
+    if (pLib)
+    {
+        version = pLib->GetVersion();
+    }
+
+    return version;
+}
+
+/**
+****************************************************************************************************
+*   AddrUseTileIndex
+*
+*   @brief
+*       Return TRUE if tileIndex is enabled in this address library
+****************************************************************************************************
+*/
+BOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib)
+{
+    BOOL_32 useTileIndex = FALSE;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_ASSERT(pLib != NULL);
+
+    if (pLib)
+    {
+        useTileIndex = pLib->UseTileIndex(0);
+    }
+
+    return useTileIndex;
+}
+
+/**
+****************************************************************************************************
+*   AddrUseCombinedSwizzle
+*
+*   @brief
+*       Return TRUE if combined swizzle is enabled in this address library
+****************************************************************************************************
+*/
+BOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib)
+{
+    BOOL_32 useCombinedSwizzle = FALSE;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_ASSERT(pLib != NULL);
+
+    if (pLib)
+    {
+        useCombinedSwizzle = pLib->UseCombinedSwizzle();
+    }
+
+    return useCombinedSwizzle;
+}
+
+/**
+****************************************************************************************************
+*   AddrExtractBankPipeSwizzle
+*
+*   @brief
+*       Extract Bank and Pipe swizzle from base256b
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle(
+    ADDR_HANDLE                                 hLib,     ///< addrlib handle
+    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,      ///< [in] input structure
+    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut)     ///< [out] output structure
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ExtractBankPipeSwizzle(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrCombineBankPipeSwizzle
+*
+*   @brief
+*       Combine Bank and Pipe swizzle
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle(
+    ADDR_HANDLE                                 hLib,
+    const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,
+    ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT*       pOut)
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->CombineBankPipeSwizzle(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeSliceSwizzle
+*
+*   @brief
+*       Compute a swizzle for slice from a base swizzle
+*   @return
+*       ADDR_OK if no error
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle(
+    ADDR_HANDLE                                 hLib,
+    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*      pIn,
+    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*           pOut)
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSliceTileSwizzle(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputeBaseSwizzle
+*
+*   @brief
+*       Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
+*   @return
+*       ADDR_OK if no error
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle(
+    ADDR_HANDLE                             hLib,
+    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
+    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT*       pOut)
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeBaseSwizzle(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   ElemFlt32ToDepthPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a depth/stencil pixel value
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel(
+    ADDR_HANDLE                         hLib,    ///< addrlib handle
+    const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,     ///< [in] per-component value
+    ELEM_FLT32TODEPTHPIXEL_OUTPUT*      pOut)    ///< [out] final pixel value
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    Lib* pLib = Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        pLib->Flt32ToDepthPixel(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   ElemFlt32ToColorPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel(
+    ADDR_HANDLE                         hLib,    ///< addrlib handle
+    const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,     ///< [in] format, surface number and swap value
+    ELEM_FLT32TOCOLORPIXEL_OUTPUT*      pOut)    ///< [out] final pixel value
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    Lib* pLib = Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        pLib->Flt32ToColorPixel(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   ElemGetExportNorm
+*
+*   @brief
+*       Helper function to check one format can be EXPORT_NUM,
+*       which is a register CB_COLOR_INFO.SURFACE_FORMAT.
+*       FP16 can be reported as EXPORT_NORM for rv770 in r600
+*       family
+*
+****************************************************************************************************
+*/
+BOOL_32 ADDR_API ElemGetExportNorm(
+    ADDR_HANDLE                     hLib, ///< addrlib handle
+    const ELEM_GETEXPORTNORM_INPUT* pIn)  ///< [in] input structure
+{
+    Addr::Lib* pLib = Lib::GetLib(hLib);
+    BOOL_32 enabled = FALSE;
+
+    MAYBE_UNUSED ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        enabled = pLib->GetExportNorm(pIn);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    ADDR_ASSERT(returnCode == ADDR_OK);
+
+    return enabled;
+}
+
+/**
+****************************************************************************************************
+*   ElemSize
+*
+*   @brief
+*       Get bits-per-element for specified format
+*
+*   @return
+*       Bits-per-element of specified format
+*
+****************************************************************************************************
+*/
+UINT_32 ADDR_API ElemSize(
+    ADDR_HANDLE hLib,
+    AddrFormat  format)
+{
+    UINT_32 bpe = 0;
+
+    Addr::Lib* pLib = Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        bpe = pLib->GetBpe(format);
+    }
+
+    return bpe;
+}
+
+/**
+****************************************************************************************************
+*   AddrConvertTileInfoToHW
+*
+*   @brief
+*       Convert tile info from real value to hardware register value
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW(
+    ADDR_HANDLE                             hLib, ///< address lib handle
+    const ADDR_CONVERT_TILEINFOTOHW_INPUT*  pIn,  ///< [in] tile info with real value
+    ADDR_CONVERT_TILEINFOTOHW_OUTPUT*       pOut) ///< [out] tile info with HW register value
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ConvertTileInfoToHW(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrConvertTileIndex
+*
+*   @brief
+*       Convert tile index to tile mode/type/info
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
+    ADDR_HANDLE                          hLib, ///< address lib handle
+    const ADDR_CONVERT_TILEINDEX_INPUT*  pIn,  ///< [in] input - tile index
+    ADDR_CONVERT_TILEINDEX_OUTPUT*       pOut) ///< [out] tile mode/type/info
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ConvertTileIndex(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrGetMacroModeIndex
+*
+*   @brief
+*       Get macro mode index based on input parameters
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
+    ADDR_HANDLE                          hLib, ///< address lib handle
+    const ADDR_GET_MACROMODEINDEX_INPUT* pIn,  ///< [in] input
+    ADDR_GET_MACROMODEINDEX_OUTPUT*      pOut) ///< [out] macro mode index
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->GetMacroModeIndex(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrConvertTileIndex1
+*
+*   @brief
+*       Convert tile index to tile mode/type/info
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1(
+    ADDR_HANDLE                          hLib, ///< address lib handle
+    const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,  ///< [in] input - tile index
+    ADDR_CONVERT_TILEINDEX_OUTPUT*       pOut) ///< [out] tile mode/type/info
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ConvertTileIndex1(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrGetTileIndex
+*
+*   @brief
+*       Get tile index from tile mode/type/info
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+*
+*   @note
+*       Only meaningful for SI (and above)
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetTileIndex(
+    ADDR_HANDLE                     hLib,
+    const ADDR_GET_TILEINDEX_INPUT* pIn,
+    ADDR_GET_TILEINDEX_OUTPUT*      pOut)
+{
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->GetTileIndex(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrComputePrtInfo
+*
+*   @brief
+*       Interface function for ComputePrtInfo
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo(
+    ADDR_HANDLE                 hLib,
+    const ADDR_PRT_INFO_INPUT*  pIn,
+    ADDR_PRT_INFO_OUTPUT*       pOut)
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    V1::Lib* pLib = V1::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputePrtInfo(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrGetMaxAlignments
+*
+*   @brief
+*       Convert maximum alignments
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
+    ADDR_HANDLE                     hLib, ///< address lib handle
+    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) ///< [out] output structure
+{
+    Addr::Lib* pLib = Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->GetMaxAlignments(pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   AddrGetMaxMetaAlignments
+*
+*   @brief
+*       Convert maximum alignments for metadata
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMaxMetaAlignments(
+    ADDR_HANDLE                     hLib, ///< address lib handle
+    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) ///< [out] output structure
+{
+    Addr::Lib* pLib = Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->GetMaxMetaAlignments(pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    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;
+}
+
+/**
+****************************************************************************************************
+*   Addr2ComputeDccAddrFromCoord
+*
+*   @brief
+*       Compute DCC key address according to coordinates
+*
+*   @return
+*       ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccAddrFromCoord(
+    ADDR_HANDLE                                     hLib, ///< address lib handle
+    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT*    pIn,  ///< [in] Dcc info and coordinates
+    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*         pOut) ///< [out] Dcc address
+{
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeDccAddrFromCoord(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;
+}
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSlicePipeBankXor
+*
+*   @brief
+*       Calculate slice pipe bank xor value based on base pipe bank xor and slice id.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSlicePipeBankXor(
+    ADDR_HANDLE                                  hLib, ///< handle of addrlib
+    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,  ///< [in] input
+    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) ///< [out] output
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSlicePipeBankXor(pIn, pOut);
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Addr2ComputeSubResourceOffsetForSwizzlePattern
+*
+*   @brief
+*       Calculate sub resource offset for swizzle pattern.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2ComputeSubResourceOffsetForSwizzlePattern(
+    ADDR_HANDLE                                                     hLib, ///< handle of addrlib
+    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,  ///< [in] input
+    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) ///< [out] output
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        returnCode = pLib->ComputeSubResourceOffsetForSwizzlePattern(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;
+}
+
+/**
+****************************************************************************************************
+*   Addr2IsValidDisplaySwizzleMode
+*
+*   @brief
+*       Return whether the swizzle mode is supported by DCE / DCN.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
+    ADDR_HANDLE     hLib,
+    AddrSwizzleMode swizzleMode,
+    UINT_32         bpp,
+    bool            *result)
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+    if (pLib != NULL)
+    {
+        ADDR2_COMPUTE_SURFACE_INFO_INPUT in;
+        in.swizzleMode = swizzleMode;
+        in.bpp = bpp;
+
+        *result = pLib->IsValidDisplaySwizzleMode(&in);
+        returnCode = ADDR_OK;
+    }
+    else
+    {
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
diff --git a/src/amd/addrlib/src/amdgpu_asic_addr.h b/src/amd/addrlib/src/amdgpu_asic_addr.h
new file mode 100644 (file)
index 0000000..41efd70
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright © 2017-2018 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.
+ */
+
+#ifndef _AMDGPU_ASIC_ADDR_H
+#define _AMDGPU_ASIC_ADDR_H
+
+#define ATI_VENDOR_ID         0x1002
+#define AMD_VENDOR_ID         0x1022
+
+// AMDGPU_VENDOR_IS_AMD(vendorId)
+#define AMDGPU_VENDOR_IS_AMD(v) ((v == ATI_VENDOR_ID) || (v == AMD_VENDOR_ID))
+
+#define FAMILY_UNKNOWN 0x00
+#define FAMILY_TN      0x69
+#define FAMILY_SI      0x6E
+#define FAMILY_CI      0x78
+#define FAMILY_KV      0x7D
+#define FAMILY_VI      0x82
+#define FAMILY_POLARIS 0x82
+#define FAMILY_CZ      0x87
+#define FAMILY_AI      0x8D
+#define FAMILY_RV      0x8E
+
+// AMDGPU_FAMILY_IS(familyId, familyName)
+#define FAMILY_IS(f, fn)     (f == FAMILY_##fn)
+#define FAMILY_IS_TN(f)      FAMILY_IS(f, TN)
+#define FAMILY_IS_SI(f)      FAMILY_IS(f, SI)
+#define FAMILY_IS_CI(f)      FAMILY_IS(f, CI)
+#define FAMILY_IS_KV(f)      FAMILY_IS(f, KV)
+#define FAMILY_IS_VI(f)      FAMILY_IS(f, VI)
+#define FAMILY_IS_POLARIS(f) FAMILY_IS(f, POLARIS)
+#define FAMILY_IS_CZ(f)      FAMILY_IS(f, CZ)
+#define FAMILY_IS_AI(f)      FAMILY_IS(f, AI)
+#define FAMILY_IS_RV(f)      FAMILY_IS(f, RV)
+
+#define AMDGPU_UNKNOWN          0xFF
+
+#define AMDGPU_TAHITI_RANGE     0x05, 0x14
+#define AMDGPU_PITCAIRN_RANGE   0x15, 0x28
+#define AMDGPU_CAPEVERDE_RANGE  0x29, 0x3C
+#define AMDGPU_OLAND_RANGE      0x3C, 0x46
+#define AMDGPU_HAINAN_RANGE     0x46, 0xFF
+
+#define AMDGPU_BONAIRE_RANGE    0x14, 0x28
+#define AMDGPU_HAWAII_RANGE     0x28, 0x3C
+
+#define AMDGPU_SPECTRE_RANGE    0x01, 0x41
+#define AMDGPU_SPOOKY_RANGE     0x41, 0x81
+#define AMDGPU_KALINDI_RANGE    0x81, 0xA1
+#define AMDGPU_GODAVARI_RANGE   0xA1, 0xFF
+
+#define AMDGPU_ICELAND_RANGE    0x01, 0x14
+#define AMDGPU_TONGA_RANGE      0x14, 0x28
+#define AMDGPU_FIJI_RANGE       0x3C, 0x50
+
+#define AMDGPU_POLARIS10_RANGE  0x50, 0x5A
+#define AMDGPU_POLARIS11_RANGE  0x5A, 0x64
+#define AMDGPU_POLARIS12_RANGE  0x64, 0x6E
+#define AMDGPU_VEGAM_RANGE      0x6E, 0xFF
+
+#define AMDGPU_CARRIZO_RANGE    0x01, 0x21
+#define AMDGPU_BRISTOL_RANGE    0x10, 0x21
+#define AMDGPU_STONEY_RANGE     0x61, 0xFF
+
+#define AMDGPU_VEGA10_RANGE     0x01, 0x14
+#define AMDGPU_VEGA12_RANGE     0x14, 0x28
+#define AMDGPU_VEGA20_RANGE     0x28, 0xFF
+
+#define AMDGPU_RAVEN_RANGE      0x01, 0x81
+#define AMDGPU_RAVEN2_RANGE     0x81, 0xFF
+
+#define AMDGPU_EXPAND_FIX(x) x
+#define AMDGPU_RANGE_HELPER(val, min, max) ((val >= min) && (val < max))
+#define AMDGPU_IN_RANGE(val, ...)   AMDGPU_EXPAND_FIX(AMDGPU_RANGE_HELPER(val, __VA_ARGS__))
+
+// ASICREV_IS(eRevisionId, revisionName)
+#define ASICREV_IS(r, rn)              AMDGPU_IN_RANGE(r, AMDGPU_##rn##_RANGE)
+#define ASICREV_IS_TAHITI_P(r)         ASICREV_IS(r, TAHITI)
+#define ASICREV_IS_PITCAIRN_PM(r)      ASICREV_IS(r, PITCAIRN)
+#define ASICREV_IS_CAPEVERDE_M(r)      ASICREV_IS(r, CAPEVERDE)
+#define ASICREV_IS_OLAND_M(r)          ASICREV_IS(r, OLAND)
+#define ASICREV_IS_HAINAN_V(r)         ASICREV_IS(r, HAINAN)
+
+#define ASICREV_IS_BONAIRE_M(r)        ASICREV_IS(r, BONAIRE)
+#define ASICREV_IS_HAWAII_P(r)         ASICREV_IS(r, HAWAII)
+
+#define ASICREV_IS_SPECTRE(r)          ASICREV_IS(r, SPECTRE)
+#define ASICREV_IS_SPOOKY(r)           ASICREV_IS(r, SPOOKY)
+#define ASICREV_IS_KALINDI(r)          ASICREV_IS(r, KALINDI)
+#define ASICREV_IS_KALINDI_GODAVARI(r) ASICREV_IS(r, GODAVARI)
+
+#define ASICREV_IS_ICELAND_M(r)        ASICREV_IS(r, ICELAND)
+#define ASICREV_IS_TONGA_P(r)          ASICREV_IS(r, TONGA)
+#define ASICREV_IS_FIJI_P(r)           ASICREV_IS(r, FIJI)
+
+#define ASICREV_IS_POLARIS10_P(r)      ASICREV_IS(r, POLARIS10)
+#define ASICREV_IS_POLARIS11_M(r)      ASICREV_IS(r, POLARIS11)
+#define ASICREV_IS_POLARIS12_V(r)      ASICREV_IS(r, POLARIS12)
+#define ASICREV_IS_VEGAM_P(r)          ASICREV_IS(r, VEGAM)
+
+#define ASICREV_IS_CARRIZO(r)          ASICREV_IS(r, CARRIZO)
+#define ASICREV_IS_CARRIZO_BRISTOL(r)  ASICREV_IS(r, BRISTOL)
+#define ASICREV_IS_STONEY(r)           ASICREV_IS(r, STONEY)
+
+#define ASICREV_IS_VEGA10_M(r)         ASICREV_IS(r, VEGA10)
+#define ASICREV_IS_VEGA10_P(r)         ASICREV_IS(r, VEGA10)
+#define ASICREV_IS_VEGA12_P(r)         ASICREV_IS(r, VEGA12)
+#define ASICREV_IS_VEGA12_p(r)         ASICREV_IS(r, VEGA12)
+#define ASICREV_IS_VEGA20_P(r)         ASICREV_IS(r, VEGA20)
+
+#define ASICREV_IS_RAVEN(r)            ASICREV_IS(r, RAVEN)
+#define ASICREV_IS_RAVEN2(r)           ASICREV_IS(r, RAVEN2)
+
+#endif // _AMDGPU_ASIC_ADDR_H
diff --git a/src/amd/addrlib/src/chip/gfx9/gfx9_gb_reg.h b/src/amd/addrlib/src/chip/gfx9/gfx9_gb_reg.h
new file mode 100644 (file)
index 0000000..ade70b9
--- /dev/null
@@ -0,0 +1,89 @@
+#if !defined (__GFX9_GB_REG_H__)
+#define __GFX9_GB_REG_H__
+
+/*
+ * Copyright © 2007-2018 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.
+ */
+
+#include "util/u_endian.h"
+
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+#define LITTLEENDIAN_CPU
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+#define BIGENDIAN_CPU
+#endif
+
+//
+// Make sure the necessary endian defines are there.
+//
+#if defined(LITTLEENDIAN_CPU)
+#elif defined(BIGENDIAN_CPU)
+#else
+#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
+#endif
+
+union GB_ADDR_CONFIG {
+    struct {
+#if        defined(LITTLEENDIAN_CPU)
+        unsigned int                       NUM_PIPES : 3;
+        unsigned int            PIPE_INTERLEAVE_SIZE : 3;
+        unsigned int            MAX_COMPRESSED_FRAGS : 2;
+        unsigned int            BANK_INTERLEAVE_SIZE : 3;
+        unsigned int                                 : 1;
+        unsigned int                       NUM_BANKS : 3;
+        unsigned int                                 : 1;
+        unsigned int         SHADER_ENGINE_TILE_SIZE : 3;
+        unsigned int              NUM_SHADER_ENGINES : 2;
+        unsigned int                        NUM_GPUS : 3;
+        unsigned int             MULTI_GPU_TILE_SIZE : 2;
+        unsigned int                   NUM_RB_PER_SE : 2;
+        unsigned int                        ROW_SIZE : 2;
+        unsigned int                 NUM_LOWER_PIPES : 1;
+        unsigned int                       SE_ENABLE : 1;
+#elif        defined(BIGENDIAN_CPU)
+        unsigned int                       SE_ENABLE : 1;
+        unsigned int                 NUM_LOWER_PIPES : 1;
+        unsigned int                        ROW_SIZE : 2;
+        unsigned int                   NUM_RB_PER_SE : 2;
+        unsigned int             MULTI_GPU_TILE_SIZE : 2;
+        unsigned int                        NUM_GPUS : 3;
+        unsigned int              NUM_SHADER_ENGINES : 2;
+        unsigned int         SHADER_ENGINE_TILE_SIZE : 3;
+        unsigned int                                 : 1;
+        unsigned int                       NUM_BANKS : 3;
+        unsigned int                                 : 1;
+        unsigned int            BANK_INTERLEAVE_SIZE : 3;
+        unsigned int            MAX_COMPRESSED_FRAGS : 2;
+        unsigned int            PIPE_INTERLEAVE_SIZE : 3;
+        unsigned int                       NUM_PIPES : 3;
+#endif
+    } bitfields, bits;
+    unsigned int    u32All;
+    signed int    i32All;
+    float    f32All;
+};
+
+#endif
+
diff --git a/src/amd/addrlib/src/chip/r800/si_gb_reg.h b/src/amd/addrlib/src/chip/r800/si_gb_reg.h
new file mode 100644 (file)
index 0000000..15711ee
--- /dev/null
@@ -0,0 +1,163 @@
+#if !defined (__SI_GB_REG_H__)
+#define __SI_GB_REG_H__
+
+/*
+ * Copyright © 2007-2018 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.
+ */
+
+#include "util/u_endian.h"
+
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+#define LITTLEENDIAN_CPU
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+#define BIGENDIAN_CPU
+#endif
+
+//
+// Make sure the necessary endian defines are there.
+//
+#if defined(LITTLEENDIAN_CPU)
+#elif defined(BIGENDIAN_CPU)
+#else
+#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
+#endif
+
+/*
+ * GB_ADDR_CONFIG struct
+ */
+
+#if     defined(LITTLEENDIAN_CPU)
+
+     typedef struct _GB_ADDR_CONFIG_T {
+          unsigned int num_pipes                      : 3;
+          unsigned int                                : 1;
+          unsigned int pipe_interleave_size           : 3;
+          unsigned int                                : 1;
+          unsigned int bank_interleave_size           : 3;
+          unsigned int                                : 1;
+          unsigned int num_shader_engines             : 2;
+          unsigned int                                : 2;
+          unsigned int shader_engine_tile_size        : 3;
+          unsigned int                                : 1;
+          unsigned int num_gpus                       : 3;
+          unsigned int                                : 1;
+          unsigned int multi_gpu_tile_size            : 2;
+          unsigned int                                : 2;
+          unsigned int row_size                       : 2;
+          unsigned int num_lower_pipes                : 1;
+          unsigned int                                : 1;
+     } GB_ADDR_CONFIG_T;
+
+#elif       defined(BIGENDIAN_CPU)
+
+     typedef struct _GB_ADDR_CONFIG_T {
+          unsigned int                                : 1;
+          unsigned int num_lower_pipes                : 1;
+          unsigned int row_size                       : 2;
+          unsigned int                                : 2;
+          unsigned int multi_gpu_tile_size            : 2;
+          unsigned int                                : 1;
+          unsigned int num_gpus                       : 3;
+          unsigned int                                : 1;
+          unsigned int shader_engine_tile_size        : 3;
+          unsigned int                                : 2;
+          unsigned int num_shader_engines             : 2;
+          unsigned int                                : 1;
+          unsigned int bank_interleave_size           : 3;
+          unsigned int                                : 1;
+          unsigned int pipe_interleave_size           : 3;
+          unsigned int                                : 1;
+          unsigned int num_pipes                      : 3;
+     } GB_ADDR_CONFIG_T;
+
+#endif
+
+typedef union {
+     unsigned int val : 32;
+     GB_ADDR_CONFIG_T f;
+} GB_ADDR_CONFIG;
+
+#if       defined(LITTLEENDIAN_CPU)
+
+     typedef struct _GB_TILE_MODE_T {
+          unsigned int micro_tile_mode                : 2;
+          unsigned int array_mode                     : 4;
+          unsigned int pipe_config                    : 5;
+          unsigned int tile_split                     : 3;
+          unsigned int bank_width                     : 2;
+          unsigned int bank_height                    : 2;
+          unsigned int macro_tile_aspect              : 2;
+          unsigned int num_banks                      : 2;
+          unsigned int micro_tile_mode_new            : 3;
+          unsigned int sample_split                   : 2;
+          unsigned int                                : 5;
+     } GB_TILE_MODE_T;
+
+     typedef struct _GB_MACROTILE_MODE_T {
+          unsigned int bank_width                     : 2;
+          unsigned int bank_height                    : 2;
+          unsigned int macro_tile_aspect              : 2;
+          unsigned int num_banks                      : 2;
+          unsigned int                                : 24;
+     } GB_MACROTILE_MODE_T;
+
+#elif          defined(BIGENDIAN_CPU)
+
+     typedef struct _GB_TILE_MODE_T {
+          unsigned int                                : 5;
+          unsigned int sample_split                   : 2;
+          unsigned int micro_tile_mode_new            : 3;
+          unsigned int num_banks                      : 2;
+          unsigned int macro_tile_aspect              : 2;
+          unsigned int bank_height                    : 2;
+          unsigned int bank_width                     : 2;
+          unsigned int tile_split                     : 3;
+          unsigned int pipe_config                    : 5;
+          unsigned int array_mode                     : 4;
+          unsigned int micro_tile_mode                : 2;
+     } GB_TILE_MODE_T;
+
+     typedef struct _GB_MACROTILE_MODE_T {
+          unsigned int                                : 24;
+          unsigned int num_banks                      : 2;
+          unsigned int macro_tile_aspect              : 2;
+          unsigned int bank_height                    : 2;
+          unsigned int bank_width                     : 2;
+     } GB_MACROTILE_MODE_T;
+
+#endif
+
+typedef union {
+     unsigned int val : 32;
+     GB_TILE_MODE_T f;
+} GB_TILE_MODE;
+
+typedef union {
+     unsigned int val : 32;
+     GB_MACROTILE_MODE_T f;
+} GB_MACROTILE_MODE;
+
+#endif
+
diff --git a/src/amd/addrlib/src/core/addrcommon.h b/src/amd/addrlib/src/core/addrcommon.h
new file mode 100644 (file)
index 0000000..f54f165
--- /dev/null
@@ -0,0 +1,922 @@
+/*
+ * Copyright © 2007-2018 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  addrcommon.h
+* @brief Contains the helper function and constants.
+****************************************************************************************************
+*/
+
+#ifndef __ADDR_COMMON_H__
+#define __ADDR_COMMON_H__
+
+#include "addrinterface.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#if !defined(DEBUG)
+#ifdef NDEBUG
+#define DEBUG 0
+#else
+#define DEBUG 1
+#endif
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Platform specific debug break defines
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#if DEBUG
+    #if defined(__GNUC__)
+        #define ADDR_DBG_BREAK()    assert(false)
+    #elif defined(__APPLE__)
+        #define ADDR_DBG_BREAK()    { IOPanic("");}
+    #else
+        #define ADDR_DBG_BREAK()    { __debugbreak(); }
+    #endif
+#else
+    #define ADDR_DBG_BREAK()
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Debug assertions used in AddrLib
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#if defined(_WIN32) && (_MSC_VER >= 1400)
+    #define ADDR_ANALYSIS_ASSUME(expr) __analysis_assume(expr)
+#else
+    #define ADDR_ANALYSIS_ASSUME(expr) do { (void)(expr); } while (0)
+#endif
+
+#define ADDR_ASSERT(__e) assert(__e)
+#define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK()
+#define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case")
+#define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented");
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Debug print macro from legacy address library
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#if DEBUG
+
+#define ADDR_PRNT(a)    Object::DebugPrint a
+
+/// @brief Macro for reporting informational messages
+/// @ingroup util
+///
+/// This macro optionally prints an informational message to stdout.
+/// The first parameter is a condition -- if it is true, nothing is done.
+/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
+/// starting with a string. This is passed to printf() or an equivalent
+/// in order to format the informational message. For example,
+/// ADDR_INFO(0, ("test %d",3) ); prints out "test 3".
+///
+#define ADDR_INFO(cond, a)         \
+{ if (!(cond)) { ADDR_PRNT(a); } }
+
+/// @brief Macro for reporting error warning messages
+/// @ingroup util
+///
+/// This macro optionally prints an error warning message to stdout,
+/// followed by the file name and line number where the macro was called.
+/// The first parameter is a condition -- if it is true, nothing is done.
+/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
+/// starting with a string. This is passed to printf() or an equivalent
+/// in order to format the informational message. For example,
+/// ADDR_WARN(0, ("test %d",3) ); prints out "test 3" followed by
+/// a second line with the file name and line number.
+///
+#define ADDR_WARN(cond, a)         \
+{ if (!(cond))                     \
+  { ADDR_PRNT(a);                  \
+    ADDR_PRNT(("  WARNING in file %s, line %d\n", __FILE__, __LINE__)); \
+} }
+
+/// @brief Macro for reporting fatal error conditions
+/// @ingroup util
+///
+/// This macro optionally stops execution of the current routine
+/// after printing an error warning message to stdout,
+/// followed by the file name and line number where the macro was called.
+/// The first parameter is a condition -- if it is true, nothing is done.
+/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
+/// starting with a string. This is passed to printf() or an equivalent
+/// in order to format the informational message. For example,
+/// ADDR_EXIT(0, ("test %d",3) ); prints out "test 3" followed by
+/// a second line with the file name and line number, then stops execution.
+///
+#define ADDR_EXIT(cond, a)         \
+{ if (!(cond))                     \
+  { ADDR_PRNT(a); ADDR_DBG_BREAK();\
+} }
+
+#else // DEBUG
+
+#define ADDRDPF 1 ? (void)0 : (void)
+
+#define ADDR_PRNT(a)
+
+#define ADDR_DBG_BREAK()
+
+#define ADDR_INFO(cond, a)
+
+#define ADDR_WARN(cond, a)
+
+#define ADDR_EXIT(cond, a)
+
+#endif // DEBUG
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define ADDR_C_ASSERT(__e) typedef char __ADDR_C_ASSERT__[(__e) ? 1 : -1]
+
+namespace Addr
+{
+
+namespace V1
+{
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common constants
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static const UINT_32 MicroTileWidth      = 8;       ///< Micro tile width, for 1D and 2D tiling
+static const UINT_32 MicroTileHeight     = 8;       ///< Micro tile height, for 1D and 2D tiling
+static const UINT_32 ThickTileThickness  = 4;       ///< Micro tile thickness, for THICK modes
+static const UINT_32 XThickTileThickness = 8;       ///< Extra thick tiling thickness
+static const UINT_32 PowerSaveTileBytes  = 64;      ///< Nuber of bytes per tile for power save 64
+static const UINT_32 CmaskCacheBits      = 1024;    ///< Number of bits for CMASK cache
+static const UINT_32 CmaskElemBits       = 4;       ///< Number of bits for CMASK element
+static const UINT_32 HtileCacheBits      = 16384;   ///< Number of bits for HTILE cache 512*32
+
+static const UINT_32 MicroTilePixels     = MicroTileWidth * MicroTileHeight;
+
+static const INT_32 TileIndexInvalid        = TILEINDEX_INVALID;
+static const INT_32 TileIndexLinearGeneral  = TILEINDEX_LINEAR_GENERAL;
+static const INT_32 TileIndexNoMacroIndex   = -3;
+
+} // V1
+
+namespace V2
+{
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common constants
+////////////////////////////////////////////////////////////////////////////////////////////////////
+static const UINT_32 MaxSurfaceHeight = 16384;
+
+} // V2
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common macros
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#define BITS_PER_BYTE 8
+#define BITS_TO_BYTES(x) ( ((x) + (BITS_PER_BYTE-1)) / BITS_PER_BYTE )
+#define BYTES_TO_BITS(x) ( (x) * BITS_PER_BYTE )
+
+/// Helper macros to select a single bit from an int (undefined later in section)
+#define _BIT(v,b)      (((v) >> (b) ) & 1)
+
+/**
+****************************************************************************************************
+* @brief Enums to identify AddrLib type
+****************************************************************************************************
+*/
+enum LibClass
+{
+    BASE_ADDRLIB = 0x0,
+    R600_ADDRLIB = 0x6,
+    R800_ADDRLIB = 0x8,
+    SI_ADDRLIB   = 0xa,
+    CI_ADDRLIB   = 0xb,
+    AI_ADDRLIB   = 0xd,
+};
+
+/**
+****************************************************************************************************
+* ChipFamily
+*
+*   @brief
+*       Neutral enums that specifies chip family.
+*
+****************************************************************************************************
+*/
+enum ChipFamily
+{
+    ADDR_CHIP_FAMILY_IVLD,    ///< Invalid family
+    ADDR_CHIP_FAMILY_R6XX,
+    ADDR_CHIP_FAMILY_R7XX,
+    ADDR_CHIP_FAMILY_R8XX,
+    ADDR_CHIP_FAMILY_NI,
+    ADDR_CHIP_FAMILY_SI,
+    ADDR_CHIP_FAMILY_CI,
+    ADDR_CHIP_FAMILY_VI,
+    ADDR_CHIP_FAMILY_AI,
+};
+
+/**
+****************************************************************************************************
+* ConfigFlags
+*
+*   @brief
+*       This structure is used to set configuration flags.
+****************************************************************************************************
+*/
+union ConfigFlags
+{
+    struct
+    {
+        /// These flags are set up internally thru AddrLib::Create() based on ADDR_CREATE_FLAGS
+        UINT_32 optimalBankSwap        : 1;    ///< New bank tiling for RV770 only
+        UINT_32 noCubeMipSlicesPad     : 1;    ///< Disables faces padding for cubemap mipmaps
+        UINT_32 fillSizeFields         : 1;    ///< If clients fill size fields in all input and
+                                               ///  output structure
+        UINT_32 ignoreTileInfo         : 1;    ///< Don't use tile info structure
+        UINT_32 useTileIndex           : 1;    ///< Make tileIndex field in input valid
+        UINT_32 useCombinedSwizzle     : 1;    ///< Use combined swizzle
+        UINT_32 checkLast2DLevel       : 1;    ///< Check the last 2D mip sub level
+        UINT_32 useHtileSliceAlign     : 1;    ///< Do htile single slice alignment
+        UINT_32 allowLargeThickTile    : 1;    ///< Allow 64*thickness*bytesPerPixel > rowSize
+        UINT_32 disableLinearOpt       : 1;    ///< Disallow tile modes to be optimized to linear
+        UINT_32 use32bppFor422Fmt      : 1;    ///< View 422 formats as 32 bits per pixel element
+        UINT_32 reserved               : 21;   ///< Reserved bits for future use
+    };
+
+    UINT_32 value;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Misc helper functions
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   AddrXorReduce
+*
+*   @brief
+*       Xor the right-side numberOfBits bits of x.
+****************************************************************************************************
+*/
+static inline UINT_32 XorReduce(
+    UINT_32 x,
+    UINT_32 numberOfBits)
+{
+    UINT_32 i;
+    UINT_32 result = x & 1;
+
+    for (i=1; i<numberOfBits; i++)
+    {
+        result ^= ((x>>i) & 1);
+    }
+
+    return result;
+}
+
+/**
+****************************************************************************************************
+*   IsPow2
+*
+*   @brief
+*       Check if the size (UINT_32) is pow 2
+****************************************************************************************************
+*/
+static inline UINT_32 IsPow2(
+    UINT_32 dim)        ///< [in] dimension of miplevel
+{
+    ADDR_ASSERT(dim > 0);
+    return !(dim & (dim - 1));
+}
+
+/**
+****************************************************************************************************
+*   IsPow2
+*
+*   @brief
+*       Check if the size (UINT_64) is pow 2
+****************************************************************************************************
+*/
+static inline UINT_64 IsPow2(
+    UINT_64 dim)        ///< [in] dimension of miplevel
+{
+    ADDR_ASSERT(dim > 0);
+    return !(dim & (dim - 1));
+}
+
+/**
+****************************************************************************************************
+*   ByteAlign
+*
+*   @brief
+*       Align UINT_32 "x" to "align" alignment, "align" should be power of 2
+****************************************************************************************************
+*/
+static inline UINT_32 PowTwoAlign(
+    UINT_32 x,
+    UINT_32 align)
+{
+    //
+    // Assert that x is a power of two.
+    //
+    ADDR_ASSERT(IsPow2(align));
+    return (x + (align - 1)) & (~(align - 1));
+}
+
+/**
+****************************************************************************************************
+*   ByteAlign
+*
+*   @brief
+*       Align UINT_64 "x" to "align" alignment, "align" should be power of 2
+****************************************************************************************************
+*/
+static inline UINT_64 PowTwoAlign(
+    UINT_64 x,
+    UINT_64 align)
+{
+    //
+    // Assert that x is a power of two.
+    //
+    ADDR_ASSERT(IsPow2(align));
+    return (x + (align - 1)) & (~(align - 1));
+}
+
+/**
+****************************************************************************************************
+*   Min
+*
+*   @brief
+*       Get the min value between two unsigned values
+****************************************************************************************************
+*/
+static inline UINT_32 Min(
+    UINT_32 value1,
+    UINT_32 value2)
+{
+    return ((value1 < (value2)) ? (value1) : value2);
+}
+
+/**
+****************************************************************************************************
+*   Min
+*
+*   @brief
+*       Get the min value between two signed values
+****************************************************************************************************
+*/
+static inline INT_32 Min(
+    INT_32 value1,
+    INT_32 value2)
+{
+    return ((value1 < (value2)) ? (value1) : value2);
+}
+
+/**
+****************************************************************************************************
+*   Max
+*
+*   @brief
+*       Get the max value between two unsigned values
+****************************************************************************************************
+*/
+static inline UINT_32 Max(
+    UINT_32 value1,
+    UINT_32 value2)
+{
+    return ((value1 > (value2)) ? (value1) : value2);
+}
+
+/**
+****************************************************************************************************
+*   Max
+*
+*   @brief
+*       Get the max value between two signed values
+****************************************************************************************************
+*/
+static inline INT_32 Max(
+    INT_32 value1,
+    INT_32 value2)
+{
+    return ((value1 > (value2)) ? (value1) : value2);
+}
+
+/**
+****************************************************************************************************
+*   NextPow2
+*
+*   @brief
+*       Compute the mipmap's next level dim size
+****************************************************************************************************
+*/
+static inline UINT_32 NextPow2(
+    UINT_32 dim)        ///< [in] dimension of miplevel
+{
+    UINT_32 newDim = 1;
+
+    if (dim > 0x7fffffff)
+    {
+        ADDR_ASSERT_ALWAYS();
+        newDim = 0x80000000;
+    }
+    else
+    {
+        while (newDim < dim)
+        {
+            newDim <<= 1;
+        }
+    }
+
+    return newDim;
+}
+
+/**
+****************************************************************************************************
+*   Log2NonPow2
+*
+*   @brief
+*       Compute log of base 2 no matter the target is power of 2 or not
+****************************************************************************************************
+*/
+static inline UINT_32 Log2NonPow2(
+    UINT_32 x)      ///< [in] the value should calculate log based 2
+{
+    UINT_32 y;
+
+    y = 0;
+    while (x > 1)
+    {
+        x >>= 1;
+        y++;
+    }
+
+    return y;
+}
+
+/**
+****************************************************************************************************
+*   Log2
+*
+*   @brief
+*       Compute log of base 2
+****************************************************************************************************
+*/
+static inline UINT_32 Log2(
+    UINT_32 x)      ///< [in] the value should calculate log based 2
+{
+    // Assert that x is a power of two.
+    ADDR_ASSERT(IsPow2(x));
+
+    return Log2NonPow2(x);
+}
+
+/**
+****************************************************************************************************
+*   QLog2
+*
+*   @brief
+*       Compute log of base 2 quickly (<= 16)
+****************************************************************************************************
+*/
+static inline UINT_32 QLog2(
+    UINT_32 x)      ///< [in] the value should calculate log based 2
+{
+    ADDR_ASSERT(x <= 16);
+
+    UINT_32 y = 0;
+
+    switch (x)
+    {
+        case 1:
+            y = 0;
+            break;
+        case 2:
+            y = 1;
+            break;
+        case 4:
+            y = 2;
+            break;
+        case 8:
+            y = 3;
+            break;
+        case 16:
+            y = 4;
+            break;
+        default:
+            ADDR_ASSERT_ALWAYS();
+    }
+
+    return y;
+}
+
+/**
+****************************************************************************************************
+*   SafeAssign
+*
+*   @brief
+*       NULL pointer safe assignment
+****************************************************************************************************
+*/
+static inline VOID SafeAssign(
+    UINT_32*    pLVal,  ///< [in] Pointer to left val
+    UINT_32     rVal)   ///< [in] Right value
+{
+    if (pLVal)
+    {
+        *pLVal = rVal;
+    }
+}
+
+/**
+****************************************************************************************************
+*   SafeAssign
+*
+*   @brief
+*       NULL pointer safe assignment for 64bit values
+****************************************************************************************************
+*/
+static inline VOID SafeAssign(
+    UINT_64*    pLVal,  ///< [in] Pointer to left val
+    UINT_64     rVal)   ///< [in] Right value
+{
+    if (pLVal)
+    {
+        *pLVal = rVal;
+    }
+}
+
+/**
+****************************************************************************************************
+*   SafeAssign
+*
+*   @brief
+*       NULL pointer safe assignment for AddrTileMode
+****************************************************************************************************
+*/
+static inline VOID SafeAssign(
+    AddrTileMode*    pLVal, ///< [in] Pointer to left val
+    AddrTileMode     rVal)  ///< [in] Right value
+{
+    if (pLVal)
+    {
+        *pLVal = rVal;
+    }
+}
+
+/**
+****************************************************************************************************
+*   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: v[0]v[1]...v[num-2]v[num-1]
+****************************************************************************************************
+*/
+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
+*       Set channel initialization value via a return value
+****************************************************************************************************
+*/
+static inline ADDR_CHANNEL_SETTING InitChannel(
+    UINT_32     valid,     ///< [in] valid setting
+    UINT_32     channel,   ///< [in] channel setting
+    UINT_32     index)     ///< [in] index setting
+{
+    ADDR_CHANNEL_SETTING t;
+    t.valid = valid;
+    t.channel = channel;
+    t.index = index;
+
+    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->index;
+}
+
+/**
+****************************************************************************************************
+*   GetMaxValidChannelIndex
+*
+*   @brief
+*       Get max valid index for a specific channel
+****************************************************************************************************
+*/
+static inline UINT_32 GetMaxValidChannelIndex(
+    const 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;
+}
+
+/**
+****************************************************************************************************
+*   GetCoordActiveMask
+*
+*   @brief
+*       Get bit mask which indicates which positions in the equation match the target coord
+****************************************************************************************************
+*/
+static inline UINT_32 GetCoordActiveMask(
+    const 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)      ///< [in] index to be searched
+{
+    UINT_32 mask = 0;
+
+    for (UINT_32 i = 0; i < searchCount; i++)
+    {
+        if ((pChanSet[i].valid   == TRUE)    &&
+            (pChanSet[i].channel == channel) &&
+            (pChanSet[i].index   == index))
+        {
+            mask |= (1 << i);
+        }
+    }
+
+    return mask;
+}
+
+} // Addr
+
+#endif // __ADDR_COMMON_H__
+
diff --git a/src/amd/addrlib/src/core/addrelemlib.cpp b/src/amd/addrlib/src/core/addrelemlib.cpp
new file mode 100644 (file)
index 0000000..71c0ba7
--- /dev/null
@@ -0,0 +1,1830 @@
+/*
+ * Copyright © 2007-2018 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  addrelemlib.cpp
+* @brief Contains the class implementation for element/pixel related functions.
+****************************************************************************************************
+*/
+
+#include "addrelemlib.h"
+#include "addrlib.h"
+
+namespace Addr
+{
+
+/**
+****************************************************************************************************
+*   ElemLib::ElemLib
+*
+*   @brief
+*       constructor
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+ElemLib::ElemLib(
+    Lib* pAddrLib)  ///< [in] Parent addrlib instance pointer
+    :
+    Object(pAddrLib->GetClient()),
+    m_pAddrLib(pAddrLib)
+{
+    switch (m_pAddrLib->GetChipFamily())
+    {
+        case ADDR_CHIP_FAMILY_R6XX:
+            m_depthPlanarType = ADDR_DEPTH_PLANAR_R600;
+            m_fp16ExportNorm = 0;
+            break;
+        case ADDR_CHIP_FAMILY_R7XX:
+            m_depthPlanarType = ADDR_DEPTH_PLANAR_R600;
+            m_fp16ExportNorm = 1;
+            break;
+        case ADDR_CHIP_FAMILY_R8XX:
+        case ADDR_CHIP_FAMILY_NI: // Same as 8xx
+            m_depthPlanarType = ADDR_DEPTH_PLANAR_R800;
+            m_fp16ExportNorm = 1;
+            break;
+        default:
+            m_fp16ExportNorm = 1;
+            m_depthPlanarType = ADDR_DEPTH_PLANAR_R800;
+            break;
+    }
+
+    m_configFlags.value = 0;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::~ElemLib
+*
+*   @brief
+*       destructor
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+ElemLib::~ElemLib()
+{
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::Create
+*
+*   @brief
+*       Creates and initializes AddrLib object.
+*
+*   @return
+*       Returns point to ADDR_CREATEINFO if successful.
+****************************************************************************************************
+*/
+ElemLib* ElemLib::Create(
+    const Lib* pAddrLib)   ///< [in] Pointer of parent AddrLib instance
+{
+    ElemLib* pElemLib = NULL;
+
+    if (pAddrLib)
+    {
+        VOID* pObj = Object::ClientAlloc(sizeof(ElemLib), pAddrLib->GetClient());
+        if (pObj)
+        {
+            pElemLib = new(pObj) ElemLib(const_cast<Lib* const>(pAddrLib));
+        }
+    }
+
+    return pElemLib;
+}
+
+/**************************************************************************************************
+*   ElemLib::Flt32sToInt32s
+*
+*   @brief
+*       Convert a ADDR_FLT_32 value to Int32 value
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::Flt32sToInt32s(
+    ADDR_FLT_32     value,      ///< [in] ADDR_FLT_32 value
+    UINT_32         bits,       ///< [in] nubmer of bits in value
+    NumberType      numberType, ///< [in] the type of number
+    UINT_32*        pResult)    ///< [out] Int32 value
+{
+    UINT_8 round = 128;    //ADDR_ROUND_BY_HALF
+    UINT_32 uscale;
+    UINT_32 sign;
+
+    //convert each component to an INT_32
+    switch ( numberType )
+    {
+        case ADDR_NO_NUMBER:    //fall through
+        case ADDR_ZERO:         //fall through
+        case ADDR_ONE:          //fall through
+        case ADDR_EPSILON:      //fall through
+            return;        // these are zero-bit components, so don't set result
+
+        case ADDR_UINT_BITS:            // unsigned integer bit field, clamped to range
+            uscale = (1<<bits) - 1;
+            if (bits == 32)               // special case unsigned 32-bit int
+            {
+                *pResult = value.i;
+            }
+            else
+            {
+                if ((value.i < 0) || (value.u > uscale))
+                {
+                    *pResult = uscale;
+                }
+                else
+                {
+                    *pResult = value.i;
+                }
+                return;
+            }
+
+        // The algorithm used in the DB and TX differs at one value for 24-bit unorms
+        case ADDR_UNORM_R6XXDB:        // unsigned repeating fraction
+            if ((bits==24) && (value.i == 0x33000000))
+            {
+                *pResult = 1;
+                return;
+            }              // Else treat like ADDR_UNORM_R6XX
+
+        case ADDR_UNORM_R6XX:            // unsigned repeating fraction
+            if (value.f <= 0)
+            {
+                *pResult = 0;            // first clamp to [0..1]
+            }
+            else
+            {
+                if (value.f >= 1)
+                {
+                     *pResult = (1<<bits) - 1;
+                }
+                else
+                {
+                    if ((value.i | 0x87FFFFFF) == 0xFFFFFFFF)
+                    {
+                        *pResult = 0;                        // NaN, so force to 0
+                    }
+
+                    #if 0 // floating point version for documentation
+                    else
+                    {
+                        FLOAT f = value.f * ((1<<bits) - 1);
+                        *pResult = static_cast<INT_32>(f + (round/256.0f));
+                    }
+                    #endif
+                    else
+                    {
+                        ADDR_FLT_32 scaled;
+                        ADDR_FLT_32 shifted;
+                        UINT_64 truncated, rounded;
+                        UINT_32 altShift;
+                        UINT_32 mask = (1 << bits) - 1;
+                        UINT_32 half = 1 << (bits - 1);
+                        UINT_32 mant24 = (value.i & 0x7FFFFF) + 0x800000;
+                        UINT_64 temp = mant24 - (mant24>>bits) -
+                            static_cast<INT_32>((mant24 & mask) > half);
+                        UINT_32 exp8 = value.i >> 23;
+                        UINT_32 shift = 126 - exp8 + 24 - bits;
+                        UINT_64 final;
+
+                        if (shift >= 32) // This is zero, even with maximum dither add
+                        {
+                            final = 0;
+                        }
+                        else
+                        {
+                            final = ((temp<<8) + (static_cast<UINT_64>(round)<<shift)) >> (shift+8);
+                        }
+                        //ADDR_EXIT( *pResult == final,
+                        //    ("Float %x converted to %d-bit Unorm %x != bitwise %x",
+                        //     value.u, bits, (UINT_32)*pResult, (UINT_32)final) );
+                        if (final > mask)
+                        {
+                            final = mask;
+                        }
+
+                        scaled.f  = value.f * ((1<<bits) - 1);
+                        shifted.f = (scaled.f * 256);
+                        truncated = ((shifted.i&0x7FFFFF) + (INT_64)0x800000) << 8;
+                        altShift  = 126 + 24 + 8 - ((shifted.i>>23)&0xFF);
+                        truncated = (altShift > 60) ? 0 : truncated >> altShift;
+                        rounded   = static_cast<INT_32>((round + truncated) >> 8);
+                        //if (rounded > ((1<<bits) - 1))
+                        //    rounded = ((1<<bits) - 1);
+                        *pResult = static_cast<INT_32>(rounded); //(INT_32)final;
+                    }
+                }
+            }
+
+            return;
+
+        case ADDR_S8FLOAT32:    // 32-bit IEEE float, passes through NaN values
+            *pResult = value.i;
+            return;
+
+        // @@ FIX ROUNDING in this code, fix the denorm case
+        case ADDR_U4FLOATC:         // Unsigned float, 4-bit exponent. bias 15, clamped [0..1]
+            sign = (value.i >> 31) & 1;
+            if ((value.i&0x7F800000) == 0x7F800000)    // If NaN or INF:
+            {
+                if ((value.i&0x007FFFFF) != 0)             // then if NaN
+                {
+                    *pResult = 0;                       // return 0
+                }
+                else
+                {
+                    *pResult = (sign)?0:0xF00000;           // else +INF->+1, -INF->0
+                }
+                return;
+            }
+            if (value.f <= 0)
+            {
+                *pResult = 0;
+            }
+            else
+            {
+                if (value.f>=1)
+                {
+                    *pResult = 0xF << (bits-4);
+                }
+                else
+                {
+                    if ((value.i>>23) > 112 )
+                    {
+                        // 24-bit float: normalized
+                        // value.i += 1 << (22-bits+4);
+                        // round the IEEE mantissa to mantissa size
+                        // @@ NOTE: add code to support rounding
+                        value.u &= 0x7FFFFFF;             // mask off high 4 exponent bits
+                        *pResult = value.i >> (23-bits+4);// shift off unused mantissa bits
+                    }
+                    else
+                    {
+                        // 24-bit float: denormalized
+                        value.f = value.f / (1<<28) / (1<<28);
+                        value.f = value.f / (1<<28) / (1<<28);    // convert to IEEE denorm
+                        // value.i += 1 << (22-bits+4);
+                        // round the IEEE mantissa to mantissa size
+                        // @@ NOTE: add code to support rounding
+                        *pResult = value.i >> (23-bits+4);    // shift off unused mantissa bits
+                    }
+                }
+            }
+
+            return;
+
+        default:                    // invalid number mode
+            //ADDR_EXIT(0, ("Invalid AddrNumber %d", numberType) );
+            break;
+
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::Int32sToPixel
+*
+*   @brief
+*       Pack 32-bit integer values into an uncompressed pixel,
+*       in the proper order
+*
+*   @return
+*       N/A
+*
+*   @note
+*       This entry point packes four 32-bit integer values into
+*       an uncompressed pixel. The pixel values are specifies in
+*       standard order, e.g. depth/stencil. This routine asserts
+*       if called on compressed pixel.
+****************************************************************************************************
+*/
+VOID ElemLib::Int32sToPixel(
+    UINT_32              numComps,      ///< [in] number of components
+    UINT_32*             pComps,        ///< [in] compnents
+    UINT_32*             pCompBits,     ///< [in] total bits in each component
+    UINT_32*             pCompStart,    ///< [in] the first bit position of each component
+    ComponentFlags       properties,    ///< [in] properties about byteAligned, exportNorm
+    UINT_32              resultBits,    ///< [in] result bits: total bpp after decompression
+    UINT_8*              pPixel)        ///< [out] a depth/stencil pixel value
+{
+    UINT_32 i;
+    UINT_32 j;
+    UINT_32 start;
+    UINT_32 size;
+    UINT_32 byte;
+    UINT_32 value = 0;
+    UINT_32 compMask;
+    UINT_32 elemMask=0;
+    UINT_32 elementXor = 0;  // address xor when reading bytes from elements
+
+    // @@ NOTE: assert if called on a compressed format!
+
+    if (properties.byteAligned)    // Components are all byte-sized
+    {
+        for (i = 0; i < numComps; i++)        // Then for each component
+        {
+            // Copy the bytes of the component into the element
+            start = pCompStart[i] / 8;
+            size  = pCompBits[i]  / 8;
+            for (j = 0; j < size; j++)
+            {
+                pPixel[(j+start)^elementXor] = static_cast<UINT_8>(pComps[i] >> (8*j));
+            }
+        }
+    }
+    else                        // Element is 32-bits or less, components are bit fields
+    {
+        // First, extract each component in turn and combine it into a 32-bit value
+        for (i = 0; i < numComps; i++)
+        {
+            compMask = (1 << pCompBits[i]) - 1;
+            elemMask |= compMask << pCompStart[i];
+            value |= (pComps[i] & compMask) << pCompStart[i];
+        }
+
+        // Mext, copy the masked value into the element
+        size = (resultBits + 7) / 8;
+        for (i = 0; i < size; i++)
+        {
+            byte = pPixel[i^elementXor] & ~(elemMask >> (8*i));
+            pPixel[i^elementXor] = static_cast<UINT_8>(byte | ((elemMask & value) >> (8*i)));
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   Flt32ToDepthPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a depth/stencil pixel value
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::Flt32ToDepthPixel(
+    AddrDepthFormat     format,     ///< [in] Depth format
+    const ADDR_FLT_32   comps[2],   ///< [in] two components of depth
+    UINT_8*             pPixel      ///< [out] depth pixel value
+    ) const
+{
+    UINT_32 i;
+    UINT_32 values[2];
+    ComponentFlags properties;  // byteAligned, exportNorm
+    UINT_32 resultBits = 0;     // result bits: total bits per pixel after decompression
+
+    PixelFormatInfo fmt;
+
+    // get type for each component
+    PixGetDepthCompInfo(format, &fmt);
+
+    //initialize properties
+    properties.byteAligned = TRUE;
+    properties.exportNorm  = TRUE;
+    properties.floatComp   = FALSE;
+
+    //set properties and result bits
+    for (i = 0; i < 2; i++)
+    {
+        if ((fmt.compBit[i] & 7) || (fmt.compStart[i] & 7))
+        {
+            properties.byteAligned = FALSE;
+        }
+
+        if (resultBits < fmt.compStart[i] + fmt.compBit[i])
+        {
+            resultBits = fmt.compStart[i] + fmt.compBit[i];
+        }
+
+        // Clear ADDR_EXPORT_NORM if can't be represented as 11-bit or smaller [-1..+1] format
+        if (fmt.compBit[i] > 11 || fmt.numType[i] >= ADDR_USCALED)
+        {
+            properties.exportNorm = FALSE;
+        }
+
+        // Mark if there are any floating point components
+        if ((fmt.numType[i] == ADDR_U4FLOATC) || (fmt.numType[i] >= ADDR_S8FLOAT) )
+        {
+            properties.floatComp = TRUE;
+        }
+    }
+
+    // Convert the two input floats to integer values
+    for (i = 0; i < 2; i++)
+    {
+        Flt32sToInt32s(comps[i], fmt.compBit[i], fmt.numType[i], &values[i]);
+    }
+
+    // Then pack the two integer components, in the proper order
+    Int32sToPixel(2, values, fmt.compBit, fmt.compStart, properties, resultBits, pPixel );
+
+}
+
+/**
+****************************************************************************************************
+*   Flt32ToColorPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::Flt32ToColorPixel(
+    AddrColorFormat     format,     ///< [in] Color format
+    AddrSurfaceNumber   surfNum,    ///< [in] Surface number
+    AddrSurfaceSwap     surfSwap,   ///< [in] Surface swap
+    const ADDR_FLT_32   comps[4],   ///< [in] four components of color
+    UINT_8*             pPixel      ///< [out] a red/green/blue/alpha pixel value
+    ) const
+{
+    PixelFormatInfo pixelInfo;
+
+    UINT_32 i;
+    UINT_32 values[4];
+    ComponentFlags properties;    // byteAligned, exportNorm
+    UINT_32 resultBits = 0;       // result bits: total bits per pixel after decompression
+
+    memset(&pixelInfo, 0, sizeof(PixelFormatInfo));
+
+    PixGetColorCompInfo(format, surfNum, surfSwap, &pixelInfo);
+
+    //initialize properties
+    properties.byteAligned = TRUE;
+    properties.exportNorm  = TRUE;
+    properties.floatComp   = FALSE;
+
+    //set properties and result bits
+    for (i = 0; i < 4; i++)
+    {
+        if ( (pixelInfo.compBit[i] & 7) || (pixelInfo.compStart[i] & 7) )
+        {
+            properties.byteAligned = FALSE;
+        }
+
+        if (resultBits < pixelInfo.compStart[i] + pixelInfo.compBit[i])
+        {
+            resultBits = pixelInfo.compStart[i] + pixelInfo.compBit[i];
+        }
+
+        if (m_fp16ExportNorm)
+        {
+            // Clear ADDR_EXPORT_NORM if can't be represented as 11-bit or smaller [-1..+1] format
+            // or if it's not FP and <=16 bits
+            if (((pixelInfo.compBit[i] > 11) || (pixelInfo.numType[i] >= ADDR_USCALED))
+                && (pixelInfo.numType[i] !=ADDR_U4FLOATC))
+            {
+                properties.exportNorm = FALSE;
+            }
+        }
+        else
+        {
+            // Clear ADDR_EXPORT_NORM if can't be represented as 11-bit or smaller [-1..+1] format
+            if (pixelInfo.compBit[i] > 11 || pixelInfo.numType[i] >= ADDR_USCALED)
+            {
+                properties.exportNorm = FALSE;
+            }
+        }
+
+        // Mark if there are any floating point components
+        if ( (pixelInfo.numType[i] == ADDR_U4FLOATC) ||
+             (pixelInfo.numType[i] >= ADDR_S8FLOAT) )
+        {
+            properties.floatComp = TRUE;
+        }
+    }
+
+    // Convert the four input floats to integer values
+    for (i = 0; i < 4; i++)
+    {
+        Flt32sToInt32s(comps[i], pixelInfo.compBit[i], pixelInfo.numType[i], &values[i]);
+    }
+
+    // Then pack the four integer components, in the proper order
+    Int32sToPixel(4, values, &pixelInfo.compBit[0], &pixelInfo.compStart[0],
+                  properties, resultBits, pPixel);
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::GetCompType
+*
+*   @brief
+*       Fill per component info
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID ElemLib::GetCompType(
+    AddrColorFormat   format,     ///< [in] surface format
+    AddrSurfaceNumber numType,  ///< [in] number type
+    PixelFormatInfo*  pInfo)       ///< [in][out] per component info out
+{
+    BOOL_32 handled = FALSE;
+
+    // Floating point formats override the number format
+    switch (format)
+    {
+        case ADDR_COLOR_16_FLOAT:            // fall through for all pure floating point format
+        case ADDR_COLOR_16_16_FLOAT:
+        case ADDR_COLOR_16_16_16_16_FLOAT:
+        case ADDR_COLOR_32_FLOAT:
+        case ADDR_COLOR_32_32_FLOAT:
+        case ADDR_COLOR_32_32_32_32_FLOAT:
+        case ADDR_COLOR_10_11_11_FLOAT:
+        case ADDR_COLOR_11_11_10_FLOAT:
+            numType = ADDR_NUMBER_FLOAT;
+            break;
+            // Special handling for the depth formats
+        case ADDR_COLOR_8_24:                // fall through for these 2 similar format
+        case ADDR_COLOR_24_8:
+            for (UINT_32 c = 0; c < 4; c++)
+            {
+                if (pInfo->compBit[c] == 8)
+                {
+                    pInfo->numType[c] = ADDR_UINT_BITS;
+                }
+                else if (pInfo->compBit[c]  == 24)
+                {
+                    pInfo->numType[c] = ADDR_UNORM_R6XX;
+                }
+                else
+                {
+                    pInfo->numType[c] = ADDR_NO_NUMBER;
+                }
+            }
+            handled = TRUE;
+            break;
+        case ADDR_COLOR_8_24_FLOAT:          // fall through for these 3 similar format
+        case ADDR_COLOR_24_8_FLOAT:
+        case ADDR_COLOR_X24_8_32_FLOAT:
+            for (UINT_32 c = 0; c < 4; c++)
+            {
+                if (pInfo->compBit[c] == 8)
+                {
+                    pInfo->numType[c] = ADDR_UINT_BITS;
+                }
+                else if (pInfo->compBit[c] == 24)
+                {
+                    pInfo->numType[c] = ADDR_U4FLOATC;
+                }
+                else if (pInfo->compBit[c] == 32)
+                {
+                    pInfo->numType[c] = ADDR_S8FLOAT32;
+                }
+                else
+                {
+                    pInfo->numType[c] = ADDR_NO_NUMBER;
+                }
+            }
+            handled = TRUE;
+            break;
+        default:
+            break;
+    }
+
+    if (!handled)
+    {
+        for (UINT_32 c = 0; c < 4; c++)
+        {
+            // Assign a number type for each component
+            AddrSurfaceNumber cnum;
+
+            // First handle default component values
+            if (pInfo->compBit[c] == 0)
+            {
+                if (c < 3)
+                {
+                    pInfo->numType[c] = ADDR_ZERO;      // Default is zero for RGB
+                }
+                else if (numType == ADDR_NUMBER_UINT || numType == ADDR_NUMBER_SINT)
+                {
+                    pInfo->numType[c] = ADDR_EPSILON;   // Alpha INT_32 bits default is 0x01
+                }
+                else
+                {
+                    pInfo->numType[c] = ADDR_ONE;       // Alpha normal default is float 1.0
+                }
+                continue;
+            }
+            // Now handle small components
+            else if (pInfo->compBit[c] == 1)
+            {
+                if (numType == ADDR_NUMBER_UINT || numType == ADDR_NUMBER_SINT)
+                {
+                    cnum = ADDR_NUMBER_UINT;
+                }
+                else
+                {
+                    cnum = ADDR_NUMBER_UNORM;
+                }
+            }
+            else
+            {
+                cnum = numType;
+            }
+
+            // If no default, set the number type fom num, compbits, and architecture
+            switch (cnum)
+            {
+                case ADDR_NUMBER_SRGB:
+                    pInfo->numType[c] = (c < 3) ? ADDR_GAMMA8_R6XX : ADDR_UNORM_R6XX;
+                    break;
+                case ADDR_NUMBER_UNORM:
+                    pInfo->numType[c] = ADDR_UNORM_R6XX;
+                    break;
+                case ADDR_NUMBER_SNORM:
+                    pInfo->numType[c] = ADDR_SNORM_R6XX;
+                    break;
+                case ADDR_NUMBER_USCALED:
+                    pInfo->numType[c] = ADDR_USCALED;  // @@ Do we need separate Pele routine?
+                    break;
+                case ADDR_NUMBER_SSCALED:
+                    pInfo->numType[c] = ADDR_SSCALED;  // @@ Do we need separate Pele routine?
+                    break;
+                case ADDR_NUMBER_FLOAT:
+                    if (pInfo->compBit[c] == 32)
+                    {
+                        pInfo->numType[c] = ADDR_S8FLOAT32;
+                    }
+                    else if (pInfo->compBit[c] == 16)
+                    {
+                        pInfo->numType[c] = ADDR_S5FLOAT;
+                    }
+                    else if (pInfo->compBit[c] >= 10)
+                    {
+                        pInfo->numType[c] = ADDR_U5FLOAT;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT_ALWAYS();
+                    }
+                    break;
+                case ADDR_NUMBER_SINT:
+                    pInfo->numType[c] = ADDR_SINT_BITS;
+                    break;
+                case ADDR_NUMBER_UINT:
+                    pInfo->numType[c] = ADDR_UINT_BITS;
+                    break;
+
+                default:
+                    ADDR_ASSERT(!"Invalid number type");
+                    pInfo->numType[c] = ADDR_NO_NUMBER;
+                    break;
+             }
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::GetCompSwap
+*
+*   @brief
+*       Get components swapped for color surface
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID ElemLib::GetCompSwap(
+    AddrSurfaceSwap  swap,   ///< [in] swap mode
+    PixelFormatInfo* pInfo)  ///< [in,out] output per component info
+{
+    switch (pInfo->comps)
+    {
+        case 4:
+            switch (swap)
+            {
+                case ADDR_SWAP_ALT:
+                    SwapComps( 0, 2, pInfo );
+                    break;    // BGRA
+                case ADDR_SWAP_STD_REV:
+                    SwapComps( 0, 3, pInfo );
+                    SwapComps( 1, 2, pInfo );
+                    break;    // ABGR
+                case ADDR_SWAP_ALT_REV:
+                    SwapComps( 0, 3, pInfo );
+                    SwapComps( 0, 2, pInfo );
+                    SwapComps( 0, 1, pInfo );
+                    break;    // ARGB
+                default:
+                    break;
+            }
+            break;
+        case 3:
+            switch (swap)
+            {
+                case ADDR_SWAP_ALT_REV:
+                    SwapComps( 0, 3, pInfo );
+                    SwapComps( 0, 2, pInfo );
+                    break;    // AGR
+                case ADDR_SWAP_STD_REV:
+                    SwapComps( 0, 2, pInfo );
+                    break;    // BGR
+                case ADDR_SWAP_ALT:
+                    SwapComps( 2, 3, pInfo );
+                    break;    // RGA
+                default:
+                    break;    // RGB
+            }
+            break;
+        case 2:
+            switch (swap)
+            {
+                case ADDR_SWAP_ALT_REV:
+                    SwapComps( 0, 1, pInfo );
+                    SwapComps( 1, 3, pInfo );
+                    break;    // AR
+                case ADDR_SWAP_STD_REV:
+                    SwapComps( 0, 1, pInfo );
+                    break;    // GR
+                case ADDR_SWAP_ALT:
+                    SwapComps( 1, 3, pInfo );
+                    break;    // RA
+                default:
+                    break;    // RG
+            }
+            break;
+        case 1:
+            switch (swap)
+            {
+                case ADDR_SWAP_ALT_REV:
+                    SwapComps( 0, 3, pInfo );
+                    break;    // A
+                case ADDR_SWAP_STD_REV:
+                    SwapComps( 0, 2, pInfo );
+                    break;    // B
+                case ADDR_SWAP_ALT:
+                    SwapComps( 0, 1, pInfo );
+                    break;    // G
+                default:
+                    break;    // R
+            }
+            break;
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::GetCompSwap
+*
+*   @brief
+*       Get components swapped for color surface
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID ElemLib::SwapComps(
+    UINT_32          c0,     ///< [in] component index 0
+    UINT_32          c1,     ///< [in] component index 1
+    PixelFormatInfo* pInfo)  ///< [in,out] output per component info
+{
+    UINT_32 start;
+    UINT_32 bits;
+
+    start = pInfo->compStart[c0];
+    pInfo->compStart[c0] = pInfo->compStart[c1];
+    pInfo->compStart[c1] = start;
+
+    bits  = pInfo->compBit[c0];
+    pInfo->compBit[c0] = pInfo->compBit[c1];
+    pInfo->compBit[c1] = bits;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::PixGetColorCompInfo
+*
+*   @brief
+*       Get per component info for color surface
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID ElemLib::PixGetColorCompInfo(
+    AddrColorFormat   format, ///< [in] surface format, read from register
+    AddrSurfaceNumber number, ///< [in] pixel number type
+    AddrSurfaceSwap   swap,   ///< [in] component swap mode
+    PixelFormatInfo*  pInfo   ///< [out] output per component info
+    ) const
+{
+    // 1. Get componet bits
+    switch (format)
+    {
+        case ADDR_COLOR_8:
+            GetCompBits(8, 0, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_1_5_5_5:
+            GetCompBits(5, 5, 5, 1, pInfo);
+            break;
+        case ADDR_COLOR_5_6_5:
+            GetCompBits(8, 6, 5, 0, pInfo);
+            break;
+        case ADDR_COLOR_6_5_5:
+            GetCompBits(5, 5, 6, 0, pInfo);
+            break;
+        case ADDR_COLOR_8_8:
+            GetCompBits(8, 8, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_4_4_4_4:
+            GetCompBits(4, 4, 4, 4, pInfo);
+            break;
+        case ADDR_COLOR_16:
+            GetCompBits(16, 0, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_8_8_8_8:
+            GetCompBits(8, 8, 8, 8, pInfo);
+            break;
+        case ADDR_COLOR_2_10_10_10:
+            GetCompBits(10, 10, 10, 2, pInfo);
+            break;
+        case ADDR_COLOR_10_11_11:
+            GetCompBits(11, 11, 10, 0, pInfo);
+            break;
+        case ADDR_COLOR_11_11_10:
+            GetCompBits(10, 11, 11, 0, pInfo);
+            break;
+        case ADDR_COLOR_16_16:
+            GetCompBits(16, 16, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_16_16_16_16:
+            GetCompBits(16, 16, 16, 16, pInfo);
+            break;
+        case ADDR_COLOR_16_FLOAT:
+            GetCompBits(16, 0, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_16_16_FLOAT:
+            GetCompBits(16, 16, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_32_FLOAT:
+            GetCompBits(32, 0, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_32_32_FLOAT:
+            GetCompBits(32, 32, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_16_16_16_16_FLOAT:
+            GetCompBits(16, 16, 16, 16, pInfo);
+            break;
+        case ADDR_COLOR_32_32_32_32_FLOAT:
+            GetCompBits(32, 32, 32, 32, pInfo);
+            break;
+
+        case ADDR_COLOR_32:
+            GetCompBits(32, 0, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_32_32:
+            GetCompBits(32, 32, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_32_32_32_32:
+            GetCompBits(32, 32, 32, 32, pInfo);
+            break;
+        case ADDR_COLOR_10_10_10_2:
+            GetCompBits(2, 10, 10, 10, pInfo);
+            break;
+        case ADDR_COLOR_10_11_11_FLOAT:
+            GetCompBits(11, 11, 10, 0, pInfo);
+            break;
+        case ADDR_COLOR_11_11_10_FLOAT:
+            GetCompBits(10, 11, 11, 0, pInfo);
+            break;
+        case ADDR_COLOR_5_5_5_1:
+            GetCompBits(1, 5, 5, 5, pInfo);
+            break;
+        case ADDR_COLOR_3_3_2:
+            GetCompBits(2, 3, 3, 0, pInfo);
+            break;
+        case ADDR_COLOR_4_4:
+            GetCompBits(4, 4, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_8_24:
+        case ADDR_COLOR_8_24_FLOAT:  // same bit count, fall through
+            GetCompBits(24, 8, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_24_8:
+        case ADDR_COLOR_24_8_FLOAT:  // same bit count, fall through
+            GetCompBits(8, 24, 0, 0, pInfo);
+            break;
+        case ADDR_COLOR_X24_8_32_FLOAT:
+            GetCompBits(32, 8, 0, 0, pInfo);
+            break;
+
+        case ADDR_COLOR_INVALID:
+            GetCompBits(0, 0, 0, 0, pInfo);
+            break;
+        default:
+            ADDR_ASSERT(0);
+            GetCompBits(0, 0, 0, 0, pInfo);
+            break;
+    }
+
+    // 2. Get component number type
+
+    GetCompType(format, number, pInfo);
+
+    // 3. Swap components if needed
+
+    GetCompSwap(swap, pInfo);
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::PixGetDepthCompInfo
+*
+*   @brief
+*       Get per component info for depth surface
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID ElemLib::PixGetDepthCompInfo(
+    AddrDepthFormat  format,     ///< [in] surface format, read from register
+    PixelFormatInfo* pInfo       ///< [out] output per component bits and type
+    ) const
+{
+    if (m_depthPlanarType == ADDR_DEPTH_PLANAR_R800)
+    {
+        if (format == ADDR_DEPTH_8_24_FLOAT)
+        {
+            format = ADDR_DEPTH_X24_8_32_FLOAT; // Use this format to represent R800's D24FS8
+        }
+
+        if (format == ADDR_DEPTH_X8_24_FLOAT)
+        {
+            format = ADDR_DEPTH_32_FLOAT;
+        }
+    }
+
+    switch (format)
+    {
+        case ADDR_DEPTH_16:
+            GetCompBits(16, 0, 0, 0, pInfo);
+            break;
+        case ADDR_DEPTH_8_24:
+        case ADDR_DEPTH_8_24_FLOAT:      // similar format, fall through
+            GetCompBits(24, 8, 0, 0, pInfo);
+            break;
+        case ADDR_DEPTH_X8_24:
+        case ADDR_DEPTH_X8_24_FLOAT:     // similar format, fall through
+            GetCompBits(24, 0, 0, 0, pInfo);
+            break;
+        case ADDR_DEPTH_32_FLOAT:
+            GetCompBits(32, 0, 0, 0, pInfo);
+            break;
+        case ADDR_DEPTH_X24_8_32_FLOAT:
+            GetCompBits(32, 8, 0, 0, pInfo);
+            break;
+        case ADDR_DEPTH_INVALID:
+            GetCompBits(0, 0, 0, 0, pInfo);
+            break;
+        default:
+            ADDR_ASSERT(0);
+            GetCompBits(0, 0, 0, 0, pInfo);
+            break;
+    }
+
+    switch (format)
+    {
+        case ADDR_DEPTH_16:
+            pInfo->numType [0] = ADDR_UNORM_R6XX;
+            pInfo->numType [1] = ADDR_ZERO;
+            break;
+        case ADDR_DEPTH_8_24:
+            pInfo->numType [0] = ADDR_UNORM_R6XXDB;
+            pInfo->numType [1] = ADDR_UINT_BITS;
+            break;
+        case ADDR_DEPTH_8_24_FLOAT:
+            pInfo->numType [0] = ADDR_U4FLOATC;
+            pInfo->numType [1] = ADDR_UINT_BITS;
+            break;
+        case ADDR_DEPTH_X8_24:
+            pInfo->numType [0] = ADDR_UNORM_R6XXDB;
+            pInfo->numType [1] = ADDR_ZERO;
+            break;
+        case ADDR_DEPTH_X8_24_FLOAT:
+            pInfo->numType [0] = ADDR_U4FLOATC;
+            pInfo->numType [1] = ADDR_ZERO;
+            break;
+        case ADDR_DEPTH_32_FLOAT:
+            pInfo->numType [0] = ADDR_S8FLOAT32;
+            pInfo->numType [1] = ADDR_ZERO;
+            break;
+        case ADDR_DEPTH_X24_8_32_FLOAT:
+            pInfo->numType [0] = ADDR_S8FLOAT32;
+            pInfo->numType [1] = ADDR_UINT_BITS;
+            break;
+        default:
+            pInfo->numType [0] = ADDR_NO_NUMBER;
+            pInfo->numType [1] = ADDR_NO_NUMBER;
+            break;
+    }
+
+    pInfo->numType [2] = ADDR_NO_NUMBER;
+    pInfo->numType [3] = ADDR_NO_NUMBER;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::PixGetExportNorm
+*
+*   @brief
+*       Check if fp16 export norm can be enabled.
+*
+*   @return
+*       TRUE if this can be enabled.
+*
+****************************************************************************************************
+*/
+BOOL_32 ElemLib::PixGetExportNorm(
+    AddrColorFormat     colorFmt,       ///< [in] surface format, read from register
+    AddrSurfaceNumber   numberFmt,      ///< [in] pixel number type
+    AddrSurfaceSwap     swap            ///< [in] components swap type
+    ) const
+{
+    BOOL_32 enabled = TRUE;
+
+    PixelFormatInfo formatInfo;
+
+    PixGetColorCompInfo(colorFmt, numberFmt, swap, &formatInfo);
+
+    for (UINT_32 c = 0; c < 4; c++)
+    {
+        if (m_fp16ExportNorm)
+        {
+            if (((formatInfo.compBit[c] > 11) || (formatInfo.numType[c] > ADDR_USCALED)) &&
+                (formatInfo.numType[c] != ADDR_U4FLOATC)    &&
+                (formatInfo.numType[c] != ADDR_S5FLOAT)     &&
+                (formatInfo.numType[c] != ADDR_S5FLOATM)    &&
+                (formatInfo.numType[c] != ADDR_U5FLOAT)     &&
+                (formatInfo.numType[c] != ADDR_U3FLOATM))
+            {
+                enabled = FALSE;
+                break;
+            }
+        }
+        else
+        {
+            if ((formatInfo.compBit[c] > 11) || (formatInfo.numType[c] > ADDR_USCALED))
+            {
+                enabled = FALSE;
+                break;
+            }
+        }
+    }
+
+    return enabled;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::AdjustSurfaceInfo
+*
+*   @brief
+*       Adjust bpp/base pitch/width/height according to elemMode and expandX/Y
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::AdjustSurfaceInfo(
+    ElemMode        elemMode,       ///< [in] element mode
+    UINT_32         expandX,        ///< [in] decompression expansion factor in X
+    UINT_32         expandY,        ///< [in] decompression expansion factor in Y
+    UINT_32*        pBpp,           ///< [in,out] bpp
+    UINT_32*        pBasePitch,     ///< [in,out] base pitch
+    UINT_32*        pWidth,         ///< [in,out] width
+    UINT_32*        pHeight)        ///< [in,out] height
+{
+    UINT_32 packedBits;
+    UINT_32 basePitch;
+    UINT_32 width;
+    UINT_32 height;
+    UINT_32 bpp;
+    BOOL_32 bBCnFormat = FALSE;
+
+    ADDR_ASSERT(pBpp != NULL);
+    ADDR_ASSERT(pWidth != NULL && pHeight != NULL && pBasePitch != NULL);
+
+    if (pBpp)
+    {
+        bpp = *pBpp;
+
+        switch (elemMode)
+        {
+            case ADDR_EXPANDED:
+                packedBits = bpp / expandX / expandY;
+                break;
+            case ADDR_PACKED_STD: // Different bit order
+            case ADDR_PACKED_REV:
+                packedBits = bpp * expandX * expandY;
+                break;
+            case ADDR_PACKED_GBGR:
+            case ADDR_PACKED_BGRG:
+                packedBits = bpp; // 32-bit packed ==> 2 32-bit result
+                break;
+            case ADDR_PACKED_BC1: // Fall through
+            case ADDR_PACKED_BC4:
+                packedBits = 64;
+                bBCnFormat = TRUE;
+                break;
+            case ADDR_PACKED_BC2: // Fall through
+            case ADDR_PACKED_BC3: // Fall through
+            case ADDR_PACKED_BC5: // Fall through
+                bBCnFormat = TRUE;
+                // fall through
+            case ADDR_PACKED_ASTC:
+            case ADDR_PACKED_ETC2_128BPP:
+                packedBits = 128;
+                break;
+            case ADDR_PACKED_ETC2_64BPP:
+                packedBits = 64;
+                break;
+            case ADDR_ROUND_BY_HALF:  // Fall through
+            case ADDR_ROUND_TRUNCATE: // Fall through
+            case ADDR_ROUND_DITHER:   // Fall through
+            case ADDR_UNCOMPRESSED:
+                packedBits = bpp;
+                break;
+            default:
+                packedBits = bpp;
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        *pBpp = packedBits;
+    }
+
+    if (pWidth && pHeight && pBasePitch)
+    {
+        basePitch = *pBasePitch;
+        width     = *pWidth;
+        height    = *pHeight;
+
+        if ((expandX > 1) || (expandY > 1))
+        {
+            if (elemMode == ADDR_EXPANDED)
+            {
+                basePitch *= expandX;
+                width     *= expandX;
+                height    *= expandY;
+            }
+            else
+            {
+                // Evergreen family workaround
+                if (bBCnFormat && (m_pAddrLib->GetChipFamily() == ADDR_CHIP_FAMILY_R8XX))
+                {
+                    // For BCn we now pad it to POW2 at the beginning so it is safe to
+                    // divide by 4 directly
+                    basePitch = basePitch / expandX;
+                    width     = width  / expandX;
+                    height    = height / expandY;
+#if DEBUG
+                    width     = (width == 0) ? 1 : width;
+                    height    = (height == 0) ? 1 : height;
+
+                    if ((*pWidth > PowTwoAlign(width, 8) * expandX) ||
+                        (*pHeight > PowTwoAlign(height, 8) * expandY)) // 8 is 1D tiling alignment
+                    {
+                        // if this assertion is hit we may have issues if app samples
+                        // rightmost/bottommost pixels
+                        ADDR_ASSERT_ALWAYS();
+                    }
+#endif
+                }
+                else // Not BCn format we still keep old way (FMT_1? No real test yet)
+                {
+                    basePitch = (basePitch + expandX - 1) / expandX;
+                    width     = (width + expandX - 1) / expandX;
+                    height    = (height + expandY - 1) / expandY;
+                }
+            }
+
+            *pBasePitch = basePitch; // 0 is legal value for base pitch.
+            *pWidth     = (width == 0) ? 1 : width;
+            *pHeight    = (height == 0) ? 1 : height;
+        } //if (pWidth && pHeight && pBasePitch)
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::RestoreSurfaceInfo
+*
+*   @brief
+*       Reverse operation of AdjustSurfaceInfo
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::RestoreSurfaceInfo(
+    ElemMode        elemMode,       ///< [in] element mode
+    UINT_32         expandX,        ///< [in] decompression expansion factor in X
+    UINT_32         expandY,        ///< [out] decompression expansion factor in Y
+    UINT_32*        pBpp,           ///< [in,out] bpp
+    UINT_32*        pWidth,         ///< [in,out] width
+    UINT_32*        pHeight)        ///< [in,out] height
+{
+    UINT_32 originalBits;
+    UINT_32 width;
+    UINT_32 height;
+    UINT_32 bpp;
+
+    BOOL_32 bBCnFormat = FALSE;
+    (void)bBCnFormat;
+
+    ADDR_ASSERT(pBpp != NULL);
+    ADDR_ASSERT(pWidth != NULL && pHeight != NULL);
+
+    if (pBpp)
+    {
+        bpp = *pBpp;
+
+        switch (elemMode)
+        {
+        case ADDR_EXPANDED:
+            originalBits = bpp * expandX * expandY;
+            break;
+        case ADDR_PACKED_STD: // Different bit order
+        case ADDR_PACKED_REV:
+            originalBits = bpp / expandX / expandY;
+            break;
+        case ADDR_PACKED_GBGR:
+        case ADDR_PACKED_BGRG:
+            originalBits = bpp; // 32-bit packed ==> 2 32-bit result
+            break;
+        case ADDR_PACKED_BC1: // Fall through
+        case ADDR_PACKED_BC4:
+            originalBits = 64;
+            bBCnFormat = TRUE;
+            break;
+        case ADDR_PACKED_BC2: // Fall through
+        case ADDR_PACKED_BC3: // Fall through
+        case ADDR_PACKED_BC5:
+            bBCnFormat = TRUE;
+            // fall through
+        case ADDR_PACKED_ASTC:
+        case ADDR_PACKED_ETC2_128BPP:
+            originalBits = 128;
+            break;
+        case ADDR_PACKED_ETC2_64BPP:
+            originalBits = 64;
+            break;
+        case ADDR_ROUND_BY_HALF:  // Fall through
+        case ADDR_ROUND_TRUNCATE: // Fall through
+        case ADDR_ROUND_DITHER:   // Fall through
+        case ADDR_UNCOMPRESSED:
+            originalBits = bpp;
+            break;
+        default:
+            originalBits = bpp;
+            ADDR_ASSERT_ALWAYS();
+            break;
+        }
+
+        *pBpp = originalBits;
+    }
+
+    if (pWidth && pHeight)
+    {
+        width    = *pWidth;
+        height   = *pHeight;
+
+        if ((expandX > 1) || (expandY > 1))
+        {
+            if (elemMode == ADDR_EXPANDED)
+            {
+                width /= expandX;
+                height /= expandY;
+            }
+            else
+            {
+                width *= expandX;
+                height *= expandY;
+            }
+        }
+
+        *pWidth  = (width == 0) ? 1 : width;
+        *pHeight = (height == 0) ? 1 : height;
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::GetBitsPerPixel
+*
+*   @brief
+*       Compute the total bits per element according to a format
+*       code. For compressed formats, this is not the same as
+*       the number of bits per decompressed element.
+*
+*   @return
+*       Bits per pixel
+****************************************************************************************************
+*/
+UINT_32 ElemLib::GetBitsPerPixel(
+    AddrFormat          format,         ///< [in] surface format code
+    ElemMode*           pElemMode,      ///< [out] element mode
+    UINT_32*            pExpandX,       ///< [out] decompression expansion factor in X
+    UINT_32*            pExpandY,       ///< [out] decompression expansion factor in Y
+    UINT_32*            pUnusedBits)    ///< [out] bits unused
+{
+    UINT_32 bpp;
+    UINT_32 expandX = 1;
+    UINT_32 expandY = 1;
+    UINT_32 bitUnused = 0;
+    ElemMode elemMode = ADDR_UNCOMPRESSED; // default value
+
+    switch (format)
+    {
+        case ADDR_FMT_8:
+            bpp = 8;
+            break;
+        case ADDR_FMT_1_5_5_5:
+        case ADDR_FMT_5_6_5:
+        case ADDR_FMT_6_5_5:
+        case ADDR_FMT_8_8:
+        case ADDR_FMT_4_4_4_4:
+        case ADDR_FMT_16:
+            bpp = 16;
+            break;
+        case ADDR_FMT_GB_GR:
+            elemMode = ADDR_PACKED_GBGR;
+            bpp      = m_configFlags.use32bppFor422Fmt ? 32 : 16;
+            expandX  = m_configFlags.use32bppFor422Fmt ? 2 : 1;
+            break;
+        case ADDR_FMT_BG_RG:
+            elemMode = ADDR_PACKED_BGRG;
+            bpp      = m_configFlags.use32bppFor422Fmt ? 32 : 16;
+            expandX  = m_configFlags.use32bppFor422Fmt ? 2 : 1;
+            break;
+        case ADDR_FMT_8_8_8_8:
+        case ADDR_FMT_2_10_10_10:
+        case ADDR_FMT_10_11_11:
+        case ADDR_FMT_11_11_10:
+        case ADDR_FMT_16_16:
+        case ADDR_FMT_32:
+        case ADDR_FMT_24_8:
+            bpp = 32;
+            break;
+        case ADDR_FMT_16_16_16_16:
+        case ADDR_FMT_32_32:
+        case ADDR_FMT_CTX1:
+            bpp = 64;
+            break;
+        case ADDR_FMT_32_32_32_32:
+            bpp = 128;
+            break;
+        case ADDR_FMT_INVALID:
+            bpp = 0;
+            break;
+        case ADDR_FMT_1_REVERSED:
+            elemMode = ADDR_PACKED_REV;
+            expandX = 8;
+            bpp = 1;
+            break;
+        case ADDR_FMT_1:
+            elemMode = ADDR_PACKED_STD;
+            expandX = 8;
+            bpp = 1;
+            break;
+        case ADDR_FMT_4_4:
+        case ADDR_FMT_3_3_2:
+            bpp = 8;
+            break;
+        case ADDR_FMT_5_5_5_1:
+            bpp = 16;
+            break;
+        case ADDR_FMT_32_AS_8:
+        case ADDR_FMT_32_AS_8_8:
+        case ADDR_FMT_8_24:
+        case ADDR_FMT_10_10_10_2:
+        case ADDR_FMT_5_9_9_9_SHAREDEXP:
+            bpp = 32;
+            break;
+        case ADDR_FMT_X24_8_32_FLOAT:
+            bpp = 64;
+            bitUnused = 24;
+            break;
+        case ADDR_FMT_8_8_8:
+            elemMode = ADDR_EXPANDED;
+            bpp = 24;//@@ 8;      // read 3 elements per pixel
+            expandX = 3;
+            break;
+        case ADDR_FMT_16_16_16:
+            elemMode = ADDR_EXPANDED;
+            bpp = 48;//@@ 16;      // read 3 elements per pixel
+            expandX = 3;
+            break;
+        case ADDR_FMT_32_32_32:
+            elemMode = ADDR_EXPANDED;
+            expandX = 3;
+            bpp = 96;//@@ 32;      // read 3 elements per pixel
+            break;
+        case ADDR_FMT_BC1:
+            elemMode = ADDR_PACKED_BC1;
+            expandX = 4;
+            expandY = 4;
+            bpp = 64;
+            break;
+        case ADDR_FMT_BC4:
+            elemMode = ADDR_PACKED_BC4;
+            expandX = 4;
+            expandY = 4;
+            bpp = 64;
+            break;
+        case ADDR_FMT_BC2:
+            elemMode = ADDR_PACKED_BC2;
+            expandX = 4;
+            expandY = 4;
+            bpp = 128;
+            break;
+        case ADDR_FMT_BC3:
+            elemMode = ADDR_PACKED_BC3;
+            expandX = 4;
+            expandY = 4;
+            bpp = 128;
+            break;
+        case ADDR_FMT_BC5:
+        case ADDR_FMT_BC6: // reuse ADDR_PACKED_BC5
+        case ADDR_FMT_BC7: // reuse ADDR_PACKED_BC5
+            elemMode = ADDR_PACKED_BC5;
+            expandX = 4;
+            expandY = 4;
+            bpp = 128;
+            break;
+
+        case ADDR_FMT_ETC2_64BPP:
+            elemMode = ADDR_PACKED_ETC2_64BPP;
+            expandX  = 4;
+            expandY  = 4;
+            bpp      = 64;
+            break;
+
+        case ADDR_FMT_ETC2_128BPP:
+            elemMode = ADDR_PACKED_ETC2_128BPP;
+            expandX  = 4;
+            expandY  = 4;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_4x4:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 4;
+            expandY  = 4;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_5x4:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 5;
+            expandY  = 4;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_5x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 5;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_6x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 6;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_6x6:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 6;
+            expandY  = 6;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_8x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 8;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_8x6:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 8;
+            expandY  = 6;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_8x8:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 8;
+            expandY  = 8;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x6:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 6;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x8:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 8;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x10:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 10;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_12x10:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 12;
+            expandY  = 10;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_12x12:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 12;
+            expandY  = 12;
+            bpp      = 128;
+            break;
+
+        default:
+            bpp = 0;
+            ADDR_ASSERT_ALWAYS();
+            break;
+            // @@ or should this be an error?
+    }
+
+    SafeAssign(pExpandX, expandX);
+    SafeAssign(pExpandY, expandY);
+    SafeAssign(pUnusedBits, bitUnused);
+    SafeAssign(reinterpret_cast<UINT_32*>(pElemMode), elemMode);
+
+    return bpp;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::GetCompBits
+*
+*   @brief
+*       Set each component's bit size and bit start. And set element mode and number type
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::GetCompBits(
+    UINT_32          c0,        ///< [in] bits of component 0
+    UINT_32          c1,        ///< [in] bits of component 1
+    UINT_32          c2,        ///< [in] bits of component 2
+    UINT_32          c3,        ///< [in] bits of component 3
+    PixelFormatInfo* pInfo,     ///< [out] per component info out
+    ElemMode         elemMode)  ///< [in] element mode
+{
+    pInfo->comps = 0;
+
+    pInfo->compBit[0] = c0;
+    pInfo->compBit[1] = c1;
+    pInfo->compBit[2] = c2;
+    pInfo->compBit[3] = c3;
+
+    pInfo->compStart[0] = 0;
+    pInfo->compStart[1] = c0;
+    pInfo->compStart[2] = c0+c1;
+    pInfo->compStart[3] = c0+c1+c2;
+
+    pInfo->elemMode = elemMode;
+    // still needed since component swap may depend on number of components
+    for (INT i=0; i<4; i++)
+    {
+        if (pInfo->compBit[i] == 0)
+        {
+            pInfo->compStart[i]  = 0;       // all null components start at bit 0
+            pInfo->numType[i] = ADDR_NO_NUMBER; // and have no number type
+        }
+        else
+        {
+            pInfo->comps++;
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::GetCompBits
+*
+*   @brief
+*       Set the clear color (or clear depth/stencil) for a surface
+*
+*   @note
+*       If clearColor is zero, a default clear value is used in place of comps[4].
+*       If float32 is set, full precision is used, else the mantissa is reduced to 12-bits
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID ElemLib::SetClearComps(
+    ADDR_FLT_32 comps[4],   ///< [in,out] components
+    BOOL_32 clearColor,     ///< [in] TRUE if clear color is set (CLEAR_COLOR)
+    BOOL_32 float32)        ///< [in] TRUE if float32 component (BLEND_FLOAT32)
+{
+    INT_32 i;
+
+    // Use default clearvalues if clearColor is disabled
+    if (clearColor == FALSE)
+    {
+        for (i=0; i<3; i++)
+        {
+            comps[i].f = 0.0;
+        }
+        comps[3].f = 1.0;
+    }
+
+    // Otherwise use the (modified) clear value
+    else
+    {
+        for (i=0; i<4; i++)
+        {   // If full precision, use clear value unchanged
+            if (float32)
+            {
+                // Do nothing
+                //comps[i] = comps[i];
+            }
+            // Else if it is a NaN, use the standard NaN value
+            else if ((comps[i].u & 0x7FFFFFFF) > 0x7F800000)
+            {
+                comps[i].u = 0xFFC00000;
+            }
+            // Else reduce the mantissa precision
+            else
+            {
+                comps[i].u = comps[i].u & 0xFFFFF000;
+            }
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::IsBlockCompressed
+*
+*   @brief
+*       TRUE if this is block compressed format
+*
+*   @note
+*
+*   @return
+*       BOOL_32
+****************************************************************************************************
+*/
+BOOL_32 ElemLib::IsBlockCompressed(
+    AddrFormat format)  ///< [in] Format
+{
+    return (((format >= ADDR_FMT_BC1) && (format <= ADDR_FMT_BC7)) ||
+            ((format >= ADDR_FMT_ASTC_4x4) && (format <= ADDR_FMT_ETC2_128BPP)));
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::IsCompressed
+*
+*   @brief
+*       TRUE if this is block compressed format or 1 bit format
+*
+*   @note
+*
+*   @return
+*       BOOL_32
+****************************************************************************************************
+*/
+BOOL_32 ElemLib::IsCompressed(
+    AddrFormat format)  ///< [in] Format
+{
+    return IsBlockCompressed(format) || format == ADDR_FMT_BC1 || format == ADDR_FMT_BC7;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::IsExpand3x
+*
+*   @brief
+*       TRUE if this is 3x expand format
+*
+*   @note
+*
+*   @return
+*       BOOL_32
+****************************************************************************************************
+*/
+BOOL_32 ElemLib::IsExpand3x(
+    AddrFormat format)  ///< [in] Format
+{
+    BOOL_32 is3x = FALSE;
+
+    switch (format)
+    {
+        case ADDR_FMT_8_8_8:
+        case ADDR_FMT_16_16_16:
+        case ADDR_FMT_32_32_32:
+            is3x = TRUE;
+            break;
+        default:
+            break;
+    }
+
+    return is3x;
+}
+
+/**
+****************************************************************************************************
+*   ElemLib::IsMacroPixelPacked
+*
+*   @brief
+*       TRUE if this is a macro-pixel-packed format.
+*
+*   @note
+*
+*   @return
+*       BOOL_32
+****************************************************************************************************
+*/
+BOOL_32 ElemLib::IsMacroPixelPacked(
+    AddrFormat format)  ///< [in] Format
+{
+    BOOL_32 isMacroPixelPacked = FALSE;
+
+    switch (format)
+    {
+        case ADDR_FMT_BG_RG:
+        case ADDR_FMT_GB_GR:
+            isMacroPixelPacked = TRUE;
+            break;
+        default:
+            break;
+    }
+
+    return isMacroPixelPacked;
+}
+
+}
diff --git a/src/amd/addrlib/src/core/addrelemlib.h b/src/amd/addrlib/src/core/addrelemlib.h
new file mode 100644 (file)
index 0000000..633f94c
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright © 2007-2018 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  addrelemlib.h
+* @brief Contains the class for element/pixel related functions.
+****************************************************************************************************
+*/
+
+#ifndef __ELEM_LIB_H__
+#define __ELEM_LIB_H__
+
+#include "addrinterface.h"
+#include "addrobject.h"
+#include "addrcommon.h"
+
+namespace Addr
+{
+
+class Lib;
+
+// The masks for property bits within the Properties INT_32
+union ComponentFlags
+{
+    struct
+    {
+        UINT_32 byteAligned    : 1;    ///< all components are byte aligned
+        UINT_32 exportNorm     : 1;    ///< components support R6xx NORM compression
+        UINT_32 floatComp      : 1;    ///< there is at least one floating point component
+    };
+
+    UINT_32 value;
+};
+
+// Copy from legacy lib's NumberType
+enum NumberType
+{
+    // The following number types have the range [-1..1]
+    ADDR_NO_NUMBER,         // This component doesn't exist and has no default value
+    ADDR_EPSILON,           // Force component value to integer 0x00000001
+    ADDR_ZERO,              // Force component value to integer 0x00000000
+    ADDR_ONE,               // Force component value to floating point 1.0
+    // Above values don't have any bits per component (keep ADDR_ONE the last of these)
+
+    ADDR_UNORM,             // Unsigned normalized (repeating fraction) full precision
+    ADDR_SNORM,             // Signed normalized (repeating fraction) full precision
+    ADDR_GAMMA,             // Gamma-corrected, full precision
+
+    ADDR_UNORM_R5XXRB,      // Unsigned normalized (repeating fraction) for r5xx RB
+    ADDR_SNORM_R5XXRB,      // Signed normalized (repeating fraction) for r5xx RB
+    ADDR_GAMMA_R5XXRB,      // Gamma-corrected for r5xx RB (note: unnormalized value)
+    ADDR_UNORM_R5XXBC,      // Unsigned normalized (repeating fraction) for r5xx BC
+    ADDR_SNORM_R5XXBC,      // Signed normalized (repeating fraction) for r5xx BC
+    ADDR_GAMMA_R5XXBC,      // Gamma-corrected for r5xx BC (note: unnormalized value)
+
+    ADDR_UNORM_R6XX,        // Unsigned normalized (repeating fraction) for R6xx
+    ADDR_UNORM_R6XXDB,      // Unorms for 24-bit depth: one value differs from ADDR_UNORM_R6XX
+    ADDR_SNORM_R6XX,        // Signed normalized (repeating fraction) for R6xx
+    ADDR_GAMMA8_R6XX,       // Gamma-corrected for r6xx
+    ADDR_GAMMA8_R7XX_TP,    // Gamma-corrected for r7xx TP 12bit unorm 8.4.
+
+    ADDR_U4FLOATC,          // Unsigned float: 4-bit exponent, bias=15, no NaN, clamp [0..1]
+    ADDR_GAMMA_4SEG,        // Gamma-corrected, four segment approximation
+    ADDR_U0FIXED,           // Unsigned 0.N-bit fixed point
+
+    // The following number types have large ranges (LEAVE ADDR_USCALED first or fix Finish routine)
+    ADDR_USCALED,           // Unsigned integer converted to/from floating point
+    ADDR_SSCALED,           // Signed integer converted to/from floating point
+    ADDR_USCALED_R5XXRB,    // Unsigned integer to/from floating point for r5xx RB
+    ADDR_SSCALED_R5XXRB,    // Signed integer to/from floating point for r5xx RB
+    ADDR_UINT_BITS,         // Keep in unsigned integer form, clamped to specified range
+    ADDR_SINT_BITS,         // Keep in signed integer form, clamped to specified range
+    ADDR_UINTBITS,          // @@ remove Keep in unsigned integer form, use modulus to reduce bits
+    ADDR_SINTBITS,          // @@ remove Keep in signed integer form, use modulus to reduce bits
+
+    // The following number types and ADDR_U4FLOATC have exponents
+    // (LEAVE ADDR_S8FLOAT first or fix Finish routine)
+    ADDR_S8FLOAT,           // Signed floating point with 8-bit exponent, bias=127
+    ADDR_S8FLOAT32,         // 32-bit IEEE float, passes through NaN values
+    ADDR_S5FLOAT,           // Signed floating point with 5-bit exponent, bias=15
+    ADDR_S5FLOATM,          // Signed floating point with 5-bit exponent, bias=15, no NaN/Inf
+    ADDR_U5FLOAT,           // Signed floating point with 5-bit exponent, bias=15
+    ADDR_U3FLOATM,          // Unsigned floating point with 3-bit exponent, bias=3
+
+    ADDR_S5FIXED,           // Signed 5.N-bit fixed point, with rounding
+
+    ADDR_END_NUMBER         // Used for range comparisons
+};
+
+// Copy from legacy lib's AddrElement
+enum ElemMode
+{
+    // These formats allow both packing an unpacking
+    ADDR_ROUND_BY_HALF,      // add 1/2 and truncate when packing this element
+    ADDR_ROUND_TRUNCATE,     // truncate toward 0 for sign/mag, else toward neg
+    ADDR_ROUND_DITHER,       // Pack by dithering -- requires (x,y) position
+
+    // These formats only allow unpacking, no packing
+    ADDR_UNCOMPRESSED,       // Elements are not compressed: one data element per pixel/texel
+    ADDR_EXPANDED,           // Elements are split up and stored in multiple data elements
+    ADDR_PACKED_STD,         // Elements are compressed into ExpandX by ExpandY data elements
+    ADDR_PACKED_REV,         // Like ADDR_PACKED, but X order of pixels is reverved
+    ADDR_PACKED_GBGR,        // Elements are compressed 4:2:2 in G1B_G0R order (high to low)
+    ADDR_PACKED_BGRG,        // Elements are compressed 4:2:2 in BG1_RG0 order (high to low)
+    ADDR_PACKED_BC1,         // Each data element is uncompressed to a 4x4 pixel/texel array
+    ADDR_PACKED_BC2,         // Each data element is uncompressed to a 4x4 pixel/texel array
+    ADDR_PACKED_BC3,         // Each data element is uncompressed to a 4x4 pixel/texel array
+    ADDR_PACKED_BC4,         // Each data element is uncompressed to a 4x4 pixel/texel array
+    ADDR_PACKED_BC5,         // Each data element is uncompressed to a 4x4 pixel/texel array
+    ADDR_PACKED_ETC2_64BPP,  // ETC2 formats that use 64bpp to represent each 4x4 block
+    ADDR_PACKED_ETC2_128BPP, // ETC2 formats that use 128bpp to represent each 4x4 block
+    ADDR_PACKED_ASTC,        // Various ASTC formats, all are 128bpp with varying block sizes
+
+    // These formats provide various kinds of compression
+    ADDR_ZPLANE_R5XX,        // Compressed Zplane using r5xx architecture format
+    ADDR_ZPLANE_R6XX,        // Compressed Zplane using r6xx architecture format
+    //@@ Fill in the compression modes
+
+    ADDR_END_ELEMENT         // Used for range comparisons
+};
+
+enum DepthPlanarType
+{
+    ADDR_DEPTH_PLANAR_NONE = 0, // No plane z/stencl
+    ADDR_DEPTH_PLANAR_R600 = 1, // R600 z and stencil planes are store within a tile
+    ADDR_DEPTH_PLANAR_R800 = 2, // R800 has separate z and stencil planes
+};
+
+/**
+****************************************************************************************************
+*   PixelFormatInfo
+*
+*   @brief
+*       Per component info
+*
+****************************************************************************************************
+*/
+struct PixelFormatInfo
+{
+    UINT_32             compBit[4];
+    NumberType          numType[4];
+    UINT_32             compStart[4];
+    ElemMode            elemMode;
+    UINT_32             comps;          ///< Number of components
+};
+
+/**
+****************************************************************************************************
+* @brief This class contains asic indepentent element related attributes and operations
+****************************************************************************************************
+*/
+class ElemLib : public Object
+{
+protected:
+    ElemLib(Lib* pAddrLib);
+
+public:
+
+    /// Makes this class virtual
+    virtual ~ElemLib();
+
+    static ElemLib* Create(
+        const Lib* pAddrLib);
+
+    /// The implementation is only for R6xx/R7xx, so make it virtual in case we need for R8xx
+    BOOL_32 PixGetExportNorm(
+        AddrColorFormat colorFmt,
+        AddrSurfaceNumber numberFmt, AddrSurfaceSwap swap) const;
+
+    /// Below method are asic independent, so make them just static.
+    /// Remove static if we need different operation in hwl.
+
+    VOID    Flt32ToDepthPixel(
+        AddrDepthFormat format, const ADDR_FLT_32 comps[2], UINT_8 *pPixel) const;
+
+    VOID    Flt32ToColorPixel(
+        AddrColorFormat format, AddrSurfaceNumber surfNum, AddrSurfaceSwap surfSwap,
+        const ADDR_FLT_32 comps[4], UINT_8 *pPixel) const;
+
+    static VOID    Flt32sToInt32s(
+        ADDR_FLT_32 value, UINT_32 bits, NumberType numberType, UINT_32* pResult);
+
+    static VOID    Int32sToPixel(
+        UINT_32 numComps, UINT_32* pComps, UINT_32* pCompBits, UINT_32* pCompStart,
+        ComponentFlags properties, UINT_32 resultBits, UINT_8* pPixel);
+
+    VOID    PixGetColorCompInfo(
+        AddrColorFormat format, AddrSurfaceNumber number, AddrSurfaceSwap swap,
+        PixelFormatInfo* pInfo) const;
+
+    VOID    PixGetDepthCompInfo(
+        AddrDepthFormat format, PixelFormatInfo* pInfo) const;
+
+    UINT_32 GetBitsPerPixel(
+        AddrFormat format, ElemMode* pElemMode = NULL,
+        UINT_32* pExpandX = NULL, UINT_32* pExpandY = NULL, UINT_32* pBitsUnused = NULL);
+
+    static VOID    SetClearComps(
+        ADDR_FLT_32 comps[4], BOOL_32 clearColor, BOOL_32 float32);
+
+    VOID    AdjustSurfaceInfo(
+        ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
+        UINT_32* pBpp, UINT_32* pBasePitch, UINT_32* pWidth, UINT_32* pHeight);
+
+    VOID    RestoreSurfaceInfo(
+        ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
+        UINT_32* pBpp, UINT_32* pWidth, UINT_32* pHeight);
+
+    /// Checks if depth and stencil are planar inside a tile
+    BOOL_32 IsDepthStencilTilePlanar()
+    {
+        return (m_depthPlanarType == ADDR_DEPTH_PLANAR_R600) ? TRUE : FALSE;
+    }
+
+    /// Sets m_configFlags, copied from AddrLib
+    VOID    SetConfigFlags(ConfigFlags flags)
+    {
+        m_configFlags = flags;
+    }
+
+    static BOOL_32 IsCompressed(AddrFormat format);
+    static BOOL_32 IsBlockCompressed(AddrFormat format);
+    static BOOL_32 IsExpand3x(AddrFormat format);
+    static BOOL_32 IsMacroPixelPacked(AddrFormat format);
+
+protected:
+
+    static VOID    GetCompBits(
+        UINT_32 c0, UINT_32 c1, UINT_32 c2, UINT_32 c3,
+        PixelFormatInfo* pInfo,
+        ElemMode elemMode = ADDR_ROUND_BY_HALF);
+
+    static VOID    GetCompType(
+        AddrColorFormat format, AddrSurfaceNumber numType,
+        PixelFormatInfo* pInfo);
+
+    static VOID    GetCompSwap(
+        AddrSurfaceSwap swap, PixelFormatInfo* pInfo);
+
+    static VOID    SwapComps(
+        UINT_32 c0, UINT_32 c1, PixelFormatInfo* pInfo);
+
+private:
+
+    UINT_32             m_fp16ExportNorm;   ///< If allow FP16 to be reported as EXPORT_NORM
+    DepthPlanarType     m_depthPlanarType;
+
+    ConfigFlags         m_configFlags;      ///< Copy of AddrLib's configFlags
+    Addr::Lib* const    m_pAddrLib;         ///< Pointer to parent addrlib instance
+};
+
+} //Addr
+
+#endif
+
diff --git a/src/amd/addrlib/src/core/addrlib.cpp b/src/amd/addrlib/src/core/addrlib.cpp
new file mode 100644 (file)
index 0000000..bdc17ff
--- /dev/null
@@ -0,0 +1,655 @@
+/*
+ * Copyright © 2007-2018 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  addrlib.cpp
+* @brief Contains the implementation for the Addr::Lib class.
+****************************************************************************************************
+*/
+
+#include "addrinterface.h"
+#include "addrlib.h"
+#include "addrcommon.h"
+
+#if defined(__APPLE__)
+
+UINT_32 div64_32(UINT_64 n, UINT_32 base)
+{
+    UINT_64 rem = n;
+    UINT_64 b = base;
+    UINT_64 res, d = 1;
+    UINT_32 high = rem >> 32;
+
+    res = 0;
+    if (high >= base)
+    {
+        high /= base;
+        res = (UINT_64) high << 32;
+        rem -= (UINT_64) (high * base) << 32;
+    }
+
+    while (((INT_64)b > 0) && (b < rem))
+    {
+        b = b + b;
+        d = d + d;
+    }
+
+    do
+    {
+        if (rem >= b)
+        {
+            rem -= b;
+            res += d;
+        }
+        b >>= 1;
+        d >>= 1;
+    } while (d);
+
+    n = res;
+    return rem;
+}
+
+extern "C"
+UINT_32 __umoddi3(UINT_64 n, UINT_32 base)
+{
+    return div64_32(n, base);
+}
+
+#endif // __APPLE__
+
+namespace Addr
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Constructor/Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::Lib
+*
+*   @brief
+*       Constructor for the AddrLib class
+*
+****************************************************************************************************
+*/
+Lib::Lib() :
+    m_class(BASE_ADDRLIB),
+    m_chipFamily(ADDR_CHIP_FAMILY_IVLD),
+    m_chipRevision(0),
+    m_version(ADDRLIB_VERSION),
+    m_pipes(0),
+    m_banks(0),
+    m_pipeInterleaveBytes(0),
+    m_rowSize(0),
+    m_minPitchAlignPixels(1),
+    m_maxSamples(8),
+    m_pElemLib(NULL)
+{
+    m_configFlags.value = 0;
+}
+
+/**
+****************************************************************************************************
+*   Lib::Lib
+*
+*   @brief
+*       Constructor for the AddrLib class with hClient as parameter
+*
+****************************************************************************************************
+*/
+Lib::Lib(const Client* pClient) :
+    Object(pClient),
+    m_class(BASE_ADDRLIB),
+    m_chipFamily(ADDR_CHIP_FAMILY_IVLD),
+    m_chipRevision(0),
+    m_version(ADDRLIB_VERSION),
+    m_pipes(0),
+    m_banks(0),
+    m_pipeInterleaveBytes(0),
+    m_rowSize(0),
+    m_minPitchAlignPixels(1),
+    m_maxSamples(8),
+    m_pElemLib(NULL)
+{
+    m_configFlags.value = 0;
+}
+
+/**
+****************************************************************************************************
+*   Lib::~AddrLib
+*
+*   @brief
+*       Destructor for the AddrLib class
+*
+****************************************************************************************************
+*/
+Lib::~Lib()
+{
+    if (m_pElemLib)
+    {
+        delete m_pElemLib;
+        m_pElemLib = NULL;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Initialization/Helper
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::Create
+*
+*   @brief
+*       Creates and initializes AddrLib object.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::Create(
+    const ADDR_CREATE_INPUT* pCreateIn,     ///< [in] pointer to ADDR_CREATE_INPUT
+    ADDR_CREATE_OUTPUT*      pCreateOut)    ///< [out] pointer to ADDR_CREATE_OUTPUT
+{
+    Lib* pLib = NULL;
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pCreateIn->createFlags.fillSizeFields == TRUE)
+    {
+        if ((pCreateIn->size != sizeof(ADDR_CREATE_INPUT)) ||
+            (pCreateOut->size != sizeof(ADDR_CREATE_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if ((returnCode == ADDR_OK)                    &&
+        (pCreateIn->callbacks.allocSysMem != NULL) &&
+        (pCreateIn->callbacks.freeSysMem != NULL))
+    {
+        Client client = {
+            pCreateIn->hClient,
+            pCreateIn->callbacks
+        };
+
+        switch (pCreateIn->chipEngine)
+        {
+            case CIASICIDGFXENGINE_SOUTHERNISLAND:
+                switch (pCreateIn->chipFamily)
+                {
+                    case FAMILY_SI:
+                        pLib = SiHwlInit(&client);
+                        break;
+                    case FAMILY_VI:
+                    case FAMILY_CZ:
+                    case FAMILY_CI:
+                    case FAMILY_KV: // CI based fusion
+                        pLib = CiHwlInit(&client);
+                        break;
+                    default:
+                        ADDR_ASSERT_ALWAYS();
+                        break;
+                }
+                break;
+            case CIASICIDGFXENGINE_ARCTICISLAND:
+                switch (pCreateIn->chipFamily)
+                {
+                    case FAMILY_AI:
+                    case FAMILY_RV:
+                        pLib = Gfx9HwlInit(&client);
+                        break;
+                    default:
+                        ADDR_ASSERT_ALWAYS();
+                        break;
+                }
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+    }
+
+    if (pLib != NULL)
+    {
+        BOOL_32 initValid;
+
+        // Pass createFlags to configFlags first since these flags may be overwritten
+        pLib->m_configFlags.noCubeMipSlicesPad  = pCreateIn->createFlags.noCubeMipSlicesPad;
+        pLib->m_configFlags.fillSizeFields      = pCreateIn->createFlags.fillSizeFields;
+        pLib->m_configFlags.useTileIndex        = pCreateIn->createFlags.useTileIndex;
+        pLib->m_configFlags.useCombinedSwizzle  = pCreateIn->createFlags.useCombinedSwizzle;
+        pLib->m_configFlags.checkLast2DLevel    = pCreateIn->createFlags.checkLast2DLevel;
+        pLib->m_configFlags.useHtileSliceAlign  = pCreateIn->createFlags.useHtileSliceAlign;
+        pLib->m_configFlags.allowLargeThickTile = pCreateIn->createFlags.allowLargeThickTile;
+        pLib->m_configFlags.disableLinearOpt    = FALSE;
+
+        pLib->SetChipFamily(pCreateIn->chipFamily, pCreateIn->chipRevision);
+
+        pLib->SetMinPitchAlignPixels(pCreateIn->minPitchAlignPixels);
+
+        // Global parameters initialized and remaining configFlags bits are set as well
+        initValid = pLib->HwlInitGlobalParams(pCreateIn);
+
+        if (initValid)
+        {
+            pLib->m_pElemLib = ElemLib::Create(pLib);
+        }
+        else
+        {
+            pLib->m_pElemLib = NULL; // Don't go on allocating element lib
+            returnCode = ADDR_INVALIDGBREGVALUES;
+        }
+
+        if (pLib->m_pElemLib == NULL)
+        {
+            delete pLib;
+            pLib = NULL;
+            ADDR_ASSERT_ALWAYS();
+        }
+        else
+        {
+            pLib->m_pElemLib->SetConfigFlags(pLib->m_configFlags);
+        }
+    }
+
+    pCreateOut->hLib = pLib;
+
+    if ((pLib != NULL) &&
+        (returnCode == ADDR_OK))
+    {
+        pCreateOut->numEquations =
+            pLib->HwlGetEquationTableInfo(&pCreateOut->pEquationTable);
+
+        pLib->SetMaxAlignments();
+
+    }
+    else if ((pLib == NULL) &&
+             (returnCode == ADDR_OK))
+    {
+        // Unknown failures, we return the general error code
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::SetChipFamily
+*
+*   @brief
+*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
+*   @return
+*      N/A
+****************************************************************************************************
+*/
+VOID Lib::SetChipFamily(
+    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
+    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
+{
+    ChipFamily family = HwlConvertChipFamily(uChipFamily, uChipRevision);
+
+    ADDR_ASSERT(family != ADDR_CHIP_FAMILY_IVLD);
+
+    m_chipFamily   = family;
+    m_chipRevision = uChipRevision;
+}
+
+/**
+****************************************************************************************************
+*   Lib::SetMinPitchAlignPixels
+*
+*   @brief
+*       Set m_minPitchAlignPixels with input param
+*
+*   @return
+*      N/A
+****************************************************************************************************
+*/
+VOID Lib::SetMinPitchAlignPixels(
+    UINT_32 minPitchAlignPixels)    ///< [in] minmum pitch alignment in pixels
+{
+    m_minPitchAlignPixels = (minPitchAlignPixels == 0) ? 1 : minPitchAlignPixels;
+}
+
+/**
+****************************************************************************************************
+*   Lib::SetMaxAlignments
+*
+*   @brief
+*       Set max alignments
+*
+*   @return
+*      N/A
+****************************************************************************************************
+*/
+VOID Lib::SetMaxAlignments()
+{
+    m_maxBaseAlign     = HwlComputeMaxBaseAlignments();
+    m_maxMetaBaseAlign = HwlComputeMaxMetaBaseAlignments();
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetLib
+*
+*   @brief
+*       Get AddrLib pointer
+*
+*   @return
+*      An AddrLib class pointer
+****************************************************************************************************
+*/
+Lib* Lib::GetLib(
+    ADDR_HANDLE hLib)   ///< [in] handle of ADDR_HANDLE
+{
+    return static_cast<Addr::Lib*>(hLib);
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMaxAlignments
+*
+*   @brief
+*       Gets maximum alignments for data surface (include FMask)
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::GetMaxAlignments(
+    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if (pOut->size != sizeof(ADDR_GET_MAX_ALINGMENTS_OUTPUT))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        if (m_maxBaseAlign != 0)
+        {
+            pOut->baseAlign = m_maxBaseAlign;
+        }
+        else
+        {
+            returnCode = ADDR_NOTIMPLEMENTED;
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMaxMetaAlignments
+*
+*   @brief
+*       Gets maximum alignments for metadata (CMask, DCC and HTile)
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::GetMaxMetaAlignments(
+    ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if (pOut->size != sizeof(ADDR_GET_MAX_ALINGMENTS_OUTPUT))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        if (m_maxMetaBaseAlign != 0)
+        {
+            pOut->baseAlign = m_maxMetaBaseAlign;
+        }
+        else
+        {
+            returnCode = ADDR_NOTIMPLEMENTED;
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::Bits2Number
+*
+*   @brief
+*       Cat a array of binary bit to a number
+*
+*   @return
+*       The number combined with the array of bits
+****************************************************************************************************
+*/
+UINT_32 Lib::Bits2Number(
+    UINT_32 bitNum,     ///< [in] how many bits
+    ...)                ///< [in] varaible bits value starting from MSB
+{
+    UINT_32 number = 0;
+    UINT_32 i;
+    va_list bits_ptr;
+
+    va_start(bits_ptr, bitNum);
+
+    for(i = 0; i < bitNum; i++)
+    {
+        number |= va_arg(bits_ptr, UINT_32);
+        number <<= 1;
+    }
+
+    number >>= 1;
+
+    va_end(bits_ptr);
+
+    return number;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Element lib
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::Flt32ToColorPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a depth/stencil pixel value
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::Flt32ToDepthPixel(
+    const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
+    ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ELEM_FLT32TODEPTHPIXEL_INPUT)) ||
+            (pOut->size != sizeof(ELEM_FLT32TODEPTHPIXEL_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        GetElemLib()->Flt32ToDepthPixel(pIn->format, pIn->comps, pOut->pPixel);
+
+        UINT_32 depthBase = 0;
+        UINT_32 stencilBase = 0;
+        UINT_32 depthBits = 0;
+        UINT_32 stencilBits = 0;
+
+        switch (pIn->format)
+        {
+            case ADDR_DEPTH_16:
+                depthBits = 16;
+                break;
+            case ADDR_DEPTH_X8_24:
+            case ADDR_DEPTH_8_24:
+            case ADDR_DEPTH_X8_24_FLOAT:
+            case ADDR_DEPTH_8_24_FLOAT:
+                depthBase = 8;
+                depthBits = 24;
+                stencilBits = 8;
+                break;
+            case ADDR_DEPTH_32_FLOAT:
+                depthBits = 32;
+                break;
+            case ADDR_DEPTH_X24_8_32_FLOAT:
+                depthBase = 8;
+                depthBits = 32;
+                stencilBits = 8;
+                break;
+            default:
+                break;
+        }
+
+        // Overwrite base since R800 has no "tileBase"
+        if (GetElemLib()->IsDepthStencilTilePlanar() == FALSE)
+        {
+            depthBase = 0;
+            stencilBase = 0;
+        }
+
+        depthBase *= 64;
+        stencilBase *= 64;
+
+        pOut->stencilBase = stencilBase;
+        pOut->depthBase = depthBase;
+        pOut->depthBits = depthBits;
+        pOut->stencilBits = stencilBits;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::Flt32ToColorPixel
+*
+*   @brief
+*       Convert a FLT_32 value to a red/green/blue/alpha pixel value
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::Flt32ToColorPixel(
+    const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
+    ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ELEM_FLT32TOCOLORPIXEL_INPUT)) ||
+            (pOut->size != sizeof(ELEM_FLT32TOCOLORPIXEL_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        GetElemLib()->Flt32ToColorPixel(pIn->format,
+                                        pIn->surfNum,
+                                        pIn->surfSwap,
+                                        pIn->comps,
+                                        pOut->pPixel);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetExportNorm
+*
+*   @brief
+*       Check one format can be EXPORT_NUM
+*   @return
+*       TRUE if EXPORT_NORM can be used
+****************************************************************************************************
+*/
+BOOL_32 Lib::GetExportNorm(
+    const ELEM_GETEXPORTNORM_INPUT* pIn) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    BOOL_32 enabled = FALSE;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if (pIn->size != sizeof(ELEM_GETEXPORTNORM_INPUT))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        enabled = GetElemLib()->PixGetExportNorm(pIn->format, pIn->num, pIn->swap);
+    }
+
+    return enabled;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetBpe
+*
+*   @brief
+*       Get bits-per-element for specified format
+*   @return
+*       bits-per-element of specified format
+****************************************************************************************************
+*/
+UINT_32 Lib::GetBpe(AddrFormat format) const
+{
+    return GetElemLib()->GetBitsPerPixel(format);
+}
+
+} // Addr
diff --git a/src/amd/addrlib/src/core/addrlib.h b/src/amd/addrlib/src/core/addrlib.h
new file mode 100644 (file)
index 0000000..70c74f9
--- /dev/null
@@ -0,0 +1,415 @@
+/*
+ * Copyright © 2007-2018 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  addrlib.h
+* @brief Contains the Addr::Lib base class definition.
+****************************************************************************************************
+*/
+
+#ifndef __ADDR_LIB_H__
+#define __ADDR_LIB_H__
+
+#include "addrinterface.h"
+#include "addrobject.h"
+#include "addrelemlib.h"
+
+#include "amdgpu_asic_addr.h"
+
+#ifndef CIASICIDGFXENGINE_R600
+#define CIASICIDGFXENGINE_R600 0x00000006
+#endif
+
+#ifndef CIASICIDGFXENGINE_R800
+#define CIASICIDGFXENGINE_R800 0x00000008
+#endif
+
+#ifndef CIASICIDGFXENGINE_SOUTHERNISLAND
+#define CIASICIDGFXENGINE_SOUTHERNISLAND 0x0000000A
+#endif
+
+#ifndef CIASICIDGFXENGINE_ARCTICISLAND
+#define CIASICIDGFXENGINE_ARCTICISLAND 0x0000000D
+#endif
+
+namespace Addr
+{
+
+/**
+****************************************************************************************************
+* @brief Neutral enums that define pipeinterleave
+****************************************************************************************************
+*/
+enum PipeInterleave
+{
+    ADDR_PIPEINTERLEAVE_256B = 256,
+    ADDR_PIPEINTERLEAVE_512B = 512,
+    ADDR_PIPEINTERLEAVE_1KB  = 1024,
+    ADDR_PIPEINTERLEAVE_2KB  = 2048,
+};
+
+/**
+****************************************************************************************************
+* @brief Neutral enums that define DRAM row size
+****************************************************************************************************
+*/
+enum RowSize
+{
+    ADDR_ROWSIZE_1KB = 1024,
+    ADDR_ROWSIZE_2KB = 2048,
+    ADDR_ROWSIZE_4KB = 4096,
+    ADDR_ROWSIZE_8KB = 8192,
+};
+
+/**
+****************************************************************************************************
+* @brief Neutral enums that define bank interleave
+****************************************************************************************************
+*/
+enum BankInterleave
+{
+    ADDR_BANKINTERLEAVE_1 = 1,
+    ADDR_BANKINTERLEAVE_2 = 2,
+    ADDR_BANKINTERLEAVE_4 = 4,
+    ADDR_BANKINTERLEAVE_8 = 8,
+};
+
+/**
+****************************************************************************************************
+* @brief Neutral enums that define shader engine tile size
+****************************************************************************************************
+*/
+enum ShaderEngineTileSize
+{
+    ADDR_SE_TILESIZE_16 = 16,
+    ADDR_SE_TILESIZE_32 = 32,
+};
+
+/**
+****************************************************************************************************
+* @brief Neutral enums that define bank swap size
+****************************************************************************************************
+*/
+enum BankSwapSize
+{
+    ADDR_BANKSWAP_128B = 128,
+    ADDR_BANKSWAP_256B = 256,
+    ADDR_BANKSWAP_512B = 512,
+    ADDR_BANKSWAP_1KB = 1024,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define max compressed fragments config
+****************************************************************************************************
+*/
+enum NumMaxCompressedFragmentsConfig
+{
+    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,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define num pipes config
+****************************************************************************************************
+*/
+enum NumPipesConfig
+{
+    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,
+    ADDR_CONFIG_64_PIPE                      = 0x00000006,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define num banks config
+****************************************************************************************************
+*/
+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,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define num rb per shader engine config
+****************************************************************************************************
+*/
+enum NumRbPerShaderEngineConfig
+{
+    ADDR_CONFIG_1_RB_PER_SHADER_ENGINE       = 0x00000000,
+    ADDR_CONFIG_2_RB_PER_SHADER_ENGINE       = 0x00000001,
+    ADDR_CONFIG_4_RB_PER_SHADER_ENGINE       = 0x00000002,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define num shader engines config
+****************************************************************************************************
+*/
+enum NumShaderEnginesConfig
+{
+    ADDR_CONFIG_1_SHADER_ENGINE              = 0x00000000,
+    ADDR_CONFIG_2_SHADER_ENGINE              = 0x00000001,
+    ADDR_CONFIG_4_SHADER_ENGINE              = 0x00000002,
+    ADDR_CONFIG_8_SHADER_ENGINE              = 0x00000003,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define pipe interleave size config
+****************************************************************************************************
+*/
+enum PipeInterleaveSizeConfig
+{
+    ADDR_CONFIG_PIPE_INTERLEAVE_256B         = 0x00000000,
+    ADDR_CONFIG_PIPE_INTERLEAVE_512B         = 0x00000001,
+    ADDR_CONFIG_PIPE_INTERLEAVE_1KB          = 0x00000002,
+    ADDR_CONFIG_PIPE_INTERLEAVE_2KB          = 0x00000003,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define row size config
+****************************************************************************************************
+*/
+enum RowSizeConfig
+{
+    ADDR_CONFIG_1KB_ROW                      = 0x00000000,
+    ADDR_CONFIG_2KB_ROW                      = 0x00000001,
+    ADDR_CONFIG_4KB_ROW                      = 0x00000002,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define bank interleave size config
+****************************************************************************************************
+*/
+enum BankInterleaveSizeConfig
+{
+    ADDR_CONFIG_BANK_INTERLEAVE_1            = 0x00000000,
+    ADDR_CONFIG_BANK_INTERLEAVE_2            = 0x00000001,
+    ADDR_CONFIG_BANK_INTERLEAVE_4            = 0x00000002,
+    ADDR_CONFIG_BANK_INTERLEAVE_8            = 0x00000003,
+};
+
+/**
+****************************************************************************************************
+* @brief Enums that define engine tile size config
+****************************************************************************************************
+*/
+enum ShaderEngineTileSizeConfig
+{
+    ADDR_CONFIG_SE_TILE_16                   = 0x00000000,
+    ADDR_CONFIG_SE_TILE_32                   = 0x00000001,
+};
+
+/**
+****************************************************************************************************
+* @brief This class contains asic independent address lib functionalities
+****************************************************************************************************
+*/
+class Lib : public Object
+{
+public:
+    virtual ~Lib();
+
+    static ADDR_E_RETURNCODE Create(
+        const ADDR_CREATE_INPUT* pCreateInfo, ADDR_CREATE_OUTPUT* pCreateOut);
+
+    /// Pair of Create
+    VOID Destroy()
+    {
+        delete this;
+    }
+
+    static Lib* GetLib(ADDR_HANDLE hLib);
+
+    /// Returns AddrLib version (from compiled binary instead include file)
+    UINT_32 GetVersion()
+    {
+        return m_version;
+    }
+
+    /// Returns asic chip family name defined by AddrLib
+    ChipFamily GetChipFamily()
+    {
+        return m_chipFamily;
+    }
+
+    ADDR_E_RETURNCODE Flt32ToDepthPixel(
+        const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
+        ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE Flt32ToColorPixel(
+        const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
+        ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) const;
+
+    BOOL_32 GetExportNorm(const ELEM_GETEXPORTNORM_INPUT* pIn) const;
+
+    ADDR_E_RETURNCODE GetMaxAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE GetMaxMetaAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
+
+    UINT_32 GetBpe(AddrFormat format) const;
+
+protected:
+    Lib();  // Constructor is protected
+    Lib(const Client* pClient);
+
+    /// Pure virtual function to get max base alignments
+    virtual UINT_32 HwlComputeMaxBaseAlignments() const = 0;
+
+    /// Gets maximum alignements for metadata
+    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const
+    {
+        ADDR_NOT_IMPLEMENTED();
+
+        return 0;
+    }
+
+    VOID ValidBaseAlignments(UINT_32 alignment) const
+    {
+#if DEBUG
+        ADDR_ASSERT(alignment <= m_maxBaseAlign);
+#endif
+    }
+
+    VOID ValidMetaBaseAlignments(UINT_32 metaAlignment) const
+    {
+#if DEBUG
+        ADDR_ASSERT(metaAlignment <= m_maxMetaBaseAlign);
+#endif
+    }
+
+    //
+    // Initialization
+    //
+    /// Pure Virtual function for Hwl computing internal global parameters from h/w registers
+    virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn) = 0;
+
+    /// Pure Virtual function for Hwl converting chip family
+    virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision) = 0;
+
+    /// Get equation table pointer and number of equations
+    virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
+    {
+        *ppEquationTable = NULL;
+
+        return 0;
+    }
+
+    //
+    // Misc helper
+    //
+    static UINT_32 Bits2Number(UINT_32 bitNum, ...);
+
+    static UINT_32 GetNumFragments(UINT_32 numSamples, UINT_32 numFrags)
+    {
+        return (numFrags != 0) ? numFrags : Max(1u, numSamples);
+    }
+
+    /// Returns pointer of ElemLib
+    ElemLib* GetElemLib() const
+    {
+        return m_pElemLib;
+    }
+
+    /// Returns fillSizeFields flag
+    UINT_32 GetFillSizeFieldsFlags() const
+    {
+        return m_configFlags.fillSizeFields;
+    }
+
+private:
+    // Disallow the copy constructor
+    Lib(const Lib& a);
+
+    // Disallow the assignment operator
+    Lib& operator=(const Lib& a);
+
+    VOID SetChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
+
+    VOID SetMinPitchAlignPixels(UINT_32 minPitchAlignPixels);
+
+    VOID SetMaxAlignments();
+
+protected:
+    LibClass    m_class;        ///< Store class type (HWL type)
+
+    ChipFamily  m_chipFamily;   ///< Chip family translated from the one in atiid.h
+
+    UINT_32     m_chipRevision; ///< Revision id from xxx_id.h
+
+    UINT_32     m_version;      ///< Current version
+
+    //
+    // Global parameters
+    //
+    ConfigFlags m_configFlags;          ///< Global configuration flags. Note this is setup by
+                                        ///  AddrLib instead of Client except forceLinearAligned
+
+    UINT_32     m_pipes;                ///< Number of pipes
+    UINT_32     m_banks;                ///< Number of banks
+                                        ///  For r800 this is MC_ARB_RAMCFG.NOOFBANK
+                                        ///  Keep it here to do default parameter calculation
+
+    UINT_32     m_pipeInterleaveBytes;
+                                        ///< Specifies the size of contiguous address space
+                                        ///  within each tiling pipe when making linear
+                                        ///  accesses. (Formerly Group Size)
+
+    UINT_32     m_rowSize;              ///< DRAM row size, in bytes
+
+    UINT_32     m_minPitchAlignPixels;  ///< Minimum pitch alignment in pixels
+    UINT_32     m_maxSamples;           ///< Max numSamples
+
+    UINT_32     m_maxBaseAlign;         ///< Max base alignment for data surface
+    UINT_32     m_maxMetaBaseAlign;     ///< Max base alignment for metadata
+
+private:
+    ElemLib*    m_pElemLib;             ///< Element Lib pointer
+};
+
+Lib* SiHwlInit   (const Client* pClient);
+Lib* CiHwlInit   (const Client* pClient);
+Lib* Gfx9HwlInit (const Client* pClient);
+
+} // Addr
+
+#endif
diff --git a/src/amd/addrlib/src/core/addrlib1.cpp b/src/amd/addrlib/src/core/addrlib1.cpp
new file mode 100644 (file)
index 0000000..65f8fe0
--- /dev/null
@@ -0,0 +1,4061 @@
+/*
+ * Copyright © 2007-2018 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  addr1lib.cpp
+* @brief Contains the implementation for the Addr::V1::Lib base class.
+****************************************************************************************************
+*/
+
+#include "addrinterface.h"
+#include "addrlib1.h"
+#include "addrcommon.h"
+
+namespace Addr
+{
+namespace V1
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Static Const Member
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const TileModeFlags Lib::ModeFlags[ADDR_TM_COUNT] =
+{// T   L  1  2  3  P  Pr B
+    {1, 1, 0, 0, 0, 0, 0, 0}, // ADDR_TM_LINEAR_GENERAL
+    {1, 1, 0, 0, 0, 0, 0, 0}, // ADDR_TM_LINEAR_ALIGNED
+    {1, 0, 1, 0, 0, 0, 0, 0}, // ADDR_TM_1D_TILED_THIN1
+    {4, 0, 1, 0, 0, 0, 0, 0}, // ADDR_TM_1D_TILED_THICK
+    {1, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THIN1
+    {1, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THIN2
+    {1, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THIN4
+    {4, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_THICK
+    {1, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THIN1
+    {1, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THIN2
+    {1, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THIN4
+    {4, 0, 0, 1, 0, 0, 0, 1}, // ADDR_TM_2B_TILED_THICK
+    {1, 0, 0, 1, 1, 0, 0, 0}, // ADDR_TM_3D_TILED_THIN1
+    {4, 0, 0, 1, 1, 0, 0, 0}, // ADDR_TM_3D_TILED_THICK
+    {1, 0, 0, 1, 1, 0, 0, 1}, // ADDR_TM_3B_TILED_THIN1
+    {4, 0, 0, 1, 1, 0, 0, 1}, // ADDR_TM_3B_TILED_THICK
+    {8, 0, 0, 1, 0, 0, 0, 0}, // ADDR_TM_2D_TILED_XTHICK
+    {8, 0, 0, 1, 1, 0, 0, 0}, // ADDR_TM_3D_TILED_XTHICK
+    {1, 0, 0, 0, 0, 0, 0, 0}, // ADDR_TM_POWER_SAVE
+    {1, 0, 0, 1, 0, 1, 1, 0}, // ADDR_TM_PRT_TILED_THIN1
+    {1, 0, 0, 1, 0, 1, 0, 0}, // ADDR_TM_PRT_2D_TILED_THIN1
+    {1, 0, 0, 1, 1, 1, 0, 0}, // ADDR_TM_PRT_3D_TILED_THIN1
+    {4, 0, 0, 1, 0, 1, 1, 0}, // ADDR_TM_PRT_TILED_THICK
+    {4, 0, 0, 1, 0, 1, 0, 0}, // ADDR_TM_PRT_2D_TILED_THICK
+    {4, 0, 0, 1, 1, 1, 0, 0}, // ADDR_TM_PRT_3D_TILED_THICK
+    {0, 0, 0, 0, 0, 0, 0, 0}, // ADDR_TM_UNKNOWN
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Constructor/Destructor
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::AddrLib1
+*
+*   @brief
+*       Constructor for the AddrLib1 class
+*
+****************************************************************************************************
+*/
+Lib::Lib()
+    :
+    Addr::Lib()
+{
+}
+
+/**
+****************************************************************************************************
+*   Lib::Lib
+*
+*   @brief
+*       Constructor for the Addr::V1::Lib class with hClient as parameter
+*
+****************************************************************************************************
+*/
+Lib::Lib(const Client* pClient)
+    :
+    Addr::Lib(pClient)
+{
+}
+
+/**
+****************************************************************************************************
+*   Lib::~AddrLib1
+*
+*   @brief
+*       Destructor for the AddrLib1 class
+*
+****************************************************************************************************
+*/
+Lib::~Lib()
+{
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetLib
+*
+*   @brief
+*       Get AddrLib1 pointer
+*
+*   @return
+*      An Addr::V1::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_IVLD) ||
+         (pAddrLib->GetChipFamily() > ADDR_CHIP_FAMILY_VI)))
+    {
+        // only valid and pre-VI ASIC can use AddrLib1 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 ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,    ///< [in] input structure
+     ADDR_COMPUTE_SURFACE_INFO_OUTPUT*      pOut    ///< [out] output structure
+     ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_SURFACE_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_SURFACE_INFO_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    // We suggest client do sanity check but a check here is also good
+    if (pIn->bpp > 128)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    if ((pIn->tileMode == ADDR_TM_UNKNOWN) && (pIn->mipLevel > 0))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    // Thick modes don't support multisample
+    if ((Thickness(pIn->tileMode) > 1) && (pIn->numSamples > 1))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        // Get a local copy of input structure and only reference pIn for unadjusted values
+        ADDR_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
+        ADDR_TILEINFO tileInfoNull = {0};
+
+        if (UseTileInfo())
+        {
+            // If the original input has a valid ADDR_TILEINFO pointer then copy its contents.
+            // Otherwise the default 0's in tileInfoNull are used.
+            if (pIn->pTileInfo)
+            {
+                tileInfoNull = *pIn->pTileInfo;
+            }
+            localIn.pTileInfo  = &tileInfoNull;
+        }
+
+        localIn.numSamples = (pIn->numSamples == 0) ? 1 : pIn->numSamples;
+
+        // Do mipmap check first
+        // If format is BCn, pre-pad dimension to power-of-two according to HWL
+        ComputeMipLevel(&localIn);
+
+        if (m_configFlags.checkLast2DLevel)
+        {
+            // Save this level's original height in pixels
+            pOut->height = pIn->height;
+        }
+
+        UINT_32 expandX = 1;
+        UINT_32 expandY = 1;
+        ElemMode elemMode;
+
+        // Save outputs that may not go through HWL
+        pOut->pixelBits = localIn.bpp;
+        pOut->numSamples = localIn.numSamples;
+        pOut->last2DLevel = FALSE;
+        pOut->tcCompatible = FALSE;
+
+#if !ALT_TEST
+        if (localIn.numSamples > 1)
+        {
+            ADDR_ASSERT(localIn.mipLevel == 0);
+        }
+#endif
+
+        if (localIn.format != ADDR_FMT_INVALID) // Set format to INVALID will skip this conversion
+        {
+            // 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(IsLinear(localIn.tileMode));
+            }
+
+            GetElemLib()->AdjustSurfaceInfo(elemMode,
+                                            expandX,
+                                            expandY,
+                                            &localIn.bpp,
+                                            &localIn.basePitch,
+                                            &localIn.width,
+                                            &localIn.height);
+
+            // Overwrite these parameters if we have a valid format
+        }
+        else if (localIn.bpp != 0)
+        {
+            localIn.width  = (localIn.width != 0) ? localIn.width : 1;
+            localIn.height = (localIn.height != 0) ? localIn.height : 1;
+        }
+        else // Rule out some invalid parameters
+        {
+            ADDR_ASSERT_ALWAYS();
+
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+
+        // Check mipmap after surface expansion
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = PostComputeMipLevel(&localIn, pOut);
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (UseTileIndex(localIn.tileIndex))
+            {
+                // Make sure pTileInfo is not NULL
+                ADDR_ASSERT(localIn.pTileInfo);
+
+                UINT_32 numSamples = GetNumFragments(localIn.numSamples, localIn.numFrags);
+
+                INT_32 macroModeIndex = TileIndexNoMacroIndex;
+
+                if (localIn.tileIndex != TileIndexLinearGeneral)
+                {
+                    // Try finding a macroModeIndex
+                    macroModeIndex = HwlComputeMacroModeIndex(localIn.tileIndex,
+                                                              localIn.flags,
+                                                              localIn.bpp,
+                                                              numSamples,
+                                                              localIn.pTileInfo,
+                                                              &localIn.tileMode,
+                                                              &localIn.tileType);
+                }
+
+                // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
+                if (macroModeIndex == TileIndexNoMacroIndex)
+                {
+                    returnCode = HwlSetupTileCfg(localIn.bpp,
+                                                 localIn.tileIndex, macroModeIndex,
+                                                 localIn.pTileInfo,
+                                                 &localIn.tileMode, &localIn.tileType);
+                }
+                // If macroModeIndex is invalid, then assert this is not macro tiled
+                else if (macroModeIndex == TileIndexInvalid)
+                {
+                    ADDR_ASSERT(!IsMacroTiled(localIn.tileMode));
+                }
+
+                pOut->macroModeIndex = macroModeIndex;
+            }
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            localIn.flags.dccPipeWorkaround = localIn.flags.dccCompatible;
+
+            if (localIn.tileMode == ADDR_TM_UNKNOWN)
+            {
+                // HWL layer may override tile mode if necessary
+                HwlSelectTileMode(&localIn);
+            }
+            else
+            {
+                // HWL layer may override tile mode if necessary
+                HwlOverrideTileMode(&localIn);
+
+                // Optimize tile mode if possible
+                OptimizeTileMode(&localIn);
+            }
+        }
+
+        // Call main function to compute surface info
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlComputeSurfaceInfo(&localIn, pOut);
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            // Since bpp might be changed we just pass it through
+            pOut->bpp  = localIn.bpp;
+
+            // Also original width/height/bpp
+            pOut->pixelPitch    = pOut->pitch;
+            pOut->pixelHeight   = pOut->height;
+
+#if DEBUG
+            if (localIn.flags.display)
+            {
+                ADDR_ASSERT((pOut->pitchAlign % 32) == 0);
+            }
+#endif //DEBUG
+
+            if (localIn.format != ADDR_FMT_INVALID)
+            {
+                //
+                // Note: For 96 bit surface, the pixelPitch returned might be an odd number, but it
+                // is okay to program texture pitch as HW's mip calculator would multiply 3 first,
+                // then do the appropriate paddings (linear alignment requirement and possible the
+                // nearest power-of-two for mipmaps), which results in the original pitch.
+                //
+                GetElemLib()->RestoreSurfaceInfo(elemMode,
+                                                 expandX,
+                                                 expandY,
+                                                 &localIn.bpp,
+                                                 &pOut->pixelPitch,
+                                                 &pOut->pixelHeight);
+            }
+
+            if (localIn.flags.qbStereo)
+            {
+                if (pOut->pStereoInfo)
+                {
+                    ComputeQbStereoInfo(pOut);
+                }
+            }
+
+            if (localIn.flags.volume) // For volume sliceSize equals to all z-slices
+            {
+                pOut->sliceSize = pOut->surfSize;
+            }
+            else // For array: sliceSize is likely to have slice-padding (the last one)
+            {
+                pOut->sliceSize = pOut->surfSize / pOut->depth;
+
+                // array or cubemap
+                if (pIn->numSlices > 1)
+                {
+                    // If this is the last slice then add the padding size to this slice
+                    if (pIn->slice == (pIn->numSlices - 1))
+                    {
+                        pOut->sliceSize += pOut->sliceSize * (pOut->depth - pIn->numSlices);
+                    }
+                    else if (m_configFlags.checkLast2DLevel)
+                    {
+                        // Reset last2DLevel flag if this is not the last array slice
+                        pOut->last2DLevel = FALSE;
+                    }
+                }
+            }
+
+            pOut->pitchTileMax = pOut->pitch / 8 - 1;
+            pOut->heightTileMax = pOut->height / 8 - 1;
+            pOut->sliceTileMax = pOut->pitch * pOut->height / 64 - 1;
+        }
+    }
+
+    ValidBaseAlignments(pOut->baseAlign);
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeSurfaceInfo.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceAddrFromCoord(
+    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            const ADDR_SURFACE_FLAGS flags = {{0}};
+            UINT_32 numSamples = GetNumFragments(pIn->numSamples, pIn->numFrags);
+
+            // Try finding a macroModeIndex
+            INT_32 macroModeIndex = HwlComputeMacroModeIndex(input.tileIndex,
+                                                             flags,
+                                                             input.bpp,
+                                                             numSamples,
+                                                             input.pTileInfo,
+                                                             &input.tileMode,
+                                                             &input.tileType);
+
+            // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
+            if (macroModeIndex == TileIndexNoMacroIndex)
+            {
+                returnCode = HwlSetupTileCfg(input.bpp, input.tileIndex, macroModeIndex,
+                                             input.pTileInfo, &input.tileMode, &input.tileType);
+            }
+            // If macroModeIndex is invalid, then assert this is not macro tiled
+            else if (macroModeIndex == TileIndexInvalid)
+            {
+                ADDR_ASSERT(!IsMacroTiled(input.tileMode));
+            }
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlComputeSurfaceAddrFromCoord(pIn, pOut);
+
+            if (returnCode == ADDR_OK)
+            {
+                pOut->prtBlockIndex = static_cast<UINT_32>(pOut->addr / (64 * 1024));
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceCoordFromAddr
+*
+*   @brief
+*       Interface function stub of ComputeSurfaceCoordFromAddr.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSurfaceCoordFromAddr(
+    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            const ADDR_SURFACE_FLAGS flags = {{0}};
+            UINT_32 numSamples = GetNumFragments(pIn->numSamples, pIn->numFrags);
+
+            // Try finding a macroModeIndex
+            INT_32 macroModeIndex = HwlComputeMacroModeIndex(input.tileIndex,
+                                                             flags,
+                                                             input.bpp,
+                                                             numSamples,
+                                                             input.pTileInfo,
+                                                             &input.tileMode,
+                                                             &input.tileType);
+
+            // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
+            if (macroModeIndex == TileIndexNoMacroIndex)
+            {
+                returnCode = HwlSetupTileCfg(input.bpp, input.tileIndex, macroModeIndex,
+                                             input.pTileInfo, &input.tileMode, &input.tileType);
+            }
+            // If macroModeIndex is invalid, then assert this is not macro tiled
+            else if (macroModeIndex == TileIndexInvalid)
+            {
+                ADDR_ASSERT(!IsMacroTiled(input.tileMode));
+            }
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlComputeSurfaceCoordFromAddr(pIn, pOut);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSliceTileSwizzle
+*
+*   @brief
+*       Interface function stub of ComputeSliceTileSwizzle.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSliceTileSwizzle(
+    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_SLICESWIZZLE_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_SLICESWIZZLE_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_SLICESWIZZLE_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex,
+                                         input.pTileInfo, &input.tileMode);
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlComputeSliceTileSwizzle(pIn, pOut);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ExtractBankPipeSwizzle
+*
+*   @brief
+*       Interface function stub of AddrExtractBankPipeSwizzle.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ExtractBankPipeSwizzle(
+    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,    ///< [in] input structure
+    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT)) ||
+            (pOut->size != sizeof(ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlExtractBankPipeSwizzle(pIn, pOut);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::CombineBankPipeSwizzle
+*
+*   @brief
+*       Interface function stub of AddrCombineBankPipeSwizzle.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::CombineBankPipeSwizzle(
+    const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_INFO_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlCombineBankPipeSwizzle(pIn->bankSwizzle,
+                                                   pIn->pipeSwizzle,
+                                                   pIn->pTileInfo,
+                                                   pIn->baseAddr,
+                                                   &pOut->tileSwizzle);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeBaseSwizzle
+*
+*   @brief
+*       Interface function stub of AddrCompueBaseSwizzle.
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeBaseSwizzle(
+    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
+    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_BASE_SWIZZLE_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_BASE_SWIZZLE_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (IsMacroTiled(pIn->tileMode))
+            {
+                returnCode = HwlComputeBaseSwizzle(pIn, pOut);
+            }
+            else
+            {
+                pOut->tileSwizzle = 0;
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeFmaskInfo
+*
+*   @brief
+*       Interface function stub of ComputeFmaskInfo.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeFmaskInfo(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
+    )
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_INFO_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    // No thick MSAA
+    if (Thickness(pIn->tileMode) > 1)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_FMASK_INFO_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+
+            if (pOut->pTileInfo)
+            {
+                // Use temp tile info for calcalation
+                input.pTileInfo = pOut->pTileInfo;
+            }
+            else
+            {
+                input.pTileInfo = &tileInfoNull;
+            }
+
+            ADDR_SURFACE_FLAGS flags = {{0}};
+            flags.fmask = 1;
+
+            // Try finding a macroModeIndex
+            INT_32 macroModeIndex = HwlComputeMacroModeIndex(pIn->tileIndex,
+                                                             flags,
+                                                             HwlComputeFmaskBits(pIn, NULL),
+                                                             pIn->numSamples,
+                                                             input.pTileInfo,
+                                                             &input.tileMode);
+
+            // If macroModeIndex is not needed, then call HwlSetupTileCfg to get tile info
+            if (macroModeIndex == TileIndexNoMacroIndex)
+            {
+                returnCode = HwlSetupTileCfg(0, input.tileIndex, macroModeIndex,
+                                             input.pTileInfo, &input.tileMode);
+            }
+
+            ADDR_ASSERT(macroModeIndex != TileIndexInvalid);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (pIn->numSamples > 1)
+            {
+                returnCode = HwlComputeFmaskInfo(pIn, pOut);
+            }
+            else
+            {
+                memset(pOut, 0, sizeof(ADDR_COMPUTE_FMASK_INFO_OUTPUT));
+
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+        }
+    }
+
+    ValidBaseAlignments(pOut->baseAlign);
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeFmaskAddrFromCoord
+*
+*   @brief
+*       Interface function stub of ComputeFmaskAddrFromCoord.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeFmaskAddrFromCoord(
+    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_ASSERT(pIn->numSamples > 1);
+
+        if (pIn->numSamples > 1)
+        {
+            returnCode = HwlComputeFmaskAddrFromCoord(pIn, pOut);
+        }
+        else
+        {
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeFmaskCoordFromAddr
+*
+*   @brief
+*       Interface function stub of ComputeFmaskAddrFromCoord.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeFmaskCoordFromAddr(
+    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*  pIn,     ///< [in] input structure
+    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut           ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_ASSERT(pIn->numSamples > 1);
+
+        if (pIn->numSamples > 1)
+        {
+            returnCode = HwlComputeFmaskCoordFromAddr(pIn, pOut);
+        }
+        else
+        {
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ConvertTileInfoToHW
+*
+*   @brief
+*       Convert tile info from real value to HW register value in HW layer
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ConvertTileInfoToHW(
+    const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
+    ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_CONVERT_TILEINFOTOHW_INPUT)) ||
+            (pOut->size != sizeof(ADDR_CONVERT_TILEINFOTOHW_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_CONVERT_TILEINFOTOHW_INPUT input;
+        // if pIn->reverse is TRUE, indices are ignored
+        if (pIn->reverse == FALSE && UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(input.bpp, input.tileIndex,
+                                         input.macroModeIndex, input.pTileInfo);
+
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = HwlConvertTileInfoToHW(pIn, pOut);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ConvertTileIndex
+*
+*   @brief
+*       Convert tile index to tile mode/type/info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ConvertTileIndex(
+    const ADDR_CONVERT_TILEINDEX_INPUT* pIn, ///< [in] input structure
+    ADDR_CONVERT_TILEINDEX_OUTPUT* pOut      ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_CONVERT_TILEINDEX_INPUT)) ||
+            (pOut->size != sizeof(ADDR_CONVERT_TILEINDEX_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+
+        returnCode = HwlSetupTileCfg(pIn->bpp, pIn->tileIndex, pIn->macroModeIndex,
+                                     pOut->pTileInfo, &pOut->tileMode, &pOut->tileType);
+
+        if (returnCode == ADDR_OK && pIn->tileInfoHw)
+        {
+            ADDR_CONVERT_TILEINFOTOHW_INPUT hwInput = {0};
+            ADDR_CONVERT_TILEINFOTOHW_OUTPUT hwOutput = {0};
+
+            hwInput.pTileInfo = pOut->pTileInfo;
+            hwInput.tileIndex = -1;
+            hwOutput.pTileInfo = pOut->pTileInfo;
+
+            returnCode = HwlConvertTileInfoToHW(&hwInput, &hwOutput);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetMacroModeIndex
+*
+*   @brief
+*       Get macro mode index based on input info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::GetMacroModeIndex(
+    const ADDR_GET_MACROMODEINDEX_INPUT* pIn, ///< [in] input structure
+    ADDR_GET_MACROMODEINDEX_OUTPUT*      pOut ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags())
+    {
+        if ((pIn->size != sizeof(ADDR_GET_MACROMODEINDEX_INPUT)) ||
+            (pOut->size != sizeof(ADDR_GET_MACROMODEINDEX_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfo = {0};
+        pOut->macroModeIndex = HwlComputeMacroModeIndex(pIn->tileIndex, pIn->flags, pIn->bpp,
+                                                        pIn->numFrags, &tileInfo);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ConvertTileIndex1
+*
+*   @brief
+*       Convert tile index to tile mode/type/info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ConvertTileIndex1(
+    const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,   ///< [in] input structure
+    ADDR_CONVERT_TILEINDEX_OUTPUT* pOut         ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_CONVERT_TILEINDEX1_INPUT)) ||
+            (pOut->size != sizeof(ADDR_CONVERT_TILEINDEX_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_SURFACE_FLAGS flags = {{0}};
+
+        HwlComputeMacroModeIndex(pIn->tileIndex, flags, pIn->bpp, pIn->numSamples,
+                                 pOut->pTileInfo, &pOut->tileMode, &pOut->tileType);
+
+        if (pIn->tileInfoHw)
+        {
+            ADDR_CONVERT_TILEINFOTOHW_INPUT hwInput = {0};
+            ADDR_CONVERT_TILEINFOTOHW_OUTPUT hwOutput = {0};
+
+            hwInput.pTileInfo = pOut->pTileInfo;
+            hwInput.tileIndex = -1;
+            hwOutput.pTileInfo = pOut->pTileInfo;
+
+            returnCode = HwlConvertTileInfoToHW(&hwInput, &hwOutput);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::GetTileIndex
+*
+*   @brief
+*       Get tile index from tile mode/type/info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::GetTileIndex(
+    const ADDR_GET_TILEINDEX_INPUT* pIn, ///< [in] input structure
+    ADDR_GET_TILEINDEX_OUTPUT* pOut      ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_GET_TILEINDEX_INPUT)) ||
+            (pOut->size != sizeof(ADDR_GET_TILEINDEX_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        returnCode = HwlGetTileIndex(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::Thickness
+*
+*   @brief
+*       Get tile mode thickness
+*
+*   @return
+*       Tile mode thickness
+****************************************************************************************************
+*/
+UINT_32 Lib::Thickness(
+    AddrTileMode tileMode)    ///< [in] tile mode
+{
+    return ModeFlags[tileMode].thickness;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               CMASK/HTILE
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeHtilenfo
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeHtileInfo(
+    const ADDR_COMPUTE_HTILE_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR_COMPUTE_HTILE_INFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    BOOL_32 isWidth8  = (pIn->blockWidth == 8) ? TRUE : FALSE;
+    BOOL_32 isHeight8 = (pIn->blockHeight == 8) ? TRUE : FALSE;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_HTILE_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_HTILE_INFO_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_HTILE_INFO_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (pIn->flags.tcCompatible)
+            {
+                const UINT_32 sliceSize = pIn->pitch * pIn->height * 4 / (8 * 8);
+                const UINT_32 align     = HwlGetPipes(pIn->pTileInfo) * pIn->pTileInfo->banks * m_pipeInterleaveBytes;
+
+                if (pIn->numSlices > 1)
+                {
+                    const UINT_32 surfBytes = (sliceSize * pIn->numSlices);
+
+                    pOut->sliceSize        = sliceSize;
+                    pOut->htileBytes       = pIn->flags.skipTcCompatSizeAlign ?
+                                             surfBytes : PowTwoAlign(surfBytes, align);
+                    pOut->sliceInterleaved = ((sliceSize % align) != 0) ? TRUE : FALSE;
+                }
+                else
+                {
+                    pOut->sliceSize        = pIn->flags.skipTcCompatSizeAlign ?
+                                             sliceSize : PowTwoAlign(sliceSize, align);
+                    pOut->htileBytes       = pOut->sliceSize;
+                    pOut->sliceInterleaved = FALSE;
+                }
+
+                pOut->nextMipLevelCompressible = ((sliceSize % align) == 0) ? TRUE : FALSE;
+
+                pOut->pitch       = pIn->pitch;
+                pOut->height      = pIn->height;
+                pOut->baseAlign   = align;
+                pOut->macroWidth  = 0;
+                pOut->macroHeight = 0;
+                pOut->bpp         = 32;
+            }
+            else
+            {
+                pOut->bpp = ComputeHtileInfo(pIn->flags,
+                                             pIn->pitch,
+                                             pIn->height,
+                                             pIn->numSlices,
+                                             pIn->isLinear,
+                                             isWidth8,
+                                             isHeight8,
+                                             pIn->pTileInfo,
+                                             &pOut->pitch,
+                                             &pOut->height,
+                                             &pOut->htileBytes,
+                                             &pOut->macroWidth,
+                                             &pOut->macroHeight,
+                                             &pOut->sliceSize,
+                                             &pOut->baseAlign);
+            }
+        }
+    }
+
+    ValidMetaBaseAlignments(pOut->baseAlign);
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskInfo
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskInfo(
+    const ADDR_COMPUTE_CMASK_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR_COMPUTE_CMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_CMASK_INFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_CMASK_INFO_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_CMASK_INFO_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            returnCode = ComputeCmaskInfo(pIn->flags,
+                                          pIn->pitch,
+                                          pIn->height,
+                                          pIn->numSlices,
+                                          pIn->isLinear,
+                                          pIn->pTileInfo,
+                                          &pOut->pitch,
+                                          &pOut->height,
+                                          &pOut->cmaskBytes,
+                                          &pOut->macroWidth,
+                                          &pOut->macroHeight,
+                                          &pOut->sliceSize,
+                                          &pOut->baseAlign,
+                                          &pOut->blockMax);
+        }
+    }
+
+    ValidMetaBaseAlignments(pOut->baseAlign);
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeDccInfo
+*
+*   @brief
+*       Interface function to compute DCC key info
+*
+*   @return
+*       return code of HwlComputeDccInfo
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeDccInfo(
+    const ADDR_COMPUTE_DCCINFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR_COMPUTE_DCCINFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE ret = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_DCCINFO_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_DCCINFO_OUTPUT)))
+        {
+            ret = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (ret == ADDR_OK)
+    {
+        ADDR_COMPUTE_DCCINFO_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+
+            ret = HwlSetupTileCfg(input.bpp, input.tileIndex, input.macroModeIndex,
+                                  &input.tileInfo, &input.tileMode);
+
+            pIn = &input;
+        }
+
+        if (ret == ADDR_OK)
+        {
+            ret = HwlComputeDccInfo(pIn, pOut);
+
+            ValidMetaBaseAlignments(pOut->dccRamBaseAlign);
+        }
+    }
+
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeHtileAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeHtileAddrFromCoord(
+    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    BOOL_32 isWidth8  = (pIn->blockWidth == 8) ? TRUE : FALSE;
+    BOOL_32 isHeight8 = (pIn->blockHeight == 8) ? TRUE : FALSE;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (pIn->flags.tcCompatible)
+            {
+                HwlComputeHtileAddrFromCoord(pIn, pOut);
+            }
+            else
+            {
+                pOut->addr = HwlComputeXmaskAddrFromCoord(pIn->pitch,
+                                                          pIn->height,
+                                                          pIn->x,
+                                                          pIn->y,
+                                                          pIn->slice,
+                                                          pIn->numSlices,
+                                                          1,
+                                                          pIn->isLinear,
+                                                          isWidth8,
+                                                          isHeight8,
+                                                          pIn->pTileInfo,
+                                                          &pOut->bitPosition);
+            }
+        }
+    }
+
+    return returnCode;
+
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileCoordFromAddr
+*
+*   @brief
+*       Interface function stub of AddrComputeHtileCoordFromAddr
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeHtileCoordFromAddr(
+    const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    BOOL_32 isWidth8  = (pIn->blockWidth == 8) ? TRUE : FALSE;
+    BOOL_32 isHeight8 = (pIn->blockHeight == 8) ? TRUE : FALSE;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            HwlComputeXmaskCoordFromAddr(pIn->addr,
+                                         pIn->bitPosition,
+                                         pIn->pitch,
+                                         pIn->height,
+                                         pIn->numSlices,
+                                         1,
+                                         pIn->isLinear,
+                                         isWidth8,
+                                         isHeight8,
+                                         pIn->pTileInfo,
+                                         &pOut->x,
+                                         &pOut->y,
+                                         &pOut->slice);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskAddrFromCoord(
+    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            if (pIn->flags.tcCompatible == TRUE)
+            {
+                returnCode = HwlComputeCmaskAddrFromCoord(pIn, pOut);
+            }
+            else
+            {
+                pOut->addr = HwlComputeXmaskAddrFromCoord(pIn->pitch,
+                                                          pIn->height,
+                                                          pIn->x,
+                                                          pIn->y,
+                                                          pIn->slice,
+                                                          pIn->numSlices,
+                                                          2,
+                                                          pIn->isLinear,
+                                                          FALSE, //this is cmask, isWidth8 is not needed
+                                                          FALSE, //this is cmask, isHeight8 is not needed
+                                                          pIn->pTileInfo,
+                                                          &pOut->bitPosition);
+            }
+
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskCoordFromAddr
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskCoordFromAddr
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskCoordFromAddr(
+    const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (GetFillSizeFieldsFlags() == TRUE)
+    {
+        if ((pIn->size != sizeof(ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT)) ||
+            (pOut->size != sizeof(ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT)))
+        {
+            returnCode = ADDR_PARAMSIZEMISMATCH;
+        }
+    }
+
+    if (returnCode == ADDR_OK)
+    {
+        ADDR_TILEINFO tileInfoNull;
+        ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT input;
+
+        if (UseTileIndex(pIn->tileIndex))
+        {
+            input = *pIn;
+            // Use temp tile info for calcalation
+            input.pTileInfo = &tileInfoNull;
+
+            returnCode = HwlSetupTileCfg(0, input.tileIndex, input.macroModeIndex, input.pTileInfo);
+
+            // Change the input structure
+            pIn = &input;
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            HwlComputeXmaskCoordFromAddr(pIn->addr,
+                                         pIn->bitPosition,
+                                         pIn->pitch,
+                                         pIn->height,
+                                         pIn->numSlices,
+                                         2,
+                                         pIn->isLinear,
+                                         FALSE,
+                                         FALSE,
+                                         pIn->pTileInfo,
+                                         &pOut->x,
+                                         &pOut->y,
+                                         &pOut->slice);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeTileDataWidthAndHeight
+*
+*   @brief
+*       Compute the squared cache shape for per-tile data (CMASK and HTILE)
+*
+*   @return
+*       N/A
+*
+*   @note
+*       MacroWidth and macroHeight are measured in pixels
+****************************************************************************************************
+*/
+VOID Lib::ComputeTileDataWidthAndHeight(
+    UINT_32         bpp,             ///< [in] bits per pixel
+    UINT_32         cacheBits,       ///< [in] bits of cache
+    ADDR_TILEINFO*  pTileInfo,       ///< [in] Tile info
+    UINT_32*        pMacroWidth,     ///< [out] macro tile width
+    UINT_32*        pMacroHeight     ///< [out] macro tile height
+    ) const
+{
+    UINT_32 height = 1;
+    UINT_32 width  = cacheBits / bpp;
+    UINT_32 pipes  = HwlGetPipes(pTileInfo);
+
+    // Double height until the macro-tile is close to square
+    // Height can only be doubled if width is even
+
+    while ((width > height * 2 * pipes) && !(width & 1))
+    {
+        width  /= 2;
+        height *= 2;
+    }
+
+    *pMacroWidth  = 8 * width;
+    *pMacroHeight = 8 * height * pipes;
+
+    // Note: The above iterative comptuation is equivalent to the following
+    //
+    //int log2_height = ((log2(cacheBits)-log2(bpp)-log2(pipes))/2);
+    //int macroHeight = pow2( 3+log2(pipes)+log2_height );
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlComputeTileDataWidthAndHeightLinear
+*
+*   @brief
+*       Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
+*
+*   @return
+*       N/A
+*
+*   @note
+*       MacroWidth and macroHeight are measured in pixels
+****************************************************************************************************
+*/
+VOID Lib::HwlComputeTileDataWidthAndHeightLinear(
+    UINT_32*        pMacroWidth,     ///< [out] macro tile width
+    UINT_32*        pMacroHeight,    ///< [out] macro tile height
+    UINT_32         bpp,             ///< [in] bits per pixel
+    ADDR_TILEINFO*  pTileInfo        ///< [in] tile info
+    ) const
+{
+    ADDR_ASSERT(bpp != 4);              // Cmask does not support linear layout prior to SI
+    *pMacroWidth  = 8 * 512 / bpp;      // Align width to 512-bit memory accesses
+    *pMacroHeight = 8 * m_pipes;        // Align height to number of pipes
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeHtileInfo
+*
+*   @brief
+*       Compute htile pitch,width, bytes per 2D slice
+*
+*   @return
+*       Htile bpp i.e. How many bits for an 8x8 tile
+*       Also returns by output parameters:
+*       *Htile pitch, height, total size in bytes, macro-tile dimensions and slice size*
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputeHtileInfo(
+    ADDR_HTILE_FLAGS flags,             ///< [in] htile flags
+    UINT_32          pitchIn,           ///< [in] pitch input
+    UINT_32          heightIn,          ///< [in] height input
+    UINT_32          numSlices,         ///< [in] number of slices
+    BOOL_32          isLinear,          ///< [in] if it is linear mode
+    BOOL_32          isWidth8,          ///< [in] if htile block width is 8
+    BOOL_32          isHeight8,         ///< [in] if htile block height is 8
+    ADDR_TILEINFO*   pTileInfo,         ///< [in] Tile info
+    UINT_32*         pPitchOut,         ///< [out] pitch output
+    UINT_32*         pHeightOut,        ///< [out] height output
+    UINT_64*         pHtileBytes,       ///< [out] bytes per 2D slice
+    UINT_32*         pMacroWidth,       ///< [out] macro-tile width in pixels
+    UINT_32*         pMacroHeight,      ///< [out] macro-tile width in pixels
+    UINT_64*         pSliceSize,        ///< [out] slice size in bytes
+    UINT_32*         pBaseAlign         ///< [out] base alignment
+    ) const
+{
+
+    UINT_32 macroWidth;
+    UINT_32 macroHeight;
+    UINT_32 baseAlign;
+    UINT_64 surfBytes;
+    UINT_64 sliceBytes;
+
+    numSlices = Max(1u, numSlices);
+
+    const UINT_32 bpp = HwlComputeHtileBpp(isWidth8, isHeight8);
+    const UINT_32 cacheBits = HtileCacheBits;
+
+    if (isLinear)
+    {
+        HwlComputeTileDataWidthAndHeightLinear(&macroWidth,
+                                               &macroHeight,
+                                               bpp,
+                                               pTileInfo);
+    }
+    else
+    {
+        ComputeTileDataWidthAndHeight(bpp,
+                                      cacheBits,
+                                      pTileInfo,
+                                      &macroWidth,
+                                      &macroHeight);
+    }
+
+    *pPitchOut = PowTwoAlign(pitchIn,  macroWidth);
+    *pHeightOut = PowTwoAlign(heightIn,  macroHeight);
+
+    baseAlign = HwlComputeHtileBaseAlign(flags.tcCompatible, isLinear, pTileInfo);
+
+    surfBytes = HwlComputeHtileBytes(*pPitchOut,
+                                     *pHeightOut,
+                                     bpp,
+                                     isLinear,
+                                     numSlices,
+                                     &sliceBytes,
+                                     baseAlign);
+
+    *pHtileBytes = surfBytes;
+
+    //
+    // Use SafeAssign since they are optional
+    //
+    SafeAssign(pMacroWidth, macroWidth);
+
+    SafeAssign(pMacroHeight, macroHeight);
+
+    SafeAssign(pSliceSize,  sliceBytes);
+
+    SafeAssign(pBaseAlign, baseAlign);
+
+    return bpp;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskBaseAlign
+*
+*   @brief
+*       Compute cmask base alignment
+*
+*   @return
+*       Cmask base alignment
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputeCmaskBaseAlign(
+    ADDR_CMASK_FLAGS flags,           ///< [in] Cmask flags
+    ADDR_TILEINFO*   pTileInfo        ///< [in] Tile info
+    ) const
+{
+    UINT_32 baseAlign = m_pipeInterleaveBytes * HwlGetPipes(pTileInfo);
+
+    if (flags.tcCompatible)
+    {
+        ADDR_ASSERT(pTileInfo != NULL);
+        if (pTileInfo)
+        {
+            baseAlign *= pTileInfo->banks;
+        }
+    }
+
+    return baseAlign;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskBytes
+*
+*   @brief
+*       Compute cmask size in bytes
+*
+*   @return
+*       Cmask size in bytes
+****************************************************************************************************
+*/
+UINT_64 Lib::ComputeCmaskBytes(
+    UINT_32 pitch,        ///< [in] pitch
+    UINT_32 height,       ///< [in] height
+    UINT_32 numSlices     ///< [in] number of slices
+    ) const
+{
+    return BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * numSlices * CmaskElemBits) /
+        MicroTilePixels;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeCmaskInfo
+*
+*   @brief
+*       Compute cmask pitch,width, bytes per 2D slice
+*
+*   @return
+*       BlockMax. Also by output parameters: Cmask pitch,height, total size in bytes,
+*       macro-tile dimensions
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeCmaskInfo(
+    ADDR_CMASK_FLAGS flags,            ///< [in] cmask flags
+    UINT_32          pitchIn,           ///< [in] pitch input
+    UINT_32          heightIn,          ///< [in] height input
+    UINT_32          numSlices,         ///< [in] number of slices
+    BOOL_32          isLinear,          ///< [in] is linear mode
+    ADDR_TILEINFO*   pTileInfo,         ///< [in] Tile info
+    UINT_32*         pPitchOut,         ///< [out] pitch output
+    UINT_32*         pHeightOut,        ///< [out] height output
+    UINT_64*         pCmaskBytes,       ///< [out] bytes per 2D slice
+    UINT_32*         pMacroWidth,       ///< [out] macro-tile width in pixels
+    UINT_32*         pMacroHeight,      ///< [out] macro-tile width in pixels
+    UINT_64*         pSliceSize,        ///< [out] slice size in bytes
+    UINT_32*         pBaseAlign,        ///< [out] base alignment
+    UINT_32*         pBlockMax          ///< [out] block max == slice / 128 / 128 - 1
+    ) const
+{
+    UINT_32 macroWidth;
+    UINT_32 macroHeight;
+    UINT_32 baseAlign;
+    UINT_64 surfBytes;
+    UINT_64 sliceBytes;
+
+    numSlices = Max(1u, numSlices);
+
+    const UINT_32 bpp = CmaskElemBits;
+    const UINT_32 cacheBits = CmaskCacheBits;
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (isLinear)
+    {
+        HwlComputeTileDataWidthAndHeightLinear(&macroWidth,
+                                               &macroHeight,
+                                               bpp,
+                                               pTileInfo);
+    }
+    else
+    {
+        ComputeTileDataWidthAndHeight(bpp,
+                                      cacheBits,
+                                      pTileInfo,
+                                      &macroWidth,
+                                      &macroHeight);
+    }
+
+    *pPitchOut = (pitchIn + macroWidth - 1) & ~(macroWidth - 1);
+    *pHeightOut = (heightIn + macroHeight - 1) & ~(macroHeight - 1);
+
+    sliceBytes = ComputeCmaskBytes(*pPitchOut,
+                                   *pHeightOut,
+                                   1);
+
+    baseAlign = ComputeCmaskBaseAlign(flags, pTileInfo);
+
+    while (sliceBytes % baseAlign)
+    {
+        *pHeightOut += macroHeight;
+
+        sliceBytes = ComputeCmaskBytes(*pPitchOut,
+                                       *pHeightOut,
+                                       1);
+    }
+
+    surfBytes = sliceBytes * numSlices;
+
+    *pCmaskBytes = surfBytes;
+
+    //
+    // Use SafeAssign since they are optional
+    //
+    SafeAssign(pMacroWidth, macroWidth);
+
+    SafeAssign(pMacroHeight, macroHeight);
+
+    SafeAssign(pBaseAlign, baseAlign);
+
+    SafeAssign(pSliceSize, sliceBytes);
+
+    UINT_32 slice = (*pPitchOut) * (*pHeightOut);
+    UINT_32 blockMax = slice / 128 / 128 - 1;
+
+#if DEBUG
+    if (slice % (64*256) != 0)
+    {
+        ADDR_ASSERT_ALWAYS();
+    }
+#endif //DEBUG
+
+    UINT_32 maxBlockMax = HwlGetMaxCmaskBlockMax();
+
+    if (blockMax > maxBlockMax)
+    {
+        blockMax = maxBlockMax;
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    SafeAssign(pBlockMax, blockMax);
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeXmaskCoordYFromPipe
+*
+*   @brief
+*       Compute the Y coord from pipe number for cmask/htile
+*
+*   @return
+*       Y coordinate
+*
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputeXmaskCoordYFromPipe(
+    UINT_32         pipe,       ///< [in] pipe number
+    UINT_32         x           ///< [in] x coordinate
+    ) const
+{
+    UINT_32 pipeBit0;
+    UINT_32 pipeBit1;
+    UINT_32 xBit0;
+    UINT_32 xBit1;
+    UINT_32 yBit0;
+    UINT_32 yBit1;
+
+    UINT_32 y = 0;
+
+    UINT_32 numPipes = m_pipes; // SI has its implementation
+    //
+    // Convert pipe + x to y coordinate.
+    //
+    switch (numPipes)
+    {
+        case 1:
+            //
+            // 1 pipe
+            //
+            // p0 = 0
+            //
+            y = 0;
+            break;
+        case 2:
+            //
+            // 2 pipes
+            //
+            // p0 = x0 ^ y0
+            //
+            // y0 = p0 ^ x0
+            //
+            pipeBit0 = pipe & 0x1;
+
+            xBit0 = x & 0x1;
+
+            yBit0 = pipeBit0 ^ xBit0;
+
+            y = yBit0;
+            break;
+        case 4:
+            //
+            // 4 pipes
+            //
+            // p0 = x1 ^ y0
+            // p1 = x0 ^ y1
+            //
+            // y0 = p0 ^ x1
+            // y1 = p1 ^ x0
+            //
+            pipeBit0 =  pipe & 0x1;
+            pipeBit1 = (pipe & 0x2) >> 1;
+
+            xBit0 =  x & 0x1;
+            xBit1 = (x & 0x2) >> 1;
+
+            yBit0 = pipeBit0 ^ xBit1;
+            yBit1 = pipeBit1 ^ xBit0;
+
+            y = (yBit0 |
+                 (yBit1 << 1));
+            break;
+        case 8:
+            //
+            // 8 pipes
+            //
+            // r600 and r800 have different method
+            //
+            y = HwlComputeXmaskCoordYFrom8Pipe(pipe, x);
+            break;
+        default:
+            break;
+    }
+    return y;
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlComputeXmaskCoordFromAddr
+*
+*   @brief
+*       Compute the coord from an address of a cmask/htile
+*
+*   @return
+*       N/A
+*
+*   @note
+*       This method is reused by htile, so rename to Xmask
+****************************************************************************************************
+*/
+VOID Lib::HwlComputeXmaskCoordFromAddr(
+    UINT_64         addr,           ///< [in] address
+    UINT_32         bitPosition,    ///< [in] bitPosition in a byte
+    UINT_32         pitch,          ///< [in] pitch
+    UINT_32         height,         ///< [in] height
+    UINT_32         numSlices,      ///< [in] number of slices
+    UINT_32         factor,         ///< [in] factor that indicates cmask or htile
+    BOOL_32         isLinear,       ///< [in] linear or tiled HTILE layout
+    BOOL_32         isWidth8,       ///< [in] TRUE if width is 8, FALSE means 4. It's register value
+    BOOL_32         isHeight8,      ///< [in] TRUE if width is 8, FALSE means 4. It's register value
+    ADDR_TILEINFO*  pTileInfo,      ///< [in] Tile info
+    UINT_32*        pX,             ///< [out] x coord
+    UINT_32*        pY,             ///< [out] y coord
+    UINT_32*        pSlice          ///< [out] slice index
+    ) const
+{
+    UINT_32 pipe;
+    UINT_32 numPipes;
+    UINT_32 numGroupBits;
+    (void)numGroupBits;
+    UINT_32 numPipeBits;
+    UINT_32 macroTilePitch;
+    UINT_32 macroTileHeight;
+
+    UINT_64 bitAddr;
+
+    UINT_32 microTileCoordY;
+
+    UINT_32 elemBits;
+
+    UINT_32 pitchAligned = pitch;
+    UINT_32 heightAligned = height;
+    UINT_64 totalBytes;
+
+    UINT_64 elemOffset;
+
+    UINT_64 macroIndex;
+    UINT_32 microIndex;
+
+    UINT_64 macroNumber;
+    UINT_32 microNumber;
+
+    UINT_32 macroX;
+    UINT_32 macroY;
+    UINT_32 macroZ;
+
+    UINT_32 microX;
+    UINT_32 microY;
+
+    UINT_32 tilesPerMacro;
+    UINT_32 macrosPerPitch;
+    UINT_32 macrosPerSlice;
+
+    //
+    // Extract pipe.
+    //
+    numPipes = HwlGetPipes(pTileInfo);
+    pipe = ComputePipeFromAddr(addr, numPipes);
+
+    //
+    // Compute the number of group and pipe bits.
+    //
+    numGroupBits = Log2(m_pipeInterleaveBytes);
+    numPipeBits  = Log2(numPipes);
+
+    UINT_32 groupBits = 8 * m_pipeInterleaveBytes;
+    UINT_32 pipes = numPipes;
+
+    //
+    // Compute the micro tile size, in bits. And macro tile pitch and height.
+    //
+    if (factor == 2) //CMASK
+    {
+        ADDR_CMASK_FLAGS flags = {{0}};
+
+        elemBits = CmaskElemBits;
+
+        ComputeCmaskInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         pTileInfo,
+                         &pitchAligned,
+                         &heightAligned,
+                         &totalBytes,
+                         &macroTilePitch,
+                         &macroTileHeight);
+    }
+    else  //HTILE
+    {
+        ADDR_HTILE_FLAGS flags = {{0}};
+
+        if (factor != 1)
+        {
+            factor = 1;
+        }
+
+        elemBits = HwlComputeHtileBpp(isWidth8, isHeight8);
+
+        ComputeHtileInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         isWidth8,
+                         isHeight8,
+                         pTileInfo,
+                         &pitchAligned,
+                         &heightAligned,
+                         &totalBytes,
+                         &macroTilePitch,
+                         &macroTileHeight);
+    }
+
+    // Should use aligned dims
+    //
+    pitch = pitchAligned;
+    height = heightAligned;
+
+    //
+    // Convert byte address to bit address.
+    //
+    bitAddr = BYTES_TO_BITS(addr) + bitPosition;
+
+    //
+    // Remove pipe bits from address.
+    //
+
+    bitAddr = (bitAddr % groupBits) + ((bitAddr/groupBits/pipes)*groupBits);
+
+    elemOffset = bitAddr / elemBits;
+
+    tilesPerMacro = (macroTilePitch/factor) * macroTileHeight / MicroTilePixels >> numPipeBits;
+
+    macrosPerPitch = pitch / (macroTilePitch/factor);
+    macrosPerSlice = macrosPerPitch * height / macroTileHeight;
+
+    macroIndex = elemOffset / factor / tilesPerMacro;
+    microIndex = static_cast<UINT_32>(elemOffset % (tilesPerMacro * factor));
+
+    macroNumber = macroIndex * factor + microIndex % factor;
+    microNumber = microIndex / factor;
+
+    macroX = static_cast<UINT_32>((macroNumber % macrosPerPitch));
+    macroY = static_cast<UINT_32>((macroNumber % macrosPerSlice) / macrosPerPitch);
+    macroZ = static_cast<UINT_32>((macroNumber / macrosPerSlice));
+
+    microX = microNumber % (macroTilePitch / factor / MicroTileWidth);
+    microY = (microNumber / (macroTilePitch / factor / MicroTileHeight));
+
+    *pX = macroX * (macroTilePitch/factor) + microX * MicroTileWidth;
+    *pY = macroY * macroTileHeight + (microY * MicroTileHeight << numPipeBits);
+    *pSlice = macroZ;
+
+    microTileCoordY = ComputeXmaskCoordYFromPipe(pipe,
+                                                 *pX/MicroTileWidth);
+
+    //
+    // Assemble final coordinates.
+    //
+    *pY += microTileCoordY * MicroTileHeight;
+
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlComputeXmaskAddrFromCoord
+*
+*   @brief
+*       Compute the address from an address of cmask (prior to si)
+*
+*   @return
+*       Address in bytes
+*
+****************************************************************************************************
+*/
+UINT_64 Lib::HwlComputeXmaskAddrFromCoord(
+    UINT_32        pitch,          ///< [in] pitch
+    UINT_32        height,         ///< [in] height
+    UINT_32        x,              ///< [in] x coord
+    UINT_32        y,              ///< [in] y coord
+    UINT_32        slice,          ///< [in] slice/depth index
+    UINT_32        numSlices,      ///< [in] number of slices
+    UINT_32        factor,         ///< [in] factor that indicates cmask(2) or htile(1)
+    BOOL_32        isLinear,       ///< [in] linear or tiled HTILE layout
+    BOOL_32        isWidth8,       ///< [in] TRUE if width is 8, FALSE means 4. It's register value
+    BOOL_32        isHeight8,      ///< [in] TRUE if width is 8, FALSE means 4. It's register value
+    ADDR_TILEINFO* pTileInfo,      ///< [in] Tile info
+    UINT_32*       pBitPosition    ///< [out] bit position inside a byte
+    ) const
+{
+    UINT_64 addr;
+    UINT_32 numGroupBits;
+    UINT_32 numPipeBits;
+    UINT_32 newPitch = 0;
+    UINT_32 newHeight = 0;
+    UINT_64 sliceBytes = 0;
+    UINT_64 totalBytes = 0;
+    UINT_64 sliceOffset;
+    UINT_32 pipe;
+    UINT_32 macroTileWidth;
+    UINT_32 macroTileHeight;
+    UINT_32 macroTilesPerRow;
+    UINT_32 macroTileBytes;
+    UINT_32 macroTileIndexX;
+    UINT_32 macroTileIndexY;
+    UINT_64 macroTileOffset;
+    UINT_32 pixelBytesPerRow;
+    UINT_32 pixelOffsetX;
+    UINT_32 pixelOffsetY;
+    UINT_32 pixelOffset;
+    UINT_64 totalOffset;
+    UINT_64 offsetLo;
+    UINT_64 offsetHi;
+    UINT_64 groupMask;
+
+    UINT_32 elemBits = 0;
+
+    UINT_32 numPipes = m_pipes; // This function is accessed prior to si only
+
+    if (factor == 2) //CMASK
+    {
+        elemBits = CmaskElemBits;
+
+        // For asics before SI, cmask is always tiled
+        isLinear = FALSE;
+    }
+    else //HTILE
+    {
+        if (factor != 1) // Fix compile warning
+        {
+            factor = 1;
+        }
+
+        elemBits = HwlComputeHtileBpp(isWidth8, isHeight8);
+    }
+
+    //
+    // Compute the number of group bits and pipe bits.
+    //
+    numGroupBits = Log2(m_pipeInterleaveBytes);
+    numPipeBits  = Log2(numPipes);
+
+    //
+    // Compute macro tile dimensions.
+    //
+    if (factor == 2) // CMASK
+    {
+        ADDR_CMASK_FLAGS flags = {{0}};
+
+        ComputeCmaskInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         pTileInfo,
+                         &newPitch,
+                         &newHeight,
+                         &totalBytes,
+                         &macroTileWidth,
+                         &macroTileHeight);
+
+        sliceBytes = totalBytes / numSlices;
+    }
+    else // HTILE
+    {
+        ADDR_HTILE_FLAGS flags = {{0}};
+
+        ComputeHtileInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         isWidth8,
+                         isHeight8,
+                         pTileInfo,
+                         &newPitch,
+                         &newHeight,
+                         &totalBytes,
+                         &macroTileWidth,
+                         &macroTileHeight,
+                         &sliceBytes);
+    }
+
+    sliceOffset = slice * sliceBytes;
+
+    //
+    // Get the pipe.  Note that neither slice rotation nor pipe swizzling apply for CMASK.
+    //
+    pipe = ComputePipeFromCoord(x,
+                                y,
+                                0,
+                                ADDR_TM_2D_TILED_THIN1,
+                                0,
+                                FALSE,
+                                pTileInfo);
+
+    //
+    // Compute the number of macro tiles per row.
+    //
+    macroTilesPerRow = newPitch / macroTileWidth;
+
+    //
+    // Compute the number of bytes per macro tile.
+    //
+    macroTileBytes = BITS_TO_BYTES((macroTileWidth * macroTileHeight * elemBits) / MicroTilePixels);
+
+    //
+    // Compute the offset to the macro tile containing the specified coordinate.
+    //
+    macroTileIndexX = x / macroTileWidth;
+    macroTileIndexY = y / macroTileHeight;
+    macroTileOffset = ((macroTileIndexY * macroTilesPerRow) + macroTileIndexX) * macroTileBytes;
+
+    //
+    // Compute the pixel offset within the macro tile.
+    //
+    pixelBytesPerRow = BITS_TO_BYTES(macroTileWidth * elemBits) / MicroTileWidth;
+
+    //
+    // The nibbles are interleaved (see below), so the part of the offset relative to the x
+    // coordinate repeats halfway across the row. (Not for HTILE)
+    //
+    if (factor == 2)
+    {
+        pixelOffsetX = (x % (macroTileWidth / 2)) / MicroTileWidth;
+    }
+    else
+    {
+        pixelOffsetX = (x % (macroTileWidth)) / MicroTileWidth * BITS_TO_BYTES(elemBits);
+    }
+
+    //
+    // Compute the y offset within the macro tile.
+    //
+    pixelOffsetY = (((y % macroTileHeight) / MicroTileHeight) / numPipes) * pixelBytesPerRow;
+
+    pixelOffset = pixelOffsetX + pixelOffsetY;
+
+    //
+    // Combine the slice offset and macro tile offset with the pixel offset, accounting for the
+    // pipe bits in the middle of the address.
+    //
+    totalOffset = ((sliceOffset + macroTileOffset) >> numPipeBits) + pixelOffset;
+
+    //
+    // Split the offset to put some bits below the pipe bits and some above.
+    //
+    groupMask = (1 << numGroupBits) - 1;
+    offsetLo  = totalOffset &  groupMask;
+    offsetHi  = (totalOffset & ~groupMask) << numPipeBits;
+
+    //
+    // Assemble the address from its components.
+    //
+    addr  = offsetLo;
+    addr |= offsetHi;
+    // This is to remove warning with /analyze option
+    UINT_32 pipeBits = pipe << numGroupBits;
+    addr |= pipeBits;
+
+    //
+    // Compute the bit position.  The lower nibble is used when the x coordinate within the macro
+    // tile is less than half of the macro tile width, and the upper nibble is used when the x
+    // coordinate within the macro tile is greater than or equal to half the macro tile width.
+    //
+    *pBitPosition = ((x % macroTileWidth) < (macroTileWidth / factor)) ? 0 : 4;
+
+    return addr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Surface Addressing Shared
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceAddrFromCoordLinear
+*
+*   @brief
+*       Compute address from coord for linear surface
+*
+*   @return
+*       Address in bytes
+*
+****************************************************************************************************
+*/
+UINT_64 Lib::ComputeSurfaceAddrFromCoordLinear(
+    UINT_32  x,              ///< [in] x coord
+    UINT_32  y,              ///< [in] y coord
+    UINT_32  slice,          ///< [in] slice/depth index
+    UINT_32  sample,         ///< [in] sample index
+    UINT_32  bpp,            ///< [in] bits per pixel
+    UINT_32  pitch,          ///< [in] pitch
+    UINT_32  height,         ///< [in] height
+    UINT_32  numSlices,      ///< [in] number of slices
+    UINT_32* pBitPosition    ///< [out] bit position inside a byte
+    ) const
+{
+    const UINT_64 sliceSize = static_cast<UINT_64>(pitch) * height;
+
+    UINT_64 sliceOffset = (slice + sample * numSlices)* sliceSize;
+    UINT_64 rowOffset   = static_cast<UINT_64>(y) * pitch;
+    UINT_64 pixOffset   = x;
+
+    UINT_64 addr = (sliceOffset + rowOffset + pixOffset) * bpp;
+
+    *pBitPosition = static_cast<UINT_32>(addr % 8);
+    addr /= 8;
+
+    return addr;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceCoordFromAddrLinear
+*
+*   @brief
+*       Compute the coord from an address of a linear surface
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID Lib::ComputeSurfaceCoordFromAddrLinear(
+    UINT_64  addr,           ///< [in] address
+    UINT_32  bitPosition,    ///< [in] bitPosition in a byte
+    UINT_32  bpp,            ///< [in] bits per pixel
+    UINT_32  pitch,          ///< [in] pitch
+    UINT_32  height,         ///< [in] height
+    UINT_32  numSlices,      ///< [in] number of slices
+    UINT_32* pX,             ///< [out] x coord
+    UINT_32* pY,             ///< [out] y coord
+    UINT_32* pSlice,         ///< [out] slice/depth index
+    UINT_32* pSample         ///< [out] sample index
+    ) const
+{
+    const UINT_64 sliceSize = static_cast<UINT_64>(pitch) * height;
+    const UINT_64 linearOffset = (BYTES_TO_BITS(addr) + bitPosition) / bpp;
+
+    *pX = static_cast<UINT_32>((linearOffset % sliceSize) % pitch);
+    *pY = static_cast<UINT_32>((linearOffset % sliceSize) / pitch % height);
+    *pSlice  = static_cast<UINT_32>((linearOffset / sliceSize) % numSlices);
+    *pSample = static_cast<UINT_32>((linearOffset / sliceSize) / numSlices);
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeSurfaceCoordFromAddrMicroTiled
+*
+*   @brief
+*       Compute the coord from an address of a micro tiled surface
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID Lib::ComputeSurfaceCoordFromAddrMicroTiled(
+    UINT_64         addr,               ///< [in] address
+    UINT_32         bitPosition,        ///< [in] bitPosition in a byte
+    UINT_32         bpp,                ///< [in] bits per pixel
+    UINT_32         pitch,              ///< [in] pitch
+    UINT_32         height,             ///< [in] height
+    UINT_32         numSamples,         ///< [in] number of samples
+    AddrTileMode    tileMode,           ///< [in] tile mode
+    UINT_32         tileBase,           ///< [in] base offset within a tile
+    UINT_32         compBits,           ///< [in] component bits actually needed(for planar surface)
+    UINT_32*        pX,                 ///< [out] x coord
+    UINT_32*        pY,                 ///< [out] y coord
+    UINT_32*        pSlice,             ///< [out] slice/depth index
+    UINT_32*        pSample,            ///< [out] sample index,
+    AddrTileType    microTileType,      ///< [in] micro tiling order
+    BOOL_32         isDepthSampleOrder  ///< [in] TRUE if in depth sample order
+    ) const
+{
+    UINT_64 bitAddr;
+    UINT_32 microTileThickness;
+    UINT_32 microTileBits;
+    UINT_64 sliceBits;
+    UINT_64 rowBits;
+    UINT_32 sliceIndex;
+    UINT_32 microTileCoordX;
+    UINT_32 microTileCoordY;
+    UINT_32 pixelOffset;
+    UINT_32 pixelCoordX = 0;
+    UINT_32 pixelCoordY = 0;
+    UINT_32 pixelCoordZ = 0;
+    UINT_32 pixelCoordS = 0;
+
+    //
+    // Convert byte address to bit address.
+    //
+    bitAddr = BYTES_TO_BITS(addr) + bitPosition;
+
+    //
+    // Compute the micro tile size, in bits.
+    //
+    switch (tileMode)
+    {
+        case ADDR_TM_1D_TILED_THICK:
+            microTileThickness = ThickTileThickness;
+            break;
+        default:
+            microTileThickness = 1;
+            break;
+    }
+
+    microTileBits = MicroTilePixels * microTileThickness * bpp * numSamples;
+
+    //
+    // Compute number of bits per slice and number of bits per row of micro tiles.
+    //
+    sliceBits = static_cast<UINT_64>(pitch) * height * microTileThickness * bpp * numSamples;
+
+    rowBits   = (pitch / MicroTileWidth) * microTileBits;
+
+    //
+    // Extract the slice index.
+    //
+    sliceIndex = static_cast<UINT_32>(bitAddr / sliceBits);
+    bitAddr -= sliceIndex * sliceBits;
+
+    //
+    // Extract the y coordinate of the micro tile.
+    //
+    microTileCoordY = static_cast<UINT_32>(bitAddr / rowBits) * MicroTileHeight;
+    bitAddr -= (microTileCoordY / MicroTileHeight) * rowBits;
+
+    //
+    // Extract the x coordinate of the micro tile.
+    //
+    microTileCoordX = static_cast<UINT_32>(bitAddr / microTileBits) * MicroTileWidth;
+
+    //
+    // Compute the pixel offset within the micro tile.
+    //
+    pixelOffset = static_cast<UINT_32>(bitAddr % microTileBits);
+
+    //
+    // Extract pixel coordinates from the offset.
+    //
+    HwlComputePixelCoordFromOffset(pixelOffset,
+                                   bpp,
+                                   numSamples,
+                                   tileMode,
+                                   tileBase,
+                                   compBits,
+                                   &pixelCoordX,
+                                   &pixelCoordY,
+                                   &pixelCoordZ,
+                                   &pixelCoordS,
+                                   microTileType,
+                                   isDepthSampleOrder);
+
+    //
+    // Assemble final coordinates.
+    //
+    *pX     = microTileCoordX + pixelCoordX;
+    *pY     = microTileCoordY + pixelCoordY;
+    *pSlice = (sliceIndex * microTileThickness) + pixelCoordZ;
+    *pSample = pixelCoordS;
+
+    if (microTileThickness > 1)
+    {
+        *pSample = 0;
+    }
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputePipeFromAddr
+*
+*   @brief
+*       Compute the pipe number from an address
+*
+*   @return
+*       Pipe number
+*
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputePipeFromAddr(
+    UINT_64 addr,        ///< [in] address
+    UINT_32 numPipes     ///< [in] number of banks
+    ) const
+{
+    UINT_32 pipe;
+
+    UINT_32 groupBytes = m_pipeInterleaveBytes; //just different terms
+
+    // R600
+    // The LSBs of the address are arranged as follows:
+    //   bank | pipe | group
+    //
+    // To get the pipe number, shift off the group bits and mask the pipe bits.
+    //
+
+    // R800
+    // The LSBs of the address are arranged as follows:
+    //   bank | bankInterleave | pipe | pipeInterleave
+    //
+    // To get the pipe number, shift off the pipe interleave bits and mask the pipe bits.
+    //
+
+    pipe = static_cast<UINT_32>(addr >> Log2(groupBytes)) & (numPipes - 1);
+
+    return pipe;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeMicroTileEquation
+*
+*   @brief
+*       Compute micro tile equation
+*
+*   @return
+*       If equation can be computed
+*
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeMicroTileEquation(
+    UINT_32         log2BytesPP,    ///< [in] log2 of bytes per pixel
+    AddrTileMode    tileMode,       ///< [in] tile mode
+    AddrTileType    microTileType,  ///< [in] pixel order in display/non-display mode
+    ADDR_EQUATION*  pEquation       ///< [out] equation
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    for (UINT_32 i = 0; i < log2BytesPP; i++)
+    {
+        pEquation->addr[i].valid = 1;
+        pEquation->addr[i].channel = 0;
+        pEquation->addr[i].index = i;
+    }
+
+    ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[log2BytesPP];
+
+    ADDR_CHANNEL_SETTING x0 = InitChannel(1, 0, log2BytesPP + 0);
+    ADDR_CHANNEL_SETTING x1 = InitChannel(1, 0, log2BytesPP + 1);
+    ADDR_CHANNEL_SETTING x2 = InitChannel(1, 0, log2BytesPP + 2);
+    ADDR_CHANNEL_SETTING y0 = InitChannel(1, 1, 0);
+    ADDR_CHANNEL_SETTING y1 = InitChannel(1, 1, 1);
+    ADDR_CHANNEL_SETTING y2 = InitChannel(1, 1, 2);
+    ADDR_CHANNEL_SETTING z0 = InitChannel(1, 2, 0);
+    ADDR_CHANNEL_SETTING z1 = InitChannel(1, 2, 1);
+    ADDR_CHANNEL_SETTING z2 = InitChannel(1, 2, 2);
+
+    UINT_32 thickness = Thickness(tileMode);
+    UINT_32 bpp = 1 << (log2BytesPP + 3);
+
+    if (microTileType != ADDR_THICK)
+    {
+        if (microTileType == ADDR_DISPLAYABLE)
+        {
+            switch (bpp)
+            {
+                case 8:
+                    pixelBit[0] = x0;
+                    pixelBit[1] = x1;
+                    pixelBit[2] = x2;
+                    pixelBit[3] = y1;
+                    pixelBit[4] = y0;
+                    pixelBit[5] = y2;
+                    break;
+                case 16:
+                    pixelBit[0] = x0;
+                    pixelBit[1] = x1;
+                    pixelBit[2] = x2;
+                    pixelBit[3] = y0;
+                    pixelBit[4] = y1;
+                    pixelBit[5] = y2;
+                    break;
+                case 32:
+                    pixelBit[0] = x0;
+                    pixelBit[1] = x1;
+                    pixelBit[2] = y0;
+                    pixelBit[3] = x2;
+                    pixelBit[4] = y1;
+                    pixelBit[5] = y2;
+                    break;
+                case 64:
+                    pixelBit[0] = x0;
+                    pixelBit[1] = y0;
+                    pixelBit[2] = x1;
+                    pixelBit[3] = x2;
+                    pixelBit[4] = y1;
+                    pixelBit[5] = y2;
+                    break;
+                case 128:
+                    pixelBit[0] = y0;
+                    pixelBit[1] = x0;
+                    pixelBit[2] = x1;
+                    pixelBit[3] = x2;
+                    pixelBit[4] = y1;
+                    pixelBit[5] = y2;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    break;
+            }
+        }
+        else if (microTileType == ADDR_NON_DISPLAYABLE || microTileType == ADDR_DEPTH_SAMPLE_ORDER)
+        {
+            pixelBit[0] = x0;
+            pixelBit[1] = y0;
+            pixelBit[2] = x1;
+            pixelBit[3] = y1;
+            pixelBit[4] = x2;
+            pixelBit[5] = y2;
+        }
+        else if (microTileType == ADDR_ROTATED)
+        {
+            ADDR_ASSERT(thickness == 1);
+
+            switch (bpp)
+            {
+                case 8:
+                    pixelBit[0] = y0;
+                    pixelBit[1] = y1;
+                    pixelBit[2] = y2;
+                    pixelBit[3] = x1;
+                    pixelBit[4] = x0;
+                    pixelBit[5] = x2;
+                    break;
+                case 16:
+                    pixelBit[0] = y0;
+                    pixelBit[1] = y1;
+                    pixelBit[2] = y2;
+                    pixelBit[3] = x0;
+                    pixelBit[4] = x1;
+                    pixelBit[5] = x2;
+                    break;
+                case 32:
+                    pixelBit[0] = y0;
+                    pixelBit[1] = y1;
+                    pixelBit[2] = x0;
+                    pixelBit[3] = y2;
+                    pixelBit[4] = x1;
+                    pixelBit[5] = x2;
+                    break;
+                case 64:
+                    pixelBit[0] = y0;
+                    pixelBit[1] = x0;
+                    pixelBit[2] = y1;
+                    pixelBit[3] = x1;
+                    pixelBit[4] = x2;
+                    pixelBit[5] = y2;
+                    break;
+                default:
+                    retCode = ADDR_NOTSUPPORTED;
+                    break;
+            }
+        }
+
+        if (thickness > 1)
+        {
+            pixelBit[6] = z0;
+            pixelBit[7] = z1;
+            pEquation->numBits = 8 + log2BytesPP;
+        }
+        else
+        {
+            pEquation->numBits = 6 + log2BytesPP;
+        }
+    }
+    else // ADDR_THICK
+    {
+        ADDR_ASSERT(thickness > 1);
+
+        switch (bpp)
+        {
+            case 8:
+            case 16:
+                pixelBit[0] = x0;
+                pixelBit[1] = y0;
+                pixelBit[2] = x1;
+                pixelBit[3] = y1;
+                pixelBit[4] = z0;
+                pixelBit[5] = z1;
+                break;
+            case 32:
+                pixelBit[0] = x0;
+                pixelBit[1] = y0;
+                pixelBit[2] = x1;
+                pixelBit[3] = z0;
+                pixelBit[4] = y1;
+                pixelBit[5] = z1;
+                break;
+            case 64:
+            case 128:
+                pixelBit[0] = x0;
+                pixelBit[1] = y0;
+                pixelBit[2] = z0;
+                pixelBit[3] = x1;
+                pixelBit[4] = y1;
+                pixelBit[5] = z1;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        pixelBit[6] = x2;
+        pixelBit[7] = y2;
+        pEquation->numBits = 8 + log2BytesPP;
+    }
+
+    if (thickness == 8)
+    {
+        pixelBit[8] = z2;
+        pEquation->numBits = 9 + log2BytesPP;
+    }
+
+    // stackedDepthSlices is used for addressing mode that a tile block contains multiple slices,
+    // which is not supported by our address lib
+    pEquation->stackedDepthSlices = FALSE;
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputePixelIndexWithinMicroTile
+*
+*   @brief
+*       Compute the pixel index inside a micro tile of surface
+*
+*   @return
+*       Pixel index
+*
+****************************************************************************************************
+*/
+UINT_32 Lib::ComputePixelIndexWithinMicroTile(
+    UINT_32         x,              ///< [in] x coord
+    UINT_32         y,              ///< [in] y coord
+    UINT_32         z,              ///< [in] slice/depth index
+    UINT_32         bpp,            ///< [in] bits per pixel
+    AddrTileMode    tileMode,       ///< [in] tile mode
+    AddrTileType    microTileType   ///< [in] pixel order in display/non-display mode
+    ) const
+{
+    UINT_32 pixelBit0 = 0;
+    UINT_32 pixelBit1 = 0;
+    UINT_32 pixelBit2 = 0;
+    UINT_32 pixelBit3 = 0;
+    UINT_32 pixelBit4 = 0;
+    UINT_32 pixelBit5 = 0;
+    UINT_32 pixelBit6 = 0;
+    UINT_32 pixelBit7 = 0;
+    UINT_32 pixelBit8 = 0;
+    UINT_32 pixelNumber;
+
+    UINT_32 x0 = _BIT(x, 0);
+    UINT_32 x1 = _BIT(x, 1);
+    UINT_32 x2 = _BIT(x, 2);
+    UINT_32 y0 = _BIT(y, 0);
+    UINT_32 y1 = _BIT(y, 1);
+    UINT_32 y2 = _BIT(y, 2);
+    UINT_32 z0 = _BIT(z, 0);
+    UINT_32 z1 = _BIT(z, 1);
+    UINT_32 z2 = _BIT(z, 2);
+
+    UINT_32 thickness = Thickness(tileMode);
+
+    // Compute the pixel number within the micro tile.
+
+    if (microTileType != ADDR_THICK)
+    {
+        if (microTileType == ADDR_DISPLAYABLE)
+        {
+            switch (bpp)
+            {
+                case 8:
+                    pixelBit0 = x0;
+                    pixelBit1 = x1;
+                    pixelBit2 = x2;
+                    pixelBit3 = y1;
+                    pixelBit4 = y0;
+                    pixelBit5 = y2;
+                    break;
+                case 16:
+                    pixelBit0 = x0;
+                    pixelBit1 = x1;
+                    pixelBit2 = x2;
+                    pixelBit3 = y0;
+                    pixelBit4 = y1;
+                    pixelBit5 = y2;
+                    break;
+                case 32:
+                    pixelBit0 = x0;
+                    pixelBit1 = x1;
+                    pixelBit2 = y0;
+                    pixelBit3 = x2;
+                    pixelBit4 = y1;
+                    pixelBit5 = y2;
+                    break;
+                case 64:
+                    pixelBit0 = x0;
+                    pixelBit1 = y0;
+                    pixelBit2 = x1;
+                    pixelBit3 = x2;
+                    pixelBit4 = y1;
+                    pixelBit5 = y2;
+                    break;
+                case 128:
+                    pixelBit0 = y0;
+                    pixelBit1 = x0;
+                    pixelBit2 = x1;
+                    pixelBit3 = x2;
+                    pixelBit4 = y1;
+                    pixelBit5 = y2;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    break;
+            }
+        }
+        else if (microTileType == ADDR_NON_DISPLAYABLE || microTileType == ADDR_DEPTH_SAMPLE_ORDER)
+        {
+            pixelBit0 = x0;
+            pixelBit1 = y0;
+            pixelBit2 = x1;
+            pixelBit3 = y1;
+            pixelBit4 = x2;
+            pixelBit5 = y2;
+        }
+        else if (microTileType == ADDR_ROTATED)
+        {
+            ADDR_ASSERT(thickness == 1);
+
+            switch (bpp)
+            {
+                case 8:
+                    pixelBit0 = y0;
+                    pixelBit1 = y1;
+                    pixelBit2 = y2;
+                    pixelBit3 = x1;
+                    pixelBit4 = x0;
+                    pixelBit5 = x2;
+                    break;
+                case 16:
+                    pixelBit0 = y0;
+                    pixelBit1 = y1;
+                    pixelBit2 = y2;
+                    pixelBit3 = x0;
+                    pixelBit4 = x1;
+                    pixelBit5 = x2;
+                    break;
+                case 32:
+                    pixelBit0 = y0;
+                    pixelBit1 = y1;
+                    pixelBit2 = x0;
+                    pixelBit3 = y2;
+                    pixelBit4 = x1;
+                    pixelBit5 = x2;
+                    break;
+                case 64:
+                    pixelBit0 = y0;
+                    pixelBit1 = x0;
+                    pixelBit2 = y1;
+                    pixelBit3 = x1;
+                    pixelBit4 = x2;
+                    pixelBit5 = y2;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    break;
+            }
+        }
+
+        if (thickness > 1)
+        {
+            pixelBit6 = z0;
+            pixelBit7 = z1;
+        }
+    }
+    else // ADDR_THICK
+    {
+        ADDR_ASSERT(thickness > 1);
+
+        switch (bpp)
+        {
+            case 8:
+            case 16:
+                pixelBit0 = x0;
+                pixelBit1 = y0;
+                pixelBit2 = x1;
+                pixelBit3 = y1;
+                pixelBit4 = z0;
+                pixelBit5 = z1;
+                break;
+            case 32:
+                pixelBit0 = x0;
+                pixelBit1 = y0;
+                pixelBit2 = x1;
+                pixelBit3 = z0;
+                pixelBit4 = y1;
+                pixelBit5 = z1;
+                break;
+            case 64:
+            case 128:
+                pixelBit0 = x0;
+                pixelBit1 = y0;
+                pixelBit2 = z0;
+                pixelBit3 = x1;
+                pixelBit4 = y1;
+                pixelBit5 = z1;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        pixelBit6 = x2;
+        pixelBit7 = y2;
+    }
+
+    if (thickness == 8)
+    {
+        pixelBit8 = z2;
+    }
+
+    pixelNumber = ((pixelBit0     ) |
+                   (pixelBit1 << 1) |
+                   (pixelBit2 << 2) |
+                   (pixelBit3 << 3) |
+                   (pixelBit4 << 4) |
+                   (pixelBit5 << 5) |
+                   (pixelBit6 << 6) |
+                   (pixelBit7 << 7) |
+                   (pixelBit8 << 8));
+
+    return pixelNumber;
+}
+
+/**
+****************************************************************************************************
+*   Lib::AdjustPitchAlignment
+*
+*   @brief
+*       Adjusts pitch alignment for flipping surface
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID Lib::AdjustPitchAlignment(
+    ADDR_SURFACE_FLAGS  flags,      ///< [in] Surface flags
+    UINT_32*            pPitchAlign ///< [out] Pointer to pitch alignment
+    ) const
+{
+    // Display engine hardwires lower 5 bit of GRPH_PITCH to ZERO which means 32 pixel alignment
+    // Maybe it will be fixed in future but let's make it general for now.
+    if (flags.display || flags.overlay)
+    {
+        *pPitchAlign = PowTwoAlign(*pPitchAlign, 32);
+
+        if(flags.display)
+        {
+            *pPitchAlign = Max(m_minPitchAlignPixels, *pPitchAlign);
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   Lib::PadDimensions
+*
+*   @brief
+*       Helper function to pad dimensions
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID Lib::PadDimensions(
+    AddrTileMode        tileMode,    ///< [in] tile mode
+    UINT_32             bpp,         ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,       ///< [in] surface flags
+    UINT_32             numSamples,  ///< [in] number of samples
+    ADDR_TILEINFO*      pTileInfo,   ///< [in,out] bank structure.
+    UINT_32             padDims,     ///< [in] Dimensions to pad valid value 1,2,3
+    UINT_32             mipLevel,    ///< [in] MipLevel
+    UINT_32*            pPitch,      ///< [in,out] pitch in pixels
+    UINT_32*            pPitchAlign, ///< [in,out] pitch align could be changed in HwlPadDimensions
+    UINT_32*            pHeight,     ///< [in,out] height in pixels
+    UINT_32             heightAlign, ///< [in] height alignment
+    UINT_32*            pSlices,     ///< [in,out] number of slices
+    UINT_32             sliceAlign   ///< [in] number of slice alignment
+    ) const
+{
+    UINT_32 pitchAlign = *pPitchAlign;
+    UINT_32 thickness = Thickness(tileMode);
+
+    ADDR_ASSERT(padDims <= 3);
+
+    //
+    // Override padding for mip levels
+    //
+    if (mipLevel > 0)
+    {
+        if (flags.cube)
+        {
+            // for cubemap, we only pad when client call with 6 faces as an identity
+            if (*pSlices > 1)
+            {
+                padDims = 3; // we should pad cubemap sub levels when we treat it as 3d texture
+            }
+            else
+            {
+                padDims = 2;
+            }
+        }
+    }
+
+    // Any possibilities that padDims is 0?
+    if (padDims == 0)
+    {
+        padDims = 3;
+    }
+
+    if (IsPow2(pitchAlign))
+    {
+        *pPitch = PowTwoAlign((*pPitch), pitchAlign);
+    }
+    else // add this code to pass unit test, r600 linear mode is not align bpp to pow2 for linear
+    {
+        *pPitch += pitchAlign - 1;
+        *pPitch /= pitchAlign;
+        *pPitch *= pitchAlign;
+    }
+
+    if (padDims > 1)
+    {
+        if (IsPow2(heightAlign))
+        {
+            *pHeight = PowTwoAlign((*pHeight), heightAlign);
+        }
+        else
+        {
+            *pHeight += heightAlign - 1;
+            *pHeight /= heightAlign;
+            *pHeight *= heightAlign;
+        }
+    }
+
+    if (padDims > 2 || thickness > 1)
+    {
+        // for cubemap single face, we do not pad slices.
+        // if we pad it, the slice number should be set to 6 and current mip level > 1
+        if (flags.cube && (!m_configFlags.noCubeMipSlicesPad || flags.cubeAsArray))
+        {
+            *pSlices = NextPow2(*pSlices);
+        }
+
+        // normal 3D texture or arrays or cubemap has a thick mode? (Just pass unit test)
+        if (thickness > 1)
+        {
+            *pSlices = PowTwoAlign((*pSlices), sliceAlign);
+        }
+
+    }
+
+    HwlPadDimensions(tileMode,
+                     bpp,
+                     flags,
+                     numSamples,
+                     pTileInfo,
+                     mipLevel,
+                     pPitch,
+                     pPitchAlign,
+                     *pHeight,
+                     heightAlign);
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlPreHandleBaseLvl3xPitch
+*
+*   @brief
+*       Pre-handler of 3x pitch (96 bit) adjustment
+*
+*   @return
+*       Expected pitch
+****************************************************************************************************
+*/
+UINT_32 Lib::HwlPreHandleBaseLvl3xPitch(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
+    UINT_32                                 expPitch    ///< [in] pitch
+    ) const
+{
+    ADDR_ASSERT(pIn->width == expPitch);
+    //
+    // If pitch is pre-multiplied by 3, we retrieve original one here to get correct miplevel size
+    //
+    if (ElemLib::IsExpand3x(pIn->format) &&
+        pIn->mipLevel == 0 &&
+        pIn->tileMode == ADDR_TM_LINEAR_ALIGNED)
+    {
+        expPitch /= 3;
+        expPitch = NextPow2(expPitch);
+    }
+
+    return expPitch;
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlPostHandleBaseLvl3xPitch
+*
+*   @brief
+*       Post-handler of 3x pitch adjustment
+*
+*   @return
+*       Expected pitch
+****************************************************************************************************
+*/
+UINT_32 Lib::HwlPostHandleBaseLvl3xPitch(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
+    UINT_32                                 expPitch    ///< [in] pitch
+    ) const
+{
+    //
+    // 96 bits surface of sub levels require element pitch of 32 bits instead
+    // So we just return pitch in 32 bit pixels without timing 3
+    //
+    if (ElemLib::IsExpand3x(pIn->format) &&
+        pIn->mipLevel == 0 &&
+        pIn->tileMode == ADDR_TM_LINEAR_ALIGNED)
+    {
+        expPitch *= 3;
+    }
+
+    return expPitch;
+}
+
+/**
+****************************************************************************************************
+*   Lib::IsMacroTiled
+*
+*   @brief
+*       Check if the tile mode is macro tiled
+*
+*   @return
+*       TRUE if it is macro tiled (2D/2B/3D/3B)
+****************************************************************************************************
+*/
+BOOL_32 Lib::IsMacroTiled(
+    AddrTileMode tileMode)  ///< [in] tile mode
+{
+   return ModeFlags[tileMode].isMacro;
+}
+
+/**
+****************************************************************************************************
+*   Lib::IsMacro3dTiled
+*
+*   @brief
+*       Check if the tile mode is 3D macro tiled
+*
+*   @return
+*       TRUE if it is 3D macro tiled
+****************************************************************************************************
+*/
+BOOL_32 Lib::IsMacro3dTiled(
+    AddrTileMode tileMode)  ///< [in] tile mode
+{
+    return ModeFlags[tileMode].isMacro3d;
+}
+
+/**
+****************************************************************************************************
+*   Lib::IsMicroTiled
+*
+*   @brief
+*       Check if the tile mode is micro tiled
+*
+*   @return
+*       TRUE if micro tiled
+****************************************************************************************************
+*/
+BOOL_32 Lib::IsMicroTiled(
+    AddrTileMode tileMode)  ///< [in] tile mode
+{
+    return ModeFlags[tileMode].isMicro;
+}
+
+/**
+****************************************************************************************************
+*   Lib::IsLinear
+*
+*   @brief
+*       Check if the tile mode is linear
+*
+*   @return
+*       TRUE if linear
+****************************************************************************************************
+*/
+BOOL_32 Lib::IsLinear(
+    AddrTileMode tileMode)  ///< [in] tile mode
+{
+    return ModeFlags[tileMode].isLinear;
+}
+
+/**
+****************************************************************************************************
+*   Lib::IsPrtNoRotationTileMode
+*
+*   @brief
+*       Return TRUE if it is prt tile without rotation
+*   @note
+*       This function just used by CI
+****************************************************************************************************
+*/
+BOOL_32 Lib::IsPrtNoRotationTileMode(
+    AddrTileMode tileMode)
+{
+    return ModeFlags[tileMode].isPrtNoRotation;
+}
+
+/**
+****************************************************************************************************
+*   Lib::IsPrtTileMode
+*
+*   @brief
+*       Return TRUE if it is prt tile
+*   @note
+*       This function just used by CI
+****************************************************************************************************
+*/
+BOOL_32 Lib::IsPrtTileMode(
+    AddrTileMode tileMode)
+{
+    return ModeFlags[tileMode].isPrt;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeMipLevel
+*
+*   @brief
+*       Compute mipmap level width/height/slices
+*   @return
+*      N/A
+****************************************************************************************************
+*/
+VOID Lib::ComputeMipLevel(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn ///< [in,out] Input structure
+    ) const
+{
+    // Check if HWL has handled
+    BOOL_32 hwlHandled = FALSE;
+    (void)hwlHandled;
+
+    if (ElemLib::IsBlockCompressed(pIn->format))
+    {
+        if (pIn->mipLevel == 0)
+        {
+            // DXTn's level 0 must be multiple of 4
+            // But there are exceptions:
+            // 1. Internal surface creation in hostblt/vsblt/etc...
+            // 2. Runtime doesn't reject ATI1/ATI2 whose width/height are not multiple of 4
+            pIn->width = PowTwoAlign(pIn->width, 4);
+            pIn->height = PowTwoAlign(pIn->height, 4);
+        }
+    }
+
+    hwlHandled = HwlComputeMipLevel(pIn);
+}
+
+/**
+****************************************************************************************************
+*   Lib::DegradeTo1D
+*
+*   @brief
+*       Check if surface can be degraded to 1D
+*   @return
+*       TRUE if degraded
+****************************************************************************************************
+*/
+BOOL_32 Lib::DegradeTo1D(
+    UINT_32 width,                  ///< surface width
+    UINT_32 height,                 ///< surface height
+    UINT_32 macroTilePitchAlign,    ///< macro tile pitch align
+    UINT_32 macroTileHeightAlign    ///< macro tile height align
+    )
+{
+    BOOL_32 degrade = ((width < macroTilePitchAlign) || (height < macroTileHeightAlign));
+
+    // Check whether 2D tiling still has too much footprint
+    if (degrade == FALSE)
+    {
+        // Only check width and height as slices are aligned to thickness
+        UINT_64 unalignedSize = width * height;
+
+        UINT_32 alignedPitch = PowTwoAlign(width, macroTilePitchAlign);
+        UINT_32 alignedHeight = PowTwoAlign(height, macroTileHeightAlign);
+        UINT_64 alignedSize = alignedPitch * alignedHeight;
+
+        // alignedSize > 1.5 * unalignedSize
+        if (2 * alignedSize > 3 * unalignedSize)
+        {
+            degrade = TRUE;
+        }
+    }
+
+    return degrade;
+}
+
+/**
+****************************************************************************************************
+*   Lib::OptimizeTileMode
+*
+*   @brief
+*       Check if base level's tile mode can be optimized (degraded)
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID Lib::OptimizeTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*  pInOut     ///< [in, out] structure for surface info
+    ) const
+{
+    AddrTileMode tileMode = pInOut->tileMode;
+
+    BOOL_32 doOpt = (pInOut->flags.opt4Space == TRUE) ||
+                    (pInOut->flags.minimizeAlignment == TRUE) ||
+                    (pInOut->maxBaseAlign != 0);
+
+    BOOL_32 convertToPrt = FALSE;
+
+    // Optimization can only be done on level 0 and samples <= 1
+    if ((doOpt == TRUE)                     &&
+        (pInOut->mipLevel == 0)             &&
+        (IsPrtTileMode(tileMode) == FALSE)  &&
+        (pInOut->flags.prt == FALSE))
+    {
+        UINT_32 width = pInOut->width;
+        UINT_32 height = pInOut->height;
+        UINT_32 thickness = Thickness(tileMode);
+        BOOL_32 macroTiledOK = TRUE;
+        UINT_32 macroWidthAlign = 0;
+        UINT_32 macroHeightAlign = 0;
+        UINT_32 macroSizeAlign = 0;
+
+        if (IsMacroTiled(tileMode))
+        {
+            macroTiledOK = HwlGetAlignmentInfoMacroTiled(pInOut,
+                                                         &macroWidthAlign,
+                                                         &macroHeightAlign,
+                                                         &macroSizeAlign);
+        }
+
+        if (macroTiledOK)
+        {
+            if ((pInOut->flags.display == FALSE) &&
+                (pInOut->flags.opt4Space == TRUE) &&
+                (pInOut->numSamples <= 1))
+            {
+                // Check if linear mode is optimal
+                if ((pInOut->height == 1) &&
+                    (IsLinear(tileMode) == FALSE) &&
+                    (ElemLib::IsBlockCompressed(pInOut->format) == FALSE) &&
+                    (pInOut->flags.depth == FALSE) &&
+                    (pInOut->flags.stencil == FALSE) &&
+                    (m_configFlags.disableLinearOpt == FALSE) &&
+                    (pInOut->flags.disableLinearOpt == FALSE))
+                {
+                    tileMode = ADDR_TM_LINEAR_ALIGNED;
+                }
+                else if (IsMacroTiled(tileMode) && (pInOut->flags.tcCompatible == FALSE))
+                {
+                    if (DegradeTo1D(width, height, macroWidthAlign, macroHeightAlign))
+                    {
+                        tileMode = (thickness == 1) ?
+                                   ADDR_TM_1D_TILED_THIN1 : ADDR_TM_1D_TILED_THICK;
+                    }
+                    else if ((thickness > 1) && (pInOut->flags.disallowLargeThickDegrade == 0))
+                    {
+                        // As in the following HwlComputeSurfaceInfo, thick modes may be degraded to
+                        // thinner modes, we should re-evaluate whether the corresponding
+                        // thinner modes should be degraded. If so, we choose 1D thick mode instead.
+                        tileMode = DegradeLargeThickTile(pInOut->tileMode, pInOut->bpp);
+
+                        if (tileMode != pInOut->tileMode)
+                        {
+                            // Get thickness again after large thick degrade
+                            thickness = Thickness(tileMode);
+
+                            ADDR_COMPUTE_SURFACE_INFO_INPUT input = *pInOut;
+                            input.tileMode = tileMode;
+
+                            macroTiledOK = HwlGetAlignmentInfoMacroTiled(&input,
+                                                                         &macroWidthAlign,
+                                                                         &macroHeightAlign,
+                                                                         &macroSizeAlign);
+
+                            if (macroTiledOK &&
+                                DegradeTo1D(width, height, macroWidthAlign, macroHeightAlign))
+                            {
+                                tileMode = ADDR_TM_1D_TILED_THICK;
+                            }
+                        }
+                    }
+                }
+            }
+
+            if (macroTiledOK)
+            {
+                if ((pInOut->flags.minimizeAlignment == TRUE) &&
+                    (pInOut->numSamples <= 1) &&
+                    (IsMacroTiled(tileMode) == TRUE))
+                {
+                    UINT_32 macroSize = PowTwoAlign(width, macroWidthAlign) *
+                                        PowTwoAlign(height, macroHeightAlign);
+                    UINT_32 microSize = PowTwoAlign(width, MicroTileWidth) *
+                                        PowTwoAlign(height, MicroTileHeight);
+
+                    if (macroSize > microSize)
+                    {
+                        tileMode = (thickness == 1) ?
+                                   ADDR_TM_1D_TILED_THIN1 : ADDR_TM_1D_TILED_THICK;
+                    }
+                }
+
+                if ((pInOut->maxBaseAlign != 0) &&
+                    (IsMacroTiled(tileMode) == TRUE))
+                {
+                    if (macroSizeAlign > pInOut->maxBaseAlign)
+                    {
+                        if (pInOut->numSamples > 1)
+                        {
+                            ADDR_ASSERT(pInOut->maxBaseAlign >= Block64K);
+
+                            convertToPrt = TRUE;
+                        }
+                        else if (pInOut->maxBaseAlign < Block64K)
+                        {
+                            tileMode = (thickness == 1) ?
+                                       ADDR_TM_1D_TILED_THIN1 : ADDR_TM_1D_TILED_THICK;
+                        }
+                        else
+                        {
+                            convertToPrt = TRUE;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    if (convertToPrt)
+    {
+        if ((pInOut->flags.matchStencilTileCfg == TRUE) && (pInOut->numSamples <= 1))
+        {
+            pInOut->tileMode = ADDR_TM_1D_TILED_THIN1;
+        }
+        else
+        {
+            HwlSetPrtTileMode(pInOut);
+        }
+    }
+    else if (tileMode != pInOut->tileMode)
+    {
+        pInOut->tileMode = tileMode;
+    }
+
+    HwlOptimizeTileMode(pInOut);
+}
+
+/**
+****************************************************************************************************
+*   Lib::DegradeLargeThickTile
+*
+*   @brief
+*       Check if the thickness needs to be reduced if a tile is too large
+*   @return
+*       The degraded tile mode (unchanged if not degraded)
+****************************************************************************************************
+*/
+AddrTileMode Lib::DegradeLargeThickTile(
+    AddrTileMode tileMode,
+    UINT_32 bpp) const
+{
+    // Override tilemode
+    // When tile_width (8) * tile_height (8) * thickness * element_bytes is > row_size,
+    // it is better to just use THIN mode in this case
+    UINT_32 thickness = Thickness(tileMode);
+
+    if (thickness > 1 && m_configFlags.allowLargeThickTile == 0)
+    {
+        UINT_32 tileSize = MicroTilePixels * thickness * (bpp >> 3);
+
+        if (tileSize > m_rowSize)
+        {
+            switch (tileMode)
+            {
+                case ADDR_TM_2D_TILED_XTHICK:
+                    if ((tileSize >> 1) <= m_rowSize)
+                    {
+                        tileMode = ADDR_TM_2D_TILED_THICK;
+                        break;
+                    }
+                    // else fall through
+                case ADDR_TM_2D_TILED_THICK:
+                    tileMode    = ADDR_TM_2D_TILED_THIN1;
+                    break;
+
+                case ADDR_TM_3D_TILED_XTHICK:
+                    if ((tileSize >> 1) <= m_rowSize)
+                    {
+                        tileMode = ADDR_TM_3D_TILED_THICK;
+                        break;
+                    }
+                    // else fall through
+                case ADDR_TM_3D_TILED_THICK:
+                    tileMode    = ADDR_TM_3D_TILED_THIN1;
+                    break;
+
+                case ADDR_TM_PRT_TILED_THICK:
+                    tileMode    = ADDR_TM_PRT_TILED_THIN1;
+                    break;
+
+                case ADDR_TM_PRT_2D_TILED_THICK:
+                    tileMode    = ADDR_TM_PRT_2D_TILED_THIN1;
+                    break;
+
+                case ADDR_TM_PRT_3D_TILED_THICK:
+                    tileMode    = ADDR_TM_PRT_3D_TILED_THIN1;
+                    break;
+
+                default:
+                    break;
+            }
+        }
+    }
+
+    return tileMode;
+}
+
+/**
+****************************************************************************************************
+*   Lib::PostComputeMipLevel
+*   @brief
+*       Compute MipLevel info (including level 0) after surface adjustment
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::PostComputeMipLevel(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pIn,   ///< [in,out] Input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*   pOut   ///< [out] Output structure
+    ) const
+{
+    // Mipmap including level 0 must be pow2 padded since either SI hw expects so or it is
+    // required by CFX  for Hw Compatibility between NI and SI. Otherwise it is only needed for
+    // mipLevel > 0. Any h/w has different requirement should implement its own virtual function
+
+    if (pIn->flags.pow2Pad)
+    {
+        pIn->width      = NextPow2(pIn->width);
+        pIn->height     = NextPow2(pIn->height);
+        pIn->numSlices  = NextPow2(pIn->numSlices);
+    }
+    else if (pIn->mipLevel > 0)
+    {
+        pIn->width      = NextPow2(pIn->width);
+        pIn->height     = NextPow2(pIn->height);
+
+        if (!pIn->flags.cube)
+        {
+            pIn->numSlices = NextPow2(pIn->numSlices);
+        }
+
+        // for cubemap, we keep its value at first
+    }
+
+    return ADDR_OK;
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlSetupTileCfg
+*
+*   @brief
+*       Map tile index to tile setting.
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::HwlSetupTileCfg(
+    UINT_32         bpp,              ///< Bits per pixel
+    INT_32          index,            ///< [in] Tile index
+    INT_32          macroModeIndex,   ///< [in] Index in macro tile mode table(CI)
+    ADDR_TILEINFO*  pInfo,            ///< [out] Tile Info
+    AddrTileMode*   pMode,            ///< [out] Tile mode
+    AddrTileType*   pType             ///< [out] Tile type
+    ) const
+{
+    return ADDR_NOTSUPPORTED;
+}
+
+/**
+****************************************************************************************************
+*   Lib::HwlGetPipes
+*
+*   @brief
+*       Get number pipes
+*   @return
+*       num pipes
+****************************************************************************************************
+*/
+UINT_32 Lib::HwlGetPipes(
+    const ADDR_TILEINFO* pTileInfo    ///< [in] Tile info
+    ) const
+{
+    //pTileInfo can be NULL when asic is 6xx and 8xx.
+    return m_pipes;
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputeQbStereoInfo
+*
+*   @brief
+*       Get quad buffer stereo information
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID Lib::ComputeQbStereoInfo(
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [in,out] updated pOut+pStereoInfo
+    ) const
+{
+    ADDR_ASSERT(pOut->bpp >= 8);
+    ADDR_ASSERT((pOut->surfSize % pOut->baseAlign) == 0);
+
+    // Save original height
+    pOut->pStereoInfo->eyeHeight = pOut->height;
+
+    // Right offset
+    pOut->pStereoInfo->rightOffset = static_cast<UINT_32>(pOut->surfSize);
+
+    pOut->pStereoInfo->rightSwizzle = HwlComputeQbStereoRightSwizzle(pOut);
+    // Double height
+    pOut->height <<= 1;
+    pOut->pixelHeight <<= 1;
+
+    // Double size
+    pOut->surfSize <<= 1;
+
+    // Right start address meets the base align since it is guaranteed by AddrLib1
+
+    // 1D surface on SI may break this rule, but we can force it to meet by checking .qbStereo.
+}
+
+/**
+****************************************************************************************************
+*   Lib::ComputePrtInfo
+*
+*   @brief
+*       Compute prt surface related info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputePrtInfo(
+    const ADDR_PRT_INFO_INPUT*  pIn,
+    ADDR_PRT_INFO_OUTPUT*       pOut) const
+{
+    ADDR_ASSERT(pOut != NULL);
+
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    UINT_32     expandX = 1;
+    UINT_32     expandY = 1;
+    ElemMode    elemMode;
+
+    UINT_32     bpp = GetElemLib()->GetBitsPerPixel(pIn->format,
+                                                    &elemMode,
+                                                    &expandX,
+                                                    &expandY);
+
+    if (bpp <8 || bpp == 24 || bpp == 48 || bpp == 96)
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    UINT_32     numFrags = pIn->numFrags;
+    ADDR_ASSERT(numFrags <= 8);
+
+    UINT_32     tileWidth = 0;
+    UINT_32     tileHeight = 0;
+    if (returnCode == ADDR_OK)
+    {
+        // 3D texture without depth or 2d texture
+        if (pIn->baseMipDepth > 1 || pIn->baseMipHeight > 1)
+        {
+            if (bpp == 8)
+            {
+                tileWidth = 256;
+                tileHeight = 256;
+            }
+            else if (bpp == 16)
+            {
+                tileWidth = 256;
+                tileHeight = 128;
+            }
+            else if (bpp == 32)
+            {
+                tileWidth = 128;
+                tileHeight = 128;
+            }
+            else if (bpp == 64)
+            {
+                // assume it is BC1/4
+                tileWidth = 512;
+                tileHeight = 256;
+
+                if (elemMode == ADDR_UNCOMPRESSED)
+                {
+                    tileWidth = 128;
+                    tileHeight = 64;
+                }
+            }
+            else if (bpp == 128)
+            {
+                // assume it is BC2/3/5/6H/7
+                tileWidth = 256;
+                tileHeight = 256;
+
+                if (elemMode == ADDR_UNCOMPRESSED)
+                {
+                    tileWidth = 64;
+                    tileHeight = 64;
+                }
+            }
+
+            if (numFrags == 2)
+            {
+                tileWidth = tileWidth / 2;
+            }
+            else if (numFrags == 4)
+            {
+                tileWidth = tileWidth / 2;
+                tileHeight = tileHeight / 2;
+            }
+            else if (numFrags == 8)
+            {
+                tileWidth = tileWidth / 4;
+                tileHeight = tileHeight / 2;
+            }
+        }
+        else    // 1d
+        {
+            tileHeight = 1;
+            if (bpp == 8)
+            {
+                tileWidth = 65536;
+            }
+            else if (bpp == 16)
+            {
+                tileWidth = 32768;
+            }
+            else if (bpp == 32)
+            {
+                tileWidth = 16384;
+            }
+            else if (bpp == 64)
+            {
+                tileWidth = 8192;
+            }
+            else if (bpp == 128)
+            {
+                tileWidth = 4096;
+            }
+        }
+    }
+
+    pOut->prtTileWidth = tileWidth;
+    pOut->prtTileHeight = tileHeight;
+
+    return returnCode;
+}
+
+} // V1
+} // Addr
diff --git a/src/amd/addrlib/src/core/addrlib1.h b/src/amd/addrlib/src/core/addrlib1.h
new file mode 100644 (file)
index 0000000..4933a53
--- /dev/null
@@ -0,0 +1,544 @@
+/*
+ * Copyright © 2007-2018 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  addrlib1.h
+* @brief Contains the Addr::V1::Lib class definition.
+****************************************************************************************************
+*/
+
+#ifndef __ADDR_LIB1_H__
+#define __ADDR_LIB1_H__
+
+#include "addrlib.h"
+
+namespace Addr
+{
+namespace V1
+{
+
+/**
+****************************************************************************************************
+* @brief Neutral enums that define bank swap size
+****************************************************************************************************
+*/
+enum SampleSplitSize
+{
+    ADDR_SAMPLESPLIT_1KB = 1024,
+    ADDR_SAMPLESPLIT_2KB = 2048,
+    ADDR_SAMPLESPLIT_4KB = 4096,
+    ADDR_SAMPLESPLIT_8KB = 8192,
+};
+
+/**
+****************************************************************************************************
+* @brief Flags for AddrTileMode
+****************************************************************************************************
+*/
+struct TileModeFlags
+{
+    UINT_32 thickness       : 4;
+    UINT_32 isLinear        : 1;
+    UINT_32 isMicro         : 1;
+    UINT_32 isMacro         : 1;
+    UINT_32 isMacro3d       : 1;
+    UINT_32 isPrt           : 1;
+    UINT_32 isPrtNoRotation : 1;
+    UINT_32 isBankSwapped   : 1;
+};
+
+static const UINT_32 Block64K = 0x10000;
+static const UINT_32 PrtTileSize = Block64K;
+
+/**
+****************************************************************************************************
+* @brief This class contains asic independent address lib functionalities
+****************************************************************************************************
+*/
+class Lib : public Addr::Lib
+{
+public:
+    virtual ~Lib();
+
+    static Lib* GetLib(
+        ADDR_HANDLE hLib);
+
+    /// Returns tileIndex support
+    BOOL_32 UseTileIndex(INT_32 index) const
+    {
+        return m_configFlags.useTileIndex && (index != TileIndexInvalid);
+    }
+
+    /// Returns combined swizzle support
+    BOOL_32 UseCombinedSwizzle() const
+    {
+        return m_configFlags.useCombinedSwizzle;
+    }
+
+    //
+    // Interface stubs
+    //
+    ADDR_E_RETURNCODE ComputeSurfaceInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoord(
+        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddr(
+        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT*  pIn,
+        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeSliceTileSwizzle(
+        const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,
+        ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ExtractBankPipeSwizzle(
+        const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
+        ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE CombineBankPipeSwizzle(
+        const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT*  pIn,
+        ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeBaseSwizzle(
+        const ADDR_COMPUTE_BASE_SWIZZLE_INPUT*  pIn,
+        ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeFmaskInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT*  pIn,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
+
+    ADDR_E_RETURNCODE ComputeFmaskAddrFromCoord(
+        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeFmaskCoordFromAddr(
+        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*  pIn,
+        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ConvertTileInfoToHW(
+        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
+        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ConvertTileIndex(
+        const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
+        ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE GetMacroModeIndex(
+        const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
+        ADDR_GET_MACROMODEINDEX_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ConvertTileIndex1(
+        const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,
+        ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE GetTileIndex(
+        const ADDR_GET_TILEINDEX_INPUT* pIn,
+        ADDR_GET_TILEINDEX_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeHtileInfo(
+        const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeCmaskInfo(
+        const ADDR_COMPUTE_CMASK_INFO_INPUT* pIn,
+        ADDR_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeDccInfo(
+        const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
+        ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeHtileAddrFromCoord(
+        const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeCmaskAddrFromCoord(
+        const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
+        const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT*  pIn,
+        ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputeCmaskCoordFromAddr(
+        const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT*  pIn,
+        ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE ComputePrtInfo(
+        const ADDR_PRT_INFO_INPUT*  pIn,
+        ADDR_PRT_INFO_OUTPUT*       pOut) const;
+protected:
+    Lib();  // Constructor is protected
+    Lib(const Client* pClient);
+
+    /// Pure Virtual function for Hwl computing surface info
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl computing surface address from coord
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoord(
+        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl computing surface coord from address
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceCoordFromAddr(
+        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl computing surface tile swizzle
+    virtual ADDR_E_RETURNCODE HwlComputeSliceTileSwizzle(
+        const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
+        ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl extracting bank/pipe swizzle from base256b
+    virtual ADDR_E_RETURNCODE HwlExtractBankPipeSwizzle(
+        const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
+        ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl combining bank/pipe swizzle
+    virtual ADDR_E_RETURNCODE HwlCombineBankPipeSwizzle(
+        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, ADDR_TILEINFO*  pTileInfo,
+        UINT_64 baseAddr, UINT_32* pTileSwizzle) const = 0;
+
+    /// Pure Virtual function for Hwl computing base swizzle
+    virtual ADDR_E_RETURNCODE HwlComputeBaseSwizzle(
+        const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
+        ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl computing HTILE base align
+    virtual UINT_32 HwlComputeHtileBaseAlign(
+        BOOL_32 isTcCompatible, BOOL_32 isLinear, ADDR_TILEINFO* pTileInfo) const = 0;
+
+    /// Pure Virtual function for Hwl computing HTILE bpp
+    virtual UINT_32 HwlComputeHtileBpp(
+        BOOL_32 isWidth8, BOOL_32 isHeight8) const = 0;
+
+    /// Pure Virtual function for Hwl computing HTILE bytes
+    virtual UINT_64 HwlComputeHtileBytes(
+        UINT_32 pitch, UINT_32 height, UINT_32 bpp,
+        BOOL_32 isLinear, UINT_32 numSlices, UINT_64* pSliceBytes, UINT_32 baseAlign) const = 0;
+
+    /// Pure Virtual function for Hwl computing FMASK info
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut) = 0;
+
+    /// Pure Virtual function for Hwl FMASK address from coord
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskAddrFromCoord(
+        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl FMASK coord from address
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskCoordFromAddr(
+        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl convert tile info from real value to HW value
+    virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
+        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
+        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const = 0;
+
+    /// Pure Virtual function for Hwl compute mipmap info
+    virtual BOOL_32 HwlComputeMipLevel(
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const = 0;
+
+    /// Pure Virtual function for Hwl compute max cmask blockMax value
+    virtual BOOL_32 HwlGetMaxCmaskBlockMax() const = 0;
+
+    /// Pure Virtual function for Hwl compute fmask bits
+    virtual UINT_32 HwlComputeFmaskBits(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+        UINT_32* pNumSamples) const = 0;
+
+    /// Virtual function to get index (not pure then no need to implement this in all hwls
+    virtual ADDR_E_RETURNCODE HwlGetTileIndex(
+        const ADDR_GET_TILEINDEX_INPUT* pIn,
+        ADDR_GET_TILEINDEX_OUTPUT*      pOut) const
+    {
+        return ADDR_NOTSUPPORTED;
+    }
+
+    /// Virtual function for Hwl to compute Dcc info
+    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
+        const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
+        ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const
+    {
+        return ADDR_NOTSUPPORTED;
+    }
+
+    /// Virtual function to get cmask address for tc compatible cmask
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
+        const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const
+    {
+        return ADDR_NOTSUPPORTED;
+    }
+
+    /// Virtual function to get htile address for tc compatible htile
+    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
+        const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const
+    {
+        return ADDR_NOTSUPPORTED;
+    }
+
+    // Compute attributes
+
+    // HTILE
+    UINT_32    ComputeHtileInfo(
+        ADDR_HTILE_FLAGS flags,
+        UINT_32 pitchIn, UINT_32 heightIn, UINT_32 numSlices,
+        BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
+        ADDR_TILEINFO*  pTileInfo,
+        UINT_32* pPitchOut, UINT_32* pHeightOut, UINT_64* pHtileBytes,
+        UINT_32* pMacroWidth = NULL, UINT_32* pMacroHeight = NULL,
+        UINT_64* pSliceSize = NULL, UINT_32* pBaseAlign = NULL) const;
+
+    // CMASK
+    ADDR_E_RETURNCODE ComputeCmaskInfo(
+        ADDR_CMASK_FLAGS flags,
+        UINT_32 pitchIn, UINT_32 heightIn, UINT_32 numSlices, BOOL_32 isLinear,
+        ADDR_TILEINFO* pTileInfo, UINT_32* pPitchOut, UINT_32* pHeightOut, UINT_64* pCmaskBytes,
+        UINT_32* pMacroWidth, UINT_32* pMacroHeight, UINT_64* pSliceSize = NULL,
+        UINT_32* pBaseAlign = NULL, UINT_32* pBlockMax = NULL) const;
+
+    virtual VOID HwlComputeTileDataWidthAndHeightLinear(
+        UINT_32* pMacroWidth, UINT_32* pMacroHeight,
+        UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
+
+    // CMASK & HTILE addressing
+    virtual UINT_64 HwlComputeXmaskAddrFromCoord(
+        UINT_32 pitch, UINT_32 height, UINT_32 x, UINT_32 y, UINT_32 slice,
+        UINT_32 numSlices, UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8,
+        BOOL_32 isHeight8, ADDR_TILEINFO* pTileInfo,
+        UINT_32* bitPosition) const;
+
+    virtual VOID HwlComputeXmaskCoordFromAddr(
+        UINT_64 addr, UINT_32 bitPosition, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
+        UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
+        ADDR_TILEINFO* pTileInfo, UINT_32* pX, UINT_32* pY, UINT_32* pSlice) const;
+
+    // Surface mipmap
+    VOID    ComputeMipLevel(
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
+
+    /// Pure Virtual function for Hwl to get macro tiled alignment info
+    virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const = 0;
+
+    virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+        // not supported in hwl layer
+    }
+
+    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+        // not supported in hwl layer
+    }
+
+    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+        // not supported in hwl layer
+    }
+
+    AddrTileMode DegradeLargeThickTile(AddrTileMode tileMode, UINT_32 bpp) const;
+
+    VOID PadDimensions(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 padDims, UINT_32 mipLevel,
+        UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32* pHeight, UINT_32 heightAlign,
+        UINT_32* pSlices, UINT_32 sliceAlign) const;
+
+    virtual VOID HwlPadDimensions(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
+        UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32 height, UINT_32 heightAlign) const
+    {
+    }
+
+    //
+    // Addressing shared for linear/1D tiling
+    //
+    UINT_64 ComputeSurfaceAddrFromCoordLinear(
+        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
+        UINT_32* pBitPosition) const;
+
+    VOID    ComputeSurfaceCoordFromAddrLinear(
+        UINT_64 addr, UINT_32 bitPosition, UINT_32 bpp,
+        UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample) const;
+
+    VOID    ComputeSurfaceCoordFromAddrMicroTiled(
+        UINT_64 addr, UINT_32 bitPosition,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
+        AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const;
+
+    ADDR_E_RETURNCODE ComputeMicroTileEquation(
+        UINT_32 bpp, AddrTileMode tileMode,
+        AddrTileType microTileType, ADDR_EQUATION* pEquation) const;
+
+    UINT_32 ComputePixelIndexWithinMicroTile(
+        UINT_32 x, UINT_32 y, UINT_32 z,
+        UINT_32 bpp, AddrTileMode tileMode, AddrTileType microTileType) const;
+
+    /// Pure Virtual function for Hwl computing coord from offset inside micro tile
+    virtual VOID HwlComputePixelCoordFromOffset(
+        UINT_32 offset, UINT_32 bpp, UINT_32 numSamples,
+        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
+        AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const = 0;
+
+    //
+    // Addressing shared by all
+    //
+    virtual UINT_32 HwlGetPipes(
+        const ADDR_TILEINFO* pTileInfo) const;
+
+    UINT_32 ComputePipeFromAddr(
+        UINT_64 addr, UINT_32 numPipes) const;
+
+    virtual ADDR_E_RETURNCODE ComputePipeEquation(
+        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY, ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const
+    {
+        return ADDR_NOTSUPPORTED;
+    }
+
+    /// Pure Virtual function for Hwl computing pipe from coord
+    virtual UINT_32 ComputePipeFromCoord(
+        UINT_32 x, UINT_32 y, UINT_32 slice, AddrTileMode tileMode,
+        UINT_32 pipeSwizzle, BOOL_32 flags, ADDR_TILEINFO* pTileInfo) const = 0;
+
+    /// Pure Virtual function for Hwl computing coord Y for 8 pipe cmask/htile
+    virtual UINT_32 HwlComputeXmaskCoordYFrom8Pipe(
+        UINT_32 pipe, UINT_32 x) const = 0;
+
+    //
+    // Misc helper
+    //
+    static const TileModeFlags ModeFlags[ADDR_TM_COUNT];
+
+    static UINT_32 Thickness(
+        AddrTileMode tileMode);
+
+    // Checking tile mode
+    static BOOL_32 IsMacroTiled(AddrTileMode tileMode);
+    static BOOL_32 IsMacro3dTiled(AddrTileMode tileMode);
+    static BOOL_32 IsLinear(AddrTileMode tileMode);
+    static BOOL_32 IsMicroTiled(AddrTileMode tileMode);
+    static BOOL_32 IsPrtTileMode(AddrTileMode tileMode);
+    static BOOL_32 IsPrtNoRotationTileMode(AddrTileMode tileMode);
+
+    /// Return TRUE if tile info is needed
+    BOOL_32 UseTileInfo() const
+    {
+        return !m_configFlags.ignoreTileInfo;
+    }
+
+    /// Adjusts pitch alignment for flipping surface
+    VOID    AdjustPitchAlignment(
+        ADDR_SURFACE_FLAGS flags, UINT_32* pPitchAlign) const;
+
+    /// Overwrite tile config according to tile index
+    virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
+        UINT_32 bpp, INT_32 index, INT_32 macroModeIndex,
+        ADDR_TILEINFO* pInfo, AddrTileMode* mode = NULL, AddrTileType* type = NULL) const;
+
+    /// Overwrite macro tile config according to tile index
+    virtual INT_32 HwlComputeMacroModeIndex(
+        INT_32 index, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
+        ADDR_TILEINFO* pTileInfo, AddrTileMode *pTileMode = NULL, AddrTileType *pTileType = NULL
+        ) const
+    {
+        return TileIndexNoMacroIndex;
+    }
+
+    /// Pre-handler of 3x pitch (96 bit) adjustment
+    virtual UINT_32 HwlPreHandleBaseLvl3xPitch(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
+    /// Post-handler of 3x pitch adjustment
+    virtual UINT_32 HwlPostHandleBaseLvl3xPitch(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
+    /// Check miplevel after surface adjustment
+    ADDR_E_RETURNCODE PostComputeMipLevel(
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    /// Quad buffer stereo support, has its implementation in ind. layer
+    VOID ComputeQbStereoInfo(
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    /// Pure virutual function to compute stereo bank swizzle for right eye
+    virtual UINT_32 HwlComputeQbStereoRightSwizzle(
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
+
+    VOID OptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    /// Overwrite tile setting to PRT
+    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+    }
+
+    static BOOL_32 DegradeTo1D(
+        UINT_32 width, UINT_32 height,
+        UINT_32 macroTilePitchAlign, UINT_32 macroTileHeightAlign);
+
+private:
+    // Disallow the copy constructor
+    Lib(const Lib& a);
+
+    // Disallow the assignment operator
+    Lib& operator=(const Lib& a);
+
+    UINT_32 ComputeCmaskBaseAlign(
+        ADDR_CMASK_FLAGS flags, ADDR_TILEINFO*  pTileInfo) const;
+
+    UINT_64 ComputeCmaskBytes(
+        UINT_32 pitch, UINT_32 height, UINT_32 numSlices) const;
+
+    //
+    // CMASK/HTILE shared methods
+    //
+    VOID    ComputeTileDataWidthAndHeight(
+        UINT_32 bpp, UINT_32 cacheBits, ADDR_TILEINFO* pTileInfo,
+        UINT_32* pMacroWidth, UINT_32* pMacroHeight) const;
+
+    UINT_32 ComputeXmaskCoordYFromPipe(
+        UINT_32 pipe, UINT_32 x) const;
+};
+
+} // V1
+} // Addr
+
+#endif
+
diff --git a/src/amd/addrlib/src/core/addrlib2.cpp b/src/amd/addrlib/src/core/addrlib2.cpp
new file mode 100644 (file)
index 0000000..3b4b8de
--- /dev/null
@@ -0,0 +1,1883 @@
+/*
+ * Copyright © 2007-2018 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 Dim2d Lib::Block256_2d[] = {{16, 16}, {16, 8}, {8, 8}, {8, 4}, {4, 4}};
+
+const Dim3d Lib::Block1K_3d[]  = {{16, 8, 8}, {8, 8, 8}, {8, 8, 4}, {8, 4, 4}, {4, 4, 4}};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               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+ ASIC 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(IsLinear(localIn.swizzleMode));
+            }
+
+            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.numMipLevels > 1) && (pOut->pMipInfo != NULL))
+                {
+                    for (UINT_32 i = 0; i < localIn.numMipLevels; i++)
+                    {
+                        pOut->pMipInfo[i].pixelPitch  = pOut->pMipInfo[i].pitch;
+                        pOut->pMipInfo[i].pixelHeight = pOut->pMipInfo[i].height;
+
+                        GetElemLib()->RestoreSurfaceInfo(elemMode,
+                                                         expandX,
+                                                         expandY,
+                                                         &pixelBits,
+                                                         &pOut->pMipInfo[i].pixelPitch,
+                                                         &pOut->pMipInfo[i].pixelHeight);
+                    }
+                }
+            }
+
+            if (localIn.flags.needEquation && (Log2(localIn.numFrags) == 0))
+            {
+                pOut->equationIndex = GetEquationIndex(&localIn, pOut);
+            }
+
+            if (localIn.flags.qbStereo)
+            {
+                if (pOut->pStereoInfo != NULL)
+                {
+                    ComputeQbStereoInfo(pOut);
+                }
+            }
+        }
+    }
+
+    ADDR_ASSERT(pOut->surfSize != 0);
+
+    ValidBaseAlignments(pOut->baseAlign);
+
+    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);
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->prtBlockIndex = static_cast<UINT_32>(pOut->addr / (64 * 1024));
+        }
+    }
+
+    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);
+
+        ValidMetaBaseAlignments(pOut->baseAlign);
+    }
+
+    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
+{
+    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
+{
+    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);
+
+        ValidMetaBaseAlignments(pOut->baseAlign);
+    }
+
+    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
+{
+    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  = static_cast<UINT_32>(localOut.sliceSize);
+            pOut->bpp        = localIn.bpp;
+            pOut->numSamples = 1;
+        }
+    }
+
+    ValidBaseAlignments(pOut->baseAlign);
+
+    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::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);
+
+        ValidMetaBaseAlignments(pOut->dccRamBaseAlign);
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Lib::ComputeDccAddrFromCoord
+*
+*   @brief
+*       Interface function stub of ComputeDccAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeDccAddrFromCoord(
+    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut)   ///< [out] output structure
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeDccAddrFromCoord(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
+    {
+        returnCode = HwlComputePipeBankXor(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Lib::ComputeSlicePipeBankXor
+*
+*   @brief
+*       Interface function stub of Addr2ComputeSlicePipeBankXor.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSlicePipeBankXor(
+    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
+    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut)
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else if ((IsThin(pIn->resourceType, pIn->swizzleMode) == FALSE) ||
+             (IsNonPrtXor(pIn->swizzleMode) == FALSE) ||
+             (pIn->numSamples > 1))
+    {
+        returnCode = ADDR_NOTSUPPORTED;
+    }
+    else
+    {
+        returnCode = HwlComputeSlicePipeBankXor(pIn, pOut);
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Lib::ComputeSubResourceOffsetForSwizzlePattern
+*
+*   @brief
+*       Interface function stub of Addr2ComputeSubResourceOffsetForSwizzlePattern.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Lib::ComputeSubResourceOffsetForSwizzlePattern(
+    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
+    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut)
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeSubResourceOffsetForSwizzlePattern(pIn, pOut);
+    }
+
+    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;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        (pIn->size != sizeof(ADDR2_COMPUTE_SURFACE_INFO_INPUT)))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlComputeSurfaceInfoSanityCheck(pIn);
+    }
+
+    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  pitchAlignInElement,                   ///< [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 % pitchAlignInElement) != 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
+{
+    return HwlComputeSurfaceInfoLinear(pIn, pOut);
+}
+
+/**
+************************************************************************************************************************
+*   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
+{
+    return HwlComputeSurfaceInfoTiled(pIn, pOut);
+}
+
+/**
+************************************************************************************************************************
+*   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};
+        ADDR2_MIP_INFO                    mipInfo[MaxMipLevels];
+
+        localIn.bpp          = pIn->bpp;
+        localIn.flags        = pIn->flags;
+        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;
+        }
+
+        localOut.pMipInfo = mipInfo;
+
+        returnCode = ComputeSurfaceInfoLinear(&localIn, &localOut);
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->addr        = (localOut.sliceSize * pIn->slice) +
+                                mipInfo[pIn->mipId].offset +
+                                (pIn->y * mipInfo[pIn->mipId].pitch + pIn->x) * (pIn->bpp >> 3);
+            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
+{
+    return HwlComputeSurfaceAddrFromCoordTiled(pIn, pOut);
+}
+
+/**
+************************************************************************************************************************
+*   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.flags        = pIn->flags;
+        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::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))
+    {
+        const UINT_32 log2blkSize = GetBlockSizeLog2(swizzleMode);
+        const UINT_32 log2sample  = Log2(numSamples);
+        const UINT_32 q           = log2sample >> 1;
+        const UINT_32 r           = log2sample & 1;
+
+        if (log2blkSize & 1)
+        {
+            *pWidth  >>= q;
+            *pHeight >>= (q + r);
+        }
+        else
+        {
+            *pWidth  >>= (q + r);
+            *pHeight >>= q;
+        }
+    }
+
+    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))
+    {
+        UINT_32 log2blkSizeIn256B = log2blkSize - 8;
+        UINT_32 widthAmp          = log2blkSizeIn256B / 2;
+        UINT_32 heightAmp         = log2blkSizeIn256B - widthAmp;
+
+        ADDR_ASSERT(microBlockSizeTableIndex < sizeof(Block256_2d) / sizeof(Block256_2d[0]));
+
+        *pWidth  = (Block256_2d[microBlockSizeTableIndex].w << widthAmp);
+        *pHeight = (Block256_2d[microBlockSizeTableIndex].h << heightAmp);
+        *pDepth  = 1;
+    }
+    else if (IsThick(resourceType, swizzleMode))
+    {
+        UINT_32 log2blkSizeIn1KB = log2blkSize - 10;
+        UINT_32 averageAmp       = log2blkSizeIn1KB / 3;
+        UINT_32 restAmp          = log2blkSizeIn1KB % 3;
+
+        ADDR_ASSERT(microBlockSizeTableIndex < sizeof(Block1K_3d) / sizeof(Block1K_3d[0]));
+
+        *pWidth  = Block1K_3d[microBlockSizeTableIndex].w << averageAmp;
+        *pHeight = Block1K_3d[microBlockSizeTableIndex].h << (averageAmp + (restAmp / 2));
+        *pDepth  = Block1K_3d[microBlockSizeTableIndex].d << (averageAmp + ((restAmp != 0) ? 1 : 0));
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   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
+{
+    ADDR_E_RETURNCODE returnCode;
+
+    if ((GetFillSizeFieldsFlags() == TRUE) &&
+        ((pIn->size != sizeof(ADDR2_GET_PREFERRED_SURF_SETTING_INPUT)) ||
+         (pOut->size != sizeof(ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT))))
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        returnCode = HwlGetPreferredSurfaceSetting(pIn, pOut);
+    }
+
+    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;
+}
+
+/**
+************************************************************************************************************************
+*   Lib::ComputeQbStereoInfo
+*
+*   @brief
+*       Get quad buffer stereo information
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Lib::ComputeQbStereoInfo(
+    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut    ///< [in,out] updated pOut+pStereoInfo
+    ) const
+{
+    ADDR_ASSERT(pOut->bpp >= 8);
+    ADDR_ASSERT((pOut->surfSize % pOut->baseAlign) == 0);
+
+    // Save original height
+    pOut->pStereoInfo->eyeHeight = pOut->height;
+
+    // Right offset
+    pOut->pStereoInfo->rightOffset = static_cast<UINT_32>(pOut->surfSize);
+
+    // Double height
+    pOut->height <<= 1;
+
+    ADDR_ASSERT(pOut->height <= MaxSurfaceHeight);
+
+    pOut->pixelHeight <<= 1;
+
+    // Double size
+    pOut->surfSize <<= 1;
+}
+
+} // V2
+} // Addr
+
diff --git a/src/amd/addrlib/src/core/addrlib2.h b/src/amd/addrlib/src/core/addrlib2.h
new file mode 100644 (file)
index 0000000..e72dd43
--- /dev/null
@@ -0,0 +1,836 @@
+/*
+ * Copyright © 2007-2018 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
+
+    UINT_32 isRtOpt         : 1;    // mode opt for render target
+};
+
+struct Dim2d
+{
+    UINT_32 w;
+    UINT_32 h;
+};
+
+struct Dim3d
+{
+    UINT_32 w;
+    UINT_32 h;
+    UINT_32 d;
+};
+
+// 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 block, only valid for GFX9
+    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,
+};
+
+enum AddrSwSet
+{
+    AddrSwSetZ = 1 << ADDR_SW_Z,
+    AddrSwSetS = 1 << ADDR_SW_S,
+    AddrSwSetD = 1 << ADDR_SW_D,
+    AddrSwSetR = 1 << ADDR_SW_R,
+
+    AddrSwSetAll         = AddrSwSetZ | AddrSwSetS | AddrSwSetD | AddrSwSetR,
+};
+
+/**
+************************************************************************************************************************
+* @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);
+
+    ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
+        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*      pOut);
+
+    // 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);
+
+    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;
+
+    ADDR_E_RETURNCODE ComputeDccAddrFromCoord(
+        const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut);
+
+    // Misc
+    ADDR_E_RETURNCODE ComputePipeBankXor(
+        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut);
+
+    ADDR_E_RETURNCODE ComputeSlicePipeBankXor(
+        const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut);
+
+    ADDR_E_RETURNCODE ComputeSubResourceOffsetForSwizzlePattern(
+        const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
+        ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut);
+
+    ADDR_E_RETURNCODE Addr2GetPreferredSurfaceSetting(
+        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const;
+
+    virtual BOOL_32 IsValidDisplaySwizzleMode(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTIMPLEMENTED;
+    }
+
+protected:
+    Lib();  // Constructor is protected
+    Lib(const Client* pClient);
+
+    static const UINT_32 MaxNumOfBpp = 5;
+    static const UINT_32 MaxNumOfAA  = 4;
+
+    static const Dim2d Block256_2d[MaxNumOfBpp];
+    static const Dim3d Block1K_3d[MaxNumOfBpp];
+
+    static const UINT_32 PrtAlignment = 64 * 1024;
+    static const UINT_32 MaxMacroBits = 20;
+
+    static const UINT_32 MaxMipLevels = 16;
+
+    // Checking block size
+    BOOL_32 IsBlock256b(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].is256b;
+    }
+
+    BOOL_32 IsBlock4kb(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].is4kb;
+    }
+
+    BOOL_32 IsBlock64kb(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].is64kb;
+    }
+
+    BOOL_32 IsBlockVariable(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isVar;
+    }
+
+    // Checking swizzle mode
+    BOOL_32 IsLinear(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isLinear;
+    }
+
+    BOOL_32 IsRtOptSwizzle(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isRtOpt;
+    }
+
+    BOOL_32 IsZOrderSwizzle(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isZ;
+    }
+
+    BOOL_32 IsStandardSwizzle(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isStd;
+    }
+
+    BOOL_32 IsDisplaySwizzle(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isDisp;
+    }
+
+    BOOL_32 IsRotateSwizzle(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isRot;
+    }
+
+    BOOL_32 IsStandardSwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
+    {
+        return HwlIsStandardSwizzle(resourceType, swizzleMode);
+    }
+
+    BOOL_32 IsDisplaySwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
+    {
+        return HwlIsDisplaySwizzle(resourceType, swizzleMode);
+    }
+
+    BOOL_32 IsXor(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isXor;
+    }
+
+    BOOL_32 IsPrt(AddrSwizzleMode swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isT;
+    }
+
+    BOOL_32 IsNonPrtXor(AddrSwizzleMode swizzleMode) const
+    {
+        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);
+    }
+
+    BOOL_32 IsThick(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
+    {
+        return HwlIsThick(resourceType, swizzleMode);
+    }
+
+    BOOL_32 IsThin(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
+    {
+        return HwlIsThin(resourceType, swizzleMode);
+    }
+
+    UINT_32 GetBlockSizeLog2(AddrSwizzleMode swizzleMode) const
+    {
+        UINT_32 blockSizeLog2 = 0;
+
+        if (IsBlock256b(swizzleMode) || IsLinear(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 BOOL_32 HwlIsStandardSwizzle(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return FALSE;
+    }
+
+    virtual BOOL_32 HwlIsDisplaySwizzle(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return FALSE;
+    }
+
+    virtual BOOL_32 HwlIsThin(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return FALSE;
+    }
+
+    virtual BOOL_32 HwlIsThick(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return FALSE;
+    }
+
+    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 HwlComputeDccAddrFromCoord(
+        const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut)
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
+        const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*      pOut)
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
+        const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*      pOut)
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
+        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*      pOut)
+    {
+        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 ADDR_E_RETURNCODE HwlComputePipeBankXor(
+        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
+        const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
+        const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
+        ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
+        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTSUPPORTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
+         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTIMPLEMENTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
+         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTIMPLEMENTED;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
+        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) const
+    {
+        ADDR_NOT_IMPLEMENTED();
+        return ADDR_NOTIMPLEMENTED;
+    }
+
+    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 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(
+        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;
+    }
+
+    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);
+    }
+
+    Dim3d GetMipTailDim(
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode,
+        UINT_32           blockWidth,
+        UINT_32           blockHeight,
+        UINT_32           blockDepth) const;
+
+    BOOL_32 IsInMipTail(
+        AddrResourceType  resourceType,
+        AddrSwizzleMode   swizzleMode,
+        Dim3d             mipTailDim,
+        UINT_32           width,
+        UINT_32           height,
+        UINT_32           depth) const
+    {
+        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;
+
+    ADDR_E_RETURNCODE ApplyCustomizedPitchHeight(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32                                 elementBytes,
+        UINT_32                                 pitchAlignInElement,
+        UINT_32*                                pPitch,
+        UINT_32*                                pHeight) const;
+
+    VOID ComputeQbStereoInfo(ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) 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
+
+    SwizzleModeFlags m_swizzleModeTable[ADDR_SW_MAX_TYPE];  ///< Swizzle mode table
+
+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/src/core/addrobject.cpp b/src/amd/addrlib/src/core/addrobject.cpp
new file mode 100644 (file)
index 0000000..5f262c3
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ * Copyright © 2007-2018 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  addrobject.cpp
+* @brief Contains the Object base class implementation.
+****************************************************************************************************
+*/
+
+#include "addrinterface.h"
+#include "addrobject.h"
+
+namespace Addr
+{
+
+/**
+****************************************************************************************************
+*   Object::Object
+*
+*   @brief
+*       Constructor for the Object class.
+****************************************************************************************************
+*/
+Object::Object()
+{
+    m_client.handle = NULL;
+    m_client.callbacks.allocSysMem = NULL;
+    m_client.callbacks.freeSysMem = NULL;
+    m_client.callbacks.debugPrint = NULL;
+}
+
+/**
+****************************************************************************************************
+*   Object::Object
+*
+*   @brief
+*       Constructor for the Object class.
+****************************************************************************************************
+*/
+Object::Object(const Client* pClient)
+{
+    m_client = *pClient;
+}
+
+/**
+****************************************************************************************************
+*   Object::~Object
+*
+*   @brief
+*       Destructor for the Object class.
+****************************************************************************************************
+*/
+Object::~Object()
+{
+}
+
+/**
+****************************************************************************************************
+*   Object::ClientAlloc
+*
+*   @brief
+*       Calls instanced allocSysMem inside Client
+****************************************************************************************************
+*/
+VOID* Object::ClientAlloc(
+    size_t         objSize,    ///< [in] Size to allocate
+    const Client*  pClient)    ///< [in] Client pointer
+{
+    VOID* pObjMem = NULL;
+
+    if (pClient->callbacks.allocSysMem != NULL)
+    {
+        ADDR_ALLOCSYSMEM_INPUT allocInput = {0};
+
+        allocInput.size        = sizeof(ADDR_ALLOCSYSMEM_INPUT);
+        allocInput.flags.value = 0;
+        allocInput.sizeInBytes = static_cast<UINT_32>(objSize);
+        allocInput.hClient     = pClient->handle;
+
+        pObjMem = pClient->callbacks.allocSysMem(&allocInput);
+    }
+
+    return pObjMem;
+}
+
+/**
+****************************************************************************************************
+*   Object::Alloc
+*
+*   @brief
+*       A wrapper of ClientAlloc
+****************************************************************************************************
+*/
+VOID* Object::Alloc(
+    size_t objSize      ///< [in] Size to allocate
+    ) const
+{
+    return ClientAlloc(objSize, &m_client);
+}
+
+/**
+****************************************************************************************************
+*   Object::ClientFree
+*
+*   @brief
+*       Calls freeSysMem inside Client
+****************************************************************************************************
+*/
+VOID Object::ClientFree(
+    VOID*          pObjMem,    ///< [in] User virtual address to free.
+    const Client*  pClient)    ///< [in] Client pointer
+{
+    if (pClient->callbacks.freeSysMem != NULL)
+    {
+        if (pObjMem != NULL)
+        {
+            ADDR_FREESYSMEM_INPUT freeInput = {0};
+
+            freeInput.size      = sizeof(ADDR_FREESYSMEM_INPUT);
+            freeInput.hClient   = pClient->handle;
+            freeInput.pVirtAddr = pObjMem;
+
+            pClient->callbacks.freeSysMem(&freeInput);
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   Object::Free
+*
+*   @brief
+*       A wrapper of ClientFree
+****************************************************************************************************
+*/
+VOID Object::Free(
+    VOID* pObjMem       ///< [in] User virtual address to free.
+    ) const
+{
+    ClientFree(pObjMem, &m_client);
+}
+
+/**
+****************************************************************************************************
+*   Object::operator new
+*
+*   @brief
+*       Placement new operator. (with pre-allocated memory pointer)
+*
+*   @return
+*       Returns pre-allocated memory pointer.
+****************************************************************************************************
+*/
+VOID* Object::operator new(
+    size_t objSize,     ///< [in] Size to allocate
+    VOID*  pMem)        ///< [in] Pre-allocated pointer
+{
+    return pMem;
+}
+
+/**
+****************************************************************************************************
+*   Object::operator delete
+*
+*   @brief
+*       Frees Object object memory.
+****************************************************************************************************
+*/
+VOID Object::operator delete(
+    VOID* pObjMem)      ///< [in] User virtual address to free.
+{
+    Object* pObj = static_cast<Object*>(pObjMem);
+    ClientFree(pObjMem, &pObj->m_client);
+}
+
+/**
+****************************************************************************************************
+*   Object::DebugPrint
+*
+*   @brief
+*       Print debug message
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID Object::DebugPrint(
+    const CHAR* pDebugString,     ///< [in] Debug string
+    ...
+    ) const
+{
+#if DEBUG
+    if (m_client.callbacks.debugPrint != NULL)
+    {
+        ADDR_DEBUGPRINT_INPUT debugPrintInput = {0};
+
+        debugPrintInput.size         = sizeof(ADDR_DEBUGPRINT_INPUT);
+        debugPrintInput.pDebugString = const_cast<CHAR*>(pDebugString);
+        debugPrintInput.hClient      = m_client.handle;
+        va_start(debugPrintInput.ap, pDebugString);
+
+        m_client.callbacks.debugPrint(&debugPrintInput);
+
+        va_end(debugPrintInput.ap);
+    }
+#endif
+}
+
+} // Addr
diff --git a/src/amd/addrlib/src/core/addrobject.h b/src/amd/addrlib/src/core/addrobject.h
new file mode 100644 (file)
index 0000000..069bb78
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright © 2007-2018 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  addrobject.h
+* @brief Contains the Object base class definition.
+****************************************************************************************************
+*/
+
+#ifndef __ADDR_OBJECT_H__
+#define __ADDR_OBJECT_H__
+
+#include "addrtypes.h"
+#include "addrcommon.h"
+
+namespace Addr
+{
+
+/**
+****************************************************************************************************
+* @brief This structure contains client specific data
+****************************************************************************************************
+*/
+struct Client
+{
+    ADDR_CLIENT_HANDLE  handle;
+    ADDR_CALLBACKS      callbacks;
+};
+/**
+****************************************************************************************************
+* @brief This class is the base class for all ADDR class objects.
+****************************************************************************************************
+*/
+class Object
+{
+public:
+    Object();
+    Object(const Client* pClient);
+    virtual ~Object();
+
+    VOID* operator new(size_t size, VOID* pMem);
+    VOID  operator delete(VOID* pObj);
+    /// Microsoft compiler requires a matching delete implementation, which seems to be called when
+    /// bad_alloc is thrown. But currently C++ exception isn't allowed so a dummy implementation is
+    /// added to eliminate the warning.
+    VOID  operator delete(VOID* pObj, VOID* pMem) { ADDR_ASSERT_ALWAYS(); }
+
+    VOID* Alloc(size_t size) const;
+    VOID  Free(VOID* pObj) const;
+
+    VOID DebugPrint(const CHAR* pDebugString, ...) const;
+
+    const Client* GetClient() const {return &m_client;}
+
+protected:
+    Client m_client;
+
+    static VOID* ClientAlloc(size_t size, const Client* pClient);
+    static VOID  ClientFree(VOID* pObj, const Client* pClient);
+
+private:
+    // disallow the copy constructor
+    Object(const Object& a);
+
+    // disallow the assignment operator
+    Object& operator=(const Object& a);
+};
+
+} // Addr
+#endif
+
diff --git a/src/amd/addrlib/src/core/coord.cpp b/src/amd/addrlib/src/core/coord.cpp
new file mode 100644 (file)
index 0000000..7fd6bc9
--- /dev/null
@@ -0,0 +1,714 @@
+/*
+ * Copyright © 2007-2018 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.
+ */
+
+// Coordinate class implementation
+#include "addrcommon.h"
+#include "coord.h"
+
+namespace Addr
+{
+namespace V2
+{
+
+Coordinate::Coordinate()
+{
+    dim = 'x';
+    ord = 0;
+}
+
+Coordinate::Coordinate(INT_8 c, INT_32 n)
+{
+    set(c, n);
+}
+
+VOID Coordinate::set(INT_8 c, INT_32 n)
+{
+    dim = c;
+    ord = static_cast<INT_8>(n);
+}
+
+UINT_32 Coordinate::ison(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
+{
+    UINT_32 bit = static_cast<UINT_32>(1ull << static_cast<UINT_32>(ord));
+    UINT_32 out = 0;
+
+    switch (dim)
+    {
+    case 'm': out = m & bit; break;
+    case 's': out = s & bit; break;
+    case 'x': out = x & bit; break;
+    case 'y': out = y & bit; break;
+    case 'z': out = z & bit; break;
+    }
+    return (out != 0) ? 1 : 0;
+}
+
+INT_8 Coordinate::getdim()
+{
+    return dim;
+}
+
+INT_8 Coordinate::getord()
+{
+    return ord;
+}
+
+BOOL_32 Coordinate::operator==(const Coordinate& b)
+{
+    return (dim == b.dim) && (ord == b.ord);
+}
+
+BOOL_32 Coordinate::operator<(const Coordinate& b)
+{
+    BOOL_32 ret;
+
+    if (dim == b.dim)
+    {
+        ret = ord < b.ord;
+    }
+    else
+    {
+        if (dim == 's' || b.dim == 'm')
+        {
+            ret = TRUE;
+        }
+        else if (b.dim == 's' || dim == 'm')
+        {
+            ret = FALSE;
+        }
+        else if (ord == b.ord)
+        {
+            ret = dim < b.dim;
+        }
+        else
+        {
+            ret = ord < b.ord;
+        }
+    }
+
+    return ret;
+}
+
+BOOL_32 Coordinate::operator>(const Coordinate& b)
+{
+    BOOL_32 lt = *this < b;
+    BOOL_32 eq = *this == b;
+    return !lt && !eq;
+}
+
+BOOL_32 Coordinate::operator<=(const Coordinate& b)
+{
+    return (*this < b) || (*this == b);
+}
+
+BOOL_32 Coordinate::operator>=(const Coordinate& b)
+{
+    return !(*this < b);
+}
+
+BOOL_32 Coordinate::operator!=(const Coordinate& b)
+{
+    return !(*this == b);
+}
+
+Coordinate& Coordinate::operator++(INT_32)
+{
+    ord++;
+    return *this;
+}
+
+// CoordTerm
+
+CoordTerm::CoordTerm()
+{
+    num_coords = 0;
+}
+
+VOID CoordTerm::Clear()
+{
+    num_coords = 0;
+}
+
+VOID CoordTerm::add(Coordinate& co)
+{
+    // This function adds a coordinate INT_32o the list
+    // It will prevent the same coordinate from appearing,
+    // and will keep the list ordered from smallest to largest
+    UINT_32 i;
+
+    for (i = 0; i < num_coords; i++)
+    {
+        if (m_coord[i] == co)
+        {
+            break;
+        }
+        if (m_coord[i] > co)
+        {
+            for (UINT_32 j = num_coords; j > i; j--)
+            {
+                m_coord[j] = m_coord[j - 1];
+            }
+            m_coord[i] = co;
+            num_coords++;
+            break;
+        }
+    }
+
+    if (i == num_coords)
+    {
+        m_coord[num_coords] = co;
+        num_coords++;
+    }
+}
+
+VOID CoordTerm::add(CoordTerm& cl)
+{
+    for (UINT_32 i = 0; i < cl.num_coords; i++)
+    {
+        add(cl.m_coord[i]);
+    }
+}
+
+BOOL_32 CoordTerm::remove(Coordinate& co)
+{
+    BOOL_32 remove = FALSE;
+    for (UINT_32 i = 0; i < num_coords; i++)
+    {
+        if (m_coord[i] == co)
+        {
+            remove = TRUE;
+            num_coords--;
+        }
+
+        if (remove)
+        {
+            m_coord[i] = m_coord[i + 1];
+        }
+    }
+    return remove;
+}
+
+BOOL_32 CoordTerm::Exists(Coordinate& co)
+{
+    BOOL_32 exists = FALSE;
+    for (UINT_32 i = 0; i < num_coords; i++)
+    {
+        if (m_coord[i] == co)
+        {
+            exists = TRUE;
+            break;
+        }
+    }
+    return exists;
+}
+
+VOID CoordTerm::copyto(CoordTerm& cl)
+{
+    cl.num_coords = num_coords;
+    for (UINT_32 i = 0; i < num_coords; i++)
+    {
+        cl.m_coord[i] = m_coord[i];
+    }
+}
+
+UINT_32 CoordTerm::getsize()
+{
+    return num_coords;
+}
+
+UINT_32 CoordTerm::getxor(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
+{
+    UINT_32 out = 0;
+    for (UINT_32 i = 0; i < num_coords; i++)
+    {
+        out = out ^ m_coord[i].ison(x, y, z, s, m);
+    }
+    return out;
+}
+
+VOID CoordTerm::getsmallest(Coordinate& co)
+{
+    co = m_coord[0];
+}
+
+UINT_32 CoordTerm::Filter(INT_8 f, Coordinate& co, UINT_32 start, INT_8 axis)
+{
+    for (UINT_32 i = start;  i < num_coords;)
+    {
+        if (((f == '<' && m_coord[i] < co) ||
+             (f == '>' && m_coord[i] > co) ||
+             (f == '=' && m_coord[i] == co)) &&
+            (axis == '\0' || axis == m_coord[i].getdim()))
+        {
+            for (UINT_32 j = i; j < num_coords - 1; j++)
+            {
+                m_coord[j] = m_coord[j + 1];
+            }
+            num_coords--;
+        }
+        else
+        {
+            i++;
+        }
+    }
+    return num_coords;
+}
+
+Coordinate& CoordTerm::operator[](UINT_32 i)
+{
+    return m_coord[i];
+}
+
+BOOL_32 CoordTerm::operator==(const CoordTerm& b)
+{
+    BOOL_32 ret = TRUE;
+
+    if (num_coords != b.num_coords)
+    {
+        ret = FALSE;
+    }
+    else
+    {
+        for (UINT_32 i = 0; i < num_coords; i++)
+        {
+            // Note: the lists will always be in order, so we can compare the two lists at time
+            if (m_coord[i] != b.m_coord[i])
+            {
+                ret = FALSE;
+                break;
+            }
+        }
+    }
+    return ret;
+}
+
+BOOL_32 CoordTerm::operator!=(const CoordTerm& b)
+{
+    return !(*this == b);
+}
+
+BOOL_32 CoordTerm::exceedRange(UINT_32 xRange, UINT_32 yRange, UINT_32 zRange, UINT_32 sRange)
+{
+    BOOL_32 exceed = FALSE;
+    for (UINT_32 i = 0; (i < num_coords) && (exceed == FALSE); i++)
+    {
+        UINT_32 subject;
+        switch (m_coord[i].getdim())
+        {
+            case 'x':
+                subject = xRange;
+                break;
+            case 'y':
+                subject = yRange;
+                break;
+            case 'z':
+                subject = zRange;
+                break;
+            case 's':
+                subject = sRange;
+                break;
+            case 'm':
+                subject = 0;
+                break;
+            default:
+                // Invalid input!
+                ADDR_ASSERT_ALWAYS();
+                subject = 0;
+                break;
+        }
+
+        exceed = ((1u << m_coord[i].getord()) <= subject);
+    }
+
+    return exceed;
+}
+
+// coordeq
+CoordEq::CoordEq()
+{
+    m_numBits = 0;
+}
+
+VOID CoordEq::remove(Coordinate& co)
+{
+    for (UINT_32 i = 0; i < m_numBits; i++)
+    {
+        m_eq[i].remove(co);
+    }
+}
+
+BOOL_32 CoordEq::Exists(Coordinate& co)
+{
+    BOOL_32 exists = FALSE;
+
+    for (UINT_32 i = 0; i < m_numBits; i++)
+    {
+        if (m_eq[i].Exists(co))
+        {
+            exists = TRUE;
+        }
+    }
+    return exists;
+}
+
+VOID CoordEq::resize(UINT_32 n)
+{
+    if (n > m_numBits)
+    {
+        for (UINT_32 i = m_numBits; i < n; i++)
+        {
+            m_eq[i].Clear();
+        }
+    }
+    m_numBits = n;
+}
+
+UINT_32 CoordEq::getsize()
+{
+    return m_numBits;
+}
+
+UINT_64 CoordEq::solve(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
+{
+    UINT_64 out = 0;
+    for (UINT_32 i = 0; i < m_numBits; i++)
+    {
+        if (m_eq[i].getxor(x, y, z, s, m) != 0)
+        {
+            out |= (1ULL << i);
+        }
+    }
+    return out;
+}
+
+VOID CoordEq::solveAddr(
+    UINT_64 addr, UINT_32 sliceInM,
+    UINT_32& x, UINT_32& y, UINT_32& z, UINT_32& s, UINT_32& m) const
+{
+    UINT_32 xBitsValid = 0;
+    UINT_32 yBitsValid = 0;
+    UINT_32 zBitsValid = 0;
+    UINT_32 sBitsValid = 0;
+    UINT_32 mBitsValid = 0;
+
+    CoordEq temp = *this;
+
+    x = y = z = s = m = 0;
+
+    UINT_32 bitsLeft = 0;
+
+    for (UINT_32 i = 0; i < temp.m_numBits; i++)
+    {
+        UINT_32 termSize = temp.m_eq[i].getsize();
+
+        if (termSize == 1)
+        {
+            INT_8 bit = (addr >> i) & 1;
+            INT_8 dim = temp.m_eq[i][0].getdim();
+            INT_8 ord = temp.m_eq[i][0].getord();
+
+            ADDR_ASSERT((ord < 32) || (bit == 0));
+
+            switch (dim)
+            {
+                case 'x':
+                    xBitsValid |= (1 << ord);
+                    x |= (bit << ord);
+                    break;
+                case 'y':
+                    yBitsValid |= (1 << ord);
+                    y |= (bit << ord);
+                    break;
+                case 'z':
+                    zBitsValid |= (1 << ord);
+                    z |= (bit << ord);
+                    break;
+                case 's':
+                    sBitsValid |= (1 << ord);
+                    s |= (bit << ord);
+                    break;
+                case 'm':
+                    mBitsValid |= (1 << ord);
+                    m |= (bit << ord);
+                    break;
+                default:
+                    break;
+            }
+
+            temp.m_eq[i].Clear();
+        }
+        else if (termSize > 1)
+        {
+            bitsLeft++;
+        }
+    }
+
+    if (bitsLeft > 0)
+    {
+        if (sliceInM != 0)
+        {
+            z = m / sliceInM;
+            zBitsValid = 0xffffffff;
+        }
+
+        do
+        {
+            bitsLeft = 0;
+
+            for (UINT_32 i = 0; i < temp.m_numBits; i++)
+            {
+                UINT_32 termSize = temp.m_eq[i].getsize();
+
+                if (termSize == 1)
+                {
+                    INT_8 bit = (addr >> i) & 1;
+                    INT_8 dim = temp.m_eq[i][0].getdim();
+                    INT_8 ord = temp.m_eq[i][0].getord();
+
+                    ADDR_ASSERT((ord < 32) || (bit == 0));
+
+                    switch (dim)
+                    {
+                        case 'x':
+                            xBitsValid |= (1 << ord);
+                            x |= (bit << ord);
+                            break;
+                        case 'y':
+                            yBitsValid |= (1 << ord);
+                            y |= (bit << ord);
+                            break;
+                        case 'z':
+                            zBitsValid |= (1 << ord);
+                            z |= (bit << ord);
+                            break;
+                        case 's':
+                            ADDR_ASSERT_ALWAYS();
+                            break;
+                        case 'm':
+                            ADDR_ASSERT_ALWAYS();
+                            break;
+                        default:
+                            break;
+                    }
+
+                    temp.m_eq[i].Clear();
+                }
+                else if (termSize > 1)
+                {
+                    CoordTerm tmpTerm = temp.m_eq[i];
+
+                    for (UINT_32 j = 0; j < termSize; j++)
+                    {
+                        INT_8 dim = temp.m_eq[i][j].getdim();
+                        INT_8 ord = temp.m_eq[i][j].getord();
+
+                        switch (dim)
+                        {
+                            case 'x':
+                                if (xBitsValid & (1 << ord))
+                                {
+                                    UINT_32 v = (((x >> ord) & 1) << i);
+                                    addr ^= static_cast<UINT_64>(v);
+                                    tmpTerm.remove(temp.m_eq[i][j]);
+                                }
+                                break;
+                            case 'y':
+                                if (yBitsValid & (1 << ord))
+                                {
+                                    UINT_32 v = (((y >> ord) & 1) << i);
+                                    addr ^= static_cast<UINT_64>(v);
+                                    tmpTerm.remove(temp.m_eq[i][j]);
+                                }
+                                break;
+                            case 'z':
+                                if (zBitsValid & (1 << ord))
+                                {
+                                    UINT_32 v = (((z >> ord) & 1) << i);
+                                    addr ^= static_cast<UINT_64>(v);
+                                    tmpTerm.remove(temp.m_eq[i][j]);
+                                }
+                                break;
+                            case 's':
+                                ADDR_ASSERT_ALWAYS();
+                                break;
+                            case 'm':
+                                ADDR_ASSERT_ALWAYS();
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+
+                    temp.m_eq[i] = tmpTerm;
+
+                    bitsLeft++;
+                }
+            }
+        } while (bitsLeft > 0);
+    }
+}
+
+VOID CoordEq::copy(CoordEq& o, UINT_32 start, UINT_32 num)
+{
+    o.m_numBits = (num == 0xFFFFFFFF) ? m_numBits : num;
+    for (UINT_32 i = 0; i < o.m_numBits; i++)
+    {
+        m_eq[start + i].copyto(o.m_eq[i]);
+    }
+}
+
+VOID CoordEq::reverse(UINT_32 start, UINT_32 num)
+{
+    UINT_32 n = (num == 0xFFFFFFFF) ? m_numBits : num;
+
+    for (UINT_32 i = 0; i < n / 2; i++)
+    {
+        CoordTerm temp;
+        m_eq[start + i].copyto(temp);
+        m_eq[start + n - 1 - i].copyto(m_eq[start + i]);
+        temp.copyto(m_eq[start + n - 1 - i]);
+    }
+}
+
+VOID CoordEq::xorin(CoordEq& x, UINT_32 start)
+{
+    UINT_32 n = ((m_numBits - start) < x.m_numBits) ? (m_numBits - start) : x.m_numBits;
+    for (UINT_32 i = 0; i < n; i++)
+    {
+        m_eq[start + i].add(x.m_eq[i]);
+    }
+}
+
+UINT_32 CoordEq::Filter(INT_8 f, Coordinate& co, UINT_32 start, INT_8 axis)
+{
+    for (UINT_32 i = start; i < m_numBits;)
+    {
+        UINT_32 m = m_eq[i].Filter(f, co, 0, axis);
+        if (m == 0)
+        {
+            for (UINT_32 j = i; j < m_numBits - 1; j++)
+            {
+                m_eq[j] = m_eq[j + 1];
+            }
+            m_numBits--;
+        }
+        else
+        {
+            i++;
+        }
+    }
+    return m_numBits;
+}
+
+VOID CoordEq::shift(INT_32 amount, INT_32 start)
+{
+    if (amount != 0)
+    {
+        INT_32 numBits = static_cast<INT_32>(m_numBits);
+        amount = -amount;
+        INT_32 inc = (amount < 0) ? -1 : 1;
+        INT_32 i = (amount < 0) ? numBits - 1 : start;
+        INT_32 end = (amount < 0) ? start - 1 : numBits;
+        for (; (inc > 0) ? i < end : i > end; i += inc)
+        {
+            if ((i + amount < start) || (i + amount >= numBits))
+            {
+                m_eq[i].Clear();
+            }
+            else
+            {
+                m_eq[i + amount].copyto(m_eq[i]);
+            }
+        }
+    }
+}
+
+CoordTerm& CoordEq::operator[](UINT_32 i)
+{
+    return m_eq[i];
+}
+
+VOID CoordEq::mort2d(Coordinate& c0, Coordinate& c1, UINT_32 start, UINT_32 end)
+{
+    if (end == 0)
+    {
+        ADDR_ASSERT(m_numBits > 0);
+        end = m_numBits - 1;
+    }
+    for (UINT_32 i = start; i <= end; i++)
+    {
+        UINT_32 select = (i - start) % 2;
+        Coordinate& c = (select == 0) ? c0 : c1;
+        m_eq[i].add(c);
+        c++;
+    }
+}
+
+VOID CoordEq::mort3d(Coordinate& c0, Coordinate& c1, Coordinate& c2, UINT_32 start, UINT_32 end)
+{
+    if (end == 0)
+    {
+        ADDR_ASSERT(m_numBits > 0);
+        end = m_numBits - 1;
+    }
+    for (UINT_32 i = start; i <= end; i++)
+    {
+        UINT_32 select = (i - start) % 3;
+        Coordinate& c = (select == 0) ? c0 : ((select == 1) ? c1 : c2);
+        m_eq[i].add(c);
+        c++;
+    }
+}
+
+BOOL_32 CoordEq::operator==(const CoordEq& b)
+{
+    BOOL_32 ret = TRUE;
+
+    if (m_numBits != b.m_numBits)
+    {
+        ret = FALSE;
+    }
+    else
+    {
+        for (UINT_32 i = 0; i < m_numBits; i++)
+        {
+            if (m_eq[i] != b.m_eq[i])
+            {
+                ret = FALSE;
+                break;
+            }
+        }
+    }
+    return ret;
+}
+
+BOOL_32 CoordEq::operator!=(const CoordEq& b)
+{
+    return !(*this == b);
+}
+
+} // V2
+} // Addr
diff --git a/src/amd/addrlib/src/core/coord.h b/src/amd/addrlib/src/core/coord.h
new file mode 100644 (file)
index 0000000..ce40a3e
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright © 2007-2018 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.
+ */
+
+// Class used to define a coordinate bit
+
+#ifndef __COORD_H
+#define __COORD_H
+
+namespace Addr
+{
+namespace V2
+{
+
+class Coordinate
+{
+public:
+    Coordinate();
+    Coordinate(INT_8 c, INT_32 n);
+
+    VOID set(INT_8 c, INT_32 n);
+    UINT_32 ison(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
+    INT_8   getdim();
+    INT_8   getord();
+
+    BOOL_32 operator==(const Coordinate& b);
+    BOOL_32 operator<(const Coordinate& b);
+    BOOL_32 operator>(const Coordinate& b);
+    BOOL_32 operator<=(const Coordinate& b);
+    BOOL_32 operator>=(const Coordinate& b);
+    BOOL_32 operator!=(const Coordinate& b);
+    Coordinate& operator++(INT_32);
+
+private:
+    INT_8 dim;
+    INT_8 ord;
+};
+
+class CoordTerm
+{
+public:
+    CoordTerm();
+    VOID Clear();
+    VOID add(Coordinate& co);
+    VOID add(CoordTerm& cl);
+    BOOL_32 remove(Coordinate& co);
+    BOOL_32 Exists(Coordinate& co);
+    VOID copyto(CoordTerm& cl);
+    UINT_32 getsize();
+    UINT_32 getxor(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
+
+    VOID getsmallest(Coordinate& co);
+    UINT_32 Filter(INT_8 f, Coordinate& co, UINT_32 start = 0, INT_8 axis = '\0');
+    Coordinate& operator[](UINT_32 i);
+    BOOL_32 operator==(const CoordTerm& b);
+    BOOL_32 operator!=(const CoordTerm& b);
+    BOOL_32 exceedRange(UINT_32 xRange, UINT_32 yRange = 0, UINT_32 zRange = 0, UINT_32 sRange = 0);
+
+private:
+    static const UINT_32 MaxCoords = 8;
+    UINT_32 num_coords;
+    Coordinate m_coord[MaxCoords];
+};
+
+class CoordEq
+{
+public:
+    CoordEq();
+    VOID remove(Coordinate& co);
+    BOOL_32 Exists(Coordinate& co);
+    VOID resize(UINT_32 n);
+    UINT_32 getsize();
+    virtual UINT_64 solve(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
+    virtual VOID solveAddr(UINT_64 addr, UINT_32 sliceInM,
+                           UINT_32& x, UINT_32& y, UINT_32& z, UINT_32& s, UINT_32& m) const;
+
+    VOID copy(CoordEq& o, UINT_32 start = 0, UINT_32 num = 0xFFFFFFFF);
+    VOID reverse(UINT_32 start = 0, UINT_32 num = 0xFFFFFFFF);
+    VOID xorin(CoordEq& x, UINT_32 start = 0);
+    UINT_32 Filter(INT_8 f, Coordinate& co, UINT_32 start = 0, INT_8 axis = '\0');
+    VOID shift(INT_32 amount, INT_32 start = 0);
+    virtual CoordTerm& operator[](UINT_32 i);
+    VOID mort2d(Coordinate& c0, Coordinate& c1, UINT_32 start = 0, UINT_32 end = 0);
+    VOID mort3d(Coordinate& c0, Coordinate& c1, Coordinate& c2, UINT_32 start = 0, UINT_32 end = 0);
+
+    BOOL_32 operator==(const CoordEq& b);
+    BOOL_32 operator!=(const CoordEq& b);
+
+private:
+    static const UINT_32 MaxEqBits = 64;
+    UINT_32 m_numBits;
+
+    CoordTerm m_eq[MaxEqBits];
+};
+
+} // V2
+} // Addr
+
+#endif
+
diff --git a/src/amd/addrlib/src/gfx9/gfx9addrlib.cpp b/src/amd/addrlib/src/gfx9/gfx9addrlib.cpp
new file mode 100644 (file)
index 0000000..b3cbccf
--- /dev/null
@@ -0,0 +1,4871 @@
+/*
+ * Copyright © 2007-2018 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  gfx9addrlib.cpp
+* @brief Contgfx9ns the implementation for the Gfx9Lib class.
+************************************************************************************************************************
+*/
+
+#include "gfx9addrlib.h"
+
+#include "gfx9_gb_reg.h"
+
+#include "amdgpu_asic_addr.h"
+
+#include "util/macros.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace Addr
+{
+
+/**
+************************************************************************************************************************
+*   Gfx9HwlInit
+*
+*   @brief
+*       Creates an Gfx9Lib object.
+*
+*   @return
+*       Returns an Gfx9Lib object pointer.
+************************************************************************************************************************
+*/
+Addr::Lib* Gfx9HwlInit(const Client* pClient)
+{
+    return V2::Gfx9Lib::CreateObj(pClient);
+}
+
+namespace V2
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                               Static Const Member
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const SwizzleModeFlags Gfx9Lib::SwizzleModeTable[ADDR_SW_MAX_TYPE] =
+{//Linear 256B  4KB  64KB   Var    Z    Std   Disp  Rot   XOR    T     RtOpt
+    {1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0}, // ADDR_SW_LINEAR
+    {0,    1,    0,    0,    0,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_256B_S
+    {0,    1,    0,    0,    0,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_256B_D
+    {0,    1,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_256B_R
+
+    {0,    0,    1,    0,    0,    1,    0,    0,    0,    0,    0,    0}, // ADDR_SW_4KB_Z
+    {0,    0,    1,    0,    0,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_4KB_S
+    {0,    0,    1,    0,    0,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_4KB_D
+    {0,    0,    1,    0,    0,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_4KB_R
+
+    {0,    0,    0,    1,    0,    1,    0,    0,    0,    0,    0,    0}, // ADDR_SW_64KB_Z
+    {0,    0,    0,    1,    0,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_64KB_S
+    {0,    0,    0,    1,    0,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_64KB_D
+    {0,    0,    0,    1,    0,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_64KB_R
+
+    {0,    0,    0,    0,    1,    1,    0,    0,    0,    0,    0,    0}, // ADDR_SW_VAR_Z
+    {0,    0,    0,    0,    1,    0,    1,    0,    0,    0,    0,    0}, // ADDR_SW_VAR_S
+    {0,    0,    0,    0,    1,    0,    0,    1,    0,    0,    0,    0}, // ADDR_SW_VAR_D
+    {0,    0,    0,    0,    1,    0,    0,    0,    1,    0,    0,    0}, // ADDR_SW_VAR_R
+
+    {0,    0,    0,    1,    0,    1,    0,    0,    0,    1,    1,    0}, // ADDR_SW_64KB_Z_T
+    {0,    0,    0,    1,    0,    0,    1,    0,    0,    1,    1,    0}, // ADDR_SW_64KB_S_T
+    {0,    0,    0,    1,    0,    0,    0,    1,    0,    1,    1,    0}, // ADDR_SW_64KB_D_T
+    {0,    0,    0,    1,    0,    0,    0,    0,    1,    1,    1,    0}, // ADDR_SW_64KB_R_T
+
+    {0,    0,    1,    0,    0,    1,    0,    0,    0,    1,    0,    0}, // ADDR_SW_4KB_Z_x
+    {0,    0,    1,    0,    0,    0,    1,    0,    0,    1,    0,    0}, // ADDR_SW_4KB_S_x
+    {0,    0,    1,    0,    0,    0,    0,    1,    0,    1,    0,    0}, // ADDR_SW_4KB_D_x
+    {0,    0,    1,    0,    0,    0,    0,    0,    1,    1,    0,    0}, // ADDR_SW_4KB_R_x
+
+    {0,    0,    0,    1,    0,    1,    0,    0,    0,    1,    0,    0}, // ADDR_SW_64KB_Z_X
+    {0,    0,    0,    1,    0,    0,    1,    0,    0,    1,    0,    0}, // ADDR_SW_64KB_S_X
+    {0,    0,    0,    1,    0,    0,    0,    1,    0,    1,    0,    0}, // ADDR_SW_64KB_D_X
+    {0,    0,    0,    1,    0,    0,    0,    0,    1,    1,    0,    0}, // ADDR_SW_64KB_R_X
+
+    {0,    0,    0,    0,    1,    1,    0,    0,    0,    1,    0,    0}, // ADDR_SW_VAR_Z_X
+    {0,    0,    0,    0,    1,    0,    1,    0,    0,    1,    0,    0}, // ADDR_SW_VAR_S_X
+    {0,    0,    0,    0,    1,    0,    0,    1,    0,    1,    0,    0}, // ADDR_SW_VAR_D_X
+    {0,    0,    0,    0,    1,    0,    0,    0,    1,    1,    0,    0}, // ADDR_SW_VAR_R_X
+    {1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0}, // ADDR_SW_LINEAR_GENERAL
+};
+
+const UINT_32 Gfx9Lib::MipTailOffset256B[] = {2048, 1024, 512, 256, 128, 64, 32, 16,
+                                              8, 6, 5, 4, 3, 2, 1, 0};
+
+const Dim3d   Gfx9Lib::Block256_3dS[]  = {{16, 4, 4}, {8, 4, 4}, {4, 4, 4}, {2, 4, 4}, {1, 4, 4}};
+
+const Dim3d   Gfx9Lib::Block256_3dZ[]  = {{8, 4, 8}, {4, 4, 8}, {4, 4, 4}, {4, 2, 4}, {2, 2, 4}};
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::Gfx9Lib
+*
+*   @brief
+*       Constructor
+*
+************************************************************************************************************************
+*/
+Gfx9Lib::Gfx9Lib(const Client* pClient)
+    :
+    Lib(pClient),
+    m_numEquations(0)
+{
+    m_class = AI_ADDRLIB;
+    memset(&m_settings, 0, sizeof(m_settings));
+    memcpy(m_swizzleModeTable, SwizzleModeTable, sizeof(SwizzleModeTable));
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::~Gfx9Lib
+*
+*   @brief
+*       Destructor
+************************************************************************************************************************
+*/
+Gfx9Lib::~Gfx9Lib()
+{
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeHtileInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeHtilenfo
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileInfo(
+    const ADDR2_COMPUTE_HTILE_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_HTILE_INFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    UINT_32 numPipeTotal = GetPipeNumForMetaAddressing(pIn->hTileFlags.pipeAligned,
+                                                       pIn->swizzleMode);
+
+    UINT_32 numRbTotal = pIn->hTileFlags.rbAligned ? m_se * m_rbPerSe : 1;
+
+    UINT_32 numCompressBlkPerMetaBlk, numCompressBlkPerMetaBlkLog2;
+
+    if ((numPipeTotal == 1) && (numRbTotal == 1))
+    {
+        numCompressBlkPerMetaBlkLog2 = 10;
+    }
+    else
+    {
+        if (m_settings.applyAliasFix)
+        {
+            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + Max(10u, m_pipeInterleaveLog2);
+        }
+        else
+        {
+            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + 10;
+        }
+    }
+
+    numCompressBlkPerMetaBlk = 1 << numCompressBlkPerMetaBlkLog2;
+
+    Dim3d   metaBlkDim   = {8, 8, 1};
+    UINT_32 totalAmpBits = numCompressBlkPerMetaBlkLog2;
+    UINT_32 widthAmp     = (pIn->numMipLevels > 1) ? (totalAmpBits >> 1) : RoundHalf(totalAmpBits);
+    UINT_32 heightAmp    = totalAmpBits - widthAmp;
+    metaBlkDim.w <<= widthAmp;
+    metaBlkDim.h <<= heightAmp;
+
+#if DEBUG
+    Dim3d metaBlkDimDbg = {8, 8, 1};
+    for (UINT_32 index = 0; index < numCompressBlkPerMetaBlkLog2; index++)
+    {
+        if ((metaBlkDimDbg.h < metaBlkDimDbg.w) ||
+            ((pIn->numMipLevels > 1) && (metaBlkDimDbg.h == metaBlkDimDbg.w)))
+        {
+            metaBlkDimDbg.h <<= 1;
+        }
+        else
+        {
+            metaBlkDimDbg.w <<= 1;
+        }
+    }
+    ADDR_ASSERT((metaBlkDimDbg.w == metaBlkDim.w) && (metaBlkDimDbg.h == metaBlkDim.h));
+#endif
+
+    UINT_32 numMetaBlkX;
+    UINT_32 numMetaBlkY;
+    UINT_32 numMetaBlkZ;
+
+    GetMetaMipInfo(pIn->numMipLevels, &metaBlkDim, FALSE, pOut->pMipInfo,
+                   pIn->unalignedWidth, pIn->unalignedHeight, pIn->numSlices,
+                   &numMetaBlkX, &numMetaBlkY, &numMetaBlkZ);
+
+    const UINT_32 metaBlkSize = numCompressBlkPerMetaBlk << 2;
+    UINT_32       align       = numPipeTotal * numRbTotal * m_pipeInterleaveBytes;
+
+    if ((IsXor(pIn->swizzleMode) == FALSE) && (numPipeTotal > 2))
+    {
+        align *= (numPipeTotal >> 1);
+    }
+
+    align = Max(align, metaBlkSize);
+
+    if (m_settings.metaBaseAlignFix)
+    {
+        align = Max(align, GetBlockSize(pIn->swizzleMode));
+    }
+
+    if (m_settings.htileAlignFix)
+    {
+        const INT_32 metaBlkSizeLog2        = numCompressBlkPerMetaBlkLog2 + 2;
+        const INT_32 htileCachelineSizeLog2 = 11;
+        const INT_32 maxNumOfRbMaskBits     = 1 + Log2(numPipeTotal) + Log2(numRbTotal);
+
+        INT_32 rbMaskPadding = Max(0, htileCachelineSizeLog2 - (metaBlkSizeLog2 - maxNumOfRbMaskBits));
+
+        align <<= rbMaskPadding;
+    }
+
+    pOut->pitch      = numMetaBlkX * metaBlkDim.w;
+    pOut->height     = numMetaBlkY * metaBlkDim.h;
+    pOut->sliceSize  = numMetaBlkX * numMetaBlkY * metaBlkSize;
+
+    pOut->metaBlkWidth       = metaBlkDim.w;
+    pOut->metaBlkHeight      = metaBlkDim.h;
+    pOut->metaBlkNumPerSlice = numMetaBlkX * numMetaBlkY;
+
+    pOut->baseAlign  = align;
+    pOut->htileBytes = PowTwoAlign(pOut->sliceSize * numMetaBlkZ, align);
+
+    return ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeCmaskInfo
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskInfo
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskInfo(
+    const ADDR2_COMPUTE_CMASK_INFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_CMASK_INFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+// TODO: Clarify with AddrLib team
+//     ADDR_ASSERT(pIn->resourceType == ADDR_RSRC_TEX_2D);
+
+    UINT_32 numPipeTotal = GetPipeNumForMetaAddressing(pIn->cMaskFlags.pipeAligned,
+                                                       pIn->swizzleMode);
+
+    UINT_32 numRbTotal = pIn->cMaskFlags.rbAligned ? m_se * m_rbPerSe : 1;
+
+    UINT_32 numCompressBlkPerMetaBlkLog2, numCompressBlkPerMetaBlk;
+
+    if ((numPipeTotal == 1) && (numRbTotal == 1))
+    {
+        numCompressBlkPerMetaBlkLog2 = 13;
+    }
+    else
+    {
+        if (m_settings.applyAliasFix)
+        {
+            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + Max(10u, m_pipeInterleaveLog2);
+        }
+        else
+        {
+            numCompressBlkPerMetaBlkLog2 = m_seLog2 + m_rbPerSeLog2 + 10;
+        }
+
+        numCompressBlkPerMetaBlkLog2 = Max(numCompressBlkPerMetaBlkLog2, 13u);
+    }
+
+    numCompressBlkPerMetaBlk = 1 << numCompressBlkPerMetaBlkLog2;
+
+    Dim2d metaBlkDim = {8, 8};
+    UINT_32 totalAmpBits = numCompressBlkPerMetaBlkLog2;
+    UINT_32 heightAmp = totalAmpBits >> 1;
+    UINT_32 widthAmp = totalAmpBits - heightAmp;
+    metaBlkDim.w <<= widthAmp;
+    metaBlkDim.h <<= heightAmp;
+
+#if DEBUG
+    Dim2d metaBlkDimDbg = {8, 8};
+    for (UINT_32 index = 0; index < numCompressBlkPerMetaBlkLog2; index++)
+    {
+        if (metaBlkDimDbg.h < metaBlkDimDbg.w)
+        {
+            metaBlkDimDbg.h <<= 1;
+        }
+        else
+        {
+            metaBlkDimDbg.w <<= 1;
+        }
+    }
+    ADDR_ASSERT((metaBlkDimDbg.w == metaBlkDim.w) && (metaBlkDimDbg.h == metaBlkDim.h));
+#endif
+
+    UINT_32 numMetaBlkX = (pIn->unalignedWidth  + metaBlkDim.w - 1) / metaBlkDim.w;
+    UINT_32 numMetaBlkY = (pIn->unalignedHeight + metaBlkDim.h - 1) / metaBlkDim.h;
+    UINT_32 numMetaBlkZ = Max(pIn->numSlices, 1u);
+
+    UINT_32 sizeAlign = numPipeTotal * numRbTotal * m_pipeInterleaveBytes;
+
+    if (m_settings.metaBaseAlignFix)
+    {
+        sizeAlign = Max(sizeAlign, GetBlockSize(pIn->swizzleMode));
+    }
+
+    pOut->pitch      = numMetaBlkX * metaBlkDim.w;
+    pOut->height     = numMetaBlkY * metaBlkDim.h;
+    pOut->sliceSize  = (numMetaBlkX * numMetaBlkY * numCompressBlkPerMetaBlk) >> 1;
+    pOut->cmaskBytes = PowTwoAlign(pOut->sliceSize * numMetaBlkZ, sizeAlign);
+    pOut->baseAlign  = Max(numCompressBlkPerMetaBlk >> 1, sizeAlign);
+
+    pOut->metaBlkWidth = metaBlkDim.w;
+    pOut->metaBlkHeight = metaBlkDim.h;
+
+    pOut->metaBlkNumPerSlice = numMetaBlkX * numMetaBlkY;
+
+    return ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::GetMetaMipInfo
+*
+*   @brief
+*       Get meta mip info
+*
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::GetMetaMipInfo(
+    UINT_32 numMipLevels,           ///< [in]  number of mip levels
+    Dim3d* pMetaBlkDim,             ///< [in]  meta block dimension
+    BOOL_32 dataThick,              ///< [in]  data surface is thick
+    ADDR2_META_MIP_INFO* pInfo,     ///< [out] meta mip info
+    UINT_32 mip0Width,              ///< [in]  mip0 width
+    UINT_32 mip0Height,             ///< [in]  mip0 height
+    UINT_32 mip0Depth,              ///< [in]  mip0 depth
+    UINT_32* pNumMetaBlkX,          ///< [out] number of metablock X in mipchain
+    UINT_32* pNumMetaBlkY,          ///< [out] number of metablock Y in mipchain
+    UINT_32* pNumMetaBlkZ)          ///< [out] number of metablock Z in mipchain
+    const
+{
+    UINT_32 numMetaBlkX = (mip0Width  + pMetaBlkDim->w - 1) / pMetaBlkDim->w;
+    UINT_32 numMetaBlkY = (mip0Height + pMetaBlkDim->h - 1) / pMetaBlkDim->h;
+    UINT_32 numMetaBlkZ = (mip0Depth  + pMetaBlkDim->d - 1) / pMetaBlkDim->d;
+    UINT_32 tailWidth   = pMetaBlkDim->w;
+    UINT_32 tailHeight  = pMetaBlkDim->h >> 1;
+    UINT_32 tailDepth   = pMetaBlkDim->d;
+    BOOL_32 inTail      = FALSE;
+    AddrMajorMode major = ADDR_MAJOR_MAX_TYPE;
+
+    if (numMipLevels > 1)
+    {
+        if (dataThick && (numMetaBlkZ > numMetaBlkX) && (numMetaBlkZ > numMetaBlkY))
+        {
+            // Z major
+            major = ADDR_MAJOR_Z;
+        }
+        else if (numMetaBlkX >= numMetaBlkY)
+        {
+            // X major
+            major = ADDR_MAJOR_X;
+        }
+        else
+        {
+            // Y major
+            major = ADDR_MAJOR_Y;
+        }
+
+        inTail = ((mip0Width <= tailWidth) &&
+                  (mip0Height <= tailHeight) &&
+                  ((dataThick == FALSE) || (mip0Depth <= tailDepth)));
+
+        if (inTail == FALSE)
+        {
+            UINT_32 orderLimit;
+            UINT_32 *pMipDim;
+            UINT_32 *pOrderDim;
+
+            if (major == ADDR_MAJOR_Z)
+            {
+                // Z major
+                pMipDim = &numMetaBlkY;
+                pOrderDim = &numMetaBlkZ;
+                orderLimit = 4;
+            }
+            else if (major == ADDR_MAJOR_X)
+            {
+                // X major
+                pMipDim = &numMetaBlkY;
+                pOrderDim = &numMetaBlkX;
+                orderLimit = 4;
+            }
+            else
+            {
+                // Y major
+                pMipDim = &numMetaBlkX;
+                pOrderDim = &numMetaBlkY;
+                orderLimit = 2;
+            }
+
+            if ((*pMipDim < 3) && (*pOrderDim > orderLimit) && (numMipLevels > 3))
+            {
+                *pMipDim += 2;
+            }
+            else
+            {
+                *pMipDim += ((*pMipDim / 2) + (*pMipDim & 1));
+            }
+        }
+    }
+
+    if (pInfo != NULL)
+    {
+        UINT_32 mipWidth  = mip0Width;
+        UINT_32 mipHeight = mip0Height;
+        UINT_32 mipDepth  = mip0Depth;
+        Dim3d   mipCoord  = {0};
+
+        for (UINT_32 mip = 0; mip < numMipLevels; mip++)
+        {
+            if (inTail)
+            {
+                GetMetaMiptailInfo(&pInfo[mip], mipCoord, numMipLevels - mip,
+                                   pMetaBlkDim);
+                break;
+            }
+            else
+            {
+                mipWidth  = PowTwoAlign(mipWidth, pMetaBlkDim->w);
+                mipHeight = PowTwoAlign(mipHeight, pMetaBlkDim->h);
+                mipDepth  = PowTwoAlign(mipDepth, pMetaBlkDim->d);
+
+                pInfo[mip].inMiptail = FALSE;
+                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  = dataThick ? mipDepth : 1;
+
+                if ((mip >= 3) || (mip & 1))
+                {
+                    switch (major)
+                    {
+                        case ADDR_MAJOR_X:
+                            mipCoord.w += mipWidth;
+                            break;
+                        case ADDR_MAJOR_Y:
+                            mipCoord.h += mipHeight;
+                            break;
+                        case ADDR_MAJOR_Z:
+                            mipCoord.d += mipDepth;
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                else
+                {
+                    switch (major)
+                    {
+                        case ADDR_MAJOR_X:
+                            mipCoord.h += mipHeight;
+                            break;
+                        case ADDR_MAJOR_Y:
+                            mipCoord.w += mipWidth;
+                            break;
+                        case ADDR_MAJOR_Z:
+                            mipCoord.h += mipHeight;
+                            break;
+                        default:
+                            break;
+                    }
+                }
+
+                mipWidth  = Max(mipWidth >> 1, 1u);
+                mipHeight = Max(mipHeight >> 1, 1u);
+                mipDepth = Max(mipDepth >> 1, 1u);
+
+                inTail = ((mipWidth <= tailWidth) &&
+                          (mipHeight <= tailHeight) &&
+                          ((dataThick == FALSE) || (mipDepth <= tailDepth)));
+            }
+        }
+    }
+
+    *pNumMetaBlkX = numMetaBlkX;
+    *pNumMetaBlkY = numMetaBlkY;
+    *pNumMetaBlkZ = numMetaBlkZ;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeDccInfo
+*
+*   @brief
+*       Interface function to compute DCC key info
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeDccInfo(
+    const ADDR2_COMPUTE_DCCINFO_INPUT*    pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_DCCINFO_OUTPUT*         pOut    ///< [out] output structure
+    ) const
+{
+    BOOL_32 dataLinear = IsLinear(pIn->swizzleMode);
+    BOOL_32 metaLinear = pIn->dccKeyFlags.linear;
+    BOOL_32 pipeAligned = pIn->dccKeyFlags.pipeAligned;
+
+    if (dataLinear)
+    {
+        metaLinear = TRUE;
+    }
+    else if (metaLinear == TRUE)
+    {
+        pipeAligned = FALSE;
+    }
+
+    UINT_32 numPipeTotal = GetPipeNumForMetaAddressing(pipeAligned, pIn->swizzleMode);
+
+    if (metaLinear)
+    {
+        // Linear metadata supporting was removed for GFX9! No one can use this feature on GFX9.
+        ADDR_ASSERT_ALWAYS();
+
+        pOut->dccRamBaseAlign = numPipeTotal * m_pipeInterleaveBytes;
+        pOut->dccRamSize = PowTwoAlign((pIn->dataSurfaceSize / 256), pOut->dccRamBaseAlign);
+    }
+    else
+    {
+        BOOL_32 dataThick = IsThick(pIn->resourceType, pIn->swizzleMode);
+
+        UINT_32 minMetaBlkSize = dataThick ? 65536 : 4096;
+
+        UINT_32 numFrags = Max(pIn->numFrags, 1u);
+        UINT_32 numSlices = Max(pIn->numSlices, 1u);
+
+        minMetaBlkSize /= numFrags;
+
+        UINT_32 numCompressBlkPerMetaBlk = minMetaBlkSize;
+
+        UINT_32 numRbTotal = pIn->dccKeyFlags.rbAligned ? m_se * m_rbPerSe : 1;
+
+        if ((numPipeTotal > 1) || (numRbTotal > 1))
+        {
+            const UINT_32 thinBlkSize = 1 << (m_settings.applyAliasFix ? Max(10u, m_pipeInterleaveLog2) : 10);
+
+            numCompressBlkPerMetaBlk =
+                Max(numCompressBlkPerMetaBlk, m_se * m_rbPerSe * (dataThick ? 262144 : thinBlkSize));
+
+            if (numCompressBlkPerMetaBlk > 65536 * pIn->bpp)
+            {
+                numCompressBlkPerMetaBlk = 65536 * pIn->bpp;
+            }
+        }
+
+        Dim3d compressBlkDim = GetDccCompressBlk(pIn->resourceType, pIn->swizzleMode, pIn->bpp);
+        Dim3d metaBlkDim = compressBlkDim;
+
+        for (UINT_32 index = 1; index < numCompressBlkPerMetaBlk; index <<= 1)
+        {
+            if ((metaBlkDim.h < metaBlkDim.w) ||
+                ((pIn->numMipLevels > 1) && (metaBlkDim.h == metaBlkDim.w)))
+            {
+                if ((dataThick == FALSE) || (metaBlkDim.h <= metaBlkDim.d))
+                {
+                    metaBlkDim.h <<= 1;
+                }
+                else
+                {
+                    metaBlkDim.d <<= 1;
+                }
+            }
+            else
+            {
+                if ((dataThick == FALSE) || (metaBlkDim.w <= metaBlkDim.d))
+                {
+                    metaBlkDim.w <<= 1;
+                }
+                else
+                {
+                    metaBlkDim.d <<= 1;
+                }
+            }
+        }
+
+        UINT_32 numMetaBlkX;
+        UINT_32 numMetaBlkY;
+        UINT_32 numMetaBlkZ;
+
+        GetMetaMipInfo(pIn->numMipLevels, &metaBlkDim, dataThick, pOut->pMipInfo,
+                       pIn->unalignedWidth, pIn->unalignedHeight, numSlices,
+                       &numMetaBlkX, &numMetaBlkY, &numMetaBlkZ);
+
+        UINT_32 sizeAlign = numPipeTotal * numRbTotal * m_pipeInterleaveBytes;
+
+        if (numFrags > m_maxCompFrag)
+        {
+            sizeAlign *= (numFrags / m_maxCompFrag);
+        }
+
+        if (m_settings.metaBaseAlignFix)
+        {
+            sizeAlign = Max(sizeAlign, GetBlockSize(pIn->swizzleMode));
+        }
+
+        pOut->dccRamSize = numMetaBlkX * numMetaBlkY * numMetaBlkZ *
+                           numCompressBlkPerMetaBlk * numFrags;
+        pOut->dccRamSize = PowTwoAlign(pOut->dccRamSize, sizeAlign);
+        pOut->dccRamBaseAlign = Max(numCompressBlkPerMetaBlk, sizeAlign);
+
+        pOut->pitch = numMetaBlkX * metaBlkDim.w;
+        pOut->height = numMetaBlkY * metaBlkDim.h;
+        pOut->depth = numMetaBlkZ * metaBlkDim.d;
+
+        pOut->compressBlkWidth = compressBlkDim.w;
+        pOut->compressBlkHeight = compressBlkDim.h;
+        pOut->compressBlkDepth = compressBlkDim.d;
+
+        pOut->metaBlkWidth = metaBlkDim.w;
+        pOut->metaBlkHeight = metaBlkDim.h;
+        pOut->metaBlkDepth = metaBlkDim.d;
+
+        pOut->metaBlkNumPerSlice = numMetaBlkX * numMetaBlkY;
+        pOut->fastClearSizePerSlice =
+            pOut->metaBlkNumPerSlice * numCompressBlkPerMetaBlk * Min(numFrags, m_maxCompFrag);
+    }
+
+    return ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeMaxBaseAlignments
+*
+*   @brief
+*       Gets maximum alignments
+*   @return
+*       maximum alignments
+************************************************************************************************************************
+*/
+UINT_32 Gfx9Lib::HwlComputeMaxBaseAlignments() const
+{
+    return ComputeSurfaceBaseAlignTiled(ADDR_SW_64KB);
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeMaxMetaBaseAlignments
+*
+*   @brief
+*       Gets maximum alignments for metadata
+*   @return
+*       maximum alignments for metadata
+************************************************************************************************************************
+*/
+UINT_32 Gfx9Lib::HwlComputeMaxMetaBaseAlignments() const
+{
+    // Max base alignment for Htile
+    const UINT_32 maxNumPipeTotal = GetPipeNumForMetaAddressing(TRUE, ADDR_SW_64KB_Z);
+    const UINT_32 maxNumRbTotal   = m_se * m_rbPerSe;
+
+    // If applyAliasFix was set, the extra bits should be MAX(10u, m_pipeInterleaveLog2),
+    // but we never saw any ASIC whose m_pipeInterleaveLog2 != 8, so just put an assertion and simply the logic.
+    ADDR_ASSERT((m_settings.applyAliasFix == FALSE) || (m_pipeInterleaveLog2 <= 10u));
+    const UINT_32 maxNumCompressBlkPerMetaBlk = 1u << (m_seLog2 + m_rbPerSeLog2 + 10u);
+
+    UINT_32 maxBaseAlignHtile = maxNumPipeTotal * maxNumRbTotal * m_pipeInterleaveBytes;
+
+    if (maxNumPipeTotal > 2)
+    {
+        maxBaseAlignHtile *= (maxNumPipeTotal >> 1);
+    }
+
+    maxBaseAlignHtile = Max(maxNumCompressBlkPerMetaBlk << 2, maxBaseAlignHtile);
+
+    if (m_settings.metaBaseAlignFix)
+    {
+        maxBaseAlignHtile = Max(maxBaseAlignHtile, GetBlockSize(ADDR_SW_64KB));
+    }
+
+    if (m_settings.htileAlignFix)
+    {
+        maxBaseAlignHtile *= maxNumPipeTotal;
+    }
+
+    // Max base alignment for Cmask will not be larger than that for Htile, no need to calculate
+
+    // Max base alignment for 2D Dcc will not be larger than that for 3D, no need to calculate
+    UINT_32 maxBaseAlignDcc3D = 65536;
+
+    if ((maxNumPipeTotal > 1) || (maxNumRbTotal > 1))
+    {
+        maxBaseAlignDcc3D = Min(m_se * m_rbPerSe * 262144, 65536 * 128u);
+    }
+
+    // Max base alignment for Msaa Dcc
+    UINT_32 maxBaseAlignDccMsaa = maxNumPipeTotal * maxNumRbTotal * m_pipeInterleaveBytes * (8 / m_maxCompFrag);
+
+    if (m_settings.metaBaseAlignFix)
+    {
+        maxBaseAlignDccMsaa = Max(maxBaseAlignDccMsaa, GetBlockSize(ADDR_SW_64KB));
+    }
+
+    return Max(maxBaseAlignHtile, Max(maxBaseAlignDccMsaa, maxBaseAlignDcc3D));
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeCmaskAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskAddrFromCoord(
+    const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*        pOut)   ///< [out] output structure
+{
+    ADDR2_COMPUTE_CMASK_INFO_INPUT input = {0};
+    input.size            = sizeof(input);
+    input.cMaskFlags      = pIn->cMaskFlags;
+    input.colorFlags      = pIn->colorFlags;
+    input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
+    input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
+    input.numSlices       = Max(pIn->numSlices, 1u);
+    input.swizzleMode     = pIn->swizzleMode;
+    input.resourceType    = pIn->resourceType;
+
+    ADDR2_COMPUTE_CMASK_INFO_OUTPUT output = {0};
+    output.size = sizeof(output);
+
+    ADDR_E_RETURNCODE returnCode = ComputeCmaskInfo(&input, &output);
+
+    if (returnCode == ADDR_OK)
+    {
+        UINT_32 fmaskBpp              = GetFmaskBpp(pIn->numSamples, pIn->numFrags);
+        UINT_32 fmaskElementBytesLog2 = Log2(fmaskBpp >> 3);
+        UINT_32 metaBlkWidthLog2      = Log2(output.metaBlkWidth);
+        UINT_32 metaBlkHeightLog2     = Log2(output.metaBlkHeight);
+
+        MetaEqParams metaEqParams = {0, fmaskElementBytesLog2, 0, pIn->cMaskFlags,
+                                     Gfx9DataFmask, pIn->swizzleMode, pIn->resourceType,
+                                     metaBlkWidthLog2, metaBlkHeightLog2, 0, 3, 3, 0};
+
+        const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
+
+        UINT_32 xb = pIn->x / output.metaBlkWidth;
+        UINT_32 yb = pIn->y / output.metaBlkHeight;
+        UINT_32 zb = pIn->slice;
+
+        UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
+        UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
+        UINT_32 blockIndex       = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
+
+        UINT_64 address = pMetaEq->solve(pIn->x, pIn->y, pIn->slice, 0, blockIndex);
+
+        pOut->addr = address >> 1;
+        pOut->bitPosition = static_cast<UINT_32>((address & 1) << 2);
+
+        UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->cMaskFlags.pipeAligned,
+                                                           pIn->swizzleMode);
+
+        UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
+
+        pOut->addr ^= (pipeXor << m_pipeInterleaveLog2);
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeHtileAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeHtileAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileAddrFromCoord(
+    const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*        pOut)   ///< [out] output structure
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pIn->numMipLevels > 1)
+    {
+        returnCode = ADDR_NOTIMPLEMENTED;
+    }
+    else
+    {
+        ADDR2_COMPUTE_HTILE_INFO_INPUT input = {0};
+        input.size            = sizeof(input);
+        input.hTileFlags      = pIn->hTileFlags;
+        input.depthFlags      = pIn->depthflags;
+        input.swizzleMode     = pIn->swizzleMode;
+        input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
+        input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
+        input.numSlices       = Max(pIn->numSlices, 1u);
+        input.numMipLevels    = Max(pIn->numMipLevels, 1u);
+
+        ADDR2_COMPUTE_HTILE_INFO_OUTPUT output = {0};
+        output.size = sizeof(output);
+
+        returnCode = ComputeHtileInfo(&input, &output);
+
+        if (returnCode == ADDR_OK)
+        {
+            UINT_32 elementBytesLog2  = Log2(pIn->bpp >> 3);
+            UINT_32 metaBlkWidthLog2  = Log2(output.metaBlkWidth);
+            UINT_32 metaBlkHeightLog2 = Log2(output.metaBlkHeight);
+            UINT_32 numSamplesLog2    = Log2(pIn->numSamples);
+
+            MetaEqParams metaEqParams = {0, elementBytesLog2, numSamplesLog2, pIn->hTileFlags,
+                                         Gfx9DataDepthStencil, pIn->swizzleMode, ADDR_RSRC_TEX_2D,
+                                         metaBlkWidthLog2, metaBlkHeightLog2, 0, 3, 3, 0};
+
+            const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
+
+            UINT_32 xb = pIn->x / output.metaBlkWidth;
+            UINT_32 yb = pIn->y / output.metaBlkHeight;
+            UINT_32 zb = pIn->slice;
+
+            UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
+            UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
+            UINT_32 blockIndex       = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
+
+            UINT_64 address = pMetaEq->solve(pIn->x, pIn->y, pIn->slice, 0, blockIndex);
+
+            pOut->addr = address >> 1;
+
+            UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->hTileFlags.pipeAligned,
+                                                               pIn->swizzleMode);
+
+            UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
+
+            pOut->addr ^= (pipeXor << m_pipeInterleaveLog2);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeHtileCoordFromAddr
+*
+*   @brief
+*       Interface function stub of AddrComputeHtileCoordFromAddr
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileCoordFromAddr(
+    const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
+    ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*        pOut)   ///< [out] output structure
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (pIn->numMipLevels > 1)
+    {
+        returnCode = ADDR_NOTIMPLEMENTED;
+    }
+    else
+    {
+        ADDR2_COMPUTE_HTILE_INFO_INPUT input = {0};
+        input.size            = sizeof(input);
+        input.hTileFlags      = pIn->hTileFlags;
+        input.swizzleMode     = pIn->swizzleMode;
+        input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
+        input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
+        input.numSlices       = Max(pIn->numSlices, 1u);
+        input.numMipLevels    = Max(pIn->numMipLevels, 1u);
+
+        ADDR2_COMPUTE_HTILE_INFO_OUTPUT output = {0};
+        output.size = sizeof(output);
+
+        returnCode = ComputeHtileInfo(&input, &output);
+
+        if (returnCode == ADDR_OK)
+        {
+            UINT_32 elementBytesLog2  = Log2(pIn->bpp >> 3);
+            UINT_32 metaBlkWidthLog2  = Log2(output.metaBlkWidth);
+            UINT_32 metaBlkHeightLog2 = Log2(output.metaBlkHeight);
+            UINT_32 numSamplesLog2    = Log2(pIn->numSamples);
+
+            MetaEqParams metaEqParams = {0, elementBytesLog2, numSamplesLog2, pIn->hTileFlags,
+                                         Gfx9DataDepthStencil, pIn->swizzleMode, ADDR_RSRC_TEX_2D,
+                                         metaBlkWidthLog2, metaBlkHeightLog2, 0, 3, 3, 0};
+
+            const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
+
+            UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->hTileFlags.pipeAligned,
+                                                               pIn->swizzleMode);
+
+            UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
+
+            UINT_64 nibbleAddress = (pIn->addr ^ (pipeXor << m_pipeInterleaveLog2)) << 1;
+
+            UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
+            UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
+
+            UINT_32 x, y, z, s, m;
+            pMetaEq->solveAddr(nibbleAddress, sliceSizeInBlock, x, y, z, s, m);
+
+            pOut->slice = m / sliceSizeInBlock;
+            pOut->y     = ((m % sliceSizeInBlock) / pitchInBlock) * output.metaBlkHeight + y;
+            pOut->x     = (m % pitchInBlock) * output.metaBlkWidth + x;
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeDccAddrFromCoord
+*
+*   @brief
+*       Interface function stub of AddrComputeDccAddrFromCoord
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeDccAddrFromCoord(
+    const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT*  pIn,
+    ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut)
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if ((pIn->numMipLevels > 1) || (pIn->mipId > 1) || pIn->dccKeyFlags.linear)
+    {
+        returnCode = ADDR_NOTIMPLEMENTED;
+    }
+    else
+    {
+        ADDR2_COMPUTE_DCCINFO_INPUT input = {0};
+        input.size            = sizeof(input);
+        input.dccKeyFlags     = pIn->dccKeyFlags;
+        input.colorFlags      = pIn->colorFlags;
+        input.swizzleMode     = pIn->swizzleMode;
+        input.resourceType    = pIn->resourceType;
+        input.bpp             = pIn->bpp;
+        input.unalignedWidth  = Max(pIn->unalignedWidth, 1u);
+        input.unalignedHeight = Max(pIn->unalignedHeight, 1u);
+        input.numSlices       = Max(pIn->numSlices, 1u);
+        input.numFrags        = Max(pIn->numFrags, 1u);
+        input.numMipLevels    = Max(pIn->numMipLevels, 1u);
+
+        ADDR2_COMPUTE_DCCINFO_OUTPUT output = {0};
+        output.size = sizeof(output);
+
+        returnCode = ComputeDccInfo(&input, &output);
+
+        if (returnCode == ADDR_OK)
+        {
+            UINT_32 elementBytesLog2  = Log2(pIn->bpp >> 3);
+            UINT_32 numSamplesLog2    = Log2(pIn->numFrags);
+            UINT_32 metaBlkWidthLog2  = Log2(output.metaBlkWidth);
+            UINT_32 metaBlkHeightLog2 = Log2(output.metaBlkHeight);
+            UINT_32 metaBlkDepthLog2  = Log2(output.metaBlkDepth);
+            UINT_32 compBlkWidthLog2  = Log2(output.compressBlkWidth);
+            UINT_32 compBlkHeightLog2 = Log2(output.compressBlkHeight);
+            UINT_32 compBlkDepthLog2  = Log2(output.compressBlkDepth);
+
+            MetaEqParams metaEqParams = {pIn->mipId, elementBytesLog2, numSamplesLog2, pIn->dccKeyFlags,
+                                         Gfx9DataColor, pIn->swizzleMode, pIn->resourceType,
+                                         metaBlkWidthLog2, metaBlkHeightLog2, metaBlkDepthLog2,
+                                         compBlkWidthLog2, compBlkHeightLog2, compBlkDepthLog2};
+
+            const CoordEq* pMetaEq = GetMetaEquation(metaEqParams);
+
+            UINT_32 xb = pIn->x / output.metaBlkWidth;
+            UINT_32 yb = pIn->y / output.metaBlkHeight;
+            UINT_32 zb = pIn->slice / output.metaBlkDepth;
+
+            UINT_32 pitchInBlock     = output.pitch / output.metaBlkWidth;
+            UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock;
+            UINT_32 blockIndex       = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
+
+            UINT_64 address = pMetaEq->solve(pIn->x, pIn->y, pIn->slice, pIn->sample, blockIndex);
+
+            pOut->addr = address >> 1;
+
+            UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->dccKeyFlags.pipeAligned,
+                                                               pIn->swizzleMode);
+
+            UINT_64 pipeXor = static_cast<UINT_64>(pIn->pipeXor & ((1 << numPipeBits) - 1));
+
+            pOut->addr ^= (pipeXor << m_pipeInterleaveLog2);
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlInitGlobalParams
+*
+*   @brief
+*       Initializes global parameters
+*
+*   @return
+*       TRUE if all settings are valid
+*
+************************************************************************************************************************
+*/
+BOOL_32 Gfx9Lib::HwlInitGlobalParams(
+    const ADDR_CREATE_INPUT* pCreateIn) ///< [in] create input
+{
+    BOOL_32 valid = TRUE;
+
+    if (m_settings.isArcticIsland)
+    {
+        GB_ADDR_CONFIG gbAddrConfig;
+
+        gbAddrConfig.u32All = pCreateIn->regValue.gbAddrConfig;
+
+        // These values are copied from CModel code
+        switch (gbAddrConfig.bits.NUM_PIPES)
+        {
+            case ADDR_CONFIG_1_PIPE:
+                m_pipes = 1;
+                m_pipesLog2 = 0;
+                break;
+            case ADDR_CONFIG_2_PIPE:
+                m_pipes = 2;
+                m_pipesLog2 = 1;
+                break;
+            case ADDR_CONFIG_4_PIPE:
+                m_pipes = 4;
+                m_pipesLog2 = 2;
+                break;
+            case ADDR_CONFIG_8_PIPE:
+                m_pipes = 8;
+                m_pipesLog2 = 3;
+                break;
+            case ADDR_CONFIG_16_PIPE:
+                m_pipes = 16;
+                m_pipesLog2 = 4;
+                break;
+            case ADDR_CONFIG_32_PIPE:
+                m_pipes = 32;
+                m_pipesLog2 = 5;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        switch (gbAddrConfig.bits.PIPE_INTERLEAVE_SIZE)
+        {
+            case ADDR_CONFIG_PIPE_INTERLEAVE_256B:
+                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_256B;
+                m_pipeInterleaveLog2 = 8;
+                break;
+            case ADDR_CONFIG_PIPE_INTERLEAVE_512B:
+                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_512B;
+                m_pipeInterleaveLog2 = 9;
+                break;
+            case ADDR_CONFIG_PIPE_INTERLEAVE_1KB:
+                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_1KB;
+                m_pipeInterleaveLog2 = 10;
+                break;
+            case ADDR_CONFIG_PIPE_INTERLEAVE_2KB:
+                m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_2KB;
+                m_pipeInterleaveLog2 = 11;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        // Addr::V2::Lib::ComputePipeBankXor()/ComputeSlicePipeBankXor() requires pipe interleave to be exactly 8 bits,
+        // and any larger value requires a post-process (left shift) on the output pipeBankXor bits.
+        ADDR_ASSERT(m_pipeInterleaveBytes == ADDR_PIPEINTERLEAVE_256B);
+
+        switch (gbAddrConfig.bits.NUM_BANKS)
+        {
+            case ADDR_CONFIG_1_BANK:
+                m_banks = 1;
+                m_banksLog2 = 0;
+                break;
+            case ADDR_CONFIG_2_BANK:
+                m_banks = 2;
+                m_banksLog2 = 1;
+                break;
+            case ADDR_CONFIG_4_BANK:
+                m_banks = 4;
+                m_banksLog2 = 2;
+                break;
+            case ADDR_CONFIG_8_BANK:
+                m_banks = 8;
+                m_banksLog2 = 3;
+                break;
+            case ADDR_CONFIG_16_BANK:
+                m_banks = 16;
+                m_banksLog2 = 4;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        switch (gbAddrConfig.bits.NUM_SHADER_ENGINES)
+        {
+            case ADDR_CONFIG_1_SHADER_ENGINE:
+                m_se = 1;
+                m_seLog2 = 0;
+                break;
+            case ADDR_CONFIG_2_SHADER_ENGINE:
+                m_se = 2;
+                m_seLog2 = 1;
+                break;
+            case ADDR_CONFIG_4_SHADER_ENGINE:
+                m_se = 4;
+                m_seLog2 = 2;
+                break;
+            case ADDR_CONFIG_8_SHADER_ENGINE:
+                m_se = 8;
+                m_seLog2 = 3;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        switch (gbAddrConfig.bits.NUM_RB_PER_SE)
+        {
+            case ADDR_CONFIG_1_RB_PER_SHADER_ENGINE:
+                m_rbPerSe = 1;
+                m_rbPerSeLog2 = 0;
+                break;
+            case ADDR_CONFIG_2_RB_PER_SHADER_ENGINE:
+                m_rbPerSe = 2;
+                m_rbPerSeLog2 = 1;
+                break;
+            case ADDR_CONFIG_4_RB_PER_SHADER_ENGINE:
+                m_rbPerSe = 4;
+                m_rbPerSeLog2 = 2;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        switch (gbAddrConfig.bits.MAX_COMPRESSED_FRAGS)
+        {
+            case ADDR_CONFIG_1_MAX_COMPRESSED_FRAGMENTS:
+                m_maxCompFrag = 1;
+                m_maxCompFragLog2 = 0;
+                break;
+            case ADDR_CONFIG_2_MAX_COMPRESSED_FRAGMENTS:
+                m_maxCompFrag = 2;
+                m_maxCompFragLog2 = 1;
+                break;
+            case ADDR_CONFIG_4_MAX_COMPRESSED_FRAGMENTS:
+                m_maxCompFrag = 4;
+                m_maxCompFragLog2 = 2;
+                break;
+            case ADDR_CONFIG_8_MAX_COMPRESSED_FRAGMENTS:
+                m_maxCompFrag = 8;
+                m_maxCompFragLog2 = 3;
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        m_blockVarSizeLog2 = pCreateIn->regValue.blockVarSizeLog2;
+        ADDR_ASSERT((m_blockVarSizeLog2 == 0) ||
+                    ((m_blockVarSizeLog2 >= 17u) && (m_blockVarSizeLog2 <= 20u)));
+        m_blockVarSizeLog2 = Min(Max(17u, m_blockVarSizeLog2), 20u);
+
+        if ((m_rbPerSeLog2 == 1) &&
+            (((m_pipesLog2 == 1) && ((m_seLog2 == 2) || (m_seLog2 == 3))) ||
+             ((m_pipesLog2 == 2) && ((m_seLog2 == 1) || (m_seLog2 == 2)))))
+        {
+            ADDR_ASSERT(m_settings.isVega10 == FALSE);
+            ADDR_ASSERT(m_settings.isRaven == FALSE);
+            ADDR_ASSERT(m_settings.isVega20 == FALSE);
+
+            if (m_settings.isVega12)
+            {
+                m_settings.htileCacheRbConflict = 1;
+            }
+        }
+    }
+    else
+    {
+        valid = FALSE;
+        ADDR_NOT_IMPLEMENTED();
+    }
+
+    if (valid)
+    {
+        InitEquationTable();
+    }
+
+    return valid;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlConvertChipFamily
+*
+*   @brief
+*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
+*   @return
+*       ChipFamily
+************************************************************************************************************************
+*/
+ChipFamily Gfx9Lib::HwlConvertChipFamily(
+    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
+    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
+{
+    ChipFamily family = ADDR_CHIP_FAMILY_AI;
+
+    switch (uChipFamily)
+    {
+        case FAMILY_AI:
+            m_settings.isArcticIsland = 1;
+            m_settings.isVega10 = ASICREV_IS_VEGA10_P(uChipRevision);
+            m_settings.isVega12 = ASICREV_IS_VEGA12_P(uChipRevision);
+            m_settings.isVega20 = ASICREV_IS_VEGA20_P(uChipRevision);
+            m_settings.isDce12 = 1;
+
+            if (m_settings.isVega10 == 0)
+            {
+                m_settings.htileAlignFix = 1;
+                m_settings.applyAliasFix = 1;
+            }
+
+            m_settings.metaBaseAlignFix = 1;
+
+            m_settings.depthPipeXorDisable = 1;
+            break;
+        case FAMILY_RV:
+            m_settings.isArcticIsland = 1;
+
+            if (ASICREV_IS_RAVEN(uChipRevision))
+            {
+                m_settings.isRaven = 1;
+
+                m_settings.depthPipeXorDisable = 1;
+            }
+
+            if (ASICREV_IS_RAVEN2(uChipRevision))
+            {
+                m_settings.isRaven = 1;
+            }
+
+            if (m_settings.isRaven == 0)
+            {
+                m_settings.htileAlignFix = 1;
+                m_settings.applyAliasFix = 1;
+            }
+
+            m_settings.isDcn1 = m_settings.isRaven;
+
+            m_settings.metaBaseAlignFix = 1;
+            break;
+
+        default:
+            ADDR_ASSERT(!"This should be a Fusion");
+            break;
+    }
+
+    return family;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::InitRbEquation
+*
+*   @brief
+*       Init RB equation
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::GetRbEquation(
+    CoordEq* pRbEq,             ///< [out] rb equation
+    UINT_32  numRbPerSeLog2,    ///< [in] number of rb per shader engine
+    UINT_32  numSeLog2)         ///< [in] number of shader engine
+    const
+{
+    // RB's are distributed on 16x16, except when we have 1 rb per se, in which case its 32x32
+    UINT_32 rbRegion = (numRbPerSeLog2 == 0) ? 5 : 4;
+    Coordinate cx('x', rbRegion);
+    Coordinate cy('y', rbRegion);
+
+    UINT_32 start = 0;
+    UINT_32 numRbTotalLog2 = numRbPerSeLog2 + numSeLog2;
+
+    // Clear the rb equation
+    pRbEq->resize(0);
+    pRbEq->resize(numRbTotalLog2);
+
+    if ((numSeLog2 > 0) && (numRbPerSeLog2 == 1))
+    {
+        // Special case when more than 1 SE, and 2 RB per SE
+        (*pRbEq)[0].add(cx);
+        (*pRbEq)[0].add(cy);
+        cx++;
+        cy++;
+
+        if (m_settings.applyAliasFix == false)
+        {
+            (*pRbEq)[0].add(cy);
+        }
+
+        (*pRbEq)[0].add(cy);
+        start++;
+    }
+
+    UINT_32 numBits = 2 * (numRbTotalLog2 - start);
+
+    for (UINT_32 i = 0; i < numBits; i++)
+    {
+        UINT_32 idx =
+            start + (((start + i) >= numRbTotalLog2) ? (2 * (numRbTotalLog2 - start) - i - 1) : i);
+
+        if ((i % 2) == 1)
+        {
+            (*pRbEq)[idx].add(cx);
+            cx++;
+        }
+        else
+        {
+            (*pRbEq)[idx].add(cy);
+            cy++;
+        }
+    }
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::GetDataEquation
+*
+*   @brief
+*       Get data equation for fmask and Z
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::GetDataEquation(
+    CoordEq* pDataEq,               ///< [out] data surface equation
+    Gfx9DataType dataSurfaceType,   ///< [in] data surface type
+    AddrSwizzleMode swizzleMode,    ///< [in] data surface swizzle mode
+    AddrResourceType resourceType,  ///< [in] data surface resource type
+    UINT_32 elementBytesLog2,       ///< [in] data surface element bytes
+    UINT_32 numSamplesLog2)         ///< [in] data surface sample count
+    const
+{
+    Coordinate cx('x', 0);
+    Coordinate cy('y', 0);
+    Coordinate cz('z', 0);
+    Coordinate cs('s', 0);
+
+    // Clear the equation
+    pDataEq->resize(0);
+    pDataEq->resize(27);
+
+    if (dataSurfaceType == Gfx9DataColor)
+    {
+        if (IsLinear(swizzleMode))
+        {
+            Coordinate cm('m', 0);
+
+            pDataEq->resize(49);
+
+            for (UINT_32 i = 0; i < 49; i++)
+            {
+                (*pDataEq)[i].add(cm);
+                cm++;
+            }
+        }
+        else if (IsThick(resourceType, swizzleMode))
+        {
+            // Color 3d_S and 3d_Z modes, 3d_D is same as color 2d
+            UINT_32 i;
+            if (IsStandardSwizzle(resourceType, swizzleMode))
+            {
+                // Standard 3d swizzle
+                // Fill in bottom x bits
+                for (i = elementBytesLog2; i < 4; i++)
+                {
+                    (*pDataEq)[i].add(cx);
+                    cx++;
+                }
+                // Fill in 2 bits of y and then z
+                for (i = 4; i < 6; i++)
+                {
+                    (*pDataEq)[i].add(cy);
+                    cy++;
+                }
+                for (i = 6; i < 8; i++)
+                {
+                    (*pDataEq)[i].add(cz);
+                    cz++;
+                }
+                if (elementBytesLog2 < 2)
+                {
+                    // fill in z & y bit
+                    (*pDataEq)[8].add(cz);
+                    (*pDataEq)[9].add(cy);
+                    cz++;
+                    cy++;
+                }
+                else if (elementBytesLog2 == 2)
+                {
+                    // fill in y and x bit
+                    (*pDataEq)[8].add(cy);
+                    (*pDataEq)[9].add(cx);
+                    cy++;
+                    cx++;
+                }
+                else
+                {
+                    // fill in 2 x bits
+                    (*pDataEq)[8].add(cx);
+                    cx++;
+                    (*pDataEq)[9].add(cx);
+                    cx++;
+                }
+            }
+            else
+            {
+                // Z 3d swizzle
+                UINT_32 m2dEnd = (elementBytesLog2 ==0) ? 3 : ((elementBytesLog2 < 4) ? 4 : 5);
+                UINT_32 numZs = (elementBytesLog2 == 0 || elementBytesLog2 == 4) ?
+                                2 : ((elementBytesLog2 == 1) ? 3 : 1);
+                pDataEq->mort2d(cx, cy, elementBytesLog2, m2dEnd);
+                for (i = m2dEnd + 1; i <= m2dEnd + numZs; i++)
+                {
+                    (*pDataEq)[i].add(cz);
+                    cz++;
+                }
+                if ((elementBytesLog2 == 0) || (elementBytesLog2 == 3))
+                {
+                    // add an x and z
+                    (*pDataEq)[6].add(cx);
+                    (*pDataEq)[7].add(cz);
+                    cx++;
+                    cz++;
+                }
+                else if (elementBytesLog2 == 2)
+                {
+                    // add a y and z
+                    (*pDataEq)[6].add(cy);
+                    (*pDataEq)[7].add(cz);
+                    cy++;
+                    cz++;
+                }
+                // add y and x
+                (*pDataEq)[8].add(cy);
+                (*pDataEq)[9].add(cx);
+                cy++;
+                cx++;
+            }
+            // Fill in bit 10 and up
+            pDataEq->mort3d( cz, cy, cx, 10 );
+        }
+        else if (IsThin(resourceType, swizzleMode))
+        {
+            UINT_32 blockSizeLog2 = GetBlockSizeLog2(swizzleMode);
+            // Color 2D
+            UINT_32 microYBits = (8 - elementBytesLog2) / 2;
+            UINT_32 tileSplitStart = blockSizeLog2 - numSamplesLog2;
+            UINT_32 i;
+            // Fill in bottom x bits
+            for (i = elementBytesLog2; i < 4; i++)
+            {
+                (*pDataEq)[i].add(cx);
+                cx++;
+            }
+            // Fill in bottom y bits
+            for (i = 4; i < 4 + microYBits; i++)
+            {
+                (*pDataEq)[i].add(cy);
+                cy++;
+            }
+            // Fill in last of the micro_x bits
+            for (i = 4 + microYBits; i < 8; i++)
+            {
+                (*pDataEq)[i].add(cx);
+                cx++;
+            }
+            // Fill in x/y bits below sample split
+            pDataEq->mort2d(cy, cx, 8, tileSplitStart - 1);
+            // Fill in sample bits
+            for (i = 0; i < numSamplesLog2; i++)
+            {
+                cs.set('s', i);
+                (*pDataEq)[tileSplitStart + i].add(cs);
+            }
+            // Fill in x/y bits above sample split
+            if ((numSamplesLog2 & 1) ^ (blockSizeLog2 & 1))
+            {
+                pDataEq->mort2d(cx, cy, blockSizeLog2);
+            }
+            else
+            {
+                pDataEq->mort2d(cy, cx, blockSizeLog2);
+            }
+        }
+        else
+        {
+            ADDR_ASSERT_ALWAYS();
+        }
+    }
+    else
+    {
+        // Fmask or depth
+        UINT_32 sampleStart = elementBytesLog2;
+        UINT_32 pixelStart = elementBytesLog2 + numSamplesLog2;
+        UINT_32 ymajStart = 6 + numSamplesLog2;
+
+        for (UINT_32 s = 0; s < numSamplesLog2; s++)
+        {
+            cs.set('s', s);
+            (*pDataEq)[sampleStart + s].add(cs);
+        }
+
+        // Put in the x-major order pixel bits
+        pDataEq->mort2d(cx, cy, pixelStart, ymajStart - 1);
+        // Put in the y-major order pixel bits
+        pDataEq->mort2d(cy, cx, ymajStart);
+    }
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::GetPipeEquation
+*
+*   @brief
+*       Get pipe equation
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::GetPipeEquation(
+    CoordEq*         pPipeEq,            ///< [out] pipe equation
+    CoordEq*         pDataEq,            ///< [in] data equation
+    UINT_32          pipeInterleaveLog2, ///< [in] pipe interleave
+    UINT_32          numPipeLog2,        ///< [in] number of pipes
+    UINT_32          numSamplesLog2,     ///< [in] data surface sample count
+    Gfx9DataType     dataSurfaceType,    ///< [in] data surface type
+    AddrSwizzleMode  swizzleMode,        ///< [in] data surface swizzle mode
+    AddrResourceType resourceType        ///< [in] data surface resource type
+    ) const
+{
+    UINT_32 blockSizeLog2 = GetBlockSizeLog2(swizzleMode);
+    CoordEq dataEq;
+
+    pDataEq->copy(dataEq);
+
+    if (dataSurfaceType == Gfx9DataColor)
+    {
+        INT_32 shift = static_cast<INT_32>(numSamplesLog2);
+        dataEq.shift(-shift, blockSizeLog2 - numSamplesLog2);
+    }
+
+    dataEq.copy(*pPipeEq, pipeInterleaveLog2, numPipeLog2);
+
+    // This section should only apply to z/stencil, maybe fmask
+    // If the pipe bit is below the comp block size,
+    // then keep moving up the address until we find a bit that is above
+    UINT_32 pipeStart = 0;
+
+    if (dataSurfaceType != Gfx9DataColor)
+    {
+        Coordinate tileMin('x', 3);
+
+        while (dataEq[pipeInterleaveLog2 + pipeStart][0] < tileMin)
+        {
+            pipeStart++;
+        }
+
+        // if pipe is 0, then the first pipe bit is above the comp block size,
+        // so we don't need to do anything
+        // Note, this if condition is not necessary, since if we execute the loop when pipe==0,
+        // we will get the same pipe equation
+        if (pipeStart != 0)
+        {
+            for (UINT_32 i = 0; i < numPipeLog2; i++)
+            {
+                // Copy the jth bit above pipe interleave to the current pipe equation bit
+                dataEq[pipeInterleaveLog2 + pipeStart + i].copyto((*pPipeEq)[i]);
+            }
+        }
+    }
+
+    if (IsPrt(swizzleMode))
+    {
+        // Clear out bits above the block size if prt's are enabled
+        dataEq.resize(blockSizeLog2);
+        dataEq.resize(48);
+    }
+
+    if (IsXor(swizzleMode))
+    {
+        CoordEq xorMask;
+
+        if (IsThick(resourceType, swizzleMode))
+        {
+            CoordEq xorMask2;
+
+            dataEq.copy(xorMask2, pipeInterleaveLog2 + numPipeLog2, 2 * numPipeLog2);
+
+            xorMask.resize(numPipeLog2);
+
+            for (UINT_32 pipeIdx = 0; pipeIdx < numPipeLog2; pipeIdx++)
+            {
+                xorMask[pipeIdx].add(xorMask2[2 * pipeIdx]);
+                xorMask[pipeIdx].add(xorMask2[2 * pipeIdx + 1]);
+            }
+        }
+        else
+        {
+            // Xor in the bits above the pipe+gpu bits
+            dataEq.copy(xorMask, pipeInterleaveLog2 + pipeStart + numPipeLog2, numPipeLog2);
+
+            if ((numSamplesLog2 == 0) && (IsPrt(swizzleMode) == FALSE))
+            {
+                Coordinate co;
+                CoordEq xorMask2;
+                // if 1xaa and not prt, then xor in the z bits
+                xorMask2.resize(0);
+                xorMask2.resize(numPipeLog2);
+                for (UINT_32 pipeIdx = 0; pipeIdx < numPipeLog2; pipeIdx++)
+                {
+                    co.set('z', numPipeLog2 - 1 - pipeIdx);
+                    xorMask2[pipeIdx].add(co);
+                }
+
+                pPipeEq->xorin(xorMask2);
+            }
+        }
+
+        xorMask.reverse();
+        pPipeEq->xorin(xorMask);
+    }
+}
+/**
+************************************************************************************************************************
+*   Gfx9Lib::GetMetaEquation
+*
+*   @brief
+*       Get meta equation for cmask/htile/DCC
+*   @return
+*       Pointer to a calculated meta equation
+************************************************************************************************************************
+*/
+const CoordEq* Gfx9Lib::GetMetaEquation(
+    const MetaEqParams& metaEqParams)
+{
+    UINT_32 cachedMetaEqIndex;
+
+    for (cachedMetaEqIndex = 0; cachedMetaEqIndex < MaxCachedMetaEq; cachedMetaEqIndex++)
+    {
+        if (memcmp(&metaEqParams,
+                   &m_cachedMetaEqKey[cachedMetaEqIndex],
+                   static_cast<UINT_32>(sizeof(metaEqParams))) == 0)
+        {
+            break;
+        }
+    }
+
+    CoordEq* pMetaEq = NULL;
+
+    if (cachedMetaEqIndex < MaxCachedMetaEq)
+    {
+        pMetaEq = &m_cachedMetaEq[cachedMetaEqIndex];
+    }
+    else
+    {
+        m_cachedMetaEqKey[m_metaEqOverrideIndex] = metaEqParams;
+
+        pMetaEq = &m_cachedMetaEq[m_metaEqOverrideIndex++];
+
+        m_metaEqOverrideIndex %= MaxCachedMetaEq;
+
+        GenMetaEquation(pMetaEq,
+                        metaEqParams.maxMip,
+                        metaEqParams.elementBytesLog2,
+                        metaEqParams.numSamplesLog2,
+                        metaEqParams.metaFlag,
+                        metaEqParams.dataSurfaceType,
+                        metaEqParams.swizzleMode,
+                        metaEqParams.resourceType,
+                        metaEqParams.metaBlkWidthLog2,
+                        metaEqParams.metaBlkHeightLog2,
+                        metaEqParams.metaBlkDepthLog2,
+                        metaEqParams.compBlkWidthLog2,
+                        metaEqParams.compBlkHeightLog2,
+                        metaEqParams.compBlkDepthLog2);
+    }
+
+    return pMetaEq;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::GenMetaEquation
+*
+*   @brief
+*       Get meta equation for cmask/htile/DCC
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::GenMetaEquation(
+    CoordEq*         pMetaEq,               ///< [out] meta equation
+    UINT_32          maxMip,                ///< [in] max mip Id
+    UINT_32          elementBytesLog2,      ///< [in] data surface element bytes
+    UINT_32          numSamplesLog2,        ///< [in] data surface sample count
+    ADDR2_META_FLAGS metaFlag,              ///< [in] meta falg
+    Gfx9DataType     dataSurfaceType,       ///< [in] data surface type
+    AddrSwizzleMode  swizzleMode,           ///< [in] data surface swizzle mode
+    AddrResourceType resourceType,          ///< [in] data surface resource type
+    UINT_32          metaBlkWidthLog2,      ///< [in] meta block width
+    UINT_32          metaBlkHeightLog2,     ///< [in] meta block height
+    UINT_32          metaBlkDepthLog2,      ///< [in] meta block depth
+    UINT_32          compBlkWidthLog2,      ///< [in] compress block width
+    UINT_32          compBlkHeightLog2,     ///< [in] compress block height
+    UINT_32          compBlkDepthLog2)      ///< [in] compress block depth
+    const
+{
+    UINT_32 numPipeTotalLog2   = GetPipeLog2ForMetaAddressing(metaFlag.pipeAligned, swizzleMode);
+    UINT_32 pipeInterleaveLog2 = m_pipeInterleaveLog2;
+
+    // Get the correct data address and rb equation
+    CoordEq dataEq;
+    GetDataEquation(&dataEq, dataSurfaceType, swizzleMode, resourceType,
+                    elementBytesLog2, numSamplesLog2);
+
+    // Get pipe and rb equations
+    CoordEq pipeEquation;
+    GetPipeEquation(&pipeEquation, &dataEq, pipeInterleaveLog2, numPipeTotalLog2,
+                    numSamplesLog2, dataSurfaceType, swizzleMode, resourceType);
+    numPipeTotalLog2 = pipeEquation.getsize();
+
+    if (metaFlag.linear)
+    {
+        // Linear metadata supporting was removed for GFX9! No one can use this feature.
+        ADDR_ASSERT_ALWAYS();
+
+        ADDR_ASSERT(dataSurfaceType == Gfx9DataColor);
+
+        dataEq.copy(*pMetaEq);
+
+        if (IsLinear(swizzleMode))
+        {
+            if (metaFlag.pipeAligned)
+            {
+                // Remove the pipe bits
+                INT_32 shift = static_cast<INT_32>(numPipeTotalLog2);
+                pMetaEq->shift(-shift, pipeInterleaveLog2);
+            }
+            // Divide by comp block size, which for linear (which is always color) is 256 B
+            pMetaEq->shift(-8);
+
+            if (metaFlag.pipeAligned)
+            {
+                // Put pipe bits back in
+                pMetaEq->shift(numPipeTotalLog2, pipeInterleaveLog2);
+
+                for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
+                {
+                    pipeEquation[i].copyto((*pMetaEq)[pipeInterleaveLog2 + i]);
+                }
+            }
+        }
+
+        pMetaEq->shift(1);
+    }
+    else
+    {
+        UINT_32 maxCompFragLog2 = static_cast<INT_32>(m_maxCompFragLog2);
+        UINT_32 compFragLog2 =
+            ((dataSurfaceType == Gfx9DataColor) && (numSamplesLog2 > maxCompFragLog2)) ?
+            maxCompFragLog2 : numSamplesLog2;
+
+        UINT_32 uncompFragLog2 = numSamplesLog2 - compFragLog2;
+
+        // Make sure the metaaddr is cleared
+        pMetaEq->resize(0);
+        pMetaEq->resize(27);
+
+        if (IsThick(resourceType, swizzleMode))
+        {
+            Coordinate cx('x', 0);
+            Coordinate cy('y', 0);
+            Coordinate cz('z', 0);
+
+            if (maxMip > 0)
+            {
+                pMetaEq->mort3d(cy, cx, cz);
+            }
+            else
+            {
+                pMetaEq->mort3d(cx, cy, cz);
+            }
+        }
+        else
+        {
+            Coordinate cx('x', 0);
+            Coordinate cy('y', 0);
+            Coordinate cs;
+
+            if (maxMip > 0)
+            {
+                pMetaEq->mort2d(cy, cx, compFragLog2);
+            }
+            else
+            {
+                pMetaEq->mort2d(cx, cy, compFragLog2);
+            }
+
+            //------------------------------------------------------------------------------------------------------------------------
+            // Put the compressible fragments at the lsb
+            // the uncompressible frags will be at the msb of the micro address
+            //------------------------------------------------------------------------------------------------------------------------
+            for (UINT_32 s = 0; s < compFragLog2; s++)
+            {
+                cs.set('s', s);
+                (*pMetaEq)[s].add(cs);
+            }
+        }
+
+        // Keep a copy of the pipe equations
+        CoordEq origPipeEquation;
+        pipeEquation.copy(origPipeEquation);
+
+        Coordinate co;
+        // filter out everything under the compressed block size
+        co.set('x', compBlkWidthLog2);
+        pMetaEq->Filter('<', co, 0, 'x');
+        co.set('y', compBlkHeightLog2);
+        pMetaEq->Filter('<', co, 0, 'y');
+        co.set('z', compBlkDepthLog2);
+        pMetaEq->Filter('<', co, 0, 'z');
+
+        // For non-color, filter out sample bits
+        if (dataSurfaceType != Gfx9DataColor)
+        {
+            co.set('x', 0);
+            pMetaEq->Filter('<', co, 0, 's');
+        }
+
+        // filter out everything above the metablock size
+        co.set('x', metaBlkWidthLog2 - 1);
+        pMetaEq->Filter('>', co, 0, 'x');
+        co.set('y', metaBlkHeightLog2 - 1);
+        pMetaEq->Filter('>', co, 0, 'y');
+        co.set('z', metaBlkDepthLog2 - 1);
+        pMetaEq->Filter('>', co, 0, 'z');
+
+        // filter out everything above the metablock size for the channel bits
+        co.set('x', metaBlkWidthLog2 - 1);
+        pipeEquation.Filter('>', co, 0, 'x');
+        co.set('y', metaBlkHeightLog2 - 1);
+        pipeEquation.Filter('>', co, 0, 'y');
+        co.set('z', metaBlkDepthLog2 - 1);
+        pipeEquation.Filter('>', co, 0, 'z');
+
+        // Make sure we still have the same number of channel bits
+        if (pipeEquation.getsize() != numPipeTotalLog2)
+        {
+            ADDR_ASSERT_ALWAYS();
+        }
+
+        // Loop through all channel and rb bits,
+        // and make sure these components exist in the metadata address
+        for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
+        {
+            for (UINT_32 j = pipeEquation[i].getsize(); j > 0; j--)
+            {
+                if (pMetaEq->Exists(pipeEquation[i][j - 1]) == FALSE)
+                {
+                    ADDR_ASSERT_ALWAYS();
+                }
+            }
+        }
+
+        const UINT_32 numSeLog2     = metaFlag.rbAligned ? m_seLog2      : 0;
+        const UINT_32 numRbPeSeLog2 = metaFlag.rbAligned ? m_rbPerSeLog2 : 0;
+        const UINT_32 numRbTotalLog2 = numRbPeSeLog2 + numSeLog2;
+        CoordEq       origRbEquation;
+
+        GetRbEquation(&origRbEquation, numRbPeSeLog2, numSeLog2);
+
+        CoordEq rbEquation = origRbEquation;
+
+        for (UINT_32 i = 0; i < numRbTotalLog2; i++)
+        {
+            for (UINT_32 j = rbEquation[i].getsize(); j > 0; j--)
+            {
+                if (pMetaEq->Exists(rbEquation[i][j - 1]) == FALSE)
+                {
+                    ADDR_ASSERT_ALWAYS();
+                }
+            }
+        }
+
+        if (m_settings.applyAliasFix)
+        {
+            co.set('z', -1);
+        }
+
+        // Loop through each rb id bit; if it is equal to any of the filtered channel bits, clear it
+        for (UINT_32 i = 0; i < numRbTotalLog2; i++)
+        {
+            for (UINT_32 j = 0; j < numPipeTotalLog2; j++)
+            {
+                BOOL_32 isRbEquationInPipeEquation = FALSE;
+
+                if (m_settings.applyAliasFix)
+                {
+                    CoordTerm filteredPipeEq;
+                    filteredPipeEq = pipeEquation[j];
+
+                    filteredPipeEq.Filter('>', co, 0, 'z');
+
+                    isRbEquationInPipeEquation = (rbEquation[i] == filteredPipeEq);
+                }
+                else
+                {
+                    isRbEquationInPipeEquation = (rbEquation[i] == pipeEquation[j]);
+                }
+
+                if (isRbEquationInPipeEquation)
+                {
+                    rbEquation[i].Clear();
+                }
+            }
+        }
+
+         bool rbAppendedWithPipeBits[1 << (MaxSeLog2 + MaxRbPerSeLog2)] = {};
+
+        // Loop through each bit of the channel, get the smallest coordinate,
+        // and remove it from the metaaddr, and rb_equation
+        for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
+        {
+            pipeEquation[i].getsmallest(co);
+
+            UINT_32 old_size = pMetaEq->getsize();
+            pMetaEq->Filter('=', co);
+            UINT_32 new_size = pMetaEq->getsize();
+            if (new_size != old_size-1)
+            {
+                ADDR_ASSERT_ALWAYS();
+            }
+            pipeEquation.remove(co);
+            for (UINT_32 j = 0; j < numRbTotalLog2; j++)
+            {
+                if (rbEquation[j].remove(co))
+                {
+                    // if we actually removed something from this bit, then add the remaining
+                    // channel bits, as these can be removed for this bit
+                    for (UINT_32 k = 0; k < pipeEquation[i].getsize(); k++)
+                    {
+                        if (pipeEquation[i][k] != co)
+                        {
+                            rbEquation[j].add(pipeEquation[i][k]);
+                            rbAppendedWithPipeBits[j] = true;
+                        }
+                    }
+                }
+            }
+        }
+
+        // Loop through the rb bits and see what remain;
+        // filter out the smallest coordinate if it remains
+        UINT_32 rbBitsLeft = 0;
+        for (UINT_32 i = 0; i < numRbTotalLog2; i++)
+        {
+            BOOL_32 isRbEqAppended = FALSE;
+
+            if (m_settings.applyAliasFix)
+            {
+                isRbEqAppended = (rbEquation[i].getsize() > (rbAppendedWithPipeBits[i] ? 1 : 0));
+            }
+            else
+            {
+                isRbEqAppended = (rbEquation[i].getsize() > 0);
+            }
+
+            if (isRbEqAppended)
+            {
+                rbBitsLeft++;
+                rbEquation[i].getsmallest(co);
+                UINT_32 old_size = pMetaEq->getsize();
+                pMetaEq->Filter('=', co);
+                UINT_32 new_size = pMetaEq->getsize();
+                if (new_size != old_size - 1)
+                {
+                    // assert warning
+                }
+                for (UINT_32 j = i + 1; j < numRbTotalLog2; j++)
+                {
+                    if (rbEquation[j].remove(co))
+                    {
+                        // if we actually removed something from this bit, then add the remaining
+                        // rb bits, as these can be removed for this bit
+                        for (UINT_32 k = 0; k < rbEquation[i].getsize(); k++)
+                        {
+                            if (rbEquation[i][k] != co)
+                            {
+                                rbEquation[j].add(rbEquation[i][k]);
+                                rbAppendedWithPipeBits[j] |= rbAppendedWithPipeBits[i];
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // capture the size of the metaaddr
+        UINT_32 metaSize = pMetaEq->getsize();
+        // resize to 49 bits...make this a nibble address
+        pMetaEq->resize(49);
+        // Concatenate the macro address above the current address
+        for (UINT_32 i = metaSize, j = 0; i < 49; i++, j++)
+        {
+            co.set('m', j);
+            (*pMetaEq)[i].add(co);
+        }
+
+        // Multiply by meta element size (in nibbles)
+        if (dataSurfaceType == Gfx9DataColor)
+        {
+            pMetaEq->shift(1);
+        }
+        else if (dataSurfaceType == Gfx9DataDepthStencil)
+        {
+            pMetaEq->shift(3);
+        }
+
+        //------------------------------------------------------------------------------------------
+        // Note the pipeInterleaveLog2+1 is because address is a nibble address
+        // Shift up from pipe interleave number of channel
+        // and rb bits left, and uncompressed fragments
+        //------------------------------------------------------------------------------------------
+
+        pMetaEq->shift(numPipeTotalLog2 + rbBitsLeft + uncompFragLog2, pipeInterleaveLog2 + 1);
+
+        // Put in the channel bits
+        for (UINT_32 i = 0; i < numPipeTotalLog2; i++)
+        {
+            origPipeEquation[i].copyto((*pMetaEq)[pipeInterleaveLog2+1 + i]);
+        }
+
+        // Put in remaining rb bits
+        for (UINT_32 i = 0, j = 0; j < rbBitsLeft; i = (i + 1) % numRbTotalLog2)
+        {
+            BOOL_32 isRbEqAppended = FALSE;
+
+            if (m_settings.applyAliasFix)
+            {
+                isRbEqAppended = (rbEquation[i].getsize() > (rbAppendedWithPipeBits[i] ? 1 : 0));
+            }
+            else
+            {
+                isRbEqAppended = (rbEquation[i].getsize() > 0);
+            }
+
+            if (isRbEqAppended)
+            {
+                origRbEquation[i].copyto((*pMetaEq)[pipeInterleaveLog2 + 1 + numPipeTotalLog2 + j]);
+                // Mark any rb bit we add in to the rb mask
+                j++;
+            }
+        }
+
+        //------------------------------------------------------------------------------------------
+        // Put in the uncompressed fragment bits
+        //------------------------------------------------------------------------------------------
+        for (UINT_32 i = 0; i < uncompFragLog2; i++)
+        {
+            co.set('s', compFragLog2 + i);
+            (*pMetaEq)[pipeInterleaveLog2 + 1 + numPipeTotalLog2 + rbBitsLeft + i].add(co);
+        }
+    }
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::IsEquationSupported
+*
+*   @brief
+*       Check if equation is supported for given swizzle mode and resource type.
+*
+*   @return
+*       TRUE if supported
+************************************************************************************************************************
+*/
+BOOL_32 Gfx9Lib::IsEquationSupported(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode  swMode,
+    UINT_32          elementBytesLog2) const
+{
+    BOOL_32 supported = (elementBytesLog2 < MaxElementBytesLog2) &&
+                        (IsLinear(swMode) == FALSE) &&
+                        (((IsTex2d(rsrcType) == TRUE) &&
+                          ((elementBytesLog2 < 4) ||
+                           ((IsRotateSwizzle(swMode) == FALSE) &&
+                            (IsZOrderSwizzle(swMode) == FALSE)))) ||
+                         ((IsTex3d(rsrcType) == TRUE) &&
+                          (IsRotateSwizzle(swMode) == FALSE) &&
+                          (IsBlock256b(swMode) == FALSE)));
+
+    return supported;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::InitEquationTable
+*
+*   @brief
+*       Initialize Equation table.
+*
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::InitEquationTable()
+{
+    memset(m_equationTable, 0, sizeof(m_equationTable));
+
+    // Loop all possible resource type (2D/3D)
+    for (UINT_32 rsrcTypeIdx = 0; rsrcTypeIdx < MaxRsrcType; rsrcTypeIdx++)
+    {
+        AddrResourceType rsrcType = static_cast<AddrResourceType>(rsrcTypeIdx + ADDR_RSRC_TEX_2D);
+
+        // Loop all possible swizzle mode
+        for (UINT_32 swModeIdx = 0; swModeIdx < MaxSwMode; swModeIdx++)
+        {
+            AddrSwizzleMode swMode = static_cast<AddrSwizzleMode>(swModeIdx);
+
+            // Loop all possible bpp
+            for (UINT_32 bppIdx = 0; bppIdx < MaxElementBytesLog2; bppIdx++)
+            {
+                UINT_32 equationIndex = ADDR_INVALID_EQUATION_INDEX;
+
+                // Check if the input is supported
+                if (IsEquationSupported(rsrcType, swMode, bppIdx))
+                {
+                    ADDR_EQUATION equation;
+                    ADDR_E_RETURNCODE retCode;
+
+                    memset(&equation, 0, sizeof(ADDR_EQUATION));
+
+                    // Generate the equation
+                    if (IsBlock256b(swMode) && IsTex2d(rsrcType))
+                    {
+                        retCode = ComputeBlock256Equation(rsrcType, swMode, bppIdx, &equation);
+                    }
+                    else if (IsThin(rsrcType, swMode))
+                    {
+                        retCode = ComputeThinEquation(rsrcType, swMode, bppIdx, &equation);
+                    }
+                    else
+                    {
+                        retCode = ComputeThickEquation(rsrcType, swMode, bppIdx, &equation);
+                    }
+
+                    // Only fill the equation into the table if the return code is ADDR_OK,
+                    // otherwise if the return code is not ADDR_OK, it indicates this is not
+                    // a valid input, we do nothing but just fill invalid equation index
+                    // into the lookup table.
+                    if (retCode == ADDR_OK)
+                    {
+                        equationIndex = m_numEquations;
+                        ADDR_ASSERT(equationIndex < EquationTableSize);
+
+                        m_equationTable[equationIndex] = equation;
+
+                        m_numEquations++;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT_ALWAYS();
+                    }
+                }
+
+                // Fill the index into the lookup table, if the combination is not supported
+                // fill the invalid equation index
+                m_equationLookupTable[rsrcTypeIdx][swModeIdx][bppIdx] = equationIndex;
+            }
+        }
+    }
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlGetEquationIndex
+*
+*   @brief
+*       Interface function stub of GetEquationIndex
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+UINT_32 Gfx9Lib::HwlGetEquationIndex(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut
+    ) const
+{
+    AddrResourceType rsrcType         = pIn->resourceType;
+    AddrSwizzleMode  swMode           = pIn->swizzleMode;
+    UINT_32          elementBytesLog2 = Log2(pIn->bpp >> 3);
+    UINT_32          index            = ADDR_INVALID_EQUATION_INDEX;
+
+    if (IsEquationSupported(rsrcType, swMode, elementBytesLog2))
+    {
+        UINT_32 rsrcTypeIdx = static_cast<UINT_32>(rsrcType) - 1;
+        UINT_32 swModeIdx   = static_cast<UINT_32>(swMode);
+
+        index = m_equationLookupTable[rsrcTypeIdx][swModeIdx][elementBytesLog2];
+    }
+
+    if (pOut->pMipInfo != NULL)
+    {
+        for (UINT_32 i = 0; i < pIn->numMipLevels; i++)
+        {
+            pOut->pMipInfo[i].equationIndex = index;
+        }
+    }
+
+    return index;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeBlock256Equation
+*
+*   @brief
+*       Interface function stub of ComputeBlock256Equation
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeBlock256Equation(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode  swMode,
+    UINT_32          elementBytesLog2,
+    ADDR_EQUATION*   pEquation) const
+{
+    ADDR_E_RETURNCODE ret = ADDR_OK;
+
+    pEquation->numBits = 8;
+
+    UINT_32 i = 0;
+    for (; i < elementBytesLog2; i++)
+    {
+        InitChannel(1, 0 , i, &pEquation->addr[i]);
+    }
+
+    ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[elementBytesLog2];
+
+    const UINT_32 maxBitsUsed = 4;
+    ADDR_CHANNEL_SETTING x[maxBitsUsed] = {};
+    ADDR_CHANNEL_SETTING y[maxBitsUsed] = {};
+
+    for (i = 0; i < maxBitsUsed; i++)
+    {
+        InitChannel(1, 0, elementBytesLog2 + i, &x[i]);
+        InitChannel(1, 1, i, &y[i]);
+    }
+
+    if (IsStandardSwizzle(rsrcType, swMode))
+    {
+        switch (elementBytesLog2)
+        {
+            case 0:
+                pixelBit[0] = x[0];
+                pixelBit[1] = x[1];
+                pixelBit[2] = x[2];
+                pixelBit[3] = x[3];
+                pixelBit[4] = y[0];
+                pixelBit[5] = y[1];
+                pixelBit[6] = y[2];
+                pixelBit[7] = y[3];
+                break;
+            case 1:
+                pixelBit[0] = x[0];
+                pixelBit[1] = x[1];
+                pixelBit[2] = x[2];
+                pixelBit[3] = y[0];
+                pixelBit[4] = y[1];
+                pixelBit[5] = y[2];
+                pixelBit[6] = x[3];
+                break;
+            case 2:
+                pixelBit[0] = x[0];
+                pixelBit[1] = x[1];
+                pixelBit[2] = y[0];
+                pixelBit[3] = y[1];
+                pixelBit[4] = y[2];
+                pixelBit[5] = x[2];
+                break;
+            case 3:
+                pixelBit[0] = x[0];
+                pixelBit[1] = y[0];
+                pixelBit[2] = y[1];
+                pixelBit[3] = x[1];
+                pixelBit[4] = x[2];
+                break;
+            case 4:
+                pixelBit[0] = y[0];
+                pixelBit[1] = y[1];
+                pixelBit[2] = x[0];
+                pixelBit[3] = x[1];
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                ret = ADDR_INVALIDPARAMS;
+                break;
+        }
+    }
+    else if (IsDisplaySwizzle(rsrcType, swMode))
+    {
+        switch (elementBytesLog2)
+        {
+            case 0:
+                pixelBit[0] = x[0];
+                pixelBit[1] = x[1];
+                pixelBit[2] = x[2];
+                pixelBit[3] = y[1];
+                pixelBit[4] = y[0];
+                pixelBit[5] = y[2];
+                pixelBit[6] = x[3];
+                pixelBit[7] = y[3];
+                break;
+            case 1:
+                pixelBit[0] = x[0];
+                pixelBit[1] = x[1];
+                pixelBit[2] = x[2];
+                pixelBit[3] = y[0];
+                pixelBit[4] = y[1];
+                pixelBit[5] = y[2];
+                pixelBit[6] = x[3];
+                break;
+            case 2:
+                pixelBit[0] = x[0];
+                pixelBit[1] = x[1];
+                pixelBit[2] = y[0];
+                pixelBit[3] = x[2];
+                pixelBit[4] = y[1];
+                pixelBit[5] = y[2];
+                break;
+            case 3:
+                pixelBit[0] = x[0];
+                pixelBit[1] = y[0];
+                pixelBit[2] = x[1];
+                pixelBit[3] = x[2];
+                pixelBit[4] = y[1];
+                break;
+            case 4:
+                pixelBit[0] = x[0];
+                pixelBit[1] = y[0];
+                pixelBit[2] = x[1];
+                pixelBit[3] = y[1];
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                ret = ADDR_INVALIDPARAMS;
+                break;
+        }
+    }
+    else if (IsRotateSwizzle(swMode))
+    {
+        switch (elementBytesLog2)
+        {
+            case 0:
+                pixelBit[0] = y[0];
+                pixelBit[1] = y[1];
+                pixelBit[2] = y[2];
+                pixelBit[3] = x[1];
+                pixelBit[4] = x[0];
+                pixelBit[5] = x[2];
+                pixelBit[6] = x[3];
+                pixelBit[7] = y[3];
+                break;
+            case 1:
+                pixelBit[0] = y[0];
+                pixelBit[1] = y[1];
+                pixelBit[2] = y[2];
+                pixelBit[3] = x[0];
+                pixelBit[4] = x[1];
+                pixelBit[5] = x[2];
+                pixelBit[6] = x[3];
+                break;
+            case 2:
+                pixelBit[0] = y[0];
+                pixelBit[1] = y[1];
+                pixelBit[2] = x[0];
+                pixelBit[3] = y[2];
+                pixelBit[4] = x[1];
+                pixelBit[5] = x[2];
+                break;
+            case 3:
+                pixelBit[0] = y[0];
+                pixelBit[1] = x[0];
+                pixelBit[2] = y[1];
+                pixelBit[3] = x[1];
+                pixelBit[4] = x[2];
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+            case 4:
+                ret = ADDR_INVALIDPARAMS;
+                break;
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        ret = ADDR_INVALIDPARAMS;
+    }
+
+    // Post validation
+    if (ret == ADDR_OK)
+    {
+        MAYBE_UNUSED Dim2d microBlockDim = Block256_2d[elementBytesLog2];
+        ADDR_ASSERT((2u << GetMaxValidChannelIndex(pEquation->addr, 8, 0)) ==
+                    (microBlockDim.w * (1 << elementBytesLog2)));
+        ADDR_ASSERT((2u << GetMaxValidChannelIndex(pEquation->addr, 8, 1)) == microBlockDim.h);
+    }
+
+    return ret;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeThinEquation
+*
+*   @brief
+*       Interface function stub of ComputeThinEquation
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeThinEquation(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode  swMode,
+    UINT_32          elementBytesLog2,
+    ADDR_EQUATION*   pEquation) const
+{
+    ADDR_E_RETURNCODE ret = ADDR_OK;
+
+    UINT_32 blockSizeLog2 = GetBlockSizeLog2(swMode);
+
+    UINT_32 maxXorBits = blockSizeLog2;
+    if (IsNonPrtXor(swMode))
+    {
+        // For non-prt-xor, maybe need to initialize some more bits for xor
+        // The highest xor bit used in equation will be max the following 3 items:
+        // 1. m_pipeInterleaveLog2 + 2 * pipeXorBits
+        // 2. m_pipeInterleaveLog2 + pipeXorBits + 2 * bankXorBits
+        // 3. blockSizeLog2
+
+        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 + 2 * GetPipeXorBits(blockSizeLog2));
+        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 +
+                                     GetPipeXorBits(blockSizeLog2) +
+                                     2 * GetBankXorBits(blockSizeLog2));
+    }
+
+    const UINT_32 maxBitsUsed = 14;
+    ADDR_ASSERT((2 * maxBitsUsed) >= maxXorBits);
+    ADDR_CHANNEL_SETTING x[maxBitsUsed] = {};
+    ADDR_CHANNEL_SETTING y[maxBitsUsed] = {};
+
+    const UINT_32 extraXorBits = 16;
+    ADDR_ASSERT(extraXorBits >= maxXorBits - blockSizeLog2);
+    ADDR_CHANNEL_SETTING xorExtra[extraXorBits] = {};
+
+    for (UINT_32 i = 0; i < maxBitsUsed; i++)
+    {
+        InitChannel(1, 0, elementBytesLog2 + i, &x[i]);
+        InitChannel(1, 1, i, &y[i]);
+    }
+
+    ADDR_CHANNEL_SETTING* pixelBit = pEquation->addr;
+
+    for (UINT_32 i = 0; i < elementBytesLog2; i++)
+    {
+        InitChannel(1, 0 , i, &pixelBit[i]);
+    }
+
+    UINT_32 xIdx = 0;
+    UINT_32 yIdx = 0;
+    UINT_32 lowBits = 0;
+
+    if (IsZOrderSwizzle(swMode))
+    {
+        if (elementBytesLog2 <= 3)
+        {
+            for (UINT_32 i = elementBytesLog2; i < 6; i++)
+            {
+                pixelBit[i] = (((i - elementBytesLog2) & 1) == 0) ? x[xIdx++] : y[yIdx++];
+            }
+
+            lowBits = 6;
+        }
+        else
+        {
+            ret = ADDR_INVALIDPARAMS;
+        }
+    }
+    else
+    {
+        ret = HwlComputeBlock256Equation(rsrcType, swMode, elementBytesLog2, pEquation);
+
+        if (ret == ADDR_OK)
+        {
+            Dim2d microBlockDim = Block256_2d[elementBytesLog2];
+            xIdx = Log2(microBlockDim.w);
+            yIdx = Log2(microBlockDim.h);
+            lowBits = 8;
+        }
+    }
+
+    if (ret == ADDR_OK)
+    {
+        for (UINT_32 i = lowBits; i < blockSizeLog2; i++)
+        {
+            pixelBit[i] = ((i & 1) == 0) ? y[yIdx++] : x[xIdx++];
+        }
+
+        for (UINT_32 i = blockSizeLog2; i < maxXorBits; i++)
+        {
+            xorExtra[i - blockSizeLog2] = ((i & 1) == 0) ? y[yIdx++] : x[xIdx++];
+        }
+
+        if (IsXor(swMode))
+        {
+            // Fill XOR bits
+            UINT_32 pipeStart = m_pipeInterleaveLog2;
+            UINT_32 pipeXorBits = GetPipeXorBits(blockSizeLog2);
+
+            UINT_32 bankStart = pipeStart + pipeXorBits;
+            UINT_32 bankXorBits = GetBankXorBits(blockSizeLog2);
+
+            for (UINT_32 i = 0; i < pipeXorBits; i++)
+            {
+                UINT_32               xor1BitPos = pipeStart + 2 * pipeXorBits - 1 - i;
+                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
+                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
+
+                InitChannel(&pEquation->xor1[pipeStart + i], pXor1Src);
+            }
+
+            for (UINT_32 i = 0; i < bankXorBits; i++)
+            {
+                UINT_32               xor1BitPos = bankStart + 2 * bankXorBits - 1 - i;
+                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
+                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
+
+                InitChannel(&pEquation->xor1[bankStart + i], pXor1Src);
+            }
+
+            if (IsPrt(swMode) == FALSE)
+            {
+                for (UINT_32 i = 0; i < pipeXorBits; i++)
+                {
+                    InitChannel(1, 2, pipeXorBits - i - 1, &pEquation->xor2[pipeStart + i]);
+                }
+
+                for (UINT_32 i = 0; i < bankXorBits; i++)
+                {
+                    InitChannel(1, 2, bankXorBits - i - 1 + pipeXorBits, &pEquation->xor2[bankStart + i]);
+                }
+            }
+        }
+
+        pEquation->numBits = blockSizeLog2;
+    }
+
+    return ret;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeThickEquation
+*
+*   @brief
+*       Interface function stub of ComputeThickEquation
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeThickEquation(
+    AddrResourceType rsrcType,
+    AddrSwizzleMode  swMode,
+    UINT_32          elementBytesLog2,
+    ADDR_EQUATION*   pEquation) const
+{
+    ADDR_E_RETURNCODE ret = ADDR_OK;
+
+    ADDR_ASSERT(IsTex3d(rsrcType));
+
+    UINT_32 blockSizeLog2 = GetBlockSizeLog2(swMode);
+
+    UINT_32 maxXorBits = blockSizeLog2;
+    if (IsNonPrtXor(swMode))
+    {
+        // For non-prt-xor, maybe need to initialize some more bits for xor
+        // The highest xor bit used in equation will be max the following 3:
+        // 1. m_pipeInterleaveLog2 + 3 * pipeXorBits
+        // 2. m_pipeInterleaveLog2 + pipeXorBits + 3 * bankXorBits
+        // 3. blockSizeLog2
+
+        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 + 3 * GetPipeXorBits(blockSizeLog2));
+        maxXorBits = Max(maxXorBits, m_pipeInterleaveLog2 +
+                                     GetPipeXorBits(blockSizeLog2) +
+                                     3 * GetBankXorBits(blockSizeLog2));
+    }
+
+    for (UINT_32 i = 0; i < elementBytesLog2; i++)
+    {
+        InitChannel(1, 0 , i, &pEquation->addr[i]);
+    }
+
+    ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[elementBytesLog2];
+
+    const UINT_32 maxBitsUsed = 12;
+    ADDR_ASSERT((3 * maxBitsUsed) >= maxXorBits);
+    ADDR_CHANNEL_SETTING x[maxBitsUsed] = {};
+    ADDR_CHANNEL_SETTING y[maxBitsUsed] = {};
+    ADDR_CHANNEL_SETTING z[maxBitsUsed] = {};
+
+    const UINT_32 extraXorBits = 24;
+    ADDR_ASSERT(extraXorBits >= maxXorBits - blockSizeLog2);
+    ADDR_CHANNEL_SETTING xorExtra[extraXorBits] = {};
+
+    for (UINT_32 i = 0; i < maxBitsUsed; i++)
+    {
+        InitChannel(1, 0, elementBytesLog2 + i, &x[i]);
+        InitChannel(1, 1, i, &y[i]);
+        InitChannel(1, 2, i, &z[i]);
+    }
+
+    if (IsZOrderSwizzle(swMode))
+    {
+        switch (elementBytesLog2)
+        {
+            case 0:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = y[0];
+                pixelBit[2]  = x[1];
+                pixelBit[3]  = y[1];
+                pixelBit[4]  = z[0];
+                pixelBit[5]  = z[1];
+                pixelBit[6]  = x[2];
+                pixelBit[7]  = z[2];
+                pixelBit[8]  = y[2];
+                pixelBit[9]  = x[3];
+                break;
+            case 1:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = y[0];
+                pixelBit[2]  = x[1];
+                pixelBit[3]  = y[1];
+                pixelBit[4]  = z[0];
+                pixelBit[5]  = z[1];
+                pixelBit[6]  = z[2];
+                pixelBit[7]  = y[2];
+                pixelBit[8]  = x[2];
+                break;
+            case 2:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = y[0];
+                pixelBit[2]  = x[1];
+                pixelBit[3]  = z[0];
+                pixelBit[4]  = y[1];
+                pixelBit[5]  = z[1];
+                pixelBit[6]  = y[2];
+                pixelBit[7]  = x[2];
+                break;
+            case 3:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = y[0];
+                pixelBit[2]  = z[0];
+                pixelBit[3]  = x[1];
+                pixelBit[4]  = z[1];
+                pixelBit[5]  = y[1];
+                pixelBit[6]  = x[2];
+                break;
+            case 4:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = y[0];
+                pixelBit[2]  = z[0];
+                pixelBit[3]  = z[1];
+                pixelBit[4]  = y[1];
+                pixelBit[5]  = x[1];
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                ret = ADDR_INVALIDPARAMS;
+                break;
+        }
+    }
+    else if (IsStandardSwizzle(rsrcType, swMode))
+    {
+        switch (elementBytesLog2)
+        {
+            case 0:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = x[1];
+                pixelBit[2]  = x[2];
+                pixelBit[3]  = x[3];
+                pixelBit[4]  = y[0];
+                pixelBit[5]  = y[1];
+                pixelBit[6]  = z[0];
+                pixelBit[7]  = z[1];
+                pixelBit[8]  = z[2];
+                pixelBit[9]  = y[2];
+                break;
+            case 1:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = x[1];
+                pixelBit[2]  = x[2];
+                pixelBit[3]  = y[0];
+                pixelBit[4]  = y[1];
+                pixelBit[5]  = z[0];
+                pixelBit[6]  = z[1];
+                pixelBit[7]  = z[2];
+                pixelBit[8]  = y[2];
+                break;
+            case 2:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = x[1];
+                pixelBit[2]  = y[0];
+                pixelBit[3]  = y[1];
+                pixelBit[4]  = z[0];
+                pixelBit[5]  = z[1];
+                pixelBit[6]  = y[2];
+                pixelBit[7]  = x[2];
+                break;
+            case 3:
+                pixelBit[0]  = x[0];
+                pixelBit[1]  = y[0];
+                pixelBit[2]  = y[1];
+                pixelBit[3]  = z[0];
+                pixelBit[4]  = z[1];
+                pixelBit[5]  = x[1];
+                pixelBit[6]  = x[2];
+                break;
+            case 4:
+                pixelBit[0]  = y[0];
+                pixelBit[1]  = y[1];
+                pixelBit[2]  = z[0];
+                pixelBit[3]  = z[1];
+                pixelBit[4]  = x[0];
+                pixelBit[5]  = x[1];
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                ret = ADDR_INVALIDPARAMS;
+                break;
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        ret = ADDR_INVALIDPARAMS;
+    }
+
+    if (ret == ADDR_OK)
+    {
+        Dim3d microBlockDim = Block1K_3d[elementBytesLog2];
+        UINT_32 xIdx = Log2(microBlockDim.w);
+        UINT_32 yIdx = Log2(microBlockDim.h);
+        UINT_32 zIdx = Log2(microBlockDim.d);
+
+        pixelBit = pEquation->addr;
+
+        const UINT_32 lowBits = 10;
+        ADDR_ASSERT(pEquation->addr[lowBits - 1].valid == 1);
+        ADDR_ASSERT(pEquation->addr[lowBits].valid == 0);
+
+        for (UINT_32 i = lowBits; i < blockSizeLog2; i++)
+        {
+            if ((i % 3) == 0)
+            {
+                pixelBit[i] = x[xIdx++];
+            }
+            else if ((i % 3) == 1)
+            {
+                pixelBit[i] = z[zIdx++];
+            }
+            else
+            {
+                pixelBit[i] = y[yIdx++];
+            }
+        }
+
+        for (UINT_32 i = blockSizeLog2; i < maxXorBits; i++)
+        {
+            if ((i % 3) == 0)
+            {
+                xorExtra[i - blockSizeLog2] = x[xIdx++];
+            }
+            else if ((i % 3) == 1)
+            {
+                xorExtra[i - blockSizeLog2] = z[zIdx++];
+            }
+            else
+            {
+                xorExtra[i - blockSizeLog2] = y[yIdx++];
+            }
+        }
+
+        if (IsXor(swMode))
+        {
+            // Fill XOR bits
+            UINT_32 pipeStart = m_pipeInterleaveLog2;
+            UINT_32 pipeXorBits = GetPipeXorBits(blockSizeLog2);
+            for (UINT_32 i = 0; i < pipeXorBits; i++)
+            {
+                UINT_32               xor1BitPos = pipeStart + (3 * pipeXorBits) - 1 - (2 * i);
+                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
+                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
+
+                InitChannel(&pEquation->xor1[pipeStart + i], pXor1Src);
+
+                UINT_32               xor2BitPos = pipeStart + (3 * pipeXorBits) - 2 - (2 * i);
+                ADDR_CHANNEL_SETTING* pXor2Src   = (xor2BitPos < blockSizeLog2) ?
+                                                   &pEquation->addr[xor2BitPos] : &xorExtra[xor2BitPos - blockSizeLog2];
+
+                InitChannel(&pEquation->xor2[pipeStart + i], pXor2Src);
+            }
+
+            UINT_32 bankStart = pipeStart + pipeXorBits;
+            UINT_32 bankXorBits = GetBankXorBits(blockSizeLog2);
+            for (UINT_32 i = 0; i < bankXorBits; i++)
+            {
+                UINT_32               xor1BitPos = bankStart + (3 * bankXorBits) - 1 - (2 * i);
+                ADDR_CHANNEL_SETTING* pXor1Src   = (xor1BitPos < blockSizeLog2) ?
+                                                   &pEquation->addr[xor1BitPos] : &xorExtra[xor1BitPos - blockSizeLog2];
+
+                InitChannel(&pEquation->xor1[bankStart + i], pXor1Src);
+
+                UINT_32               xor2BitPos = bankStart + (3 * bankXorBits) - 2 - (2 * i);
+                ADDR_CHANNEL_SETTING* pXor2Src   = (xor2BitPos < blockSizeLog2) ?
+                                                   &pEquation->addr[xor2BitPos] : &xorExtra[xor2BitPos - blockSizeLog2];
+
+                InitChannel(&pEquation->xor2[bankStart + i], pXor2Src);
+            }
+        }
+
+        pEquation->numBits = blockSizeLog2;
+    }
+
+    return ret;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::IsValidDisplaySwizzleMode
+*
+*   @brief
+*       Check if a swizzle mode is supported by display engine
+*
+*   @return
+*       TRUE is swizzle mode is supported by display engine
+************************************************************************************************************************
+*/
+BOOL_32 Gfx9Lib::IsValidDisplaySwizzleMode(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+{
+    BOOL_32 support = FALSE;
+
+    const AddrResourceType resourceType = pIn->resourceType;
+    (void)resourceType;
+    const AddrSwizzleMode swizzleMode = pIn->swizzleMode;
+
+    if (m_settings.isDce12)
+    {
+        switch (swizzleMode)
+        {
+            case ADDR_SW_256B_D:
+            case ADDR_SW_256B_R:
+                support = (pIn->bpp == 32);
+                break;
+
+            case ADDR_SW_LINEAR:
+            case ADDR_SW_4KB_D:
+            case ADDR_SW_4KB_R:
+            case ADDR_SW_64KB_D:
+            case ADDR_SW_64KB_R:
+            case ADDR_SW_VAR_D:
+            case ADDR_SW_VAR_R:
+            case ADDR_SW_4KB_D_X:
+            case ADDR_SW_4KB_R_X:
+            case ADDR_SW_64KB_D_X:
+            case ADDR_SW_64KB_R_X:
+            case ADDR_SW_VAR_D_X:
+            case ADDR_SW_VAR_R_X:
+                support = (pIn->bpp <= 64);
+                break;
+
+            default:
+                break;
+        }
+    }
+    else if (m_settings.isDcn1)
+    {
+        switch (swizzleMode)
+        {
+            case ADDR_SW_4KB_D:
+            case ADDR_SW_64KB_D:
+            case ADDR_SW_VAR_D:
+            case ADDR_SW_64KB_D_T:
+            case ADDR_SW_4KB_D_X:
+            case ADDR_SW_64KB_D_X:
+            case ADDR_SW_VAR_D_X:
+                support = (pIn->bpp == 64);
+                break;
+
+            case ADDR_SW_LINEAR:
+            case ADDR_SW_4KB_S:
+            case ADDR_SW_64KB_S:
+            case ADDR_SW_VAR_S:
+            case ADDR_SW_64KB_S_T:
+            case ADDR_SW_4KB_S_X:
+            case ADDR_SW_64KB_S_X:
+            case ADDR_SW_VAR_S_X:
+                support = (pIn->bpp <= 64);
+                break;
+
+            default:
+                break;
+        }
+    }
+    else
+    {
+        ADDR_NOT_IMPLEMENTED();
+    }
+
+    return support;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputePipeBankXor
+*
+*   @brief
+*       Generate a PipeBankXor value to be ORed into bits above pipeInterleaveBits of address
+*
+*   @return
+*       PipeBankXor value
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputePipeBankXor(
+    const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+    ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) const
+{
+    if (IsXor(pIn->swizzleMode))
+    {
+        UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
+        UINT_32 pipeBits       = GetPipeXorBits(macroBlockBits);
+        UINT_32 bankBits       = GetBankXorBits(macroBlockBits);
+
+        UINT_32 pipeXor = 0;
+        UINT_32 bankXor = 0;
+
+        const UINT_32 bankMask = (1 << bankBits) - 1;
+        const UINT_32 index    = pIn->surfIndex & bankMask;
+
+        const UINT_32 bpp      = pIn->flags.fmask ?
+                                 GetFmaskBpp(pIn->numSamples, pIn->numFrags) : GetElemLib()->GetBitsPerPixel(pIn->format);
+        if (bankBits == 4)
+        {
+            static const UINT_32 BankXorSmallBpp[] = {0, 7, 4, 3, 8, 15, 12, 11, 1, 6, 5, 2, 9, 14, 13, 10};
+            static const UINT_32 BankXorLargeBpp[] = {0, 7, 8, 15, 4, 3, 12, 11, 1, 6, 9, 14, 5, 2, 13, 10};
+
+            bankXor = (bpp <= 32) ? BankXorSmallBpp[index] : BankXorLargeBpp[index];
+        }
+        else if (bankBits > 0)
+        {
+            UINT_32 bankIncrease = (1 << (bankBits - 1)) - 1;
+            bankIncrease = (bankIncrease == 0) ? 1 : bankIncrease;
+            bankXor = (index * bankIncrease) & bankMask;
+        }
+
+        pOut->pipeBankXor = (bankXor << pipeBits) | pipeXor;
+    }
+    else
+    {
+        pOut->pipeBankXor = 0;
+    }
+
+    return ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeSlicePipeBankXor
+*
+*   @brief
+*       Generate slice PipeBankXor value based on base PipeBankXor value and slice id
+*
+*   @return
+*       PipeBankXor value
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSlicePipeBankXor(
+    const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
+    ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) const
+{
+    UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
+    UINT_32 pipeBits       = GetPipeXorBits(macroBlockBits);
+    UINT_32 bankBits       = GetBankXorBits(macroBlockBits);
+
+    UINT_32 pipeXor        = ReverseBitVector(pIn->slice, pipeBits);
+    UINT_32 bankXor        = ReverseBitVector(pIn->slice >> pipeBits, bankBits);
+
+    pOut->pipeBankXor = pIn->basePipeBankXor ^ (pipeXor | (bankXor << pipeBits));
+
+    return ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeSubResourceOffsetForSwizzlePattern
+*
+*   @brief
+*       Compute sub resource offset to support swizzle pattern
+*
+*   @return
+*       Offset
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSubResourceOffsetForSwizzlePattern(
+    const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
+    ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) const
+{
+    ADDR_ASSERT(IsThin(pIn->resourceType, pIn->swizzleMode));
+
+    UINT_32 macroBlockBits = GetBlockSizeLog2(pIn->swizzleMode);
+    UINT_32 pipeBits       = GetPipeXorBits(macroBlockBits);
+    UINT_32 bankBits       = GetBankXorBits(macroBlockBits);
+    UINT_32 pipeXor        = ReverseBitVector(pIn->slice, pipeBits);
+    UINT_32 bankXor        = ReverseBitVector(pIn->slice >> pipeBits, bankBits);
+    UINT_32 pipeBankXor    = ((pipeXor | (bankXor << pipeBits)) ^ (pIn->pipeBankXor)) << m_pipeInterleaveLog2;
+
+    pOut->offset = pIn->slice * pIn->sliceSize +
+                   pIn->macroBlockOffset +
+                   (pIn->mipTailOffset ^ pipeBankXor) -
+                   static_cast<UINT_64>(pipeBankXor);
+    return ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeSurfaceInfoSanityCheck
+*
+*   @brief
+*       Compute surface info sanity check
+*
+*   @return
+*       Offset
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceInfoSanityCheck(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+{
+    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);
+    BOOL_32          thin3d      = tex3d && flags.view3dAs2dArray;
+    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         = flags.prt;
+    BOOL_32          stereo      = flags.qbStereo;
+
+    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) || stereo;
+                break;
+            case ADDR_RSRC_TEX_2D:
+                invalid = (msaa && mipmap) || (stereo && msaa) || (stereo && mipmap);
+                break;
+            case ADDR_RSRC_TEX_3D:
+                invalid = msaa || zbuffer || display || stereo;
+                break;
+            default:
+                invalid = TRUE;
+                break;
+        }
+    }
+
+    if (invalid == FALSE)
+    {
+        if (display)
+        {
+            invalid = (IsValidDisplaySwizzleMode(pIn) == FALSE);
+        }
+    }
+
+    if (invalid == FALSE)
+    {
+        if (linear)
+        {
+            invalid = ((ADDR_RSRC_TEX_1D != rsrcType) && 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) || thin3d;
+                }
+                else if (IsStandardSwizzle(swizzle))
+                {
+                    invalid = zbuffer || thin3d;
+                }
+                else if (IsDisplaySwizzle(swizzle))
+                {
+                    invalid = zbuffer || (prt && (ADDR_RSRC_TEX_3D == rsrcType));
+                }
+                else if (IsRotateSwizzle(swizzle))
+                {
+                    invalid = zbuffer || (pIn->bpp > 64) || tex3d;
+                }
+                else
+                {
+                    ADDR_ASSERT(!"invalid swizzle mode");
+                    invalid = TRUE;
+                }
+            }
+        }
+    }
+
+    ADDR_ASSERT(invalid == FALSE);
+
+    return invalid ? ADDR_INVALIDPARAMS : ADDR_OK;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlGetPreferredSurfaceSetting
+*
+*   @brief
+*       Internal function to get suggested surface information for cliet to use
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting(
+    const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+    ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+    ElemLib*          pElemLib   = GetElemLib();
+
+    UINT_32 bpp          = pIn->bpp;
+    UINT_32 width        = pIn->width;
+    UINT_32 height       = pIn->height;
+    UINT_32 numSamples   = Max(pIn->numSamples, 1u);
+    UINT_32 numFrags     = (pIn->numFrags == 0) ? numSamples : pIn->numFrags;
+
+    if (pIn->flags.fmask)
+    {
+        bpp                = GetFmaskBpp(numSamples, numFrags);
+        numFrags           = 1;
+        numSamples         = 1;
+        pOut->resourceType = ADDR_RSRC_TEX_2D;
+    }
+    else
+    {
+        // Set format to INVALID will skip this conversion
+        if (pIn->format != ADDR_FMT_INVALID)
+        {
+            UINT_32 expandX, expandY;
+
+            // 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 basePitch = 0;
+            GetElemLib()->AdjustSurfaceInfo(elemMode,
+                                            expandX,
+                                            expandY,
+                                            &bpp,
+                                            &basePitch,
+                                            &width,
+                                            &height);
+        }
+
+        // The output may get changed for volume(3D) texture resource in future
+        pOut->resourceType = pIn->resourceType;
+    }
+
+    const UINT_32 numSlices    = Max(pIn->numSlices, 1u);
+    const UINT_32 numMipLevels = Max(pIn->numMipLevels, 1u);
+    const BOOL_32 msaa         = (numFrags > 1) || (numSamples > 1);
+    const BOOL_32 displayRsrc  = pIn->flags.display || pIn->flags.rotated;
+
+    // Forbid swizzle mode(s) by client setting, for simplicity we never allow VAR swizzle mode for GFX9
+    ADDR2_SWMODE_SET allowedSwModeSet = {};
+    allowedSwModeSet.value |= pIn->forbiddenBlock.linear    ? 0 : Gfx9LinearSwModeMask;
+    allowedSwModeSet.value |= pIn->forbiddenBlock.micro     ? 0 : Gfx9Blk256BSwModeMask;
+    allowedSwModeSet.value |= pIn->forbiddenBlock.macro4KB  ? 0 : Gfx9Blk4KBSwModeMask;
+    allowedSwModeSet.value |= pIn->forbiddenBlock.macro64KB ? 0 : Gfx9Blk64KBSwModeMask;
+
+    if (pIn->preferredSwSet.value != 0)
+    {
+        allowedSwModeSet.value &= pIn->preferredSwSet.sw_Z ? ~0 : ~Gfx9ZSwModeMask;
+        allowedSwModeSet.value &= pIn->preferredSwSet.sw_S ? ~0 : ~Gfx9StandardSwModeMask;
+        allowedSwModeSet.value &= pIn->preferredSwSet.sw_D ? ~0 : ~Gfx9DisplaySwModeMask;
+        allowedSwModeSet.value &= pIn->preferredSwSet.sw_R ? ~0 : ~Gfx9RotateSwModeMask;
+    }
+
+    if (pIn->noXor)
+    {
+        allowedSwModeSet.value &= ~Gfx9XorSwModeMask;
+    }
+
+    if (pIn->maxAlign > 0)
+    {
+        if (pIn->maxAlign < GetBlockSize(ADDR_SW_64KB))
+        {
+            allowedSwModeSet.value &= ~Gfx9Blk64KBSwModeMask;
+        }
+
+        if (pIn->maxAlign < GetBlockSize(ADDR_SW_4KB))
+        {
+            allowedSwModeSet.value &= ~Gfx9Blk4KBSwModeMask;
+        }
+
+        if (pIn->maxAlign < GetBlockSize(ADDR_SW_256B))
+        {
+            allowedSwModeSet.value &= ~Gfx9Blk256BSwModeMask;
+        }
+    }
+
+    // Filter out invalid swizzle mode(s) by image attributes and HW restrictions
+    switch (pOut->resourceType)
+    {
+        case ADDR_RSRC_TEX_1D:
+            allowedSwModeSet.value &= Gfx9Rsrc1dSwModeMask;
+            break;
+
+        case ADDR_RSRC_TEX_2D:
+            allowedSwModeSet.value &= pIn->flags.prt ? Gfx9Rsrc2dPrtSwModeMask : Gfx9Rsrc2dSwModeMask;
+
+            if (bpp > 64)
+            {
+                allowedSwModeSet.value &= ~(Gfx9RotateSwModeMask | Gfx9ZSwModeMask);
+            }
+            break;
+
+        case ADDR_RSRC_TEX_3D:
+            allowedSwModeSet.value &= pIn->flags.prt ? Gfx9Rsrc3dPrtSwModeMask : Gfx9Rsrc3dSwModeMask;
+
+            if ((numMipLevels > 1) && (numSlices >= width) && (numSlices >= height))
+            {
+                // SW_*_D for 3D mipmaps (maxmip > 0) is only supported for Xmajor or Ymajor mipmap
+                // When depth (Z) is the maximum dimension then must use one of the SW_*_S
+                // or SW_*_Z modes if mipmapping is desired on a 3D surface
+                allowedSwModeSet.value &= ~Gfx9DisplaySwModeMask;
+            }
+
+            if ((bpp == 128) && pIn->flags.color)
+            {
+                allowedSwModeSet.value &= ~Gfx9StandardSwModeMask;
+            }
+
+            if (pIn->flags.view3dAs2dArray)
+            {
+                allowedSwModeSet.value &= Gfx9Rsrc3dThinSwModeMask | Gfx9LinearSwModeMask;
+            }
+            break;
+
+        default:
+            ADDR_ASSERT_ALWAYS();
+            allowedSwModeSet.value = 0;
+            break;
+    }
+
+    if (pIn->format == ADDR_FMT_32_32_32)
+    {
+        allowedSwModeSet.value &= Gfx9LinearSwModeMask;
+    }
+
+    if (ElemLib::IsBlockCompressed(pIn->format))
+    {
+        if (pIn->flags.texture)
+        {
+            allowedSwModeSet.value &= Gfx9StandardSwModeMask | Gfx9DisplaySwModeMask;
+        }
+        else
+        {
+            allowedSwModeSet.value &= Gfx9StandardSwModeMask | Gfx9DisplaySwModeMask | Gfx9LinearSwModeMask;
+        }
+    }
+
+    if (ElemLib::IsMacroPixelPacked(pIn->format) ||
+        (msaa && ((bpp > 32) || pIn->flags.color || pIn->flags.unordered)))
+    {
+        allowedSwModeSet.value &= ~Gfx9ZSwModeMask;
+    }
+
+    if (pIn->flags.fmask || pIn->flags.depth || pIn->flags.stencil)
+    {
+        allowedSwModeSet.value &= Gfx9ZSwModeMask;
+
+        if (pIn->flags.noMetadata == FALSE)
+        {
+            if (pIn->flags.depth &&
+                pIn->flags.texture &&
+                (((bpp == 16) && (numFrags >= 4)) || ((bpp == 32) && (numFrags >= 2))))
+            {
+                // When _X/_T swizzle mode was used for MSAA depth texture, TC will get zplane
+                // equation from wrong address within memory range a tile covered and use the
+                // garbage data for compressed Z reading which finally leads to corruption.
+                allowedSwModeSet.value &= ~Gfx9XorSwModeMask;
+            }
+
+            if (m_settings.htileCacheRbConflict &&
+                (pIn->flags.depth || pIn->flags.stencil) &&
+                (numSlices > 1) &&
+                (pIn->flags.metaRbUnaligned == FALSE) &&
+                (pIn->flags.metaPipeUnaligned == FALSE))
+            {
+                // Z_X 2D array with Rb/Pipe aligned HTile won't have metadata cache coherency
+                allowedSwModeSet.value &= ~Gfx9XSwModeMask;
+            }
+        }
+    }
+
+    if (msaa)
+    {
+        allowedSwModeSet.value &= Gfx9MsaaSwModeMask;
+    }
+
+    if ((numFrags > 1) &&
+        (GetBlockSize(ADDR_SW_4KB) < (m_pipeInterleaveBytes * numFrags)))
+    {
+        // MSAA surface must have blk_bytes/pipe_interleave >= num_samples
+        allowedSwModeSet.value &= Gfx9Blk64KBSwModeMask;
+    }
+
+    if (numMipLevels > 1)
+    {
+        allowedSwModeSet.value &= ~Gfx9Blk256BSwModeMask;
+    }
+
+    if (displayRsrc)
+    {
+        if (m_settings.isDce12)
+        {
+            allowedSwModeSet.value &= (bpp == 32) ? Dce12Bpp32SwModeMask : Dce12NonBpp32SwModeMask;
+        }
+        else if (m_settings.isDcn1)
+        {
+            allowedSwModeSet.value &= (bpp == 64) ? Dcn1Bpp64SwModeMask : Dcn1NonBpp64SwModeMask;
+        }
+        else
+        {
+            ADDR_NOT_IMPLEMENTED();
+        }
+    }
+
+    if (allowedSwModeSet.value != 0)
+    {
+#if DEBUG
+        // Post sanity check, at least AddrLib should accept the output generated by its own
+        ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {};
+        localIn.flags        = pIn->flags;
+        localIn.resourceType = pOut->resourceType;
+        localIn.format       = pIn->format;
+        localIn.bpp          = bpp;
+        localIn.width        = width;
+        localIn.height       = height;
+        localIn.numSlices    = numSlices;
+        localIn.numMipLevels = numMipLevels;
+        localIn.numSamples   = numSamples;
+        localIn.numFrags     = numFrags;
+
+        UINT_32 validateSwModeSet = allowedSwModeSet.value;
+        for (UINT_32 i = 0; validateSwModeSet != 0; i++)
+        {
+            if (validateSwModeSet & 1)
+            {
+                localIn.swizzleMode = static_cast<AddrSwizzleMode>(i);
+                HwlComputeSurfaceInfoSanityCheck(&localIn);
+            }
+
+            validateSwModeSet >>= 1;
+        }
+#endif
+
+        pOut->validSwModeSet = allowedSwModeSet;
+        pOut->canXor         = (allowedSwModeSet.value & Gfx9XorSwModeMask) ? TRUE : FALSE;
+        pOut->validBlockSet  = GetAllowedBlockSet(allowedSwModeSet);
+        pOut->validSwTypeSet = GetAllowedSwSet(allowedSwModeSet);
+
+        pOut->clientPreferredSwSet = pIn->preferredSwSet;
+
+        if (pOut->clientPreferredSwSet.value == 0)
+        {
+            pOut->clientPreferredSwSet.value = AddrSwSetAll;
+        }
+
+        if (allowedSwModeSet.value == Gfx9LinearSwModeMask)
+        {
+            pOut->swizzleMode = ADDR_SW_LINEAR;
+        }
+        else
+        {
+            // Always ignore linear swizzle mode if there is other choice.
+            allowedSwModeSet.swLinear = 0;
+
+            ADDR2_BLOCK_SET allowedBlockSet = GetAllowedBlockSet(allowedSwModeSet);
+
+            // Determine block size if there is 2 or more block type candidates
+            if (IsPow2(allowedBlockSet.value) == FALSE)
+            {
+                const AddrSwizzleMode swMode[AddrBlockMaxTiledType]  = {ADDR_SW_256B, ADDR_SW_4KB, ADDR_SW_64KB};
+                Dim3d                 blkDim[AddrBlockMaxTiledType]  = {{0}, {0}, {0}};
+                Dim3d                 padDim[AddrBlockMaxTiledType]  = {{0}, {0}, {0}};
+                UINT_64               padSize[AddrBlockMaxTiledType] = {0};
+
+                const UINT_32 ratioLow           = pIn->flags.minimizeAlign ? 1 : (pIn->flags.opt4space ? 3 : 2);
+                const UINT_32 ratioHi            = pIn->flags.minimizeAlign ? 1 : (pIn->flags.opt4space ? 2 : 1);
+                const UINT_64 sizeAlignInElement = Max(NextPow2(pIn->minSizeAlign) / (bpp >> 3), 1u);
+                UINT_32       minSizeBlk         = AddrBlockMicro;
+                UINT_64       minSize            = 0;
+
+                for (UINT_32 i = AddrBlockMicro; i < AddrBlockMaxTiledType; i++)
+                {
+                    if (allowedBlockSet.value & (1 << i))
+                    {
+                        ComputeBlockDimensionForSurf(&blkDim[i].w,
+                                                     &blkDim[i].h,
+                                                     &blkDim[i].d,
+                                                     bpp,
+                                                     numFrags,
+                                                     pOut->resourceType,
+                                                     swMode[i]);
+
+                        if (displayRsrc)
+                        {
+                            blkDim[i].w = PowTwoAlign(blkDim[i].w, 32);
+                        }
+
+                        padSize[i] = ComputePadSize(&blkDim[i], width, height, numSlices, &padDim[i]);
+                        padSize[i] = PowTwoAlign(padSize[i], sizeAlignInElement);
+
+                        if ((minSize == 0) ||
+                            ((padSize[i] * ratioHi) <= (minSize * ratioLow)))
+                        {
+                            minSize    = padSize[i];
+                            minSizeBlk = i;
+                        }
+                    }
+                }
+
+                if ((allowedBlockSet.micro == TRUE)      &&
+                    (width  <= blkDim[AddrBlockMicro].w) &&
+                    (height <= blkDim[AddrBlockMicro].h) &&
+                    (NextPow2(pIn->minSizeAlign) <= GetBlockSize(ADDR_SW_256B)))
+                {
+                    minSizeBlk = AddrBlockMicro;
+                }
+
+                if (minSizeBlk == AddrBlockMicro)
+                {
+                    allowedSwModeSet.value &= Gfx9Blk256BSwModeMask;
+                }
+                else if (minSizeBlk == AddrBlock4KB)
+                {
+                    allowedSwModeSet.value &= Gfx9Blk4KBSwModeMask;
+                }
+                else
+                {
+                    ADDR_ASSERT(minSizeBlk == AddrBlock64KB);
+                    allowedSwModeSet.value &= Gfx9Blk64KBSwModeMask;
+                }
+            }
+
+            // Block type should be determined.
+            ADDR_ASSERT(IsPow2(GetAllowedBlockSet(allowedSwModeSet).value));
+
+            ADDR2_SWTYPE_SET allowedSwSet = GetAllowedSwSet(allowedSwModeSet);
+
+            // Determine swizzle type if there is 2 or more swizzle type candidates
+            if (IsPow2(allowedSwSet.value) == FALSE)
+            {
+                if (ElemLib::IsBlockCompressed(pIn->format))
+                {
+                    if (allowedSwSet.sw_D)
+                    {
+                        allowedSwModeSet.value &= Gfx9DisplaySwModeMask;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT(allowedSwSet.sw_S);
+                        allowedSwModeSet.value &= Gfx9StandardSwModeMask;
+                    }
+                }
+                else if (ElemLib::IsMacroPixelPacked(pIn->format))
+                {
+                    if (allowedSwSet.sw_S)
+                    {
+                        allowedSwModeSet.value &= Gfx9StandardSwModeMask;
+                    }
+                    else if (allowedSwSet.sw_D)
+                    {
+                        allowedSwModeSet.value &= Gfx9DisplaySwModeMask;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT(allowedSwSet.sw_R);
+                        allowedSwModeSet.value &= Gfx9RotateSwModeMask;
+                    }
+                }
+                else if (pOut->resourceType == ADDR_RSRC_TEX_3D)
+                {
+                    if (pIn->flags.color && allowedSwSet.sw_D)
+                    {
+                        allowedSwModeSet.value &= Gfx9DisplaySwModeMask;
+                    }
+                    else if (allowedSwSet.sw_Z)
+                    {
+                        allowedSwModeSet.value &= Gfx9ZSwModeMask;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT(allowedSwSet.sw_S);
+                        allowedSwModeSet.value &= Gfx9StandardSwModeMask;
+                    }
+                }
+                else
+                {
+                    if (pIn->flags.rotated && allowedSwSet.sw_R)
+                    {
+                        allowedSwModeSet.value &= Gfx9RotateSwModeMask;
+                    }
+                    else if (displayRsrc && allowedSwSet.sw_D)
+                    {
+                        allowedSwModeSet.value &= Gfx9DisplaySwModeMask;
+                    }
+                    else if (allowedSwSet.sw_S)
+                    {
+                        allowedSwModeSet.value &= Gfx9StandardSwModeMask;
+                    }
+                    else
+                    {
+                        ADDR_ASSERT(allowedSwSet.sw_Z);
+                        allowedSwModeSet.value &= Gfx9ZSwModeMask;
+                    }
+                }
+            }
+
+            // Swizzle type should be determined.
+            ADDR_ASSERT(IsPow2(GetAllowedSwSet(allowedSwModeSet).value));
+
+            // Determine swizzle mode now - always select the "largest" swizzle mode for a given block type +
+            // swizzle type combination. For example, for AddrBlock64KB + ADDR_SW_S, select SW_64KB_S_X(25) if it's
+            // available, or otherwise select SW_64KB_S_T(17) if it's available, or otherwise select SW_64KB_S(9).
+            pOut->swizzleMode = static_cast<AddrSwizzleMode>(Log2NonPow2(allowedSwModeSet.value));
+        }
+    }
+    else
+    {
+        // Invalid combination...
+        ADDR_ASSERT_ALWAYS();
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::ComputeStereoInfo
+*
+*   @brief
+*       Compute height alignment and right eye pipeBankXor for stereo surface
+*
+*   @return
+*       Error code
+*
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::ComputeStereoInfo(
+    const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+    ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut,
+    UINT_32*                                pHeightAlign
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    UINT_32 eqIndex = HwlGetEquationIndex(pIn, pOut);
+
+    if (eqIndex < m_numEquations)
+    {
+        if (IsXor(pIn->swizzleMode))
+        {
+            const UINT_32        blkSizeLog2       = GetBlockSizeLog2(pIn->swizzleMode);
+            const UINT_32        numPipeBits       = GetPipeXorBits(blkSizeLog2);
+            const UINT_32        numBankBits       = GetBankXorBits(blkSizeLog2);
+            const UINT_32        bppLog2           = Log2(pIn->bpp >> 3);
+            const UINT_32        maxYCoordBlock256 = Log2(Block256_2d[bppLog2].h) - 1;
+            MAYBE_UNUSED const ADDR_EQUATION *pEqToCheck = &m_equationTable[eqIndex];
+
+            ADDR_ASSERT(maxYCoordBlock256 ==
+                        GetMaxValidChannelIndex(&pEqToCheck->addr[0], GetBlockSizeLog2(ADDR_SW_256B), 1));
+
+            const UINT_32 maxYCoordInBaseEquation =
+                (blkSizeLog2 - GetBlockSizeLog2(ADDR_SW_256B)) / 2 + maxYCoordBlock256;
+
+            ADDR_ASSERT(maxYCoordInBaseEquation ==
+                        GetMaxValidChannelIndex(&pEqToCheck->addr[0], blkSizeLog2, 1));
+
+            const UINT_32 maxYCoordInPipeXor = (numPipeBits == 0) ? 0 : maxYCoordBlock256 + numPipeBits;
+
+            ADDR_ASSERT(maxYCoordInPipeXor ==
+                        GetMaxValidChannelIndex(&pEqToCheck->xor1[m_pipeInterleaveLog2], numPipeBits, 1));
+
+            const UINT_32 maxYCoordInBankXor = (numBankBits == 0) ?
+                                               0 : maxYCoordBlock256 + (numPipeBits + 1) / 2 + numBankBits;
+
+            ADDR_ASSERT(maxYCoordInBankXor ==
+                        GetMaxValidChannelIndex(&pEqToCheck->xor1[m_pipeInterleaveLog2 + numPipeBits], numBankBits, 1));
+
+            const UINT_32 maxYCoordInPipeBankXor = Max(maxYCoordInPipeXor, maxYCoordInBankXor);
+
+            if (maxYCoordInPipeBankXor > maxYCoordInBaseEquation)
+            {
+                *pHeightAlign = 1u << maxYCoordInPipeBankXor;
+
+                if (pOut->pStereoInfo != NULL)
+                {
+                    pOut->pStereoInfo->rightSwizzle = 0;
+
+                    if ((PowTwoAlign(pIn->height, *pHeightAlign) % (*pHeightAlign * 2)) != 0)
+                    {
+                        if (maxYCoordInPipeXor == maxYCoordInPipeBankXor)
+                        {
+                            pOut->pStereoInfo->rightSwizzle |= (1u << 1);
+                        }
+
+                        if (maxYCoordInBankXor == maxYCoordInPipeBankXor)
+                        {
+                            pOut->pStereoInfo->rightSwizzle |=
+                                1u << ((numPipeBits % 2) ? numPipeBits : numPipeBits + 1);
+                        }
+
+                        ADDR_ASSERT(pOut->pStereoInfo->rightSwizzle ==
+                                    GetCoordActiveMask(&pEqToCheck->xor1[m_pipeInterleaveLog2],
+                                                       numPipeBits + numBankBits, 1, maxYCoordInPipeBankXor));
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        returnCode = ADDR_ERROR;
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeSurfaceInfoTiled
+*
+*   @brief
+*       Internal function to calculate alignment for tiled surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceInfoTiled(
+     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)
+    {
+        UINT_32 pitchAlignInElement = pOut->blockWidth;
+
+        if ((IsTex2d(pIn->resourceType) == TRUE) &&
+            (pIn->flags.display || pIn->flags.rotated) &&
+            (pIn->numMipLevels <= 1) &&
+            (pIn->numSamples <= 1) &&
+            (pIn->numFrags <= 1))
+        {
+            // Display engine needs pitch align to be at least 32 pixels.
+            pitchAlignInElement = PowTwoAlign(pitchAlignInElement, 32);
+        }
+
+        pOut->pitch = PowTwoAlign(pIn->width, pitchAlignInElement);
+
+        if ((pIn->numMipLevels <= 1) && (pIn->pitchInElement > 0))
+        {
+            if ((pIn->pitchInElement % pitchAlignInElement) != 0)
+            {
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else if (pIn->pitchInElement < pOut->pitch)
+            {
+                returnCode = ADDR_INVALIDPARAMS;
+            }
+            else
+            {
+                pOut->pitch = pIn->pitchInElement;
+            }
+        }
+
+        UINT_32 heightAlign = 0;
+
+        if (pIn->flags.qbStereo)
+        {
+            returnCode = ComputeStereoInfo(pIn, pOut, &heightAlign);
+        }
+
+        if (returnCode == ADDR_OK)
+        {
+            pOut->height = PowTwoAlign(pIn->height, pOut->blockHeight);
+
+            if (heightAlign > 1)
+            {
+                pOut->height = PowTwoAlign(pOut->height, heightAlign);
+            }
+
+            pOut->numSlices = PowTwoAlign(pIn->numSlices, pOut->blockSlices);
+
+            pOut->epitchIsHeight   = FALSE;
+            pOut->mipChainInTail   = FALSE;
+            pOut->firstMipIdInTail = pIn->numMipLevels;
+
+            pOut->mipChainPitch    = pOut->pitch;
+            pOut->mipChainHeight   = pOut->height;
+            pOut->mipChainSlice    = pOut->numSlices;
+
+            if (pIn->numMipLevels > 1)
+            {
+                pOut->firstMipIdInTail = GetMipChainInfo(pIn->resourceType,
+                                                         pIn->swizzleMode,
+                                                         pIn->bpp,
+                                                         pIn->width,
+                                                         pIn->height,
+                                                         pIn->numSlices,
+                                                         pOut->blockWidth,
+                                                         pOut->blockHeight,
+                                                         pOut->blockSlices,
+                                                         pIn->numMipLevels,
+                                                         pOut->pMipInfo);
+
+                const UINT_32 endingMipId = Min(pOut->firstMipIdInTail, pIn->numMipLevels - 1);
+
+                if (endingMipId == 0)
+                {
+                    const Dim3d tailMaxDim = GetMipTailDim(pIn->resourceType,
+                                                           pIn->swizzleMode,
+                                                           pOut->blockWidth,
+                                                           pOut->blockHeight,
+                                                           pOut->blockSlices);
+
+                    pOut->epitchIsHeight = TRUE;
+                    pOut->pitch          = tailMaxDim.w;
+                    pOut->height         = tailMaxDim.h;
+                    pOut->numSlices      = IsThick(pIn->resourceType, pIn->swizzleMode) ?
+                                           tailMaxDim.d : pIn->numSlices;
+                    pOut->mipChainInTail = 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) && (endingMipId > 2))
+                        {
+                            mip1WidthInBlk++;
+                        }
+
+                        pOut->mipChainPitch += (mip1WidthInBlk * pOut->blockWidth);
+
+                        pOut->epitchIsHeight = FALSE;
+                    }
+                    else
+                    {
+                        UINT_32 mip1HeightInBlk = RoundHalf(mip0HeightInBlk);
+
+                        if ((mip1HeightInBlk == 1) && (endingMipId > 2))
+                        {
+                            mip1HeightInBlk++;
+                        }
+
+                        pOut->mipChainHeight += (mip1HeightInBlk * pOut->blockHeight);
+
+                        pOut->epitchIsHeight = TRUE;
+                    }
+                }
+
+                if (pOut->pMipInfo != NULL)
+                {
+                    UINT_32 elementBytesLog2 = Log2(pIn->bpp >> 3);
+
+                    for (UINT_32 i = 0; i < pIn->numMipLevels; i++)
+                    {
+                        Dim3d   mipStartPos          = {0};
+                        UINT_32 mipTailOffsetInBytes = 0;
+
+                        mipStartPos = GetMipStartPos(pIn->resourceType,
+                                                     pIn->swizzleMode,
+                                                     pOut->pitch,
+                                                     pOut->height,
+                                                     pOut->numSlices,
+                                                     pOut->blockWidth,
+                                                     pOut->blockHeight,
+                                                     pOut->blockSlices,
+                                                     i,
+                                                     elementBytesLog2,
+                                                     &mipTailOffsetInBytes);
+
+                        UINT_32 pitchInBlock     =
+                            pOut->mipChainPitch / pOut->blockWidth;
+                        UINT_32 sliceInBlock     =
+                            (pOut->mipChainHeight / pOut->blockHeight) * pitchInBlock;
+                        UINT_64 blockIndex       =
+                            mipStartPos.d * sliceInBlock + mipStartPos.h * pitchInBlock + mipStartPos.w;
+                        UINT_64 macroBlockOffset =
+                            blockIndex << GetBlockSizeLog2(pIn->swizzleMode);
+
+                        pOut->pMipInfo[i].macroBlockOffset = macroBlockOffset;
+                        pOut->pMipInfo[i].mipTailOffset    = mipTailOffsetInBytes;
+                    }
+                }
+            }
+            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 = static_cast<UINT_64>(pOut->mipChainPitch) * pOut->mipChainHeight *
+                              (pIn->bpp >> 3) * pIn->numFrags;
+            pOut->surfSize  = pOut->sliceSize * pOut->mipChainSlice;
+            pOut->baseAlign = ComputeSurfaceBaseAlignTiled(pIn->swizzleMode);
+
+            if ((IsBlock256b(pIn->swizzleMode) == FALSE) &&
+                (pIn->flags.color || pIn->flags.depth || pIn->flags.stencil || pIn->flags.fmask) &&
+                (pIn->flags.texture == TRUE) &&
+                (pIn->flags.noMetadata == FALSE) &&
+                (pIn->flags.metaPipeUnaligned == FALSE))
+            {
+                // Assume client requires pipe aligned metadata, which is TcCompatible and will be accessed by TC...
+                // Then we need extra padding for base surface. Otherwise, metadata and data surface for same pixel will
+                // be flushed to different pipes, but texture engine only uses pipe id of data surface to fetch both of
+                // them, which may cause invalid metadata to be fetched.
+                pOut->baseAlign = Max(pOut->baseAlign, m_pipeInterleaveBytes * m_pipes);
+            }
+
+            if (pIn->flags.prt)
+            {
+                pOut->baseAlign = Max(pOut->baseAlign, PrtAlignment);
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeSurfaceInfoLinear
+*
+*   @brief
+*       Internal function to calculate alignment for linear surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceInfoLinear(
+     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;
+    const UINT_32     alignment    = pIn->flags.prt ? PrtAlignment : 256;
+
+    if (IsTex1d(pIn->resourceType))
+    {
+        if (pIn->height > 1)
+        {
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+        else
+        {
+            const UINT_32 pitchAlignInElement = alignment / elementBytes;
+
+            pitch        = PowTwoAlign(pIn->width, pitchAlignInElement);
+            actualHeight = pIn->numMipLevels;
+
+            if (pIn->flags.prt == FALSE)
+            {
+                returnCode = ApplyCustomizedPitchHeight(pIn, elementBytes, pitchAlignInElement,
+                                                        &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      = static_cast<UINT_64>(pOut->pitch) * actualHeight * elementBytes;
+        pOut->surfSize       = pOut->sliceSize * pOut->numSlices;
+        pOut->baseAlign      = (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL) ? (pIn->bpp / 8) : alignment;
+        pOut->blockWidth     = (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL) ? 1 : (256 / elementBytes);
+        pOut->blockHeight    = 1;
+        pOut->blockSlices    = 1;
+    }
+
+    // Post calculation validate
+    ADDR_ASSERT(pOut->sliceSize > 0);
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::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 Gfx9Lib::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 firstMipIdInTail = numMipLevel;
+    BOOL_32 inTail           = FALSE;
+    BOOL_32 finalDim         = FALSE;
+    BOOL_32 is3dThick        = IsThick(resourceType, swizzleMode);
+    BOOL_32 is3dThin         = IsTex3d(resourceType) && (is3dThick == FALSE);
+
+    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  = Block256_3dZ[index].w;
+                        mipHeight = Block256_3dZ[index].h;
+                        mipDepth  = Block256_3dZ[index].d;
+                    }
+                    else
+                    {
+                        mipPitch  = Block256_2d[index].w;
+                        mipHeight = Block256_2d[index].h;
+                    }
+
+                    finalDim = TRUE;
+                }
+            }
+        }
+        else
+        {
+            inTail = IsInMipTail(resourceType, swizzleMode, tailMaxDim,
+                                 mipPitch, mipHeight, mipDepth);
+
+            if (inTail)
+            {
+                firstMipIdInTail = 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);
+                }
+            }
+        }
+
+        if (pMipInfo != NULL)
+        {
+            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 firstMipIdInTail;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::GetMetaMiptailInfo
+*
+*   @brief
+*       Get mip tail coordinate information.
+*
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+VOID Gfx9Lib::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;
+            }
+        }
+    }
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::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 Gfx9Lib::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           log2ElementBytes,
+    UINT_32*          pMipTailBytesOffset) 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);
+    UINT_32 mipIndexInTail = mipId;
+
+    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;
+            mipIndexInTail = mipId - endingMip;
+        }
+    }
+
+    if (inMipTail)
+    {
+        UINT_32 index = mipIndexInTail + MaxMacroBits - log2blkSize;
+        ADDR_ASSERT(index < sizeof(MipTailOffset256B) / sizeof(UINT_32));
+        *pMipTailBytesOffset = MipTailOffset256B[index] << 8;
+    }
+
+    return mipStartPos;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::HwlComputeSurfaceAddrFromCoordTiled
+*
+*   @brief
+*       Internal function to calculate address from coord for tiled swizzle surface
+*
+*   @return
+*       ADDR_E_RETURNCODE
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::HwlComputeSurfaceAddrFromCoordTiled(
+     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);
+    localIn.numSamples   = Max(pIn->numSamples, 1u);
+    localIn.numFrags     = Max(pIn->numFrags, 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)
+    {
+        UINT_32 log2ElementBytes   = Log2(pIn->bpp >> 3);
+        Dim3d   mipStartPos        = {0};
+        UINT_32 mipTailBytesOffset = 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,
+                                         log2ElementBytes,
+                                         &mipTailBytesOffset);
+        }
+
+        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);
+
+            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 < MaxNumOfBpp);
+                Dim2d microBlockDim = Block256_2d[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 | mipTailBytesOffset) == (blockOffset + mipTailBytesOffset));
+            ADDR_ASSERT((mipTailBytesOffset == 0u) || (blockOffset < (1u << log2blkSize)));
+
+            blockOffset |= mipTailBytesOffset;
+
+            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_64 macroBlockIndex =
+                (pIn->slice + mipStartPos.d) * sliceSizeInMacroBlock +
+                ((pIn->y / localOut.blockHeight) + mipStartPos.h) * pitchInMacroBlock +
+                ((pIn->x / localOut.blockWidth) + mipStartPos.w);
+
+            pOut->addr = blockOffset | (macroBlockIndex << log2blkSize);
+        }
+        else
+        {
+            UINT_32 log2blkSize = GetBlockSizeLog2(pIn->swizzleMode);
+
+            Dim3d microBlockDim = Block1K_3d[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 | mipTailBytesOffset) == (blockOffset + mipTailBytesOffset));
+            ADDR_ASSERT((mipTailBytesOffset == 0u) || (blockOffset < (1u << log2blkSize)));
+            blockOffset |= mipTailBytesOffset;
+
+            returnCode = ApplyCustomerPipeBankXor(pIn->swizzleMode, pIn->pipeBankXor,
+                                                  bankBits, pipeBits, &blockOffset);
+
+            blockOffset %= (1 << log2blkSize);
+
+            UINT_32 xb = pIn->x / localOut.blockWidth  + mipStartPos.w;
+            UINT_32 yb = pIn->y / localOut.blockHeight + mipStartPos.h;
+            UINT_32 zb = pIn->slice / localOut.blockSlices + + mipStartPos.d;
+
+            UINT_32 pitchInBlock = localOut.mipChainPitch / localOut.blockWidth;
+            UINT_32 sliceSizeInBlock =
+                (localOut.mipChainHeight / localOut.blockHeight) * pitchInBlock;
+            UINT_64 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb;
+
+            pOut->addr = blockOffset | (blockIndex << log2blkSize);
+        }
+    }
+    else
+    {
+        returnCode = ADDR_INVALIDPARAMS;
+    }
+
+    return returnCode;
+}
+
+/**
+************************************************************************************************************************
+*   Gfx9Lib::ComputeSurfaceInfoLinear
+*
+*   @brief
+*       Internal function to calculate padding for linear swizzle 2D/3D surface
+*
+*   @return
+*       N/A
+************************************************************************************************************************
+*/
+ADDR_E_RETURNCODE Gfx9Lib::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 pitchAlignInElement = 0;
+
+    if (pIn->swizzleMode == ADDR_SW_LINEAR_GENERAL)
+    {
+        ADDR_ASSERT(pIn->numMipLevels <= 1);
+        ADDR_ASSERT(pIn->numSlices <= 1);
+        pitchAlignInElement = 1;
+    }
+    else
+    {
+        pitchAlignInElement = (256 / elementBytes);
+    }
+
+    UINT_32 mipChainWidth      = PowTwoAlign(pIn->width, pitchAlignInElement);
+    UINT_32 slice0PaddedHeight = pIn->height;
+
+    returnCode = ApplyCustomizedPitchHeight(pIn, elementBytes, pitchAlignInElement,
+                                            &mipChainWidth, &slice0PaddedHeight);
+
+    if (returnCode == ADDR_OK)
+    {
+        UINT_32 mipChainHeight = 0;
+        UINT_32 mipHeight      = pIn->height;
+        UINT_32 mipDepth       = (pIn->resourceType == ADDR_RSRC_TEX_3D) ? pIn->numSlices : 1;
+
+        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  = mipDepth;
+            }
+
+            mipChainHeight += mipHeight;
+            mipHeight = RoundHalf(mipHeight);
+            mipHeight = Max(mipHeight, 1u);
+        }
+
+        *pMipmap0PaddedWidth = mipChainWidth;
+        *pSlice0PaddedHeight = (pIn->numMipLevels > 1) ? mipChainHeight : slice0PaddedHeight;
+    }
+
+    return returnCode;
+}
+
+} // V2
+} // Addr
diff --git a/src/amd/addrlib/src/gfx9/gfx9addrlib.h b/src/amd/addrlib/src/gfx9/gfx9addrlib.h
new file mode 100644 (file)
index 0000000..73f0353
--- /dev/null
@@ -0,0 +1,629 @@
+/*
+ * Copyright © 2007-2018 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  gfx9addrlib.h
+* @brief Contgfx9ns the Gfx9Lib class definition.
+************************************************************************************************************************
+*/
+
+#ifndef __GFX9_ADDR_LIB_H__
+#define __GFX9_ADDR_LIB_H__
+
+#include "addrlib2.h"
+#include "coord.h"
+
+namespace Addr
+{
+namespace V2
+{
+
+/**
+************************************************************************************************************************
+* @brief GFX9 specific settings structure.
+************************************************************************************************************************
+*/
+struct Gfx9ChipSettings
+{
+    struct
+    {
+        // Asic/Generation name
+        UINT_32 isArcticIsland      : 1;
+        UINT_32 isVega10            : 1;
+        UINT_32 isRaven             : 1;
+        UINT_32 isVega12            : 1;
+        UINT_32 isVega20            : 1;
+        UINT_32 reserved0           : 27;
+
+        // Display engine IP version name
+        UINT_32 isDce12             : 1;
+        UINT_32 isDcn1              : 1;
+
+        // Misc configuration bits
+        UINT_32 metaBaseAlignFix    : 1;
+        UINT_32 depthPipeXorDisable : 1;
+        UINT_32 htileAlignFix       : 1;
+        UINT_32 applyAliasFix       : 1;
+        UINT_32 htileCacheRbConflict: 1;
+        UINT_32 reserved2           : 27;
+    };
+};
+
+/**
+************************************************************************************************************************
+* @brief GFX9 data surface type.
+************************************************************************************************************************
+*/
+enum Gfx9DataType
+{
+    Gfx9DataColor,
+    Gfx9DataDepthStencil,
+    Gfx9DataFmask
+};
+
+const UINT_32 Gfx9LinearSwModeMask = (1u << ADDR_SW_LINEAR);
+
+const UINT_32 Gfx9Blk256BSwModeMask = (1u << ADDR_SW_256B_S) |
+                                      (1u << ADDR_SW_256B_D) |
+                                      (1u << ADDR_SW_256B_R);
+
+const UINT_32 Gfx9Blk4KBSwModeMask = (1u << ADDR_SW_4KB_Z)   |
+                                     (1u << ADDR_SW_4KB_S)   |
+                                     (1u << ADDR_SW_4KB_D)   |
+                                     (1u << ADDR_SW_4KB_R)   |
+                                     (1u << ADDR_SW_4KB_Z_X) |
+                                     (1u << ADDR_SW_4KB_S_X) |
+                                     (1u << ADDR_SW_4KB_D_X) |
+                                     (1u << ADDR_SW_4KB_R_X);
+
+const UINT_32 Gfx9Blk64KBSwModeMask = (1u << ADDR_SW_64KB_Z)   |
+                                      (1u << ADDR_SW_64KB_S)   |
+                                      (1u << ADDR_SW_64KB_D)   |
+                                      (1u << ADDR_SW_64KB_R)   |
+                                      (1u << ADDR_SW_64KB_Z_T) |
+                                      (1u << ADDR_SW_64KB_S_T) |
+                                      (1u << ADDR_SW_64KB_D_T) |
+                                      (1u << ADDR_SW_64KB_R_T) |
+                                      (1u << ADDR_SW_64KB_Z_X) |
+                                      (1u << ADDR_SW_64KB_S_X) |
+                                      (1u << ADDR_SW_64KB_D_X) |
+                                      (1u << ADDR_SW_64KB_R_X);
+
+const UINT_32 Gfx9BlkVarSwModeMask = (1u << ADDR_SW_VAR_Z)   |
+                                     (1u << ADDR_SW_VAR_S)   |
+                                     (1u << ADDR_SW_VAR_D)   |
+                                     (1u << ADDR_SW_VAR_R)   |
+                                     (1u << ADDR_SW_VAR_Z_X) |
+                                     (1u << ADDR_SW_VAR_S_X) |
+                                     (1u << ADDR_SW_VAR_D_X) |
+                                     (1u << ADDR_SW_VAR_R_X);
+
+const UINT_32 Gfx9ZSwModeMask = (1u << ADDR_SW_4KB_Z)    |
+                                (1u << ADDR_SW_64KB_Z)   |
+                                (1u << ADDR_SW_VAR_Z)    |
+                                (1u << ADDR_SW_64KB_Z_T) |
+                                (1u << ADDR_SW_4KB_Z_X)  |
+                                (1u << ADDR_SW_64KB_Z_X) |
+                                (1u << ADDR_SW_VAR_Z_X);
+
+const UINT_32 Gfx9StandardSwModeMask = (1u << ADDR_SW_256B_S)   |
+                                       (1u << ADDR_SW_4KB_S)    |
+                                       (1u << ADDR_SW_64KB_S)   |
+                                       (1u << ADDR_SW_VAR_S)    |
+                                       (1u << ADDR_SW_64KB_S_T) |
+                                       (1u << ADDR_SW_4KB_S_X)  |
+                                       (1u << ADDR_SW_64KB_S_X) |
+                                       (1u << ADDR_SW_VAR_S_X);
+
+const UINT_32 Gfx9DisplaySwModeMask = (1u << ADDR_SW_256B_D)   |
+                                      (1u << ADDR_SW_4KB_D)    |
+                                      (1u << ADDR_SW_64KB_D)   |
+                                      (1u << ADDR_SW_VAR_D)    |
+                                      (1u << ADDR_SW_64KB_D_T) |
+                                      (1u << ADDR_SW_4KB_D_X)  |
+                                      (1u << ADDR_SW_64KB_D_X) |
+                                      (1u << ADDR_SW_VAR_D_X);
+
+const UINT_32 Gfx9RotateSwModeMask = (1u << ADDR_SW_256B_R)   |
+                                     (1u << ADDR_SW_4KB_R)    |
+                                     (1u << ADDR_SW_64KB_R)   |
+                                     (1u << ADDR_SW_VAR_R)    |
+                                     (1u << ADDR_SW_64KB_R_T) |
+                                     (1u << ADDR_SW_4KB_R_X)  |
+                                     (1u << ADDR_SW_64KB_R_X) |
+                                     (1u << ADDR_SW_VAR_R_X);
+
+const UINT_32 Gfx9XSwModeMask = (1u << ADDR_SW_4KB_Z_X)  |
+                                (1u << ADDR_SW_4KB_S_X)  |
+                                (1u << ADDR_SW_4KB_D_X)  |
+                                (1u << ADDR_SW_4KB_R_X)  |
+                                (1u << ADDR_SW_64KB_Z_X) |
+                                (1u << ADDR_SW_64KB_S_X) |
+                                (1u << ADDR_SW_64KB_D_X) |
+                                (1u << ADDR_SW_64KB_R_X) |
+                                (1u << ADDR_SW_VAR_Z_X)  |
+                                (1u << ADDR_SW_VAR_S_X)  |
+                                (1u << ADDR_SW_VAR_D_X)  |
+                                (1u << ADDR_SW_VAR_R_X);
+
+const UINT_32 Gfx9TSwModeMask = (1u << ADDR_SW_64KB_Z_T) |
+                                (1u << ADDR_SW_64KB_S_T) |
+                                (1u << ADDR_SW_64KB_D_T) |
+                                (1u << ADDR_SW_64KB_R_T);
+
+const UINT_32 Gfx9XorSwModeMask = Gfx9XSwModeMask |
+                                  Gfx9TSwModeMask;
+
+const UINT_32 Gfx9AllSwModeMask = Gfx9LinearSwModeMask   |
+                                  Gfx9ZSwModeMask        |
+                                  Gfx9StandardSwModeMask |
+                                  Gfx9DisplaySwModeMask  |
+                                  Gfx9RotateSwModeMask;
+
+const UINT_32 Gfx9Rsrc1dSwModeMask = Gfx9LinearSwModeMask;
+
+const UINT_32 Gfx9Rsrc2dSwModeMask = Gfx9AllSwModeMask;
+
+const UINT_32 Gfx9Rsrc3dSwModeMask = Gfx9AllSwModeMask & ~Gfx9Blk256BSwModeMask & ~Gfx9RotateSwModeMask;
+
+const UINT_32 Gfx9Rsrc2dPrtSwModeMask = (Gfx9Blk4KBSwModeMask | Gfx9Blk64KBSwModeMask) & ~Gfx9XSwModeMask;
+
+const UINT_32 Gfx9Rsrc3dPrtSwModeMask = Gfx9Rsrc2dPrtSwModeMask & ~Gfx9RotateSwModeMask & ~Gfx9DisplaySwModeMask;
+
+const UINT_32 Gfx9Rsrc3dThinSwModeMask = Gfx9DisplaySwModeMask & ~Gfx9Blk256BSwModeMask;
+
+const UINT_32 Gfx9MsaaSwModeMask = Gfx9AllSwModeMask & ~Gfx9Blk256BSwModeMask & ~Gfx9LinearSwModeMask;
+
+const UINT_32 Dce12NonBpp32SwModeMask = (1u << ADDR_SW_LINEAR)   |
+                                        (1u << ADDR_SW_4KB_D)    |
+                                        (1u << ADDR_SW_4KB_R)    |
+                                        (1u << ADDR_SW_64KB_D)   |
+                                        (1u << ADDR_SW_64KB_R)   |
+                                        (1u << ADDR_SW_VAR_D)    |
+                                        (1u << ADDR_SW_VAR_R)    |
+                                        (1u << ADDR_SW_4KB_D_X)  |
+                                        (1u << ADDR_SW_4KB_R_X)  |
+                                        (1u << ADDR_SW_64KB_D_X) |
+                                        (1u << ADDR_SW_64KB_R_X) |
+                                        (1u << ADDR_SW_VAR_D_X)  |
+                                        (1u << ADDR_SW_VAR_R_X);
+
+const UINT_32 Dce12Bpp32SwModeMask = (1u << ADDR_SW_256B_D) |
+                                     (1u << ADDR_SW_256B_R) |
+                                     Dce12NonBpp32SwModeMask;
+
+const UINT_32 Dcn1NonBpp64SwModeMask = (1u << ADDR_SW_LINEAR)   |
+                                       (1u << ADDR_SW_4KB_S)    |
+                                       (1u << ADDR_SW_64KB_S)   |
+                                       (1u << ADDR_SW_VAR_S)    |
+                                       (1u << ADDR_SW_64KB_S_T) |
+                                       (1u << ADDR_SW_4KB_S_X)  |
+                                       (1u << ADDR_SW_64KB_S_X) |
+                                       (1u << ADDR_SW_VAR_S_X);
+
+const UINT_32 Dcn1Bpp64SwModeMask = (1u << ADDR_SW_4KB_D)    |
+                                    (1u << ADDR_SW_64KB_D)   |
+                                    (1u << ADDR_SW_VAR_D)    |
+                                    (1u << ADDR_SW_64KB_D_T) |
+                                    (1u << ADDR_SW_4KB_D_X)  |
+                                    (1u << ADDR_SW_64KB_D_X) |
+                                    (1u << ADDR_SW_VAR_D_X)  |
+                                    Dcn1NonBpp64SwModeMask;
+
+/**
+************************************************************************************************************************
+* @brief GFX9 meta equation parameters
+************************************************************************************************************************
+*/
+struct MetaEqParams
+{
+    UINT_32          maxMip;
+    UINT_32          elementBytesLog2;
+    UINT_32          numSamplesLog2;
+    ADDR2_META_FLAGS metaFlag;
+    Gfx9DataType     dataSurfaceType;
+    AddrSwizzleMode  swizzleMode;
+    AddrResourceType resourceType;
+    UINT_32          metaBlkWidthLog2;
+    UINT_32          metaBlkHeightLog2;
+    UINT_32          metaBlkDepthLog2;
+    UINT_32          compBlkWidthLog2;
+    UINT_32          compBlkHeightLog2;
+    UINT_32          compBlkDepthLog2;
+};
+
+/**
+************************************************************************************************************************
+* @brief This class is the GFX9 specific address library
+*        function set.
+************************************************************************************************************************
+*/
+class Gfx9Lib : public Lib
+{
+public:
+    /// Creates Gfx9Lib object
+    static Addr::Lib* CreateObj(const Client* pClient)
+    {
+        VOID* pMem = Object::ClientAlloc(sizeof(Gfx9Lib), pClient);
+        return (pMem != NULL) ? new (pMem) Gfx9Lib(pClient) : NULL;
+    }
+
+    virtual BOOL_32 IsValidDisplaySwizzleMode(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
+
+protected:
+    Gfx9Lib(const Client* pClient);
+    virtual ~Gfx9Lib();
+
+    virtual BOOL_32 HwlIsStandardSwizzle(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        return m_swizzleModeTable[swizzleMode].isStd ||
+               (IsTex3d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp);
+    }
+
+    virtual BOOL_32 HwlIsDisplaySwizzle(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        return IsTex2d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp;
+    }
+
+    virtual BOOL_32 HwlIsThin(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        return ((IsTex2d(resourceType)  == TRUE) ||
+                ((IsTex3d(resourceType) == TRUE)                  &&
+                 (m_swizzleModeTable[swizzleMode].isZ   == FALSE) &&
+                 (m_swizzleModeTable[swizzleMode].isStd == FALSE)));
+    }
+
+    virtual BOOL_32 HwlIsThick(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode) const
+    {
+        return (IsTex3d(resourceType) &&
+                (m_swizzleModeTable[swizzleMode].isZ || m_swizzleModeTable[swizzleMode].isStd));
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileInfo(
+        const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_INFO_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskInfo(
+        const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_CMASK_INFO_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
+        const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
+        ADDR2_COMPUTE_DCCINFO_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
+        const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*      pOut);
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
+        const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*      pOut);
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
+        const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
+        ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT*      pOut);
+
+    virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord(
+        const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT*      pOut);
+
+    virtual UINT_32 HwlGetEquationIndex(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeBlock256Equation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeThinEquation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeThickEquation(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2,
+        ADDR_EQUATION* pEquation) const;
+
+    // Get equation table pointer and number of equations
+    virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
+    {
+        *ppEquationTable = m_equationTable;
+
+        return m_numEquations;
+    }
+
+    virtual BOOL_32 IsEquationSupported(
+        AddrResourceType rsrcType,
+        AddrSwizzleMode swMode,
+        UINT_32 elementBytesLog2) const;
+
+    UINT_32 ComputeSurfaceBaseAlignTiled(AddrSwizzleMode swizzleMode) const
+    {
+        UINT_32 baseAlign;
+
+        if (IsXor(swizzleMode))
+        {
+            baseAlign = GetBlockSize(swizzleMode);
+        }
+        else
+        {
+            baseAlign = 256;
+        }
+
+        return baseAlign;
+    }
+
+    virtual ADDR_E_RETURNCODE HwlComputePipeBankXor(
+        const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
+        const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
+        ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
+        const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
+        ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
+        const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
+        ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
+         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
+         const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+         ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
+        const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut) const;
+
+    // Initialize equation table
+    VOID InitEquationTable();
+
+    ADDR_E_RETURNCODE ComputeStereoInfo(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR2_COMPUTE_SURFACE_INFO_OUTPUT*      pOut,
+        UINT_32*                                pHeightAlign) const;
+
+    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;
+
+    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           log2ElementBytes,
+        UINT_32*          pMipTailBytesOffset) const;
+
+    AddrMajorMode GetMajorMode(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode,
+        UINT_32          mip0WidthInBlk,
+        UINT_32          mip0HeightInBlk,
+        UINT_32          mip0DepthInBlk) const
+    {
+        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;
+    }
+
+    Dim3d GetDccCompressBlk(
+        AddrResourceType resourceType,
+        AddrSwizzleMode  swizzleMode,
+        UINT_32          bpp) const
+    {
+        UINT_32 index = Log2(bpp >> 3);
+        Dim3d   compressBlkDim;
+
+        if (IsThin(resourceType, swizzleMode))
+        {
+            compressBlkDim.w = Block256_2d[index].w;
+            compressBlkDim.h = Block256_2d[index].h;
+            compressBlkDim.d = 1;
+        }
+        else if (IsStandardSwizzle(resourceType, swizzleMode))
+        {
+            compressBlkDim = Block256_3dS[index];
+        }
+        else
+        {
+            compressBlkDim = Block256_3dZ[index];
+        }
+
+        return compressBlkDim;
+    }
+
+    static const UINT_32          MaxSeLog2      = 3;
+    static const UINT_32          MaxRbPerSeLog2 = 2;
+
+    static const Dim3d            Block256_3dS[MaxNumOfBpp];
+    static const Dim3d            Block256_3dZ[MaxNumOfBpp];
+
+    static const UINT_32          MipTailOffset256B[];
+
+    static const SwizzleModeFlags SwizzleModeTable[ADDR_SW_MAX_TYPE];
+
+    // Max number of swizzle mode supported for equation
+    static const UINT_32    MaxSwMode = 32;
+    // Max number of resource type (2D/3D) supported for equation
+    static const UINT_32    MaxRsrcType = 2;
+    // Max number of bpp (8bpp/16bpp/32bpp/64bpp/128bpp)
+    static const UINT_32    MaxElementBytesLog2  = 5;
+    // Almost all swizzle mode + resource type support equation
+    static const UINT_32    EquationTableSize = MaxElementBytesLog2 * MaxSwMode * MaxRsrcType;
+    // Equation table
+    ADDR_EQUATION           m_equationTable[EquationTableSize];
+
+    // Number of equation entries in the table
+    UINT_32                 m_numEquations;
+    // Equation lookup table according to bpp and tile index
+    UINT_32                 m_equationLookupTable[MaxRsrcType][MaxSwMode][MaxElementBytesLog2];
+
+    static const UINT_32    MaxCachedMetaEq = 2;
+
+private:
+    virtual UINT_32 HwlComputeMaxBaseAlignments() const;
+
+    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
+
+    virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn);
+
+    VOID GetRbEquation(CoordEq* pRbEq, UINT_32 rbPerSeLog2, UINT_32 seLog2) const;
+
+    VOID GetDataEquation(CoordEq* pDataEq, Gfx9DataType dataSurfaceType,
+                         AddrSwizzleMode swizzleMode, AddrResourceType resourceType,
+                         UINT_32 elementBytesLog2, UINT_32 numSamplesLog2) const;
+
+    VOID GetPipeEquation(CoordEq* pPipeEq, CoordEq* pDataEq,
+                         UINT_32 pipeInterleaveLog2, UINT_32 numPipesLog2,
+                         UINT_32 numSamplesLog2, Gfx9DataType dataSurfaceType,
+                         AddrSwizzleMode swizzleMode, AddrResourceType resourceType) const;
+
+    VOID GenMetaEquation(CoordEq* pMetaEq, UINT_32 maxMip,
+                         UINT_32 elementBytesLog2, UINT_32 numSamplesLog2,
+                         ADDR2_META_FLAGS metaFlag, Gfx9DataType dataSurfaceType,
+                         AddrSwizzleMode swizzleMode, AddrResourceType resourceType,
+                         UINT_32 metaBlkWidthLog2, UINT_32 metaBlkHeightLog2,
+                         UINT_32 metaBlkDepthLog2, UINT_32 compBlkWidthLog2,
+                         UINT_32 compBlkHeightLog2, UINT_32 compBlkDepthLog2) const;
+
+    const CoordEq* GetMetaEquation(const MetaEqParams& metaEqParams);
+
+    virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
+
+    VOID GetMetaMipInfo(UINT_32 numMipLevels, Dim3d* pMetaBlkDim,
+                        BOOL_32 dataThick, ADDR2_META_MIP_INFO* pInfo,
+                        UINT_32 mip0Width, UINT_32 mip0Height, UINT_32 mip0Depth,
+                        UINT_32* pNumMetaBlkX, UINT_32* pNumMetaBlkY, UINT_32* pNumMetaBlkZ) const;
+
+    ADDR_E_RETURNCODE ComputeSurfaceLinearPadding(
+        const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32*                                pMipmap0PaddedWidth,
+        UINT_32*                                pSlice0PaddedHeight,
+        ADDR2_MIP_INFO*                         pMipInfo = NULL) const;
+
+    static ADDR2_BLOCK_SET GetAllowedBlockSet(ADDR2_SWMODE_SET allowedSwModeSet)
+    {
+        ADDR2_BLOCK_SET allowedBlockSet = {};
+
+        allowedBlockSet.micro     = (allowedSwModeSet.value & Gfx9Blk256BSwModeMask) ? TRUE : FALSE;
+        allowedBlockSet.macro4KB  = (allowedSwModeSet.value & Gfx9Blk4KBSwModeMask)  ? TRUE : FALSE;
+        allowedBlockSet.macro64KB = (allowedSwModeSet.value & Gfx9Blk64KBSwModeMask) ? TRUE : FALSE;
+        allowedBlockSet.var       = (allowedSwModeSet.value & Gfx9BlkVarSwModeMask)  ? TRUE : FALSE;
+        allowedBlockSet.linear    = (allowedSwModeSet.value & Gfx9LinearSwModeMask)  ? TRUE : FALSE;
+
+        return allowedBlockSet;
+    }
+
+    static ADDR2_SWTYPE_SET GetAllowedSwSet(ADDR2_SWMODE_SET allowedSwModeSet)
+    {
+        ADDR2_SWTYPE_SET allowedSwSet = {};
+
+        allowedSwSet.sw_Z = (allowedSwModeSet.value & Gfx9ZSwModeMask)        ? TRUE : FALSE;
+        allowedSwSet.sw_S = (allowedSwModeSet.value & Gfx9StandardSwModeMask) ? TRUE : FALSE;
+        allowedSwSet.sw_D = (allowedSwModeSet.value & Gfx9DisplaySwModeMask)  ? TRUE : FALSE;
+        allowedSwSet.sw_R = (allowedSwModeSet.value & Gfx9RotateSwModeMask)   ? TRUE : FALSE;
+
+        return allowedSwSet;
+    }
+
+    Gfx9ChipSettings m_settings;
+
+    CoordEq      m_cachedMetaEq[MaxCachedMetaEq];
+    MetaEqParams m_cachedMetaEqKey[MaxCachedMetaEq];
+    UINT_32      m_metaEqOverrideIndex;
+};
+
+} // V2
+} // Addr
+
+#endif
+
diff --git a/src/amd/addrlib/src/r800/ciaddrlib.cpp b/src/amd/addrlib/src/r800/ciaddrlib.cpp
new file mode 100644 (file)
index 0000000..5bec091
--- /dev/null
@@ -0,0 +1,2339 @@
+/*
+ * Copyright © 2007-2018 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  ciaddrlib.cpp
+* @brief Contains the implementation for the CiLib class.
+****************************************************************************************************
+*/
+
+#include "ciaddrlib.h"
+
+#include "si_gb_reg.h"
+
+#include "amdgpu_asic_addr.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace Addr
+{
+
+/**
+****************************************************************************************************
+*   CiHwlInit
+*
+*   @brief
+*       Creates an CiLib object.
+*
+*   @return
+*       Returns an CiLib object pointer.
+****************************************************************************************************
+*/
+Lib* CiHwlInit(const Client* pClient)
+{
+    return V1::CiLib::CreateObj(pClient);
+}
+
+namespace V1
+{
+
+/**
+****************************************************************************************************
+*   Mask
+*
+*   @brief
+*       Gets a mask of "width"
+*   @return
+*       Bit mask
+****************************************************************************************************
+*/
+static UINT_64 Mask(
+    UINT_32 width)  ///< Width of bits
+{
+    UINT_64 ret;
+
+    if (width >= sizeof(UINT_64)*8)
+    {
+        ret = ~((UINT_64) 0);
+    }
+    else
+    {
+        return (((UINT_64) 1) << width) - 1;
+    }
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   GetBits
+*
+*   @brief
+*       Gets bits within a range of [msb, lsb]
+*   @return
+*       Bits of this range
+****************************************************************************************************
+*/
+static UINT_64 GetBits(
+    UINT_64 bits,   ///< Source bits
+    UINT_32 msb,    ///< Most signicant bit
+    UINT_32 lsb)    ///< Least signicant bit
+{
+    UINT_64 ret = 0;
+
+    if (msb >= lsb)
+    {
+        ret = (bits >> lsb) & (Mask(1 + msb - lsb));
+    }
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   RemoveBits
+*
+*   @brief
+*       Removes bits within the range of [msb, lsb]
+*   @return
+*       Modified bits
+****************************************************************************************************
+*/
+static UINT_64 RemoveBits(
+    UINT_64 bits,   ///< Source bits
+    UINT_32 msb,    ///< Most signicant bit
+    UINT_32 lsb)    ///< Least signicant bit
+{
+    UINT_64 ret = bits;
+
+    if (msb >= lsb)
+    {
+        ret = GetBits(bits, lsb - 1, 0) // low bits
+            | (GetBits(bits, 8 * sizeof(bits) - 1, msb + 1) << lsb); //high bits
+    }
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   InsertBits
+*
+*   @brief
+*       Inserts new bits into the range of [msb, lsb]
+*   @return
+*       Modified bits
+****************************************************************************************************
+*/
+static UINT_64 InsertBits(
+    UINT_64 bits,       ///< Source bits
+    UINT_64 newBits,    ///< New bits to be inserted
+    UINT_32 msb,        ///< Most signicant bit
+    UINT_32 lsb)        ///< Least signicant bit
+{
+    UINT_64 ret = bits;
+
+    if (msb >= lsb)
+    {
+        ret = GetBits(bits, lsb - 1, 0) // old low bitss
+             | (GetBits(newBits, msb - lsb, 0) << lsb) //new bits
+             | (GetBits(bits, 8 * sizeof(bits) - 1, lsb) << (msb + 1)); //old high bits
+    }
+    return ret;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::CiLib
+*
+*   @brief
+*       Constructor
+*
+****************************************************************************************************
+*/
+CiLib::CiLib(const Client* pClient)
+    :
+    SiLib(pClient),
+    m_noOfMacroEntries(0),
+    m_allowNonDispThickModes(FALSE)
+{
+    m_class = CI_ADDRLIB;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::~CiLib
+*
+*   @brief
+*       Destructor
+****************************************************************************************************
+*/
+CiLib::~CiLib()
+{
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeDccInfo
+*
+*   @brief
+*       Compute DCC key size, base alignment
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiLib::HwlComputeDccInfo(
+    const ADDR_COMPUTE_DCCINFO_INPUT*  pIn,
+    ADDR_COMPUTE_DCCINFO_OUTPUT*       pOut) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    if (m_settings.isVolcanicIslands && IsMacroTiled(pIn->tileMode))
+    {
+        UINT_64 dccFastClearSize = pIn->colorSurfSize >> 8;
+
+        ADDR_ASSERT(0 == (pIn->colorSurfSize & 0xff));
+
+        if (pIn->numSamples > 1)
+        {
+            UINT_32 tileSizePerSample = BITS_TO_BYTES(pIn->bpp * MicroTileWidth * MicroTileHeight);
+            UINT_32 samplesPerSplit  = pIn->tileInfo.tileSplitBytes / tileSizePerSample;
+
+            if (samplesPerSplit < pIn->numSamples)
+            {
+                UINT_32 numSplits = pIn->numSamples / samplesPerSplit;
+                UINT_32 fastClearBaseAlign = HwlGetPipes(&pIn->tileInfo) * m_pipeInterleaveBytes;
+
+                ADDR_ASSERT(IsPow2(fastClearBaseAlign));
+
+                dccFastClearSize /= numSplits;
+
+                if (0 != (dccFastClearSize & (fastClearBaseAlign - 1)))
+                {
+                    // Disable dcc fast clear
+                    // if key size of fisrt sample split is not pipe*interleave aligned
+                    dccFastClearSize = 0;
+                }
+            }
+        }
+
+        pOut->dccRamSize          = pIn->colorSurfSize >> 8;
+        pOut->dccRamBaseAlign     = pIn->tileInfo.banks *
+                                    HwlGetPipes(&pIn->tileInfo) *
+                                    m_pipeInterleaveBytes;
+        pOut->dccFastClearSize    = dccFastClearSize;
+        pOut->dccRamSizeAligned   = TRUE;
+
+        ADDR_ASSERT(IsPow2(pOut->dccRamBaseAlign));
+
+        if (0 == (pOut->dccRamSize & (pOut->dccRamBaseAlign - 1)))
+        {
+            pOut->subLvlCompressible = TRUE;
+        }
+        else
+        {
+            UINT_64 dccRamSizeAlign = HwlGetPipes(&pIn->tileInfo) * m_pipeInterleaveBytes;
+
+            if (pOut->dccRamSize == pOut->dccFastClearSize)
+            {
+                pOut->dccFastClearSize = PowTwoAlign(pOut->dccRamSize, dccRamSizeAlign);
+            }
+            if ((pOut->dccRamSize & (dccRamSizeAlign - 1)) != 0)
+            {
+                pOut->dccRamSizeAligned = FALSE;
+            }
+            pOut->dccRamSize          = PowTwoAlign(pOut->dccRamSize, dccRamSizeAlign);
+            pOut->subLvlCompressible  = FALSE;
+        }
+    }
+    else
+    {
+        returnCode = ADDR_NOTSUPPORTED;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeCmaskAddrFromCoord
+*
+*   @brief
+*       Compute tc compatible Cmask address from fmask ram address
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiLib::HwlComputeCmaskAddrFromCoord(
+    const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT*  pIn,  ///< [in] fmask addr/bpp/tile input
+    ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT*       pOut  ///< [out] cmask address
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_NOTSUPPORTED;
+
+    if ((m_settings.isVolcanicIslands == TRUE) &&
+        (pIn->flags.tcCompatible == TRUE))
+    {
+        UINT_32 numOfPipes   = HwlGetPipes(pIn->pTileInfo);
+        UINT_32 numOfBanks   = pIn->pTileInfo->banks;
+        UINT_64 fmaskAddress = pIn->fmaskAddr;
+        UINT_32 elemBits     = pIn->bpp;
+        UINT_32 blockByte    = 64 * elemBits / 8;
+        UINT_64 metaNibbleAddress = HwlComputeMetadataNibbleAddress(fmaskAddress,
+                                                                    0,
+                                                                    0,
+                                                                    4,   // cmask 4 bits
+                                                                    elemBits,
+                                                                    blockByte,
+                                                                    m_pipeInterleaveBytes,
+                                                                    numOfPipes,
+                                                                    numOfBanks,
+                                                                    1);
+        pOut->addr = (metaNibbleAddress >> 1);
+        pOut->bitPosition = (metaNibbleAddress % 2) ? 4 : 0;
+        returnCode = ADDR_OK;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeHtileAddrFromCoord
+*
+*   @brief
+*       Compute tc compatible Htile address from depth/stencil address
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiLib::HwlComputeHtileAddrFromCoord(
+    const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,  ///< [in] depth/stencil addr/bpp/tile input
+    ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*       pOut  ///< [out] htile address
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_NOTSUPPORTED;
+
+    if ((m_settings.isVolcanicIslands == TRUE) &&
+        (pIn->flags.tcCompatible == TRUE))
+    {
+        UINT_32 numOfPipes   = HwlGetPipes(pIn->pTileInfo);
+        UINT_32 numOfBanks   = pIn->pTileInfo->banks;
+        UINT_64 zStencilAddr = pIn->zStencilAddr;
+        UINT_32 elemBits     = pIn->bpp;
+        UINT_32 blockByte    = 64 * elemBits / 8;
+        UINT_64 metaNibbleAddress = HwlComputeMetadataNibbleAddress(zStencilAddr,
+                                                                    0,
+                                                                    0,
+                                                                    32,  // htile 32 bits
+                                                                    elemBits,
+                                                                    blockByte,
+                                                                    m_pipeInterleaveBytes,
+                                                                    numOfPipes,
+                                                                    numOfBanks,
+                                                                    1);
+        pOut->addr = (metaNibbleAddress >> 1);
+        pOut->bitPosition = 0;
+        returnCode = ADDR_OK;
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlConvertChipFamily
+*
+*   @brief
+*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
+*   @return
+*       ChipFamily
+****************************************************************************************************
+*/
+ChipFamily CiLib::HwlConvertChipFamily(
+    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
+    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
+{
+    ChipFamily family = ADDR_CHIP_FAMILY_CI;
+
+    switch (uChipFamily)
+    {
+        case FAMILY_CI:
+            m_settings.isSeaIsland  = 1;
+            m_settings.isBonaire    = ASICREV_IS_BONAIRE_M(uChipRevision);
+            m_settings.isHawaii     = ASICREV_IS_HAWAII_P(uChipRevision);
+            break;
+        case FAMILY_KV:
+            m_settings.isKaveri     = 1;
+            m_settings.isSpectre    = ASICREV_IS_SPECTRE(uChipRevision);
+            m_settings.isSpooky     = ASICREV_IS_SPOOKY(uChipRevision);
+            m_settings.isKalindi    = ASICREV_IS_KALINDI(uChipRevision);
+            break;
+        case FAMILY_VI:
+            m_settings.isVolcanicIslands = 1;
+            m_settings.isIceland         = ASICREV_IS_ICELAND_M(uChipRevision);
+            m_settings.isTonga           = ASICREV_IS_TONGA_P(uChipRevision);
+            m_settings.isFiji            = ASICREV_IS_FIJI_P(uChipRevision);
+            m_settings.isPolaris10       = ASICREV_IS_POLARIS10_P(uChipRevision);
+            m_settings.isPolaris11       = ASICREV_IS_POLARIS11_M(uChipRevision);
+            m_settings.isPolaris12       = ASICREV_IS_POLARIS12_V(uChipRevision);
+            m_settings.isVegaM           = ASICREV_IS_VEGAM_P(uChipRevision);
+            family = ADDR_CHIP_FAMILY_VI;
+            break;
+        case FAMILY_CZ:
+            m_settings.isCarrizo         = 1;
+            m_settings.isVolcanicIslands = 1;
+            family = ADDR_CHIP_FAMILY_VI;
+            break;
+        default:
+            ADDR_ASSERT(!"This should be a unexpected Fusion");
+            break;
+    }
+
+    return family;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlInitGlobalParams
+*
+*   @brief
+*       Initializes global parameters
+*
+*   @return
+*       TRUE if all settings are valid
+*
+****************************************************************************************************
+*/
+BOOL_32 CiLib::HwlInitGlobalParams(
+    const ADDR_CREATE_INPUT* pCreateIn) ///< [in] create input
+{
+    BOOL_32  valid = TRUE;
+
+    const ADDR_REGISTER_VALUE* pRegValue = &pCreateIn->regValue;
+
+    valid = DecodeGbRegs(pRegValue);
+
+    // The following assignments for m_pipes is only for fail-safe, InitTileSettingTable should
+    // read the correct pipes from tile mode table
+    if (m_settings.isHawaii)
+    {
+        m_pipes = 16;
+    }
+    else if (m_settings.isBonaire || m_settings.isSpectre)
+    {
+        m_pipes = 4;
+    }
+    else // Treat other KV asics to be 2-pipe
+    {
+        m_pipes = 2;
+    }
+
+    // @todo: VI
+    // Move this to VI code path once created
+    if (m_settings.isTonga || m_settings.isPolaris10)
+    {
+        m_pipes = 8;
+    }
+    else if (m_settings.isIceland)
+    {
+        m_pipes = 2;
+    }
+    else if (m_settings.isFiji)
+    {
+        m_pipes = 16;
+    }
+    else if (m_settings.isPolaris11 || m_settings.isPolaris12)
+    {
+        m_pipes = 4;
+    }
+    else if (m_settings.isVegaM)
+    {
+        m_pipes = 16;
+    }
+
+    if (valid)
+    {
+        valid = InitTileSettingTable(pRegValue->pTileConfig, pRegValue->noOfEntries);
+    }
+    if (valid)
+    {
+        valid = InitMacroTileCfgTable(pRegValue->pMacroTileConfig, pRegValue->noOfMacroEntries);
+    }
+
+    if (valid)
+    {
+        InitEquationTable();
+    }
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlPostCheckTileIndex
+*
+*   @brief
+*       Map a tile setting to index if curIndex is invalid, otherwise check if curIndex matches
+*       tile mode/type/info and change the index if needed
+*   @return
+*       Tile index.
+****************************************************************************************************
+*/
+INT_32 CiLib::HwlPostCheckTileIndex(
+    const ADDR_TILEINFO* pInfo,     ///< [in] Tile Info
+    AddrTileMode         mode,      ///< [in] Tile mode
+    AddrTileType         type,      ///< [in] Tile type
+    INT                  curIndex   ///< [in] Current index assigned in HwlSetupTileInfo
+    ) const
+{
+    INT_32 index = curIndex;
+
+    if (mode == ADDR_TM_LINEAR_GENERAL)
+    {
+        index = TileIndexLinearGeneral;
+    }
+    else
+    {
+        BOOL_32 macroTiled = IsMacroTiled(mode);
+
+        // We need to find a new index if either of them is true
+        // 1. curIndex is invalid
+        // 2. tile mode is changed
+        // 3. tile info does not match for macro tiled
+        if ((index == TileIndexInvalid)         ||
+            (mode != m_tileTable[index].mode)   ||
+            (macroTiled && pInfo->pipeConfig != m_tileTable[index].info.pipeConfig))
+        {
+            for (index = 0; index < static_cast<INT_32>(m_noOfEntries); index++)
+            {
+                if (macroTiled)
+                {
+                    // macro tile modes need all to match
+                    if ((pInfo->pipeConfig == m_tileTable[index].info.pipeConfig) &&
+                        (mode == m_tileTable[index].mode) &&
+                        (type == m_tileTable[index].type))
+                    {
+                        // tileSplitBytes stored in m_tileTable is only valid for depth entries
+                        if (type == ADDR_DEPTH_SAMPLE_ORDER)
+                        {
+                            if (Min(m_tileTable[index].info.tileSplitBytes,
+                                    m_rowSize) == pInfo->tileSplitBytes)
+                            {
+                                break;
+                            }
+                        }
+                        else // other entries are determined by other 3 fields
+                        {
+                            break;
+                        }
+                    }
+                }
+                else if (mode == ADDR_TM_LINEAR_ALIGNED)
+                {
+                    // linear mode only needs tile mode to match
+                    if (mode == m_tileTable[index].mode)
+                    {
+                        break;
+                    }
+                }
+                else
+                {
+                    // micro tile modes only need tile mode and tile type to match
+                    if (mode == m_tileTable[index].mode &&
+                        type == m_tileTable[index].type)
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    ADDR_ASSERT(index < static_cast<INT_32>(m_noOfEntries));
+
+    if (index >= static_cast<INT_32>(m_noOfEntries))
+    {
+        index = TileIndexInvalid;
+    }
+
+    return index;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlSetupTileCfg
+*
+*   @brief
+*       Map tile index to tile setting.
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiLib::HwlSetupTileCfg(
+    UINT_32         bpp,            ///< Bits per pixel
+    INT_32          index,          ///< Tile index
+    INT_32          macroModeIndex, ///< Index in macro tile mode table(CI)
+    ADDR_TILEINFO*  pInfo,          ///< [out] Tile Info
+    AddrTileMode*   pMode,          ///< [out] Tile mode
+    AddrTileType*   pType           ///< [out] Tile type
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    // Global flag to control usage of tileIndex
+    if (UseTileIndex(index))
+    {
+        if (index == TileIndexLinearGeneral)
+        {
+            pInfo->banks = 2;
+            pInfo->bankWidth = 1;
+            pInfo->bankHeight = 1;
+            pInfo->macroAspectRatio = 1;
+            pInfo->tileSplitBytes = 64;
+            pInfo->pipeConfig = ADDR_PIPECFG_P2;
+        }
+        else if (static_cast<UINT_32>(index) >= m_noOfEntries)
+        {
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+        else
+        {
+            const TileConfig* pCfgTable = GetTileSetting(index);
+
+            if (pInfo != NULL)
+            {
+                if (IsMacroTiled(pCfgTable->mode))
+                {
+                    ADDR_ASSERT((macroModeIndex != TileIndexInvalid) &&
+                                (macroModeIndex != TileIndexNoMacroIndex));
+
+                    UINT_32 tileSplit;
+
+                    *pInfo = m_macroTileTable[macroModeIndex];
+
+                    if (pCfgTable->type == ADDR_DEPTH_SAMPLE_ORDER)
+                    {
+                        tileSplit = pCfgTable->info.tileSplitBytes;
+                    }
+                    else
+                    {
+                        if (bpp > 0)
+                        {
+                            UINT_32 thickness = Thickness(pCfgTable->mode);
+                            UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
+                            // Non-depth entries store a split factor
+                            UINT_32 sampleSplit = m_tileTable[index].info.tileSplitBytes;
+                            tileSplit = Max(256u, sampleSplit * tileBytes1x);
+                        }
+                        else
+                        {
+                            // Return tileBytes instead if not enough info
+                            tileSplit = pInfo->tileSplitBytes;
+                        }
+                    }
+
+                    // Clamp to row_size
+                    pInfo->tileSplitBytes = Min(m_rowSize, tileSplit);
+
+                    pInfo->pipeConfig = pCfgTable->info.pipeConfig;
+                }
+                else // 1D and linear modes, we return default value stored in table
+                {
+                    *pInfo = pCfgTable->info;
+                }
+            }
+
+            if (pMode != NULL)
+            {
+                *pMode = pCfgTable->mode;
+            }
+
+            if (pType != NULL)
+            {
+                *pType = pCfgTable->type;
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeSurfaceInfo
+*
+*   @brief
+*       Entry of CI's ComputeSurfaceInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiLib::HwlComputeSurfaceInfo(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    // If tileIndex is invalid, force macroModeIndex to be invalid, too
+    if (pIn->tileIndex == TileIndexInvalid)
+    {
+        pOut->macroModeIndex = TileIndexInvalid;
+    }
+
+    ADDR_E_RETURNCODE retCode = SiLib::HwlComputeSurfaceInfo(pIn, pOut);
+
+    if ((pIn->mipLevel > 0) &&
+        (pOut->tcCompatible == TRUE) &&
+        (pOut->tileMode != pIn->tileMode) &&
+        (m_settings.isVolcanicIslands == TRUE))
+    {
+        pOut->tcCompatible = CheckTcCompatibility(pOut->pTileInfo, pIn->bpp, pOut->tileMode, pOut->tileType, pOut);
+    }
+
+    if (pOut->macroModeIndex == TileIndexNoMacroIndex)
+    {
+        pOut->macroModeIndex = TileIndexInvalid;
+    }
+
+    if ((pIn->flags.matchStencilTileCfg == TRUE) &&
+        (pIn->flags.depth == TRUE))
+    {
+        pOut->stencilTileIdx = TileIndexInvalid;
+
+        if ((MinDepth2DThinIndex <= pOut->tileIndex) &&
+            (MaxDepth2DThinIndex >= pOut->tileIndex))
+        {
+            BOOL_32 depthStencil2DTileConfigMatch = DepthStencilTileCfgMatch(pIn, pOut);
+
+            if ((depthStencil2DTileConfigMatch == FALSE) &&
+                (pOut->tcCompatible == TRUE))
+            {
+                pOut->macroModeIndex = TileIndexInvalid;
+
+                ADDR_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
+                localIn.tileIndex = TileIndexInvalid;
+                localIn.pTileInfo = NULL;
+                localIn.flags.tcCompatible = FALSE;
+
+                SiLib::HwlComputeSurfaceInfo(&localIn, pOut);
+
+                ADDR_ASSERT((MinDepth2DThinIndex <= pOut->tileIndex) && (MaxDepth2DThinIndex >= pOut->tileIndex));
+
+                depthStencil2DTileConfigMatch = DepthStencilTileCfgMatch(pIn, pOut);
+            }
+
+            if ((depthStencil2DTileConfigMatch == FALSE) &&
+                (pIn->numSamples <= 1))
+            {
+                pOut->macroModeIndex = TileIndexInvalid;
+
+                ADDR_COMPUTE_SURFACE_INFO_INPUT localIn = *pIn;
+                localIn.tileMode = ADDR_TM_1D_TILED_THIN1;
+                localIn.tileIndex = TileIndexInvalid;
+                localIn.pTileInfo = NULL;
+
+                retCode = SiLib::HwlComputeSurfaceInfo(&localIn, pOut);
+            }
+        }
+
+        if (pOut->tileIndex == Depth1DThinIndex)
+        {
+            pOut->stencilTileIdx = Depth1DThinIndex;
+        }
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlFmaskSurfaceInfo
+*   @brief
+*       Entry of r800's ComputeFmaskInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiLib::HwlComputeFmaskInfo(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut   ///< [out] output structure
+    )
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    ADDR_TILEINFO tileInfo = {0};
+    ADDR_COMPUTE_FMASK_INFO_INPUT fmaskIn;
+    fmaskIn = *pIn;
+
+    AddrTileMode tileMode = pIn->tileMode;
+
+    // Use internal tile info if pOut does not have a valid pTileInfo
+    if (pOut->pTileInfo == NULL)
+    {
+        pOut->pTileInfo = &tileInfo;
+    }
+
+    ADDR_ASSERT(tileMode == ADDR_TM_2D_TILED_THIN1     ||
+                tileMode == ADDR_TM_3D_TILED_THIN1     ||
+                tileMode == ADDR_TM_PRT_TILED_THIN1    ||
+                tileMode == ADDR_TM_PRT_2D_TILED_THIN1 ||
+                tileMode == ADDR_TM_PRT_3D_TILED_THIN1);
+
+    ADDR_ASSERT(m_tileTable[14].mode == ADDR_TM_2D_TILED_THIN1);
+    ADDR_ASSERT(m_tileTable[15].mode == ADDR_TM_3D_TILED_THIN1);
+
+    // The only valid tile modes for fmask are 2D_THIN1 and 3D_THIN1 plus non-displayable
+    INT_32 tileIndex = tileMode == ADDR_TM_2D_TILED_THIN1 ? 14 : 15;
+    ADDR_SURFACE_FLAGS flags = {{0}};
+    flags.fmask = 1;
+
+    INT_32 macroModeIndex = TileIndexInvalid;
+
+    UINT_32 numSamples = pIn->numSamples;
+    UINT_32 numFrags = pIn->numFrags == 0 ? numSamples : pIn->numFrags;
+
+    UINT_32 bpp = QLog2(numFrags);
+
+    // EQAA needs one more bit
+    if (numSamples > numFrags)
+    {
+        bpp++;
+    }
+
+    if (bpp == 3)
+    {
+        bpp = 4;
+    }
+
+    bpp = Max(8u, bpp * numSamples);
+
+    macroModeIndex = HwlComputeMacroModeIndex(tileIndex, flags, bpp, numSamples, pOut->pTileInfo);
+
+    fmaskIn.tileIndex = tileIndex;
+    fmaskIn.pTileInfo = pOut->pTileInfo;
+    pOut->macroModeIndex = macroModeIndex;
+    pOut->tileIndex = tileIndex;
+
+    retCode = DispatchComputeFmaskInfo(&fmaskIn, pOut);
+
+    if (retCode == ADDR_OK)
+    {
+        pOut->tileIndex =
+            HwlPostCheckTileIndex(pOut->pTileInfo, pIn->tileMode, ADDR_NON_DISPLAYABLE,
+                                  pOut->tileIndex);
+    }
+
+    // Resets pTileInfo to NULL if the internal tile info is used
+    if (pOut->pTileInfo == &tileInfo)
+    {
+        pOut->pTileInfo = NULL;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlFmaskPreThunkSurfInfo
+*
+*   @brief
+*       Some preparation before thunking a ComputeSurfaceInfo call for Fmask
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+VOID CiLib::HwlFmaskPreThunkSurfInfo(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pFmaskIn,   ///< [in] Input of fmask info
+    const ADDR_COMPUTE_FMASK_INFO_OUTPUT*   pFmaskOut,  ///< [in] Output of fmask info
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*        pSurfIn,    ///< [out] Input of thunked surface info
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pSurfOut    ///< [out] Output of thunked surface info
+    ) const
+{
+    pSurfIn->tileIndex = pFmaskIn->tileIndex;
+    pSurfOut->macroModeIndex  = pFmaskOut->macroModeIndex;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlFmaskPostThunkSurfInfo
+*
+*   @brief
+*       Copy hwl extra field after calling thunked ComputeSurfaceInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+VOID CiLib::HwlFmaskPostThunkSurfInfo(
+    const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,   ///< [in] Output of surface info
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut           ///< [out] Output of fmask info
+    ) const
+{
+    pFmaskOut->tileIndex = pSurfOut->tileIndex;
+    pFmaskOut->macroModeIndex = pSurfOut->macroModeIndex;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlDegradeThickTileMode
+*
+*   @brief
+*       Degrades valid tile mode for thick modes if needed
+*
+*   @return
+*       Suitable tile mode
+****************************************************************************************************
+*/
+AddrTileMode CiLib::HwlDegradeThickTileMode(
+    AddrTileMode        baseTileMode,   ///< [in] base tile mode
+    UINT_32             numSlices,      ///< [in] current number of slices
+    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
+    ) const
+{
+    return baseTileMode;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlOptimizeTileMode
+*
+*   @brief
+*       Optimize tile mode on CI
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID CiLib::HwlOptimizeTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut      ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode = pInOut->tileMode;
+
+    // Override 2D/3D macro tile mode to PRT_* tile mode if
+    // client driver requests this surface is equation compatible
+    if (IsMacroTiled(tileMode) == TRUE)
+    {
+        if ((pInOut->flags.needEquation == TRUE) &&
+            (pInOut->numSamples <= 1) &&
+            (IsPrtTileMode(tileMode) == FALSE))
+        {
+            if ((pInOut->numSlices > 1) && ((pInOut->maxBaseAlign == 0) || (pInOut->maxBaseAlign >= Block64K)))
+            {
+                UINT_32 thickness = Thickness(tileMode);
+
+                if (thickness == 1)
+                {
+                    tileMode = ADDR_TM_PRT_TILED_THIN1;
+                }
+                else
+                {
+                    static const UINT_32 PrtTileBytes = 0x10000;
+                    // First prt thick tile index in the tile mode table
+                    static const UINT_32 PrtThickTileIndex = 22;
+                    ADDR_TILEINFO tileInfo = {0};
+
+                    HwlComputeMacroModeIndex(PrtThickTileIndex,
+                                             pInOut->flags,
+                                             pInOut->bpp,
+                                             pInOut->numSamples,
+                                             &tileInfo);
+
+                    UINT_32 macroTileBytes = ((pInOut->bpp) >> 3) * 64 * pInOut->numSamples *
+                                             thickness * HwlGetPipes(&tileInfo) *
+                                             tileInfo.banks * tileInfo.bankWidth *
+                                             tileInfo.bankHeight;
+
+                    if (macroTileBytes <= PrtTileBytes)
+                    {
+                        tileMode = ADDR_TM_PRT_TILED_THICK;
+                    }
+                    else
+                    {
+                        tileMode = ADDR_TM_PRT_TILED_THIN1;
+                    }
+                }
+            }
+        }
+
+        if (pInOut->maxBaseAlign != 0)
+        {
+            pInOut->flags.dccPipeWorkaround = FALSE;
+        }
+    }
+
+    if (tileMode != pInOut->tileMode)
+    {
+        pInOut->tileMode = tileMode;
+    }
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlOverrideTileMode
+*
+*   @brief
+*       Override THICK to THIN, for specific formats on CI
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID CiLib::HwlOverrideTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut      ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode = pInOut->tileMode;
+    AddrTileType tileType = pInOut->tileType;
+
+    // currently, all CI/VI family do not
+    // support ADDR_TM_PRT_2D_TILED_THICK,ADDR_TM_PRT_3D_TILED_THICK and
+    // ADDR_TM_PRT_2D_TILED_THIN1, ADDR_TM_PRT_3D_TILED_THIN1
+    switch (tileMode)
+    {
+        case ADDR_TM_PRT_2D_TILED_THICK:
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            tileMode = ADDR_TM_PRT_TILED_THICK;
+            break;
+        case ADDR_TM_PRT_2D_TILED_THIN1:
+        case ADDR_TM_PRT_3D_TILED_THIN1:
+            tileMode = ADDR_TM_PRT_TILED_THIN1;
+            break;
+        default:
+            break;
+    }
+
+    // UBTS#404321, we do not need such overriding, as THICK+THICK entries removed from the tile-mode table
+    if (!m_settings.isBonaire)
+    {
+        UINT_32 thickness = Thickness(tileMode);
+
+        // tile_thickness = (array_mode == XTHICK) ? 8 : ((array_mode == THICK) ? 4 : 1)
+        if (thickness > 1)
+        {
+            switch (pInOut->format)
+            {
+                // tcpError("Thick micro tiling is not supported for format...
+                case ADDR_FMT_X24_8_32_FLOAT:
+                case ADDR_FMT_32_AS_8:
+                case ADDR_FMT_32_AS_8_8:
+                case ADDR_FMT_32_AS_32_32_32_32:
+
+                // packed formats
+                case ADDR_FMT_GB_GR:
+                case ADDR_FMT_BG_RG:
+                case ADDR_FMT_1_REVERSED:
+                case ADDR_FMT_1:
+                case ADDR_FMT_BC1:
+                case ADDR_FMT_BC2:
+                case ADDR_FMT_BC3:
+                case ADDR_FMT_BC4:
+                case ADDR_FMT_BC5:
+                case ADDR_FMT_BC6:
+                case ADDR_FMT_BC7:
+                    switch (tileMode)
+                    {
+                        case ADDR_TM_1D_TILED_THICK:
+                            tileMode = ADDR_TM_1D_TILED_THIN1;
+                            break;
+
+                        case ADDR_TM_2D_TILED_XTHICK:
+                        case ADDR_TM_2D_TILED_THICK:
+                            tileMode = ADDR_TM_2D_TILED_THIN1;
+                            break;
+
+                        case ADDR_TM_3D_TILED_XTHICK:
+                        case ADDR_TM_3D_TILED_THICK:
+                            tileMode = ADDR_TM_3D_TILED_THIN1;
+                            break;
+
+                        case ADDR_TM_PRT_TILED_THICK:
+                            tileMode = ADDR_TM_PRT_TILED_THIN1;
+                            break;
+
+                        case ADDR_TM_PRT_2D_TILED_THICK:
+                            tileMode = ADDR_TM_PRT_2D_TILED_THIN1;
+                            break;
+
+                        case ADDR_TM_PRT_3D_TILED_THICK:
+                            tileMode = ADDR_TM_PRT_3D_TILED_THIN1;
+                            break;
+
+                        default:
+                            break;
+
+                    }
+
+                    // Switch tile type from thick to thin
+                    if (tileMode != pInOut->tileMode)
+                    {
+                        // see tileIndex: 13-18
+                        tileType = ADDR_NON_DISPLAYABLE;
+                    }
+
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+    if (tileMode != pInOut->tileMode)
+    {
+        pInOut->tileMode = tileMode;
+        pInOut->tileType = tileType;
+    }
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlSelectTileMode
+*
+*   @brief
+*       Select tile modes.
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID CiLib::HwlSelectTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode;
+    AddrTileType tileType;
+
+    if (pInOut->flags.rotateDisplay)
+    {
+        tileMode = ADDR_TM_2D_TILED_THIN1;
+        tileType = ADDR_ROTATED;
+    }
+    else if (pInOut->flags.volume)
+    {
+        BOOL_32 bThin = (m_settings.isBonaire == TRUE) ||
+                        ((m_allowNonDispThickModes == TRUE) && (pInOut->flags.color == TRUE));
+
+        if (pInOut->numSlices >= 8)
+        {
+            tileMode = ADDR_TM_2D_TILED_XTHICK;
+            tileType = (bThin == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
+        }
+        else if (pInOut->numSlices >= 4)
+        {
+            tileMode = ADDR_TM_2D_TILED_THICK;
+            tileType = (bThin == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
+        }
+        else
+        {
+            tileMode = ADDR_TM_2D_TILED_THIN1;
+            tileType = ADDR_NON_DISPLAYABLE;
+        }
+    }
+    else
+    {
+        tileMode = ADDR_TM_2D_TILED_THIN1;
+
+        if (pInOut->flags.depth || pInOut->flags.stencil)
+        {
+            tileType = ADDR_DEPTH_SAMPLE_ORDER;
+        }
+        else if ((pInOut->bpp <= 32) ||
+                 (pInOut->flags.display == TRUE) ||
+                 (pInOut->flags.overlay == TRUE))
+        {
+            tileType = ADDR_DISPLAYABLE;
+        }
+        else
+        {
+            tileType = ADDR_NON_DISPLAYABLE;
+        }
+    }
+
+    if (pInOut->flags.prt)
+    {
+        if (Thickness(tileMode) > 1)
+        {
+            tileMode = ADDR_TM_PRT_TILED_THICK;
+            tileType = (m_settings.isBonaire == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
+        }
+        else
+        {
+            tileMode = ADDR_TM_PRT_TILED_THIN1;
+        }
+    }
+
+    pInOut->tileMode = tileMode;
+    pInOut->tileType = tileType;
+
+    if ((pInOut->flags.dccCompatible == FALSE) &&
+        (pInOut->flags.tcCompatible == FALSE))
+    {
+        pInOut->flags.opt4Space = TRUE;
+        pInOut->maxBaseAlign = Block64K;
+    }
+
+    // Optimize tile mode if possible
+    OptimizeTileMode(pInOut);
+
+    HwlOverrideTileMode(pInOut);
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlSetPrtTileMode
+*
+*   @brief
+*       Set PRT tile mode.
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID CiLib::HwlSetPrtTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode = pInOut->tileMode;
+    AddrTileType tileType = pInOut->tileType;
+
+    if (Thickness(tileMode) > 1)
+    {
+        tileMode = ADDR_TM_PRT_TILED_THICK;
+        tileType = (m_settings.isBonaire == TRUE) ? ADDR_NON_DISPLAYABLE : ADDR_THICK;
+    }
+    else
+    {
+        tileMode = ADDR_TM_PRT_TILED_THIN1;
+        tileType = (tileType == ADDR_THICK) ? ADDR_NON_DISPLAYABLE : tileType;
+    }
+
+    pInOut->tileMode = tileMode;
+    pInOut->tileType = tileType;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlSetupTileInfo
+*
+*   @brief
+*       Setup default value of tile info for SI
+****************************************************************************************************
+*/
+VOID CiLib::HwlSetupTileInfo(
+    AddrTileMode                        tileMode,       ///< [in] Tile mode
+    ADDR_SURFACE_FLAGS                  flags,          ///< [in] Surface type flags
+    UINT_32                             bpp,            ///< [in] Bits per pixel
+    UINT_32                             pitch,          ///< [in] Pitch in pixels
+    UINT_32                             height,         ///< [in] Height in pixels
+    UINT_32                             numSamples,     ///< [in] Number of samples
+    ADDR_TILEINFO*                      pTileInfoIn,    ///< [in] Tile info input: NULL for default
+    ADDR_TILEINFO*                      pTileInfoOut,   ///< [out] Tile info output
+    AddrTileType                        inTileType,     ///< [in] Tile type
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*   pOut            ///< [out] Output
+    ) const
+{
+    UINT_32 thickness = Thickness(tileMode);
+    ADDR_TILEINFO* pTileInfo = pTileInfoOut;
+    INT index = TileIndexInvalid;
+    INT macroModeIndex = TileIndexInvalid;
+
+    // Fail-safe code
+    if (IsLinear(tileMode) == FALSE)
+    {
+        // Thick tile modes must use thick micro tile mode but Bonaire does not support due to
+        // old derived netlists (UBTS 404321)
+        if (thickness > 1)
+        {
+            if (m_settings.isBonaire)
+            {
+                inTileType = ADDR_NON_DISPLAYABLE;
+            }
+            else if ((m_allowNonDispThickModes == FALSE) ||
+                     (inTileType != ADDR_NON_DISPLAYABLE) ||
+                     // There is no PRT_THICK + THIN entry in tile mode table except Bonaire
+                     (IsPrtTileMode(tileMode) == TRUE))
+            {
+                inTileType = ADDR_THICK;
+            }
+        }
+        // 128 bpp tiling must be non-displayable.
+        // Fmask reuse color buffer's entry but bank-height field can be from another entry
+        // To simplify the logic, fmask entry should be picked from non-displayable ones
+        else if (bpp == 128 || flags.fmask)
+        {
+            inTileType = ADDR_NON_DISPLAYABLE;
+        }
+        // These two modes only have non-disp entries though they can be other micro tile modes
+        else if (tileMode == ADDR_TM_3D_TILED_THIN1 || tileMode == ADDR_TM_PRT_3D_TILED_THIN1)
+        {
+            inTileType = ADDR_NON_DISPLAYABLE;
+        }
+
+        if (flags.depth || flags.stencil)
+        {
+            inTileType = ADDR_DEPTH_SAMPLE_ORDER;
+        }
+    }
+
+    // tcCompatible flag is only meaningful for gfx8.
+    if (m_settings.isVolcanicIslands == FALSE)
+    {
+        flags.tcCompatible = FALSE;
+    }
+
+    if (IsTileInfoAllZero(pTileInfo))
+    {
+        // See table entries 0-4
+        if (flags.depth || flags.stencil)
+        {
+            // tileSize = thickness * bpp * numSamples * 8 * 8 / 8
+            UINT_32 tileSize = thickness * bpp * numSamples * 8;
+
+            // Turn off tc compatible if row_size is smaller than tile size (tile split occurs).
+            if (m_rowSize < tileSize)
+            {
+                flags.tcCompatible = FALSE;
+            }
+
+            if (flags.nonSplit | flags.tcCompatible | flags.needEquation)
+            {
+                // Texture readable depth surface should not be split
+                switch (tileSize)
+                {
+                    case 64:
+                        index = 0;
+                        break;
+                    case 128:
+                        index = 1;
+                        break;
+                    case 256:
+                        index = 2;
+                        break;
+                    case 512:
+                        index = 3;
+                        break;
+                    default:
+                        index = 4;
+                        break;
+                }
+            }
+            else
+            {
+                // Depth and stencil need to use the same index, thus the pre-defined tile_split
+                // can meet the requirement to choose the same macro mode index
+                // uncompressed depth/stencil are not supported for now
+                switch (numSamples)
+                {
+                    case 1:
+                        index = 0;
+                        break;
+                    case 2:
+                    case 4:
+                        index = 1;
+                        break;
+                    case 8:
+                        index = 2;
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
+        // See table entries 5-6
+        if (inTileType == ADDR_DEPTH_SAMPLE_ORDER)
+        {
+            switch (tileMode)
+            {
+                case ADDR_TM_1D_TILED_THIN1:
+                    index = 5;
+                    break;
+                case ADDR_TM_PRT_TILED_THIN1:
+                    index = 6;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        // See table entries 8-12
+        if (inTileType == ADDR_DISPLAYABLE)
+        {
+            switch (tileMode)
+            {
+                case ADDR_TM_1D_TILED_THIN1:
+                    index = 9;
+                    break;
+                case ADDR_TM_2D_TILED_THIN1:
+                    index = 10;
+                    break;
+                case ADDR_TM_PRT_TILED_THIN1:
+                    index = 11;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        // See table entries 13-18
+        if (inTileType == ADDR_NON_DISPLAYABLE)
+        {
+            switch (tileMode)
+            {
+                case ADDR_TM_1D_TILED_THIN1:
+                    index = 13;
+                    break;
+                case ADDR_TM_2D_TILED_THIN1:
+                    index = 14;
+                    break;
+                case ADDR_TM_3D_TILED_THIN1:
+                    index = 15;
+                    break;
+                case ADDR_TM_PRT_TILED_THIN1:
+                    index = 16;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        // See table entries 19-26
+        if (thickness > 1)
+        {
+            switch (tileMode)
+            {
+                case ADDR_TM_1D_TILED_THICK:
+                    // special check for bonaire, for the compatablity between old KMD and new UMD
+                    index = ((inTileType == ADDR_THICK) || m_settings.isBonaire) ? 19 : 18;
+                    break;
+                case ADDR_TM_2D_TILED_THICK:
+                    // special check for bonaire, for the compatablity between old KMD and new UMD
+                    index = ((inTileType == ADDR_THICK) || m_settings.isBonaire) ? 20 : 24;
+                    break;
+                case ADDR_TM_3D_TILED_THICK:
+                    index = 21;
+                    break;
+                case ADDR_TM_PRT_TILED_THICK:
+                    index = 22;
+                    break;
+                case ADDR_TM_2D_TILED_XTHICK:
+                    index = 25;
+                    break;
+                case ADDR_TM_3D_TILED_XTHICK:
+                    index = 26;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        // See table entries 27-30
+        if (inTileType == ADDR_ROTATED)
+        {
+            switch (tileMode)
+            {
+                case ADDR_TM_1D_TILED_THIN1:
+                    index = 27;
+                    break;
+                case ADDR_TM_2D_TILED_THIN1:
+                    index = 28;
+                    break;
+                case ADDR_TM_PRT_TILED_THIN1:
+                    index = 29;
+                    break;
+                case ADDR_TM_PRT_2D_TILED_THIN1:
+                    index = 30;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        if (m_pipes >= 8)
+        {
+            ADDR_ASSERT((index + 1) < static_cast<INT_32>(m_noOfEntries));
+            // Only do this when tile mode table is updated.
+            if (((tileMode == ADDR_TM_PRT_TILED_THIN1) || (tileMode == ADDR_TM_PRT_TILED_THICK)) &&
+                (m_tileTable[index + 1].mode == tileMode))
+            {
+                static const UINT_32 PrtTileBytes = 0x10000;
+                ADDR_TILEINFO tileInfo = {0};
+
+                HwlComputeMacroModeIndex(index, flags, bpp, numSamples, &tileInfo);
+
+                UINT_32 macroTileBytes = (bpp >> 3) * 64 * numSamples * thickness *
+                                         HwlGetPipes(&tileInfo) * tileInfo.banks *
+                                         tileInfo.bankWidth * tileInfo.bankHeight;
+
+                if (macroTileBytes != PrtTileBytes)
+                {
+                    // Switching to next tile mode entry to make sure macro tile size is 64KB
+                    index += 1;
+
+                    tileInfo.pipeConfig = m_tileTable[index].info.pipeConfig;
+
+                    macroTileBytes = (bpp >> 3) * 64 * numSamples * thickness *
+                                     HwlGetPipes(&tileInfo) * tileInfo.banks *
+                                     tileInfo.bankWidth * tileInfo.bankHeight;
+
+                    ADDR_ASSERT(macroTileBytes == PrtTileBytes);
+
+                    flags.tcCompatible = FALSE;
+                    pOut->dccUnsupport = TRUE;
+                }
+            }
+        }
+    }
+    else
+    {
+        // A pre-filled tile info is ready
+        index = pOut->tileIndex;
+        macroModeIndex = pOut->macroModeIndex;
+
+        // pass tile type back for post tile index compute
+        pOut->tileType = inTileType;
+
+        if (flags.depth || flags.stencil)
+        {
+            // tileSize = thickness * bpp * numSamples * 8 * 8 / 8
+            UINT_32 tileSize = thickness * bpp * numSamples * 8;
+
+            // Turn off tc compatible if row_size is smaller than tile size (tile split occurs).
+            if (m_rowSize < tileSize)
+            {
+                flags.tcCompatible = FALSE;
+            }
+        }
+
+        UINT_32 numPipes = GetPipePerSurf(pTileInfo->pipeConfig);
+
+        if (m_pipes != numPipes)
+        {
+            pOut->dccUnsupport = TRUE;
+        }
+    }
+
+    // We only need to set up tile info if there is a valid index but macroModeIndex is invalid
+    if ((index != TileIndexInvalid) && (macroModeIndex == TileIndexInvalid))
+    {
+        macroModeIndex = HwlComputeMacroModeIndex(index, flags, bpp, numSamples, pTileInfo);
+
+        // Copy to pOut->tileType/tileIndex/macroModeIndex
+        pOut->tileIndex = index;
+        pOut->tileType = m_tileTable[index].type; // Or inTileType, the samea
+        pOut->macroModeIndex = macroModeIndex;
+    }
+    else if (tileMode == ADDR_TM_LINEAR_GENERAL)
+    {
+        pOut->tileIndex = TileIndexLinearGeneral;
+
+        // Copy linear-aligned entry??
+        *pTileInfo = m_tileTable[8].info;
+    }
+    else if (tileMode == ADDR_TM_LINEAR_ALIGNED)
+    {
+        pOut->tileIndex = 8;
+        *pTileInfo = m_tileTable[8].info;
+    }
+
+    if (flags.tcCompatible)
+    {
+        flags.tcCompatible = CheckTcCompatibility(pTileInfo, bpp, tileMode, inTileType, pOut);
+    }
+
+    pOut->tcCompatible = flags.tcCompatible;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::ReadGbTileMode
+*
+*   @brief
+*       Convert GB_TILE_MODE HW value to ADDR_TILE_CONFIG.
+****************************************************************************************************
+*/
+VOID CiLib::ReadGbTileMode(
+    UINT_32       regValue,   ///< [in] GB_TILE_MODE register
+    TileConfig*   pCfg        ///< [out] output structure
+    ) const
+{
+    GB_TILE_MODE gbTileMode;
+    gbTileMode.val = regValue;
+
+    pCfg->type = static_cast<AddrTileType>(gbTileMode.f.micro_tile_mode_new);
+    pCfg->info.pipeConfig = static_cast<AddrPipeCfg>(gbTileMode.f.pipe_config + 1);
+
+    if (pCfg->type == ADDR_DEPTH_SAMPLE_ORDER)
+    {
+        pCfg->info.tileSplitBytes = 64 << gbTileMode.f.tile_split;
+    }
+    else
+    {
+        pCfg->info.tileSplitBytes = 1 << gbTileMode.f.sample_split;
+    }
+
+    UINT_32 regArrayMode = gbTileMode.f.array_mode;
+
+    pCfg->mode = static_cast<AddrTileMode>(regArrayMode);
+
+    switch (regArrayMode)
+    {
+        case 5:
+            pCfg->mode = ADDR_TM_PRT_TILED_THIN1;
+            break;
+        case 6:
+            pCfg->mode = ADDR_TM_PRT_2D_TILED_THIN1;
+            break;
+        case 8:
+            pCfg->mode = ADDR_TM_2D_TILED_XTHICK;
+            break;
+        case 9:
+            pCfg->mode = ADDR_TM_PRT_TILED_THICK;
+            break;
+        case 0xa:
+            pCfg->mode = ADDR_TM_PRT_2D_TILED_THICK;
+            break;
+        case 0xb:
+            pCfg->mode = ADDR_TM_PRT_3D_TILED_THIN1;
+            break;
+        case 0xe:
+            pCfg->mode = ADDR_TM_3D_TILED_XTHICK;
+            break;
+        case 0xf:
+            pCfg->mode = ADDR_TM_PRT_3D_TILED_THICK;
+            break;
+        default:
+            break;
+    }
+
+    // Fail-safe code for these always convert tile info, as the non-macro modes
+    // return the entry of tile mode table directly without looking up macro mode table
+    if (!IsMacroTiled(pCfg->mode))
+    {
+        pCfg->info.banks = 2;
+        pCfg->info.bankWidth = 1;
+        pCfg->info.bankHeight = 1;
+        pCfg->info.macroAspectRatio = 1;
+        pCfg->info.tileSplitBytes = 64;
+    }
+}
+
+/**
+****************************************************************************************************
+*   CiLib::InitTileSettingTable
+*
+*   @brief
+*       Initialize the ADDR_TILE_CONFIG table.
+*   @return
+*       TRUE if tile table is correctly initialized
+****************************************************************************************************
+*/
+BOOL_32 CiLib::InitTileSettingTable(
+    const UINT_32*  pCfg,           ///< [in] Pointer to table of tile configs
+    UINT_32         noOfEntries     ///< [in] Numbe of entries in the table above
+    )
+{
+    BOOL_32 initOk = TRUE;
+
+    ADDR_ASSERT(noOfEntries <= TileTableSize);
+
+    memset(m_tileTable, 0, sizeof(m_tileTable));
+
+    if (noOfEntries != 0)
+    {
+        m_noOfEntries = noOfEntries;
+    }
+    else
+    {
+        m_noOfEntries = TileTableSize;
+    }
+
+    if (pCfg) // From Client
+    {
+        for (UINT_32 i = 0; i < m_noOfEntries; i++)
+        {
+            ReadGbTileMode(*(pCfg + i), &m_tileTable[i]);
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        initOk = FALSE;
+    }
+
+    if (initOk)
+    {
+        ADDR_ASSERT(m_tileTable[TILEINDEX_LINEAR_ALIGNED].mode == ADDR_TM_LINEAR_ALIGNED);
+
+        if (m_settings.isBonaire == FALSE)
+        {
+            // Check if entry 18 is "thick+thin" combination
+            if ((m_tileTable[18].mode == ADDR_TM_1D_TILED_THICK) &&
+                (m_tileTable[18].type == ADDR_NON_DISPLAYABLE))
+            {
+                m_allowNonDispThickModes = TRUE;
+                ADDR_ASSERT(m_tileTable[24].mode == ADDR_TM_2D_TILED_THICK);
+            }
+        }
+        else
+        {
+            m_allowNonDispThickModes = TRUE;
+        }
+
+        // Assume the first entry is always programmed with full pipes
+        m_pipes = HwlGetPipes(&m_tileTable[0].info);
+    }
+
+    return initOk;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::ReadGbMacroTileCfg
+*
+*   @brief
+*       Convert GB_MACRO_TILE_CFG HW value to ADDR_TILE_CONFIG.
+****************************************************************************************************
+*/
+VOID CiLib::ReadGbMacroTileCfg(
+    UINT_32             regValue,   ///< [in] GB_MACRO_TILE_MODE register
+    ADDR_TILEINFO*      pCfg        ///< [out] output structure
+    ) const
+{
+    GB_MACROTILE_MODE gbTileMode;
+    gbTileMode.val = regValue;
+
+    pCfg->bankHeight = 1 << gbTileMode.f.bank_height;
+    pCfg->bankWidth = 1 << gbTileMode.f.bank_width;
+    pCfg->banks = 1 << (gbTileMode.f.num_banks + 1);
+    pCfg->macroAspectRatio = 1 << gbTileMode.f.macro_tile_aspect;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::InitMacroTileCfgTable
+*
+*   @brief
+*       Initialize the ADDR_MACRO_TILE_CONFIG table.
+*   @return
+*       TRUE if macro tile table is correctly initialized
+****************************************************************************************************
+*/
+BOOL_32 CiLib::InitMacroTileCfgTable(
+    const UINT_32*  pCfg,           ///< [in] Pointer to table of tile configs
+    UINT_32         noOfMacroEntries     ///< [in] Numbe of entries in the table above
+    )
+{
+    BOOL_32 initOk = TRUE;
+
+    ADDR_ASSERT(noOfMacroEntries <= MacroTileTableSize);
+
+    memset(m_macroTileTable, 0, sizeof(m_macroTileTable));
+
+    if (noOfMacroEntries != 0)
+    {
+        m_noOfMacroEntries = noOfMacroEntries;
+    }
+    else
+    {
+        m_noOfMacroEntries = MacroTileTableSize;
+    }
+
+    if (pCfg) // From Client
+    {
+        for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
+        {
+            ReadGbMacroTileCfg(*(pCfg + i), &m_macroTileTable[i]);
+
+            m_macroTileTable[i].tileSplitBytes = 64 << (i % 8);
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        initOk = FALSE;
+    }
+    return initOk;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeMacroModeIndex
+*
+*   @brief
+*       Computes macro tile mode index
+*   @return
+*       TRUE if macro tile table is correctly initialized
+****************************************************************************************************
+*/
+INT_32 CiLib::HwlComputeMacroModeIndex(
+    INT_32              tileIndex,      ///< [in] Tile mode index
+    ADDR_SURFACE_FLAGS  flags,          ///< [in] Surface flags
+    UINT_32             bpp,            ///< [in] Bit per pixel
+    UINT_32             numSamples,     ///< [in] Number of samples
+    ADDR_TILEINFO*      pTileInfo,      ///< [out] Pointer to ADDR_TILEINFO
+    AddrTileMode*       pTileMode,      ///< [out] Pointer to AddrTileMode
+    AddrTileType*       pTileType       ///< [out] Pointer to AddrTileType
+    ) const
+{
+    INT_32 macroModeIndex = TileIndexInvalid;
+
+    AddrTileMode tileMode = m_tileTable[tileIndex].mode;
+    AddrTileType tileType = m_tileTable[tileIndex].type;
+    UINT_32 thickness = Thickness(tileMode);
+
+    if (!IsMacroTiled(tileMode))
+    {
+        *pTileInfo = m_tileTable[tileIndex].info;
+        macroModeIndex = TileIndexNoMacroIndex;
+    }
+    else
+    {
+        UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
+        UINT_32 tileSplit;
+
+        if (m_tileTable[tileIndex].type == ADDR_DEPTH_SAMPLE_ORDER)
+        {
+            // Depth entries store real tileSplitBytes
+            tileSplit = m_tileTable[tileIndex].info.tileSplitBytes;
+        }
+        else
+        {
+            // Non-depth entries store a split factor
+            UINT_32 sampleSplit = m_tileTable[tileIndex].info.tileSplitBytes;
+            UINT_32 colorTileSplit = Max(256u, sampleSplit * tileBytes1x);
+
+            tileSplit = colorTileSplit;
+        }
+
+        UINT_32 tileSplitC = Min(m_rowSize, tileSplit);
+        UINT_32 tileBytes;
+
+        if (flags.fmask)
+        {
+            tileBytes = Min(tileSplitC, tileBytes1x);
+        }
+        else
+        {
+            tileBytes = Min(tileSplitC, numSamples * tileBytes1x);
+        }
+
+        if (tileBytes < 64)
+        {
+            tileBytes = 64;
+        }
+
+        macroModeIndex = Log2(tileBytes / 64);
+
+        if (flags.prt || IsPrtTileMode(tileMode))
+        {
+            macroModeIndex += PrtMacroModeOffset;
+            *pTileInfo = m_macroTileTable[macroModeIndex];
+        }
+        else
+        {
+            *pTileInfo = m_macroTileTable[macroModeIndex];
+        }
+
+        pTileInfo->pipeConfig = m_tileTable[tileIndex].info.pipeConfig;
+
+        pTileInfo->tileSplitBytes = tileSplitC;
+    }
+
+    if (NULL != pTileMode)
+    {
+        *pTileMode = tileMode;
+    }
+
+    if (NULL != pTileType)
+    {
+        *pTileType = tileType;
+    }
+
+    return macroModeIndex;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeTileDataWidthAndHeightLinear
+*
+*   @brief
+*       Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
+*
+*   @note
+*       MacroWidth and macroHeight are measured in pixels
+****************************************************************************************************
+*/
+VOID CiLib::HwlComputeTileDataWidthAndHeightLinear(
+    UINT_32*        pMacroWidth,     ///< [out] macro tile width
+    UINT_32*        pMacroHeight,    ///< [out] macro tile height
+    UINT_32         bpp,             ///< [in] bits per pixel
+    ADDR_TILEINFO*  pTileInfo        ///< [in] tile info
+    ) const
+{
+    ADDR_ASSERT(pTileInfo != NULL);
+
+    UINT_32 numTiles;
+
+    switch (pTileInfo->pipeConfig)
+    {
+        case ADDR_PIPECFG_P16_32x32_8x16:
+        case ADDR_PIPECFG_P16_32x32_16x16:
+        case ADDR_PIPECFG_P8_32x64_32x32:
+        case ADDR_PIPECFG_P8_32x32_16x32:
+        case ADDR_PIPECFG_P8_32x32_16x16:
+        case ADDR_PIPECFG_P8_32x32_8x16:
+        case ADDR_PIPECFG_P4_32x32:
+            numTiles = 8;
+            break;
+        default:
+            numTiles = 4;
+            break;
+    }
+
+    *pMacroWidth    = numTiles * MicroTileWidth;
+    *pMacroHeight   = numTiles * MicroTileHeight;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeMetadataNibbleAddress
+*
+*   @brief
+*        calculate meta data address based on input information
+*
+*   &parameter
+*        uncompressedDataByteAddress - address of a pixel in color surface
+*        dataBaseByteAddress         - base address of color surface
+*        metadataBaseByteAddress     - base address of meta ram
+*        metadataBitSize             - meta key size, 8 for DCC, 4 for cmask
+*        elementBitSize              - element size of color surface
+*        blockByteSize               - compression block size, 256 for DCC
+*        pipeInterleaveBytes         - pipe interleave size
+*        numOfPipes                  - number of pipes
+*        numOfBanks                  - number of banks
+*        numOfSamplesPerSplit        - number of samples per tile split
+*   @return
+*        meta data nibble address (nibble address is used to support DCC compatible cmask)
+*
+****************************************************************************************************
+*/
+UINT_64 CiLib::HwlComputeMetadataNibbleAddress(
+    UINT_64 uncompressedDataByteAddress,
+    UINT_64 dataBaseByteAddress,
+    UINT_64 metadataBaseByteAddress,
+    UINT_32 metadataBitSize,
+    UINT_32 elementBitSize,
+    UINT_32 blockByteSize,
+    UINT_32 pipeInterleaveBytes,
+    UINT_32 numOfPipes,
+    UINT_32 numOfBanks,
+    UINT_32 numOfSamplesPerSplit) const
+{
+    ///--------------------------------------------------------------------------------------------
+    /// Get pipe interleave, bank and pipe bits
+    ///--------------------------------------------------------------------------------------------
+    UINT_32 pipeInterleaveBits  = Log2(pipeInterleaveBytes);
+    UINT_32 pipeBits            = Log2(numOfPipes);
+    UINT_32 bankBits            = Log2(numOfBanks);
+
+    ///--------------------------------------------------------------------------------------------
+    /// Clear pipe and bank swizzles
+    ///--------------------------------------------------------------------------------------------
+    UINT_32 dataMacrotileBits        = pipeInterleaveBits + pipeBits + bankBits;
+    UINT_32 metadataMacrotileBits    = pipeInterleaveBits + pipeBits + bankBits;
+
+    UINT_64 dataMacrotileClearMask     = ~((1L << dataMacrotileBits) - 1);
+    UINT_64 metadataMacrotileClearMask = ~((1L << metadataMacrotileBits) - 1);
+
+    UINT_64 dataBaseByteAddressNoSwizzle = dataBaseByteAddress & dataMacrotileClearMask;
+    UINT_64 metadataBaseByteAddressNoSwizzle = metadataBaseByteAddress & metadataMacrotileClearMask;
+
+    ///--------------------------------------------------------------------------------------------
+    /// Modify metadata base before adding in so that when final address is divided by data ratio,
+    /// the base address returns to where it should be
+    ///--------------------------------------------------------------------------------------------
+    ADDR_ASSERT((0 != metadataBitSize));
+    UINT_64 metadataBaseShifted = metadataBaseByteAddressNoSwizzle * blockByteSize * 8 /
+                                  metadataBitSize;
+    UINT_64 offset = uncompressedDataByteAddress -
+                     dataBaseByteAddressNoSwizzle +
+                     metadataBaseShifted;
+
+    ///--------------------------------------------------------------------------------------------
+    /// Save bank data bits
+    ///--------------------------------------------------------------------------------------------
+    UINT_32 lsb = pipeBits + pipeInterleaveBits;
+    UINT_32 msb = bankBits - 1 + lsb;
+
+    UINT_64 bankDataBits = GetBits(offset, msb, lsb);
+
+    ///--------------------------------------------------------------------------------------------
+    /// Save pipe data bits
+    ///--------------------------------------------------------------------------------------------
+    lsb = pipeInterleaveBits;
+    msb = pipeBits - 1 + lsb;
+
+    UINT_64 pipeDataBits = GetBits(offset, msb, lsb);
+
+    ///--------------------------------------------------------------------------------------------
+    /// Remove pipe and bank bits
+    ///--------------------------------------------------------------------------------------------
+    lsb = pipeInterleaveBits;
+    msb = dataMacrotileBits - 1;
+
+    UINT_64 offsetWithoutPipeBankBits = RemoveBits(offset, msb, lsb);
+
+    ADDR_ASSERT((0 != blockByteSize));
+    UINT_64 blockInBankpipe = offsetWithoutPipeBankBits / blockByteSize;
+
+    UINT_32 tileSize = 8 * 8 * elementBitSize/8 * numOfSamplesPerSplit;
+    UINT_32 blocksInTile = tileSize / blockByteSize;
+
+    if (0 == blocksInTile)
+    {
+        lsb = 0;
+    }
+    else
+    {
+        lsb = Log2(blocksInTile);
+    }
+    msb = bankBits - 1 + lsb;
+
+    UINT_64 blockInBankpipeWithBankBits = InsertBits(blockInBankpipe, bankDataBits, msb, lsb);
+
+    /// NOTE *2 because we are converting to Nibble address in this step
+    UINT_64 metaAddressInPipe = blockInBankpipeWithBankBits * 2 * metadataBitSize / 8;
+
+    ///--------------------------------------------------------------------------------------------
+    /// Reinsert pipe bits back into the final address
+    ///--------------------------------------------------------------------------------------------
+    lsb = pipeInterleaveBits + 1; ///<+1 due to Nibble address now gives interleave bits extra lsb.
+    msb = pipeBits - 1 + lsb;
+    UINT_64 metadataAddress = InsertBits(metaAddressInPipe, pipeDataBits, msb, lsb);
+
+    return metadataAddress;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeSurfaceAlignmentsMacroTiled
+*
+*   @brief
+*       Hardware layer function to compute alignment request for macro tile mode
+*
+****************************************************************************************************
+*/
+VOID CiLib::HwlComputeSurfaceAlignmentsMacroTiled(
+    AddrTileMode                      tileMode,           ///< [in] tile mode
+    UINT_32                           bpp,                ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
+    UINT_32                           mipLevel,           ///< [in] mip level
+    UINT_32                           numSamples,         ///< [in] number of samples
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
+    ) const
+{
+    // This is to workaround a H/W limitation that DCC doesn't work when pipe config is switched to
+    // P4. In theory, all asics that have such switching should be patched but we now only know what
+    // to pad for Fiji.
+    if ((m_settings.isFiji == TRUE) &&
+        (flags.dccPipeWorkaround == TRUE) &&
+        (flags.prt == FALSE) &&
+        (mipLevel == 0) &&
+        (tileMode == ADDR_TM_PRT_TILED_THIN1) &&
+        (pOut->dccUnsupport == TRUE))
+    {
+        pOut->pitchAlign   = PowTwoAlign(pOut->pitchAlign, 256);
+        // In case the client still requests DCC usage.
+        pOut->dccUnsupport = FALSE;
+    }
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlPadDimensions
+*
+*   @brief
+*       Helper function to pad dimensions
+*
+****************************************************************************************************
+*/
+VOID CiLib::HwlPadDimensions(
+    AddrTileMode        tileMode,    ///< [in] tile mode
+    UINT_32             bpp,         ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,       ///< [in] surface flags
+    UINT_32             numSamples,  ///< [in] number of samples
+    ADDR_TILEINFO*      pTileInfo,   ///< [in] tile info
+    UINT_32             mipLevel,    ///< [in] mip level
+    UINT_32*            pPitch,      ///< [in,out] pitch in pixels
+    UINT_32*            pPitchAlign, ///< [in,out] pitch alignment
+    UINT_32             height,      ///< [in] height in pixels
+    UINT_32             heightAlign  ///< [in] height alignment
+    ) const
+{
+    if ((m_settings.isVolcanicIslands == TRUE) &&
+        (flags.dccCompatible == TRUE) &&
+        (numSamples > 1) &&
+        (mipLevel == 0) &&
+        (IsMacroTiled(tileMode) == TRUE))
+    {
+        UINT_32 tileSizePerSample = BITS_TO_BYTES(bpp * MicroTileWidth * MicroTileHeight);
+        UINT_32 samplesPerSplit  = pTileInfo->tileSplitBytes / tileSizePerSample;
+
+        if (samplesPerSplit < numSamples)
+        {
+            UINT_32 dccFastClearByteAlign = HwlGetPipes(pTileInfo) * m_pipeInterleaveBytes * 256;
+            UINT_32 bytesPerSplit = BITS_TO_BYTES((*pPitch) * height * bpp * samplesPerSplit);
+
+            ADDR_ASSERT(IsPow2(dccFastClearByteAlign));
+
+            if (0 != (bytesPerSplit & (dccFastClearByteAlign - 1)))
+            {
+                UINT_32 dccFastClearPixelAlign = dccFastClearByteAlign /
+                                                BITS_TO_BYTES(bpp) /
+                                                samplesPerSplit;
+                UINT_32 macroTilePixelAlign = (*pPitchAlign) * heightAlign;
+
+                if ((dccFastClearPixelAlign >= macroTilePixelAlign) &&
+                    ((dccFastClearPixelAlign % macroTilePixelAlign) == 0))
+                {
+                    UINT_32 dccFastClearPitchAlignInMacroTile =
+                        dccFastClearPixelAlign / macroTilePixelAlign;
+                    UINT_32 heightInMacroTile = height / heightAlign;
+
+                    while ((heightInMacroTile > 1) &&
+                           ((heightInMacroTile % 2) == 0) &&
+                           (dccFastClearPitchAlignInMacroTile > 1) &&
+                           ((dccFastClearPitchAlignInMacroTile % 2) == 0))
+                    {
+                        heightInMacroTile >>= 1;
+                        dccFastClearPitchAlignInMacroTile >>= 1;
+                    }
+
+                    UINT_32 dccFastClearPitchAlignInPixels =
+                        (*pPitchAlign) * dccFastClearPitchAlignInMacroTile;
+
+                    if (IsPow2(dccFastClearPitchAlignInPixels))
+                    {
+                        *pPitch = PowTwoAlign((*pPitch), dccFastClearPitchAlignInPixels);
+                    }
+                    else
+                    {
+                        *pPitch += (dccFastClearPitchAlignInPixels - 1);
+                        *pPitch /= dccFastClearPitchAlignInPixels;
+                        *pPitch *= dccFastClearPitchAlignInPixels;
+                    }
+
+                    *pPitchAlign = dccFastClearPitchAlignInPixels;
+                }
+            }
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeMaxBaseAlignments
+*
+*   @brief
+*       Gets maximum alignments
+*   @return
+*       maximum alignments
+****************************************************************************************************
+*/
+UINT_32 CiLib::HwlComputeMaxBaseAlignments() const
+{
+    const UINT_32 pipes = HwlGetPipes(&m_tileTable[0].info);
+
+    // Initial size is 64 KiB for PRT.
+    UINT_32 maxBaseAlign = 64 * 1024;
+
+    for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
+    {
+        // The maximum tile size is 16 byte-per-pixel and either 8-sample or 8-slice.
+        UINT_32 tileSize = m_macroTileTable[i].tileSplitBytes;
+
+        UINT_32 baseAlign = tileSize * pipes * m_macroTileTable[i].banks *
+                            m_macroTileTable[i].bankWidth * m_macroTileTable[i].bankHeight;
+
+        if (baseAlign > maxBaseAlign)
+        {
+            maxBaseAlign = baseAlign;
+        }
+    }
+
+    return maxBaseAlign;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::HwlComputeMaxMetaBaseAlignments
+*
+*   @brief
+*       Gets maximum alignments for metadata
+*   @return
+*       maximum alignments for metadata
+****************************************************************************************************
+*/
+UINT_32 CiLib::HwlComputeMaxMetaBaseAlignments() const
+{
+    UINT_32 maxBank = 1;
+
+    for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
+    {
+        if ((m_settings.isVolcanicIslands) && IsMacroTiled(m_tileTable[i].mode))
+        {
+            maxBank = Max(maxBank, m_macroTileTable[i].banks);
+        }
+    }
+
+    return SiLib::HwlComputeMaxMetaBaseAlignments() * maxBank;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::DepthStencilTileCfgMatch
+*
+*   @brief
+*       Try to find a tile index for stencil which makes its tile config parameters matches to depth
+*   @return
+*       TRUE if such tile index for stencil can be found
+****************************************************************************************************
+*/
+BOOL_32 CiLib::DepthStencilTileCfgMatch(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    BOOL_32 depthStencil2DTileConfigMatch = FALSE;
+
+    for (INT_32 stencilTileIndex = MinDepth2DThinIndex;
+         stencilTileIndex <= MaxDepth2DThinIndex;
+         stencilTileIndex++)
+    {
+        ADDR_TILEINFO tileInfo = {0};
+        INT_32 stencilMacroIndex = HwlComputeMacroModeIndex(stencilTileIndex,
+                                                            pIn->flags,
+                                                            8,
+                                                            pIn->numSamples,
+                                                            &tileInfo);
+
+        if (stencilMacroIndex != TileIndexNoMacroIndex)
+        {
+            if ((m_macroTileTable[stencilMacroIndex].banks ==
+                 m_macroTileTable[pOut->macroModeIndex].banks) &&
+                (m_macroTileTable[stencilMacroIndex].bankWidth ==
+                 m_macroTileTable[pOut->macroModeIndex].bankWidth) &&
+                (m_macroTileTable[stencilMacroIndex].bankHeight ==
+                 m_macroTileTable[pOut->macroModeIndex].bankHeight) &&
+                (m_macroTileTable[stencilMacroIndex].macroAspectRatio ==
+                 m_macroTileTable[pOut->macroModeIndex].macroAspectRatio) &&
+                (m_macroTileTable[stencilMacroIndex].pipeConfig ==
+                 m_macroTileTable[pOut->macroModeIndex].pipeConfig))
+            {
+                if ((pOut->tcCompatible == FALSE) ||
+                    (tileInfo.tileSplitBytes >= MicroTileWidth * MicroTileHeight * pIn->numSamples))
+                {
+                    depthStencil2DTileConfigMatch = TRUE;
+                    pOut->stencilTileIdx = stencilTileIndex;
+                    break;
+                }
+            }
+        }
+        else
+        {
+            ADDR_ASSERT_ALWAYS();
+        }
+    }
+
+    return depthStencil2DTileConfigMatch;
+}
+
+/**
+****************************************************************************************************
+*   CiLib::DepthStencilTileCfgMatch
+*
+*   @brief
+*       Check if tc compatibility is available
+*   @return
+*       If tc compatibility is not available
+****************************************************************************************************
+*/
+BOOL_32 CiLib::CheckTcCompatibility(
+    const ADDR_TILEINFO*                    pTileInfo,    ///< [in] input tile info
+    UINT_32                                 bpp,          ///< [in] Bits per pixel
+    AddrTileMode                            tileMode,     ///< [in] input tile mode
+    AddrTileType                            tileType,     ///< [in] input tile type
+    const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut          ///< [in] output surf info
+    ) const
+{
+    BOOL_32 tcCompatible = TRUE;
+
+    if (IsMacroTiled(tileMode))
+    {
+        if (tileType != ADDR_DEPTH_SAMPLE_ORDER)
+        {
+            // Turn off tcCompatible for color surface if tileSplit happens. Depth/stencil
+            // tileSplit case was handled at tileIndex selecting time.
+            INT_32 tileIndex = pOut->tileIndex;
+
+            if ((tileIndex == TileIndexInvalid) && (IsTileInfoAllZero(pTileInfo) == FALSE))
+            {
+                tileIndex = HwlPostCheckTileIndex(pTileInfo, tileMode, tileType, tileIndex);
+            }
+
+            if (tileIndex != TileIndexInvalid)
+            {
+                UINT_32 thickness = Thickness(tileMode);
+
+                ADDR_ASSERT(static_cast<UINT_32>(tileIndex) < TileTableSize);
+                // Non-depth entries store a split factor
+                UINT_32 sampleSplit = m_tileTable[tileIndex].info.tileSplitBytes;
+                UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
+                UINT_32 colorTileSplit = Max(256u, sampleSplit * tileBytes1x);
+
+                if (m_rowSize < colorTileSplit)
+                {
+                    tcCompatible = FALSE;
+                }
+            }
+        }
+    }
+    else
+    {
+        // Client should not enable tc compatible for linear and 1D tile modes.
+        tcCompatible = FALSE;
+    }
+
+    return tcCompatible;
+}
+
+} // V1
+} // Addr
diff --git a/src/amd/addrlib/src/r800/ciaddrlib.h b/src/amd/addrlib/src/r800/ciaddrlib.h
new file mode 100644 (file)
index 0000000..5185389
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Copyright © 2007-2018 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  ciaddrlib.h
+* @brief Contains the CiLib class definition.
+****************************************************************************************************
+*/
+
+#ifndef __CI_ADDR_LIB_H__
+#define __CI_ADDR_LIB_H__
+
+#include "addrlib1.h"
+#include "siaddrlib.h"
+
+namespace Addr
+{
+namespace V1
+{
+
+/**
+****************************************************************************************************
+* @brief This class is the CI specific address library
+*        function set.
+****************************************************************************************************
+*/
+class CiLib : public SiLib
+{
+public:
+    /// Creates CiLib object
+    static Addr::Lib* CreateObj(const Client* pClient)
+    {
+        VOID* pMem = Object::ClientAlloc(sizeof(CiLib), pClient);
+        return (pMem != NULL) ? new (pMem) CiLib(pClient) : NULL;
+    }
+
+private:
+    CiLib(const Client* pClient);
+    virtual ~CiLib();
+
+protected:
+
+    // Hwl interface - defined in AddrLib1
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
+
+    virtual ChipFamily HwlConvertChipFamily(
+        UINT_32 uChipFamily, UINT_32 uChipRevision);
+
+    virtual BOOL_32 HwlInitGlobalParams(
+        const ADDR_CREATE_INPUT* pCreateIn);
+
+    virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
+        UINT_32 bpp, INT_32 index, INT_32 macroModeIndex, ADDR_TILEINFO* pInfo,
+        AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
+
+    virtual VOID HwlComputeTileDataWidthAndHeightLinear(
+        UINT_32* pMacroWidth, UINT_32* pMacroHeight,
+        UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
+
+    virtual INT_32 HwlComputeMacroModeIndex(
+        INT_32 tileIndex, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
+        ADDR_TILEINFO* pTileInfo, AddrTileMode* pTileMode = NULL, AddrTileType* pTileType = NULL
+        ) const;
+
+    // Sub-hwl interface - defined in EgBasedLib
+    virtual VOID HwlSetupTileInfo(
+        AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
+        AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    virtual INT_32 HwlPostCheckTileIndex(
+        const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
+        INT curIndex = TileIndexInvalid) const;
+
+    virtual VOID HwlFmaskPreThunkSurfInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
+        const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
+
+    virtual VOID HwlFmaskPostThunkSurfInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
+
+    virtual AddrTileMode HwlDegradeThickTileMode(
+        AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
+
+    virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    /// Overwrite tile setting to PRT
+    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
+        const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
+        ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
+        const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
+        const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
+        ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*       pOut) const;
+
+    virtual UINT_32 HwlComputeMaxBaseAlignments() const;
+
+    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
+
+    virtual VOID HwlPadDimensions(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
+        UINT_32* pPitch, UINT_32 *PitchAlign, UINT_32 height, UINT_32 heightAlign) const;
+
+    virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+private:
+
+    VOID ReadGbTileMode(
+        UINT_32 regValue, TileConfig* pCfg) const;
+
+    VOID ReadGbMacroTileCfg(
+        UINT_32 regValue, ADDR_TILEINFO* pCfg) const;
+
+private:
+    BOOL_32 InitTileSettingTable(
+        const UINT_32 *pSetting, UINT_32 noOfEntries);
+
+    BOOL_32 InitMacroTileCfgTable(
+        const UINT_32 *pSetting, UINT_32 noOfEntries);
+
+    UINT_64 HwlComputeMetadataNibbleAddress(
+        UINT_64 uncompressedDataByteAddress,
+        UINT_64 dataBaseByteAddress,
+        UINT_64 metadataBaseByteAddress,
+        UINT_32 metadataBitSize,
+        UINT_32 elementBitSize,
+        UINT_32 blockByteSize,
+        UINT_32 pipeInterleaveBytes,
+        UINT_32 numOfPipes,
+        UINT_32 numOfBanks,
+        UINT_32 numOfSamplesPerSplit) const;
+
+    BOOL_32 DepthStencilTileCfgMatch(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut) const;
+
+    BOOL_32 CheckTcCompatibility(const ADDR_TILEINFO* pTileInfo, UINT_32 bpp, AddrTileMode tileMode,
+                                 AddrTileType tileType, const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    static const UINT_32    MacroTileTableSize = 16;
+    static const UINT_32    PrtMacroModeOffset = MacroTileTableSize / 2;
+    static const INT_32     MinDepth2DThinIndex = 0;
+    static const INT_32     MaxDepth2DThinIndex = 4;
+    static const INT_32     Depth1DThinIndex = 5;
+
+    ADDR_TILEINFO           m_macroTileTable[MacroTileTableSize];
+    UINT_32                 m_noOfMacroEntries;
+    BOOL_32                 m_allowNonDispThickModes;
+};
+
+} // V1
+} // Addr
+
+#endif
diff --git a/src/amd/addrlib/src/r800/egbaddrlib.cpp b/src/amd/addrlib/src/r800/egbaddrlib.cpp
new file mode 100644 (file)
index 0000000..3c68423
--- /dev/null
@@ -0,0 +1,4156 @@
+/*
+ * Copyright © 2007-2018 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  egbaddrlib.cpp
+* @brief Contains the EgBasedLib class implementation.
+****************************************************************************************************
+*/
+
+#include "egbaddrlib.h"
+
+#include "util/macros.h"
+
+namespace Addr
+{
+namespace V1
+{
+
+/**
+****************************************************************************************************
+*   EgBasedLib::EgBasedLib
+*
+*   @brief
+*       Constructor
+*
+*   @note
+*
+****************************************************************************************************
+*/
+EgBasedLib::EgBasedLib(const Client* pClient)
+    :
+    Lib(pClient),
+    m_ranks(0),
+    m_logicalBanks(0),
+    m_bankInterleave(1)
+{
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::~EgBasedLib
+*
+*   @brief
+*       Destructor
+****************************************************************************************************
+*/
+EgBasedLib::~EgBasedLib()
+{
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::DispatchComputeSurfaceInfo
+*
+*   @brief
+*       Compute surface sizes include padded pitch,height,slices,total size in bytes,
+*       meanwhile output suitable tile mode and base alignment might be changed in this
+*       call as well. Results are returned through output parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::DispatchComputeSurfaceInfo(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    AddrTileMode        tileMode      = pIn->tileMode;
+    UINT_32             bpp           = pIn->bpp;
+    UINT_32             numSamples    = pIn->numSamples;
+    UINT_32             numFrags      = ((pIn->numFrags == 0) ? numSamples : pIn->numFrags);
+    UINT_32             pitch         = pIn->width;
+    UINT_32             height        = pIn->height;
+    UINT_32             numSlices     = pIn->numSlices;
+    UINT_32             mipLevel      = pIn->mipLevel;
+    ADDR_SURFACE_FLAGS  flags         = pIn->flags;
+
+    ADDR_TILEINFO       tileInfoDef   = {0};
+    ADDR_TILEINFO*      pTileInfo     = &tileInfoDef;
+    UINT_32             padDims       = 0;
+    BOOL_32             valid;
+
+    if (pIn->flags.disallowLargeThickDegrade == 0)
+    {
+        tileMode = DegradeLargeThickTile(tileMode, bpp);
+    }
+
+    // Only override numSamples for NI above
+    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
+    {
+        if (numFrags != numSamples) // This means EQAA
+        {
+            // The real surface size needed is determined by number of fragments
+            numSamples = numFrags;
+        }
+
+        // Save altered numSamples in pOut
+        pOut->numSamples = numSamples;
+    }
+
+    // Caller makes sure pOut->pTileInfo is not NULL, see HwlComputeSurfaceInfo
+    ADDR_ASSERT(pOut->pTileInfo);
+
+    if (pOut->pTileInfo != NULL)
+    {
+        pTileInfo = pOut->pTileInfo;
+    }
+
+    // Set default values
+    if (pIn->pTileInfo != NULL)
+    {
+        if (pTileInfo != pIn->pTileInfo)
+        {
+            *pTileInfo = *pIn->pTileInfo;
+        }
+    }
+    else
+    {
+        memset(pTileInfo, 0, sizeof(ADDR_TILEINFO));
+    }
+
+    // For macro tile mode, we should calculate default tiling parameters
+    HwlSetupTileInfo(tileMode,
+                     flags,
+                     bpp,
+                     pitch,
+                     height,
+                     numSamples,
+                     pIn->pTileInfo,
+                     pTileInfo,
+                     pIn->tileType,
+                     pOut);
+
+    if (flags.cube)
+    {
+        if (mipLevel == 0)
+        {
+            padDims = 2;
+        }
+
+        if (numSlices == 1)
+        {
+            // This is calculating one face, remove cube flag
+            flags.cube = 0;
+        }
+    }
+
+    switch (tileMode)
+    {
+        case ADDR_TM_LINEAR_GENERAL://fall through
+        case ADDR_TM_LINEAR_ALIGNED:
+            valid = ComputeSurfaceInfoLinear(pIn, pOut, padDims);
+            break;
+
+        case ADDR_TM_1D_TILED_THIN1://fall through
+        case ADDR_TM_1D_TILED_THICK:
+            valid = ComputeSurfaceInfoMicroTiled(pIn, pOut, padDims, tileMode);
+            break;
+
+        case ADDR_TM_2D_TILED_THIN1:    //fall through
+        case ADDR_TM_2D_TILED_THICK:    //fall through
+        case ADDR_TM_3D_TILED_THIN1:    //fall through
+        case ADDR_TM_3D_TILED_THICK:    //fall through
+        case ADDR_TM_2D_TILED_XTHICK:   //fall through
+        case ADDR_TM_3D_TILED_XTHICK:   //fall through
+        case ADDR_TM_PRT_TILED_THIN1:   //fall through
+        case ADDR_TM_PRT_2D_TILED_THIN1://fall through
+        case ADDR_TM_PRT_3D_TILED_THIN1://fall through
+        case ADDR_TM_PRT_TILED_THICK:   //fall through
+        case ADDR_TM_PRT_2D_TILED_THICK://fall through
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            valid = ComputeSurfaceInfoMacroTiled(pIn, pOut, padDims, tileMode);
+            break;
+
+        default:
+            valid = FALSE;
+            ADDR_ASSERT_ALWAYS();
+            break;
+    }
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceInfoLinear
+*
+*   @brief
+*       Compute linear surface sizes include padded pitch, height, slices, total size in
+*       bytes, meanwhile alignments as well. Since it is linear mode, so output tile mode
+*       will not be changed here. Results are returned through output parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::ComputeSurfaceInfoLinear(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] Input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,   ///< [out] Output structure
+    UINT_32                                 padDims ///< [in] Dimensions to padd
+    ) const
+{
+    UINT_32 expPitch = pIn->width;
+    UINT_32 expHeight = pIn->height;
+    UINT_32 expNumSlices = pIn->numSlices;
+
+    // No linear MSAA on real H/W, keep this for TGL
+    UINT_32 numSamples = pOut->numSamples;
+
+    const UINT_32 microTileThickness = 1;
+
+    //
+    // Compute the surface alignments.
+    //
+    ComputeSurfaceAlignmentsLinear(pIn->tileMode,
+                                   pIn->bpp,
+                                   pIn->flags,
+                                   &pOut->baseAlign,
+                                   &pOut->pitchAlign,
+                                   &pOut->heightAlign);
+
+    if ((pIn->tileMode == ADDR_TM_LINEAR_GENERAL) && pIn->flags.color && (pIn->height > 1))
+    {
+#if !ALT_TEST
+        // When linear_general surface is accessed in multiple lines, it requires 8 pixels in pitch
+        // alignment since PITCH_TILE_MAX is in unit of 8 pixels.
+        // It is OK if it is accessed per line.
+        ADDR_ASSERT((pIn->width % 8) == 0);
+#endif
+    }
+
+    pOut->depthAlign = microTileThickness;
+
+    expPitch = HwlPreHandleBaseLvl3xPitch(pIn, expPitch);
+
+    //
+    // Pad pitch and height to the required granularities.
+    //
+    PadDimensions(pIn->tileMode,
+                  pIn->bpp,
+                  pIn->flags,
+                  numSamples,
+                  pOut->pTileInfo,
+                  padDims,
+                  pIn->mipLevel,
+                  &expPitch, &pOut->pitchAlign,
+                  &expHeight, pOut->heightAlign,
+                  &expNumSlices, microTileThickness);
+
+    expPitch = HwlPostHandleBaseLvl3xPitch(pIn, expPitch);
+
+    //
+    // Adjust per HWL
+    //
+
+    UINT_64 logicalSliceSize;
+
+    logicalSliceSize = HwlGetSizeAdjustmentLinear(pIn->tileMode,
+                                                  pIn->bpp,
+                                                  numSamples,
+                                                  pOut->baseAlign,
+                                                  pOut->pitchAlign,
+                                                  &expPitch,
+                                                  &expHeight,
+                                                  &pOut->heightAlign);
+
+    if ((pIn->pitchAlign != 0) || (pIn->heightAlign != 0))
+    {
+        if (pIn->pitchAlign != 0)
+        {
+           ADDR_ASSERT((pIn->pitchAlign % pOut->pitchAlign) == 0);
+           pOut->pitchAlign = pIn->pitchAlign;
+
+            if (IsPow2(pOut->pitchAlign))
+            {
+                expPitch = PowTwoAlign(expPitch, pOut->pitchAlign);
+            }
+            else
+            {
+                expPitch += pOut->pitchAlign - 1;
+                expPitch /= pOut->pitchAlign;
+                expPitch *= pOut->pitchAlign;
+            }
+        }
+
+        if (pIn->heightAlign != 0)
+        {
+           ADDR_ASSERT((pIn->heightAlign % pOut->heightAlign) == 0);
+           pOut->heightAlign = pIn->heightAlign;
+
+            if (IsPow2(pOut->heightAlign))
+            {
+                expHeight = PowTwoAlign(expHeight, pOut->heightAlign);
+            }
+            else
+            {
+                expHeight += pOut->heightAlign - 1;
+                expHeight /= pOut->heightAlign;
+                expHeight *= pOut->heightAlign;
+            }
+        }
+
+        logicalSliceSize = BITS_TO_BYTES(expPitch * expHeight * pIn->bpp);
+    }
+
+    pOut->pitch = expPitch;
+    pOut->height = expHeight;
+    pOut->depth = expNumSlices;
+
+    pOut->surfSize = logicalSliceSize * expNumSlices;
+
+    pOut->tileMode = pIn->tileMode;
+
+    return TRUE;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceInfoMicroTiled
+*
+*   @brief
+*       Compute 1D/Micro Tiled surface sizes include padded pitch, height, slices, total
+*       size in bytes, meanwhile alignments as well. Results are returned through output
+*       parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::ComputeSurfaceInfoMicroTiled(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] Input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,       ///< [out] Output structure
+    UINT_32                                 padDims,    ///< [in] Dimensions to padd
+    AddrTileMode                            expTileMode ///< [in] Expected tile mode
+    ) const
+{
+    BOOL_32 valid = TRUE;
+
+    UINT_32 microTileThickness;
+    UINT_32 expPitch = pIn->width;
+    UINT_32 expHeight = pIn->height;
+    UINT_32 expNumSlices = pIn->numSlices;
+
+    // No 1D MSAA on real H/W, keep this for TGL
+    UINT_32 numSamples = pOut->numSamples;
+
+    //
+    // Compute the micro tile thickness.
+    //
+    microTileThickness = Thickness(expTileMode);
+
+    //
+    // Extra override for mip levels
+    //
+    if (pIn->mipLevel > 0)
+    {
+        //
+        // Reduce tiling mode from thick to thin if the number of slices is less than the
+        // micro tile thickness.
+        //
+        if ((expTileMode == ADDR_TM_1D_TILED_THICK) &&
+            (expNumSlices < ThickTileThickness))
+        {
+            expTileMode = HwlDegradeThickTileMode(ADDR_TM_1D_TILED_THICK, expNumSlices, NULL);
+            if (expTileMode != ADDR_TM_1D_TILED_THICK)
+            {
+                microTileThickness = 1;
+            }
+        }
+    }
+
+    //
+    // Compute the surface restrictions.
+    //
+    ComputeSurfaceAlignmentsMicroTiled(expTileMode,
+                                       pIn->bpp,
+                                       pIn->flags,
+                                       pIn->mipLevel,
+                                       numSamples,
+                                       &pOut->baseAlign,
+                                       &pOut->pitchAlign,
+                                       &pOut->heightAlign);
+
+    pOut->depthAlign = microTileThickness;
+
+    //
+    // Pad pitch and height to the required granularities.
+    // Compute surface size.
+    // Return parameters.
+    //
+    PadDimensions(expTileMode,
+                  pIn->bpp,
+                  pIn->flags,
+                  numSamples,
+                  pOut->pTileInfo,
+                  padDims,
+                  pIn->mipLevel,
+                  &expPitch, &pOut->pitchAlign,
+                  &expHeight, pOut->heightAlign,
+                  &expNumSlices, microTileThickness);
+
+    //
+    // Get HWL specific pitch adjustment
+    //
+    UINT_64 logicalSliceSize = HwlGetSizeAdjustmentMicroTiled(microTileThickness,
+                                                              pIn->bpp,
+                                                              pIn->flags,
+                                                              numSamples,
+                                                              pOut->baseAlign,
+                                                              pOut->pitchAlign,
+                                                              &expPitch,
+                                                              &expHeight);
+
+    pOut->pitch = expPitch;
+    pOut->height = expHeight;
+    pOut->depth = expNumSlices;
+
+    pOut->surfSize = logicalSliceSize * expNumSlices;
+
+    pOut->tileMode = expTileMode;
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceInfoMacroTiled
+*
+*   @brief
+*       Compute 2D/macro tiled surface sizes include padded pitch, height, slices, total
+*       size in bytes, meanwhile output suitable tile mode and alignments might be changed
+*       in this call as well. Results are returned through output parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::ComputeSurfaceInfoMacroTiled(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] Input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut,       ///< [out] Output structure
+    UINT_32                                 padDims,    ///< [in] Dimensions to padd
+    AddrTileMode                            expTileMode ///< [in] Expected tile mode
+    ) const
+{
+    BOOL_32 valid = TRUE;
+
+    AddrTileMode origTileMode = expTileMode;
+    UINT_32 microTileThickness;
+
+    UINT_32 paddedPitch;
+    UINT_32 paddedHeight;
+    UINT_64 bytesPerSlice;
+
+    UINT_32 expPitch     = pIn->width;
+    UINT_32 expHeight    = pIn->height;
+    UINT_32 expNumSlices = pIn->numSlices;
+
+    UINT_32 numSamples = pOut->numSamples;
+
+    //
+    // Compute the surface restrictions as base
+    // SanityCheckMacroTiled is called in ComputeSurfaceAlignmentsMacroTiled
+    //
+    valid = ComputeSurfaceAlignmentsMacroTiled(expTileMode,
+                                               pIn->bpp,
+                                               pIn->flags,
+                                               pIn->mipLevel,
+                                               numSamples,
+                                               pOut);
+
+    if (valid)
+    {
+        //
+        // Compute the micro tile thickness.
+        //
+        microTileThickness = Thickness(expTileMode);
+
+        //
+        // Find the correct tiling mode for mip levels
+        //
+        if (pIn->mipLevel > 0)
+        {
+            //
+            // Try valid tile mode
+            //
+            expTileMode = ComputeSurfaceMipLevelTileMode(expTileMode,
+                                                         pIn->bpp,
+                                                         expPitch,
+                                                         expHeight,
+                                                         expNumSlices,
+                                                         numSamples,
+                                                         pOut->blockWidth,
+                                                         pOut->blockHeight,
+                                                         pOut->pTileInfo);
+
+            if (!IsMacroTiled(expTileMode)) // Downgraded to micro-tiled
+            {
+                return ComputeSurfaceInfoMicroTiled(pIn, pOut, padDims, expTileMode);
+            }
+            else if (microTileThickness != Thickness(expTileMode))
+            {
+                //
+                // Re-compute if thickness changed since bank-height may be changed!
+                //
+                return ComputeSurfaceInfoMacroTiled(pIn, pOut, padDims, expTileMode);
+            }
+        }
+
+        paddedPitch     = expPitch;
+        paddedHeight    = expHeight;
+
+        //
+        // Re-cal alignment
+        //
+        if (expTileMode != origTileMode) // Tile mode is changed but still macro-tiled
+        {
+            valid = ComputeSurfaceAlignmentsMacroTiled(expTileMode,
+                                                       pIn->bpp,
+                                                       pIn->flags,
+                                                       pIn->mipLevel,
+                                                       numSamples,
+                                                       pOut);
+        }
+
+        //
+        // Do padding
+        //
+        PadDimensions(expTileMode,
+                      pIn->bpp,
+                      pIn->flags,
+                      numSamples,
+                      pOut->pTileInfo,
+                      padDims,
+                      pIn->mipLevel,
+                      &paddedPitch, &pOut->pitchAlign,
+                      &paddedHeight, pOut->heightAlign,
+                      &expNumSlices, microTileThickness);
+
+        if (pIn->flags.qbStereo &&
+            (pOut->pStereoInfo != NULL))
+        {
+            UINT_32 stereoHeightAlign = HwlStereoCheckRightOffsetPadding(pOut->pTileInfo);
+
+            if (stereoHeightAlign != 0)
+            {
+                paddedHeight = PowTwoAlign(paddedHeight, stereoHeightAlign);
+            }
+        }
+
+        if ((pIn->flags.needEquation == TRUE) &&
+            (m_chipFamily == ADDR_CHIP_FAMILY_SI) &&
+            (pIn->numMipLevels > 1) &&
+            (pIn->mipLevel == 0))
+        {
+            BOOL_32 convertTo1D = FALSE;
+
+            ADDR_ASSERT(Thickness(expTileMode) == 1);
+
+            for (UINT_32 i = 1; i < pIn->numMipLevels; i++)
+            {
+                UINT_32 mipPitch = Max(1u, paddedPitch >> i);
+                UINT_32 mipHeight = Max(1u, pIn->height >> i);
+                UINT_32 mipSlices = pIn->flags.volume ?
+                                    Max(1u, pIn->numSlices >> i) : pIn->numSlices;
+                expTileMode = ComputeSurfaceMipLevelTileMode(expTileMode,
+                                                             pIn->bpp,
+                                                             mipPitch,
+                                                             mipHeight,
+                                                             mipSlices,
+                                                             numSamples,
+                                                             pOut->blockWidth,
+                                                             pOut->blockHeight,
+                                                             pOut->pTileInfo);
+
+                if (IsMacroTiled(expTileMode))
+                {
+                    if (PowTwoAlign(mipPitch, pOut->blockWidth) !=
+                        PowTwoAlign(mipPitch, pOut->pitchAlign))
+                    {
+                        convertTo1D = TRUE;
+                        break;
+                    }
+                }
+                else
+                {
+                    break;
+                }
+            }
+
+            if (convertTo1D)
+            {
+                return ComputeSurfaceInfoMicroTiled(pIn, pOut, padDims, ADDR_TM_1D_TILED_THIN1);
+            }
+        }
+
+        pOut->pitch = paddedPitch;
+        // Put this check right here to workaround special mipmap cases which the original height
+        // is needed.
+        // The original height is pre-stored in pOut->height in PostComputeMipLevel and
+        // pOut->pitch is needed in HwlCheckLastMacroTiledLvl, too.
+        if (m_configFlags.checkLast2DLevel && (numSamples == 1)) // Don't check MSAA
+        {
+            // Set a TRUE in pOut if next Level is the first 1D sub level
+            HwlCheckLastMacroTiledLvl(pIn, pOut);
+        }
+        pOut->height = paddedHeight;
+
+        pOut->depth = expNumSlices;
+
+        //
+        // Compute the size of a slice.
+        //
+        bytesPerSlice = BITS_TO_BYTES(static_cast<UINT_64>(paddedPitch) *
+                                      paddedHeight * NextPow2(pIn->bpp) * numSamples);
+
+        pOut->surfSize = bytesPerSlice * expNumSlices;
+
+        pOut->tileMode = expTileMode;
+
+        pOut->depthAlign = microTileThickness;
+
+    } // if (valid)
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceAlignmentsLinear
+*
+*   @brief
+*       Compute linear surface alignment, calculation results are returned through
+*       output parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsLinear(
+    AddrTileMode        tileMode,          ///< [in] tile mode
+    UINT_32             bpp,               ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
+    UINT_32*            pBaseAlign,        ///< [out] base address alignment in bytes
+    UINT_32*            pPitchAlign,       ///< [out] pitch alignment in pixels
+    UINT_32*            pHeightAlign       ///< [out] height alignment in pixels
+    ) const
+{
+    BOOL_32 valid = TRUE;
+
+    switch (tileMode)
+    {
+        case ADDR_TM_LINEAR_GENERAL:
+            //
+            // The required base alignment and pitch and height granularities is to 1 element.
+            //
+            *pBaseAlign   = (bpp > 8) ? bpp / 8 : 1;
+            *pPitchAlign  = 1;
+            *pHeightAlign = 1;
+            break;
+        case ADDR_TM_LINEAR_ALIGNED:
+            //
+            // The required alignment for base is the pipe interleave size.
+            // The required granularity for pitch is hwl dependent.
+            // The required granularity for height is one row.
+            //
+            *pBaseAlign     = m_pipeInterleaveBytes;
+            *pPitchAlign    = HwlGetPitchAlignmentLinear(bpp, flags);
+            *pHeightAlign   = 1;
+            break;
+        default:
+            *pBaseAlign     = 1;
+            *pPitchAlign    = 1;
+            *pHeightAlign   = 1;
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    AdjustPitchAlignment(flags, pPitchAlign);
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceAlignmentsMicroTiled
+*
+*   @brief
+*       Compute 1D tiled surface alignment, calculation results are returned through
+*       output parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMicroTiled(
+    AddrTileMode        tileMode,          ///< [in] tile mode
+    UINT_32             bpp,               ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
+    UINT_32             mipLevel,          ///< [in] mip level
+    UINT_32             numSamples,        ///< [in] number of samples
+    UINT_32*            pBaseAlign,        ///< [out] base address alignment in bytes
+    UINT_32*            pPitchAlign,       ///< [out] pitch alignment in pixels
+    UINT_32*            pHeightAlign       ///< [out] height alignment in pixels
+    ) const
+{
+    BOOL_32 valid = TRUE;
+
+    //
+    // The required alignment for base is the pipe interleave size.
+    //
+    *pBaseAlign   = m_pipeInterleaveBytes;
+
+    *pPitchAlign  = HwlGetPitchAlignmentMicroTiled(tileMode, bpp, flags, numSamples);
+
+    *pHeightAlign = MicroTileHeight;
+
+    AdjustPitchAlignment(flags, pPitchAlign);
+
+    // Workaround 2 for 1D tiling -  There is HW bug for Carrizo,
+    // where it requires the following alignments for 1D tiling.
+    if (flags.czDispCompatible && (mipLevel == 0))
+    {
+        *pBaseAlign  = PowTwoAlign(*pBaseAlign, 4096);                         //Base address MOD 4096 = 0
+        *pPitchAlign = PowTwoAlign(*pPitchAlign, 512 / (BITS_TO_BYTES(bpp)));  //(8 lines * pitch * bytes per pixel) MOD 4096 = 0
+    }
+    // end Carrizo workaround for 1D tilling
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlReduceBankWidthHeight
+*
+*   @brief
+*       Additional checks, reduce bankHeight/bankWidth if needed and possible
+*       tileSize*BANK_WIDTH*BANK_HEIGHT <= ROW_SIZE
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::HwlReduceBankWidthHeight(
+    UINT_32             tileSize,           ///< [in] tile size
+    UINT_32             bpp,                ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,              ///< [in] surface flags
+    UINT_32             numSamples,         ///< [in] number of samples
+    UINT_32             bankHeightAlign,    ///< [in] bank height alignment
+    UINT_32             pipes,              ///< [in] pipes
+    ADDR_TILEINFO*      pTileInfo           ///< [in,out] bank structure.
+    ) const
+{
+    UINT_32 macroAspectAlign;
+    BOOL_32 valid = TRUE;
+
+    if (tileSize * pTileInfo->bankWidth * pTileInfo->bankHeight > m_rowSize)
+    {
+        BOOL_32 stillGreater = TRUE;
+
+        // Try reducing bankWidth first
+        if (stillGreater && pTileInfo->bankWidth > 1)
+        {
+            while (stillGreater && pTileInfo->bankWidth > 0)
+            {
+                pTileInfo->bankWidth >>= 1;
+
+                if (pTileInfo->bankWidth == 0)
+                {
+                    pTileInfo->bankWidth = 1;
+                    break;
+                }
+
+                stillGreater =
+                    tileSize * pTileInfo->bankWidth * pTileInfo->bankHeight > m_rowSize;
+            }
+
+            // bankWidth is reduced above, so we need to recalculate bankHeight and ratio
+            bankHeightAlign = Max(1u,
+                                  m_pipeInterleaveBytes * m_bankInterleave /
+                                  (tileSize * pTileInfo->bankWidth)
+                                  );
+
+            // We cannot increase bankHeight so just assert this case.
+            ADDR_ASSERT((pTileInfo->bankHeight % bankHeightAlign) == 0);
+
+            if (numSamples == 1)
+            {
+                macroAspectAlign = Max(1u,
+                                   m_pipeInterleaveBytes * m_bankInterleave /
+                                   (tileSize * pipes * pTileInfo->bankWidth)
+                                   );
+                pTileInfo->macroAspectRatio = PowTwoAlign(pTileInfo->macroAspectRatio,
+                                                          macroAspectAlign);
+            }
+        }
+
+        // Early quit bank_height degradation for "64" bit z buffer
+        if (flags.depth && bpp >= 64)
+        {
+            stillGreater = FALSE;
+        }
+
+        // Then try reducing bankHeight
+        if (stillGreater && pTileInfo->bankHeight > bankHeightAlign)
+        {
+            while (stillGreater && pTileInfo->bankHeight > bankHeightAlign)
+            {
+                pTileInfo->bankHeight >>= 1;
+
+                if (pTileInfo->bankHeight < bankHeightAlign)
+                {
+                    pTileInfo->bankHeight = bankHeightAlign;
+                    break;
+                }
+
+                stillGreater =
+                    tileSize * pTileInfo->bankWidth * pTileInfo->bankHeight > m_rowSize;
+            }
+        }
+
+        valid = !stillGreater;
+
+        // Generate a warning if we still fail to meet this constraint
+        if (valid == FALSE)
+        {
+            ADDR_WARN(
+                0, ("TILE_SIZE(%d)*BANK_WIDTH(%d)*BANK_HEIGHT(%d) <= ROW_SIZE(%d)",
+                tileSize, pTileInfo->bankWidth, pTileInfo->bankHeight, m_rowSize));
+        }
+    }
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceAlignmentsMacroTiled
+*
+*   @brief
+*       Compute 2D tiled surface alignment, calculation results are returned through
+*       output parameters.
+*
+*   @return
+*       TRUE if no error occurs
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMacroTiled(
+    AddrTileMode                      tileMode,           ///< [in] tile mode
+    UINT_32                           bpp,                ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
+    UINT_32                           mipLevel,           ///< [in] mip level
+    UINT_32                           numSamples,         ///< [in] number of samples
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
+    ) const
+{
+    ADDR_TILEINFO* pTileInfo = pOut->pTileInfo;
+
+    BOOL_32 valid = SanityCheckMacroTiled(pTileInfo);
+
+    if (valid)
+    {
+        UINT_32 macroTileWidth;
+        UINT_32 macroTileHeight;
+
+        UINT_32 tileSize;
+        UINT_32 bankHeightAlign;
+        UINT_32 macroAspectAlign;
+
+        UINT_32 thickness = Thickness(tileMode);
+        UINT_32 pipes = HwlGetPipes(pTileInfo);
+
+        //
+        // Align bank height first according to latest h/w spec
+        //
+
+        // tile_size = MIN(tile_split, 64 * tile_thickness * element_bytes * num_samples)
+        tileSize = Min(pTileInfo->tileSplitBytes,
+                       BITS_TO_BYTES(64 * thickness * bpp * numSamples));
+
+        // bank_height_align =
+        // MAX(1, (pipe_interleave_bytes * bank_interleave)/(tile_size*bank_width))
+        bankHeightAlign = Max(1u,
+                              m_pipeInterleaveBytes * m_bankInterleave /
+                              (tileSize * pTileInfo->bankWidth)
+                              );
+
+        pTileInfo->bankHeight = PowTwoAlign(pTileInfo->bankHeight, bankHeightAlign);
+
+        // num_pipes * bank_width * macro_tile_aspect >=
+        // (pipe_interleave_size * bank_interleave) / tile_size
+        if (numSamples == 1)
+        {
+            // this restriction is only for mipmap (mipmap's numSamples must be 1)
+            macroAspectAlign = Max(1u,
+                                   m_pipeInterleaveBytes * m_bankInterleave /
+                                   (tileSize * pipes * pTileInfo->bankWidth)
+                                   );
+            pTileInfo->macroAspectRatio = PowTwoAlign(pTileInfo->macroAspectRatio, macroAspectAlign);
+        }
+
+        valid = HwlReduceBankWidthHeight(tileSize,
+                                         bpp,
+                                         flags,
+                                         numSamples,
+                                         bankHeightAlign,
+                                         pipes,
+                                         pTileInfo);
+
+        //
+        // The required granularity for pitch is the macro tile width.
+        //
+        macroTileWidth = MicroTileWidth * pTileInfo->bankWidth * pipes *
+            pTileInfo->macroAspectRatio;
+
+        pOut->pitchAlign = macroTileWidth;
+        pOut->blockWidth = macroTileWidth;
+
+        AdjustPitchAlignment(flags, &pOut->pitchAlign);
+
+        //
+        // The required granularity for height is the macro tile height.
+        //
+        macroTileHeight = MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
+            pTileInfo->macroAspectRatio;
+
+        pOut->heightAlign = macroTileHeight;
+        pOut->blockHeight = macroTileHeight;
+
+        //
+        // Compute base alignment
+        //
+        pOut->baseAlign =
+            pipes * pTileInfo->bankWidth * pTileInfo->banks * pTileInfo->bankHeight * tileSize;
+
+        HwlComputeSurfaceAlignmentsMacroTiled(tileMode, bpp, flags, mipLevel, numSamples, pOut);
+    }
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::SanityCheckMacroTiled
+*
+*   @brief
+*       Check if macro-tiled parameters are valid
+*   @return
+*       TRUE if valid
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::SanityCheckMacroTiled(
+    ADDR_TILEINFO* pTileInfo   ///< [in] macro-tiled parameters
+    ) const
+{
+    BOOL_32 valid       = TRUE;
+    MAYBE_UNUSED UINT_32 numPipes = HwlGetPipes(pTileInfo);
+
+    switch (pTileInfo->banks)
+    {
+        case 2: //fall through
+        case 4: //fall through
+        case 8: //fall through
+        case 16:
+            break;
+        default:
+            valid = FALSE;
+            break;
+
+    }
+
+    if (valid)
+    {
+        switch (pTileInfo->bankWidth)
+        {
+            case 1: //fall through
+            case 2: //fall through
+            case 4: //fall through
+            case 8:
+                break;
+            default:
+                valid = FALSE;
+                break;
+        }
+    }
+
+    if (valid)
+    {
+        switch (pTileInfo->bankHeight)
+        {
+            case 1: //fall through
+            case 2: //fall through
+            case 4: //fall through
+            case 8:
+                break;
+            default:
+                valid = FALSE;
+                break;
+        }
+    }
+
+    if (valid)
+    {
+        switch (pTileInfo->macroAspectRatio)
+        {
+            case 1: //fall through
+            case 2: //fall through
+            case 4: //fall through
+            case 8:
+                break;
+            default:
+                valid = FALSE;
+                break;
+        }
+    }
+
+    if (valid)
+    {
+        if (pTileInfo->banks < pTileInfo->macroAspectRatio)
+        {
+            // This will generate macro tile height <= 1
+            valid = FALSE;
+        }
+    }
+
+    if (valid)
+    {
+        if (pTileInfo->tileSplitBytes > m_rowSize)
+        {
+            ADDR_WARN(0, ("tileSplitBytes is bigger than row size"));
+        }
+    }
+
+    if (valid)
+    {
+        valid = HwlSanityCheckMacroTiled(pTileInfo);
+    }
+
+    ADDR_ASSERT(valid == TRUE);
+
+    // Add this assert for guidance
+    ADDR_ASSERT(numPipes * pTileInfo->banks >= 4);
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceMipLevelTileMode
+*
+*   @brief
+*       Compute valid tile mode for surface mipmap sub-levels
+*
+*   @return
+*       Suitable tile mode
+****************************************************************************************************
+*/
+AddrTileMode EgBasedLib::ComputeSurfaceMipLevelTileMode(
+    AddrTileMode        baseTileMode,   ///< [in] base tile mode
+    UINT_32             bpp,            ///< [in] bits per pixels
+    UINT_32             pitch,          ///< [in] current level pitch
+    UINT_32             height,         ///< [in] current level height
+    UINT_32             numSlices,      ///< [in] current number of slices
+    UINT_32             numSamples,     ///< [in] number of samples
+    UINT_32             pitchAlign,     ///< [in] pitch alignment
+    UINT_32             heightAlign,    ///< [in] height alignment
+    ADDR_TILEINFO*      pTileInfo       ///< [in] ptr to bank structure
+    ) const
+{
+    UINT_64 bytesPerSlice;
+    (void)bytesPerSlice;
+    UINT_32 bytesPerTile;
+
+    AddrTileMode expTileMode = baseTileMode;
+    UINT_32 microTileThickness = Thickness(expTileMode);
+    UINT_32 interleaveSize = m_pipeInterleaveBytes * m_bankInterleave;
+
+    //
+    // Compute the size of a slice.
+    //
+    bytesPerSlice = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
+    bytesPerTile = BITS_TO_BYTES(MicroTilePixels * microTileThickness * NextPow2(bpp) * numSamples);
+
+    //
+    // Reduce tiling mode from thick to thin if the number of slices is less than the
+    // micro tile thickness.
+    //
+    if (numSlices < microTileThickness)
+    {
+        expTileMode = HwlDegradeThickTileMode(expTileMode, numSlices, &bytesPerTile);
+    }
+
+    if (bytesPerTile > pTileInfo->tileSplitBytes)
+    {
+        bytesPerTile = pTileInfo->tileSplitBytes;
+    }
+
+    UINT_32 threshold1 =
+        bytesPerTile * HwlGetPipes(pTileInfo) * pTileInfo->bankWidth * pTileInfo->macroAspectRatio;
+
+    UINT_32 threshold2 =
+        bytesPerTile * pTileInfo->bankWidth * pTileInfo->bankHeight;
+
+    //
+    // Reduce the tile mode from 2D/3D to 1D in following conditions
+    //
+    switch (expTileMode)
+    {
+        case ADDR_TM_2D_TILED_THIN1: //fall through
+        case ADDR_TM_3D_TILED_THIN1:
+        case ADDR_TM_PRT_TILED_THIN1:
+        case ADDR_TM_PRT_2D_TILED_THIN1:
+        case ADDR_TM_PRT_3D_TILED_THIN1:
+            if ((pitch < pitchAlign) ||
+                (height < heightAlign) ||
+                (interleaveSize > threshold1) ||
+                (interleaveSize > threshold2))
+            {
+                expTileMode = ADDR_TM_1D_TILED_THIN1;
+            }
+            break;
+        case ADDR_TM_2D_TILED_THICK: //fall through
+        case ADDR_TM_3D_TILED_THICK:
+        case ADDR_TM_2D_TILED_XTHICK:
+        case ADDR_TM_3D_TILED_XTHICK:
+        case ADDR_TM_PRT_TILED_THICK:
+        case ADDR_TM_PRT_2D_TILED_THICK:
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            if ((pitch < pitchAlign) ||
+                (height < heightAlign))
+            {
+                expTileMode = ADDR_TM_1D_TILED_THICK;
+            }
+            break;
+        default:
+            break;
+    }
+
+    return expTileMode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlGetAlignmentInfoMacroTiled
+*   @brief
+*       Get alignment info for giving tile mode
+*   @return
+*       TRUE if getting alignment is OK
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::HwlGetAlignmentInfoMacroTiled(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,             ///< [in] create surface info
+    UINT_32*                               pPitchAlign,     ///< [out] pitch alignment
+    UINT_32*                               pHeightAlign,    ///< [out] height alignment
+    UINT_32*                               pSizeAlign       ///< [out] size alignment
+    ) const
+{
+    BOOL_32 valid = TRUE;
+
+    ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
+
+    UINT_32 numSamples = (pIn->numFrags == 0) ? pIn->numSamples : pIn->numFrags;
+
+    ADDR_ASSERT(pIn->pTileInfo);
+    ADDR_TILEINFO tileInfo = *pIn->pTileInfo;
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT out = {0};
+    out.pTileInfo = &tileInfo;
+
+    if (UseTileIndex(pIn->tileIndex))
+    {
+        out.tileIndex = pIn->tileIndex;
+        out.macroModeIndex = TileIndexInvalid;
+    }
+
+    HwlSetupTileInfo(pIn->tileMode,
+                     pIn->flags,
+                     pIn->bpp,
+                     pIn->width,
+                     pIn->height,
+                     numSamples,
+                     &tileInfo,
+                     &tileInfo,
+                     pIn->tileType,
+                     &out);
+
+    valid = ComputeSurfaceAlignmentsMacroTiled(pIn->tileMode,
+                                               pIn->bpp,
+                                               pIn->flags,
+                                               pIn->mipLevel,
+                                               numSamples,
+                                               &out);
+
+    if (valid)
+    {
+        *pPitchAlign  = out.pitchAlign;
+        *pHeightAlign = out.heightAlign;
+        *pSizeAlign   = out.baseAlign;
+    }
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlDegradeThickTileMode
+*
+*   @brief
+*       Degrades valid tile mode for thick modes if needed
+*
+*   @return
+*       Suitable tile mode
+****************************************************************************************************
+*/
+AddrTileMode EgBasedLib::HwlDegradeThickTileMode(
+    AddrTileMode        baseTileMode,   ///< [in] base tile mode
+    UINT_32             numSlices,      ///< [in] current number of slices
+    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
+    ) const
+{
+    ADDR_ASSERT(numSlices < Thickness(baseTileMode));
+    // if pBytesPerTile is NULL, this is a don't-care....
+    UINT_32 bytesPerTile = pBytesPerTile != NULL ? *pBytesPerTile : 64;
+
+    AddrTileMode expTileMode = baseTileMode;
+    switch (baseTileMode)
+    {
+        case ADDR_TM_1D_TILED_THICK:
+            expTileMode = ADDR_TM_1D_TILED_THIN1;
+            bytesPerTile >>= 2;
+            break;
+        case ADDR_TM_2D_TILED_THICK:
+            expTileMode = ADDR_TM_2D_TILED_THIN1;
+            bytesPerTile >>= 2;
+            break;
+        case ADDR_TM_3D_TILED_THICK:
+            expTileMode = ADDR_TM_3D_TILED_THIN1;
+            bytesPerTile >>= 2;
+            break;
+        case ADDR_TM_2D_TILED_XTHICK:
+            if (numSlices < ThickTileThickness)
+            {
+                expTileMode = ADDR_TM_2D_TILED_THIN1;
+                bytesPerTile >>= 3;
+            }
+            else
+            {
+                expTileMode = ADDR_TM_2D_TILED_THICK;
+                bytesPerTile >>= 1;
+            }
+            break;
+        case ADDR_TM_3D_TILED_XTHICK:
+            if (numSlices < ThickTileThickness)
+            {
+                expTileMode = ADDR_TM_3D_TILED_THIN1;
+                bytesPerTile >>= 3;
+            }
+            else
+            {
+                expTileMode = ADDR_TM_3D_TILED_THICK;
+                bytesPerTile >>= 1;
+            }
+            break;
+        default:
+            ADDR_ASSERT_ALWAYS();
+            break;
+    }
+
+    if (pBytesPerTile != NULL)
+    {
+        *pBytesPerTile = bytesPerTile;
+    }
+
+    return expTileMode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::DispatchComputeSurfaceAddrFromCoord
+*
+*   @brief
+*       Compute surface address from given coord (x, y, slice,sample)
+*
+*   @return
+*       Address in bytes
+****************************************************************************************************
+*/
+UINT_64 EgBasedLib::DispatchComputeSurfaceAddrFromCoord(
+    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    UINT_32             x                  = pIn->x;
+    UINT_32             y                  = pIn->y;
+    UINT_32             slice              = pIn->slice;
+    UINT_32             sample             = pIn->sample;
+    UINT_32             bpp                = pIn->bpp;
+    UINT_32             pitch              = pIn->pitch;
+    UINT_32             height             = pIn->height;
+    UINT_32             numSlices          = pIn->numSlices;
+    UINT_32             numSamples         = ((pIn->numSamples == 0) ? 1 : pIn->numSamples);
+    UINT_32             numFrags           = ((pIn->numFrags == 0) ? numSamples : pIn->numFrags);
+    AddrTileMode        tileMode           = pIn->tileMode;
+    AddrTileType        microTileType      = pIn->tileType;
+    BOOL_32             ignoreSE           = pIn->ignoreSE;
+    BOOL_32             isDepthSampleOrder = pIn->isDepth;
+    ADDR_TILEINFO*      pTileInfo          = pIn->pTileInfo;
+
+    UINT_32*            pBitPosition       = &pOut->bitPosition;
+    UINT_64             addr;
+
+    // ADDR_DEPTH_SAMPLE_ORDER = non-disp + depth-sample-order
+    if (microTileType == ADDR_DEPTH_SAMPLE_ORDER)
+    {
+        isDepthSampleOrder = TRUE;
+    }
+
+    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
+    {
+        if (numFrags != numSamples)
+        {
+            numSamples = numFrags;
+            ADDR_ASSERT(sample < numSamples);
+        }
+
+        /// @note
+        /// 128 bit/thick tiled surface doesn't support display tiling and
+        /// mipmap chain must have the same tileType, so please fill tileType correctly
+        if (IsLinear(pIn->tileMode) == FALSE)
+        {
+            if (bpp >= 128 || Thickness(tileMode) > 1)
+            {
+                ADDR_ASSERT(microTileType != ADDR_DISPLAYABLE);
+            }
+        }
+    }
+
+    switch (tileMode)
+    {
+        case ADDR_TM_LINEAR_GENERAL://fall through
+        case ADDR_TM_LINEAR_ALIGNED:
+            addr = ComputeSurfaceAddrFromCoordLinear(x,
+                                                     y,
+                                                     slice,
+                                                     sample,
+                                                     bpp,
+                                                     pitch,
+                                                     height,
+                                                     numSlices,
+                                                     pBitPosition);
+            break;
+        case ADDR_TM_1D_TILED_THIN1://fall through
+        case ADDR_TM_1D_TILED_THICK:
+            addr = ComputeSurfaceAddrFromCoordMicroTiled(x,
+                                                         y,
+                                                         slice,
+                                                         sample,
+                                                         bpp,
+                                                         pitch,
+                                                         height,
+                                                         numSamples,
+                                                         tileMode,
+                                                         microTileType,
+                                                         isDepthSampleOrder,
+                                                         pBitPosition);
+            break;
+        case ADDR_TM_2D_TILED_THIN1:    //fall through
+        case ADDR_TM_2D_TILED_THICK:    //fall through
+        case ADDR_TM_3D_TILED_THIN1:    //fall through
+        case ADDR_TM_3D_TILED_THICK:    //fall through
+        case ADDR_TM_2D_TILED_XTHICK:   //fall through
+        case ADDR_TM_3D_TILED_XTHICK:   //fall through
+        case ADDR_TM_PRT_TILED_THIN1:   //fall through
+        case ADDR_TM_PRT_2D_TILED_THIN1://fall through
+        case ADDR_TM_PRT_3D_TILED_THIN1://fall through
+        case ADDR_TM_PRT_TILED_THICK:   //fall through
+        case ADDR_TM_PRT_2D_TILED_THICK://fall through
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            UINT_32 pipeSwizzle;
+            UINT_32 bankSwizzle;
+
+            if (m_configFlags.useCombinedSwizzle)
+            {
+                ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
+                                       &bankSwizzle, &pipeSwizzle);
+            }
+            else
+            {
+                pipeSwizzle = pIn->pipeSwizzle;
+                bankSwizzle = pIn->bankSwizzle;
+            }
+
+            addr = ComputeSurfaceAddrFromCoordMacroTiled(x,
+                                                         y,
+                                                         slice,
+                                                         sample,
+                                                         bpp,
+                                                         pitch,
+                                                         height,
+                                                         numSamples,
+                                                         tileMode,
+                                                         microTileType,
+                                                         ignoreSE,
+                                                         isDepthSampleOrder,
+                                                         pipeSwizzle,
+                                                         bankSwizzle,
+                                                         pTileInfo,
+                                                         pBitPosition);
+            break;
+        default:
+            addr = 0;
+            ADDR_ASSERT_ALWAYS();
+            break;
+    }
+
+    return addr;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeMacroTileEquation
+*
+*   @brief
+*       Computes the address equation in macro tile
+*   @return
+*       If equation can be computed
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::ComputeMacroTileEquation(
+    UINT_32             log2BytesPP,            ///< [in] log2 of bytes per pixel
+    AddrTileMode        tileMode,               ///< [in] tile mode
+    AddrTileType        microTileType,          ///< [in] micro tiling type
+    ADDR_TILEINFO*      pTileInfo,              ///< [in] bank structure
+    ADDR_EQUATION*      pEquation               ///< [out] Equation for addressing in macro tile
+    ) const
+{
+    ADDR_E_RETURNCODE retCode;
+
+    // Element equation within a tile
+    retCode = ComputeMicroTileEquation(log2BytesPP, tileMode, microTileType, pEquation);
+
+    if (retCode == ADDR_OK)
+    {
+        // Tile equesiton with signle pipe bank
+        UINT_32 numPipes              = HwlGetPipes(pTileInfo);
+        UINT_32 numPipeBits           = Log2(numPipes);
+
+        for (UINT_32 i = 0; i < Log2(pTileInfo->bankWidth); i++)
+        {
+            pEquation->addr[pEquation->numBits].valid = 1;
+            pEquation->addr[pEquation->numBits].channel = 0;
+            pEquation->addr[pEquation->numBits].index = i + log2BytesPP + 3 + numPipeBits;
+            pEquation->numBits++;
+        }
+
+        for (UINT_32 i = 0; i < Log2(pTileInfo->bankHeight); i++)
+        {
+            pEquation->addr[pEquation->numBits].valid = 1;
+            pEquation->addr[pEquation->numBits].channel = 1;
+            pEquation->addr[pEquation->numBits].index = i + 3;
+            pEquation->numBits++;
+        }
+
+        ADDR_EQUATION equation;
+        memset(&equation, 0, sizeof(ADDR_EQUATION));
+
+        UINT_32 thresholdX = 32;
+        UINT_32 thresholdY = 32;
+
+        if (IsPrtNoRotationTileMode(tileMode))
+        {
+            UINT_32 macroTilePitch  =
+                (MicroTileWidth  * pTileInfo->bankWidth  * numPipes) * pTileInfo->macroAspectRatio;
+            UINT_32 macroTileHeight =
+                (MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks) /
+                pTileInfo->macroAspectRatio;
+            thresholdX = Log2(macroTilePitch);
+            thresholdY = Log2(macroTileHeight);
+        }
+
+        // Pipe equation
+        retCode = ComputePipeEquation(log2BytesPP, thresholdX, thresholdY, pTileInfo, &equation);
+
+        if (retCode == ADDR_OK)
+        {
+            UINT_32 pipeBitStart = Log2(m_pipeInterleaveBytes);
+
+            if (pEquation->numBits > pipeBitStart)
+            {
+                UINT_32 numLeftShift = pEquation->numBits - pipeBitStart;
+
+                for (UINT_32 i = 0; i < numLeftShift; i++)
+                {
+                    pEquation->addr[pEquation->numBits + equation.numBits - i - 1] =
+                        pEquation->addr[pEquation->numBits - i - 1];
+                    pEquation->xor1[pEquation->numBits + equation.numBits - i - 1] =
+                        pEquation->xor1[pEquation->numBits - i - 1];
+                    pEquation->xor2[pEquation->numBits + equation.numBits - i - 1] =
+                        pEquation->xor2[pEquation->numBits - i - 1];
+                }
+            }
+
+            for (UINT_32 i = 0; i < equation.numBits; i++)
+            {
+                pEquation->addr[pipeBitStart + i] = equation.addr[i];
+                pEquation->xor1[pipeBitStart + i] = equation.xor1[i];
+                pEquation->xor2[pipeBitStart + i] = equation.xor2[i];
+                pEquation->numBits++;
+            }
+
+            // Bank equation
+            memset(&equation, 0, sizeof(ADDR_EQUATION));
+
+            retCode = ComputeBankEquation(log2BytesPP, thresholdX, thresholdY,
+                                          pTileInfo, &equation);
+
+            if (retCode == ADDR_OK)
+            {
+                UINT_32 bankBitStart = pipeBitStart + numPipeBits + Log2(m_bankInterleave);
+
+                if (pEquation->numBits > bankBitStart)
+                {
+                    UINT_32 numLeftShift = pEquation->numBits - bankBitStart;
+
+                    for (UINT_32 i = 0; i < numLeftShift; i++)
+                    {
+                        pEquation->addr[pEquation->numBits + equation.numBits - i - 1] =
+                            pEquation->addr[pEquation->numBits - i - 1];
+                        pEquation->xor1[pEquation->numBits + equation.numBits - i - 1] =
+                            pEquation->xor1[pEquation->numBits - i - 1];
+                        pEquation->xor2[pEquation->numBits + equation.numBits - i - 1] =
+                            pEquation->xor2[pEquation->numBits - i - 1];
+                    }
+                }
+
+                for (UINT_32 i = 0; i < equation.numBits; i++)
+                {
+                    pEquation->addr[bankBitStart + i] = equation.addr[i];
+                    pEquation->xor1[bankBitStart + i] = equation.xor1[i];
+                    pEquation->xor2[bankBitStart + i] = equation.xor2[i];
+                    pEquation->numBits++;
+                }
+            }
+        }
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
+*
+*   @brief
+*       Computes the surface address and bit position from a
+*       coordinate for 2D tilied (macro tiled)
+*   @return
+*       The byte address
+****************************************************************************************************
+*/
+UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMacroTiled(
+    UINT_32             x,                      ///< [in] x coordinate
+    UINT_32             y,                      ///< [in] y coordinate
+    UINT_32             slice,                  ///< [in] slice index
+    UINT_32             sample,                 ///< [in] sample index
+    UINT_32             bpp,                    ///< [in] bits per pixel
+    UINT_32             pitch,                  ///< [in] surface pitch, in pixels
+    UINT_32             height,                 ///< [in] surface height, in pixels
+    UINT_32             numSamples,             ///< [in] number of samples
+    AddrTileMode        tileMode,               ///< [in] tile mode
+    AddrTileType        microTileType,          ///< [in] micro tiling type
+    BOOL_32             ignoreSE,               ///< [in] TRUE if shader enginers can be ignored
+    BOOL_32             isDepthSampleOrder,     ///< [in] TRUE if it depth sample ordering is used
+    UINT_32             pipeSwizzle,            ///< [in] pipe swizzle
+    UINT_32             bankSwizzle,            ///< [in] bank swizzle
+    ADDR_TILEINFO*      pTileInfo,              ///< [in] bank structure
+                                                ///  **All fields to be valid on entry**
+    UINT_32*            pBitPosition            ///< [out] bit position, e.g. FMT_1 will use this
+    ) const
+{
+    UINT_64 addr;
+
+    UINT_32 microTileBytes;
+    UINT_32 microTileBits;
+    UINT_32 sampleOffset;
+    UINT_32 pixelIndex;
+    UINT_32 pixelOffset;
+    UINT_32 elementOffset;
+    UINT_32 tileSplitSlice;
+    UINT_32 pipe;
+    UINT_32 bank;
+    UINT_64 sliceBytes;
+    UINT_64 sliceOffset;
+    UINT_32 macroTilePitch;
+    UINT_32 macroTileHeight;
+    UINT_32 macroTilesPerRow;
+    UINT_32 macroTilesPerSlice;
+    UINT_64 macroTileBytes;
+    UINT_32 macroTileIndexX;
+    UINT_32 macroTileIndexY;
+    UINT_64 macroTileOffset;
+    UINT_64 totalOffset;
+    UINT_64 pipeInterleaveMask;
+    UINT_64 bankInterleaveMask;
+    UINT_64 pipeInterleaveOffset;
+    UINT_32 bankInterleaveOffset;
+    UINT_64 offset;
+    UINT_32 tileRowIndex;
+    UINT_32 tileColumnIndex;
+    UINT_32 tileIndex;
+    UINT_32 tileOffset;
+
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    //
+    // Compute the number of group, pipe, and bank bits.
+    //
+    UINT_32 numPipes              = HwlGetPipes(pTileInfo);
+    UINT_32 numPipeInterleaveBits = Log2(m_pipeInterleaveBytes);
+    UINT_32 numPipeBits           = Log2(numPipes);
+    UINT_32 numBankInterleaveBits = Log2(m_bankInterleave);
+    UINT_32 numBankBits           = Log2(pTileInfo->banks);
+
+    //
+    // Compute the micro tile size.
+    //
+    microTileBits = MicroTilePixels * microTileThickness * bpp * numSamples;
+
+    microTileBytes = microTileBits / 8;
+    //
+    // Compute the pixel index within the micro tile.
+    //
+    pixelIndex = ComputePixelIndexWithinMicroTile(x,
+                                                  y,
+                                                  slice,
+                                                  bpp,
+                                                  tileMode,
+                                                  microTileType);
+
+    //
+    // Compute the sample offset and pixel offset.
+    //
+    if (isDepthSampleOrder)
+    {
+        //
+        // For depth surfaces, samples are stored contiguously for each element, so the sample
+        // offset is the sample number times the element size.
+        //
+        sampleOffset = sample * bpp;
+        pixelOffset  = pixelIndex * bpp * numSamples;
+    }
+    else
+    {
+        //
+        // For color surfaces, all elements for a particular sample are stored contiguously, so
+        // the sample offset is the sample number times the micro tile size divided yBit the number
+        // of samples.
+        //
+        sampleOffset = sample * (microTileBits / numSamples);
+        pixelOffset  = pixelIndex * bpp;
+    }
+
+    //
+    // Compute the element offset.
+    //
+    elementOffset = pixelOffset + sampleOffset;
+
+    *pBitPosition = static_cast<UINT_32>(elementOffset % 8);
+
+    elementOffset /= 8; //bit-to-byte
+
+    //
+    // Determine if tiles need to be split across slices.
+    //
+    // If the size of the micro tile is larger than the tile split size, then the tile will be
+    // split across multiple slices.
+    //
+    UINT_32 slicesPerTile = 1;
+
+    if ((microTileBytes > pTileInfo->tileSplitBytes) && (microTileThickness == 1))
+    {   //don't support for thick mode
+
+        //
+        // Compute the number of slices per tile.
+        //
+        slicesPerTile = microTileBytes / pTileInfo->tileSplitBytes;
+
+        //
+        // Compute the tile split slice number for use in rotating the bank.
+        //
+        tileSplitSlice = elementOffset / pTileInfo->tileSplitBytes;
+
+        //
+        // Adjust the element offset to account for the portion of the tile that is being moved to
+        // a new slice..
+        //
+        elementOffset %= pTileInfo->tileSplitBytes;
+
+        //
+        // Adjust the microTileBytes size to tileSplitBytes size since
+        // a new slice..
+        //
+        microTileBytes = pTileInfo->tileSplitBytes;
+    }
+    else
+    {
+        tileSplitSlice = 0;
+    }
+
+    //
+    // Compute macro tile pitch and height.
+    //
+    macroTilePitch  =
+        (MicroTileWidth  * pTileInfo->bankWidth  * numPipes) * pTileInfo->macroAspectRatio;
+    macroTileHeight =
+        (MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks) / pTileInfo->macroAspectRatio;
+
+    //
+    // Compute the number of bytes per macro tile. Note: bytes of the same bank/pipe actually
+    //
+    macroTileBytes =
+        static_cast<UINT_64>(microTileBytes) *
+        (macroTilePitch / MicroTileWidth) * (macroTileHeight / MicroTileHeight) /
+        (numPipes * pTileInfo->banks);
+
+    //
+    // Compute the number of macro tiles per row.
+    //
+    macroTilesPerRow = pitch / macroTilePitch;
+
+    //
+    // Compute the offset to the macro tile containing the specified coordinate.
+    //
+    macroTileIndexX = x / macroTilePitch;
+    macroTileIndexY = y / macroTileHeight;
+    macroTileOffset = ((macroTileIndexY * macroTilesPerRow) + macroTileIndexX) * macroTileBytes;
+
+    //
+    // Compute the number of macro tiles per slice.
+    //
+    macroTilesPerSlice = macroTilesPerRow  * (height / macroTileHeight);
+
+    //
+    // Compute the slice size.
+    //
+    sliceBytes = macroTilesPerSlice * macroTileBytes;
+
+    //
+    // Compute the slice offset.
+    //
+    sliceOffset = sliceBytes * (tileSplitSlice + slicesPerTile * (slice / microTileThickness));
+
+    //
+    // Compute tile offest
+    //
+    tileRowIndex    = (y / MicroTileHeight) % pTileInfo->bankHeight;
+    tileColumnIndex = ((x / MicroTileWidth) / numPipes) % pTileInfo->bankWidth;
+    tileIndex        = (tileRowIndex * pTileInfo->bankWidth) + tileColumnIndex;
+    tileOffset       = tileIndex * microTileBytes;
+
+    //
+    // Combine the slice offset and macro tile offset with the pixel and sample offsets, accounting
+    // for the pipe and bank bits in the middle of the address.
+    //
+    totalOffset = sliceOffset + macroTileOffset + elementOffset + tileOffset;
+
+    //
+    // Get the pipe and bank.
+    //
+
+    // when the tileMode is PRT type, then adjust x and y coordinates
+    if (IsPrtNoRotationTileMode(tileMode))
+    {
+        x = x % macroTilePitch;
+        y = y % macroTileHeight;
+    }
+
+    pipe = ComputePipeFromCoord(x,
+                                y,
+                                slice,
+                                tileMode,
+                                pipeSwizzle,
+                                ignoreSE,
+                                pTileInfo);
+
+    bank = ComputeBankFromCoord(x,
+                                y,
+                                slice,
+                                tileMode,
+                                bankSwizzle,
+                                tileSplitSlice,
+                                pTileInfo);
+
+    //
+    // Split the offset to put some bits below the pipe+bank bits and some above.
+    //
+    pipeInterleaveMask = (1 << numPipeInterleaveBits) - 1;
+    bankInterleaveMask = (1 << numBankInterleaveBits) - 1;
+    pipeInterleaveOffset = totalOffset & pipeInterleaveMask;
+    bankInterleaveOffset = static_cast<UINT_32>((totalOffset >> numPipeInterleaveBits) &
+                                                bankInterleaveMask);
+    offset               =  totalOffset >> (numPipeInterleaveBits + numBankInterleaveBits);
+
+    //
+    // Assemble the address from its components.
+    //
+    addr  = pipeInterleaveOffset;
+    // This is to remove /analyze warnings
+    UINT_32 pipeBits            = pipe                 <<  numPipeInterleaveBits;
+    UINT_32 bankInterleaveBits  = bankInterleaveOffset << (numPipeInterleaveBits + numPipeBits);
+    UINT_32 bankBits            = bank                 << (numPipeInterleaveBits + numPipeBits +
+                                                           numBankInterleaveBits);
+    UINT_64 offsetBits          = offset               << (numPipeInterleaveBits + numPipeBits +
+                                                           numBankInterleaveBits + numBankBits);
+
+    addr |= pipeBits;
+    addr |= bankInterleaveBits;
+    addr |= bankBits;
+    addr |= offsetBits;
+
+    return addr;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
+*
+*   @brief
+*       Computes the surface address and bit position from a coordinate for 1D tilied
+*       (micro tiled)
+*   @return
+*       The byte address
+****************************************************************************************************
+*/
+UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled(
+    UINT_32             x,                      ///< [in] x coordinate
+    UINT_32             y,                      ///< [in] y coordinate
+    UINT_32             slice,                  ///< [in] slice index
+    UINT_32             sample,                 ///< [in] sample index
+    UINT_32             bpp,                    ///< [in] bits per pixel
+    UINT_32             pitch,                  ///< [in] pitch, in pixels
+    UINT_32             height,                 ///< [in] height, in pixels
+    UINT_32             numSamples,             ///< [in] number of samples
+    AddrTileMode        tileMode,               ///< [in] tile mode
+    AddrTileType        microTileType,          ///< [in] micro tiling type
+    BOOL_32             isDepthSampleOrder,     ///< [in] TRUE if depth sample ordering is used
+    UINT_32*            pBitPosition            ///< [out] bit position, e.g. FMT_1 will use this
+    ) const
+{
+    UINT_64 addr = 0;
+
+    UINT_32 microTileBytes;
+    UINT_64 sliceBytes;
+    UINT_32 microTilesPerRow;
+    UINT_32 microTileIndexX;
+    UINT_32 microTileIndexY;
+    UINT_32 microTileIndexZ;
+    UINT_64 sliceOffset;
+    UINT_64 microTileOffset;
+    UINT_32 sampleOffset;
+    UINT_32 pixelIndex;
+    UINT_32 pixelOffset;
+
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    //
+    // Compute the micro tile size.
+    //
+    microTileBytes = BITS_TO_BYTES(MicroTilePixels * microTileThickness * bpp * numSamples);
+
+    //
+    // Compute the slice size.
+    //
+    sliceBytes =
+        BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * microTileThickness * bpp * numSamples);
+
+    //
+    // Compute the number of micro tiles per row.
+    //
+    microTilesPerRow = pitch / MicroTileWidth;
+
+    //
+    // Compute the micro tile index.
+    //
+    microTileIndexX = x     / MicroTileWidth;
+    microTileIndexY = y     / MicroTileHeight;
+    microTileIndexZ = slice / microTileThickness;
+
+    //
+    // Compute the slice offset.
+    //
+    sliceOffset = static_cast<UINT_64>(microTileIndexZ) * sliceBytes;
+
+    //
+    // Compute the offset to the micro tile containing the specified coordinate.
+    //
+    microTileOffset = (static_cast<UINT_64>(microTileIndexY) * microTilesPerRow + microTileIndexX) *
+        microTileBytes;
+
+    //
+    // Compute the pixel index within the micro tile.
+    //
+    pixelIndex = ComputePixelIndexWithinMicroTile(x,
+                                                  y,
+                                                  slice,
+                                                  bpp,
+                                                  tileMode,
+                                                  microTileType);
+
+    // Compute the sample offset.
+    //
+    if (isDepthSampleOrder)
+    {
+        //
+        // For depth surfaces, samples are stored contiguously for each element, so the sample
+        // offset is the sample number times the element size.
+        //
+        sampleOffset = sample * bpp;
+        pixelOffset = pixelIndex * bpp * numSamples;
+    }
+    else
+    {
+        //
+        // For color surfaces, all elements for a particular sample are stored contiguously, so
+        // the sample offset is the sample number times the micro tile size divided yBit the number
+        // of samples.
+        //
+        sampleOffset = sample * (microTileBytes*8 / numSamples);
+        pixelOffset = pixelIndex * bpp;
+    }
+
+    //
+    // Compute the bit position of the pixel.  Each element is stored with one bit per sample.
+    //
+
+    UINT_32 elemOffset = sampleOffset + pixelOffset;
+
+    *pBitPosition = elemOffset % 8;
+    elemOffset /= 8;
+
+    //
+    // Combine the slice offset, micro tile offset, sample offset, and pixel offsets.
+    //
+    addr = sliceOffset + microTileOffset + elemOffset;
+
+    return addr;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputePixelCoordFromOffset
+*
+*   @brief
+*       Compute pixel coordinate from offset inside a micro tile
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID EgBasedLib::HwlComputePixelCoordFromOffset(
+    UINT_32         offset,             ///< [in] offset inside micro tile in bits
+    UINT_32         bpp,                ///< [in] bits per pixel
+    UINT_32         numSamples,         ///< [in] number of samples
+    AddrTileMode    tileMode,           ///< [in] tile mode
+    UINT_32         tileBase,           ///< [in] base offset within a tile
+    UINT_32         compBits,           ///< [in] component bits actually needed(for planar surface)
+    UINT_32*        pX,                 ///< [out] x coordinate
+    UINT_32*        pY,                 ///< [out] y coordinate
+    UINT_32*        pSlice,             ///< [out] slice index
+    UINT_32*        pSample,            ///< [out] sample index
+    AddrTileType    microTileType,      ///< [in] micro tiling type
+    BOOL_32         isDepthSampleOrder  ///< [in] TRUE if depth sample order in microtile is used
+    ) const
+{
+    UINT_32 x = 0;
+    UINT_32 y = 0;
+    UINT_32 z = 0;
+    UINT_32 thickness = Thickness(tileMode);
+
+    // For planar surface, we adjust offset acoording to tile base
+    if ((bpp != compBits) && (compBits != 0) && isDepthSampleOrder)
+    {
+        offset -= tileBase;
+
+        ADDR_ASSERT(microTileType == ADDR_NON_DISPLAYABLE ||
+                    microTileType == ADDR_DEPTH_SAMPLE_ORDER);
+
+        bpp = compBits;
+    }
+
+    UINT_32 sampleTileBits;
+    UINT_32 samplePixelBits;
+    UINT_32 pixelIndex;
+
+    if (isDepthSampleOrder)
+    {
+        samplePixelBits = bpp * numSamples;
+        pixelIndex = offset / samplePixelBits;
+        *pSample = (offset % samplePixelBits) / bpp;
+    }
+    else
+    {
+        sampleTileBits = MicroTilePixels * bpp * thickness;
+        *pSample = offset / sampleTileBits;
+        pixelIndex = (offset % sampleTileBits) / bpp;
+    }
+
+    if (microTileType != ADDR_THICK)
+    {
+        if (microTileType == ADDR_DISPLAYABLE) // displayable
+        {
+            switch (bpp)
+            {
+                case 8:
+                    x = pixelIndex & 0x7;
+                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,3),_BIT(pixelIndex,4));
+                    break;
+                case 16:
+                    x = pixelIndex & 0x7;
+                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,3));
+                    break;
+                case 32:
+                    x = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,1),_BIT(pixelIndex,0));
+                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,2));
+                    break;
+                case 64:
+                    x = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
+                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,1));
+                    break;
+                case 128:
+                    x = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,2),_BIT(pixelIndex,1));
+                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,0));
+                    break;
+                default:
+                    break;
+            }
+        }
+        else if (microTileType == ADDR_NON_DISPLAYABLE || microTileType == ADDR_DEPTH_SAMPLE_ORDER)
+        {
+            x = Bits2Number(3, _BIT(pixelIndex,4),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
+            y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,3),_BIT(pixelIndex,1));
+        }
+        else if (microTileType == ADDR_ROTATED)
+        {
+            /*
+                8-Bit Elements
+                element_index[5:0] = { x[2], x[0], x[1], y[2], y[1], y[0] }
+
+                16-Bit Elements
+                element_index[5:0] = { x[2], x[1], x[0], y[2], y[1], y[0] }
+
+                32-Bit Elements
+                element_index[5:0] = { x[2], x[1], y[2], x[0], y[1], y[0] }
+
+                64-Bit Elements
+                element_index[5:0] = { y[2], x[2], x[1], y[1], x[0], y[0] }
+            */
+            switch(bpp)
+            {
+                case 8:
+                    x = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,3),_BIT(pixelIndex,4));
+                    y = pixelIndex & 0x7;
+                    break;
+                case 16:
+                    x = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,3));
+                    y = pixelIndex & 0x7;
+                    break;
+                case 32:
+                    x = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,4),_BIT(pixelIndex,2));
+                    y = Bits2Number(3, _BIT(pixelIndex,3),_BIT(pixelIndex,1),_BIT(pixelIndex,0));
+                    break;
+                case 64:
+                    x = Bits2Number(3, _BIT(pixelIndex,4),_BIT(pixelIndex,3),_BIT(pixelIndex,1));
+                    y = Bits2Number(3, _BIT(pixelIndex,5),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    break;
+            }
+        }
+
+        if (thickness > 1) // thick
+        {
+            z = Bits2Number(3, _BIT(pixelIndex,8),_BIT(pixelIndex,7),_BIT(pixelIndex,6));
+        }
+    }
+    else
+    {
+        ADDR_ASSERT((m_chipFamily >= ADDR_CHIP_FAMILY_CI) && (thickness > 1));
+        /*
+            8-Bit Elements and 16-Bit Elements
+            element_index[7:0] = { y[2], x[2], z[1], z[0], y[1], x[1], y[0], x[0] }
+
+            32-Bit Elements
+            element_index[7:0] = { y[2], x[2], z[1], y[1], z[0], x[1], y[0], x[0] }
+
+            64-Bit Elements and 128-Bit Elements
+            element_index[7:0] = { y[2], x[2], z[1], y[1], x[1], z[0], y[0], x[0] }
+
+            The equation to compute the element index for the extra thick tile:
+            element_index[8] = z[2]
+        */
+        switch (bpp)
+        {
+            case 8:
+            case 16: // fall-through
+                x = Bits2Number(3, _BIT(pixelIndex,6),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
+                y = Bits2Number(3, _BIT(pixelIndex,7),_BIT(pixelIndex,3),_BIT(pixelIndex,1));
+                z = Bits2Number(2, _BIT(pixelIndex,5),_BIT(pixelIndex,4));
+                break;
+            case 32:
+                x = Bits2Number(3, _BIT(pixelIndex,6),_BIT(pixelIndex,2),_BIT(pixelIndex,0));
+                y = Bits2Number(3, _BIT(pixelIndex,7),_BIT(pixelIndex,4),_BIT(pixelIndex,1));
+                z = Bits2Number(2, _BIT(pixelIndex,5),_BIT(pixelIndex,3));
+                break;
+            case 64:
+            case 128: // fall-through
+                x = Bits2Number(3, _BIT(pixelIndex,6),_BIT(pixelIndex,3),_BIT(pixelIndex,0));
+                y = Bits2Number(3, _BIT(pixelIndex,7),_BIT(pixelIndex,4),_BIT(pixelIndex,1));
+                z = Bits2Number(2, _BIT(pixelIndex,5),_BIT(pixelIndex,2));
+                break;
+            default:
+                ADDR_ASSERT_ALWAYS();
+                break;
+        }
+
+        if (thickness == 8)
+        {
+            z += Bits2Number(3,_BIT(pixelIndex,8),0,0);
+        }
+    }
+
+    *pX = x;
+    *pY = y;
+    *pSlice += z;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::DispatchComputeSurfaceCoordFromAddrDispatch
+*
+*   @brief
+*       Compute (x,y,slice,sample) coordinates from surface address
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID EgBasedLib::DispatchComputeSurfaceCoordFromAddr(
+    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    UINT_64             addr               = pIn->addr;
+    UINT_32             bitPosition        = pIn->bitPosition;
+    UINT_32             bpp                = pIn->bpp;
+    UINT_32             pitch              = pIn->pitch;
+    UINT_32             height             = pIn->height;
+    UINT_32             numSlices          = pIn->numSlices;
+    UINT_32             numSamples         = ((pIn->numSamples == 0) ? 1 : pIn->numSamples);
+    UINT_32             numFrags           = ((pIn->numFrags == 0) ? numSamples : pIn->numFrags);
+    AddrTileMode        tileMode           = pIn->tileMode;
+    UINT_32             tileBase           = pIn->tileBase;
+    UINT_32             compBits           = pIn->compBits;
+    AddrTileType        microTileType      = pIn->tileType;
+    BOOL_32             ignoreSE           = pIn->ignoreSE;
+    BOOL_32             isDepthSampleOrder = pIn->isDepth;
+    ADDR_TILEINFO*      pTileInfo          = pIn->pTileInfo;
+
+    UINT_32*            pX                 = &pOut->x;
+    UINT_32*            pY                 = &pOut->y;
+    UINT_32*            pSlice             = &pOut->slice;
+    UINT_32*            pSample            = &pOut->sample;
+
+    if (microTileType == ADDR_DEPTH_SAMPLE_ORDER)
+    {
+        isDepthSampleOrder = TRUE;
+    }
+
+    if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
+    {
+        if (numFrags != numSamples)
+        {
+            numSamples = numFrags;
+        }
+
+        /// @note
+        /// 128 bit/thick tiled surface doesn't support display tiling and
+        /// mipmap chain must have the same tileType, so please fill tileType correctly
+        if (IsLinear(pIn->tileMode) == FALSE)
+        {
+            if (bpp >= 128 || Thickness(tileMode) > 1)
+            {
+                ADDR_ASSERT(microTileType != ADDR_DISPLAYABLE);
+            }
+        }
+    }
+
+    switch (tileMode)
+    {
+        case ADDR_TM_LINEAR_GENERAL://fall through
+        case ADDR_TM_LINEAR_ALIGNED:
+            ComputeSurfaceCoordFromAddrLinear(addr,
+                                              bitPosition,
+                                              bpp,
+                                              pitch,
+                                              height,
+                                              numSlices,
+                                              pX,
+                                              pY,
+                                              pSlice,
+                                              pSample);
+            break;
+        case ADDR_TM_1D_TILED_THIN1://fall through
+        case ADDR_TM_1D_TILED_THICK:
+            ComputeSurfaceCoordFromAddrMicroTiled(addr,
+                                                  bitPosition,
+                                                  bpp,
+                                                  pitch,
+                                                  height,
+                                                  numSamples,
+                                                  tileMode,
+                                                  tileBase,
+                                                  compBits,
+                                                  pX,
+                                                  pY,
+                                                  pSlice,
+                                                  pSample,
+                                                  microTileType,
+                                                  isDepthSampleOrder);
+            break;
+        case ADDR_TM_2D_TILED_THIN1:    //fall through
+        case ADDR_TM_2D_TILED_THICK:    //fall through
+        case ADDR_TM_3D_TILED_THIN1:    //fall through
+        case ADDR_TM_3D_TILED_THICK:    //fall through
+        case ADDR_TM_2D_TILED_XTHICK:   //fall through
+        case ADDR_TM_3D_TILED_XTHICK:   //fall through
+        case ADDR_TM_PRT_TILED_THIN1:   //fall through
+        case ADDR_TM_PRT_2D_TILED_THIN1://fall through
+        case ADDR_TM_PRT_3D_TILED_THIN1://fall through
+        case ADDR_TM_PRT_TILED_THICK:   //fall through
+        case ADDR_TM_PRT_2D_TILED_THICK://fall through
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            UINT_32 pipeSwizzle;
+            UINT_32 bankSwizzle;
+
+            if (m_configFlags.useCombinedSwizzle)
+            {
+                ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
+                                       &bankSwizzle, &pipeSwizzle);
+            }
+            else
+            {
+                pipeSwizzle = pIn->pipeSwizzle;
+                bankSwizzle = pIn->bankSwizzle;
+            }
+
+            ComputeSurfaceCoordFromAddrMacroTiled(addr,
+                                                  bitPosition,
+                                                  bpp,
+                                                  pitch,
+                                                  height,
+                                                  numSamples,
+                                                  tileMode,
+                                                  tileBase,
+                                                  compBits,
+                                                  microTileType,
+                                                  ignoreSE,
+                                                  isDepthSampleOrder,
+                                                  pipeSwizzle,
+                                                  bankSwizzle,
+                                                  pTileInfo,
+                                                  pX,
+                                                  pY,
+                                                  pSlice,
+                                                  pSample);
+            break;
+        default:
+            ADDR_ASSERT_ALWAYS();
+    }
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled
+*
+*   @brief
+*       Compute surface coordinates from address for macro tiled surface
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled(
+    UINT_64             addr,               ///< [in] byte address
+    UINT_32             bitPosition,        ///< [in] bit position
+    UINT_32             bpp,                ///< [in] bits per pixel
+    UINT_32             pitch,              ///< [in] pitch in pixels
+    UINT_32             height,             ///< [in] height in pixels
+    UINT_32             numSamples,         ///< [in] number of samples
+    AddrTileMode        tileMode,           ///< [in] tile mode
+    UINT_32             tileBase,           ///< [in] tile base offset
+    UINT_32             compBits,           ///< [in] component bits (for planar surface)
+    AddrTileType        microTileType,      ///< [in] micro tiling type
+    BOOL_32             ignoreSE,           ///< [in] TRUE if shader engines can be ignored
+    BOOL_32             isDepthSampleOrder, ///< [in] TRUE if depth sample order is used
+    UINT_32             pipeSwizzle,        ///< [in] pipe swizzle
+    UINT_32             bankSwizzle,        ///< [in] bank swizzle
+    ADDR_TILEINFO*      pTileInfo,          ///< [in] bank structure.
+                                            ///  **All fields to be valid on entry**
+    UINT_32*            pX,                 ///< [out] X coord
+    UINT_32*            pY,                 ///< [out] Y coord
+    UINT_32*            pSlice,             ///< [out] slice index
+    UINT_32*            pSample             ///< [out] sample index
+    ) const
+{
+    UINT_32 mx;
+    UINT_32 my;
+    UINT_64 tileBits;
+    UINT_64 macroTileBits;
+    UINT_32 slices;
+    UINT_32 tileSlices;
+    UINT_64 elementOffset;
+    UINT_64 macroTileIndex;
+    UINT_32 tileIndex;
+    UINT_64 totalOffset;
+
+    UINT_32 bank;
+    UINT_32 pipe;
+    UINT_32 groupBits = m_pipeInterleaveBytes << 3;
+    UINT_32 pipes = HwlGetPipes(pTileInfo);
+    UINT_32 banks = pTileInfo->banks;
+
+    UINT_32 bankInterleave = m_bankInterleave;
+
+    UINT_64 addrBits = BYTES_TO_BITS(addr) + bitPosition;
+
+    //
+    // remove bits for bank and pipe
+    //
+    totalOffset = (addrBits % groupBits) +
+        (((addrBits / groupBits / pipes) % bankInterleave) * groupBits) +
+        (((addrBits / groupBits / pipes) / bankInterleave) / banks) * groupBits * bankInterleave;
+
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    UINT_32 microTileBits = bpp * microTileThickness * MicroTilePixels * numSamples;
+
+    UINT_32 microTileBytes = BITS_TO_BYTES(microTileBits);
+    //
+    // Determine if tiles need to be split across slices.
+    //
+    // If the size of the micro tile is larger than the tile split size, then the tile will be
+    // split across multiple slices.
+    //
+    UINT_32 slicesPerTile = 1; //_State->TileSlices
+
+    if ((microTileBytes > pTileInfo->tileSplitBytes) && (microTileThickness == 1))
+    {   //don't support for thick mode
+
+        //
+        // Compute the number of slices per tile.
+        //
+        slicesPerTile = microTileBytes / pTileInfo->tileSplitBytes;
+    }
+
+    tileBits = microTileBits / slicesPerTile; // micro tile bits
+
+    // in micro tiles because not MicroTileWidth timed.
+    UINT_32 macroWidth  = pTileInfo->bankWidth * pipes * pTileInfo->macroAspectRatio;
+    // in micro tiles as well
+    UINT_32 macroHeight = pTileInfo->bankHeight * banks / pTileInfo->macroAspectRatio;
+
+    UINT_32 pitchInMacroTiles = pitch / MicroTileWidth / macroWidth;
+
+    macroTileBits = (macroWidth * macroHeight) * tileBits / (banks * pipes);
+
+    macroTileIndex = totalOffset / macroTileBits;
+
+    // pitchMacros * height / heightMacros;  macroTilesPerSlice == _State->SliceMacros
+    UINT_32 macroTilesPerSlice = (pitch / (macroWidth * MicroTileWidth)) * height /
+        (macroHeight * MicroTileWidth);
+
+    slices = static_cast<UINT_32>(macroTileIndex / macroTilesPerSlice);
+
+    *pSlice = static_cast<UINT_32>(slices / slicesPerTile * microTileThickness);
+
+    //
+    // calculate element offset and x[2:0], y[2:0], z[1:0] for thick
+    //
+    tileSlices = slices % slicesPerTile;
+
+    elementOffset  = tileSlices * tileBits;
+    elementOffset += totalOffset % tileBits;
+
+    UINT_32 coordZ = 0;
+
+    HwlComputePixelCoordFromOffset(static_cast<UINT_32>(elementOffset),
+                                   bpp,
+                                   numSamples,
+                                   tileMode,
+                                   tileBase,
+                                   compBits,
+                                   pX,
+                                   pY,
+                                   &coordZ,
+                                   pSample,
+                                   microTileType,
+                                   isDepthSampleOrder);
+
+    macroTileIndex = macroTileIndex % macroTilesPerSlice;
+    *pY += static_cast<UINT_32>(macroTileIndex / pitchInMacroTiles * macroHeight * MicroTileHeight);
+    *pX += static_cast<UINT_32>(macroTileIndex % pitchInMacroTiles * macroWidth * MicroTileWidth);
+
+    *pSlice += coordZ;
+
+    tileIndex = static_cast<UINT_32>((totalOffset % macroTileBits) / tileBits);
+
+    my = (tileIndex / pTileInfo->bankWidth) % pTileInfo->bankHeight * MicroTileHeight;
+    mx = (tileIndex % pTileInfo->bankWidth) * pipes * MicroTileWidth;
+
+    *pY += my;
+    *pX += mx;
+
+    bank = ComputeBankFromAddr(addr, banks, pipes);
+    pipe = ComputePipeFromAddr(addr, pipes);
+
+    HwlComputeSurfaceCoord2DFromBankPipe(tileMode,
+                                         pX,
+                                         pY,
+                                         *pSlice,
+                                         bank,
+                                         pipe,
+                                         bankSwizzle,
+                                         pipeSwizzle,
+                                         tileSlices,
+                                         ignoreSE,
+                                         pTileInfo);
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSurfaceCoord2DFromBankPipe
+*
+*   @brief
+*       Compute surface x,y coordinates from bank/pipe info
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID EgBasedLib::ComputeSurfaceCoord2DFromBankPipe(
+    AddrTileMode        tileMode,   ///< [in] tile mode
+    UINT_32             x,          ///< [in] x coordinate
+    UINT_32             y,          ///< [in] y coordinate
+    UINT_32             slice,      ///< [in] slice index
+    UINT_32             bank,       ///< [in] bank number
+    UINT_32             pipe,       ///< [in] pipe number
+    UINT_32             bankSwizzle,///< [in] bank swizzle
+    UINT_32             pipeSwizzle,///< [in] pipe swizzle
+    UINT_32             tileSlices, ///< [in] slices in a micro tile
+    ADDR_TILEINFO*      pTileInfo,  ///< [in] bank structure. **All fields to be valid on entry**
+    CoordFromBankPipe*  pOutput     ///< [out] pointer to extracted x/y bits
+    ) const
+{
+    UINT_32 yBit3 = 0;
+    UINT_32 yBit4 = 0;
+    UINT_32 yBit5 = 0;
+    UINT_32 yBit6 = 0;
+
+    UINT_32 xBit3 = 0;
+    UINT_32 xBit4 = 0;
+    UINT_32 xBit5 = 0;
+
+    UINT_32 tileSplitRotation;
+
+    UINT_32 numPipes = HwlGetPipes(pTileInfo);
+
+    UINT_32 bankRotation = ComputeBankRotation(tileMode,
+                                               pTileInfo->banks, numPipes);
+
+    UINT_32 pipeRotation = ComputePipeRotation(tileMode, numPipes);
+
+    UINT_32 xBit = x / (MicroTileWidth * pTileInfo->bankWidth * numPipes);
+    UINT_32 yBit = y / (MicroTileHeight * pTileInfo->bankHeight);
+
+    //calculate the bank and pipe before rotation and swizzle
+
+    switch (tileMode)
+    {
+        case ADDR_TM_2D_TILED_THIN1:  //fall through
+        case ADDR_TM_2D_TILED_THICK:  //fall through
+        case ADDR_TM_2D_TILED_XTHICK: //fall through
+        case ADDR_TM_3D_TILED_THIN1:  //fall through
+        case ADDR_TM_3D_TILED_THICK:  //fall through
+        case ADDR_TM_3D_TILED_XTHICK:
+            tileSplitRotation = ((pTileInfo->banks / 2) + 1);
+            break;
+        default:
+            tileSplitRotation =  0;
+            break;
+    }
+
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    bank ^= tileSplitRotation * tileSlices;
+    if (pipeRotation == 0)
+    {
+        bank ^= bankRotation * (slice / microTileThickness) + bankSwizzle;
+        bank %= pTileInfo->banks;
+        pipe ^= pipeSwizzle;
+    }
+    else
+    {
+        bank ^= bankRotation * (slice / microTileThickness) / numPipes + bankSwizzle;
+        bank %= pTileInfo->banks;
+        pipe ^= pipeRotation * (slice / microTileThickness) + pipeSwizzle;
+    }
+
+    if (pTileInfo->macroAspectRatio == 1)
+    {
+        switch (pTileInfo->banks)
+        {
+            case 2:
+                yBit3 = _BIT(bank, 0) ^ _BIT(xBit,0);
+                break;
+            case 4:
+                yBit4 = _BIT(bank, 0) ^ _BIT(xBit,0);
+                yBit3 = _BIT(bank, 1) ^ _BIT(xBit,1);
+                break;
+            case 8:
+                yBit3 = _BIT(bank, 2) ^ _BIT(xBit,2);
+                yBit5 = _BIT(bank, 0) ^ _BIT(xBit,0);
+                yBit4 = _BIT(bank, 1) ^ _BIT(xBit,1) ^ yBit5;
+                break;
+            case 16:
+                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3);
+                yBit4 = _BIT(bank, 2) ^ _BIT(xBit, 2);
+                yBit6 = _BIT(bank, 0) ^ _BIT(xBit, 0);
+                yBit5 = _BIT(bank, 1) ^ _BIT(xBit, 1) ^ yBit6;
+                break;
+            default:
+                break;
+        }
+
+    }
+    else if (pTileInfo->macroAspectRatio == 2)
+    {
+        switch (pTileInfo->banks)
+        {
+            case 2: //xBit3 = yBit3^b0
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,0);
+                break;
+            case 4: //xBit3=yBit4^b0; yBit3=xBit4^b1
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,1);
+                yBit3 = _BIT(bank, 1) ^ _BIT(xBit,1);
+                break;
+            case 8: //xBit4, xBit5, yBit5 are known
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,2);
+                yBit3 = _BIT(bank, 2) ^ _BIT(xBit,2);
+                yBit4 = _BIT(bank, 1) ^ _BIT(xBit,1) ^ _BIT(yBit, 2);
+                break;
+            case 16://x4,x5,x6,y6 are known
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit, 3); //x3 = y6 ^ b0
+                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3); //y3 = x6 ^ b3
+                yBit4 = _BIT(bank, 2) ^ _BIT(xBit, 2); //y4 = x5 ^ b2
+                yBit5 = _BIT(bank, 1) ^ _BIT(xBit, 1) ^ _BIT(yBit, 3); //y5=x4^y6^b1
+                break;
+            default:
+                break;
+        }
+    }
+    else if (pTileInfo->macroAspectRatio == 4)
+    {
+        switch (pTileInfo->banks)
+        {
+            case 4: //yBit3, yBit4
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,1);
+                xBit4 = _BIT(bank, 1) ^ _BIT(yBit,0);
+                break;
+            case 8: //xBit5, yBit4, yBit5
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,2);
+                yBit3 = _BIT(bank, 2) ^ _BIT(xBit,2);
+                xBit4 = _BIT(bank, 1) ^ _BIT(yBit,1) ^  _BIT(yBit,2);
+                break;
+            case 16: //xBit5, xBit6, yBit5, yBit6
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit, 3);//x3 = b0 ^ y6
+                xBit4 = _BIT(bank, 1) ^ _BIT(yBit, 2) ^ _BIT(yBit, 3);//x4 = b1 ^ y5 ^ y6;
+                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3); //y3 = b3 ^ x6;
+                yBit4 = _BIT(bank, 2) ^ _BIT(xBit, 2); //y4 = b2 ^ x5;
+                break;
+            default:
+                break;
+        }
+    }
+    else if (pTileInfo->macroAspectRatio == 8)
+    {
+        switch (pTileInfo->banks)
+        {
+            case 8: //yBit3, yBit4, yBit5
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit,2); //x3 = b0 ^ y5;
+                xBit4 = _BIT(bank, 1) ^ _BIT(yBit,1) ^ _BIT(yBit, 2);//x4 = b1 ^ y4 ^ y5;
+                xBit5 = _BIT(bank, 2) ^ _BIT(yBit,0);
+                break;
+            case 16: //xBit6, yBit4, yBit5, yBit6
+                xBit3 = _BIT(bank, 0) ^ _BIT(yBit, 3);//x3 = y6 ^ b0
+                xBit4 = _BIT(bank, 1) ^ _BIT(yBit, 2) ^ _BIT(yBit, 3);//x4 = y5 ^ y6 ^ b1
+                xBit5 = _BIT(bank, 2) ^ _BIT(yBit, 1);//x5 = y4 ^ b2
+                yBit3 = _BIT(bank, 3) ^ _BIT(xBit, 3); //y3 = x6 ^ b3
+                break;
+            default:
+                break;
+        }
+    }
+
+    pOutput->xBits = xBit;
+    pOutput->yBits = yBit;
+
+    pOutput->xBit3 = xBit3;
+    pOutput->xBit4 = xBit4;
+    pOutput->xBit5 = xBit5;
+    pOutput->yBit3 = yBit3;
+    pOutput->yBit4 = yBit4;
+    pOutput->yBit5 = yBit5;
+    pOutput->yBit6 = yBit6;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlExtractBankPipeSwizzle
+*   @brief
+*       Entry of EgBasedLib ExtractBankPipeSwizzle
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlExtractBankPipeSwizzle(
+    const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT*  pIn,   ///< [in] input structure
+    ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT*       pOut   ///< [out] output structure
+    ) const
+{
+    ExtractBankPipeSwizzle(pIn->base256b,
+                           pIn->pTileInfo,
+                           &pOut->bankSwizzle,
+                           &pOut->pipeSwizzle);
+
+    return ADDR_OK;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlCombineBankPipeSwizzle
+*   @brief
+*       Combine bank/pipe swizzle
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlCombineBankPipeSwizzle(
+    UINT_32         bankSwizzle,    ///< [in] bank swizzle
+    UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
+    ADDR_TILEINFO*  pTileInfo,      ///< [in] tile info
+    UINT_64         baseAddr,       ///< [in] base address
+    UINT_32*        pTileSwizzle    ///< [out] combined swizzle
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    if (pTileSwizzle)
+    {
+        *pTileSwizzle = GetBankPipeSwizzle(bankSwizzle, pipeSwizzle, baseAddr, pTileInfo);
+    }
+    else
+    {
+        retCode = ADDR_INVALIDPARAMS;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeBaseSwizzle
+*   @brief
+*       Compute base swizzle
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeBaseSwizzle(
+    const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
+    ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut
+    ) const
+{
+    UINT_32 bankSwizzle = 0;
+    UINT_32 pipeSwizzle = 0;
+    ADDR_TILEINFO* pTileInfo = pIn->pTileInfo;
+
+    ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
+    ADDR_ASSERT(pIn->pTileInfo);
+
+    /// This is a legacy misreading of h/w doc, use it as it doesn't hurt.
+    static const UINT_8 bankRotationArray[4][16] = {
+        { 0, 0,  0, 0,  0, 0,  0, 0, 0,  0, 0,  0, 0,  0, 0, 0 }, // ADDR_SURF_2_BANK
+        { 0, 1,  2, 3,  0, 0,  0, 0, 0,  0, 0,  0, 0,  0, 0, 0 }, // ADDR_SURF_4_BANK
+        { 0, 3,  6, 1,  4, 7,  2, 5, 0,  0, 0,  0, 0,  0, 0, 0 }, // ADDR_SURF_8_BANK
+        { 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 }, // ADDR_SURF_16_BANK
+    };
+
+    UINT_32 pipes = HwlGetPipes(pTileInfo);
+    (void)pipes;
+    UINT_32 banks = pTileInfo ? pTileInfo->banks : 2;
+    UINT_32 hwNumBanks;
+
+    // Uses less bank swizzle bits
+    if (pIn->option.reduceBankBit && banks > 2)
+    {
+        banks >>= 1;
+    }
+
+    switch (banks)
+    {
+        case 2:
+            hwNumBanks = 0;
+            break;
+        case 4:
+            hwNumBanks = 1;
+            break;
+        case 8:
+            hwNumBanks = 2;
+            break;
+        case 16:
+            hwNumBanks = 3;
+            break;
+        default:
+            ADDR_ASSERT_ALWAYS();
+            hwNumBanks = 0;
+            break;
+    }
+
+    if (pIn->option.genOption == ADDR_SWIZZLE_GEN_LINEAR)
+    {
+        bankSwizzle = pIn->surfIndex & (banks - 1);
+    }
+    else // (pIn->option.genOption == ADDR_SWIZZLE_GEN_DEFAULT)
+    {
+        bankSwizzle = bankRotationArray[hwNumBanks][pIn->surfIndex & (banks - 1)];
+    }
+
+    if (IsMacro3dTiled(pIn->tileMode))
+    {
+        pipeSwizzle = pIn->surfIndex & (HwlGetPipes(pTileInfo) - 1);
+    }
+
+    return HwlCombineBankPipeSwizzle(bankSwizzle, pipeSwizzle, pTileInfo, 0, &pOut->tileSwizzle);
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ExtractBankPipeSwizzle
+*   @brief
+*       Extract bank/pipe swizzle from base256b
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID EgBasedLib::ExtractBankPipeSwizzle(
+    UINT_32         base256b,       ///< [in] input base256b register value
+    ADDR_TILEINFO*  pTileInfo,      ///< [in] 2D tile parameters. Client must provide all data
+    UINT_32*        pBankSwizzle,   ///< [out] bank swizzle
+    UINT_32*        pPipeSwizzle    ///< [out] pipe swizzle
+    ) const
+{
+    UINT_32 bankSwizzle = 0;
+    UINT_32 pipeSwizzle = 0;
+
+    if (base256b != 0)
+    {
+        UINT_32 numPipes        = HwlGetPipes(pTileInfo);
+        UINT_32 bankBits        = QLog2(pTileInfo->banks);
+        UINT_32 pipeBits        = QLog2(numPipes);
+        UINT_32 groupBytes      = m_pipeInterleaveBytes;
+        UINT_32 bankInterleave  = m_bankInterleave;
+
+        pipeSwizzle =
+            (base256b / (groupBytes >> 8)) & ((1<<pipeBits)-1);
+
+        bankSwizzle =
+            (base256b / (groupBytes >> 8) / numPipes / bankInterleave) & ((1 << bankBits) - 1);
+    }
+
+    *pPipeSwizzle = pipeSwizzle;
+    *pBankSwizzle = bankSwizzle;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::GetBankPipeSwizzle
+*   @brief
+*       Combine bank/pipe swizzle
+*   @return
+*       Base256b bits (only filled bank/pipe bits)
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::GetBankPipeSwizzle(
+    UINT_32         bankSwizzle,    ///< [in] bank swizzle
+    UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
+    UINT_64         baseAddr,       ///< [in] base address
+    ADDR_TILEINFO*  pTileInfo       ///< [in] tile info
+    ) const
+{
+    UINT_32 pipeBits = QLog2(HwlGetPipes(pTileInfo));
+    UINT_32 bankInterleaveBits = QLog2(m_bankInterleave);
+    UINT_32 tileSwizzle = pipeSwizzle + ((bankSwizzle << bankInterleaveBits) << pipeBits);
+
+    baseAddr ^= tileSwizzle * m_pipeInterleaveBytes;
+    baseAddr >>= 8;
+
+    return static_cast<UINT_32>(baseAddr);
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeSliceTileSwizzle
+*   @brief
+*       Compute cubemap/3d texture faces/slices tile swizzle
+*   @return
+*       Tile swizzle
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputeSliceTileSwizzle(
+    AddrTileMode        tileMode,       ///< [in] Tile mode
+    UINT_32             baseSwizzle,    ///< [in] Base swizzle
+    UINT_32             slice,          ///< [in] Slice index, Cubemap face index, 0 means +X
+    UINT_64             baseAddr,       ///< [in] Base address
+    ADDR_TILEINFO* pTileInfo       ///< [in] Bank structure
+    ) const
+{
+    UINT_32 tileSwizzle = 0;
+
+    if (IsMacroTiled(tileMode)) // Swizzle only for macro tile mode
+    {
+        UINT_32 firstSlice = slice / Thickness(tileMode);
+
+        UINT_32 numPipes = HwlGetPipes(pTileInfo);
+        UINT_32 numBanks = pTileInfo->banks;
+
+        UINT_32 pipeRotation;
+        UINT_32 bankRotation;
+
+        UINT_32 bankSwizzle = 0;
+        UINT_32 pipeSwizzle = 0;
+
+        pipeRotation = ComputePipeRotation(tileMode, numPipes);
+        bankRotation = ComputeBankRotation(tileMode, numBanks, numPipes);
+
+        if (baseSwizzle != 0)
+        {
+            ExtractBankPipeSwizzle(baseSwizzle,
+                                   pTileInfo,
+                                   &bankSwizzle,
+                                   &pipeSwizzle);
+        }
+
+        if (pipeRotation == 0) //2D mode
+        {
+            bankSwizzle += firstSlice * bankRotation;
+            bankSwizzle %= numBanks;
+        }
+        else //3D mode
+        {
+            pipeSwizzle += firstSlice * pipeRotation;
+            pipeSwizzle %= numPipes;
+            bankSwizzle += firstSlice * bankRotation / numPipes;
+            bankSwizzle %= numBanks;
+        }
+
+        tileSwizzle = GetBankPipeSwizzle(bankSwizzle,
+                                         pipeSwizzle,
+                                         baseAddr,
+                                         pTileInfo);
+    }
+
+    return tileSwizzle;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeQbStereoRightSwizzle
+*
+*   @brief
+*       Compute right eye swizzle
+*   @return
+*       swizzle
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::HwlComputeQbStereoRightSwizzle(
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo  ///< [in] Surface info, must be valid
+    ) const
+{
+    UINT_32 bankBits    = 0;
+    UINT_32 swizzle     = 0;
+
+    // The assumption is default swizzle for left eye is 0
+    if (IsMacroTiled(pInfo->tileMode) && pInfo->pStereoInfo && pInfo->pTileInfo)
+    {
+        bankBits = ComputeBankFromCoord(0, pInfo->height, 0,
+                                        pInfo->tileMode, 0, 0, pInfo->pTileInfo);
+
+        if (bankBits)
+        {
+            HwlCombineBankPipeSwizzle(bankBits, 0, pInfo->pTileInfo, 0, &swizzle);
+        }
+    }
+
+    return swizzle;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeBankFromCoord
+*
+*   @brief
+*       Compute bank number from coordinates
+*   @return
+*       Bank number
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputeBankFromCoord(
+    UINT_32         x,              ///< [in] x coordinate
+    UINT_32         y,              ///< [in] y coordinate
+    UINT_32         slice,          ///< [in] slice index
+    AddrTileMode    tileMode,       ///< [in] tile mode
+    UINT_32         bankSwizzle,    ///< [in] bank swizzle
+    UINT_32         tileSplitSlice, ///< [in] If the size of the pixel offset is larger than the
+                                    ///  tile split size, then the pixel will be moved to a separate
+                                    ///  slice. This value equals pixelOffset / tileSplitBytes
+                                    ///  in this case. Otherwise this is 0.
+    ADDR_TILEINFO*  pTileInfo       ///< [in] tile info
+    ) const
+{
+    UINT_32 pipes = HwlGetPipes(pTileInfo);
+    UINT_32 bankBit0 = 0;
+    UINT_32 bankBit1 = 0;
+    UINT_32 bankBit2 = 0;
+    UINT_32 bankBit3 = 0;
+    UINT_32 sliceRotation;
+    UINT_32 tileSplitRotation;
+    UINT_32 bank;
+    UINT_32 numBanks    = pTileInfo->banks;
+    UINT_32 bankWidth   = pTileInfo->bankWidth;
+    UINT_32 bankHeight  = pTileInfo->bankHeight;
+
+    UINT_32 tx = x / MicroTileWidth / (bankWidth * pipes);
+    UINT_32 ty = y / MicroTileHeight / bankHeight;
+
+    UINT_32 x3 = _BIT(tx,0);
+    UINT_32 x4 = _BIT(tx,1);
+    UINT_32 x5 = _BIT(tx,2);
+    UINT_32 x6 = _BIT(tx,3);
+    UINT_32 y3 = _BIT(ty,0);
+    UINT_32 y4 = _BIT(ty,1);
+    UINT_32 y5 = _BIT(ty,2);
+    UINT_32 y6 = _BIT(ty,3);
+
+    switch (numBanks)
+    {
+        case 16:
+            bankBit0 = x3 ^ y6;
+            bankBit1 = x4 ^ y5 ^ y6;
+            bankBit2 = x5 ^ y4;
+            bankBit3 = x6 ^ y3;
+            break;
+        case 8:
+            bankBit0 = x3 ^ y5;
+            bankBit1 = x4 ^ y4 ^ y5;
+            bankBit2 = x5 ^ y3;
+            break;
+        case 4:
+            bankBit0 = x3 ^ y4;
+            bankBit1 = x4 ^ y3;
+            break;
+        case 2:
+            bankBit0 = x3 ^ y3;
+            break;
+        default:
+            ADDR_ASSERT_ALWAYS();
+            break;
+    }
+
+    bank = bankBit0 | (bankBit1 << 1) | (bankBit2 << 2) | (bankBit3 << 3);
+
+    //Bits2Number(4, bankBit3, bankBit2, bankBit1, bankBit0);
+
+    bank = HwlPreAdjustBank((x / MicroTileWidth), bank, pTileInfo);
+    //
+    // Compute bank rotation for the slice.
+    //
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    switch (tileMode)
+    {
+        case ADDR_TM_2D_TILED_THIN1:  // fall through
+        case ADDR_TM_2D_TILED_THICK:  // fall through
+        case ADDR_TM_2D_TILED_XTHICK:
+            sliceRotation = ((numBanks / 2) - 1) * (slice / microTileThickness);
+            break;
+        case ADDR_TM_3D_TILED_THIN1:  // fall through
+        case ADDR_TM_3D_TILED_THICK:  // fall through
+        case ADDR_TM_3D_TILED_XTHICK:
+            sliceRotation =
+                Max(1u, (pipes / 2) - 1) * (slice / microTileThickness) / pipes;
+            break;
+        default:
+            sliceRotation =  0;
+            break;
+    }
+
+    //
+    // Compute bank rotation for the tile split slice.
+    //
+    // The sample slice will be non-zero if samples must be split across multiple slices.
+    // This situation arises when the micro tile size multiplied yBit the number of samples exceeds
+    // the split size (set in GB_ADDR_CONFIG).
+    //
+    switch (tileMode)
+    {
+        case ADDR_TM_2D_TILED_THIN1: //fall through
+        case ADDR_TM_3D_TILED_THIN1: //fall through
+        case ADDR_TM_PRT_2D_TILED_THIN1: //fall through
+        case ADDR_TM_PRT_3D_TILED_THIN1: //fall through
+            tileSplitRotation = ((numBanks / 2) + 1) * tileSplitSlice;
+            break;
+        default:
+            tileSplitRotation =  0;
+            break;
+    }
+
+    //
+    // Apply bank rotation for the slice and tile split slice.
+    //
+    bank ^= bankSwizzle + sliceRotation;
+    bank ^= tileSplitRotation;
+
+    bank &= (numBanks - 1);
+
+    return bank;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeBankFromAddr
+*
+*   @brief
+*       Compute the bank number from an address
+*   @return
+*       Bank number
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputeBankFromAddr(
+    UINT_64 addr,       ///< [in] address
+    UINT_32 numBanks,   ///< [in] number of banks
+    UINT_32 numPipes    ///< [in] number of pipes
+    ) const
+{
+    UINT_32 bank;
+
+    //
+    // The LSBs of the address are arranged as follows:
+    //   bank | bankInterleave | pipe | pipeInterleave
+    //
+    // To get the bank number, shift off the pipe interleave, pipe, and bank interlave bits and
+    // mask the bank bits.
+    //
+    bank = static_cast<UINT_32>(
+        (addr >> Log2(m_pipeInterleaveBytes * numPipes * m_bankInterleave)) &
+        (numBanks - 1)
+        );
+
+    return bank;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputePipeRotation
+*
+*   @brief
+*       Compute pipe rotation value
+*   @return
+*       Pipe rotation
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputePipeRotation(
+    AddrTileMode tileMode,  ///< [in] tile mode
+    UINT_32      numPipes   ///< [in] number of pipes
+    ) const
+{
+   UINT_32 rotation;
+
+    switch (tileMode)
+    {
+        case ADDR_TM_3D_TILED_THIN1:        //fall through
+        case ADDR_TM_3D_TILED_THICK:        //fall through
+        case ADDR_TM_3D_TILED_XTHICK:       //fall through
+        case ADDR_TM_PRT_3D_TILED_THIN1:    //fall through
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            rotation = (numPipes < 4) ? 1 : (numPipes / 2 - 1);
+            break;
+        default:
+            rotation = 0;
+    }
+
+    return rotation;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeBankRotation
+*
+*   @brief
+*       Compute bank rotation value
+*   @return
+*       Bank rotation
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputeBankRotation(
+    AddrTileMode tileMode,  ///< [in] tile mode
+    UINT_32      numBanks,  ///< [in] number of banks
+    UINT_32      numPipes   ///< [in] number of pipes
+    ) const
+{
+    UINT_32 rotation;
+
+    switch (tileMode)
+    {
+        case ADDR_TM_2D_TILED_THIN1: // fall through
+        case ADDR_TM_2D_TILED_THICK: // fall through
+        case ADDR_TM_2D_TILED_XTHICK:
+        case ADDR_TM_PRT_2D_TILED_THIN1:
+        case ADDR_TM_PRT_2D_TILED_THICK:
+            // Rotate banks per Z-slice yBit 1 for 4-bank or 3 for 8-bank
+            rotation =  numBanks / 2 - 1;
+            break;
+        case ADDR_TM_3D_TILED_THIN1: // fall through
+        case ADDR_TM_3D_TILED_THICK: // fall through
+        case ADDR_TM_3D_TILED_XTHICK:
+        case ADDR_TM_PRT_3D_TILED_THIN1:
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            rotation = (numPipes < 4) ? 1 : (numPipes / 2 - 1);    // rotate pipes & banks
+            break;
+        default:
+            rotation = 0;
+    }
+
+    return rotation;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeHtileBytes
+*
+*   @brief
+*       Compute htile size in bytes
+*
+*   @return
+*       Htile size in bytes
+****************************************************************************************************
+*/
+UINT_64 EgBasedLib::ComputeHtileBytes(
+    UINT_32 pitch,        ///< [in] pitch
+    UINT_32 height,       ///< [in] height
+    UINT_32 bpp,          ///< [in] bits per pixel
+    BOOL_32 isLinear,     ///< [in] if it is linear mode
+    UINT_32 numSlices,    ///< [in] number of slices
+    UINT_64* sliceBytes,  ///< [out] bytes per slice
+    UINT_32 baseAlign     ///< [in] base alignments
+    ) const
+{
+    UINT_64 surfBytes;
+
+    const UINT_64 HtileCacheLineSize = BITS_TO_BYTES(HtileCacheBits);
+
+    *sliceBytes = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp / 64);
+
+    if (m_configFlags.useHtileSliceAlign)
+    {
+        // Align the sliceSize to htilecachelinesize * pipes at first
+        *sliceBytes = PowTwoAlign(*sliceBytes, HtileCacheLineSize * m_pipes);
+        surfBytes  = *sliceBytes * numSlices;
+    }
+    else
+    {
+        // Align the surfSize to htilecachelinesize * pipes at last
+        surfBytes  = *sliceBytes * numSlices;
+        surfBytes  = PowTwoAlign(surfBytes, HtileCacheLineSize * m_pipes);
+    }
+
+    return surfBytes;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::DispatchComputeFmaskInfo
+*
+*   @brief
+*       Compute fmask sizes include padded pitch, height, slices, total size in bytes,
+*       meanwhile output suitable tile mode and alignments as well. Results are returned
+*       through output parameters.
+*
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::DispatchComputeFmaskInfo(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut)  ///< [out] output structure
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    ADDR_COMPUTE_SURFACE_INFO_INPUT  surfIn     = {0};
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT surfOut    = {0};
+
+    // Setup input structure
+    surfIn.tileMode          = pIn->tileMode;
+    surfIn.width             = pIn->pitch;
+    surfIn.height            = pIn->height;
+    surfIn.numSlices         = pIn->numSlices;
+    surfIn.pTileInfo         = pIn->pTileInfo;
+    surfIn.tileType          = ADDR_NON_DISPLAYABLE;
+    surfIn.flags.fmask       = 1;
+
+    // Setup output structure
+    surfOut.pTileInfo       = pOut->pTileInfo;
+
+    // Setup hwl specific fields
+    HwlFmaskPreThunkSurfInfo(pIn, pOut, &surfIn, &surfOut);
+
+    surfIn.bpp = HwlComputeFmaskBits(pIn, &surfIn.numSamples);
+
+    // ComputeSurfaceInfo needs numSamples in surfOut as surface routines need adjusted numSamples
+    surfOut.numSamples = surfIn.numSamples;
+
+    retCode = HwlComputeSurfaceInfo(&surfIn, &surfOut);
+
+    // Save bpp field for surface dump support
+    surfOut.bpp = surfIn.bpp;
+
+    if (retCode == ADDR_OK)
+    {
+        pOut->bpp               = surfOut.bpp;
+        pOut->pitch             = surfOut.pitch;
+        pOut->height            = surfOut.height;
+        pOut->numSlices         = surfOut.depth;
+        pOut->fmaskBytes        = surfOut.surfSize;
+        pOut->baseAlign         = surfOut.baseAlign;
+        pOut->pitchAlign        = surfOut.pitchAlign;
+        pOut->heightAlign       = surfOut.heightAlign;
+
+        if (surfOut.depth > 1)
+        {
+            // For fmask, expNumSlices is stored in depth.
+            pOut->sliceSize = surfOut.surfSize / surfOut.depth;
+        }
+        else
+        {
+            pOut->sliceSize = surfOut.surfSize;
+        }
+
+        // Save numSamples field for surface dump support
+        pOut->numSamples        = surfOut.numSamples;
+
+        HwlFmaskPostThunkSurfInfo(&surfOut, pOut);
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlFmaskSurfaceInfo
+*   @brief
+*       Entry of EgBasedLib ComputeFmaskInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskInfo(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pIn,   ///< [in] input structure
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT*         pOut   ///< [out] output structure
+    )
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    ADDR_TILEINFO tileInfo = {0};
+
+    // Use internal tile info if pOut does not have a valid pTileInfo
+    if (pOut->pTileInfo == NULL)
+    {
+        pOut->pTileInfo = &tileInfo;
+    }
+
+    retCode = DispatchComputeFmaskInfo(pIn, pOut);
+
+    if (retCode == ADDR_OK)
+    {
+        pOut->tileIndex =
+            HwlPostCheckTileIndex(pOut->pTileInfo, pIn->tileMode, ADDR_NON_DISPLAYABLE,
+                                  pOut->tileIndex);
+    }
+
+    // Resets pTileInfo to NULL if the internal tile info is used
+    if (pOut->pTileInfo == &tileInfo)
+    {
+        pOut->pTileInfo = NULL;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeFmaskAddrFromCoord
+*   @brief
+*       Entry of EgBasedLib ComputeFmaskAddrFromCoord
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskAddrFromCoord(
+    const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeFmaskCoordFromAddr
+*   @brief
+*       Entry of EgBasedLib ComputeFmaskCoordFromAddr
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskCoordFromAddr(
+    const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT*   pIn,    ///< [in] input structure
+    ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT*        pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeFmaskNumPlanesFromNumSamples
+*
+*   @brief
+*       Compute fmask number of planes from number of samples
+*
+*   @return
+*       Number of planes
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputeFmaskNumPlanesFromNumSamples(
+    UINT_32 numSamples)     ///< [in] number of samples
+{
+    UINT_32 numPlanes;
+
+    //
+    // FMASK is stored such that each micro tile is composed of elements containing N bits, where
+    // N is the number of samples.  There is a micro tile for each bit in the FMASK address, and
+    // micro tiles for each address bit, sometimes referred to as a plane, are stored sequentially.
+    // The FMASK for a 2-sample surface looks like a general surface with 2 bits per element.
+    // The FMASK for a 4-sample surface looks like a general surface with 4 bits per element and
+    // 2 samples.  The FMASK for an 8-sample surface looks like a general surface with 8 bits per
+    // element and 4 samples.  R6xx and R7xx only stored 3 planes for 8-sample FMASK surfaces.
+    // This was changed for R8xx to simplify the logic in the CB.
+    //
+    switch (numSamples)
+    {
+        case 2:
+            numPlanes = 1;
+            break;
+        case 4:
+            numPlanes = 2;
+            break;
+        case 8:
+            numPlanes = 4;
+            break;
+        default:
+            ADDR_UNHANDLED_CASE();
+            numPlanes = 0;
+            break;
+    }
+    return numPlanes;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::ComputeFmaskResolvedBppFromNumSamples
+*
+*   @brief
+*       Compute resolved fmask effective bpp based on number of samples
+*
+*   @return
+*       bpp
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::ComputeFmaskResolvedBppFromNumSamples(
+    UINT_32 numSamples)     ///< number of samples
+{
+    UINT_32 bpp;
+
+    //
+    // Resolved FMASK surfaces are generated yBit the CB and read yBit the texture unit
+    // so that the texture unit can read compressed multi-sample color data.
+    // These surfaces store each index value packed per element.
+    // Each element contains at least num_samples * log2(num_samples) bits.
+    // Resolved FMASK surfaces are addressed as follows:
+    // 2-sample Addressed similarly to a color surface with 8 bits per element and 1 sample.
+    // 4-sample Addressed similarly to a color surface with 8 bits per element and 1 sample.
+    // 8-sample Addressed similarly to a color surface with 32 bits per element and 1 sample.
+
+    switch (numSamples)
+    {
+        case 2:
+            bpp = 8;
+            break;
+        case 4:
+            bpp = 8;
+            break;
+        case 8:
+            bpp = 32;
+            break;
+        default:
+            ADDR_UNHANDLED_CASE();
+            bpp = 0;
+            break;
+    }
+    return bpp;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::IsTileInfoAllZero
+*
+*   @brief
+*       Return TRUE if all field are zero
+*   @note
+*       Since NULL input is consider to be all zero
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::IsTileInfoAllZero(
+    const ADDR_TILEINFO* pTileInfo)
+{
+    BOOL_32 allZero = TRUE;
+
+    if (pTileInfo)
+    {
+        if ((pTileInfo->banks            != 0)  ||
+            (pTileInfo->bankWidth        != 0)  ||
+            (pTileInfo->bankHeight       != 0)  ||
+            (pTileInfo->macroAspectRatio != 0)  ||
+            (pTileInfo->tileSplitBytes   != 0)  ||
+            (pTileInfo->pipeConfig       != 0)
+            )
+        {
+            allZero = FALSE;
+        }
+    }
+
+    return allZero;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlTileInfoEqual
+*
+*   @brief
+*       Return TRUE if all field are equal
+*   @note
+*       Only takes care of current HWL's data
+****************************************************************************************************
+*/
+BOOL_32 EgBasedLib::HwlTileInfoEqual(
+    const ADDR_TILEINFO* pLeft, ///<[in] Left compare operand
+    const ADDR_TILEINFO* pRight ///<[in] Right compare operand
+    ) const
+{
+    BOOL_32 equal = FALSE;
+
+    if (pLeft->banks == pRight->banks           &&
+        pLeft->bankWidth == pRight->bankWidth   &&
+        pLeft->bankHeight == pRight->bankHeight &&
+        pLeft->macroAspectRatio == pRight->macroAspectRatio &&
+        pLeft->tileSplitBytes == pRight->tileSplitBytes)
+    {
+        equal = TRUE;
+    }
+
+    return equal;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlConvertTileInfoToHW
+*   @brief
+*       Entry of EgBasedLib ConvertTileInfoToHW
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlConvertTileInfoToHW(
+    const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
+    ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode   = ADDR_OK;
+
+    ADDR_TILEINFO *pTileInfoIn  = pIn->pTileInfo;
+    ADDR_TILEINFO *pTileInfoOut = pOut->pTileInfo;
+
+    if ((pTileInfoIn != NULL) && (pTileInfoOut != NULL))
+    {
+        if (pIn->reverse == FALSE)
+        {
+            switch (pTileInfoIn->banks)
+            {
+                case 2:
+                    pTileInfoOut->banks = 0;
+                    break;
+                case 4:
+                    pTileInfoOut->banks = 1;
+                    break;
+                case 8:
+                    pTileInfoOut->banks = 2;
+                    break;
+                case 16:
+                    pTileInfoOut->banks = 3;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->banks = 0;
+                    break;
+            }
+
+            switch (pTileInfoIn->bankWidth)
+            {
+                case 1:
+                    pTileInfoOut->bankWidth = 0;
+                    break;
+                case 2:
+                    pTileInfoOut->bankWidth = 1;
+                    break;
+                case 4:
+                    pTileInfoOut->bankWidth = 2;
+                    break;
+                case 8:
+                    pTileInfoOut->bankWidth = 3;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->bankWidth = 0;
+                    break;
+            }
+
+            switch (pTileInfoIn->bankHeight)
+            {
+                case 1:
+                    pTileInfoOut->bankHeight = 0;
+                    break;
+                case 2:
+                    pTileInfoOut->bankHeight = 1;
+                    break;
+                case 4:
+                    pTileInfoOut->bankHeight = 2;
+                    break;
+                case 8:
+                    pTileInfoOut->bankHeight = 3;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->bankHeight = 0;
+                    break;
+            }
+
+            switch (pTileInfoIn->macroAspectRatio)
+            {
+                case 1:
+                    pTileInfoOut->macroAspectRatio = 0;
+                    break;
+                case 2:
+                    pTileInfoOut->macroAspectRatio = 1;
+                    break;
+                case 4:
+                    pTileInfoOut->macroAspectRatio = 2;
+                    break;
+                case 8:
+                    pTileInfoOut->macroAspectRatio = 3;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->macroAspectRatio = 0;
+                    break;
+            }
+
+            switch (pTileInfoIn->tileSplitBytes)
+            {
+                case 64:
+                    pTileInfoOut->tileSplitBytes = 0;
+                    break;
+                case 128:
+                    pTileInfoOut->tileSplitBytes = 1;
+                    break;
+                case 256:
+                    pTileInfoOut->tileSplitBytes = 2;
+                    break;
+                case 512:
+                    pTileInfoOut->tileSplitBytes = 3;
+                    break;
+                case 1024:
+                    pTileInfoOut->tileSplitBytes = 4;
+                    break;
+                case 2048:
+                    pTileInfoOut->tileSplitBytes = 5;
+                    break;
+                case 4096:
+                    pTileInfoOut->tileSplitBytes = 6;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->tileSplitBytes = 0;
+                    break;
+            }
+        }
+        else
+        {
+            switch (pTileInfoIn->banks)
+            {
+                case 0:
+                    pTileInfoOut->banks = 2;
+                    break;
+                case 1:
+                    pTileInfoOut->banks = 4;
+                    break;
+                case 2:
+                    pTileInfoOut->banks = 8;
+                    break;
+                case 3:
+                    pTileInfoOut->banks = 16;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->banks = 2;
+                    break;
+            }
+
+            switch (pTileInfoIn->bankWidth)
+            {
+                case 0:
+                    pTileInfoOut->bankWidth = 1;
+                    break;
+                case 1:
+                    pTileInfoOut->bankWidth = 2;
+                    break;
+                case 2:
+                    pTileInfoOut->bankWidth = 4;
+                    break;
+                case 3:
+                    pTileInfoOut->bankWidth = 8;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->bankWidth = 1;
+                    break;
+            }
+
+            switch (pTileInfoIn->bankHeight)
+            {
+                case 0:
+                    pTileInfoOut->bankHeight = 1;
+                    break;
+                case 1:
+                    pTileInfoOut->bankHeight = 2;
+                    break;
+                case 2:
+                    pTileInfoOut->bankHeight = 4;
+                    break;
+                case 3:
+                    pTileInfoOut->bankHeight = 8;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->bankHeight = 1;
+                    break;
+            }
+
+            switch (pTileInfoIn->macroAspectRatio)
+            {
+                case 0:
+                    pTileInfoOut->macroAspectRatio = 1;
+                    break;
+                case 1:
+                    pTileInfoOut->macroAspectRatio = 2;
+                    break;
+                case 2:
+                    pTileInfoOut->macroAspectRatio = 4;
+                    break;
+                case 3:
+                    pTileInfoOut->macroAspectRatio = 8;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->macroAspectRatio = 1;
+                    break;
+            }
+
+            switch (pTileInfoIn->tileSplitBytes)
+            {
+                case 0:
+                    pTileInfoOut->tileSplitBytes = 64;
+                    break;
+                case 1:
+                    pTileInfoOut->tileSplitBytes = 128;
+                    break;
+                case 2:
+                    pTileInfoOut->tileSplitBytes = 256;
+                    break;
+                case 3:
+                    pTileInfoOut->tileSplitBytes = 512;
+                    break;
+                case 4:
+                    pTileInfoOut->tileSplitBytes = 1024;
+                    break;
+                case 5:
+                    pTileInfoOut->tileSplitBytes = 2048;
+                    break;
+                case 6:
+                    pTileInfoOut->tileSplitBytes = 4096;
+                    break;
+                default:
+                    ADDR_ASSERT_ALWAYS();
+                    retCode = ADDR_INVALIDPARAMS;
+                    pTileInfoOut->tileSplitBytes = 64;
+                    break;
+            }
+        }
+
+        if (pTileInfoIn != pTileInfoOut)
+        {
+            pTileInfoOut->pipeConfig = pTileInfoIn->pipeConfig;
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        retCode = ADDR_INVALIDPARAMS;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeSurfaceInfo
+*   @brief
+*       Entry of EgBasedLib ComputeSurfaceInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceInfo(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    if (pIn->numSamples < pIn->numFrags)
+    {
+        retCode = ADDR_INVALIDPARAMS;
+    }
+
+    ADDR_TILEINFO tileInfo = {0};
+
+    if (retCode == ADDR_OK)
+    {
+        // Uses internal tile info if pOut does not have a valid pTileInfo
+        if (pOut->pTileInfo == NULL)
+        {
+            pOut->pTileInfo = &tileInfo;
+        }
+
+        if (DispatchComputeSurfaceInfo(pIn, pOut) == FALSE)
+        {
+            retCode = ADDR_INVALIDPARAMS;
+        }
+
+        // In case client uses tile info as input and would like to calculate a correct size and
+        // alignment together with tile info as output when the tile info is not suppose to have any
+        // matching indices in tile mode tables.
+        if (pIn->flags.skipIndicesOutput == FALSE)
+        {
+            // Returns an index
+            pOut->tileIndex = HwlPostCheckTileIndex(pOut->pTileInfo,
+                                                    pOut->tileMode,
+                                                    pOut->tileType,
+                                                    pOut->tileIndex);
+
+            if (IsMacroTiled(pOut->tileMode) && (pOut->macroModeIndex == TileIndexInvalid))
+            {
+                pOut->macroModeIndex = HwlComputeMacroModeIndex(pOut->tileIndex,
+                                                                pIn->flags,
+                                                                pIn->bpp,
+                                                                pIn->numSamples,
+                                                                pOut->pTileInfo);
+            }
+        }
+
+        // Resets pTileInfo to NULL if the internal tile info is used
+        if (pOut->pTileInfo == &tileInfo)
+        {
+#if DEBUG
+            // Client does not pass in a valid pTileInfo
+            if (IsMacroTiled(pOut->tileMode))
+            {
+                // If a valid index is returned, then no pTileInfo is okay
+                ADDR_ASSERT((m_configFlags.useTileIndex == FALSE) ||
+                            (pOut->tileIndex != TileIndexInvalid));
+
+                if (IsTileInfoAllZero(pIn->pTileInfo) == FALSE)
+                {
+                    // The initial value of pIn->pTileInfo is copied to tileInfo
+                    // We do not expect any of these value to be changed nor any 0 of inputs
+                    ADDR_ASSERT(tileInfo.banks == pIn->pTileInfo->banks);
+                    ADDR_ASSERT(tileInfo.bankWidth == pIn->pTileInfo->bankWidth);
+                    ADDR_ASSERT(tileInfo.bankHeight == pIn->pTileInfo->bankHeight);
+                    ADDR_ASSERT(tileInfo.macroAspectRatio == pIn->pTileInfo->macroAspectRatio);
+                    ADDR_ASSERT(tileInfo.tileSplitBytes == pIn->pTileInfo->tileSplitBytes);
+                }
+            }
+#endif
+            pOut->pTileInfo = NULL;
+        }
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeSurfaceAddrFromCoord
+*   @brief
+*       Entry of EgBasedLib ComputeSurfaceAddrFromCoord
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceAddrFromCoord(
+    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    if (
+#if !ALT_TEST // Overflow test needs this out-of-boundary coord
+        (pIn->x > pIn->pitch)   ||
+        (pIn->y > pIn->height)  ||
+#endif
+        (pIn->numSamples > m_maxSamples))
+    {
+        retCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        pOut->addr = DispatchComputeSurfaceAddrFromCoord(pIn, pOut);
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeSurfaceCoordFromAddr
+*   @brief
+*       Entry of EgBasedLib ComputeSurfaceCoordFromAddr
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceCoordFromAddr(
+    const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT*      pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    if ((pIn->bitPosition >= 8) ||
+        (pIn->numSamples > m_maxSamples))
+    {
+        retCode = ADDR_INVALIDPARAMS;
+    }
+    else
+    {
+        DispatchComputeSurfaceCoordFromAddr(pIn, pOut);
+    }
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeSliceTileSwizzle
+*   @brief
+*       Entry of EgBasedLib ComputeSurfaceCoordFromAddr
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSliceTileSwizzle(
+    const ADDR_COMPUTE_SLICESWIZZLE_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SLICESWIZZLE_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    if (pIn->pTileInfo && (pIn->pTileInfo->banks > 0))
+    {
+
+        pOut->tileSwizzle = ComputeSliceTileSwizzle(pIn->tileMode,
+                                                    pIn->baseSwizzle,
+                                                    pIn->slice,
+                                                    pIn->baseAddr,
+                                                    pIn->pTileInfo);
+    }
+    else
+    {
+        retCode = ADDR_INVALIDPARAMS;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeHtileBpp
+*
+*   @brief
+*       Compute htile bpp
+*
+*   @return
+*       Htile bpp
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::HwlComputeHtileBpp(
+    BOOL_32 isWidth8,   ///< [in] TRUE if block width is 8
+    BOOL_32 isHeight8   ///< [in] TRUE if block height is 8
+    ) const
+{
+    // only support 8x8 mode
+    ADDR_ASSERT(isWidth8 && isHeight8);
+    return 32;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlComputeHtileBaseAlign
+*
+*   @brief
+*       Compute htile base alignment
+*
+*   @return
+*       Htile base alignment
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::HwlComputeHtileBaseAlign(
+    BOOL_32         isTcCompatible, ///< [in] if TC compatible
+    BOOL_32         isLinear,       ///< [in] if it is linear mode
+    ADDR_TILEINFO*  pTileInfo       ///< [in] Tile info
+    ) const
+{
+    UINT_32 baseAlign = m_pipeInterleaveBytes * HwlGetPipes(pTileInfo);
+
+    if (isTcCompatible)
+    {
+        ADDR_ASSERT(pTileInfo != NULL);
+        if (pTileInfo)
+        {
+            baseAlign *= pTileInfo->banks;
+        }
+    }
+
+    return baseAlign;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlGetPitchAlignmentMicroTiled
+*
+*   @brief
+*       Compute 1D tiled surface pitch alignment, calculation results are returned through
+*       output parameters.
+*
+*   @return
+*       pitch alignment
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::HwlGetPitchAlignmentMicroTiled(
+    AddrTileMode        tileMode,          ///< [in] tile mode
+    UINT_32             bpp,               ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
+    UINT_32             numSamples         ///< [in] number of samples
+    ) const
+{
+    UINT_32 pitchAlign;
+
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    UINT_32 pixelsPerMicroTile;
+    UINT_32 pixelsPerPipeInterleave;
+    UINT_32 microTilesPerPipeInterleave;
+
+    //
+    // Special workaround for depth/stencil buffer, use 8 bpp to meet larger requirement for
+    // stencil buffer since pitch alignment is related to bpp.
+    // For a depth only buffer do not set this.
+    //
+    // Note: this actually does not work for mipmap but mipmap depth texture is not really
+    // sampled with mipmap.
+    //
+    if (flags.depth && (flags.noStencil == FALSE))
+    {
+        bpp = 8;
+    }
+
+    pixelsPerMicroTile = MicroTilePixels * microTileThickness;
+    pixelsPerPipeInterleave = BYTES_TO_BITS(m_pipeInterleaveBytes) / (bpp * numSamples);
+    microTilesPerPipeInterleave = pixelsPerPipeInterleave / pixelsPerMicroTile;
+
+    pitchAlign = Max(MicroTileWidth, microTilesPerPipeInterleave * MicroTileWidth);
+
+    return pitchAlign;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlGetSizeAdjustmentMicroTiled
+*
+*   @brief
+*       Adjust 1D tiled surface pitch and slice size
+*
+*   @return
+*       Logical slice size in bytes
+****************************************************************************************************
+*/
+UINT_64 EgBasedLib::HwlGetSizeAdjustmentMicroTiled(
+    UINT_32             thickness,      ///< [in] thickness
+    UINT_32             bpp,            ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,          ///< [in] surface flags
+    UINT_32             numSamples,     ///< [in] number of samples
+    UINT_32             baseAlign,      ///< [in] base alignment
+    UINT_32             pitchAlign,     ///< [in] pitch alignment
+    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
+    UINT_32*            pHeight         ///< [in,out] pointer to height
+    ) const
+{
+    UINT_64 logicalSliceSize;
+    MAYBE_UNUSED UINT_64 physicalSliceSize;
+
+    UINT_32 pitch   = *pPitch;
+    UINT_32 height  = *pHeight;
+
+    // Logical slice: pitch * height * bpp * numSamples (no 1D MSAA so actually numSamples == 1)
+    logicalSliceSize = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
+
+    // Physical slice: multiplied by thickness
+    physicalSliceSize =  logicalSliceSize * thickness;
+
+    //
+    // R800 will always pad physical slice size to baseAlign which is pipe_interleave_bytes
+    //
+    ADDR_ASSERT((physicalSliceSize % baseAlign) == 0);
+
+    return logicalSliceSize;
+}
+
+/**
+****************************************************************************************************
+*   EgBasedLib::HwlStereoCheckRightOffsetPadding
+*
+*   @brief
+*       check if the height needs extra padding for stereo right eye offset, to avoid swizzling
+*
+*   @return
+*       TRUE is the extra padding is needed
+*
+****************************************************************************************************
+*/
+UINT_32 EgBasedLib::HwlStereoCheckRightOffsetPadding(
+    ADDR_TILEINFO* pTileInfo    ///< Tiling info
+    ) const
+{
+    UINT_32 stereoHeightAlign = 0;
+
+    if (pTileInfo->macroAspectRatio > 2)
+    {
+        // Since 3D rendering treats right eye surface starting from y == "eye height" while
+        // display engine treats it to be 0, so the bank bits may be different.
+        // Additional padding in height is required to make sure it's possible
+        // to achieve synonym by adjusting bank swizzle of right eye surface.
+
+        static const UINT_32 StereoAspectRatio = 2;
+        stereoHeightAlign = pTileInfo->banks *
+            pTileInfo->bankHeight *
+            MicroTileHeight /
+            StereoAspectRatio;
+    }
+
+    return stereoHeightAlign;
+}
+
+} // V1
+} // Addr
diff --git a/src/amd/addrlib/src/r800/egbaddrlib.h b/src/amd/addrlib/src/r800/egbaddrlib.h
new file mode 100644 (file)
index 0000000..f5bae10
--- /dev/null
@@ -0,0 +1,430 @@
+/*
+ * Copyright © 2007-2018 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  egbaddrlib.h
+* @brief Contains the EgBasedLib class definition.
+****************************************************************************************************
+*/
+
+#ifndef __EG_BASED_ADDR_LIB_H__
+#define __EG_BASED_ADDR_LIB_H__
+
+#include "addrlib1.h"
+
+namespace Addr
+{
+namespace V1
+{
+/// Structures for functions
+struct CoordFromBankPipe
+{
+    UINT_32 xBits : 3;
+    UINT_32 yBits : 4;
+
+    UINT_32 xBit3 : 1;
+    UINT_32 xBit4 : 1;
+    UINT_32 xBit5 : 1;
+    UINT_32 yBit3 : 1;
+    UINT_32 yBit4 : 1;
+    UINT_32 yBit5 : 1;
+    UINT_32 yBit6 : 1;
+};
+
+/**
+****************************************************************************************************
+* @brief This class is the Evergreen based address library
+* @note  Abstract class
+****************************************************************************************************
+*/
+class EgBasedLib : public Lib
+{
+protected:
+    EgBasedLib(const Client* pClient);
+    virtual ~EgBasedLib();
+
+public:
+
+    /// Surface info functions
+
+    // NOTE: DispatchComputeSurfaceInfo using TileInfo takes both an input and an output.
+    //       On input:
+    //       One or more fields may be 0 to be calculated/defaulted - pre-SI h/w.
+    //       H/W using tile mode index only accepts none or all 0's - SI and newer h/w.
+    //       It then returns the actual tiling configuration used.
+    //       Other methods' TileInfo must be valid on entry
+    BOOL_32 DispatchComputeSurfaceInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    ADDR_E_RETURNCODE DispatchComputeFmaskInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
+
+protected:
+    // Hwl interface
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoord(
+        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceCoordFromAddr(
+        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeSliceTileSwizzle(
+        const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
+        ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlExtractBankPipeSwizzle(
+        const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
+        ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlCombineBankPipeSwizzle(
+        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, ADDR_TILEINFO*  pTileInfo,
+        UINT_64 baseAddr, UINT_32* pTileSwizzle) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeBaseSwizzle(
+        const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
+        ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
+        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
+        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
+
+    virtual UINT_32 HwlComputeHtileBpp(
+        BOOL_32 isWidth8, BOOL_32 isHeight8) const;
+
+    virtual UINT_32 HwlComputeHtileBaseAlign(
+        BOOL_32 isTcCompatible, BOOL_32 isLinear, ADDR_TILEINFO* pTileInfo) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
+
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskAddrFromCoord(
+        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlComputeFmaskCoordFromAddr(
+        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
+
+    virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const;
+
+    virtual UINT_32 HwlComputeQbStereoRightSwizzle(
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo) const;
+
+    virtual VOID HwlComputePixelCoordFromOffset(
+        UINT_32 offset, UINT_32 bpp, UINT_32 numSamples,
+        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
+        AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const;
+
+    /// Return Cmask block max
+    virtual BOOL_32 HwlGetMaxCmaskBlockMax() const
+    {
+        return 0x3FFF; // 14 bits, 0n16383
+    }
+
+    // Sub-hwl interface
+    /// Pure virtual function to setup tile info (indices) if client requests to do so
+    virtual VOID HwlSetupTileInfo(
+        AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
+        AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
+
+    /// Pure virtual function to get pitch alignment for linear modes
+    virtual UINT_32 HwlGetPitchAlignmentLinear(UINT_32 bpp, ADDR_SURFACE_FLAGS flags) const = 0;
+
+    /// Pure virtual function to get size adjustment for linear modes
+    virtual UINT_64 HwlGetSizeAdjustmentLinear(
+        AddrTileMode tileMode,
+        UINT_32 bpp, UINT_32 numSamples, UINT_32 baseAlign, UINT_32 pitchAlign,
+        UINT_32 *pPitch, UINT_32 *pHeight, UINT_32 *pHeightAlign) const = 0;
+
+    virtual UINT_32 HwlGetPitchAlignmentMicroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples) const;
+
+    virtual UINT_64 HwlGetSizeAdjustmentMicroTiled(
+        UINT_32 thickness, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
+        UINT_32 baseAlign, UINT_32 pitchAlign,
+        UINT_32 *pPitch, UINT_32 *pHeight) const;
+
+        /// Pure virtual function to do extra sanity check
+    virtual BOOL_32 HwlSanityCheckMacroTiled(
+        ADDR_TILEINFO* pTileInfo) const = 0;
+
+    /// Pure virtual function to check current level to be the last macro tiled one
+    virtual VOID HwlCheckLastMacroTiledLvl(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
+
+    /// Adjusts bank before bank is modified by rotation
+    virtual UINT_32 HwlPreAdjustBank(
+        UINT_32 tileX, UINT_32 bank, ADDR_TILEINFO*  pTileInfo) const = 0;
+
+    virtual VOID HwlComputeSurfaceCoord2DFromBankPipe(
+        AddrTileMode tileMode, UINT_32* pX, UINT_32* pY, UINT_32 slice,
+        UINT_32 bank, UINT_32 pipe,
+        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
+        BOOL_32 ignoreSE,
+        ADDR_TILEINFO* pTileInfo) const = 0;
+
+    virtual BOOL_32 HwlTileInfoEqual(
+        const ADDR_TILEINFO* pLeft, const ADDR_TILEINFO* pRight) const;
+
+    virtual AddrTileMode HwlDegradeThickTileMode(
+        AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
+
+    virtual INT_32 HwlPostCheckTileIndex(
+        const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
+        INT curIndex = TileIndexInvalid) const
+    {
+        return TileIndexInvalid;
+    }
+
+    virtual VOID HwlFmaskPreThunkSurfInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
+        const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const
+    {
+    }
+
+    virtual VOID HwlFmaskPostThunkSurfInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const
+    {
+    }
+
+    virtual UINT_32 HwlStereoCheckRightOffsetPadding(ADDR_TILEINFO* pTileInfo) const;
+
+    virtual BOOL_32 HwlReduceBankWidthHeight(
+        UINT_32 tileSize, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
+        UINT_32 bankHeightAlign, UINT_32 pipes,
+        ADDR_TILEINFO* pTileInfo) const;
+
+    // Protected non-virtual functions
+
+    /// Mip level functions
+    AddrTileMode ComputeSurfaceMipLevelTileMode(
+        AddrTileMode baseTileMode, UINT_32 bpp,
+        UINT_32 pitch, UINT_32 height, UINT_32 numSlices, UINT_32 numSamples,
+        UINT_32 pitchAlign, UINT_32 heightAlign,
+        ADDR_TILEINFO* pTileInfo) const;
+
+    /// Swizzle functions
+    VOID ExtractBankPipeSwizzle(
+        UINT_32 base256b, ADDR_TILEINFO* pTileInfo,
+        UINT_32* pBankSwizzle, UINT_32* pPipeSwizzle) const;
+
+    UINT_32 GetBankPipeSwizzle(
+        UINT_32 bankSwizzle, UINT_32 pipeSwizzle,
+        UINT_64 baseAddr, ADDR_TILEINFO*  pTileInfo) const;
+
+    UINT_32 ComputeSliceTileSwizzle(
+        AddrTileMode tileMode, UINT_32 baseSwizzle, UINT_32 slice, UINT_64 baseAddr,
+        ADDR_TILEINFO* pTileInfo) const;
+
+    /// Addressing functions
+    virtual ADDR_E_RETURNCODE ComputeBankEquation(
+        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
+        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const
+    {
+        return ADDR_NOTSUPPORTED;
+    }
+
+    UINT_32 ComputeBankFromCoord(
+        UINT_32 x, UINT_32 y, UINT_32 slice,
+        AddrTileMode tileMode, UINT_32 bankSwizzle, UINT_32 tileSpitSlice,
+        ADDR_TILEINFO* pTileInfo) const;
+
+    UINT_32 ComputeBankFromAddr(
+        UINT_64 addr, UINT_32 numBanks, UINT_32 numPipes) const;
+
+    UINT_32 ComputePipeRotation(
+        AddrTileMode tileMode, UINT_32 numPipes) const;
+
+    UINT_32 ComputeBankRotation(
+        AddrTileMode tileMode, UINT_32 numBanks,
+        UINT_32 numPipes) const;
+
+    VOID ComputeSurfaceCoord2DFromBankPipe(
+        AddrTileMode tileMode, UINT_32 x, UINT_32 y, UINT_32 slice,
+        UINT_32 bank, UINT_32 pipe,
+        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
+        ADDR_TILEINFO* pTileInfo,
+        CoordFromBankPipe *pOutput) const;
+
+    /// Htile/Cmask functions
+    UINT_64 ComputeHtileBytes(
+        UINT_32 pitch, UINT_32 height, UINT_32 bpp,
+        BOOL_32 isLinear, UINT_32 numSlices, UINT_64* sliceBytes, UINT_32 baseAlign) const;
+
+    ADDR_E_RETURNCODE ComputeMacroTileEquation(
+        UINT_32 log2BytesPP, AddrTileMode tileMode, AddrTileType microTileType,
+        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
+
+    // Static functions
+    static BOOL_32 IsTileInfoAllZero(const ADDR_TILEINFO* pTileInfo);
+    static UINT_32 ComputeFmaskNumPlanesFromNumSamples(UINT_32 numSamples);
+    static UINT_32 ComputeFmaskResolvedBppFromNumSamples(UINT_32 numSamples);
+
+    virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
+    {
+    }
+
+private:
+
+    BOOL_32 ComputeSurfaceInfoLinear(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
+        UINT_32 padDims) const;
+
+    BOOL_32 ComputeSurfaceInfoMicroTiled(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
+        UINT_32 padDims,
+        AddrTileMode expTileMode) const;
+
+    BOOL_32 ComputeSurfaceInfoMacroTiled(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
+        UINT_32 padDims,
+        AddrTileMode expTileMode) const;
+
+    BOOL_32 ComputeSurfaceAlignmentsLinear(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32* pBaseAlign, UINT_32* pPitchAlign, UINT_32* pHeightAlign) const;
+
+    BOOL_32 ComputeSurfaceAlignmentsMicroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 mipLevel, UINT_32 numSamples,
+        UINT_32* pBaseAlign, UINT_32* pPitchAlign, UINT_32* pHeightAlign) const;
+
+    BOOL_32 ComputeSurfaceAlignmentsMacroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 mipLevel, UINT_32 numSamples,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    /// Surface addressing functions
+    UINT_64 DispatchComputeSurfaceAddrFromCoord(
+        const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    VOID DispatchComputeSurfaceCoordFromAddr(
+        const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
+
+    UINT_64 ComputeSurfaceAddrFromCoordMicroTiled(
+        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        AddrTileMode tileMode,
+        AddrTileType microTileType, BOOL_32 isDepthSampleOrder,
+        UINT_32* pBitPosition) const;
+
+    UINT_64 ComputeSurfaceAddrFromCoordMacroTiled(
+        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        AddrTileMode tileMode,
+        AddrTileType microTileType, BOOL_32 ignoreSE, BOOL_32 isDepthSampleOrder,
+        UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
+        ADDR_TILEINFO* pTileInfo,
+        UINT_32* pBitPosition) const;
+
+    VOID ComputeSurfaceCoordFromAddrMacroTiled(
+        UINT_64 addr, UINT_32 bitPosition,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
+        AddrTileType microTileType, BOOL_32 ignoreSE, BOOL_32 isDepthSampleOrder,
+        UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
+        ADDR_TILEINFO* pTileInfo,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample) const;
+
+    /// Fmask functions
+    UINT_64 DispatchComputeFmaskAddrFromCoord(
+        const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
+
+    VOID DispatchComputeFmaskCoordFromAddr(
+        const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
+        ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
+
+    // FMASK related methods - private
+    UINT_64 ComputeFmaskAddrFromCoordMicroTiled(
+        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample, UINT_32 plane,
+        UINT_32 pitch, UINT_32 height, UINT_32 numSamples, AddrTileMode tileMode,
+        BOOL_32 resolved, UINT_32* pBitPosition) const;
+
+    VOID ComputeFmaskCoordFromAddrMicroTiled(
+        UINT_64 addr, UINT_32 bitPosition,
+        UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        AddrTileMode tileMode, BOOL_32 resolved,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample, UINT_32* pPlane) const;
+
+    VOID ComputeFmaskCoordFromAddrMacroTiled(
+        UINT_64 addr, UINT_32 bitPosition,
+        UINT_32 pitch, UINT_32 height, UINT_32 numSamples, AddrTileMode tileMode,
+        UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
+        BOOL_32 ignoreSE,
+        ADDR_TILEINFO* pTileInfo,
+        BOOL_32 resolved,
+        UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample, UINT_32* pPlane) const;
+
+    UINT_64 ComputeFmaskAddrFromCoordMacroTiled(
+        UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample, UINT_32 plane,
+        UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        AddrTileMode tileMode, UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
+        BOOL_32 ignoreSE,
+        ADDR_TILEINFO* pTileInfo,
+        BOOL_32 resolved,
+        UINT_32* pBitPosition) const;
+
+    /// Sanity check functions
+    BOOL_32 SanityCheckMacroTiled(
+        ADDR_TILEINFO* pTileInfo) const;
+
+protected:
+    UINT_32 m_ranks;                ///< Number of ranks - MC_ARB_RAMCFG.NOOFRANK
+    UINT_32 m_logicalBanks;         ///< Logical banks = m_banks * m_ranks if m_banks != 16
+    UINT_32 m_bankInterleave;       ///< Bank interleave, as a multiple of pipe interleave size
+};
+
+} // V1
+} // Addr
+
+#endif
+
diff --git a/src/amd/addrlib/src/r800/siaddrlib.cpp b/src/amd/addrlib/src/r800/siaddrlib.cpp
new file mode 100644 (file)
index 0000000..da37ad8
--- /dev/null
@@ -0,0 +1,3872 @@
+/*
+ * Copyright © 2007-2018 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  siaddrlib.cpp
+* @brief Contains the implementation for the SiLib class.
+****************************************************************************************************
+*/
+
+#include "siaddrlib.h"
+#include "si_gb_reg.h"
+
+#include "amdgpu_asic_addr.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+namespace Addr
+{
+
+/**
+****************************************************************************************************
+*   SiHwlInit
+*
+*   @brief
+*       Creates an SiLib object.
+*
+*   @return
+*       Returns an SiLib object pointer.
+****************************************************************************************************
+*/
+Lib* SiHwlInit(const Client* pClient)
+{
+    return V1::SiLib::CreateObj(pClient);
+}
+
+namespace V1
+{
+
+// We don't support MSAA for equation
+const BOOL_32 SiLib::m_EquationSupport[SiLib::TileTableSize][SiLib::MaxNumElementBytes] =
+{
+    {TRUE,  TRUE,  TRUE,  FALSE, FALSE},    //  0, non-AA compressed depth or any stencil
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  1, 2xAA/4xAA compressed depth with or without stencil
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  2, 8xAA compressed depth with or without stencil
+    {FALSE, TRUE,  FALSE, FALSE, FALSE},    //  3, 16 bpp depth PRT (non-MSAA), don't support uncompressed depth
+    {TRUE,  TRUE,  TRUE,  FALSE, FALSE},    //  4, 1D depth
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  5, 16 bpp depth PRT (4xMSAA)
+    {FALSE, FALSE, TRUE,  FALSE, FALSE},    //  6, 32 bpp depth PRT (non-MSAA)
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    //  7, 32 bpp depth PRT (4xMSAA)
+    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    //  8, Linear
+    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    //  9, 1D display
+    {TRUE,  FALSE, FALSE, FALSE, FALSE},    // 10, 8 bpp color (displayable)
+    {FALSE, TRUE,  FALSE, FALSE, FALSE},    // 11, 16 bpp color (displayable)
+    {FALSE, FALSE, TRUE,  TRUE,  FALSE},    // 12, 32/64 bpp color (displayable)
+    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    // 13, 1D thin
+    {TRUE,  FALSE, FALSE, FALSE, FALSE},    // 14, 8 bpp color non-displayable
+    {FALSE, TRUE,  FALSE, FALSE, FALSE},    // 15, 16 bpp color non-displayable
+    {FALSE, FALSE, TRUE,  FALSE, FALSE},    // 16, 32 bpp color non-displayable
+    {FALSE, FALSE, FALSE, TRUE,  TRUE },    // 17, 64/128 bpp color non-displayable
+    {TRUE,  TRUE,  TRUE,  TRUE,  TRUE },    // 18, 1D THICK
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 19, 2D XTHICK
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 20, 2D THICK
+    {TRUE,  FALSE, FALSE, FALSE, FALSE},    // 21, 8 bpp 2D PRTs (non-MSAA)
+    {FALSE, TRUE,  FALSE, FALSE, FALSE},    // 22, 16 bpp 2D PRTs (non-MSAA)
+    {FALSE, FALSE, TRUE,  FALSE, FALSE},    // 23, 32 bpp 2D PRTs (non-MSAA)
+    {FALSE, FALSE, FALSE, TRUE,  FALSE},    // 24, 64 bpp 2D PRTs (non-MSAA)
+    {FALSE, FALSE, FALSE, FALSE, TRUE },    // 25, 128bpp 2D PRTs (non-MSAA)
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 26, none
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 27, none
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 28, none
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 29, none
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 30, 64bpp 2D PRTs (4xMSAA)
+    {FALSE, FALSE, FALSE, FALSE, FALSE},    // 31, none
+};
+
+/**
+****************************************************************************************************
+*   SiLib::SiLib
+*
+*   @brief
+*       Constructor
+*
+****************************************************************************************************
+*/
+SiLib::SiLib(const Client* pClient)
+    :
+    EgBasedLib(pClient),
+    m_noOfEntries(0),
+    m_numEquations(0)
+{
+    m_class = SI_ADDRLIB;
+    memset(&m_settings, 0, sizeof(m_settings));
+}
+
+/**
+****************************************************************************************************
+*   SiLib::~SiLib
+*
+*   @brief
+*       Destructor
+****************************************************************************************************
+*/
+SiLib::~SiLib()
+{
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlGetPipes
+*
+*   @brief
+*       Get number pipes
+*   @return
+*       num pipes
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlGetPipes(
+    const ADDR_TILEINFO* pTileInfo    ///< [in] Tile info
+    ) const
+{
+    UINT_32 numPipes;
+
+    if (pTileInfo)
+    {
+        numPipes = GetPipePerSurf(pTileInfo->pipeConfig);
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        numPipes = m_pipes; // Suppose we should still have a global pipes
+    }
+
+    return numPipes;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::GetPipePerSurf
+*   @brief
+*       get pipe num base on inputing tileinfo->pipeconfig
+*   @return
+*       pipe number
+****************************************************************************************************
+*/
+UINT_32 SiLib::GetPipePerSurf(
+    AddrPipeCfg pipeConfig   ///< [in] pipe config
+    ) const
+{
+    UINT_32 numPipes = 0;
+
+    switch (pipeConfig)
+    {
+        case ADDR_PIPECFG_P2:
+            numPipes = 2;
+            break;
+        case ADDR_PIPECFG_P4_8x16:
+        case ADDR_PIPECFG_P4_16x16:
+        case ADDR_PIPECFG_P4_16x32:
+        case ADDR_PIPECFG_P4_32x32:
+            numPipes = 4;
+            break;
+        case ADDR_PIPECFG_P8_16x16_8x16:
+        case ADDR_PIPECFG_P8_16x32_8x16:
+        case ADDR_PIPECFG_P8_32x32_8x16:
+        case ADDR_PIPECFG_P8_16x32_16x16:
+        case ADDR_PIPECFG_P8_32x32_16x16:
+        case ADDR_PIPECFG_P8_32x32_16x32:
+        case ADDR_PIPECFG_P8_32x64_32x32:
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P16_32x32_8x16:
+        case ADDR_PIPECFG_P16_32x32_16x16:
+            numPipes = 16;
+            break;
+        default:
+            ADDR_ASSERT(!"Invalid pipe config");
+            numPipes = m_pipes;
+    }
+    return numPipes;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::ComputeBankEquation
+*
+*   @brief
+*       Compute bank equation
+*
+*   @return
+*       If equation can be computed
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiLib::ComputeBankEquation(
+    UINT_32         log2BytesPP,    ///< [in] log2 of bytes per pixel
+    UINT_32         threshX,        ///< [in] threshold for x channel
+    UINT_32         threshY,        ///< [in] threshold for y channel
+    ADDR_TILEINFO*  pTileInfo,      ///< [in] tile info
+    ADDR_EQUATION*  pEquation       ///< [out] bank equation
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    UINT_32 pipes = HwlGetPipes(pTileInfo);
+    UINT_32 bankXStart = 3 + Log2(pipes) + Log2(pTileInfo->bankWidth);
+    UINT_32 bankYStart = 3 + Log2(pTileInfo->bankHeight);
+
+    ADDR_CHANNEL_SETTING x3 = InitChannel(1, 0, log2BytesPP + bankXStart);
+    ADDR_CHANNEL_SETTING x4 = InitChannel(1, 0, log2BytesPP + bankXStart + 1);
+    ADDR_CHANNEL_SETTING x5 = InitChannel(1, 0, log2BytesPP + bankXStart + 2);
+    ADDR_CHANNEL_SETTING x6 = InitChannel(1, 0, log2BytesPP + bankXStart + 3);
+    ADDR_CHANNEL_SETTING y3 = InitChannel(1, 1, bankYStart);
+    ADDR_CHANNEL_SETTING y4 = InitChannel(1, 1, bankYStart + 1);
+    ADDR_CHANNEL_SETTING y5 = InitChannel(1, 1, bankYStart + 2);
+    ADDR_CHANNEL_SETTING y6 = InitChannel(1, 1, bankYStart + 3);
+
+    x3.value = (threshX > bankXStart)     ? x3.value : 0;
+    x4.value = (threshX > bankXStart + 1) ? x4.value : 0;
+    x5.value = (threshX > bankXStart + 2) ? x5.value : 0;
+    x6.value = (threshX > bankXStart + 3) ? x6.value : 0;
+    y3.value = (threshY > bankYStart)     ? y3.value : 0;
+    y4.value = (threshY > bankYStart + 1) ? y4.value : 0;
+    y5.value = (threshY > bankYStart + 2) ? y5.value : 0;
+    y6.value = (threshY > bankYStart + 3) ? y6.value : 0;
+
+    switch (pTileInfo->banks)
+    {
+        case 16:
+            if (pTileInfo->macroAspectRatio == 1)
+            {
+                pEquation->addr[0] = y6;
+                pEquation->xor1[0] = x3;
+                pEquation->addr[1] = y5;
+                pEquation->xor1[1] = y6;
+                pEquation->xor2[1] = x4;
+                pEquation->addr[2] = y4;
+                pEquation->xor1[2] = x5;
+                pEquation->addr[3] = y3;
+                pEquation->xor1[3] = x6;
+            }
+            else if (pTileInfo->macroAspectRatio == 2)
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y6;
+                pEquation->addr[1] = y5;
+                pEquation->xor1[1] = y6;
+                pEquation->xor2[1] = x4;
+                pEquation->addr[2] = y4;
+                pEquation->xor1[2] = x5;
+                pEquation->addr[3] = y3;
+                pEquation->xor1[3] = x6;
+            }
+            else if (pTileInfo->macroAspectRatio == 4)
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y6;
+                pEquation->addr[1] = x4;
+                pEquation->xor1[1] = y5;
+                pEquation->xor2[1] = y6;
+                pEquation->addr[2] = y4;
+                pEquation->xor1[2] = x5;
+                pEquation->addr[3] = y3;
+                pEquation->xor1[3] = x6;
+            }
+            else if (pTileInfo->macroAspectRatio == 8)
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y6;
+                pEquation->addr[1] = x4;
+                pEquation->xor1[1] = y5;
+                pEquation->xor2[1] = y6;
+                pEquation->addr[2] = x5;
+                pEquation->xor1[2] = y4;
+                pEquation->addr[3] = y3;
+                pEquation->xor1[3] = x6;
+            }
+            else
+            {
+                ADDR_ASSERT_ALWAYS();
+            }
+            pEquation->numBits = 4;
+            break;
+        case 8:
+            if (pTileInfo->macroAspectRatio == 1)
+            {
+                pEquation->addr[0] = y5;
+                pEquation->xor1[0] = x3;
+                pEquation->addr[1] = y4;
+                pEquation->xor1[1] = y5;
+                pEquation->xor2[1] = x4;
+                pEquation->addr[2] = y3;
+                pEquation->xor1[2] = x5;
+            }
+            else if (pTileInfo->macroAspectRatio == 2)
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y5;
+                pEquation->addr[1] = y4;
+                pEquation->xor1[1] = y5;
+                pEquation->xor2[1] = x4;
+                pEquation->addr[2] = y3;
+                pEquation->xor1[2] = x5;
+            }
+            else if (pTileInfo->macroAspectRatio == 4)
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y5;
+                pEquation->addr[1] = x4;
+                pEquation->xor1[1] = y4;
+                pEquation->xor2[1] = y5;
+                pEquation->addr[2] = y3;
+                pEquation->xor1[2] = x5;
+            }
+            else
+            {
+                ADDR_ASSERT_ALWAYS();
+            }
+            pEquation->numBits = 3;
+            break;
+        case 4:
+            if (pTileInfo->macroAspectRatio == 1)
+            {
+                pEquation->addr[0] = y4;
+                pEquation->xor1[0] = x3;
+                pEquation->addr[1] = y3;
+                pEquation->xor1[1] = x4;
+            }
+            else if (pTileInfo->macroAspectRatio == 2)
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y4;
+                pEquation->addr[1] = y3;
+                pEquation->xor1[1] = x4;
+            }
+            else
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y4;
+                pEquation->addr[1] = x4;
+                pEquation->xor1[1] = y3;
+            }
+            pEquation->numBits = 2;
+            break;
+        case 2:
+            if (pTileInfo->macroAspectRatio == 1)
+            {
+                pEquation->addr[0] = y3;
+                pEquation->xor1[0] = x3;
+            }
+            else
+            {
+                pEquation->addr[0] = x3;
+                pEquation->xor1[0] = y3;
+            }
+            pEquation->numBits = 1;
+            break;
+        default:
+            pEquation->numBits = 0;
+            retCode = ADDR_NOTSUPPORTED;
+            ADDR_ASSERT_ALWAYS();
+            break;
+    }
+
+    for (UINT_32 i = 0; i < pEquation->numBits; i++)
+    {
+        if (pEquation->addr[i].value == 0)
+        {
+            if (pEquation->xor1[i].value == 0)
+            {
+                // 00X -> X00
+                pEquation->addr[i].value = pEquation->xor2[i].value;
+                pEquation->xor2[i].value = 0;
+            }
+            else
+            {
+                pEquation->addr[i].value = pEquation->xor1[i].value;
+
+                if (pEquation->xor2[i].value != 0)
+                {
+                    // 0XY -> XY0
+                    pEquation->xor1[i].value = pEquation->xor2[i].value;
+                    pEquation->xor2[i].value = 0;
+                }
+                else
+                {
+                    // 0X0 -> X00
+                    pEquation->xor1[i].value = 0;
+                }
+            }
+        }
+        else if (pEquation->xor1[i].value == 0)
+        {
+            if (pEquation->xor2[i].value != 0)
+            {
+                // X0Y -> XY0
+                pEquation->xor1[i].value = pEquation->xor2[i].value;
+                pEquation->xor2[i].value = 0;
+            }
+        }
+    }
+
+    if ((pTileInfo->bankWidth == 1) &&
+        ((pTileInfo->pipeConfig == ADDR_PIPECFG_P4_32x32) ||
+         (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32)))
+    {
+        retCode = ADDR_NOTSUPPORTED;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::ComputePipeEquation
+*
+*   @brief
+*       Compute pipe equation
+*
+*   @return
+*       If equation can be computed
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiLib::ComputePipeEquation(
+    UINT_32        log2BytesPP, ///< [in] Log2 of bytes per pixel
+    UINT_32        threshX,     ///< [in] Threshold for X channel
+    UINT_32        threshY,     ///< [in] Threshold for Y channel
+    ADDR_TILEINFO* pTileInfo,   ///< [in] Tile info
+    ADDR_EQUATION* pEquation    ///< [out] Pipe configure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode = ADDR_OK;
+
+    ADDR_CHANNEL_SETTING* pAddr = pEquation->addr;
+    ADDR_CHANNEL_SETTING* pXor1 = pEquation->xor1;
+    ADDR_CHANNEL_SETTING* pXor2 = pEquation->xor2;
+
+    ADDR_CHANNEL_SETTING x3 = InitChannel(1, 0, 3 + log2BytesPP);
+    ADDR_CHANNEL_SETTING x4 = InitChannel(1, 0, 4 + log2BytesPP);
+    ADDR_CHANNEL_SETTING x5 = InitChannel(1, 0, 5 + log2BytesPP);
+    ADDR_CHANNEL_SETTING x6 = InitChannel(1, 0, 6 + log2BytesPP);
+    ADDR_CHANNEL_SETTING y3 = InitChannel(1, 1, 3);
+    ADDR_CHANNEL_SETTING y4 = InitChannel(1, 1, 4);
+    ADDR_CHANNEL_SETTING y5 = InitChannel(1, 1, 5);
+    ADDR_CHANNEL_SETTING y6 = InitChannel(1, 1, 6);
+
+    x3.value = (threshX > 3) ? x3.value : 0;
+    x4.value = (threshX > 4) ? x4.value : 0;
+    x5.value = (threshX > 5) ? x5.value : 0;
+    x6.value = (threshX > 6) ? x6.value : 0;
+    y3.value = (threshY > 3) ? y3.value : 0;
+    y4.value = (threshY > 4) ? y4.value : 0;
+    y5.value = (threshY > 5) ? y5.value : 0;
+    y6.value = (threshY > 6) ? y6.value : 0;
+
+    switch (pTileInfo->pipeConfig)
+    {
+        case ADDR_PIPECFG_P2:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pEquation->numBits = 1;
+            break;
+        case ADDR_PIPECFG_P4_8x16:
+            pAddr[0] = x4;
+            pXor1[0] = y3;
+            pAddr[1] = x3;
+            pXor1[1] = y4;
+            pEquation->numBits = 2;
+            break;
+        case ADDR_PIPECFG_P4_16x16:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x4;
+            pAddr[1] = x4;
+            pXor1[1] = y4;
+            pEquation->numBits = 2;
+            break;
+        case ADDR_PIPECFG_P4_16x32:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x4;
+            pAddr[1] = x4;
+            pXor1[1] = y5;
+            pEquation->numBits = 2;
+            break;
+        case ADDR_PIPECFG_P4_32x32:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x5;
+            pAddr[1] = x5;
+            pXor1[1] = y5;
+            pEquation->numBits = 2;
+            break;
+        case ADDR_PIPECFG_P8_16x16_8x16:
+            pAddr[0] = x4;
+            pXor1[0] = y3;
+            pXor2[0] = x5;
+            pAddr[1] = x3;
+            pXor1[1] = y5;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P8_16x32_8x16:
+            pAddr[0] = x4;
+            pXor1[0] = y3;
+            pXor2[0] = x5;
+            pAddr[1] = x3;
+            pXor1[1] = y4;
+            pAddr[2] = x4;
+            pXor1[2] = y5;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P8_16x32_16x16:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x4;
+            pAddr[1] = x5;
+            pXor1[1] = y4;
+            pAddr[2] = x4;
+            pXor1[2] = y5;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P8_32x32_8x16:
+            pAddr[0] = x4;
+            pXor1[0] = y3;
+            pXor2[0] = x5;
+            pAddr[1] = x3;
+            pXor1[1] = y4;
+            pAddr[2] = x5;
+            pXor1[2] = y5;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x16:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x4;
+            pAddr[1] = x4;
+            pXor1[1] = y4;
+            pAddr[2] = x5;
+            pXor1[2] = y5;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x32:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x4;
+            pAddr[1] = x4;
+            pXor1[1] = y6;
+            pAddr[2] = x5;
+            pXor1[2] = y5;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P8_32x64_32x32:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x5;
+            pAddr[1] = x6;
+            pXor1[1] = y5;
+            pAddr[2] = x5;
+            pXor1[2] = y6;
+            pEquation->numBits = 3;
+            break;
+        case ADDR_PIPECFG_P16_32x32_8x16:
+            pAddr[0] = x4;
+            pXor1[0] = y3;
+            pAddr[1] = x3;
+            pXor1[1] = y4;
+            pAddr[2] = x5;
+            pXor1[2] = y6;
+            pAddr[3] = x6;
+            pXor1[3] = y5;
+            pEquation->numBits = 4;
+            break;
+        case ADDR_PIPECFG_P16_32x32_16x16:
+            pAddr[0] = x3;
+            pXor1[0] = y3;
+            pXor2[0] = x4;
+            pAddr[1] = x4;
+            pXor1[1] = y4;
+            pAddr[2] = x5;
+            pXor1[2] = y6;
+            pAddr[3] = x6;
+            pXor1[3] = y5;
+            pEquation->numBits = 4;
+            break;
+        default:
+            ADDR_UNHANDLED_CASE();
+            pEquation->numBits = 0;
+            retCode = ADDR_NOTSUPPORTED;
+            break;
+    }
+
+    if (m_settings.isVegaM && (pEquation->numBits == 4))
+    {
+        ADDR_CHANNEL_SETTING addeMsb = pAddr[0];
+        ADDR_CHANNEL_SETTING xor1Msb = pXor1[0];
+        ADDR_CHANNEL_SETTING xor2Msb = pXor2[0];
+
+        pAddr[0] = pAddr[1];
+        pXor1[0] = pXor1[1];
+        pXor2[0] = pXor2[1];
+
+        pAddr[1] = pAddr[2];
+        pXor1[1] = pXor1[2];
+        pXor2[1] = pXor2[2];
+
+        pAddr[2] = pAddr[3];
+        pXor1[2] = pXor1[3];
+        pXor2[2] = pXor2[3];
+
+        pAddr[3] = addeMsb;
+        pXor1[3] = xor1Msb;
+        pXor2[3] = xor2Msb;
+    }
+
+    for (UINT_32 i = 0; i < pEquation->numBits; i++)
+    {
+        if (pAddr[i].value == 0)
+        {
+            if (pXor1[i].value == 0)
+            {
+                pAddr[i].value = pXor2[i].value;
+            }
+            else
+            {
+                pAddr[i].value = pXor1[i].value;
+                pXor1[i].value = 0;
+            }
+        }
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::ComputePipeFromCoord
+*
+*   @brief
+*       Compute pipe number from coordinates
+*   @return
+*       Pipe number
+****************************************************************************************************
+*/
+UINT_32 SiLib::ComputePipeFromCoord(
+    UINT_32         x,              ///< [in] x coordinate
+    UINT_32         y,              ///< [in] y coordinate
+    UINT_32         slice,          ///< [in] slice index
+    AddrTileMode    tileMode,       ///< [in] tile mode
+    UINT_32         pipeSwizzle,    ///< [in] pipe swizzle
+    BOOL_32         ignoreSE,       ///< [in] TRUE if shader engines are ignored
+    ADDR_TILEINFO*  pTileInfo       ///< [in] Tile info
+    ) const
+{
+    UINT_32 pipe;
+    UINT_32 pipeBit0 = 0;
+    UINT_32 pipeBit1 = 0;
+    UINT_32 pipeBit2 = 0;
+    UINT_32 pipeBit3 = 0;
+    UINT_32 sliceRotation;
+    UINT_32 numPipes = 0;
+
+    UINT_32 tx = x / MicroTileWidth;
+    UINT_32 ty = y / MicroTileHeight;
+    UINT_32 x3 = _BIT(tx,0);
+    UINT_32 x4 = _BIT(tx,1);
+    UINT_32 x5 = _BIT(tx,2);
+    UINT_32 x6 = _BIT(tx,3);
+    UINT_32 y3 = _BIT(ty,0);
+    UINT_32 y4 = _BIT(ty,1);
+    UINT_32 y5 = _BIT(ty,2);
+    UINT_32 y6 = _BIT(ty,3);
+
+    switch (pTileInfo->pipeConfig)
+    {
+        case ADDR_PIPECFG_P2:
+            pipeBit0 = x3 ^ y3;
+            numPipes = 2;
+            break;
+        case ADDR_PIPECFG_P4_8x16:
+            pipeBit0 = x4 ^ y3;
+            pipeBit1 = x3 ^ y4;
+            numPipes = 4;
+            break;
+        case ADDR_PIPECFG_P4_16x16:
+            pipeBit0 = x3 ^ y3 ^ x4;
+            pipeBit1 = x4 ^ y4;
+            numPipes = 4;
+            break;
+        case ADDR_PIPECFG_P4_16x32:
+            pipeBit0 = x3 ^ y3 ^ x4;
+            pipeBit1 = x4 ^ y5;
+            numPipes = 4;
+            break;
+        case ADDR_PIPECFG_P4_32x32:
+            pipeBit0 = x3 ^ y3 ^ x5;
+            pipeBit1 = x5 ^ y5;
+            numPipes = 4;
+            break;
+        case ADDR_PIPECFG_P8_16x16_8x16:
+            pipeBit0 = x4 ^ y3 ^ x5;
+            pipeBit1 = x3 ^ y5;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P8_16x32_8x16:
+            pipeBit0 = x4 ^ y3 ^ x5;
+            pipeBit1 = x3 ^ y4;
+            pipeBit2 = x4 ^ y5;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P8_16x32_16x16:
+            pipeBit0 = x3 ^ y3 ^ x4;
+            pipeBit1 = x5 ^ y4;
+            pipeBit2 = x4 ^ y5;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P8_32x32_8x16:
+            pipeBit0 = x4 ^ y3 ^ x5;
+            pipeBit1 = x3 ^ y4;
+            pipeBit2 = x5 ^ y5;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x16:
+            pipeBit0 = x3 ^ y3 ^ x4;
+            pipeBit1 = x4 ^ y4;
+            pipeBit2 = x5 ^ y5;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x32:
+            pipeBit0 = x3 ^ y3 ^ x4;
+            pipeBit1 = x4 ^ y6;
+            pipeBit2 = x5 ^ y5;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P8_32x64_32x32:
+            pipeBit0 = x3 ^ y3 ^ x5;
+            pipeBit1 = x6 ^ y5;
+            pipeBit2 = x5 ^ y6;
+            numPipes = 8;
+            break;
+        case ADDR_PIPECFG_P16_32x32_8x16:
+            pipeBit0 = x4 ^ y3;
+            pipeBit1 = x3 ^ y4;
+            pipeBit2 = x5 ^ y6;
+            pipeBit3 = x6 ^ y5;
+            numPipes = 16;
+            break;
+        case ADDR_PIPECFG_P16_32x32_16x16:
+            pipeBit0 = x3 ^ y3 ^ x4;
+            pipeBit1 = x4 ^ y4;
+            pipeBit2 = x5 ^ y6;
+            pipeBit3 = x6 ^ y5;
+            numPipes = 16;
+            break;
+        default:
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    if (m_settings.isVegaM && (numPipes == 16))
+    {
+        UINT_32 pipeMsb = pipeBit0;
+        pipeBit0 = pipeBit1;
+        pipeBit1 = pipeBit2;
+        pipeBit2 = pipeBit3;
+        pipeBit3 = pipeMsb;
+    }
+
+    pipe = pipeBit0 | (pipeBit1 << 1) | (pipeBit2 << 2) | (pipeBit3 << 3);
+
+    UINT_32 microTileThickness = Thickness(tileMode);
+
+    //
+    // Apply pipe rotation for the slice.
+    //
+    switch (tileMode)
+    {
+        case ADDR_TM_3D_TILED_THIN1:    //fall through thin
+        case ADDR_TM_3D_TILED_THICK:    //fall through thick
+        case ADDR_TM_3D_TILED_XTHICK:
+            sliceRotation =
+                Max(1, static_cast<INT_32>(numPipes / 2) - 1) * (slice / microTileThickness);
+            break;
+        default:
+            sliceRotation = 0;
+            break;
+    }
+    pipeSwizzle += sliceRotation;
+    pipeSwizzle &= (numPipes - 1);
+
+    pipe = pipe ^ pipeSwizzle;
+
+    return pipe;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::ComputeTileCoordFromPipeAndElemIdx
+*
+*   @brief
+*       Compute (x,y) of a tile within a macro tile from address
+*   @return
+*       Pipe number
+****************************************************************************************************
+*/
+VOID SiLib::ComputeTileCoordFromPipeAndElemIdx(
+    UINT_32         elemIdx,          ///< [in] per pipe element index within a macro tile
+    UINT_32         pipe,             ///< [in] pipe index
+    AddrPipeCfg     pipeCfg,          ///< [in] pipe config
+    UINT_32         pitchInMacroTile, ///< [in] surface pitch in macro tile
+    UINT_32         x,                ///< [in] x coordinate of the (0,0) tile in a macro tile
+    UINT_32         y,                ///< [in] y coordinate of the (0,0) tile in a macro tile
+    UINT_32*        pX,               ///< [out] x coordinate
+    UINT_32*        pY                ///< [out] y coordinate
+    ) const
+{
+    UINT_32 pipebit0 = _BIT(pipe,0);
+    UINT_32 pipebit1 = _BIT(pipe,1);
+    UINT_32 pipebit2 = _BIT(pipe,2);
+    UINT_32 pipebit3 = _BIT(pipe,3);
+    UINT_32 elemIdx0 = _BIT(elemIdx,0);
+    UINT_32 elemIdx1 = _BIT(elemIdx,1);
+    UINT_32 elemIdx2 = _BIT(elemIdx,2);
+    UINT_32 x3 = 0;
+    UINT_32 x4 = 0;
+    UINT_32 x5 = 0;
+    UINT_32 x6 = 0;
+    UINT_32 y3 = 0;
+    UINT_32 y4 = 0;
+    UINT_32 y5 = 0;
+    UINT_32 y6 = 0;
+
+    switch(pipeCfg)
+    {
+        case ADDR_PIPECFG_P2:
+            x4 = elemIdx2;
+            y4 = elemIdx1 ^ x4;
+            y3 = elemIdx0 ^ x4;
+            x3 = pipebit0 ^ y3;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P4_8x16:
+            x4 = elemIdx1;
+            y4 = elemIdx0 ^ x4;
+            x3 = pipebit1 ^ y4;
+            y3 = pipebit0 ^ x4;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P4_16x16:
+            x4 = elemIdx1;
+            y3 = elemIdx0 ^ x4;
+            y4 = pipebit1 ^ x4;
+            x3 = pipebit0 ^ y3 ^ x4;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P4_16x32:
+            x3 = elemIdx0 ^ pipebit0;
+            y5 = _BIT(y,5);
+            x4 = pipebit1 ^ y5;
+            y3 = pipebit0 ^ x3 ^ x4;
+            y4 = elemIdx1 ^ x4;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P4_32x32:
+            x4 = elemIdx2;
+            y3 = elemIdx0 ^ x4;
+            y4 = elemIdx1 ^ x4;
+            if((pitchInMacroTile % 2) == 0)
+            {   //even
+                y5 = _BIT(y,5);
+                x5 = pipebit1 ^ y5;
+                x3 = pipebit0 ^ y3 ^ x5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            else
+            {   //odd
+                x5 = _BIT(x,5);
+                x3 = pipebit0 ^ y3 ^ x5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(2, x4, x3);
+            }
+            break;
+        case ADDR_PIPECFG_P8_16x16_8x16:
+            x4 = elemIdx0;
+            y5 = _BIT(y,5);
+            x5 = _BIT(x,5);
+            x3 = pipebit1 ^ y5;
+            y4 = pipebit2 ^ x4;
+            y3 = pipebit0 ^ x5 ^ x4;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P8_16x32_8x16:
+            x3 = elemIdx0;
+            y4 = pipebit1 ^ x3;
+            y5 = _BIT(y,5);
+            x5 = _BIT(x,5);
+            x4 = pipebit2 ^ y5;
+            y3 = pipebit0 ^ x4 ^ x5;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P8_32x32_8x16:
+            x4 = elemIdx1;
+            y4 = elemIdx0 ^ x4;
+            x3 = pipebit1 ^ y4;
+            if((pitchInMacroTile % 2) == 0)
+            {  //even
+                y5 = _BIT(y,5);
+                x5 = _BIT(x,5);
+                x5 = pipebit2 ^ y5;
+                y3 = pipebit0 ^ x4 ^ x5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            else
+            {  //odd
+                x5 = _BIT(x,5);
+                y3 = pipebit0 ^ x4 ^ x5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(2, x4, x3);
+            }
+            break;
+        case ADDR_PIPECFG_P8_16x32_16x16:
+            x3 = elemIdx0;
+            x5 = _BIT(x,5);
+            y5 = _BIT(y,5);
+            x4 = pipebit2 ^ y5;
+            y4 = pipebit1 ^ x5;
+            y3 = pipebit0 ^ x3 ^ x4;
+            *pY = Bits2Number(2, y4, y3);
+            *pX = Bits2Number(2, x4, x3);
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x16:
+            x4 = elemIdx1;
+            y3 = elemIdx0 ^ x4;
+            x3 = y3^x4^pipebit0;
+            y4 = pipebit1 ^ x4;
+            if((pitchInMacroTile % 2) == 0)
+            {   //even
+                y5 = _BIT(y,5);
+                x5 = pipebit2 ^ y5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            else
+            {   //odd
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(2, x4, x3);
+            }
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x32:
+            if((pitchInMacroTile % 2) == 0)
+            {   //even
+                y5 = _BIT(y,5);
+                y6 = _BIT(y,6);
+                x4 = pipebit1 ^ y6;
+                y3 = elemIdx0 ^ x4;
+                y4 = elemIdx1 ^ x4;
+                x3 = pipebit0 ^ y3 ^ x4;
+                x5 = pipebit2 ^ y5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            else
+            {   //odd
+                y6 = _BIT(y,6);
+                x4 = pipebit1 ^ y6;
+                y3 = elemIdx0 ^ x4;
+                y4 = elemIdx1 ^ x4;
+                x3 = pipebit0 ^ y3 ^ x4;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(2, x4, x3);
+            }
+            break;
+        case ADDR_PIPECFG_P8_32x64_32x32:
+            x4 = elemIdx2;
+            y3 = elemIdx0 ^ x4;
+            y4 = elemIdx1 ^ x4;
+            if((pitchInMacroTile % 4) == 0)
+            {   //multiple of 4
+                y5 = _BIT(y,5);
+                y6 = _BIT(y,6);
+                x5 = pipebit2 ^ y6;
+                x6 = pipebit1 ^ y5;
+                x3 = pipebit0 ^ y3 ^ x5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(4, x6, x5, x4, x3);
+            }
+            else
+            {
+                y6 = _BIT(y,6);
+                x5 = pipebit2 ^ y6;
+                x3 = pipebit0 ^ y3 ^ x5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            break;
+        case ADDR_PIPECFG_P16_32x32_8x16:
+            x4 = elemIdx1;
+            y4 = elemIdx0 ^ x4;
+            y3 = pipebit0 ^ x4;
+            x3 = pipebit1 ^ y4;
+            if((pitchInMacroTile % 4) == 0)
+            {   //multiple of 4
+                y5 = _BIT(y,5);
+                y6 = _BIT(y,6);
+                x5 = pipebit2 ^ y6;
+                x6 = pipebit3 ^ y5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(4, x6, x5,x4, x3);
+            }
+            else
+            {
+                y6 = _BIT(y,6);
+                x5 = pipebit2 ^ y6;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            break;
+        case ADDR_PIPECFG_P16_32x32_16x16:
+            x4 = elemIdx1;
+            y3 = elemIdx0 ^ x4;
+            y4 = pipebit1 ^ x4;
+            x3 = pipebit0 ^ y3 ^ x4;
+            if((pitchInMacroTile % 4) == 0)
+            {   //multiple of 4
+                y5 = _BIT(y,5);
+                y6 = _BIT(y,6);
+                x5 = pipebit2 ^ y6;
+                x6 = pipebit3 ^ y5;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(4, x6, x5, x4, x3);
+            }
+            else
+            {
+                y6 = _BIT(y,6);
+                x5 = pipebit2 ^ y6;
+                *pY = Bits2Number(2, y4, y3);
+                *pX = Bits2Number(3, x5, x4, x3);
+            }
+            break;
+        default:
+            ADDR_UNHANDLED_CASE();
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::TileCoordToMaskElementIndex
+*
+*   @brief
+*       Compute element index from coordinates in tiles
+*   @return
+*       Element index
+****************************************************************************************************
+*/
+UINT_32 SiLib::TileCoordToMaskElementIndex(
+    UINT_32         tx,                 ///< [in] x coord, in Tiles
+    UINT_32         ty,                 ///< [in] y coord, in Tiles
+    AddrPipeCfg     pipeConfig,         ///< [in] pipe config
+    UINT_32*        macroShift,         ///< [out] macro shift
+    UINT_32*        elemIdxBits         ///< [out] tile offset bits
+    ) const
+{
+    UINT_32 elemIdx = 0;
+    UINT_32 elemIdx0, elemIdx1, elemIdx2;
+    UINT_32 tx0, tx1;
+    UINT_32 ty0, ty1;
+
+    tx0 = _BIT(tx,0);
+    tx1 = _BIT(tx,1);
+    ty0 = _BIT(ty,0);
+    ty1 = _BIT(ty,1);
+
+    switch(pipeConfig)
+    {
+        case ADDR_PIPECFG_P2:
+            *macroShift = 3;
+            *elemIdxBits =3;
+            elemIdx2 = tx1;
+            elemIdx1 = tx1 ^ ty1;
+            elemIdx0 = tx1 ^ ty0;
+            elemIdx = Bits2Number(3,elemIdx2,elemIdx1,elemIdx0);
+            break;
+        case ADDR_PIPECFG_P4_8x16:
+            *macroShift = 2;
+            *elemIdxBits =2;
+            elemIdx1 = tx1;
+            elemIdx0 = tx1 ^ ty1;
+            elemIdx = Bits2Number(2,elemIdx1,elemIdx0);
+            break;
+        case ADDR_PIPECFG_P4_16x16:
+            *macroShift = 2;
+            *elemIdxBits =2;
+            elemIdx0 = tx1^ty0;
+            elemIdx1 = tx1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P4_16x32:
+            *macroShift = 2;
+            *elemIdxBits =2;
+            elemIdx0 = tx1^ty0;
+            elemIdx1 = tx1^ty1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P4_32x32:
+            *macroShift = 2;
+            *elemIdxBits =3;
+            elemIdx0 = tx1^ty0;
+            elemIdx1 = tx1^ty1;
+            elemIdx2 = tx1;
+            elemIdx = Bits2Number(3, elemIdx2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P8_16x16_8x16:
+            *macroShift = 1;
+            *elemIdxBits =1;
+            elemIdx0 = tx1;
+            elemIdx = elemIdx0;
+            break;
+        case ADDR_PIPECFG_P8_16x32_8x16:
+            *macroShift = 1;
+            *elemIdxBits =1;
+            elemIdx0 = tx0;
+            elemIdx = elemIdx0;
+            break;
+        case ADDR_PIPECFG_P8_32x32_8x16:
+            *macroShift = 1;
+            *elemIdxBits =2;
+            elemIdx1 = tx1;
+            elemIdx0 = tx1^ty1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P8_16x32_16x16:
+            *macroShift = 1;
+            *elemIdxBits =1;
+            elemIdx0 = tx0;
+            elemIdx = elemIdx0;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x16:
+            *macroShift = 1;
+            *elemIdxBits =2;
+            elemIdx0 = tx1^ty0;
+            elemIdx1 = tx1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x32:
+            *macroShift = 1;
+            *elemIdxBits =2;
+            elemIdx0 =  tx1^ty0;
+            elemIdx1 = tx1^ty1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P8_32x64_32x32:
+            *macroShift = 1;
+            *elemIdxBits =3;
+            elemIdx0 = tx1^ty0;
+            elemIdx1 = tx1^ty1;
+            elemIdx2 = tx1;
+            elemIdx = Bits2Number(3, elemIdx2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P16_32x32_8x16:
+            *macroShift = 0;
+            *elemIdxBits =2;
+            elemIdx0 = tx1^ty1;
+            elemIdx1 = tx1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        case ADDR_PIPECFG_P16_32x32_16x16:
+            *macroShift = 0;
+            *elemIdxBits =2;
+            elemIdx0 = tx1^ty0;
+            elemIdx1 = tx1;
+            elemIdx = Bits2Number(2, elemIdx1, elemIdx0);
+            break;
+        default:
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    return elemIdx;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeTileDataWidthAndHeightLinear
+*
+*   @brief
+*       Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
+*
+*   @return
+*       N/A
+*
+*   @note
+*       MacroWidth and macroHeight are measured in pixels
+****************************************************************************************************
+*/
+VOID SiLib::HwlComputeTileDataWidthAndHeightLinear(
+    UINT_32*        pMacroWidth,     ///< [out] macro tile width
+    UINT_32*        pMacroHeight,    ///< [out] macro tile height
+    UINT_32         bpp,             ///< [in] bits per pixel
+    ADDR_TILEINFO*  pTileInfo        ///< [in] tile info
+    ) const
+{
+    ADDR_ASSERT(pTileInfo != NULL);
+    UINT_32 macroWidth;
+    UINT_32 macroHeight;
+
+    /// In linear mode, the htile or cmask buffer must be padded out to 4 tiles
+    /// but for P8_32x64_32x32, it must be padded out to 8 tiles
+    /// Actually there are more pipe configs which need 8-tile padding but SI family
+    /// has a bug which is fixed in CI family
+    if ((pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32) ||
+        (pTileInfo->pipeConfig == ADDR_PIPECFG_P16_32x32_8x16) ||
+        (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x32_16x16))
+    {
+        macroWidth  = 8*MicroTileWidth;
+        macroHeight = 8*MicroTileHeight;
+    }
+    else
+    {
+        macroWidth  = 4*MicroTileWidth;
+        macroHeight = 4*MicroTileHeight;
+    }
+
+    *pMacroWidth    = macroWidth;
+    *pMacroHeight   = macroHeight;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeHtileBytes
+*
+*   @brief
+*       Compute htile size in bytes
+*
+*   @return
+*       Htile size in bytes
+****************************************************************************************************
+*/
+UINT_64 SiLib::HwlComputeHtileBytes(
+    UINT_32     pitch,          ///< [in] pitch
+    UINT_32     height,         ///< [in] height
+    UINT_32     bpp,            ///< [in] bits per pixel
+    BOOL_32     isLinear,       ///< [in] if it is linear mode
+    UINT_32     numSlices,      ///< [in] number of slices
+    UINT_64*    pSliceBytes,    ///< [out] bytes per slice
+    UINT_32     baseAlign       ///< [in] base alignments
+    ) const
+{
+    return ComputeHtileBytes(pitch, height, bpp, isLinear, numSlices, pSliceBytes, baseAlign);
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeXmaskAddrFromCoord
+*
+*   @brief
+*       Compute address from coordinates for htile/cmask
+*   @return
+*       Byte address
+****************************************************************************************************
+*/
+UINT_64 SiLib::HwlComputeXmaskAddrFromCoord(
+    UINT_32        pitch,          ///< [in] pitch
+    UINT_32        height,         ///< [in] height
+    UINT_32        x,              ///< [in] x coord
+    UINT_32        y,              ///< [in] y coord
+    UINT_32        slice,          ///< [in] slice/depth index
+    UINT_32        numSlices,      ///< [in] number of slices
+    UINT_32        factor,         ///< [in] factor that indicates cmask(2) or htile(1)
+    BOOL_32        isLinear,       ///< [in] linear or tiled HTILE layout
+    BOOL_32        isWidth8,       ///< [in] TRUE if width is 8, FALSE means 4. It's register value
+    BOOL_32        isHeight8,      ///< [in] TRUE if width is 8, FALSE means 4. It's register value
+    ADDR_TILEINFO* pTileInfo,      ///< [in] Tile info
+    UINT_32*       pBitPosition    ///< [out] bit position inside a byte
+    ) const
+{
+    UINT_32 tx = x / MicroTileWidth;
+    UINT_32 ty = y / MicroTileHeight;
+    UINT_32 newPitch;
+    UINT_32 newHeight;
+    UINT_64 totalBytes;
+    UINT_32 macroWidth;
+    UINT_32 macroHeight;
+    UINT_64 pSliceBytes;
+    UINT_32 pBaseAlign;
+    UINT_32 tileNumPerPipe;
+    UINT_32 elemBits;
+
+    if (factor == 2) //CMASK
+    {
+        ADDR_CMASK_FLAGS flags = {{0}};
+
+        tileNumPerPipe = 256;
+
+        ComputeCmaskInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         pTileInfo,
+                         &newPitch,
+                         &newHeight,
+                         &totalBytes,
+                         &macroWidth,
+                         &macroHeight);
+        elemBits = CmaskElemBits;
+    }
+    else //HTile
+    {
+        ADDR_HTILE_FLAGS flags = {{0}};
+
+        tileNumPerPipe = 512;
+
+        ComputeHtileInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         TRUE,
+                         TRUE,
+                         pTileInfo,
+                         &newPitch,
+                         &newHeight,
+                         &totalBytes,
+                         &macroWidth,
+                         &macroHeight,
+                         &pSliceBytes,
+                         &pBaseAlign);
+        elemBits = 32;
+    }
+
+    const UINT_32 pitchInTile = newPitch / MicroTileWidth;
+    const UINT_32 heightInTile = newHeight / MicroTileWidth;
+    UINT_64 macroOffset; // Per pipe starting offset of the macro tile in which this tile lies.
+    UINT_64 microNumber; // Per pipe starting offset of the macro tile in which this tile lies.
+    UINT_32 microX;
+    UINT_32 microY;
+    UINT_64 microOffset;
+    UINT_32 microShift;
+    UINT_64 totalOffset;
+    UINT_32 elemIdxBits;
+    UINT_32 elemIdx =
+        TileCoordToMaskElementIndex(tx, ty, pTileInfo->pipeConfig, &microShift, &elemIdxBits);
+
+    UINT_32 numPipes = HwlGetPipes(pTileInfo);
+
+    if (isLinear)
+    {   //linear addressing
+        // Linear addressing is extremelly wasting memory if slice > 1, since each pipe has the full
+        // slice memory foot print instead of divided by numPipes.
+        microX = tx / 4; // Macro Tile is 4x4
+        microY = ty / 4 ;
+        microNumber = static_cast<UINT_64>(microX + microY * (pitchInTile / 4)) << microShift;
+
+        UINT_32 sliceBits = pitchInTile * heightInTile;
+
+        // do htile single slice alignment if the flag is true
+        if (m_configFlags.useHtileSliceAlign && (factor == 1))  //Htile
+        {
+            sliceBits = PowTwoAlign(sliceBits, BITS_TO_BYTES(HtileCacheBits) * numPipes / elemBits);
+        }
+        macroOffset = slice * (sliceBits / numPipes) * elemBits ;
+    }
+    else
+    {   //tiled addressing
+        const UINT_32 macroWidthInTile = macroWidth / MicroTileWidth; // Now in unit of Tiles
+        const UINT_32 macroHeightInTile = macroHeight / MicroTileHeight;
+        const UINT_32 pitchInCL = pitchInTile / macroWidthInTile;
+        const UINT_32 heightInCL = heightInTile / macroHeightInTile;
+
+        const UINT_32 macroX = x / macroWidth;
+        const UINT_32 macroY = y / macroHeight;
+        const UINT_32 macroNumber = macroX + macroY * pitchInCL + slice * pitchInCL * heightInCL;
+
+        // Per pipe starting offset of the cache line in which this tile lies.
+        microX = (x % macroWidth) / MicroTileWidth / 4; // Macro Tile is 4x4
+        microY = (y % macroHeight) / MicroTileHeight / 4 ;
+        microNumber = static_cast<UINT_64>(microX + microY * (macroWidth / MicroTileWidth / 4)) << microShift;
+
+        macroOffset = macroNumber * tileNumPerPipe * elemBits;
+    }
+
+    if(elemIdxBits == microShift)
+    {
+        microNumber += elemIdx;
+    }
+    else
+    {
+        microNumber >>= elemIdxBits;
+        microNumber <<= elemIdxBits;
+        microNumber += elemIdx;
+    }
+
+    microOffset = elemBits * microNumber;
+    totalOffset = microOffset + macroOffset;
+
+    UINT_32 pipe = ComputePipeFromCoord(x, y, 0, ADDR_TM_2D_TILED_THIN1, 0, FALSE, pTileInfo);
+    UINT_64 addrInBits = totalOffset % (m_pipeInterleaveBytes * 8) +
+                   pipe * (m_pipeInterleaveBytes * 8) +
+                   totalOffset / (m_pipeInterleaveBytes * 8) * (m_pipeInterleaveBytes * 8) * numPipes;
+    *pBitPosition = static_cast<UINT_32>(addrInBits) % 8;
+    UINT_64 addr = addrInBits / 8;
+
+    return addr;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeXmaskCoordFromAddr
+*
+*   @brief
+*       Compute the coord from an address of a cmask/htile
+*
+*   @return
+*       N/A
+*
+*   @note
+*       This method is reused by htile, so rename to Xmask
+****************************************************************************************************
+*/
+VOID SiLib::HwlComputeXmaskCoordFromAddr(
+    UINT_64         addr,           ///< [in] address
+    UINT_32         bitPosition,    ///< [in] bitPosition in a byte
+    UINT_32         pitch,          ///< [in] pitch
+    UINT_32         height,         ///< [in] height
+    UINT_32         numSlices,      ///< [in] number of slices
+    UINT_32         factor,         ///< [in] factor that indicates cmask or htile
+    BOOL_32         isLinear,       ///< [in] linear or tiled HTILE layout
+    BOOL_32         isWidth8,       ///< [in] Not used by SI
+    BOOL_32         isHeight8,      ///< [in] Not used by SI
+    ADDR_TILEINFO*  pTileInfo,      ///< [in] Tile info
+    UINT_32*        pX,             ///< [out] x coord
+    UINT_32*        pY,             ///< [out] y coord
+    UINT_32*        pSlice          ///< [out] slice index
+    ) const
+{
+    UINT_32 newPitch;
+    UINT_32 newHeight;
+    UINT_64 totalBytes;
+    UINT_32 clWidth;
+    UINT_32 clHeight;
+    UINT_32 tileNumPerPipe;
+    UINT_64 sliceBytes;
+
+    *pX = 0;
+    *pY = 0;
+    *pSlice = 0;
+
+    if (factor == 2) //CMASK
+    {
+        ADDR_CMASK_FLAGS flags = {{0}};
+
+        tileNumPerPipe = 256;
+
+        ComputeCmaskInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         pTileInfo,
+                         &newPitch,
+                         &newHeight,
+                         &totalBytes,
+                         &clWidth,
+                         &clHeight);
+    }
+    else //HTile
+    {
+        ADDR_HTILE_FLAGS flags = {{0}};
+
+        tileNumPerPipe = 512;
+
+        ComputeHtileInfo(flags,
+                         pitch,
+                         height,
+                         numSlices,
+                         isLinear,
+                         TRUE,
+                         TRUE,
+                         pTileInfo,
+                         &newPitch,
+                         &newHeight,
+                         &totalBytes,
+                         &clWidth,
+                         &clHeight,
+                         &sliceBytes);
+    }
+
+    const UINT_32 pitchInTile = newPitch / MicroTileWidth;
+    const UINT_32 heightInTile = newHeight / MicroTileWidth;
+    const UINT_32 pitchInMacroTile = pitchInTile / 4;
+    UINT_32 macroShift;
+    UINT_32 elemIdxBits;
+    // get macroShift and elemIdxBits
+    TileCoordToMaskElementIndex(0, 0, pTileInfo->pipeConfig, &macroShift, &elemIdxBits);
+
+    const UINT_32 numPipes = HwlGetPipes(pTileInfo);
+    const UINT_32 pipe = (UINT_32)((addr / m_pipeInterleaveBytes) % numPipes);
+    // per pipe
+    UINT_64 localOffset = (addr % m_pipeInterleaveBytes) +
+        (addr / m_pipeInterleaveBytes / numPipes)* m_pipeInterleaveBytes;
+
+    UINT_32 tileIndex;
+    if (factor == 2) //CMASK
+    {
+        tileIndex = (UINT_32)(localOffset * 2 + (bitPosition != 0));
+    }
+    else
+    {
+        tileIndex = (UINT_32)(localOffset / 4);
+    }
+
+    UINT_32 macroOffset;
+    if (isLinear)
+    {
+        UINT_32 sliceSizeInTile = pitchInTile * heightInTile;
+
+        // do htile single slice alignment if the flag is true
+        if (m_configFlags.useHtileSliceAlign && (factor == 1))  //Htile
+        {
+            sliceSizeInTile = PowTwoAlign(sliceSizeInTile, static_cast<UINT_32>(sliceBytes) / 64);
+        }
+        *pSlice = tileIndex / (sliceSizeInTile / numPipes);
+        macroOffset = tileIndex % (sliceSizeInTile / numPipes);
+    }
+    else
+    {
+        const UINT_32 clWidthInTile = clWidth / MicroTileWidth; // Now in unit of Tiles
+        const UINT_32 clHeightInTile = clHeight / MicroTileHeight;
+        const UINT_32 pitchInCL = pitchInTile / clWidthInTile;
+        const UINT_32 heightInCL = heightInTile / clHeightInTile;
+        const UINT_32 clIndex = tileIndex / tileNumPerPipe;
+
+        UINT_32 clX = clIndex % pitchInCL;
+        UINT_32 clY = (clIndex % (heightInCL * pitchInCL)) / pitchInCL;
+
+        *pX = clX * clWidthInTile * MicroTileWidth;
+        *pY = clY * clHeightInTile * MicroTileHeight;
+        *pSlice = clIndex / (heightInCL * pitchInCL);
+
+        macroOffset = tileIndex % tileNumPerPipe;
+    }
+
+    UINT_32 elemIdx = macroOffset & 7;
+    macroOffset >>= elemIdxBits;
+
+    if (elemIdxBits != macroShift)
+    {
+        macroOffset <<= (elemIdxBits - macroShift);
+
+        UINT_32 pipebit1 = _BIT(pipe,1);
+        UINT_32 pipebit2 = _BIT(pipe,2);
+        UINT_32 pipebit3 = _BIT(pipe,3);
+        if (pitchInMacroTile % 2)
+        {   //odd
+            switch (pTileInfo->pipeConfig)
+            {
+                case ADDR_PIPECFG_P4_32x32:
+                    macroOffset |= pipebit1;
+                    break;
+                case ADDR_PIPECFG_P8_32x32_8x16:
+                case ADDR_PIPECFG_P8_32x32_16x16:
+                case ADDR_PIPECFG_P8_32x32_16x32:
+                    macroOffset |= pipebit2;
+                    break;
+                default:
+                    break;
+            }
+
+        }
+
+        if (pitchInMacroTile % 4)
+        {
+            if (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32)
+            {
+                macroOffset |= (pipebit1<<1);
+            }
+            if((pTileInfo->pipeConfig == ADDR_PIPECFG_P16_32x32_8x16) ||
+               (pTileInfo->pipeConfig == ADDR_PIPECFG_P16_32x32_16x16))
+            {
+                macroOffset |= (pipebit3<<1);
+            }
+        }
+    }
+
+    UINT_32 macroX;
+    UINT_32 macroY;
+
+    if (isLinear)
+    {
+        macroX = macroOffset % pitchInMacroTile;
+        macroY = macroOffset / pitchInMacroTile;
+    }
+    else
+    {
+        const UINT_32 clWidthInMacroTile = clWidth / (MicroTileWidth * 4);
+        macroX = macroOffset % clWidthInMacroTile;
+        macroY = macroOffset / clWidthInMacroTile;
+    }
+
+    *pX += macroX * 4 * MicroTileWidth;
+    *pY += macroY * 4 * MicroTileHeight;
+
+    UINT_32 microX;
+    UINT_32 microY;
+    ComputeTileCoordFromPipeAndElemIdx(elemIdx, pipe, pTileInfo->pipeConfig, pitchInMacroTile,
+                                       *pX, *pY, &microX, &microY);
+
+    *pX += microX * MicroTileWidth;
+    *pY += microY * MicroTileWidth;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlGetPitchAlignmentLinear
+*   @brief
+*       Get pitch alignment
+*   @return
+*       pitch alignment
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlGetPitchAlignmentLinear(
+    UINT_32             bpp,    ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags   ///< [in] surface flags
+    ) const
+{
+    UINT_32 pitchAlign;
+
+    // Interleaved access requires a 256B aligned pitch, so fall back to pre-SI alignment
+    if (flags.interleaved)
+    {
+        pitchAlign = Max(64u, m_pipeInterleaveBytes / BITS_TO_BYTES(bpp));
+
+    }
+    else
+    {
+        pitchAlign = Max(8u, 64 / BITS_TO_BYTES(bpp));
+    }
+
+    return pitchAlign;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlGetSizeAdjustmentLinear
+*
+*   @brief
+*       Adjust linear surface pitch and slice size
+*
+*   @return
+*       Logical slice size in bytes
+****************************************************************************************************
+*/
+UINT_64 SiLib::HwlGetSizeAdjustmentLinear(
+    AddrTileMode        tileMode,       ///< [in] tile mode
+    UINT_32             bpp,            ///< [in] bits per pixel
+    UINT_32             numSamples,     ///< [in] number of samples
+    UINT_32             baseAlign,      ///< [in] base alignment
+    UINT_32             pitchAlign,     ///< [in] pitch alignment
+    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
+    UINT_32*            pHeight,        ///< [in,out] pointer to height
+    UINT_32*            pHeightAlign    ///< [in,out] pointer to height align
+    ) const
+{
+    UINT_64 sliceSize;
+    if (tileMode == ADDR_TM_LINEAR_GENERAL)
+    {
+        sliceSize = BITS_TO_BYTES(static_cast<UINT_64>(*pPitch) * (*pHeight) * bpp * numSamples);
+    }
+    else
+    {
+        UINT_32 pitch   = *pPitch;
+        UINT_32 height  = *pHeight;
+
+        UINT_32 pixelsPerPipeInterleave = m_pipeInterleaveBytes / BITS_TO_BYTES(bpp);
+        UINT_32 sliceAlignInPixel = pixelsPerPipeInterleave < 64 ? 64 : pixelsPerPipeInterleave;
+
+        // numSamples should be 1 in real cases (no MSAA for linear but TGL may pass non 1 value)
+        UINT_64 pixelPerSlice = static_cast<UINT_64>(pitch) * height * numSamples;
+
+        while (pixelPerSlice % sliceAlignInPixel)
+        {
+            pitch += pitchAlign;
+            pixelPerSlice = static_cast<UINT_64>(pitch) * height * numSamples;
+        }
+
+        *pPitch = pitch;
+
+        UINT_32 heightAlign = 1;
+
+        while ((pitch * heightAlign) % sliceAlignInPixel)
+        {
+            heightAlign++;
+        }
+
+        *pHeightAlign = heightAlign;
+
+        sliceSize = BITS_TO_BYTES(pixelPerSlice * bpp);
+    }
+
+    return sliceSize;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlPreHandleBaseLvl3xPitch
+*
+*   @brief
+*       Pre-handler of 3x pitch (96 bit) adjustment
+*
+*   @return
+*       Expected pitch
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlPreHandleBaseLvl3xPitch(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
+    UINT_32                                 expPitch    ///< [in] pitch
+    ) const
+{
+    ADDR_ASSERT(pIn->width == expPitch);
+
+    // From SI, if pow2Pad is 1 the pitch is expanded 3x first, then padded to pow2, so nothing to
+    // do here
+    if (pIn->flags.pow2Pad == FALSE)
+    {
+        Addr::V1::Lib::HwlPreHandleBaseLvl3xPitch(pIn, expPitch);
+    }
+    else
+    {
+        ADDR_ASSERT(IsPow2(expPitch));
+    }
+
+    return expPitch;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlPostHandleBaseLvl3xPitch
+*
+*   @brief
+*       Post-handler of 3x pitch adjustment
+*
+*   @return
+*       Expected pitch
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlPostHandleBaseLvl3xPitch(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,        ///< [in] input
+    UINT_32                                 expPitch    ///< [in] pitch
+    ) const
+{
+    /**
+     * @note The pitch will be divided by 3 in the end so the value will look odd but h/w should
+     *  be able to compute a correct pitch from it as h/w address library is doing the job.
+     */
+    // From SI, the pitch is expanded 3x first, then padded to pow2, so no special handler here
+    if (pIn->flags.pow2Pad == FALSE)
+    {
+        Addr::V1::Lib::HwlPostHandleBaseLvl3xPitch(pIn, expPitch);
+    }
+
+    return expPitch;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlGetPitchAlignmentMicroTiled
+*
+*   @brief
+*       Compute 1D tiled surface pitch alignment
+*
+*   @return
+*       pitch alignment
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlGetPitchAlignmentMicroTiled(
+    AddrTileMode        tileMode,          ///< [in] tile mode
+    UINT_32             bpp,               ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,             ///< [in] surface flags
+    UINT_32             numSamples         ///< [in] number of samples
+    ) const
+{
+    UINT_32 pitchAlign;
+
+    if (flags.qbStereo)
+    {
+        pitchAlign = EgBasedLib::HwlGetPitchAlignmentMicroTiled(tileMode,bpp,flags,numSamples);
+    }
+    else
+    {
+        pitchAlign = 8;
+    }
+
+    return pitchAlign;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlGetSizeAdjustmentMicroTiled
+*
+*   @brief
+*       Adjust 1D tiled surface pitch and slice size
+*
+*   @return
+*       Logical slice size in bytes
+****************************************************************************************************
+*/
+UINT_64 SiLib::HwlGetSizeAdjustmentMicroTiled(
+    UINT_32             thickness,      ///< [in] thickness
+    UINT_32             bpp,            ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS  flags,          ///< [in] surface flags
+    UINT_32             numSamples,     ///< [in] number of samples
+    UINT_32             baseAlign,      ///< [in] base alignment
+    UINT_32             pitchAlign,     ///< [in] pitch alignment
+    UINT_32*            pPitch,         ///< [in,out] pointer to pitch
+    UINT_32*            pHeight         ///< [in,out] pointer to height
+    ) const
+{
+    UINT_64 logicalSliceSize;
+    UINT_64 physicalSliceSize;
+
+    UINT_32 pitch   = *pPitch;
+    UINT_32 height  = *pHeight;
+
+    // Logical slice: pitch * height * bpp * numSamples (no 1D MSAA so actually numSamples == 1)
+    logicalSliceSize = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
+
+    // Physical slice: multiplied by thickness
+    physicalSliceSize =  logicalSliceSize * thickness;
+
+    // Pitch alignment is always 8, so if slice size is not padded to base alignment
+    // (pipe_interleave_size), we need to increase pitch
+    while ((physicalSliceSize % baseAlign) != 0)
+    {
+        pitch += pitchAlign;
+
+        logicalSliceSize = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
+
+        physicalSliceSize =  logicalSliceSize * thickness;
+    }
+
+#if !ALT_TEST
+    //
+    // Special workaround for depth/stencil buffer, use 8 bpp to align depth buffer again since
+    // the stencil plane may have larger pitch if the slice size is smaller than base alignment.
+    //
+    // Note: this actually does not work for mipmap but mipmap depth texture is not really
+    // sampled with mipmap.
+    //
+    if (flags.depth && (flags.noStencil == FALSE))
+    {
+        ADDR_ASSERT(numSamples == 1);
+
+        UINT_64 logicalSiceSizeStencil = static_cast<UINT_64>(pitch) * height; // 1 byte stencil
+
+        while ((logicalSiceSizeStencil % baseAlign) != 0)
+        {
+            pitch += pitchAlign; // Stencil plane's pitch alignment is the same as depth plane's
+
+            logicalSiceSizeStencil = static_cast<UINT_64>(pitch) * height;
+        }
+
+        if (pitch != *pPitch)
+        {
+            // If this is a mipmap, this padded one cannot be sampled as a whole mipmap!
+            logicalSliceSize = logicalSiceSizeStencil * BITS_TO_BYTES(bpp);
+        }
+    }
+#endif
+    *pPitch = pitch;
+
+    // No adjust for pHeight
+
+    return logicalSliceSize;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlConvertChipFamily
+*
+*   @brief
+*       Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
+*   @return
+*       ChipFamily
+****************************************************************************************************
+*/
+ChipFamily SiLib::HwlConvertChipFamily(
+    UINT_32 uChipFamily,        ///< [in] chip family defined in atiih.h
+    UINT_32 uChipRevision)      ///< [in] chip revision defined in "asic_family"_id.h
+{
+    ChipFamily family = ADDR_CHIP_FAMILY_SI;
+
+    switch (uChipFamily)
+    {
+        case FAMILY_SI:
+            m_settings.isSouthernIsland = 1;
+            m_settings.isTahiti     = ASICREV_IS_TAHITI_P(uChipRevision);
+            m_settings.isPitCairn   = ASICREV_IS_PITCAIRN_PM(uChipRevision);
+            m_settings.isCapeVerde  = ASICREV_IS_CAPEVERDE_M(uChipRevision);
+            m_settings.isOland      = ASICREV_IS_OLAND_M(uChipRevision);
+            m_settings.isHainan     = ASICREV_IS_HAINAN_V(uChipRevision);
+            break;
+        default:
+            ADDR_ASSERT(!"This should be a Fusion");
+            break;
+    }
+
+    return family;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlSetupTileInfo
+*
+*   @brief
+*       Setup default value of tile info for SI
+****************************************************************************************************
+*/
+VOID SiLib::HwlSetupTileInfo(
+    AddrTileMode                        tileMode,       ///< [in] Tile mode
+    ADDR_SURFACE_FLAGS                  flags,          ///< [in] Surface type flags
+    UINT_32                             bpp,            ///< [in] Bits per pixel
+    UINT_32                             pitch,          ///< [in] Pitch in pixels
+    UINT_32                             height,         ///< [in] Height in pixels
+    UINT_32                             numSamples,     ///< [in] Number of samples
+    ADDR_TILEINFO*                      pTileInfoIn,    ///< [in] Tile info input: NULL for default
+    ADDR_TILEINFO*                      pTileInfoOut,   ///< [out] Tile info output
+    AddrTileType                        inTileType,     ///< [in] Tile type
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*   pOut            ///< [out] Output
+    ) const
+{
+    UINT_32 thickness = Thickness(tileMode);
+    ADDR_TILEINFO* pTileInfo = pTileInfoOut;
+    INT index = TileIndexInvalid;
+
+    // Fail-safe code
+    if (IsLinear(tileMode) == FALSE)
+    {
+        // 128 bpp/thick tiling must be non-displayable.
+        // Fmask reuse color buffer's entry but bank-height field can be from another entry
+        // To simplify the logic, fmask entry should be picked from non-displayable ones
+        if (bpp == 128 || thickness > 1 || flags.fmask || flags.prt)
+        {
+            inTileType = ADDR_NON_DISPLAYABLE;
+        }
+
+        if (flags.depth || flags.stencil)
+        {
+            inTileType = ADDR_DEPTH_SAMPLE_ORDER;
+        }
+    }
+
+    // Partial valid fields are not allowed for SI.
+    if (IsTileInfoAllZero(pTileInfo))
+    {
+        if (IsMacroTiled(tileMode))
+        {
+            if (flags.prt)
+            {
+                if (numSamples == 1)
+                {
+                    if (flags.depth)
+                    {
+                        switch (bpp)
+                        {
+                            case 16:
+                                index = 3;
+                                break;
+                            case 32:
+                                index = 6;
+                                break;
+                            default:
+                                ADDR_ASSERT_ALWAYS();
+                                break;
+                        }
+                    }
+                    else
+                    {
+                        switch (bpp)
+                        {
+                            case 8:
+                                index = 21;
+                                break;
+                            case 16:
+                                index = 22;
+                                break;
+                            case 32:
+                                index = 23;
+                                break;
+                            case 64:
+                                index = 24;
+                                break;
+                            case 128:
+                                index = 25;
+                                break;
+                            default:
+                                break;
+                        }
+
+                        if (thickness > 1)
+                        {
+                            ADDR_ASSERT(bpp != 128);
+                            index += 5;
+                        }
+                    }
+                }
+                else
+                {
+                    ADDR_ASSERT(numSamples == 4);
+
+                    if (flags.depth)
+                    {
+                        switch (bpp)
+                        {
+                            case 16:
+                                index = 5;
+                                break;
+                            case 32:
+                                index = 7;
+                                break;
+                            default:
+                                ADDR_ASSERT_ALWAYS();
+                                break;
+                        }
+                    }
+                    else
+                    {
+                        switch (bpp)
+                        {
+                            case 8:
+                                index = 23;
+                                break;
+                            case 16:
+                                index = 24;
+                                break;
+                            case 32:
+                                index = 25;
+                                break;
+                            case 64:
+                                index = 30;
+                                break;
+                            default:
+                                ADDR_ASSERT_ALWAYS();
+                                break;
+                        }
+                    }
+                }
+            }//end of PRT part
+            // See table entries 0-7
+            else if (flags.depth || flags.stencil)
+            {
+                if (flags.compressZ)
+                {
+                    if (flags.stencil)
+                    {
+                        index = 0;
+                    }
+                    else
+                    {
+                        // optimal tile index for compressed depth/stencil.
+                        switch (numSamples)
+                        {
+                            case 1:
+                                index = 0;
+                                break;
+                            case 2:
+                            case 4:
+                                index = 1;
+                                break;
+                            case 8:
+                                index = 2;
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                }
+                else // unCompressZ
+                {
+                    index = 3;
+                }
+            }
+            else //non PRT & non Depth & non Stencil
+            {
+                // See table entries 9-12
+                if (inTileType == ADDR_DISPLAYABLE)
+                {
+                    switch (bpp)
+                    {
+                        case 8:
+                            index = 10;
+                            break;
+                        case 16:
+                            index = 11;
+                            break;
+                        case 32:
+                            index = 12;
+                            break;
+                        case 64:
+                            index = 12;
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                else
+                {
+                    // See table entries 13-17
+                    if (thickness == 1)
+                    {
+                        if (flags.fmask)
+                        {
+                            UINT_32 fmaskPixelSize = bpp * numSamples;
+
+                            switch (fmaskPixelSize)
+                            {
+                                case 8:
+                                    index = 14;
+                                    break;
+                                case 16:
+                                    index = 15;
+                                    break;
+                                case 32:
+                                    index = 16;
+                                    break;
+                                case 64:
+                                    index = 17;
+                                    break;
+                                default:
+                                    ADDR_ASSERT_ALWAYS();
+                            }
+                        }
+                        else
+                        {
+                            switch (bpp)
+                            {
+                                case 8:
+                                    index = 14;
+                                    break;
+                                case 16:
+                                    index = 15;
+                                    break;
+                                case 32:
+                                    index = 16;
+                                    break;
+                                case 64:
+                                    index = 17;
+                                    break;
+                                case 128:
+                                    index = 17;
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    }
+                    else // thick tiling - entries 18-20
+                    {
+                        switch (thickness)
+                        {
+                            case 4:
+                                index = 20;
+                                break;
+                            case 8:
+                                index = 19;
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                }
+            }
+        }
+        else
+        {
+            if (tileMode == ADDR_TM_LINEAR_ALIGNED)
+            {
+                index = 8;
+            }
+            else if (tileMode == ADDR_TM_LINEAR_GENERAL)
+            {
+                index = TileIndexLinearGeneral;
+            }
+            else
+            {
+                if (flags.depth || flags.stencil)
+                {
+                    index = 4;
+                }
+                else if (inTileType == ADDR_DISPLAYABLE)
+                {
+                    index = 9;
+                }
+                else if (thickness == 1)
+                {
+                    index = 13;
+                }
+                else
+                {
+                    index = 18;
+                }
+            }
+        }
+
+        if (index >= 0 && index <= 31)
+        {
+            *pTileInfo      = m_tileTable[index].info;
+            pOut->tileType  = m_tileTable[index].type;
+        }
+
+        if (index == TileIndexLinearGeneral)
+        {
+            *pTileInfo      = m_tileTable[8].info;
+            pOut->tileType  = m_tileTable[8].type;
+        }
+    }
+    else
+    {
+        if (pTileInfoIn)
+        {
+            if (flags.stencil && pTileInfoIn->tileSplitBytes == 0)
+            {
+                // Stencil always uses index 0
+                *pTileInfo = m_tileTable[0].info;
+            }
+        }
+        // Pass through tile type
+        pOut->tileType = inTileType;
+    }
+
+    pOut->tileIndex = index;
+    pOut->prtTileIndex = flags.prt;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::DecodeGbRegs
+*
+*   @brief
+*       Decodes GB_ADDR_CONFIG and noOfBanks/noOfRanks
+*
+*   @return
+*       TRUE if all settings are valid
+*
+****************************************************************************************************
+*/
+BOOL_32 SiLib::DecodeGbRegs(
+    const ADDR_REGISTER_VALUE* pRegValue) ///< [in] create input
+{
+    GB_ADDR_CONFIG  reg;
+    BOOL_32         valid = TRUE;
+
+    reg.val = pRegValue->gbAddrConfig;
+
+    switch (reg.f.pipe_interleave_size)
+    {
+        case ADDR_CONFIG_PIPE_INTERLEAVE_256B:
+            m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_256B;
+            break;
+        case ADDR_CONFIG_PIPE_INTERLEAVE_512B:
+            m_pipeInterleaveBytes = ADDR_PIPEINTERLEAVE_512B;
+            break;
+        default:
+            valid = FALSE;
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    switch (reg.f.row_size)
+    {
+        case ADDR_CONFIG_1KB_ROW:
+            m_rowSize = ADDR_ROWSIZE_1KB;
+            break;
+        case ADDR_CONFIG_2KB_ROW:
+            m_rowSize = ADDR_ROWSIZE_2KB;
+            break;
+        case ADDR_CONFIG_4KB_ROW:
+            m_rowSize = ADDR_ROWSIZE_4KB;
+            break;
+        default:
+            valid = FALSE;
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    switch (pRegValue->noOfBanks)
+    {
+        case 0:
+            m_banks = 4;
+            break;
+        case 1:
+            m_banks = 8;
+            break;
+        case 2:
+            m_banks = 16;
+            break;
+        default:
+            valid = FALSE;
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    switch (pRegValue->noOfRanks)
+    {
+        case 0:
+            m_ranks = 1;
+            break;
+        case 1:
+            m_ranks = 2;
+            break;
+        default:
+            valid = FALSE;
+            ADDR_UNHANDLED_CASE();
+            break;
+    }
+
+    m_logicalBanks = m_banks * m_ranks;
+
+    ADDR_ASSERT(m_logicalBanks <= 16);
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlInitGlobalParams
+*
+*   @brief
+*       Initializes global parameters
+*
+*   @return
+*       TRUE if all settings are valid
+*
+****************************************************************************************************
+*/
+BOOL_32 SiLib::HwlInitGlobalParams(
+    const ADDR_CREATE_INPUT* pCreateIn) ///< [in] create input
+{
+    BOOL_32 valid = TRUE;
+    const ADDR_REGISTER_VALUE* pRegValue = &pCreateIn->regValue;
+
+    valid = DecodeGbRegs(pRegValue);
+
+    if (valid)
+    {
+        if (m_settings.isTahiti || m_settings.isPitCairn)
+        {
+            m_pipes = 8;
+        }
+        else if (m_settings.isCapeVerde || m_settings.isOland)
+        {
+            m_pipes = 4;
+        }
+        else
+        {
+            // Hainan is 2-pipe (m_settings.isHainan == 1)
+            m_pipes = 2;
+        }
+
+        valid = InitTileSettingTable(pRegValue->pTileConfig, pRegValue->noOfEntries);
+
+        if (valid)
+        {
+            InitEquationTable();
+        }
+
+        m_maxSamples = 16;
+    }
+
+    return valid;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlConvertTileInfoToHW
+*   @brief
+*       Entry of si's ConvertTileInfoToHW
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiLib::HwlConvertTileInfoToHW(
+    const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
+    ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut      ///< [out] output structure
+    ) const
+{
+    ADDR_E_RETURNCODE retCode   = ADDR_OK;
+
+    retCode = EgBasedLib::HwlConvertTileInfoToHW(pIn, pOut);
+
+    if (retCode == ADDR_OK)
+    {
+        if (pIn->reverse == FALSE)
+        {
+            if (pIn->pTileInfo->pipeConfig == ADDR_PIPECFG_INVALID)
+            {
+                retCode = ADDR_INVALIDPARAMS;
+            }
+            else
+            {
+                pOut->pTileInfo->pipeConfig =
+                    static_cast<AddrPipeCfg>(pIn->pTileInfo->pipeConfig - 1);
+            }
+        }
+        else
+        {
+            pOut->pTileInfo->pipeConfig =
+                static_cast<AddrPipeCfg>(pIn->pTileInfo->pipeConfig + 1);
+        }
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeXmaskCoordYFrom8Pipe
+*
+*   @brief
+*       Compute the Y coord which will be added to Xmask Y
+*       coord.
+*   @return
+*       Y coord
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlComputeXmaskCoordYFrom8Pipe(
+    UINT_32         pipe,       ///< [in] pipe id
+    UINT_32         x           ///< [in] tile coord x, which is original x coord / 8
+    ) const
+{
+    // This function should never be called since it is 6xx/8xx specfic.
+    // Keep this empty implementation to avoid any mis-use.
+    ADDR_ASSERT_ALWAYS();
+
+    return 0;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeSurfaceCoord2DFromBankPipe
+*
+*   @brief
+*       Compute surface x,y coordinates from bank/pipe info
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID SiLib::HwlComputeSurfaceCoord2DFromBankPipe(
+    AddrTileMode        tileMode,   ///< [in] tile mode
+    UINT_32*            pX,         ///< [in,out] x coordinate
+    UINT_32*            pY,         ///< [in,out] y coordinate
+    UINT_32             slice,      ///< [in] slice index
+    UINT_32             bank,       ///< [in] bank number
+    UINT_32             pipe,       ///< [in] pipe number
+    UINT_32             bankSwizzle,///< [in] bank swizzle
+    UINT_32             pipeSwizzle,///< [in] pipe swizzle
+    UINT_32             tileSlices, ///< [in] slices in a micro tile
+    BOOL_32             ignoreSE,   ///< [in] TRUE if shader engines are ignored
+    ADDR_TILEINFO*      pTileInfo   ///< [in] bank structure. **All fields to be valid on entry**
+    ) const
+{
+    UINT_32 xBit;
+    UINT_32 yBit;
+    UINT_32 yBit3 = 0;
+    UINT_32 yBit4 = 0;
+    UINT_32 yBit5 = 0;
+    UINT_32 yBit6 = 0;
+
+    UINT_32 xBit3 = 0;
+    UINT_32 xBit4 = 0;
+    UINT_32 xBit5 = 0;
+
+    UINT_32 numPipes = GetPipePerSurf(pTileInfo->pipeConfig);
+
+    CoordFromBankPipe xyBits = {0};
+    ComputeSurfaceCoord2DFromBankPipe(tileMode, *pX, *pY, slice, bank, pipe,
+                                      bankSwizzle, pipeSwizzle, tileSlices, pTileInfo,
+                                      &xyBits);
+    yBit3 = xyBits.yBit3;
+    yBit4 = xyBits.yBit4;
+    yBit5 = xyBits.yBit5;
+    yBit6 = xyBits.yBit6;
+
+    xBit3 = xyBits.xBit3;
+    xBit4 = xyBits.xBit4;
+    xBit5 = xyBits.xBit5;
+
+    yBit = xyBits.yBits;
+
+    UINT_32 yBitTemp = 0;
+
+    if ((pTileInfo->pipeConfig == ADDR_PIPECFG_P4_32x32) ||
+        (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32))
+    {
+        ADDR_ASSERT(pTileInfo->bankWidth == 1 && pTileInfo->macroAspectRatio > 1);
+        UINT_32 yBitToCheck = QLog2(pTileInfo->banks) - 1;
+
+        ADDR_ASSERT(yBitToCheck <= 3);
+
+        yBitTemp = _BIT(yBit, yBitToCheck);
+
+        xBit3 = 0;
+    }
+
+    yBit = Bits2Number(4, yBit6, yBit5, yBit4, yBit3);
+    xBit = Bits2Number(3, xBit5, xBit4, xBit3);
+
+    *pY += yBit * pTileInfo->bankHeight * MicroTileHeight;
+    *pX += xBit * numPipes * pTileInfo->bankWidth * MicroTileWidth;
+
+    //calculate the bank and pipe bits in x, y
+    UINT_32 xTile; //x in micro tile
+    UINT_32 x3 = 0;
+    UINT_32 x4 = 0;
+    UINT_32 x5 = 0;
+    UINT_32 x6 = 0;
+    UINT_32 y = *pY;
+
+    UINT_32 pipeBit0 = _BIT(pipe,0);
+    UINT_32 pipeBit1 = _BIT(pipe,1);
+    UINT_32 pipeBit2 = _BIT(pipe,2);
+
+    UINT_32 y3 = _BIT(y, 3);
+    UINT_32 y4 = _BIT(y, 4);
+    UINT_32 y5 = _BIT(y, 5);
+    UINT_32 y6 = _BIT(y, 6);
+
+    // bankbit0 after ^x4^x5
+    UINT_32 bankBit00 = _BIT(bank,0);
+    UINT_32 bankBit0 = 0;
+
+    switch (pTileInfo->pipeConfig)
+    {
+        case ADDR_PIPECFG_P2:
+            x3 = pipeBit0 ^ y3;
+            break;
+        case ADDR_PIPECFG_P4_8x16:
+            x4 = pipeBit0 ^ y3;
+            x3 = pipeBit0 ^ y4;
+            break;
+        case ADDR_PIPECFG_P4_16x16:
+            x4 = pipeBit1 ^ y4;
+            x3 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P4_16x32:
+            x4 = pipeBit1 ^ y4;
+            x3 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P4_32x32:
+            x5 = pipeBit1 ^ y5;
+            x3 = pipeBit0 ^ y3 ^ x5;
+            bankBit0 = yBitTemp ^ x5;
+            x4 = bankBit00 ^ x5 ^ bankBit0;
+            *pX += x5 * 4 * 1 * 8; // x5 * num_pipes * bank_width * 8;
+            break;
+        case ADDR_PIPECFG_P8_16x16_8x16:
+            x3 = pipeBit1 ^ y5;
+            x4 = pipeBit2 ^ y4;
+            x5 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P8_16x32_8x16:
+            x3 = pipeBit1 ^ y4;
+            x4 = pipeBit2 ^ y5;
+            x5 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P8_32x32_8x16:
+            x3 = pipeBit1 ^ y4;
+            x5 = pipeBit2 ^ y5;
+            x4 = pipeBit0 ^ y3 ^ x5;
+            break;
+        case ADDR_PIPECFG_P8_16x32_16x16:
+            x4 = pipeBit2 ^ y5;
+            x5 = pipeBit1 ^ y4;
+            x3 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x16:
+            x5 = pipeBit2 ^ y5;
+            x4 = pipeBit1 ^ y4;
+            x3 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P8_32x32_16x32:
+            x5 = pipeBit2 ^ y5;
+            x4 = pipeBit1 ^ y6;
+            x3 = pipeBit0 ^ y3 ^ x4;
+            break;
+        case ADDR_PIPECFG_P8_32x64_32x32:
+            x6 = pipeBit1 ^ y5;
+            x5 = pipeBit2 ^ y6;
+            x3 = pipeBit0 ^ y3 ^ x5;
+            bankBit0 = yBitTemp ^ x6;
+            x4 = bankBit00 ^ x5 ^ bankBit0;
+            *pX += x6 * 8 * 1 * 8; // x6 * num_pipes * bank_width * 8;
+            break;
+        default:
+            ADDR_ASSERT_ALWAYS();
+    }
+
+    xTile = Bits2Number(3, x5, x4, x3);
+
+    *pX += xTile << 3;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlPreAdjustBank
+*
+*   @brief
+*       Adjust bank before calculating address acoording to bank/pipe
+*   @return
+*       Adjusted bank
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlPreAdjustBank(
+    UINT_32         tileX,      ///< [in] x coordinate in unit of tile
+    UINT_32         bank,       ///< [in] bank
+    ADDR_TILEINFO*  pTileInfo   ///< [in] tile info
+    ) const
+{
+    if (((pTileInfo->pipeConfig == ADDR_PIPECFG_P4_32x32) ||
+        (pTileInfo->pipeConfig == ADDR_PIPECFG_P8_32x64_32x32)) && (pTileInfo->bankWidth == 1))
+    {
+        UINT_32 bankBit0 = _BIT(bank, 0);
+        UINT_32 x4 = _BIT(tileX, 1);
+        UINT_32 x5 = _BIT(tileX, 2);
+
+        bankBit0 = bankBit0 ^ x4 ^ x5;
+        bank |= bankBit0;
+
+        ADDR_ASSERT(pTileInfo->macroAspectRatio > 1);
+    }
+
+    return bank;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeSurfaceInfo
+*
+*   @brief
+*       Entry of si's ComputeSurfaceInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiLib::HwlComputeSurfaceInfo(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,    ///< [in] input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut    ///< [out] output structure
+    ) const
+{
+    pOut->tileIndex = pIn->tileIndex;
+
+    ADDR_E_RETURNCODE retCode = EgBasedLib::HwlComputeSurfaceInfo(pIn, pOut);
+
+    UINT_32 tileIndex = static_cast<UINT_32>(pOut->tileIndex);
+
+    if (((pIn->flags.needEquation   == TRUE) ||
+         (pIn->flags.preferEquation == TRUE)) &&
+        (pIn->numSamples <= 1) &&
+        (tileIndex < TileTableSize))
+    {
+        static const UINT_32 SiUncompressDepthTileIndex = 3;
+
+        if ((pIn->numSlices > 1) &&
+            (IsMacroTiled(pOut->tileMode) == TRUE) &&
+            ((m_chipFamily == ADDR_CHIP_FAMILY_SI) ||
+             (IsPrtTileMode(pOut->tileMode) == FALSE)))
+        {
+            pOut->equationIndex = ADDR_INVALID_EQUATION_INDEX;
+        }
+        else if ((pIn->flags.prt == FALSE) &&
+                 (m_uncompressDepthEqIndex != 0) &&
+                 (tileIndex == SiUncompressDepthTileIndex))
+        {
+            pOut->equationIndex = m_uncompressDepthEqIndex + Log2(pIn->bpp >> 3);
+        }
+        else
+        {
+
+            pOut->equationIndex = m_equationLookupTable[Log2(pIn->bpp >> 3)][tileIndex];
+        }
+
+        if (pOut->equationIndex != ADDR_INVALID_EQUATION_INDEX)
+        {
+            pOut->blockWidth = m_blockWidth[pOut->equationIndex];
+
+            pOut->blockHeight = m_blockHeight[pOut->equationIndex];
+
+            pOut->blockSlices = m_blockSlices[pOut->equationIndex];
+        }
+    }
+    else
+    {
+        pOut->equationIndex = ADDR_INVALID_EQUATION_INDEX;
+    }
+
+    return retCode;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeMipLevel
+*   @brief
+*       Compute MipLevel info (including level 0)
+*   @return
+*       TRUE if HWL's handled
+****************************************************************************************************
+*/
+BOOL_32 SiLib::HwlComputeMipLevel(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn ///< [in,out] Input structure
+    ) const
+{
+    // basePitch is calculated from level 0 so we only check this for mipLevel > 0
+    if (pIn->mipLevel > 0)
+    {
+        // Note: Don't check expand 3x formats(96 bit) as the basePitch is not pow2 even if
+        // we explicity set pow2Pad flag. The 3x base pitch is padded to pow2 but after being
+        // divided by expandX factor (3) - to program texture pitch, the basePitch is never pow2.
+        if (ElemLib::IsExpand3x(pIn->format) == FALSE)
+        {
+            // Sublevel pitches are generated from base level pitch instead of width on SI
+            // If pow2Pad is 0, we don't assert - as this is not really used for a mip chain
+            ADDR_ASSERT((pIn->flags.pow2Pad == FALSE) ||
+                        ((pIn->basePitch != 0) && IsPow2(pIn->basePitch)));
+        }
+
+        if (pIn->basePitch != 0)
+        {
+            pIn->width = Max(1u, pIn->basePitch >> pIn->mipLevel);
+        }
+    }
+
+    // pow2Pad is done in PostComputeMipLevel
+
+    return TRUE;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlCheckLastMacroTiledLvl
+*
+*   @brief
+*       Sets pOut->last2DLevel to TRUE if it is
+*   @note
+*
+****************************************************************************************************
+*/
+VOID SiLib::HwlCheckLastMacroTiledLvl(
+    const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] Input structure
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut      ///< [in,out] Output structure (used as input, too)
+    ) const
+{
+    // pow2Pad covers all mipmap cases
+    if (pIn->flags.pow2Pad)
+    {
+        ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
+
+        UINT_32 nextPitch;
+        UINT_32 nextHeight;
+        UINT_32 nextSlices;
+
+        AddrTileMode nextTileMode;
+
+        if (pIn->mipLevel == 0 || pIn->basePitch == 0)
+        {
+            // Base level or fail-safe case (basePitch == 0)
+            nextPitch = pOut->pitch >> 1;
+        }
+        else
+        {
+            // Sub levels
+            nextPitch = pIn->basePitch >> (pIn->mipLevel + 1);
+        }
+
+        // nextHeight must be shifted from this level's original height rather than a pow2 padded
+        // one but this requires original height stored somewhere (pOut->height)
+        ADDR_ASSERT(pOut->height != 0);
+
+        // next level's height is just current level's >> 1 in pixels
+        nextHeight = pOut->height >> 1;
+        // Special format such as FMT_1 and FMT_32_32_32 can be linear only so we consider block
+        // compressed foramts
+        if (ElemLib::IsBlockCompressed(pIn->format))
+        {
+            nextHeight = (nextHeight + 3) / 4;
+        }
+        nextHeight = NextPow2(nextHeight);
+
+        // nextSlices may be 0 if this level's is 1
+        if (pIn->flags.volume)
+        {
+            nextSlices = Max(1u, pIn->numSlices >> 1);
+        }
+        else
+        {
+            nextSlices = pIn->numSlices;
+        }
+
+        nextTileMode = ComputeSurfaceMipLevelTileMode(pIn->tileMode,
+                                                      pIn->bpp,
+                                                      nextPitch,
+                                                      nextHeight,
+                                                      nextSlices,
+                                                      pIn->numSamples,
+                                                      pOut->blockWidth,
+                                                      pOut->blockHeight,
+                                                      pOut->pTileInfo);
+
+        pOut->last2DLevel = IsMicroTiled(nextTileMode);
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlDegradeThickTileMode
+*
+*   @brief
+*       Degrades valid tile mode for thick modes if needed
+*
+*   @return
+*       Suitable tile mode
+****************************************************************************************************
+*/
+AddrTileMode SiLib::HwlDegradeThickTileMode(
+    AddrTileMode        baseTileMode,   ///< base tile mode
+    UINT_32             numSlices,      ///< current number of slices
+    UINT_32*            pBytesPerTile   ///< [in,out] pointer to bytes per slice
+    ) const
+{
+    return EgBasedLib::HwlDegradeThickTileMode(baseTileMode, numSlices, pBytesPerTile);
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlTileInfoEqual
+*
+*   @brief
+*       Return TRUE if all field are equal
+*   @note
+*       Only takes care of current HWL's data
+****************************************************************************************************
+*/
+BOOL_32 SiLib::HwlTileInfoEqual(
+    const ADDR_TILEINFO* pLeft, ///<[in] Left compare operand
+    const ADDR_TILEINFO* pRight ///<[in] Right compare operand
+    ) const
+{
+    BOOL_32 equal = FALSE;
+
+    if (pLeft->pipeConfig == pRight->pipeConfig)
+    {
+        equal =  EgBasedLib::HwlTileInfoEqual(pLeft, pRight);
+    }
+
+    return equal;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::GetTileSettings
+*
+*   @brief
+*       Get tile setting infos by index.
+*   @return
+*       Tile setting info.
+****************************************************************************************************
+*/
+const TileConfig* SiLib::GetTileSetting(
+    UINT_32 index          ///< [in] Tile index
+    ) const
+{
+    ADDR_ASSERT(index < m_noOfEntries);
+    return &m_tileTable[index];
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlPostCheckTileIndex
+*
+*   @brief
+*       Map a tile setting to index if curIndex is invalid, otherwise check if curIndex matches
+*       tile mode/type/info and change the index if needed
+*   @return
+*       Tile index.
+****************************************************************************************************
+*/
+INT_32 SiLib::HwlPostCheckTileIndex(
+    const ADDR_TILEINFO* pInfo,     ///< [in] Tile Info
+    AddrTileMode         mode,      ///< [in] Tile mode
+    AddrTileType         type,      ///< [in] Tile type
+    INT                  curIndex   ///< [in] Current index assigned in HwlSetupTileInfo
+    ) const
+{
+    INT_32 index = curIndex;
+
+    if (mode == ADDR_TM_LINEAR_GENERAL)
+    {
+        index = TileIndexLinearGeneral;
+    }
+    else
+    {
+        BOOL_32 macroTiled = IsMacroTiled(mode);
+
+        // We need to find a new index if either of them is true
+        // 1. curIndex is invalid
+        // 2. tile mode is changed
+        // 3. tile info does not match for macro tiled
+        if ((index == TileIndexInvalid         ||
+            (mode != m_tileTable[index].mode)  ||
+            (macroTiled && (HwlTileInfoEqual(pInfo, &m_tileTable[index].info) == FALSE))))
+        {
+            for (index = 0; index < static_cast<INT_32>(m_noOfEntries); index++)
+            {
+                if (macroTiled)
+                {
+                    // macro tile modes need all to match
+                    if (HwlTileInfoEqual(pInfo, &m_tileTable[index].info) &&
+                        (mode == m_tileTable[index].mode)                 &&
+                        (type == m_tileTable[index].type))
+                    {
+                        break;
+                    }
+                }
+                else if (mode == ADDR_TM_LINEAR_ALIGNED)
+                {
+                    // linear mode only needs tile mode to match
+                    if (mode == m_tileTable[index].mode)
+                    {
+                        break;
+                    }
+                }
+                else
+                {
+                    // micro tile modes only need tile mode and tile type to match
+                    if (mode == m_tileTable[index].mode &&
+                        type == m_tileTable[index].type)
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    ADDR_ASSERT(index < static_cast<INT_32>(m_noOfEntries));
+
+    if (index >= static_cast<INT_32>(m_noOfEntries))
+    {
+        index = TileIndexInvalid;
+    }
+
+    return index;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlSetupTileCfg
+*
+*   @brief
+*       Map tile index to tile setting.
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiLib::HwlSetupTileCfg(
+    UINT_32         bpp,            ///< Bits per pixel
+    INT_32          index,          ///< Tile index
+    INT_32          macroModeIndex, ///< Index in macro tile mode table(CI)
+    ADDR_TILEINFO*  pInfo,          ///< [out] Tile Info
+    AddrTileMode*   pMode,          ///< [out] Tile mode
+    AddrTileType*   pType           ///< [out] Tile type
+    ) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    // Global flag to control usage of tileIndex
+    if (UseTileIndex(index))
+    {
+        if (index == TileIndexLinearGeneral)
+        {
+            if (pMode)
+            {
+                *pMode = ADDR_TM_LINEAR_GENERAL;
+            }
+
+            if (pType)
+            {
+                *pType = ADDR_DISPLAYABLE;
+            }
+
+            if (pInfo)
+            {
+                pInfo->banks = 2;
+                pInfo->bankWidth = 1;
+                pInfo->bankHeight = 1;
+                pInfo->macroAspectRatio = 1;
+                pInfo->tileSplitBytes = 64;
+                pInfo->pipeConfig = ADDR_PIPECFG_P2;
+            }
+        }
+        else if (static_cast<UINT_32>(index) >= m_noOfEntries)
+        {
+            returnCode = ADDR_INVALIDPARAMS;
+        }
+        else
+        {
+            const TileConfig* pCfgTable = GetTileSetting(index);
+
+            if (pInfo)
+            {
+                *pInfo = pCfgTable->info;
+            }
+            else
+            {
+                if (IsMacroTiled(pCfgTable->mode))
+                {
+                    returnCode = ADDR_INVALIDPARAMS;
+                }
+            }
+
+            if (pMode)
+            {
+                *pMode = pCfgTable->mode;
+            }
+
+            if (pType)
+            {
+                *pType = pCfgTable->type;
+            }
+        }
+    }
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::ReadGbTileMode
+*
+*   @brief
+*       Convert GB_TILE_MODE HW value to TileConfig.
+*   @return
+*       NA.
+****************************************************************************************************
+*/
+VOID SiLib::ReadGbTileMode(
+    UINT_32     regValue,   ///< [in] GB_TILE_MODE register
+    TileConfig* pCfg        ///< [out] output structure
+    ) const
+{
+    GB_TILE_MODE gbTileMode;
+    gbTileMode.val = regValue;
+
+    pCfg->type = static_cast<AddrTileType>(gbTileMode.f.micro_tile_mode);
+    pCfg->info.bankHeight = 1 << gbTileMode.f.bank_height;
+    pCfg->info.bankWidth = 1 << gbTileMode.f.bank_width;
+    pCfg->info.banks = 1 << (gbTileMode.f.num_banks + 1);
+    pCfg->info.macroAspectRatio = 1 << gbTileMode.f.macro_tile_aspect;
+    pCfg->info.tileSplitBytes = 64 << gbTileMode.f.tile_split;
+    pCfg->info.pipeConfig = static_cast<AddrPipeCfg>(gbTileMode.f.pipe_config + 1);
+
+    UINT_32 regArrayMode = gbTileMode.f.array_mode;
+
+    pCfg->mode = static_cast<AddrTileMode>(regArrayMode);
+
+    if (regArrayMode == 8) //ARRAY_2D_TILED_XTHICK
+    {
+        pCfg->mode = ADDR_TM_2D_TILED_XTHICK;
+    }
+    else if (regArrayMode >= 14) //ARRAY_3D_TILED_XTHICK
+    {
+        pCfg->mode = static_cast<AddrTileMode>(pCfg->mode + 3);
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::InitTileSettingTable
+*
+*   @brief
+*       Initialize the ADDR_TILE_CONFIG table.
+*   @return
+*       TRUE if tile table is correctly initialized
+****************************************************************************************************
+*/
+BOOL_32 SiLib::InitTileSettingTable(
+    const UINT_32*  pCfg,           ///< [in] Pointer to table of tile configs
+    UINT_32         noOfEntries     ///< [in] Numbe of entries in the table above
+    )
+{
+    BOOL_32 initOk = TRUE;
+
+    ADDR_ASSERT(noOfEntries <= TileTableSize);
+
+    memset(m_tileTable, 0, sizeof(m_tileTable));
+
+    if (noOfEntries != 0)
+    {
+        m_noOfEntries = noOfEntries;
+    }
+    else
+    {
+        m_noOfEntries = TileTableSize;
+    }
+
+    if (pCfg) // From Client
+    {
+        for (UINT_32 i = 0; i < m_noOfEntries; i++)
+        {
+            ReadGbTileMode(*(pCfg + i), &m_tileTable[i]);
+        }
+    }
+    else
+    {
+        ADDR_ASSERT_ALWAYS();
+        initOk = FALSE;
+    }
+
+    if (initOk)
+    {
+        ADDR_ASSERT(m_tileTable[TILEINDEX_LINEAR_ALIGNED].mode == ADDR_TM_LINEAR_ALIGNED);
+    }
+
+    return initOk;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlGetTileIndex
+*
+*   @brief
+*       Return the virtual/real index for given mode/type/info
+*   @return
+*       ADDR_OK if successful.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiLib::HwlGetTileIndex(
+    const ADDR_GET_TILEINDEX_INPUT* pIn,
+    ADDR_GET_TILEINDEX_OUTPUT*      pOut) const
+{
+    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+    pOut->index = HwlPostCheckTileIndex(pIn->pTileInfo, pIn->tileMode, pIn->tileType);
+
+    return returnCode;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlFmaskPreThunkSurfInfo
+*
+*   @brief
+*       Some preparation before thunking a ComputeSurfaceInfo call for Fmask
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+VOID SiLib::HwlFmaskPreThunkSurfInfo(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT*    pFmaskIn,   ///< [in] Input of fmask info
+    const ADDR_COMPUTE_FMASK_INFO_OUTPUT*   pFmaskOut,  ///< [in] Output of fmask info
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*        pSurfIn,    ///< [out] Input of thunked surface info
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pSurfOut    ///< [out] Output of thunked surface info
+    ) const
+{
+    pSurfIn->tileIndex = pFmaskIn->tileIndex;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlFmaskPostThunkSurfInfo
+*
+*   @brief
+*       Copy hwl extra field after calling thunked ComputeSurfaceInfo
+*   @return
+*       ADDR_E_RETURNCODE
+****************************************************************************************************
+*/
+VOID SiLib::HwlFmaskPostThunkSurfInfo(
+    const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,   ///< [in] Output of surface info
+    ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut           ///< [out] Output of fmask info
+    ) const
+{
+    pFmaskOut->macroModeIndex = TileIndexInvalid;
+    pFmaskOut->tileIndex = pSurfOut->tileIndex;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeFmaskBits
+*   @brief
+*       Computes fmask bits
+*   @return
+*       Fmask bits
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlComputeFmaskBits(
+    const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+    UINT_32* pNumSamples
+    ) const
+{
+    UINT_32 numSamples = pIn->numSamples;
+    UINT_32 numFrags = GetNumFragments(numSamples, pIn->numFrags);
+    UINT_32 bpp;
+
+    if (numFrags != numSamples) // EQAA
+    {
+        ADDR_ASSERT(numFrags <= 8);
+
+        if (pIn->resolved == FALSE)
+        {
+            if (numFrags == 1)
+            {
+                bpp          = 1;
+                numSamples   = numSamples == 16 ? 16 : 8;
+            }
+            else if (numFrags == 2)
+            {
+                ADDR_ASSERT(numSamples >= 4);
+
+                bpp          = 2;
+                numSamples   = numSamples;
+            }
+            else if (numFrags == 4)
+            {
+                ADDR_ASSERT(numSamples >= 4);
+
+                bpp          = 4;
+                numSamples   = numSamples;
+            }
+            else // numFrags == 8
+            {
+                ADDR_ASSERT(numSamples == 16);
+
+                bpp          = 4;
+                numSamples   = numSamples;
+            }
+        }
+        else
+        {
+            if (numFrags == 1)
+            {
+                bpp          = (numSamples == 16) ? 16 : 8;
+                numSamples   = 1;
+            }
+            else if (numFrags == 2)
+            {
+                ADDR_ASSERT(numSamples >= 4);
+
+                bpp          = numSamples*2;
+                numSamples   = 1;
+            }
+            else if (numFrags == 4)
+            {
+                ADDR_ASSERT(numSamples >= 4);
+
+                bpp          = numSamples*4;
+                numSamples   = 1;
+            }
+            else // numFrags == 8
+            {
+                ADDR_ASSERT(numSamples >= 16);
+
+                bpp          = 16*4;
+                numSamples   = 1;
+            }
+        }
+    }
+    else // Normal AA
+    {
+        if (pIn->resolved == FALSE)
+        {
+            bpp          = ComputeFmaskNumPlanesFromNumSamples(numSamples);
+            numSamples   = numSamples == 2 ? 8 : numSamples;
+        }
+        else
+        {
+            // The same as 8XX
+            bpp          = ComputeFmaskResolvedBppFromNumSamples(numSamples);
+            numSamples   = 1; // 1x sample
+        }
+    }
+
+    SafeAssign(pNumSamples, numSamples);
+
+    return bpp;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlOptimizeTileMode
+*
+*   @brief
+*       Optimize tile mode on SI
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID SiLib::HwlOptimizeTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut      ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode = pInOut->tileMode;
+
+    if ((pInOut->flags.needEquation == TRUE) &&
+        (IsMacroTiled(tileMode) == TRUE) &&
+        (pInOut->numSamples <= 1))
+    {
+        UINT_32 thickness = Thickness(tileMode);
+
+        if (thickness > 1)
+        {
+            tileMode = ADDR_TM_1D_TILED_THICK;
+        }
+        else if (pInOut->numSlices > 1)
+        {
+            tileMode = ADDR_TM_1D_TILED_THIN1;
+        }
+        else
+        {
+            tileMode = ADDR_TM_2D_TILED_THIN1;
+        }
+    }
+
+    if (tileMode != pInOut->tileMode)
+    {
+        pInOut->tileMode = tileMode;
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlOverrideTileMode
+*
+*   @brief
+*       Override tile modes (for PRT only, avoid client passes in an invalid PRT mode for SI.
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID SiLib::HwlOverrideTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT*    pInOut          ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode = pInOut->tileMode;
+
+    switch (tileMode)
+    {
+        case ADDR_TM_PRT_TILED_THIN1:
+            tileMode = ADDR_TM_2D_TILED_THIN1;
+            break;
+
+        case ADDR_TM_PRT_TILED_THICK:
+            tileMode = ADDR_TM_2D_TILED_THICK;
+            break;
+
+        case ADDR_TM_PRT_2D_TILED_THICK:
+            tileMode = ADDR_TM_2D_TILED_THICK;
+            break;
+
+        case ADDR_TM_PRT_3D_TILED_THICK:
+            tileMode = ADDR_TM_3D_TILED_THICK;
+            break;
+
+        default:
+            break;
+    }
+
+    if (tileMode != pInOut->tileMode)
+    {
+        pInOut->tileMode  = tileMode;
+        // Only PRT tile modes are overridden for now. Revisit this once new modes are added above.
+        pInOut->flags.prt = TRUE;
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlSetPrtTileMode
+*
+*   @brief
+*       Set prt tile modes.
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID SiLib::HwlSetPrtTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
+    ) const
+{
+    pInOut->tileMode = ADDR_TM_2D_TILED_THIN1;
+    pInOut->tileType = (pInOut->tileType == ADDR_DEPTH_SAMPLE_ORDER) ?
+                       ADDR_DEPTH_SAMPLE_ORDER : ADDR_NON_DISPLAYABLE;
+    pInOut->flags.prt = TRUE;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlSelectTileMode
+*
+*   @brief
+*       Select tile modes.
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID SiLib::HwlSelectTileMode(
+    ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut     ///< [in,out] input output structure
+    ) const
+{
+    AddrTileMode tileMode;
+    AddrTileType tileType;
+
+    if (pInOut->flags.volume)
+    {
+        if (pInOut->numSlices >= 8)
+        {
+            tileMode = ADDR_TM_2D_TILED_XTHICK;
+        }
+        else if (pInOut->numSlices >= 4)
+        {
+            tileMode = ADDR_TM_2D_TILED_THICK;
+        }
+        else
+        {
+            tileMode = ADDR_TM_2D_TILED_THIN1;
+        }
+        tileType = ADDR_NON_DISPLAYABLE;
+    }
+    else
+    {
+        tileMode = ADDR_TM_2D_TILED_THIN1;
+
+        if (pInOut->flags.depth || pInOut->flags.stencil)
+        {
+            tileType = ADDR_DEPTH_SAMPLE_ORDER;
+        }
+        else if ((pInOut->bpp <= 32) ||
+                 (pInOut->flags.display == TRUE) ||
+                 (pInOut->flags.overlay == TRUE))
+        {
+            tileType = ADDR_DISPLAYABLE;
+        }
+        else
+        {
+            tileType = ADDR_NON_DISPLAYABLE;
+        }
+    }
+
+    if (pInOut->flags.prt)
+    {
+        tileMode = ADDR_TM_2D_TILED_THIN1;
+        tileType = (tileType == ADDR_DISPLAYABLE) ? ADDR_NON_DISPLAYABLE : tileType;
+    }
+
+    pInOut->tileMode = tileMode;
+    pInOut->tileType = tileType;
+
+    // Optimize tile mode if possible
+    pInOut->flags.opt4Space = TRUE;
+
+    // Optimize tile mode if possible
+    OptimizeTileMode(pInOut);
+
+    HwlOverrideTileMode(pInOut);
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeMaxBaseAlignments
+*
+*   @brief
+*       Gets maximum alignments
+*   @return
+*       maximum alignments
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlComputeMaxBaseAlignments() const
+{
+    const UINT_32 pipes = HwlGetPipes(&m_tileTable[0].info);
+
+    // Initial size is 64 KiB for PRT.
+    UINT_32 maxBaseAlign = 64 * 1024;
+
+    for (UINT_32 i = 0; i < m_noOfEntries; i++)
+    {
+        if ((IsMacroTiled(m_tileTable[i].mode) == TRUE) &&
+            (IsPrtTileMode(m_tileTable[i].mode) == FALSE))
+        {
+            // The maximum tile size is 16 byte-per-pixel and either 8-sample or 8-slice.
+            UINT_32 tileSize = Min(m_tileTable[i].info.tileSplitBytes,
+                                   MicroTilePixels * 8 * 16);
+
+            UINT_32 baseAlign = tileSize * pipes * m_tileTable[i].info.banks *
+                                m_tileTable[i].info.bankWidth * m_tileTable[i].info.bankHeight;
+
+            if (baseAlign > maxBaseAlign)
+            {
+                maxBaseAlign = baseAlign;
+            }
+        }
+    }
+
+    return maxBaseAlign;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeMaxMetaBaseAlignments
+*
+*   @brief
+*       Gets maximum alignments for metadata
+*   @return
+*       maximum alignments for metadata
+****************************************************************************************************
+*/
+UINT_32 SiLib::HwlComputeMaxMetaBaseAlignments() const
+{
+    UINT_32 maxPipe = 1;
+
+    for (UINT_32 i = 0; i < m_noOfEntries; i++)
+    {
+        maxPipe = Max(maxPipe, HwlGetPipes(&m_tileTable[i].info));
+    }
+
+    return m_pipeInterleaveBytes * maxPipe;
+}
+
+/**
+****************************************************************************************************
+*   SiLib::HwlComputeSurfaceAlignmentsMacroTiled
+*
+*   @brief
+*       Hardware layer function to compute alignment request for macro tile mode
+*
+*   @return
+*       N/A
+*
+****************************************************************************************************
+*/
+VOID SiLib::HwlComputeSurfaceAlignmentsMacroTiled(
+    AddrTileMode                      tileMode,           ///< [in] tile mode
+    UINT_32                           bpp,                ///< [in] bits per pixel
+    ADDR_SURFACE_FLAGS                flags,              ///< [in] surface flags
+    UINT_32                           mipLevel,           ///< [in] mip level
+    UINT_32                           numSamples,         ///< [in] number of samples
+    ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut                ///< [in,out] Surface output
+    ) const
+{
+    if ((mipLevel == 0) && (flags.prt))
+    {
+        UINT_32 macroTileSize = pOut->blockWidth * pOut->blockHeight * numSamples * bpp / 8;
+
+        if (macroTileSize < PrtTileSize)
+        {
+            UINT_32 numMacroTiles = PrtTileSize / macroTileSize;
+
+            ADDR_ASSERT((PrtTileSize % macroTileSize) == 0);
+
+            pOut->pitchAlign *= numMacroTiles;
+            pOut->baseAlign  *= numMacroTiles;
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::InitEquationTable
+*
+*   @brief
+*       Initialize Equation table.
+*
+*   @return
+*       N/A
+****************************************************************************************************
+*/
+VOID SiLib::InitEquationTable()
+{
+    ADDR_EQUATION_KEY equationKeyTable[EquationTableSize];
+    memset(equationKeyTable, 0, sizeof(equationKeyTable));
+
+    memset(m_equationTable, 0, sizeof(m_equationTable));
+
+    memset(m_blockWidth, 0, sizeof(m_blockWidth));
+
+    memset(m_blockHeight, 0, sizeof(m_blockHeight));
+
+    memset(m_blockSlices, 0, sizeof(m_blockSlices));
+
+    // Loop all possible bpp
+    for (UINT_32 log2ElementBytes = 0; log2ElementBytes < MaxNumElementBytes; log2ElementBytes++)
+    {
+        // Get bits per pixel
+        UINT_32 bpp = 1 << (log2ElementBytes + 3);
+
+        // Loop all possible tile index
+        for (INT_32 tileIndex = 0; tileIndex < static_cast<INT_32>(m_noOfEntries); tileIndex++)
+        {
+            UINT_32 equationIndex = ADDR_INVALID_EQUATION_INDEX;
+
+            TileConfig tileConfig = m_tileTable[tileIndex];
+
+            ADDR_SURFACE_FLAGS flags = {{0}};
+
+            // Compute tile info, hardcode numSamples to 1 because MSAA is not supported
+            // in swizzle pattern equation
+            HwlComputeMacroModeIndex(tileIndex, flags, bpp, 1, &tileConfig.info, NULL, NULL);
+
+            // Check if the input is supported
+            if (IsEquationSupported(bpp, tileConfig, tileIndex, log2ElementBytes) == TRUE)
+            {
+                ADDR_EQUATION_KEY  key   = {{0}};
+
+                // Generate swizzle equation key from bpp and tile config
+                key.fields.log2ElementBytes = log2ElementBytes;
+                key.fields.tileMode         = tileConfig.mode;
+                // Treat depth micro tile type and non-display micro tile type as the same key
+                // because they have the same equation actually
+                key.fields.microTileType    = (tileConfig.type == ADDR_DEPTH_SAMPLE_ORDER) ?
+                                              ADDR_NON_DISPLAYABLE : tileConfig.type;
+                key.fields.pipeConfig       = tileConfig.info.pipeConfig;
+                key.fields.numBanksLog2     = Log2(tileConfig.info.banks);
+                key.fields.bankWidth        = tileConfig.info.bankWidth;
+                key.fields.bankHeight       = tileConfig.info.bankHeight;
+                key.fields.macroAspectRatio = tileConfig.info.macroAspectRatio;
+                key.fields.prt              = ((m_chipFamily == ADDR_CHIP_FAMILY_SI) &&
+                                               ((1 << tileIndex) & SiPrtTileIndexMask)) ? 1 : 0;
+
+                // Find in the table if the equation has been built based on the key
+                for (UINT_32 i = 0; i < m_numEquations; i++)
+                {
+                    if (key.value == equationKeyTable[i].value)
+                    {
+                        equationIndex = i;
+                        break;
+                    }
+                }
+
+                // If found, just fill the index into the lookup table and no need
+                // to generate the equation again. Otherwise, generate the equation.
+                if (equationIndex == ADDR_INVALID_EQUATION_INDEX)
+                {
+                    ADDR_EQUATION equation;
+                    ADDR_E_RETURNCODE retCode;
+
+                    memset(&equation, 0, sizeof(ADDR_EQUATION));
+
+                    // Generate the equation
+                    if (IsMicroTiled(tileConfig.mode))
+                    {
+                        retCode = ComputeMicroTileEquation(log2ElementBytes,
+                                                           tileConfig.mode,
+                                                           tileConfig.type,
+                                                           &equation);
+                    }
+                    else
+                    {
+                        retCode = ComputeMacroTileEquation(log2ElementBytes,
+                                                           tileConfig.mode,
+                                                           tileConfig.type,
+                                                           &tileConfig.info,
+                                                           &equation);
+                    }
+                    // Only fill the equation into the table if the return code is ADDR_OK,
+                    // otherwise if the return code is not ADDR_OK, it indicates this is not
+                    // a valid input, we do nothing but just fill invalid equation index
+                    // into the lookup table.
+                    if (retCode == ADDR_OK)
+                    {
+                        equationIndex = m_numEquations;
+                        ADDR_ASSERT(equationIndex < EquationTableSize);
+
+                        m_blockSlices[equationIndex] = Thickness(tileConfig.mode);
+
+                        if (IsMicroTiled(tileConfig.mode))
+                        {
+                            m_blockWidth[equationIndex]  = MicroTileWidth;
+                            m_blockHeight[equationIndex] = MicroTileHeight;
+                        }
+                        else
+                        {
+                            const ADDR_TILEINFO* pTileInfo = &tileConfig.info;
+
+                            m_blockWidth[equationIndex]  =
+                                HwlGetPipes(pTileInfo) * MicroTileWidth * pTileInfo->bankWidth *
+                                pTileInfo->macroAspectRatio;
+                            m_blockHeight[equationIndex] =
+                                MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
+                                pTileInfo->macroAspectRatio;
+
+                            if (key.fields.prt)
+                            {
+                                UINT_32 macroTileSize =
+                                    m_blockWidth[equationIndex] * m_blockHeight[equationIndex] *
+                                    bpp / 8;
+
+                                if (macroTileSize < PrtTileSize)
+                                {
+                                    UINT_32 numMacroTiles = PrtTileSize / macroTileSize;
+
+                                    ADDR_ASSERT(macroTileSize == (1u << equation.numBits));
+                                    ADDR_ASSERT((PrtTileSize % macroTileSize) == 0);
+
+                                    UINT_32 numBits = Log2(numMacroTiles);
+
+                                    UINT_32 xStart = Log2(m_blockWidth[equationIndex]) +
+                                                     log2ElementBytes;
+
+                                    m_blockWidth[equationIndex] *= numMacroTiles;
+
+                                    for (UINT_32 i = 0; i < numBits; i++)
+                                    {
+                                        equation.addr[equation.numBits + i].valid = 1;
+                                        equation.addr[equation.numBits + i].index = xStart + i;
+                                    }
+
+                                    equation.numBits += numBits;
+                                }
+                            }
+                        }
+
+                        equationKeyTable[equationIndex] = key;
+                        m_equationTable[equationIndex]  = equation;
+
+                        m_numEquations++;
+                    }
+                }
+            }
+
+            // Fill the index into the lookup table, if the combination is not supported
+            // fill the invalid equation index
+            m_equationLookupTable[log2ElementBytes][tileIndex] = equationIndex;
+        }
+
+        if (m_chipFamily == ADDR_CHIP_FAMILY_SI)
+        {
+            // For tile index 3 which is shared between PRT depth and uncompressed depth
+            m_uncompressDepthEqIndex = m_numEquations;
+
+            for (UINT_32 log2ElemBytes = 0; log2ElemBytes < MaxNumElementBytes; log2ElemBytes++)
+            {
+                TileConfig        tileConfig = m_tileTable[3];
+                ADDR_EQUATION     equation;
+                ADDR_E_RETURNCODE retCode;
+
+                memset(&equation, 0, sizeof(ADDR_EQUATION));
+
+                retCode = ComputeMacroTileEquation(log2ElemBytes,
+                                                   tileConfig.mode,
+                                                   tileConfig.type,
+                                                   &tileConfig.info,
+                                                   &equation);
+
+                if (retCode == ADDR_OK)
+                {
+                    UINT_32 equationIndex = m_numEquations;
+                    ADDR_ASSERT(equationIndex < EquationTableSize);
+
+                    m_blockSlices[equationIndex] = 1;
+
+                    const ADDR_TILEINFO* pTileInfo = &tileConfig.info;
+
+                    m_blockWidth[equationIndex]  =
+                        HwlGetPipes(pTileInfo) * MicroTileWidth * pTileInfo->bankWidth *
+                        pTileInfo->macroAspectRatio;
+                    m_blockHeight[equationIndex] =
+                        MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
+                        pTileInfo->macroAspectRatio;
+
+                    m_equationTable[equationIndex] = equation;
+
+                    m_numEquations++;
+                }
+            }
+        }
+    }
+}
+
+/**
+****************************************************************************************************
+*   SiLib::IsEquationSupported
+*
+*   @brief
+*       Check if it is supported for given bpp and tile config to generate a equation.
+*
+*   @return
+*       TRUE if supported
+****************************************************************************************************
+*/
+BOOL_32 SiLib::IsEquationSupported(
+    UINT_32    bpp,             ///< Bits per pixel
+    TileConfig tileConfig,      ///< Tile config
+    INT_32     tileIndex,       ///< Tile index
+    UINT_32    elementBytesLog2 ///< Log2 of element bytes
+    ) const
+{
+    BOOL_32 supported = TRUE;
+
+    // Linear tile mode is not supported in swizzle pattern equation
+    if (IsLinear(tileConfig.mode))
+    {
+        supported = FALSE;
+    }
+    // These tile modes are for Tex2DArray and Tex3D which has depth (num_slice > 1) use,
+    // which is not supported in swizzle pattern equation due to slice rotation
+    else if ((tileConfig.mode == ADDR_TM_2D_TILED_THICK)  ||
+             (tileConfig.mode == ADDR_TM_2D_TILED_XTHICK) ||
+             (tileConfig.mode == ADDR_TM_3D_TILED_THIN1)  ||
+             (tileConfig.mode == ADDR_TM_3D_TILED_THICK)  ||
+             (tileConfig.mode == ADDR_TM_3D_TILED_XTHICK))
+    {
+        supported = FALSE;
+    }
+    // Only 8bpp(stencil), 16bpp and 32bpp is supported for depth
+    else if ((tileConfig.type == ADDR_DEPTH_SAMPLE_ORDER) && (bpp > 32))
+    {
+        supported = FALSE;
+    }
+    // Tile split is not supported in swizzle pattern equation
+    else if (IsMacroTiled(tileConfig.mode))
+    {
+        UINT_32 thickness = Thickness(tileConfig.mode);
+        if (((bpp >> 3) * MicroTilePixels * thickness) > tileConfig.info.tileSplitBytes)
+        {
+            supported = FALSE;
+        }
+
+        if ((supported == TRUE) && (m_chipFamily == ADDR_CHIP_FAMILY_SI))
+        {
+            supported = m_EquationSupport[tileIndex][elementBytesLog2];
+        }
+    }
+
+    return supported;
+}
+
+} // V1
+} // Addr
diff --git a/src/amd/addrlib/src/r800/siaddrlib.h b/src/amd/addrlib/src/r800/siaddrlib.h
new file mode 100644 (file)
index 0000000..7051411
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ * Copyright © 2007-2018 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  siaddrlib.h
+* @brief Contains the R800Lib class definition.
+****************************************************************************************************
+*/
+
+#ifndef __SI_ADDR_LIB_H__
+#define __SI_ADDR_LIB_H__
+
+#include "addrlib1.h"
+#include "egbaddrlib.h"
+
+namespace Addr
+{
+namespace V1
+{
+
+/**
+****************************************************************************************************
+* @brief Describes the information in tile mode table
+****************************************************************************************************
+*/
+struct TileConfig
+{
+    AddrTileMode  mode;
+    AddrTileType  type;
+    ADDR_TILEINFO info;
+};
+
+/**
+****************************************************************************************************
+* @brief SI specific settings structure.
+****************************************************************************************************
+*/
+struct SiChipSettings
+{
+    UINT_32 isSouthernIsland  : 1;
+    UINT_32 isTahiti          : 1;
+    UINT_32 isPitCairn        : 1;
+    UINT_32 isCapeVerde       : 1;
+    // Oland/Hainan are of GFXIP 6.0, similar with SI
+    UINT_32 isOland           : 1;
+    UINT_32 isHainan          : 1;
+
+    // CI
+    UINT_32 isSeaIsland       : 1;
+    UINT_32 isBonaire         : 1;
+    UINT_32 isKaveri          : 1;
+    UINT_32 isSpectre         : 1;
+    UINT_32 isSpooky          : 1;
+    UINT_32 isKalindi         : 1;
+    // Hawaii is GFXIP 7.2
+    UINT_32 isHawaii          : 1;
+
+    // VI
+    UINT_32 isVolcanicIslands : 1;
+    UINT_32 isIceland         : 1;
+    UINT_32 isTonga           : 1;
+    UINT_32 isFiji            : 1;
+    UINT_32 isPolaris10       : 1;
+    UINT_32 isPolaris11       : 1;
+    UINT_32 isPolaris12       : 1;
+    UINT_32 isVegaM           : 1;
+    UINT_32 isCarrizo         : 1;
+};
+
+/**
+****************************************************************************************************
+* @brief This class is the SI specific address library
+*        function set.
+****************************************************************************************************
+*/
+class SiLib : public EgBasedLib
+{
+public:
+    /// Creates SiLib object
+    static Addr::Lib* CreateObj(const Client* pClient)
+    {
+        VOID* pMem = Object::ClientAlloc(sizeof(SiLib), pClient);
+        return (pMem != NULL) ? new (pMem) SiLib(pClient) : NULL;
+    }
+
+protected:
+    SiLib(const Client* pClient);
+    virtual ~SiLib();
+
+    // Hwl interface - defined in AddrLib1
+    virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
+        const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
+        ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
+
+    virtual UINT_64 HwlComputeXmaskAddrFromCoord(
+        UINT_32 pitch, UINT_32 height, UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 numSlices,
+        UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
+        ADDR_TILEINFO* pTileInfo, UINT_32* pBitPosition) const;
+
+    virtual VOID HwlComputeXmaskCoordFromAddr(
+        UINT_64 addr, UINT_32 bitPosition, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
+        UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
+        ADDR_TILEINFO* pTileInfo, UINT_32* pX, UINT_32* pY, UINT_32* pSlice) const;
+
+    virtual ADDR_E_RETURNCODE HwlGetTileIndex(
+        const ADDR_GET_TILEINDEX_INPUT* pIn,
+        ADDR_GET_TILEINDEX_OUTPUT*      pOut) const;
+
+    virtual BOOL_32 HwlComputeMipLevel(
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
+
+    virtual ChipFamily HwlConvertChipFamily(
+        UINT_32 uChipFamily, UINT_32 uChipRevision);
+
+    virtual BOOL_32 HwlInitGlobalParams(
+        const ADDR_CREATE_INPUT* pCreateIn);
+
+    virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
+        UINT_32 bpp, INT_32 index, INT_32 macroModeIndex,
+        ADDR_TILEINFO* pInfo, AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
+
+    virtual VOID HwlComputeTileDataWidthAndHeightLinear(
+        UINT_32* pMacroWidth, UINT_32* pMacroHeight,
+        UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
+
+    virtual UINT_64 HwlComputeHtileBytes(
+        UINT_32 pitch, UINT_32 height, UINT_32 bpp,
+        BOOL_32 isLinear, UINT_32 numSlices, UINT_64* pSliceBytes, UINT_32 baseAlign) const;
+
+    virtual ADDR_E_RETURNCODE ComputeBankEquation(
+        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
+        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
+
+    virtual ADDR_E_RETURNCODE ComputePipeEquation(
+        UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
+        ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
+
+    virtual UINT_32 ComputePipeFromCoord(
+        UINT_32 x, UINT_32 y, UINT_32 slice,
+        AddrTileMode tileMode, UINT_32 pipeSwizzle, BOOL_32 ignoreSE,
+        ADDR_TILEINFO* pTileInfo) const;
+
+    virtual UINT_32 HwlGetPipes(const ADDR_TILEINFO* pTileInfo) const;
+
+    /// Pre-handler of 3x pitch (96 bit) adjustment
+    virtual UINT_32 HwlPreHandleBaseLvl3xPitch(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
+    /// Post-handler of 3x pitch adjustment
+    virtual UINT_32 HwlPostHandleBaseLvl3xPitch(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
+
+    /// Dummy function to finalize the inheritance
+    virtual UINT_32 HwlComputeXmaskCoordYFrom8Pipe(
+        UINT_32 pipe, UINT_32 x) const;
+
+    // Sub-hwl interface - defined in EgBasedLib
+    virtual VOID HwlSetupTileInfo(
+        AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
+        UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
+        ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
+        AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    virtual UINT_32 HwlGetPitchAlignmentMicroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples) const;
+
+    virtual UINT_64 HwlGetSizeAdjustmentMicroTiled(
+        UINT_32 thickness, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
+        UINT_32 baseAlign, UINT_32 pitchAlign,
+        UINT_32 *pPitch, UINT_32 *pHeight) const;
+
+    virtual VOID HwlCheckLastMacroTiledLvl(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    virtual BOOL_32 HwlTileInfoEqual(
+        const ADDR_TILEINFO* pLeft, const ADDR_TILEINFO* pRight) const;
+
+    virtual AddrTileMode HwlDegradeThickTileMode(
+        AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
+
+    virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    /// Overwrite tile setting to PRT
+    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    virtual BOOL_32 HwlSanityCheckMacroTiled(
+        ADDR_TILEINFO* pTileInfo) const
+    {
+        return TRUE;
+    }
+
+    virtual UINT_32 HwlGetPitchAlignmentLinear(UINT_32 bpp, ADDR_SURFACE_FLAGS flags) const;
+
+    virtual UINT_64 HwlGetSizeAdjustmentLinear(
+        AddrTileMode tileMode,
+        UINT_32 bpp, UINT_32 numSamples, UINT_32 baseAlign, UINT_32 pitchAlign,
+        UINT_32 *pPitch, UINT_32 *pHeight, UINT_32 *pHeightAlign) const;
+
+    virtual VOID HwlComputeSurfaceCoord2DFromBankPipe(
+        AddrTileMode tileMode, UINT_32* pX, UINT_32* pY, UINT_32 slice,
+        UINT_32 bank, UINT_32 pipe,
+        UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
+        BOOL_32 ignoreSE,
+        ADDR_TILEINFO* pTileInfo) const;
+
+    virtual UINT_32 HwlPreAdjustBank(
+        UINT_32 tileX, UINT_32 bank, ADDR_TILEINFO* pTileInfo) const;
+
+    virtual INT_32 HwlPostCheckTileIndex(
+        const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
+        INT curIndex = TileIndexInvalid) const;
+
+    virtual VOID HwlFmaskPreThunkSurfInfo(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
+        const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
+        ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
+        ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
+
+    virtual VOID HwlFmaskPostThunkSurfInfo(
+        const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
+        ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
+
+    virtual UINT_32 HwlComputeFmaskBits(
+        const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
+        UINT_32* pNumSamples) const;
+
+    virtual BOOL_32 HwlReduceBankWidthHeight(
+        UINT_32 tileSize, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
+        UINT_32 bankHeightAlign, UINT_32 pipes,
+        ADDR_TILEINFO* pTileInfo) const
+    {
+        return TRUE;
+    }
+
+    virtual UINT_32 HwlComputeMaxBaseAlignments() const;
+
+    virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
+
+    virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
+        AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
+        UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
+
+    // Get equation table pointer and number of equations
+    virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
+    {
+        *ppEquationTable = m_equationTable;
+
+        return m_numEquations;
+    }
+
+    // Check if it is supported for given bpp and tile config to generate an equation
+    BOOL_32 IsEquationSupported(
+        UINT_32 bpp, TileConfig tileConfig, INT_32 tileIndex, UINT_32 elementBytesLog2) const;
+
+    // Protected non-virtual functions
+    VOID ComputeTileCoordFromPipeAndElemIdx(
+        UINT_32 elemIdx, UINT_32 pipe, AddrPipeCfg pipeCfg, UINT_32 pitchInMacroTile,
+        UINT_32 x, UINT_32 y, UINT_32* pX, UINT_32* pY) const;
+
+    UINT_32 TileCoordToMaskElementIndex(
+        UINT_32 tx, UINT_32 ty, AddrPipeCfg  pipeConfig,
+        UINT_32 *macroShift, UINT_32 *elemIdxBits) const;
+
+    BOOL_32 DecodeGbRegs(
+        const ADDR_REGISTER_VALUE* pRegValue);
+
+    const TileConfig* GetTileSetting(
+        UINT_32 index) const;
+
+    // Initialize equation table
+    VOID InitEquationTable();
+
+    UINT_32 GetPipePerSurf(AddrPipeCfg pipeConfig) const;
+
+    static const UINT_32    TileTableSize = 32;
+    TileConfig              m_tileTable[TileTableSize];
+    UINT_32                 m_noOfEntries;
+
+    // Max number of bpp (8bpp/16bpp/32bpp/64bpp/128bpp)
+    static const UINT_32    MaxNumElementBytes  = 5;
+
+    static const BOOL_32    m_EquationSupport[TileTableSize][MaxNumElementBytes];
+
+    // Prt tile mode index mask
+    static const UINT_32    SiPrtTileIndexMask = ((1 << 3)  | (1 << 5)  | (1 << 6)  | (1 << 7)  |
+                                                  (1 << 21) | (1 << 22) | (1 << 23) | (1 << 24) |
+                                                  (1 << 25) | (1 << 30));
+
+    // More than half slots in tile mode table can't support equation
+    static const UINT_32    EquationTableSize   = (MaxNumElementBytes * TileTableSize) / 2;
+    // Equation table
+    ADDR_EQUATION           m_equationTable[EquationTableSize];
+    UINT_32                 m_numMacroBits[EquationTableSize];
+    UINT_32                 m_blockWidth[EquationTableSize];
+    UINT_32                 m_blockHeight[EquationTableSize];
+    UINT_32                 m_blockSlices[EquationTableSize];
+    // Number of equation entries in the table
+    UINT_32                 m_numEquations;
+    // Equation lookup table according to bpp and tile index
+    UINT_32                 m_equationLookupTable[MaxNumElementBytes][TileTableSize];
+
+    UINT_32                 m_uncompressDepthEqIndex;
+
+    SiChipSettings          m_settings;
+
+private:
+
+    VOID ReadGbTileMode(UINT_32 regValue, TileConfig* pCfg) const;
+    BOOL_32 InitTileSettingTable(const UINT_32 *pSetting, UINT_32 noOfEntries);
+};
+
+} // V1
+} // Addr
+
+#endif
+
index 4a79765d0044b98542b9dfed2cfc7f9fcae1b5c4..d8d927ee1c50ffa0ed6d3450a37209504f19f8b8 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "ac_surface.h"
 #include "amd_family.h"
-#include "addrlib/amdgpu_asic_addr.h"
+#include "addrlib/src/amdgpu_asic_addr.h"
 #include "ac_gpu_info.h"
 #include "util/macros.h"
 #include "util/u_atomic.h"
@@ -39,7 +39,7 @@
 #include <amdgpu.h>
 #include <amdgpu_drm.h>
 
-#include "addrlib/addrinterface.h"
+#include "addrlib/inc/addrinterface.h"
 
 #ifndef CIASICIDGFXENGINE_SOUTHERNISLAND
 #define CIASICIDGFXENGINE_SOUTHERNISLAND 0x0000000A
index 875ac70de1a4ba0e9572a77570602633d259c3a6..3f4cad861c281a26d65aae908f0c818e9bee4374 100644 (file)
@@ -29,7 +29,6 @@
 #include <errno.h>
 
 #include "radv_private.h"
-#include "addrlib/addrinterface.h"
 #include "util/bitset.h"
 #include "radv_amdgpu_winsys.h"
 #include "radv_amdgpu_surface.h"
index 40d35d557be6007ec5b6d2f76174b027e2e16a5c..80a1c6f2926b5d336499fbd370c9d5f3ea61d9b1 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "radv_radeon_winsys.h"
 #include "ac_gpu_info.h"
-#include "addrlib/addrinterface.h"
+#include "addrlib/inc/addrinterface.h"
 #include <amdgpu.h>
 #include "util/list.h"
 #include <pthread.h>
index 5ae1d3e55a396878583dfac15c491c30005a8be5..4f0b1262e30a0ff7b520fd614b8ab8c4421e4051 100644 (file)
@@ -31,7 +31,7 @@
 #include "pipebuffer/pb_cache.h"
 #include "pipebuffer/pb_slab.h"
 #include "gallium/drivers/radeon/radeon_winsys.h"
-#include "addrlib/addrinterface.h"
+#include "addrlib/inc/addrinterface.h"
 #include "util/simple_mtx.h"
 #include "util/u_queue.h"
 #include <amdgpu.h>