summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Xiong <[email protected]>2014-06-10 03:43:44 -0400
committerMarek Olšák <[email protected]>2017-03-30 14:44:33 +0200
commitd52e0bbfe6e7f3745a2193673c49e80b9f005123 (patch)
tree40279f58e7a962fcf25cb0b177cd23726bbcfcf7
parent6c65f256e2e143914cec1326b35aa3b8d4622256 (diff)
amdgpu/addrlib: Change to compute TC compatible stencil info
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).
-rw-r--r--src/amd/addrlib/core/addrlib.cpp2
-rw-r--r--src/amd/addrlib/r800/ciaddrlib.cpp122
2 files changed, 59 insertions, 65 deletions
diff --git a/src/amd/addrlib/core/addrlib.cpp b/src/amd/addrlib/core/addrlib.cpp
index 1df693e5be5..b829eec474b 100644
--- a/src/amd/addrlib/core/addrlib.cpp
+++ b/src/amd/addrlib/core/addrlib.cpp
@@ -542,6 +542,8 @@ ADDR_E_RETURNCODE AddrLib::ComputeSurfaceInfo(
{
ADDR_ASSERT(!IsMacroTiled(localIn.tileMode));
}
+
+ pOut->macroModeIndex = macroModeIndex;
}
}
diff --git a/src/amd/addrlib/r800/ciaddrlib.cpp b/src/amd/addrlib/r800/ciaddrlib.cpp
index ae91e44eb99..26c4e056177 100644
--- a/src/amd/addrlib/r800/ciaddrlib.cpp
+++ b/src/amd/addrlib/r800/ciaddrlib.cpp
@@ -1455,96 +1455,88 @@ INT_32 CiAddrLib::HwlComputeMacroModeIndex(
{
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;
}