From 4340f9cf745f2f3122cdc652cbc63f4a4f253f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 27 Oct 2020 00:13:42 -0400 Subject: [PATCH] amd: update addrlib Acked-by: Pierre-Eric Pelloux-Prayer Acked-by: Bas Nieuwenhuizen Part-of: --- src/amd/addrlib/inc/addrinterface.h | 13 ++ src/amd/addrlib/inc/addrtypes.h | 2 +- src/amd/addrlib/src/core/addrcommon.h | 30 +-- src/amd/addrlib/src/core/addrlib.cpp | 2 +- src/amd/addrlib/src/core/addrlib2.cpp | 85 ++++++- src/amd/addrlib/src/core/addrlib2.h | 17 +- src/amd/addrlib/src/core/addrobject.cpp | 3 +- src/amd/addrlib/src/core/addrobject.h | 3 +- src/amd/addrlib/src/core/coord.h | 15 ++ src/amd/addrlib/src/gfx10/gfx10addrlib.cpp | 255 ++++++++++++--------- src/amd/addrlib/src/gfx10/gfx10addrlib.h | 12 +- src/amd/addrlib/src/gfx9/gfx9addrlib.cpp | 144 +++++++----- src/amd/addrlib/src/gfx9/gfx9addrlib.h | 9 +- src/amd/addrlib/src/r800/ciaddrlib.h | 2 + 14 files changed, 398 insertions(+), 194 deletions(-) diff --git a/src/amd/addrlib/inc/addrinterface.h b/src/amd/addrlib/inc/addrinterface.h index c05e6806893..caeb1b46010 100644 --- a/src/amd/addrlib/inc/addrinterface.h +++ b/src/amd/addrlib/inc/addrinterface.h @@ -33,6 +33,7 @@ #ifndef __ADDR_INTERFACE_H__ #define __ADDR_INTERFACE_H__ +// Includes should be before extern "C" #include "addrtypes.h" #if defined(__cplusplus) @@ -2724,6 +2725,7 @@ typedef struct _ADDR2_META_MIP_INFO UINT_32 depth; }; + // GFX10 struct { UINT_32 offset; ///< Metadata offset within one slice, @@ -2756,6 +2758,7 @@ typedef struct _ADDR2_COMPUTE_HTILE_INFO_INPUT 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 + /// Only for GFX10 } ADDR2_COMPUTE_HTILE_INFO_INPUT; /** @@ -2935,6 +2938,7 @@ 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 @@ -2943,6 +2947,7 @@ typedef struct _ADDR2_COMPUTE_CMASKINFO_INPUT UINT_32 numMipLevels; ///< Number of mip levels UINT_32 firstMipIdInTail; ///< The id of first mip in tail, if no mip is in tail, /// it should be number of mip levels + /// Only for GFX10 } ADDR2_COMPUTE_CMASK_INFO_INPUT; /** @@ -3007,6 +3012,7 @@ typedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 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 @@ -3067,6 +3073,7 @@ typedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT 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 @@ -3332,6 +3339,7 @@ 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 @@ -3344,6 +3352,7 @@ typedef struct _ADDR2_COMPUTE_DCCINFO_INPUT ///< 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 + /// Only for GFX10 } ADDR2_COMPUTE_DCCINFO_INPUT; /** @@ -3381,6 +3390,7 @@ typedef struct _ADDR2_COMPUTE_DCCINFO_OUTPUT 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 + /// Only for GFX10 }; ADDR2_META_MIP_INFO* pMipInfo; ///< DCC mip information @@ -3421,9 +3431,12 @@ typedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT 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 diff --git a/src/amd/addrlib/inc/addrtypes.h b/src/amd/addrlib/inc/addrtypes.h index fc2ddfc2525..5524f67cd45 100644 --- a/src/amd/addrlib/inc/addrtypes.h +++ b/src/amd/addrlib/inc/addrtypes.h @@ -87,7 +87,7 @@ typedef int INT; #endif #ifndef ADDR_FASTCALL - #if defined(__GNUC__) + #if defined(__GNUC__) || defined(BRAHMA_ARM) // We don't care about the performance of call instructions in addrlib #define ADDR_FASTCALL #else diff --git a/src/amd/addrlib/src/core/addrcommon.h b/src/amd/addrlib/src/core/addrcommon.h index 9b76c53474f..6114fbbb07e 100644 --- a/src/amd/addrlib/src/core/addrcommon.h +++ b/src/amd/addrlib/src/core/addrcommon.h @@ -36,27 +36,19 @@ #include "addrinterface.h" -// ADDR_LNX_KERNEL_BUILD is for internal build -// Moved from addrinterface.h so __KERNEL__ is not needed any more -#if ADDR_LNX_KERNEL_BUILD // || (defined(__GNUC__) && defined(__KERNEL__)) - #include -#elif !defined(__APPLE__) || defined(HAVE_TSERVER) + +#if !defined(__APPLE__) || defined(HAVE_TSERVER) #include #include #endif -#include +#if defined(__GNUC__) + #include +#endif + #include "util/macros.h" #include "util/u_endian.h" -#if !defined(DEBUG) -#ifdef NDEBUG -#define DEBUG 0 -#else -#define DEBUG 1 -#endif -#endif - #if UTIL_ARCH_LITTLE_ENDIAN #define LITTLEENDIAN_CPU #elif UTIL_ARCH_BIG_ENDIAN @@ -67,9 +59,17 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// // Platform specific debug break defines //////////////////////////////////////////////////////////////////////////////////////////////////// +#if !defined(DEBUG) + #ifdef NDEBUG + #define DEBUG 0 + #else + #define DEBUG 1 + #endif +#endif + #if DEBUG #if defined(__GNUC__) - #define ADDR_DBG_BREAK() assert(false) + #define ADDR_DBG_BREAK() { assert(false); } #elif defined(__APPLE__) #define ADDR_DBG_BREAK() { IOPanic("");} #else diff --git a/src/amd/addrlib/src/core/addrlib.cpp b/src/amd/addrlib/src/core/addrlib.cpp index 5e6c819c1a6..7a37a4b332b 100644 --- a/src/amd/addrlib/src/core/addrlib.cpp +++ b/src/amd/addrlib/src/core/addrlib.cpp @@ -209,7 +209,7 @@ ADDR_E_RETURNCODE Lib::Create( pLib = SiHwlInit(&client); break; case FAMILY_VI: - case FAMILY_CZ: + case FAMILY_CZ: // VI based fusion case FAMILY_CI: case FAMILY_KV: // CI based fusion pLib = CiHwlInit(&client); diff --git a/src/amd/addrlib/src/core/addrlib2.cpp b/src/amd/addrlib/src/core/addrlib2.cpp index f83e3a4ad26..07021985a89 100644 --- a/src/amd/addrlib/src/core/addrlib2.cpp +++ b/src/amd/addrlib/src/core/addrlib2.cpp @@ -310,6 +310,9 @@ ADDR_E_RETURNCODE Lib::ComputeSurfaceInfo( if (pOut->pStereoInfo != NULL) { ComputeQbStereoInfo(pOut); +#if DEBUG + ValidateStereoInfo(pIn, pOut); +#endif } } } @@ -826,7 +829,12 @@ ADDR_E_RETURNCODE Lib::ComputeDccAddrFromCoord( } else { - returnCode = HwlComputeDccAddrFromCoord(pIn, pOut); + returnCode = HwlSupportComputeDccAddrFromCoord(pIn); + + if (returnCode == ADDR_OK) + { + HwlComputeDccAddrFromCoord(pIn, pOut); + } } return returnCode; @@ -1992,6 +2000,81 @@ VOID Lib::FilterInvalidEqSwizzleMode( } } +#if DEBUG +/** +************************************************************************************************************************ +* Lib::ValidateStereoInfo +* +* @brief +* Validate stereo info by checking a few typical cases +* +* @return +* N/A +************************************************************************************************************************ +*/ +VOID Lib::ValidateStereoInfo( + const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] input structure + const ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut ///< [in] output structure + ) const +{ + ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT addrIn = {}; + addrIn.size = sizeof(addrIn); + addrIn.swizzleMode = pIn->swizzleMode; + addrIn.flags = pIn->flags; + addrIn.flags.qbStereo = 0; + addrIn.resourceType = pIn->resourceType; + addrIn.bpp = pIn->bpp; + addrIn.unalignedWidth = pIn->width; + addrIn.numSlices = pIn->numSlices; + addrIn.numMipLevels = pIn->numMipLevels; + addrIn.numSamples = pIn->numSamples; + addrIn.numFrags = pIn->numFrags; + + // Call Addr2ComputePipeBankXor() and validate different pbXor value if necessary... + const UINT_32 pbXor = 0; + + ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT addrOut = {}; + addrOut.size = sizeof(addrOut); + + // Make the array to be {0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096} for full test + const UINT_32 TestCoord[] = {0}; + + for (UINT_32 xIdx = 0; xIdx < sizeof(TestCoord) / sizeof(TestCoord[0]); xIdx++) + { + if (TestCoord[xIdx] < pIn->width) + { + addrIn.x = TestCoord[xIdx]; + + for (UINT_32 yIdx = 0; yIdx < sizeof(TestCoord) / sizeof(TestCoord[0]); yIdx++) + { + if (TestCoord[yIdx] < pIn->height) + { + addrIn.y = TestCoord[yIdx] + pOut->pStereoInfo->eyeHeight; + addrIn.pipeBankXor = pbXor ^ pOut->pStereoInfo->rightSwizzle; + addrIn.unalignedHeight = pIn->height + pOut->pStereoInfo->eyeHeight; + + ADDR_E_RETURNCODE ret = ComputeSurfaceAddrFromCoord(&addrIn, &addrOut); + ADDR_ASSERT(ret == ADDR_OK); + + const UINT_64 rightEyeOffsetFromBase = addrOut.addr; + + addrIn.y = TestCoord[yIdx]; + addrIn.pipeBankXor = pbXor; + addrIn.unalignedHeight = pIn->height; + + ret = ComputeSurfaceAddrFromCoord(&addrIn, &addrOut); + ADDR_ASSERT(ret == ADDR_OK); + + const UINT_64 rightEyeOffsetRelative = addrOut.addr; + + ADDR_ASSERT(rightEyeOffsetFromBase == rightEyeOffsetRelative + pOut->pStereoInfo->rightOffset); + } + } + } + } +} +#endif + } // V2 } // Addr diff --git a/src/amd/addrlib/src/core/addrlib2.h b/src/amd/addrlib/src/core/addrlib2.h index 778045862ed..55dd9f975ac 100644 --- a/src/amd/addrlib/src/core/addrlib2.h +++ b/src/amd/addrlib/src/core/addrlib2.h @@ -67,6 +67,7 @@ struct SwizzleModeFlags UINT_32 isT : 1; // T mode + // GFX10 UINT_32 isRtOpt : 1; // mode opt for render target UINT_32 reserved : 20; // Reserved bits @@ -540,12 +541,18 @@ protected: return ADDR_NOTSUPPORTED; } - virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord( + virtual ADDR_E_RETURNCODE HwlSupportComputeDccAddrFromCoord( + const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn) + { + ADDR_NOT_IMPLEMENTED(); + return ADDR_NOTSUPPORTED; + } + + virtual VOID 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( @@ -905,6 +912,12 @@ protected: AddrResourceType resourceType, UINT_32 elemLog2) const; +#if DEBUG + VOID ValidateStereoInfo( + const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn, + const ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const; +#endif + 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 diff --git a/src/amd/addrlib/src/core/addrobject.cpp b/src/amd/addrlib/src/core/addrobject.cpp index 339be4e702a..7e2510755a3 100644 --- a/src/amd/addrlib/src/core/addrobject.cpp +++ b/src/amd/addrlib/src/core/addrobject.cpp @@ -177,7 +177,8 @@ VOID Object::Free( */ VOID* Object::operator new( size_t objSize, ///< [in] Size to allocate - VOID* pMem) ///< [in] Pre-allocated pointer + VOID* pMem ///< [in] Pre-allocated pointer + ) noexcept { return pMem; } diff --git a/src/amd/addrlib/src/core/addrobject.h b/src/amd/addrlib/src/core/addrobject.h index 05559757712..5e2233c7a06 100644 --- a/src/amd/addrlib/src/core/addrobject.h +++ b/src/amd/addrlib/src/core/addrobject.h @@ -62,7 +62,7 @@ public: Object(const Client* pClient); virtual ~Object(); - VOID* operator new(size_t size, VOID* pMem); + VOID* operator new(size_t size, VOID* pMem) noexcept; 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 @@ -92,4 +92,3 @@ private: } // Addr #endif - diff --git a/src/amd/addrlib/src/core/coord.h b/src/amd/addrlib/src/core/coord.h index c14bf7b0d47..13efc9a0dd0 100644 --- a/src/amd/addrlib/src/core/coord.h +++ b/src/amd/addrlib/src/core/coord.h @@ -33,8 +33,23 @@ namespace Addr { namespace V2 { +#if defined(__cplusplus) +#if defined(_MSC_VER) + #if _MSC_VER >= 1900 + #define ADDR_CPP11_COMPILER TRUE + #endif +#else + #if __cplusplus >= 201103L + #define ADDR_CPP11_COMPILER TRUE + #endif +#endif +#endif +#if defined(ADDR_CPP11_COMPILER) +enum Dim : INT_8 +#else enum Dim +#endif { DIM_X, DIM_Y, diff --git a/src/amd/addrlib/src/gfx10/gfx10addrlib.cpp b/src/amd/addrlib/src/gfx10/gfx10addrlib.cpp index a29f848d83a..c227a0260e3 100644 --- a/src/amd/addrlib/src/gfx10/gfx10addrlib.cpp +++ b/src/amd/addrlib/src/gfx10/gfx10addrlib.cpp @@ -173,7 +173,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeHtileInfo( } else { - Dim3d metaBlk = {0}; + Dim3d metaBlk = {}; const UINT_32 metaBlkSize = GetMetaBlkSize(Gfx10DataDepthStencil, ADDR_RSRC_TEX_2D, pIn->swizzleMode, @@ -284,7 +284,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeCmaskInfo( } else { - Dim3d metaBlk = {0}; + Dim3d metaBlk = {}; const UINT_32 metaBlkSize = GetMetaBlkSize(Gfx10DataFmask, ADDR_RSRC_TEX_2D, pIn->swizzleMode, @@ -411,7 +411,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeDccInfo( if (ret == ADDR_OK) { - Dim3d metaBlk = {0}; + Dim3d metaBlk = {}; const UINT_32 numFragLog2 = Log2(Max(pIn->numFrags, 1u)); const UINT_32 metaBlkSize = GetMetaBlkSize(Gfx10DataColor, pIn->resourceType, @@ -519,16 +519,17 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeCmaskAddrFromCoord( // Only support pipe aligned CMask ADDR_ASSERT(pIn->cMaskFlags.pipeAligned == TRUE); - ADDR2_COMPUTE_CMASK_INFO_INPUT input = {0}; + ADDR2_COMPUTE_CMASK_INFO_INPUT input = {}; 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}; + ADDR2_COMPUTE_CMASK_INFO_OUTPUT output = {}; output.size = sizeof(output); ADDR_E_RETURNCODE returnCode = ComputeCmaskInfo(&input, &output); @@ -590,7 +591,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeHtileAddrFromCoord( } else { - ADDR2_COMPUTE_HTILE_INFO_INPUT input = {0}; + ADDR2_COMPUTE_HTILE_INFO_INPUT input = {}; input.size = sizeof(input); input.hTileFlags = pIn->hTileFlags; input.depthFlags = pIn->depthflags; @@ -600,7 +601,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeHtileAddrFromCoord( input.numSlices = Max(pIn->numSlices, 1u); input.numMipLevels = 1; - ADDR2_COMPUTE_HTILE_INFO_OUTPUT output = {0}; + ADDR2_COMPUTE_HTILE_INFO_OUTPUT output = {}; output.size = sizeof(output); returnCode = ComputeHtileInfo(&input, &output); @@ -658,18 +659,17 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeHtileCoordFromAddr( /** ************************************************************************************************************************ -* Gfx10Lib::HwlComputeDccAddrFromCoord +* Gfx10Lib::HwlSupportComputeDccAddrFromCoord * * @brief -* Interface function stub of AddrComputeDccAddrFromCoord +* Check whether HwlComputeDccAddrFromCoord() can be done for the input parameter * * @return * ADDR_E_RETURNCODE ************************************************************************************************************************ */ -ADDR_E_RETURNCODE Gfx10Lib::HwlComputeDccAddrFromCoord( - const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, ///< [in] input structure - ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] output structure +ADDR_E_RETURNCODE Gfx10Lib::HwlSupportComputeDccAddrFromCoord( + const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn) { ADDR_E_RETURNCODE returnCode = ADDR_OK; @@ -682,75 +682,96 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlComputeDccAddrFromCoord( { returnCode = ADDR_NOTSUPPORTED; } - else + else if ((pIn->pitch == 0) || + (pIn->metaBlkWidth == 0) || + (pIn->metaBlkHeight == 0) || + (pIn->slice > 0 && pIn->dccRamSliceSize == 0)) { - const UINT_32 elemLog2 = Log2(pIn->bpp >> 3); - const UINT_32 numPipeLog2 = m_pipesLog2; - const UINT_32 pipeMask = (1 << numPipeLog2) - 1; - UINT_32 index = m_dccBaseIndex + elemLog2; - const UINT_8* patIdxTable; - - if (m_settings.supportRbPlus) - { - patIdxTable = GFX10_DCC_64K_R_X_RBPLUS_PATIDX; - - if (pIn->dccKeyFlags.pipeAligned) - { - index += MaxNumOfBpp; - - if (m_numPkrLog2 < 2) - { - index += m_pipesLog2 * MaxNumOfBpp; - } - else - { - // 4 groups for "m_numPkrLog2 < 2" case - index += 4 * MaxNumOfBpp; - - const UINT_32 dccPipePerPkr = 3; - - index += (m_numPkrLog2 - 2) * dccPipePerPkr * MaxNumOfBpp + - (m_pipesLog2 - m_numPkrLog2) * MaxNumOfBpp; - } - } - } - else - { - patIdxTable = GFX10_DCC_64K_R_X_PATIDX; - - if (pIn->dccKeyFlags.pipeAligned) - { - index += (numPipeLog2 + UnalignedDccType) * MaxNumOfBpp; - } - else - { - index += Min(numPipeLog2, UnalignedDccType - 1) * MaxNumOfBpp; - } - } - - const UINT_32 blkSizeLog2 = Log2(pIn->metaBlkWidth) + Log2(pIn->metaBlkHeight) + elemLog2 - 8; - const UINT_32 blkMask = (1 << blkSizeLog2) - 1; - const UINT_32 blkOffset = - ComputeOffsetFromSwizzlePattern(GFX10_DCC_64K_R_X_SW_PATTERN[patIdxTable[index]], - blkSizeLog2 + 1, // +1 for nibble offset - pIn->x, - pIn->y, - pIn->slice, - 0); - const UINT_32 xb = pIn->x / pIn->metaBlkWidth; - const UINT_32 yb = pIn->y / pIn->metaBlkHeight; - const UINT_32 pb = pIn->pitch / pIn->metaBlkWidth; - const UINT_32 blkIndex = (yb * pb) + xb; - const UINT_32 pipeXor = ((pIn->pipeXor & pipeMask) << m_pipeInterleaveLog2) & blkMask; - - pOut->addr = (static_cast(pIn->dccRamSliceSize) * pIn->slice) + - (blkIndex * (1 << blkSizeLog2)) + - ((blkOffset >> 1) ^ pipeXor); + returnCode = ADDR_NOTSUPPORTED; } return returnCode; } +/** +************************************************************************************************************************ +* Gfx10Lib::HwlComputeDccAddrFromCoord +* +* @brief +* Interface function stub of AddrComputeDccAddrFromCoord +* +* @return +* N/A +************************************************************************************************************************ +*/ +VOID Gfx10Lib::HwlComputeDccAddrFromCoord( + const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, ///< [in] input structure + ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] output structure +{ + const UINT_32 elemLog2 = Log2(pIn->bpp >> 3); + const UINT_32 numPipeLog2 = m_pipesLog2; + const UINT_32 pipeMask = (1 << numPipeLog2) - 1; + UINT_32 index = m_dccBaseIndex + elemLog2; + const UINT_8* patIdxTable; + + if (m_settings.supportRbPlus) + { + patIdxTable = GFX10_DCC_64K_R_X_RBPLUS_PATIDX; + + if (pIn->dccKeyFlags.pipeAligned) + { + index += MaxNumOfBpp; + + if (m_numPkrLog2 < 2) + { + index += m_pipesLog2 * MaxNumOfBpp; + } + else + { + // 4 groups for "m_numPkrLog2 < 2" case + index += 4 * MaxNumOfBpp; + + const UINT_32 dccPipePerPkr = 3; + + index += (m_numPkrLog2 - 2) * dccPipePerPkr * MaxNumOfBpp + + (m_pipesLog2 - m_numPkrLog2) * MaxNumOfBpp; + } + } + } + else + { + patIdxTable = GFX10_DCC_64K_R_X_PATIDX; + + if (pIn->dccKeyFlags.pipeAligned) + { + index += (numPipeLog2 + UnalignedDccType) * MaxNumOfBpp; + } + else + { + index += Min(numPipeLog2, UnalignedDccType - 1) * MaxNumOfBpp; + } + } + + const UINT_32 blkSizeLog2 = Log2(pIn->metaBlkWidth) + Log2(pIn->metaBlkHeight) + elemLog2 - 8; + const UINT_32 blkMask = (1 << blkSizeLog2) - 1; + const UINT_32 blkOffset = + ComputeOffsetFromSwizzlePattern(GFX10_DCC_64K_R_X_SW_PATTERN[patIdxTable[index]], + blkSizeLog2 + 1, // +1 for nibble offset + pIn->x, + pIn->y, + pIn->slice, + 0); + const UINT_32 xb = pIn->x / pIn->metaBlkWidth; + const UINT_32 yb = pIn->y / pIn->metaBlkHeight; + const UINT_32 pb = pIn->pitch / pIn->metaBlkWidth; + const UINT_32 blkIndex = (yb * pb) + xb; + const UINT_32 pipeXor = ((pIn->pipeXor & pipeMask) << m_pipeInterleaveLog2) & blkMask; + + pOut->addr = (static_cast(pIn->dccRamSliceSize) * pIn->slice) + + (blkIndex * (1 << blkSizeLog2)) + + ((blkOffset >> 1) ^ pipeXor); +} + /** ************************************************************************************************************************ * Gfx10Lib::HwlInitGlobalParams @@ -1894,7 +1915,7 @@ VOID Gfx10Lib::InitEquationTable() if (pPatInfo->maxItemCount <= 3) { - ADDR_EQUATION equation = {0}; + ADDR_EQUATION equation = {}; ConvertSwizzlePatternToEquation(elemLog2, rsrcType, swMode, pPatInfo, &equation); @@ -2510,7 +2531,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlGetPreferredSurfaceSetting( AddrSwizzleMode swMode[maxFmaskSwizzleModeType] = {ADDR_SW_64KB_Z_X, ADDR_SW_VAR_Z_X}; Dim3d blkDim[maxFmaskSwizzleModeType] = {{}, {}}; Dim3d padDim[maxFmaskSwizzleModeType] = {{}, {}}; - UINT_64 padSize[maxFmaskSwizzleModeType] = {0}; + UINT_64 padSize[maxFmaskSwizzleModeType] = {}; for (UINT_8 i = 0; i < maxFmaskSwizzleModeType; i++) { @@ -2591,7 +2612,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlGetPreferredSurfaceSetting( const BOOL_32 msaa = (numFrags > 1) || (numSamples > 1); // Pre sanity check on non swizzle mode parameters - ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0}; + ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {}; localIn.flags = pIn->flags; localIn.resourceType = pIn->resourceType; localIn.format = pIn->format; @@ -2606,7 +2627,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlGetPreferredSurfaceSetting( if (ValidateNonSwModeParams(&localIn)) { // Forbid swizzle mode(s) by client setting - ADDR2_SWMODE_SET allowedSwModeSet = {0}; + ADDR2_SWMODE_SET allowedSwModeSet = {}; allowedSwModeSet.value |= pIn->forbiddenBlock.linear ? 0 : Gfx10LinearSwModeMask; allowedSwModeSet.value |= pIn->forbiddenBlock.micro ? 0 : Gfx10Blk256BSwModeMask; allowedSwModeSet.value |= @@ -2782,7 +2803,7 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlGetPreferredSurfaceSetting( // Determine block size if there are 2 or more block type candidates if (IsPow2(allowedBlockSet.value) == FALSE) { - AddrSwizzleMode swMode[AddrBlockMaxTiledType] = {ADDR_SW_LINEAR}; + AddrSwizzleMode swMode[AddrBlockMaxTiledType] = {}; if (m_blockVarSizeLog2 != 0) { @@ -2802,9 +2823,9 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlGetPreferredSurfaceSetting( swMode[AddrBlockThin64KB] = ADDR_SW_64KB_S; } - Dim3d blkDim[AddrBlockMaxTiledType] = {0}; - Dim3d padDim[AddrBlockMaxTiledType] = {0}; - UINT_64 padSize[AddrBlockMaxTiledType] = {0}; + Dim3d blkDim[AddrBlockMaxTiledType] = {}; + Dim3d padDim[AddrBlockMaxTiledType] = {}; + UINT_64 padSize[AddrBlockMaxTiledType] = {}; 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); @@ -3023,14 +3044,12 @@ ADDR_E_RETURNCODE Gfx10Lib::HwlGetPreferredSurfaceSetting( */ ADDR_E_RETURNCODE Gfx10Lib::ComputeStereoInfo( const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< Compute surface info - UINT_32 blkHeight, ///< Block height UINT_32* pAlignY, ///< Stereo requested additional alignment in Y UINT_32* pRightXor ///< Right eye xor ) const { ADDR_E_RETURNCODE ret = ADDR_OK; - *pAlignY = 1; *pRightXor = 0; if (IsNonPrtXor(pIn->swizzleMode)) @@ -3043,37 +3062,68 @@ ADDR_E_RETURNCODE Gfx10Lib::ComputeStereoInfo( if (eqIndex != ADDR_INVALID_EQUATION_INDEX) { - UINT_32 yMax = 0; - UINT_32 yPos = 0; + UINT_32 yMax = 0; + UINT_32 yPosMask = 0; + // First get "max y bit" for (UINT_32 i = m_pipeInterleaveLog2; i < blkSizeLog2; i++) { - if (m_equationTable[eqIndex].xor1[i].value == 0) + ADDR_ASSERT(m_equationTable[eqIndex].addr[i].valid == 1); + + if ((m_equationTable[eqIndex].addr[i].channel == 1) && + (m_equationTable[eqIndex].addr[i].index > yMax)) { - break; + yMax = m_equationTable[eqIndex].addr[i].index; } - ADDR_ASSERT(m_equationTable[eqIndex].xor1[i].valid == 1); - - if ((m_equationTable[eqIndex].xor1[i].channel == 1) && + if ((m_equationTable[eqIndex].xor1[i].valid == 1) && + (m_equationTable[eqIndex].xor1[i].channel == 1) && (m_equationTable[eqIndex].xor1[i].index > yMax)) { yMax = m_equationTable[eqIndex].xor1[i].index; - yPos = i; + } + + if ((m_equationTable[eqIndex].xor2[i].valid == 1) && + (m_equationTable[eqIndex].xor2[i].channel == 1) && + (m_equationTable[eqIndex].xor2[i].index > yMax)) + { + yMax = m_equationTable[eqIndex].xor2[i].index; + } + } + + // Then loop again for populating a position mask of "max Y bit" + for (UINT_32 i = m_pipeInterleaveLog2; i < blkSizeLog2; i++) + { + if ((m_equationTable[eqIndex].addr[i].channel == 1) && + (m_equationTable[eqIndex].addr[i].index == yMax)) + { + yPosMask |= 1u << i; + } + else if ((m_equationTable[eqIndex].xor1[i].valid == 1) && + (m_equationTable[eqIndex].xor1[i].channel == 1) && + (m_equationTable[eqIndex].xor1[i].index == yMax)) + { + yPosMask |= 1u << i; + } + else if ((m_equationTable[eqIndex].xor2[i].valid == 1) && + (m_equationTable[eqIndex].xor2[i].channel == 1) && + (m_equationTable[eqIndex].xor2[i].index == yMax)) + { + yPosMask |= 1u << i; } } const UINT_32 additionalAlign = 1 << yMax; - if (additionalAlign >= blkHeight) + if (additionalAlign >= *pAlignY) { - *pAlignY *= (additionalAlign / blkHeight); + *pAlignY = additionalAlign; const UINT_32 alignedHeight = PowTwoAlign(pIn->height, additionalAlign); if ((alignedHeight >> yMax) & 1) { - *pRightXor = 1 << (yPos - m_pipeInterleaveLog2); + *pRightXor = yPosMask >> m_pipeInterleaveLog2; } } } @@ -3243,15 +3293,12 @@ ADDR_E_RETURNCODE Gfx10Lib::ComputeSurfaceInfoMacroTiled( if (pIn->flags.qbStereo) { UINT_32 rightXor = 0; - UINT_32 alignY = 1; - returnCode = ComputeStereoInfo(pIn, heightAlign, &alignY, &rightXor); + returnCode = ComputeStereoInfo(pIn, &heightAlign, &rightXor); if (returnCode == ADDR_OK) { pOut->pStereoInfo->rightSwizzle = rightXor; - - heightAlign *= alignY; } } @@ -3953,8 +4000,8 @@ ADDR_E_RETURNCODE Gfx10Lib::ComputeSurfaceAddrFromCoordMicroTiled( ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut ///< [out] output structure ) const { - ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0}; - ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {0}; + ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {}; + ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {}; ADDR2_MIP_INFO mipInfo[MaxMipLevels]; localIn.swizzleMode = pIn->swizzleMode; @@ -4019,8 +4066,8 @@ ADDR_E_RETURNCODE Gfx10Lib::ComputeSurfaceAddrFromCoordMacroTiled( ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut ///< [out] output structure ) const { - ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0}; - ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {0}; + ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {}; + ADDR2_COMPUTE_SURFACE_INFO_OUTPUT localOut = {}; ADDR2_MIP_INFO mipInfo[MaxMipLevels]; localIn.swizzleMode = pIn->swizzleMode; diff --git a/src/amd/addrlib/src/gfx10/gfx10addrlib.h b/src/amd/addrlib/src/gfx10/gfx10addrlib.h index b2a5832c83c..7d53d123483 100644 --- a/src/amd/addrlib/src/gfx10/gfx10addrlib.h +++ b/src/amd/addrlib/src/gfx10/gfx10addrlib.h @@ -55,7 +55,7 @@ struct Gfx10ChipSettings UINT_32 reserved1 : 32; // Misc configuration bits - UINT_32 isDcn20 : 1; + UINT_32 isDcn20 : 1; // If using DCN2.0 UINT_32 supportRbPlus : 1; UINT_32 dsMipmapHtileFix : 1; UINT_32 dccUnsup3DSwDis : 1; @@ -274,7 +274,10 @@ protected: const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut); - virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord( + virtual ADDR_E_RETURNCODE HwlSupportComputeDccAddrFromCoord( + const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn); + + virtual VOID HwlComputeDccAddrFromCoord( const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut); @@ -365,7 +368,6 @@ private: ADDR_E_RETURNCODE ComputeStereoInfo( const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn, - UINT_32 blkHeight, UINT_32* pAlignY, UINT_32* pRightXor) const; @@ -492,7 +494,7 @@ private: static ADDR2_BLOCK_SET GetAllowedBlockSet(ADDR2_SWMODE_SET allowedSwModeSet, AddrResourceType rsrcType) { - ADDR2_BLOCK_SET allowedBlockSet = {0}; + ADDR2_BLOCK_SET allowedBlockSet = {}; allowedBlockSet.micro = (allowedSwModeSet.value & Gfx10Blk256BSwModeMask) ? TRUE : FALSE; allowedBlockSet.linear = (allowedSwModeSet.value & Gfx10LinearSwModeMask) ? TRUE : FALSE; @@ -515,7 +517,7 @@ private: static ADDR2_SWTYPE_SET GetAllowedSwSet(ADDR2_SWMODE_SET allowedSwModeSet) { - ADDR2_SWTYPE_SET allowedSwSet = {0}; + ADDR2_SWTYPE_SET allowedSwSet = {}; allowedSwSet.sw_Z = (allowedSwModeSet.value & Gfx10ZSwModeMask) ? TRUE : FALSE; allowedSwSet.sw_S = (allowedSwModeSet.value & Gfx10StandardSwModeMask) ? TRUE : FALSE; diff --git a/src/amd/addrlib/src/gfx9/gfx9addrlib.cpp b/src/amd/addrlib/src/gfx9/gfx9addrlib.cpp index 4deb55a82a1..bb85ed21be4 100644 --- a/src/amd/addrlib/src/gfx9/gfx9addrlib.cpp +++ b/src/amd/addrlib/src/gfx9/gfx9addrlib.cpp @@ -764,6 +764,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskAddrFromCoord( 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); @@ -796,8 +797,8 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeCmaskAddrFromCoord( UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock; UINT_32 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb; - UINT_32 coords[] = { pIn->x, pIn->y, pIn->slice, 0, blockIndex }; - UINT_64 address = pMetaEq->solve(coords); + UINT_32 coords[] = {pIn->x, pIn->y, pIn->slice, 0, blockIndex}; + UINT_64 address = pMetaEq->solve(coords); pOut->addr = address >> 1; pOut->bitPosition = static_cast((address & 1) << 2); @@ -873,8 +874,8 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileAddrFromCoord( UINT_32 sliceSizeInBlock = (output.height / output.metaBlkHeight) * pitchInBlock; UINT_32 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb; - UINT_32 coords[] = { pIn->x, pIn->y, pIn->slice, 0, blockIndex }; - UINT_64 address = pMetaEq->solve(coords); + UINT_32 coords[] = {pIn->x, pIn->y, pIn->slice, 0, blockIndex}; + UINT_64 address = pMetaEq->solve(coords); pOut->addr = address >> 1; @@ -962,6 +963,42 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileCoordFromAddr( return returnCode; } +/** +************************************************************************************************************************ +* Gfx9Lib::HwlSupportComputeDccAddrFromCoord +* +* @brief +* Check whether HwlComputeDccAddrFromCoord() can be done for the input parameter +* +* @return +* ADDR_E_RETURNCODE +************************************************************************************************************************ +*/ +ADDR_E_RETURNCODE Gfx9Lib::HwlSupportComputeDccAddrFromCoord( + const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn) +{ + ADDR_E_RETURNCODE returnCode = ADDR_OK; + + if ((pIn->numMipLevels > 1) || (pIn->mipId > 1) || pIn->dccKeyFlags.linear) + { + returnCode = ADDR_NOTSUPPORTED; + } + else if ((pIn->pitch == 0) || + (pIn->height == 0) || + (pIn->compressBlkWidth == 0) || + (pIn->compressBlkHeight == 0) || + (pIn->compressBlkDepth == 0) || + (pIn->metaBlkWidth == 0) || + (pIn->metaBlkHeight == 0) || + (pIn->metaBlkDepth == 0) || + (pIn->slice > 0 && pIn->dccRamSliceSize == 0)) + { + returnCode = ADDR_NOTSUPPORTED; + } + + return returnCode; +} + /** ************************************************************************************************************************ * Gfx9Lib::HwlComputeDccAddrFromCoord @@ -970,59 +1007,48 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeHtileCoordFromAddr( * Interface function stub of AddrComputeDccAddrFromCoord * * @return -* ADDR_E_RETURNCODE +* N/A ************************************************************************************************************************ */ -ADDR_E_RETURNCODE Gfx9Lib::HwlComputeDccAddrFromCoord( +VOID Gfx9Lib::HwlComputeDccAddrFromCoord( const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut) { - ADDR_E_RETURNCODE returnCode = ADDR_OK; + UINT_32 elementBytesLog2 = Log2(pIn->bpp >> 3); + UINT_32 numSamplesLog2 = Log2(pIn->numFrags); + UINT_32 metaBlkWidthLog2 = Log2(pIn->metaBlkWidth); + UINT_32 metaBlkHeightLog2 = Log2(pIn->metaBlkHeight); + UINT_32 metaBlkDepthLog2 = Log2(pIn->metaBlkDepth); + UINT_32 compBlkWidthLog2 = Log2(pIn->compressBlkWidth); + UINT_32 compBlkHeightLog2 = Log2(pIn->compressBlkHeight); + UINT_32 compBlkDepthLog2 = Log2(pIn->compressBlkDepth); - if ((pIn->numMipLevels > 1) || (pIn->mipId > 1) || pIn->dccKeyFlags.linear) - { - returnCode = ADDR_NOTIMPLEMENTED; - } - else - { - UINT_32 elementBytesLog2 = Log2(pIn->bpp >> 3); - UINT_32 numSamplesLog2 = Log2(pIn->numFrags); - UINT_32 metaBlkWidthLog2 = Log2(pIn->metaBlkWidth); - UINT_32 metaBlkHeightLog2 = Log2(pIn->metaBlkHeight); - UINT_32 metaBlkDepthLog2 = Log2(pIn->metaBlkDepth); - UINT_32 compBlkWidthLog2 = Log2(pIn->compressBlkWidth); - UINT_32 compBlkHeightLog2 = Log2(pIn->compressBlkHeight); - UINT_32 compBlkDepthLog2 = Log2(pIn->compressBlkDepth); + MetaEqParams metaEqParams = {pIn->mipId, elementBytesLog2, numSamplesLog2, pIn->dccKeyFlags, + Gfx9DataColor, pIn->swizzleMode, pIn->resourceType, + metaBlkWidthLog2, metaBlkHeightLog2, metaBlkDepthLog2, + compBlkWidthLog2, compBlkHeightLog2, compBlkDepthLog2}; - MetaEqParams metaEqParams = {pIn->mipId, elementBytesLog2, numSamplesLog2, pIn->dccKeyFlags, - Gfx9DataColor, pIn->swizzleMode, pIn->resourceType, - metaBlkWidthLog2, metaBlkHeightLog2, metaBlkDepthLog2, - compBlkWidthLog2, compBlkHeightLog2, compBlkDepthLog2}; + const CoordEq* pMetaEq = GetMetaEquation(metaEqParams); - const CoordEq* pMetaEq = GetMetaEquation(metaEqParams); + UINT_32 xb = pIn->x / pIn->metaBlkWidth; + UINT_32 yb = pIn->y / pIn->metaBlkHeight; + UINT_32 zb = pIn->slice / pIn->metaBlkDepth; - UINT_32 xb = pIn->x / pIn->metaBlkWidth; - UINT_32 yb = pIn->y / pIn->metaBlkHeight; - UINT_32 zb = pIn->slice / pIn->metaBlkDepth; + UINT_32 pitchInBlock = pIn->pitch / pIn->metaBlkWidth; + UINT_32 sliceSizeInBlock = (pIn->height / pIn->metaBlkHeight) * pitchInBlock; + UINT_32 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb; - UINT_32 pitchInBlock = pIn->pitch / pIn->metaBlkWidth; - UINT_32 sliceSizeInBlock = (pIn->height / pIn->metaBlkHeight) * pitchInBlock; - UINT_32 blockIndex = zb * sliceSizeInBlock + yb * pitchInBlock + xb; + UINT_32 coords[] = {pIn->x, pIn->y, pIn->slice, pIn->sample, blockIndex}; + UINT_64 address = pMetaEq->solve(coords); - UINT_32 coords[] = { pIn->x, pIn->y, pIn->slice, pIn->sample, blockIndex }; - UINT_64 address = pMetaEq->solve(coords); + pOut->addr = address >> 1; - pOut->addr = address >> 1; + UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->dccKeyFlags.pipeAligned, + pIn->swizzleMode); - UINT_32 numPipeBits = GetPipeLog2ForMetaAddressing(pIn->dccKeyFlags.pipeAligned, - pIn->swizzleMode); + UINT_64 pipeXor = static_cast(pIn->pipeXor & ((1 << numPipeBits) - 1)); - UINT_64 pipeXor = static_cast(pIn->pipeXor & ((1 << numPipeBits) - 1)); - - pOut->addr ^= (pipeXor << m_pipeInterleaveLog2); - } - - return returnCode; + pOut->addr ^= (pipeXor << m_pipeInterleaveLog2); } /** @@ -1976,7 +2002,7 @@ VOID Gfx9Lib::GenMetaEquation( } } - bool rbAppendedWithPipeBits[1 << (MaxSeLog2 + MaxRbPerSeLog2)] = {0}; + 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 @@ -2303,8 +2329,8 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeBlock256Equation( ADDR_CHANNEL_SETTING* pixelBit = &pEquation->addr[elementBytesLog2]; const UINT_32 maxBitsUsed = 4; - ADDR_CHANNEL_SETTING x[maxBitsUsed] = {0}; - ADDR_CHANNEL_SETTING y[maxBitsUsed] = {0}; + ADDR_CHANNEL_SETTING x[maxBitsUsed] = {}; + ADDR_CHANNEL_SETTING y[maxBitsUsed] = {}; for (i = 0; i < maxBitsUsed; i++) { @@ -2513,12 +2539,12 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeThinEquation( const UINT_32 maxBitsUsed = 14; ADDR_ASSERT((2 * maxBitsUsed) >= maxXorBits); - ADDR_CHANNEL_SETTING x[maxBitsUsed] = {0}; - ADDR_CHANNEL_SETTING y[maxBitsUsed] = {0}; + 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] = {0}; + ADDR_CHANNEL_SETTING xorExtra[extraXorBits] = {}; for (UINT_32 i = 0; i < maxBitsUsed; i++) { @@ -2672,13 +2698,13 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlComputeThickEquation( const UINT_32 maxBitsUsed = 12; ADDR_ASSERT((3 * maxBitsUsed) >= maxXorBits); - ADDR_CHANNEL_SETTING x[maxBitsUsed] = {0}; - ADDR_CHANNEL_SETTING y[maxBitsUsed] = {0}; - ADDR_CHANNEL_SETTING z[maxBitsUsed] = {0}; + 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] = {0}; + ADDR_CHANNEL_SETTING xorExtra[extraXorBits] = {}; for (UINT_32 i = 0; i < maxBitsUsed; i++) { @@ -3379,7 +3405,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting( const BOOL_32 displayRsrc = pIn->flags.display || pIn->flags.rotated; // Pre sanity check on non swizzle mode parameters - ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {0}; + ADDR2_COMPUTE_SURFACE_INFO_INPUT localIn = {}; localIn.flags = pIn->flags; localIn.resourceType = pOut->resourceType; localIn.format = pIn->format; @@ -3394,7 +3420,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting( if (ValidateNonSwModeParams(&localIn)) { // Forbid swizzle mode(s) by client setting - ADDR2_SWMODE_SET allowedSwModeSet = {0}; + ADDR2_SWMODE_SET allowedSwModeSet = {}; allowedSwModeSet.value |= pIn->forbiddenBlock.linear ? 0 : Gfx9LinearSwModeMask; allowedSwModeSet.value |= pIn->forbiddenBlock.micro ? 0 : Gfx9Blk256BSwModeMask; allowedSwModeSet.value |= @@ -3623,7 +3649,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting( // Determine block size if there are 2 or more block type candidates if (IsPow2(allowedBlockSet.value) == FALSE) { - AddrSwizzleMode swMode[AddrBlockMaxTiledType] = {ADDR_SW_LINEAR}; + AddrSwizzleMode swMode[AddrBlockMaxTiledType] = {}; swMode[AddrBlockMicro] = ADDR_SW_256B_D; swMode[AddrBlockThin4KB] = ADDR_SW_4KB_D; @@ -3635,9 +3661,9 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting( swMode[AddrBlockThick64KB] = ADDR_SW_64KB_S; } - Dim3d blkDim[AddrBlockMaxTiledType] = {0}; - Dim3d padDim[AddrBlockMaxTiledType] = {0}; - UINT_64 padSize[AddrBlockMaxTiledType] = {0}; + Dim3d blkDim[AddrBlockMaxTiledType] = {}; + Dim3d padDim[AddrBlockMaxTiledType] = {}; + UINT_64 padSize[AddrBlockMaxTiledType] = {}; 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); diff --git a/src/amd/addrlib/src/gfx9/gfx9addrlib.h b/src/amd/addrlib/src/gfx9/gfx9addrlib.h index e433bb01391..196764aa210 100644 --- a/src/amd/addrlib/src/gfx9/gfx9addrlib.h +++ b/src/amd/addrlib/src/gfx9/gfx9addrlib.h @@ -325,7 +325,10 @@ protected: const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut); - virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord( + virtual ADDR_E_RETURNCODE HwlSupportComputeDccAddrFromCoord( + const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn); + + virtual VOID HwlComputeDccAddrFromCoord( const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut); @@ -449,7 +452,7 @@ private: static ADDR2_BLOCK_SET GetAllowedBlockSet(ADDR2_SWMODE_SET allowedSwModeSet, AddrResourceType rsrcType) { - ADDR2_BLOCK_SET allowedBlockSet = {0}; + ADDR2_BLOCK_SET allowedBlockSet = {}; allowedBlockSet.micro = (allowedSwModeSet.value & Gfx9Blk256BSwModeMask) ? TRUE : FALSE; allowedBlockSet.linear = (allowedSwModeSet.value & Gfx9LinearSwModeMask) ? TRUE : FALSE; @@ -472,7 +475,7 @@ private: static ADDR2_SWTYPE_SET GetAllowedSwSet(ADDR2_SWMODE_SET allowedSwModeSet) { - ADDR2_SWTYPE_SET allowedSwSet = {0}; + ADDR2_SWTYPE_SET allowedSwSet = {}; allowedSwSet.sw_Z = (allowedSwModeSet.value & Gfx9ZSwModeMask) ? TRUE : FALSE; allowedSwSet.sw_S = (allowedSwModeSet.value & Gfx9StandardSwModeMask) ? TRUE : FALSE; diff --git a/src/amd/addrlib/src/r800/ciaddrlib.h b/src/amd/addrlib/src/r800/ciaddrlib.h index 2e72ec4a61f..550127029cc 100644 --- a/src/amd/addrlib/src/r800/ciaddrlib.h +++ b/src/amd/addrlib/src/r800/ciaddrlib.h @@ -208,3 +208,5 @@ private: } // Addr #endif + +