From: Marek Olšák Date: Fri, 7 May 2021 11:02:18 +0000 (-0400) Subject: amd: add Mesa-only addrlib changes X-Git-Tag: upstream/22.3.5~9326 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d737c88868f82bbd0cc36cbeef2cc35864f0981;p=platform%2Fupstream%2Fmesa.git amd: add Mesa-only addrlib changes Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/amd/addrlib/src/gfx11/gfx11addrlib.cpp b/src/amd/addrlib/src/gfx11/gfx11addrlib.cpp index cfc453f..c5097cd 100644 --- a/src/amd/addrlib/src/gfx11/gfx11addrlib.cpp +++ b/src/amd/addrlib/src/gfx11/gfx11addrlib.cpp @@ -250,6 +250,14 @@ ADDR_E_RETURNCODE Gfx11Lib::HwlComputeHtileInfo( pOut->pMipInfo[0].sliceSize = pOut->sliceSize; } } + + // Get the HTILE address equation (copied from HtileAddrFromCoord). + // HTILE addressing depends on the number of samples, but this code doesn't support it yet. + const UINT_32 index = m_htileBaseIndex; + const UINT_8* patIdxTable = GFX11_HTILE_PATIDX; + + ADDR_C_ASSERT(sizeof(GFX11_HTILE_SW_PATTERN[patIdxTable[index]]) == 72 * 2); + pOut->equation.gfx10_bits = (UINT_16 *)GFX11_HTILE_SW_PATTERN[patIdxTable[index]]; } return ret; @@ -373,6 +381,36 @@ ADDR_E_RETURNCODE Gfx11Lib::HwlComputeDccInfo( pOut->pMipInfo[0].sliceSize = pOut->dccRamSliceSize; } } + + // Get the DCC address equation (copied from DccAddrFromCoord) + const UINT_32 elemLog2 = Log2(pIn->bpp >> 3); + const UINT_32 numPipeLog2 = m_pipesLog2; + UINT_32 index = m_dccBaseIndex + elemLog2; + const UINT_8* patIdxTable = (pIn->swizzleMode == ADDR_SW_64KB_R_X) ? + GFX11_DCC_64K_R_X_PATIDX : GFX11_DCC_256K_R_X_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; + } + } + + ADDR_C_ASSERT(sizeof(GFX11_DCC_R_X_SW_PATTERN[patIdxTable[index]]) == 68 * 2); + pOut->equation.gfx10_bits = (UINT_16*)GFX11_DCC_R_X_SW_PATTERN[patIdxTable[index]]; } }