[Mesa-dev] [PATCH 002/140] amdgpu/addrlib: Change to compute TC compatible stencil info
Marek Olšák
maraeo at gmail.com
Mon Mar 20 22:42:12 UTC 2017
From: Carlos Xiong <clever.xiong at amd.com>
Change the logic to compute tc compatible stencil info via depth's
tileIndex instead of using depth's tileInfo. So the clients can get
the stencil's tileInfo computed from macroModeTable. If the stencil
tileInfo is same as depth tileInfo, then stencil is tc compatible;
otherwise, stencil is not tc compatible. The current suggestion is to
create another stencil buffer with the tc compatible tileInfo, use
depth-to-color copy to decompress and tile convert the rendered
stencil to tc compoatible stencil (And use the new stencil buffer to
program TC).
---
src/amd/addrlib/core/addrlib.cpp | 2 +
src/amd/addrlib/r800/ciaddrlib.cpp | 122 +++++++++++++++++--------------------
2 files changed, 59 insertions(+), 65 deletions(-)
diff --git a/src/amd/addrlib/core/addrlib.cpp b/src/amd/addrlib/core/addrlib.cpp
index 1df693e..b829eec 100644
--- a/src/amd/addrlib/core/addrlib.cpp
+++ b/src/amd/addrlib/core/addrlib.cpp
@@ -535,20 +535,22 @@ ADDR_E_RETURNCODE AddrLib::ComputeSurfaceInfo(
{
returnCode = HwlSetupTileCfg(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)
{
AddrTileMode tileMode = localIn.tileMode;
AddrTileType tileType = localIn.tileType;
// HWL layer may override tile mode if necessary
if (HwlOverrideTileMode(&localIn, &tileMode, &tileType))
diff --git a/src/amd/addrlib/r800/ciaddrlib.cpp b/src/amd/addrlib/r800/ciaddrlib.cpp
index ae91e44..26c4e05 100644
--- a/src/amd/addrlib/r800/ciaddrlib.cpp
+++ b/src/amd/addrlib/r800/ciaddrlib.cpp
@@ -1448,110 +1448,102 @@ INT_32 CiAddrLib::HwlComputeMacroModeIndex(
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;
- if (flags.tcCompatible && flags.stencil)
+ AddrTileMode tileMode = m_tileTable[tileIndex].mode;
+ AddrTileType tileType = m_tileTable[tileIndex].type;
+ UINT_32 thickness = ComputeSurfaceThickness(tileMode);
+
+ if (!IsMacroTiled(tileMode))
{
- // Don't compute macroModeIndex for tc compatible stencil surface
+ *pTileInfo = m_tileTable[tileIndex].info;
macroModeIndex = TileIndexNoMacroIndex;
}
else
{
- AddrTileMode tileMode = m_tileTable[tileIndex].mode;
- AddrTileType tileType = m_tileTable[tileIndex].type;
- UINT_32 thickness = ComputeSurfaceThickness(tileMode);
+ UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
+ UINT_32 tileSplit;
- if (!IsMacroTiled(tileMode))
+ if (m_tileTable[tileIndex].type == ADDR_DEPTH_SAMPLE_ORDER)
{
- *pTileInfo = m_tileTable[tileIndex].info;
- macroModeIndex = TileIndexNoMacroIndex;
+ // Depth entries store real tileSplitBytes
+ tileSplit = m_tileTable[tileIndex].info.tileSplitBytes;
}
else
{
- UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness);
- UINT_32 tileSplit;
+ // Non-depth entries store a split factor
+ UINT_32 sampleSplit = m_tileTable[tileIndex].info.tileSplitBytes;
+ UINT_32 colorTileSplit = Max(256u, sampleSplit * tileBytes1x);
- 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);
- }
+ tileSplit = colorTileSplit;
+ }
- if (tileBytes < 64)
- {
- tileBytes = 64;
- }
+ UINT_32 tileSplitC = Min(m_rowSize, tileSplit);
+ UINT_32 tileBytes;
- macroModeIndex = Log2(tileBytes / 64);
+ if (flags.fmask)
+ {
+ tileBytes = Min(tileSplitC, tileBytes1x);
+ }
+ else
+ {
+ tileBytes = Min(tileSplitC, numSamples * tileBytes1x);
+ }
- if (flags.prt || IsPrtTileMode(tileMode))
- {
- // Unknown - assume it is 1/2 of table size
- const UINT_32 PrtMacroModeOffset = MacroTileTableSize / 2;
+ if (tileBytes < 64)
+ {
+ tileBytes = 64;
+ }
- macroModeIndex += PrtMacroModeOffset;
- *pTileInfo = m_macroTileTable[macroModeIndex];
- }
- else
- {
- *pTileInfo = m_macroTileTable[macroModeIndex];
- }
+ macroModeIndex = Log2(tileBytes / 64);
- pTileInfo->pipeConfig = m_tileTable[tileIndex].info.pipeConfig;
+ if (flags.prt || IsPrtTileMode(tileMode))
+ {
+ // Unknown - assume it is 1/2 of table size
+ const UINT_32 PrtMacroModeOffset = MacroTileTableSize / 2;
- if (m_tileTable[tileIndex].type != ADDR_DEPTH_SAMPLE_ORDER)
- {
- pTileInfo->tileSplitBytes = tileSplitC;
- }
- else
- {
- pTileInfo->tileSplitBytes = m_tileTable[tileIndex].info.tileSplitBytes;
- }
+ macroModeIndex += PrtMacroModeOffset;
+ *pTileInfo = m_macroTileTable[macroModeIndex];
}
-
- if (NULL != pTileMode)
+ else
{
- *pTileMode = tileMode;
+ *pTileInfo = m_macroTileTable[macroModeIndex];
}
- if (NULL != pTileType)
+ pTileInfo->pipeConfig = m_tileTable[tileIndex].info.pipeConfig;
+
+ if (m_tileTable[tileIndex].type != ADDR_DEPTH_SAMPLE_ORDER)
+ {
+ pTileInfo->tileSplitBytes = tileSplitC;
+ }
+ else
{
- *pTileType = tileType;
+ pTileInfo->tileSplitBytes = m_tileTable[tileIndex].info.tileSplitBytes;
}
}
+ if (NULL != pTileMode)
+ {
+ *pTileMode = tileMode;
+ }
+
+ if (NULL != pTileType)
+ {
+ *pTileType = tileType;
+ }
+
return macroModeIndex;
}
/**
***************************************************************************************************
* CiAddrLib::HwlComputeTileDataWidthAndHeightLinear
*
* @brief
* Compute the squared cache shape for per-tile data (CMASK and HTILE) for linear layout
*
--
2.7.4
More information about the mesa-dev
mailing list