diff options
author | Nicolai Hähnle <[email protected]> | 2016-07-27 19:14:41 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 14:44:33 +0200 |
commit | 4a4b7da141834c6bcdbab7da7dd8599fab400b04 (patch) | |
tree | 08edf3fc8cfb0ebeca8f1344543eda74281bbc57 /src | |
parent | 9e40e090891e80856998aed02e63a5d76f2f243a (diff) |
amdgpu/addrlib: Fix invalid access to m_tileTable
Sometimes client driver passes valid tile info into address library,
in this case, the tile index is computed in function
HwlPostCheckTileIndex instead of CiAddrLib::HwlSetupTileCfg.
We need to call HwlPostCheckTileIndex to calculate the correct tile
index to get tile split bytes for this case.
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/addrlib/r800/ciaddrlib.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/amd/addrlib/r800/ciaddrlib.cpp b/src/amd/addrlib/r800/ciaddrlib.cpp index 57416dced16..ccb05282647 100644 --- a/src/amd/addrlib/r800/ciaddrlib.cpp +++ b/src/amd/addrlib/r800/ciaddrlib.cpp @@ -1277,14 +1277,25 @@ VOID CiAddrLib::HwlSetupTileInfo( { if (IsMacroTiled(tileMode)) { - // Non-depth entries store a split factor - UINT_32 sampleSplit = m_tileTable[pOut->tileIndex].info.tileSplitBytes; - UINT_32 tileBytes1x = BITS_TO_BYTES(bpp * MicroTilePixels * thickness); - UINT_32 colorTileSplit = Max(256u, sampleSplit * tileBytes1x); + UINT_32 tileIndex = static_cast<UINT_32>(pOut->tileIndex); - if (m_rowSize < colorTileSplit) + if ((tileIndex == TileIndexInvalid) && (IsTileInfoAllZero(pTileInfo) == FALSE)) { - pOut->tcCompatible = FALSE; + tileIndex = HwlPostCheckTileIndex(pTileInfo, tileMode, inTileType, tileIndex); + } + + if (tileIndex != TileIndexInvalid) + { + ADDR_ASSERT(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) + { + pOut->tcCompatible = FALSE; + } } } else |