/**
****************************************************************************************************
* @file egbaddrlib.cpp
-* @brief Contains the EgBasedAddrLib class implementation
+* @brief Contains the EgBasedLib class implementation.
****************************************************************************************************
*/
#include "egbaddrlib.h"
+namespace Addr
+{
+namespace V1
+{
+
/**
****************************************************************************************************
-* EgBasedAddrLib::EgBasedAddrLib
+* EgBasedLib::EgBasedLib
*
* @brief
* Constructor
*
****************************************************************************************************
*/
-EgBasedAddrLib::EgBasedAddrLib(const AddrClient* pClient) :
- AddrLib1(pClient),
+EgBasedLib::EgBasedLib(const Client* pClient)
+ :
+ Lib(pClient),
m_ranks(0),
m_logicalBanks(0),
m_bankInterleave(1)
/**
****************************************************************************************************
-* EgBasedAddrLib::~EgBasedAddrLib
+* EgBasedLib::~EgBasedLib
*
* @brief
* Destructor
****************************************************************************************************
*/
-EgBasedAddrLib::~EgBasedAddrLib()
+EgBasedLib::~EgBasedLib()
{
}
/**
****************************************************************************************************
-* EgBasedAddrLib::DispatchComputeSurfaceInfo
+* EgBasedLib::DispatchComputeSurfaceInfo
*
* @brief
* Compute surface sizes include padded pitch,height,slices,total size in bytes,
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::DispatchComputeSurfaceInfo(
+BOOL_32 EgBasedLib::DispatchComputeSurfaceInfo(
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceInfoLinear
+* EgBasedLib::ComputeSurfaceInfoLinear
*
* @brief
* Compute linear surface sizes include padded pitch, height, slices, total size in
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoLinear(
+BOOL_32 EgBasedLib::ComputeSurfaceInfoLinear(
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] Input structure
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut, ///< [out] Output structure
UINT_32 padDims ///< [in] Dimensions to padd
pOut->pTileInfo,
padDims,
pIn->mipLevel,
- &expPitch, pOut->pitchAlign,
+ &expPitch, &pOut->pitchAlign,
&expHeight, pOut->heightAlign,
&expNumSlices, microTileThickness);
&expHeight,
&pOut->heightAlign);
+ if ((pIn->pitchAlign != 0) || (pIn->heightAlign != 0))
+ {
+ if (pIn->pitchAlign != 0)
+ {
+ ADDR_ASSERT((pIn->pitchAlign % pOut->pitchAlign) == 0);
+ pOut->pitchAlign = pIn->pitchAlign;
+
+ if (IsPow2(pOut->pitchAlign))
+ {
+ expPitch = PowTwoAlign(expPitch, pOut->pitchAlign);
+ }
+ else
+ {
+ expPitch += pOut->pitchAlign - 1;
+ expPitch /= pOut->pitchAlign;
+ expPitch *= pOut->pitchAlign;
+ }
+ }
+
+ if (pIn->heightAlign != 0)
+ {
+ ADDR_ASSERT((pIn->heightAlign % pOut->heightAlign) == 0);
+ pOut->heightAlign = pIn->heightAlign;
+
+ if (IsPow2(pOut->heightAlign))
+ {
+ expHeight = PowTwoAlign(expHeight, pOut->heightAlign);
+ }
+ else
+ {
+ expHeight += pOut->heightAlign - 1;
+ expHeight /= pOut->heightAlign;
+ expHeight *= pOut->heightAlign;
+ }
+ }
+
+ logicalSliceSize = BITS_TO_BYTES(expPitch * expHeight * pIn->bpp);
+ }
pOut->pitch = expPitch;
pOut->height = expHeight;
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceInfoMicroTiled
+* EgBasedLib::ComputeSurfaceInfoMicroTiled
*
* @brief
* Compute 1D/Micro Tiled surface sizes include padded pitch, height, slices, total
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMicroTiled(
+BOOL_32 EgBasedLib::ComputeSurfaceInfoMicroTiled(
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] Input structure
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut, ///< [out] Output structure
UINT_32 padDims, ///< [in] Dimensions to padd
pOut->pTileInfo,
padDims,
pIn->mipLevel,
- &expPitch, pOut->pitchAlign,
+ &expPitch, &pOut->pitchAlign,
&expHeight, pOut->heightAlign,
&expNumSlices, microTileThickness);
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceInfoMacroTiled
+* EgBasedLib::ComputeSurfaceInfoMacroTiled
*
* @brief
* Compute 2D/macro tiled surface sizes include padded pitch, height, slices, total
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::ComputeSurfaceInfoMacroTiled(
+BOOL_32 EgBasedLib::ComputeSurfaceInfoMacroTiled(
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] Input structure
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut, ///< [out] Output structure
UINT_32 padDims, ///< [in] Dimensions to padd
pIn->flags,
pIn->mipLevel,
numSamples,
- pOut->pTileInfo,
- &pOut->baseAlign,
- &pOut->pitchAlign,
- &pOut->heightAlign,
- &pOut->blockWidth,
- &pOut->blockHeight);
+ pOut);
if (valid)
{
pIn->flags,
pIn->mipLevel,
numSamples,
- pOut->pTileInfo,
- &pOut->baseAlign,
- &pOut->pitchAlign,
- &pOut->heightAlign,
- &pOut->blockWidth,
- &pOut->blockHeight);
+ pOut);
}
//
pOut->pTileInfo,
padDims,
pIn->mipLevel,
- &paddedPitch, pOut->pitchAlign,
+ &paddedPitch, &pOut->pitchAlign,
&paddedHeight, pOut->heightAlign,
&expNumSlices, microTileThickness);
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceAlignmentsLinear
+* EgBasedLib::ComputeSurfaceAlignmentsLinear
*
* @brief
* Compute linear surface alignment, calculation results are returned through
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsLinear(
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsLinear(
AddrTileMode tileMode, ///< [in] tile mode
UINT_32 bpp, ///< [in] bits per pixel
ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled
+* EgBasedLib::ComputeSurfaceAlignmentsMicroTiled
*
* @brief
* Compute 1D tiled surface alignment, calculation results are returned through
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMicroTiled(
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMicroTiled(
AddrTileMode tileMode, ///< [in] tile mode
UINT_32 bpp, ///< [in] bits per pixel
ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
AdjustPitchAlignment(flags, pPitchAlign);
- // ECR#393489
- // Workaround 2 for 1D tiling - There is HW bug for Carrizo
+ // Workaround 2 for 1D tiling - There is HW bug for Carrizo,
// where it requires the following alignments for 1D tiling.
if (flags.czDispCompatible && (mipLevel == 0))
{
*pBaseAlign = PowTwoAlign(*pBaseAlign, 4096); //Base address MOD 4096 = 0
- *pPitchAlign = PowTwoAlign(*pPitchAlign, 512 / (BITS_TO_BYTES(bpp))); //(8 lines * pitch * bytes per pixel) MOD 4096 = 0
+ *pPitchAlign = PowTwoAlign(*pPitchAlign, 512 / (BITS_TO_BYTES(bpp))); //(8 lines * pitch * bytes per pixel) MOD 4096 = 0
}
// end Carrizo workaround for 1D tilling
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlReduceBankWidthHeight
+* EgBasedLib::HwlReduceBankWidthHeight
*
* @brief
* Additional checks, reduce bankHeight/bankWidth if needed and possible
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::HwlReduceBankWidthHeight(
+BOOL_32 EgBasedLib::HwlReduceBankWidthHeight(
UINT_32 tileSize, ///< [in] tile size
UINT_32 bpp, ///< [in] bits per pixel
ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
UINT_32 numSamples, ///< [in] number of samples
UINT_32 bankHeightAlign, ///< [in] bank height alignment
UINT_32 pipes, ///< [in] pipes
- ADDR_TILEINFO* pTileInfo ///< [in/out] bank structure.
+ ADDR_TILEINFO* pTileInfo ///< [in,out] bank structure.
) const
{
UINT_32 macroAspectAlign;
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled
+* EgBasedLib::ComputeSurfaceAlignmentsMacroTiled
*
* @brief
* Compute 2D tiled surface alignment, calculation results are returned through
* TRUE if no error occurs
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::ComputeSurfaceAlignmentsMacroTiled(
- AddrTileMode tileMode, ///< [in] tile mode
- UINT_32 bpp, ///< [in] bits per pixel
- ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
- UINT_32 mipLevel, ///< [in] mip level
- UINT_32 numSamples, ///< [in] number of samples
- ADDR_TILEINFO* pTileInfo, ///< [in/out] bank structure.
- UINT_32* pBaseAlign, ///< [out] base address alignment in bytes
- UINT_32* pPitchAlign, ///< [out] pitch alignment in pixels
- UINT_32* pHeightAlign, ///< [out] height alignment in pixels
- UINT_32* pMacroTileWidth, ///< [out] macro tile width in pixels
- UINT_32* pMacroTileHeight ///< [out] macro tile height in pixels
+BOOL_32 EgBasedLib::ComputeSurfaceAlignmentsMacroTiled(
+ AddrTileMode tileMode, ///< [in] tile mode
+ UINT_32 bpp, ///< [in] bits per pixel
+ ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
+ UINT_32 mipLevel, ///< [in] mip level
+ UINT_32 numSamples, ///< [in] number of samples
+ ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut ///< [in,out] Surface output
) const
{
+ ADDR_TILEINFO* pTileInfo = pOut->pTileInfo;
+
BOOL_32 valid = SanityCheckMacroTiled(pTileInfo);
if (valid)
{
// this restriction is only for mipmap (mipmap's numSamples must be 1)
macroAspectAlign = Max(1u,
- m_pipeInterleaveBytes * m_bankInterleave /
- (tileSize * pipes * pTileInfo->bankWidth)
- );
+ m_pipeInterleaveBytes * m_bankInterleave /
+ (tileSize * pipes * pTileInfo->bankWidth)
+ );
pTileInfo->macroAspectRatio = PowTwoAlign(pTileInfo->macroAspectRatio, macroAspectAlign);
}
valid = HwlReduceBankWidthHeight(tileSize,
- bpp,
- flags,
- numSamples,
- bankHeightAlign,
- pipes,
- pTileInfo);
+ bpp,
+ flags,
+ numSamples,
+ bankHeightAlign,
+ pipes,
+ pTileInfo);
//
// The required granularity for pitch is the macro tile width.
macroTileWidth = MicroTileWidth * pTileInfo->bankWidth * pipes *
pTileInfo->macroAspectRatio;
- *pPitchAlign = macroTileWidth;
- *pMacroTileWidth = macroTileWidth;
+ pOut->pitchAlign = macroTileWidth;
+ pOut->blockWidth = macroTileWidth;
- AdjustPitchAlignment(flags, pPitchAlign);
+ AdjustPitchAlignment(flags, &pOut->pitchAlign);
//
// The required granularity for height is the macro tile height.
macroTileHeight = MicroTileHeight * pTileInfo->bankHeight * pTileInfo->banks /
pTileInfo->macroAspectRatio;
- *pHeightAlign = macroTileHeight;
- *pMacroTileHeight = macroTileHeight;
+ pOut->heightAlign = macroTileHeight;
+ pOut->blockHeight = macroTileHeight;
//
// Compute base alignment
//
- *pBaseAlign = pipes *
- pTileInfo->bankWidth * pTileInfo->banks * pTileInfo->bankHeight * tileSize;
-
- if ((mipLevel == 0) && (flags.prt) && (m_chipFamily == ADDR_CHIP_FAMILY_SI))
- {
- static const UINT_32 PrtTileSize = 0x10000;
-
- UINT_32 macroTileSize = macroTileWidth * macroTileHeight * numSamples * bpp / 8;
+ pOut->baseAlign =
+ pipes * pTileInfo->bankWidth * pTileInfo->banks * pTileInfo->bankHeight * tileSize;
- if (macroTileSize < PrtTileSize)
- {
- UINT_32 numMacroTiles = PrtTileSize / macroTileSize;
-
- ADDR_ASSERT((PrtTileSize % macroTileSize) == 0);
-
- *pPitchAlign *= numMacroTiles;
- *pBaseAlign *= numMacroTiles;
- }
- }
+ HwlComputeSurfaceAlignmentsMacroTiled(tileMode, bpp, flags, mipLevel, numSamples, pOut);
}
return valid;
/**
****************************************************************************************************
-* EgBasedAddrLib::SanityCheckMacroTiled
+* EgBasedLib::SanityCheckMacroTiled
*
* @brief
* Check if macro-tiled parameters are valid
* TRUE if valid
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::SanityCheckMacroTiled(
+BOOL_32 EgBasedLib::SanityCheckMacroTiled(
ADDR_TILEINFO* pTileInfo ///< [in] macro-tiled parameters
) const
{
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceMipLevelTileMode
+* EgBasedLib::ComputeSurfaceMipLevelTileMode
*
* @brief
* Compute valid tile mode for surface mipmap sub-levels
* Suitable tile mode
****************************************************************************************************
*/
-AddrTileMode EgBasedAddrLib::ComputeSurfaceMipLevelTileMode(
+AddrTileMode EgBasedLib::ComputeSurfaceMipLevelTileMode(
AddrTileMode baseTileMode, ///< [in] base tile mode
UINT_32 bpp, ///< [in] bits per pixels
UINT_32 pitch, ///< [in] current level pitch
ADDR_TILEINFO* pTileInfo ///< [in] ptr to bank structure
) const
{
+ UINT_64 bytesPerSlice;
+ (void)bytesPerSlice;
UINT_32 bytesPerTile;
AddrTileMode expTileMode = baseTileMode;
//
// Compute the size of a slice.
//
+ bytesPerSlice = BITS_TO_BYTES(static_cast<UINT_64>(pitch) * height * bpp * numSamples);
bytesPerTile = BITS_TO_BYTES(MicroTilePixels * microTileThickness * NextPow2(bpp) * numSamples);
//
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlDegradeBaseLevel
+* EgBasedLib::HwlGetAlignmentInfoMacroTiled
* @brief
-* Check if degrade is needed for base level
+* Get alignment info for giving tile mode
* @return
-* TRUE if degrade is suggested
+* TRUE if getting alignment is OK
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::HwlDegradeBaseLevel(
- const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+BOOL_32 EgBasedLib::HwlGetAlignmentInfoMacroTiled(
+ const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] create surface info
+ UINT_32* pPitchAlign, ///< [out] pitch alignment
+ UINT_32* pHeightAlign, ///< [out] height alignment
+ UINT_32* pSizeAlign ///< [out] size alignment
+ ) const
{
- BOOL_32 degrade = FALSE;
BOOL_32 valid = TRUE;
ADDR_ASSERT(IsMacroTiled(pIn->tileMode));
- UINT_32 baseAlign;
- UINT_32 pitchAlign;
- UINT_32 heightAlign;
- UINT_32 macroTileWidth;
- UINT_32 macroTileHeight;
+ UINT_32 numSamples = (pIn->numFrags == 0) ? pIn->numSamples : pIn->numFrags;
ADDR_ASSERT(pIn->pTileInfo);
ADDR_TILEINFO tileInfo = *pIn->pTileInfo;
ADDR_COMPUTE_SURFACE_INFO_OUTPUT out = {0};
+ out.pTileInfo = &tileInfo;
if (UseTileIndex(pIn->tileIndex))
{
pIn->bpp,
pIn->width,
pIn->height,
- pIn->numSamples,
+ numSamples,
&tileInfo,
&tileInfo,
pIn->tileType,
pIn->bpp,
pIn->flags,
pIn->mipLevel,
- pIn->numSamples,
- &tileInfo,
- &baseAlign,
- &pitchAlign,
- &heightAlign,
- ¯oTileWidth,
- ¯oTileHeight);
+ numSamples,
+ &out);
if (valid)
{
- degrade = ((pIn->width < macroTileWidth) || (pIn->height < macroTileHeight));
- // Check whether 2D tiling still has too much footprint
- if (degrade == FALSE)
- {
- // Only check width and height as slices are aligned to thickness
- UINT_64 unalignedSize = pIn->width * pIn->height;
-
- UINT_32 alignedPitch = PowTwoAlign(pIn->width, pitchAlign);
- UINT_32 alignedHeight = PowTwoAlign(pIn->height, heightAlign);
- UINT_64 alignedSize = alignedPitch * alignedHeight;
-
- // alignedSize > 1.5 * unalignedSize
- if (2 * alignedSize > 3 * unalignedSize)
- {
- degrade = TRUE;
- }
- }
- }
- else
- {
- degrade = TRUE;
+ *pPitchAlign = out.pitchAlign;
+ *pHeightAlign = out.heightAlign;
+ *pSizeAlign = out.baseAlign;
}
- return degrade;
+ return valid;
}
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlDegradeThickTileMode
+* EgBasedLib::HwlDegradeThickTileMode
*
* @brief
* Degrades valid tile mode for thick modes if needed
* Suitable tile mode
****************************************************************************************************
*/
-AddrTileMode EgBasedAddrLib::HwlDegradeThickTileMode(
+AddrTileMode EgBasedLib::HwlDegradeThickTileMode(
AddrTileMode baseTileMode, ///< [in] base tile mode
UINT_32 numSlices, ///< [in] current number of slices
- UINT_32* pBytesPerTile ///< [in/out] pointer to bytes per slice
+ UINT_32* pBytesPerTile ///< [in,out] pointer to bytes per slice
) const
{
ADDR_ASSERT(numSlices < Thickness(baseTileMode));
/**
****************************************************************************************************
-* EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord
+* EgBasedLib::DispatchComputeSurfaceAddrFromCoord
*
* @brief
* Compute surface address from given coord (x, y, slice,sample)
* Address in bytes
****************************************************************************************************
*/
-UINT_64 EgBasedAddrLib::DispatchComputeSurfaceAddrFromCoord(
+UINT_64 EgBasedLib::DispatchComputeSurfaceAddrFromCoord(
const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut ///< [out] output structure
) const
UINT_32* pBitPosition = &pOut->bitPosition;
UINT_64 addr;
-#if ADDR_AM_BUILD
- UINT_32 addr5Bit = 0;
- UINT_32 addr5Swizzle = pIn->addr5Swizzle;
- BOOL_32 is32ByteTile = pIn->is32ByteTile;
-#endif
-
// ADDR_DEPTH_SAMPLE_ORDER = non-disp + depth-sample-order
if (microTileType == ADDR_DEPTH_SAMPLE_ORDER)
{
break;
}
-#if ADDR_AM_BUILD
- if (m_chipFamily >= ADDR_CHIP_FAMILY_NI)
- {
- if (addr5Swizzle && isDepthSampleOrder && is32ByteTile)
- {
- UINT_32 tx = x >> 3;
- UINT_32 ty = y >> 3;
- UINT_32 tileBits = ((ty&0x3) << 2) | (tx&0x3);
-
- tileBits = tileBits & addr5Swizzle;
- addr5Bit = XorReduce(tileBits, 4);
-
- addr = addr | static_cast<UINT_64>(addr5Bit << 5);
- }
- }
-#endif
-
return addr;
}
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeMacroTileEquation
+* EgBasedLib::ComputeMacroTileEquation
*
* @brief
* Computes the address equation in macro tile
* If equation can be computed
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::ComputeMacroTileEquation(
+ADDR_E_RETURNCODE EgBasedLib::ComputeMacroTileEquation(
UINT_32 log2BytesPP, ///< [in] log2 of bytes per pixel
AddrTileMode tileMode, ///< [in] tile mode
AddrTileType microTileType, ///< [in] micro tiling type
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled
+* EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
*
* @brief
* Computes the surface address and bit position from a
* The byte address
****************************************************************************************************
*/
-UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMacroTiled(
+UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMacroTiled(
UINT_32 x, ///< [in] x coordinate
UINT_32 y, ///< [in] y coordinate
UINT_32 slice, ///< [in] slice index
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled
+* EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled
*
* @brief
* Computes the surface address and bit position from a coordinate for 1D tilied
* The byte address
****************************************************************************************************
*/
-UINT_64 EgBasedAddrLib::ComputeSurfaceAddrFromCoordMicroTiled(
+UINT_64 EgBasedLib::ComputeSurfaceAddrFromCoordMicroTiled(
UINT_32 x, ///< [in] x coordinate
UINT_32 y, ///< [in] y coordinate
UINT_32 slice, ///< [in] slice index
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputePixelCoordFromOffset
+* EgBasedLib::HwlComputePixelCoordFromOffset
*
* @brief
* Compute pixel coordinate from offset inside a micro tile
* N/A
****************************************************************************************************
*/
-VOID EgBasedAddrLib::HwlComputePixelCoordFromOffset(
+VOID EgBasedLib::HwlComputePixelCoordFromOffset(
UINT_32 offset, ///< [in] offset inside micro tile in bits
UINT_32 bpp, ///< [in] bits per pixel
UINT_32 numSamples, ///< [in] number of samples
/**
****************************************************************************************************
-* EgBasedAddrLib::DispatchComputeSurfaceCoordFromAddrDispatch
+* EgBasedLib::DispatchComputeSurfaceCoordFromAddrDispatch
*
* @brief
* Compute (x,y,slice,sample) coordinates from surface address
* N/A
****************************************************************************************************
*/
-VOID EgBasedAddrLib::DispatchComputeSurfaceCoordFromAddr(
+VOID EgBasedLib::DispatchComputeSurfaceCoordFromAddr(
const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceCoordFromAddrMacroTiled
+* EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled
*
* @brief
* Compute surface coordinates from address for macro tiled surface
* N/A
****************************************************************************************************
*/
-VOID EgBasedAddrLib::ComputeSurfaceCoordFromAddrMacroTiled(
+VOID EgBasedLib::ComputeSurfaceCoordFromAddrMacroTiled(
UINT_64 addr, ///< [in] byte address
UINT_32 bitPosition, ///< [in] bit position
UINT_32 bpp, ///< [in] bits per pixel
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSurfaceCoord2DFromBankPipe
+* EgBasedLib::ComputeSurfaceCoord2DFromBankPipe
*
* @brief
* Compute surface x,y coordinates from bank/pipe info
* N/A
****************************************************************************************************
*/
-VOID EgBasedAddrLib::ComputeSurfaceCoord2DFromBankPipe(
+VOID EgBasedLib::ComputeSurfaceCoord2DFromBankPipe(
AddrTileMode tileMode, ///< [in] tile mode
UINT_32 x, ///< [in] x coordinate
UINT_32 y, ///< [in] y coordinate
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlExtractBankPipeSwizzle
+* EgBasedLib::HwlExtractBankPipeSwizzle
* @brief
-* Entry of EgBasedAddrLib ExtractBankPipeSwizzle
+* Entry of EgBasedLib ExtractBankPipeSwizzle
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlExtractBankPipeSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlExtractBankPipeSwizzle(
const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn, ///< [in] input structure
ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlCombineBankPipeSwizzle
+* EgBasedLib::HwlCombineBankPipeSwizzle
* @brief
* Combine bank/pipe swizzle
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlCombineBankPipeSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlCombineBankPipeSwizzle(
UINT_32 bankSwizzle, ///< [in] bank swizzle
UINT_32 pipeSwizzle, ///< [in] pipe swizzle
ADDR_TILEINFO* pTileInfo, ///< [in] tile info
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeBaseSwizzle
+* EgBasedLib::HwlComputeBaseSwizzle
* @brief
* Compute base swizzle
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeBaseSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeBaseSwizzle(
const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut
) const
{ 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 }, // ADDR_SURF_16_BANK
};
+ UINT_32 pipes = HwlGetPipes(pTileInfo);
+ (void)pipes;
UINT_32 banks = pTileInfo ? pTileInfo->banks : 2;
UINT_32 hwNumBanks;
/**
****************************************************************************************************
-* EgBasedAddrLib::ExtractBankPipeSwizzle
+* EgBasedLib::ExtractBankPipeSwizzle
* @brief
* Extract bank/pipe swizzle from base256b
* @return
* N/A
****************************************************************************************************
*/
-VOID EgBasedAddrLib::ExtractBankPipeSwizzle(
+VOID EgBasedLib::ExtractBankPipeSwizzle(
UINT_32 base256b, ///< [in] input base256b register value
ADDR_TILEINFO* pTileInfo, ///< [in] 2D tile parameters. Client must provide all data
UINT_32* pBankSwizzle, ///< [out] bank swizzle
/**
****************************************************************************************************
-* EgBasedAddrLib::GetBankPipeSwizzle
+* EgBasedLib::GetBankPipeSwizzle
* @brief
* Combine bank/pipe swizzle
* @return
* Base256b bits (only filled bank/pipe bits)
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::GetBankPipeSwizzle(
+UINT_32 EgBasedLib::GetBankPipeSwizzle(
UINT_32 bankSwizzle, ///< [in] bank swizzle
UINT_32 pipeSwizzle, ///< [in] pipe swizzle
UINT_64 baseAddr, ///< [in] base address
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeSliceTileSwizzle
+* EgBasedLib::ComputeSliceTileSwizzle
* @brief
* Compute cubemap/3d texture faces/slices tile swizzle
* @return
* Tile swizzle
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputeSliceTileSwizzle(
+UINT_32 EgBasedLib::ComputeSliceTileSwizzle(
AddrTileMode tileMode, ///< [in] Tile mode
UINT_32 baseSwizzle, ///< [in] Base swizzle
UINT_32 slice, ///< [in] Slice index, Cubemap face index, 0 means +X
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeQbStereoRightSwizzle
+* EgBasedLib::HwlComputeQbStereoRightSwizzle
*
* @brief
* Compute right eye swizzle
* swizzle
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::HwlComputeQbStereoRightSwizzle(
+UINT_32 EgBasedLib::HwlComputeQbStereoRightSwizzle(
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo ///< [in] Surface info, must be valid
) const
{
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeBankFromCoord
+* EgBasedLib::ComputeBankFromCoord
*
* @brief
* Compute bank number from coordinates
* Bank number
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputeBankFromCoord(
+UINT_32 EgBasedLib::ComputeBankFromCoord(
UINT_32 x, ///< [in] x coordinate
UINT_32 y, ///< [in] y coordinate
UINT_32 slice, ///< [in] slice index
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeBankFromAddr
+* EgBasedLib::ComputeBankFromAddr
*
* @brief
* Compute the bank number from an address
* Bank number
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputeBankFromAddr(
+UINT_32 EgBasedLib::ComputeBankFromAddr(
UINT_64 addr, ///< [in] address
UINT_32 numBanks, ///< [in] number of banks
UINT_32 numPipes ///< [in] number of pipes
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputePipeRotation
+* EgBasedLib::ComputePipeRotation
*
* @brief
* Compute pipe rotation value
* Pipe rotation
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputePipeRotation(
+UINT_32 EgBasedLib::ComputePipeRotation(
AddrTileMode tileMode, ///< [in] tile mode
UINT_32 numPipes ///< [in] number of pipes
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeBankRotation
+* EgBasedLib::ComputeBankRotation
*
* @brief
* Compute bank rotation value
* Bank rotation
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputeBankRotation(
+UINT_32 EgBasedLib::ComputeBankRotation(
AddrTileMode tileMode, ///< [in] tile mode
UINT_32 numBanks, ///< [in] number of banks
UINT_32 numPipes ///< [in] number of pipes
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeHtileBytes
+* EgBasedLib::ComputeHtileBytes
*
* @brief
* Compute htile size in bytes
* Htile size in bytes
****************************************************************************************************
*/
-UINT_64 EgBasedAddrLib::ComputeHtileBytes(
+UINT_64 EgBasedLib::ComputeHtileBytes(
UINT_32 pitch, ///< [in] pitch
UINT_32 height, ///< [in] height
UINT_32 bpp, ///< [in] bits per pixel
/**
****************************************************************************************************
-* EgBasedAddrLib::DispatchComputeFmaskInfo
+* EgBasedLib::DispatchComputeFmaskInfo
*
* @brief
* Compute fmask sizes include padded pitch, height, slices, total size in bytes,
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::DispatchComputeFmaskInfo(
+ADDR_E_RETURNCODE EgBasedLib::DispatchComputeFmaskInfo(
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut) ///< [out] output structure
{
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlFmaskSurfaceInfo
+* EgBasedLib::HwlFmaskSurfaceInfo
* @brief
-* Entry of EgBasedAddrLib ComputeFmaskInfo
+* Entry of EgBasedLib ComputeFmaskInfo
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskInfo(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskInfo(
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut ///< [out] output structure
)
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeFmaskAddrFromCoord
+* EgBasedLib::HwlComputeFmaskAddrFromCoord
* @brief
-* Entry of EgBasedAddrLib ComputeFmaskAddrFromCoord
+* Entry of EgBasedLib ComputeFmaskAddrFromCoord
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskAddrFromCoord(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskAddrFromCoord(
const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut ///< [out] output structure
) const
{
ADDR_E_RETURNCODE retCode = ADDR_OK;
-#if ADDR_AM_BUILD
- if ((pIn->x > pIn->pitch) ||
- (pIn->y > pIn->height) ||
- (pIn->numSamples > m_maxSamples) ||
- (pIn->sample >= m_maxSamples))
- {
- retCode = ADDR_INVALIDPARAMS;
- }
- else
- {
- pOut->addr = DispatchComputeFmaskAddrFromCoord(pIn, pOut);
- }
-#endif
-
return retCode;
}
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeFmaskCoordFromAddr
+* EgBasedLib::HwlComputeFmaskCoordFromAddr
* @brief
-* Entry of EgBasedAddrLib ComputeFmaskCoordFromAddr
+* Entry of EgBasedLib ComputeFmaskCoordFromAddr
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeFmaskCoordFromAddr(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeFmaskCoordFromAddr(
const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut ///< [out] output structure
) const
{
ADDR_E_RETURNCODE retCode = ADDR_OK;
-#if ADDR_AM_BUILD
- if ((pIn->bitPosition >= 8) ||
- (pIn->numSamples > m_maxSamples))
- {
- retCode = ADDR_INVALIDPARAMS;
- }
- else
- {
- DispatchComputeFmaskCoordFromAddr(pIn, pOut);
- }
-#endif
-
return retCode;
}
-#if ADDR_AM_BUILD
-/**
-****************************************************************************************************
-* EgBasedAddrLib::DispatchComputeFmaskAddrFromCoord
-*
-* @brief
-* Computes the FMASK address and bit position from a coordinate.
-* @return
-* The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedAddrLib::DispatchComputeFmaskAddrFromCoord(
- const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, ///< [in] input structure
- ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut ///< [out] output structure
- ) const
-{
- UINT_32 x = pIn->x;
- UINT_32 y = pIn->y;
- UINT_32 slice = pIn->slice;
- UINT_32 sample = pIn->sample;
- UINT_32 plane = pIn->plane;
- UINT_32 pitch = pIn->pitch;
- UINT_32 height = pIn->height;
- UINT_32 numSamples = pIn->numSamples;
- AddrTileMode tileMode = pIn->tileMode;
- BOOL_32 ignoreSE = pIn->ignoreSE;
- ADDR_TILEINFO* pTileInfo = pIn->pTileInfo;
- BOOL_32 resolved = pIn->resolved;
-
- UINT_32* pBitPosition = &pOut->bitPosition;
- UINT_64 addr = 0;
-
- ADDR_ASSERT(numSamples > 1);
- ADDR_ASSERT(Thickness(tileMode) == 1);
-
- switch (tileMode)
- {
- case ADDR_TM_1D_TILED_THIN1:
- addr = ComputeFmaskAddrFromCoordMicroTiled(x,
- y,
- slice,
- sample,
- plane,
- pitch,
- height,
- numSamples,
- tileMode,
- resolved,
- pBitPosition);
- break;
- case ADDR_TM_2D_TILED_THIN1: //fall through
- case ADDR_TM_3D_TILED_THIN1:
- UINT_32 pipeSwizzle;
- UINT_32 bankSwizzle;
-
- if (m_configFlags.useCombinedSwizzle)
- {
- ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
- &bankSwizzle, &pipeSwizzle);
- }
- else
- {
- pipeSwizzle = pIn->pipeSwizzle;
- bankSwizzle = pIn->bankSwizzle;
- }
-
- addr = ComputeFmaskAddrFromCoordMacroTiled(x,
- y,
- slice,
- sample,
- plane,
- pitch,
- height,
- numSamples,
- tileMode,
- pipeSwizzle,
- bankSwizzle,
- ignoreSE,
- pTileInfo,
- resolved,
- pBitPosition);
- break;
- default:
- *pBitPosition = 0;
- break;
- }
-
- return addr;
-}
-
-/**
-****************************************************************************************************
-* EgBasedAddrLib::ComputeFmaskAddrFromCoordMicroTiled
-*
-* @brief
-* Computes the FMASK address and bit position from a coordinate for 1D tilied (micro
-* tiled)
-* @return
-* The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedAddrLib::ComputeFmaskAddrFromCoordMicroTiled(
- UINT_32 x, ///< [in] x coordinate
- UINT_32 y, ///< [in] y coordinate
- UINT_32 slice, ///< [in] slice index
- UINT_32 sample, ///< [in] sample number
- UINT_32 plane, ///< [in] plane number
- UINT_32 pitch, ///< [in] surface pitch in pixels
- UINT_32 height, ///< [in] surface height in pixels
- UINT_32 numSamples, ///< [in] number of samples
- AddrTileMode tileMode, ///< [in] tile mode
- BOOL_32 resolved, ///< [in] TRUE if this is for resolved fmask
- UINT_32* pBitPosition ///< [out] pointer to returned bit position
- ) const
-{
- UINT_64 addr = 0;
- UINT_32 effectiveBpp;
- UINT_32 effectiveSamples;
-
- //
- // 2xAA use the same layout as 4xAA
- //
- if (numSamples == 2)
- {
- numSamples = 4;
- }
-
- //
- // Compute the number of planes.
- //
- if (resolved == FALSE)
- {
- effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
- effectiveBpp = numSamples;
-
- //
- // Compute the address just like a color surface with numSamples bits per element and
- // numPlanes samples.
- //
- addr = ComputeSurfaceAddrFromCoordMicroTiled(x,
- y,
- slice,
- plane, // sample
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- ADDR_NON_DISPLAYABLE,
- FALSE,
- pBitPosition);
-
- //
- // Compute the real bit position. Each (sample, plane) is stored with one bit per sample.
- //
-
- //
- // Compute the pixel index with in the micro tile
- //
- UINT_32 pixelIndex = ComputePixelIndexWithinMicroTile(x % 8,
- y % 8,
- slice,
- 1,
- tileMode,
- ADDR_NON_DISPLAYABLE);
-
- *pBitPosition = ((pixelIndex * numSamples) + sample) & (BITS_PER_BYTE-1);
-
- UINT_64 bitAddr = BYTES_TO_BITS(addr) + *pBitPosition;
-
- addr = bitAddr / 8;
- }
- else
- {
- effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
- effectiveSamples = 1;
-
- //
- // Compute the address just like a color surface with numSamples bits per element and
- // numPlanes samples.
- //
- addr = ComputeSurfaceAddrFromCoordMicroTiled(x,
- y,
- slice,
- sample,
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- ADDR_NON_DISPLAYABLE,
- TRUE,
- pBitPosition);
- }
-
- return addr;
-}
-
-/**
-****************************************************************************************************
-* EgBasedAddrLib::ComputeFmaskAddrFromCoordMacroTiled
-*
-* @brief
-* Computes the FMASK address and bit position from a coordinate for 2D tilied (macro
-* tiled)
-* @return
-* The byte address
-****************************************************************************************************
-*/
-UINT_64 EgBasedAddrLib::ComputeFmaskAddrFromCoordMacroTiled(
- UINT_32 x, ///< [in] x coordinate
- UINT_32 y, ///< [in] y coordinate
- UINT_32 slice, ///< [in] slice index
- UINT_32 sample, ///< [in] sample number
- UINT_32 plane, ///< [in] plane number
- UINT_32 pitch, ///< [in] surface pitch in pixels
- UINT_32 height, ///< [in] surface height in pixels
- UINT_32 numSamples, ///< [in] number of samples
- AddrTileMode tileMode, ///< [in] tile mode
- UINT_32 pipeSwizzle, ///< [in] pipe swizzle
- UINT_32 bankSwizzle, ///< [in] bank swizzle
- BOOL_32 ignoreSE, ///< [in] TRUE if ignore shader engine
- ADDR_TILEINFO* pTileInfo, ///< [in] bank structure.**All fields to be valid on entry**
- BOOL_32 resolved, ///< [in] TRUE if this is for resolved fmask
- UINT_32* pBitPosition ///< [out] pointer to returned bit position
- ) const
-{
- UINT_64 addr = 0;
- UINT_32 effectiveBpp;
- UINT_32 effectiveSamples;
-
- //
- // 2xAA use the same layout as 4xAA
- //
- if (numSamples == 2)
- {
- numSamples = 4;
- }
-
- //
- // Compute the number of planes.
- //
- if (resolved == FALSE)
- {
- effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
- effectiveBpp = numSamples;
-
- //
- // Compute the address just like a color surface with numSamples bits per element and
- // numPlanes samples.
- //
- addr = ComputeSurfaceAddrFromCoordMacroTiled(x,
- y,
- slice,
- plane, // sample
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- ADDR_NON_DISPLAYABLE,// isdisp
- ignoreSE,// ignore_shader
- FALSE,// depth_sample_order
- pipeSwizzle,
- bankSwizzle,
- pTileInfo,
- pBitPosition);
-
- //
- // Compute the real bit position. Each (sample, plane) is stored with one bit per sample.
- //
-
-
- //
- // Compute the pixel index with in the micro tile
- //
- UINT_32 pixelIndex = ComputePixelIndexWithinMicroTile(x ,
- y ,
- slice,
- effectiveBpp,
- tileMode,
- ADDR_NON_DISPLAYABLE);
-
- *pBitPosition = ((pixelIndex * numSamples) + sample) & (BITS_PER_BYTE-1);
-
- UINT_64 bitAddr = BYTES_TO_BITS(addr) + *pBitPosition;
-
- addr = bitAddr / 8;
-
- }
- else
- {
- effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
- effectiveSamples = 1;
-
- //
- // Compute the address just like a color surface with numSamples bits per element and
- // numPlanes samples.
- //
- addr = ComputeSurfaceAddrFromCoordMacroTiled(x,
- y,
- slice,
- sample,
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- ADDR_NON_DISPLAYABLE,
- ignoreSE,
- TRUE,
- pipeSwizzle,
- bankSwizzle,
- pTileInfo,
- pBitPosition);
- }
-
- return addr;
-}
-
-/**
-****************************************************************************************************
-* EgBasedAddrLib::ComputeFmaskCoordFromAddrMicroTiled
-*
-* @brief
-* Compute (x,y,slice,sample,plane) coordinates from fmask address
-* @return
-* N/A
-*
-****************************************************************************************************
-*/
-VOID EgBasedAddrLib::ComputeFmaskCoordFromAddrMicroTiled(
- UINT_64 addr, ///< [in] byte address
- UINT_32 bitPosition,///< [in] bit position
- UINT_32 pitch, ///< [in] pitch in pixels
- UINT_32 height, ///< [in] height in pixels
- UINT_32 numSamples, ///< [in] number of samples (of color buffer)
- AddrTileMode tileMode, ///< [in] tile mode
- BOOL_32 resolved, ///< [in] TRUE if it is resolved fmask
- UINT_32* pX, ///< [out] X coord
- UINT_32* pY, ///< [out] Y coord
- UINT_32* pSlice, ///< [out] slice index
- UINT_32* pSample, ///< [out] sample index
- UINT_32* pPlane ///< [out] plane index
- ) const
-{
- UINT_32 effectiveBpp;
- UINT_32 effectiveSamples;
-
- // 2xAA use the same layout as 4xAA
- if (numSamples == 2)
- {
- numSamples = 4;
- }
-
- if (resolved == FALSE)
- {
- effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
- effectiveBpp = numSamples;
-
- ComputeSurfaceCoordFromAddrMicroTiled(addr,
- bitPosition,
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- 0, // tileBase
- 0, // compBits
- pX,
- pY,
- pSlice,
- pPlane,
- ADDR_NON_DISPLAYABLE, // microTileType
- FALSE // isDepthSampleOrder
- );
-
-
- if ( pSample )
- {
- *pSample = bitPosition % numSamples;
- }
- }
- else
- {
- effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
- effectiveSamples = 1;
-
- ComputeSurfaceCoordFromAddrMicroTiled(addr,
- bitPosition,
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- 0, // tileBase
- 0, // compBits
- pX,
- pY,
- pSlice,
- pSample,
- ADDR_NON_DISPLAYABLE, // microTileType
- TRUE // isDepthSampleOrder
- );
- }
-}
-
-/**
-****************************************************************************************************
-* EgBasedAddrLib::ComputeFmaskCoordFromAddrMacroTiled
-*
-* @brief
-* Compute (x,y,slice,sample,plane) coordinates from
-* fmask address
-* @return
-* N/A
-*
-****************************************************************************************************
-*/
-VOID EgBasedAddrLib::ComputeFmaskCoordFromAddrMacroTiled(
- UINT_64 addr, ///< [in] byte address
- UINT_32 bitPosition,///< [in] bit position
- UINT_32 pitch, ///< [in] pitch in pixels
- UINT_32 height, ///< [in] height in pixels
- UINT_32 numSamples, ///< [in] number of samples (of color buffer)
- AddrTileMode tileMode, ///< [in] tile mode
- UINT_32 pipeSwizzle,///< [in] pipe swizzle
- UINT_32 bankSwizzle,///< [in] bank swizzle
- BOOL_32 ignoreSE, ///< [in] TRUE if ignore shader engine
- ADDR_TILEINFO* pTileInfo, ///< [in] bank structure. **All fields to be valid on entry**
- BOOL_32 resolved, ///< [in] TRUE if it is resolved fmask
- UINT_32* pX, ///< [out] X coord
- UINT_32* pY, ///< [out] Y coord
- UINT_32* pSlice, ///< [out] slice index
- UINT_32* pSample, ///< [out] sample index
- UINT_32* pPlane ///< [out] plane index
- ) const
-{
- UINT_32 effectiveBpp;
- UINT_32 effectiveSamples;
-
- // 2xAA use the same layout as 4xAA
- if (numSamples == 2)
- {
- numSamples = 4;
- }
-
- //
- // Compute the number of planes.
- //
- if (resolved == FALSE)
- {
- effectiveSamples = ComputeFmaskNumPlanesFromNumSamples(numSamples);
- effectiveBpp = numSamples;
-
- ComputeSurfaceCoordFromAddrMacroTiled(addr,
- bitPosition,
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- 0, // No tileBase
- 0, // No compBits
- ADDR_NON_DISPLAYABLE,
- ignoreSE,
- FALSE,
- pipeSwizzle,
- bankSwizzle,
- pTileInfo,
- pX,
- pY,
- pSlice,
- pPlane);
-
- if (pSample)
- {
- *pSample = bitPosition % numSamples;
- }
- }
- else
- {
- effectiveBpp = ComputeFmaskResolvedBppFromNumSamples(numSamples);
- effectiveSamples = 1;
-
- ComputeSurfaceCoordFromAddrMacroTiled(addr,
- bitPosition,
- effectiveBpp,
- pitch,
- height,
- effectiveSamples,
- tileMode,
- 0, // No tileBase
- 0, // No compBits
- ADDR_NON_DISPLAYABLE,
- ignoreSE,
- TRUE,
- pipeSwizzle,
- bankSwizzle,
- pTileInfo,
- pX,
- pY,
- pSlice,
- pSample);
- }
-}
-
-/**
-****************************************************************************************************
-* EgBasedAddrLib::DispatchComputeFmaskCoordFromAddr
-*
-* @brief
-* Compute (x,y,slice,sample,plane) coordinates from
-* fmask address
-* @return
-* N/A
-*
-****************************************************************************************************
-*/
-VOID EgBasedAddrLib::DispatchComputeFmaskCoordFromAddr(
- const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, ///< [in] input structure
- ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut ///< [out] output structure
- ) const
-{
- UINT_64 addr = pIn->addr;
- UINT_32 bitPosition = pIn->bitPosition;
- UINT_32 pitch = pIn->pitch;
- UINT_32 height = pIn->height;
- UINT_32 numSamples = pIn->numSamples;
- AddrTileMode tileMode = pIn->tileMode;
- BOOL_32 ignoreSE = pIn->ignoreSE;
- ADDR_TILEINFO* pTileInfo = pIn->pTileInfo;
- BOOL_32 resolved = pIn->resolved;
-
- UINT_32* pX = &pOut->x;
- UINT_32* pY = &pOut->y;
- UINT_32* pSlice = &pOut->slice;
- UINT_32* pSample = &pOut->sample;
- UINT_32* pPlane = &pOut->plane;
-
- switch (tileMode)
- {
- case ADDR_TM_1D_TILED_THIN1:
- ComputeFmaskCoordFromAddrMicroTiled(addr,
- bitPosition,
- pitch,
- height,
- numSamples,
- tileMode,
- resolved,
- pX,
- pY,
- pSlice,
- pSample,
- pPlane);
- break;
- case ADDR_TM_2D_TILED_THIN1://fall through
- case ADDR_TM_3D_TILED_THIN1:
- UINT_32 pipeSwizzle;
- UINT_32 bankSwizzle;
-
- if (m_configFlags.useCombinedSwizzle)
- {
- ExtractBankPipeSwizzle(pIn->tileSwizzle, pIn->pTileInfo,
- &bankSwizzle, &pipeSwizzle);
- }
- else
- {
- pipeSwizzle = pIn->pipeSwizzle;
- bankSwizzle = pIn->bankSwizzle;
- }
-
- ComputeFmaskCoordFromAddrMacroTiled(addr,
- bitPosition,
- pitch,
- height,
- numSamples,
- tileMode,
- pipeSwizzle,
- bankSwizzle,
- ignoreSE,
- pTileInfo,
- resolved,
- pX,
- pY,
- pSlice,
- pSample,
- pPlane);
- break;
- default:
- ADDR_ASSERT_ALWAYS();
- break;
-
- }
-}
-#endif
-
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeFmaskNumPlanesFromNumSamples
+* EgBasedLib::ComputeFmaskNumPlanesFromNumSamples
*
* @brief
* Compute fmask number of planes from number of samples
* Number of planes
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputeFmaskNumPlanesFromNumSamples(
+UINT_32 EgBasedLib::ComputeFmaskNumPlanesFromNumSamples(
UINT_32 numSamples) ///< [in] number of samples
{
UINT_32 numPlanes;
/**
****************************************************************************************************
-* EgBasedAddrLib::ComputeFmaskResolvedBppFromNumSamples
+* EgBasedLib::ComputeFmaskResolvedBppFromNumSamples
*
* @brief
* Compute resolved fmask effective bpp based on number of samples
* bpp
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::ComputeFmaskResolvedBppFromNumSamples(
+UINT_32 EgBasedLib::ComputeFmaskResolvedBppFromNumSamples(
UINT_32 numSamples) ///< number of samples
{
UINT_32 bpp;
/**
****************************************************************************************************
-* EgBasedAddrLib::IsTileInfoAllZero
+* EgBasedLib::IsTileInfoAllZero
*
* @brief
* Return TRUE if all field are zero
* Since NULL input is consider to be all zero
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::IsTileInfoAllZero(
- ADDR_TILEINFO* pTileInfo)
+BOOL_32 EgBasedLib::IsTileInfoAllZero(
+ const ADDR_TILEINFO* pTileInfo)
{
BOOL_32 allZero = TRUE;
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlTileInfoEqual
+* EgBasedLib::HwlTileInfoEqual
*
* @brief
* Return TRUE if all field are equal
* Only takes care of current HWL's data
****************************************************************************************************
*/
-BOOL_32 EgBasedAddrLib::HwlTileInfoEqual(
+BOOL_32 EgBasedLib::HwlTileInfoEqual(
const ADDR_TILEINFO* pLeft, ///<[in] Left compare operand
const ADDR_TILEINFO* pRight ///<[in] Right compare operand
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlConvertTileInfoToHW
+* EgBasedLib::HwlConvertTileInfoToHW
* @brief
-* Entry of EgBasedAddrLib ConvertTileInfoToHW
+* Entry of EgBasedLib ConvertTileInfoToHW
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlConvertTileInfoToHW(
+ADDR_E_RETURNCODE EgBasedLib::HwlConvertTileInfoToHW(
const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] input structure
ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeSurfaceInfo
+* EgBasedLib::HwlComputeSurfaceInfo
* @brief
-* Entry of EgBasedAddrLib ComputeSurfaceInfo
+* Entry of EgBasedLib ComputeSurfaceInfo
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceInfo(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceInfo(
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeSurfaceAddrFromCoord
+* EgBasedLib::HwlComputeSurfaceAddrFromCoord
* @brief
-* Entry of EgBasedAddrLib ComputeSurfaceAddrFromCoord
+* Entry of EgBasedLib ComputeSurfaceAddrFromCoord
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceAddrFromCoord(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceAddrFromCoord(
const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeSurfaceCoordFromAddr
+* EgBasedLib::HwlComputeSurfaceCoordFromAddr
* @brief
-* Entry of EgBasedAddrLib ComputeSurfaceCoordFromAddr
+* Entry of EgBasedLib ComputeSurfaceCoordFromAddr
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceCoordFromAddr(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSurfaceCoordFromAddr(
const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeSliceTileSwizzle
+* EgBasedLib::HwlComputeSliceTileSwizzle
* @brief
-* Entry of EgBasedAddrLib ComputeSurfaceCoordFromAddr
+* Entry of EgBasedLib ComputeSurfaceCoordFromAddr
* @return
* ADDR_E_RETURNCODE
****************************************************************************************************
*/
-ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSliceTileSwizzle(
+ADDR_E_RETURNCODE EgBasedLib::HwlComputeSliceTileSwizzle(
const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn, ///< [in] input structure
ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut ///< [out] output structure
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeHtileBpp
+* EgBasedLib::HwlComputeHtileBpp
*
* @brief
* Compute htile bpp
* Htile bpp
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::HwlComputeHtileBpp(
+UINT_32 EgBasedLib::HwlComputeHtileBpp(
BOOL_32 isWidth8, ///< [in] TRUE if block width is 8
BOOL_32 isHeight8 ///< [in] TRUE if block height is 8
) const
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlComputeHtileBaseAlign
+* EgBasedLib::HwlComputeHtileBaseAlign
*
* @brief
* Compute htile base alignment
* Htile base alignment
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::HwlComputeHtileBaseAlign(
+UINT_32 EgBasedLib::HwlComputeHtileBaseAlign(
BOOL_32 isTcCompatible, ///< [in] if TC compatible
BOOL_32 isLinear, ///< [in] if it is linear mode
ADDR_TILEINFO* pTileInfo ///< [in] Tile info
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlGetPitchAlignmentMicroTiled
+* EgBasedLib::HwlGetPitchAlignmentMicroTiled
*
* @brief
* Compute 1D tiled surface pitch alignment, calculation results are returned through
* pitch alignment
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::HwlGetPitchAlignmentMicroTiled(
+UINT_32 EgBasedLib::HwlGetPitchAlignmentMicroTiled(
AddrTileMode tileMode, ///< [in] tile mode
UINT_32 bpp, ///< [in] bits per pixel
ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled
+* EgBasedLib::HwlGetSizeAdjustmentMicroTiled
*
* @brief
* Adjust 1D tiled surface pitch and slice size
* Logical slice size in bytes
****************************************************************************************************
*/
-UINT_64 EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled(
+UINT_64 EgBasedLib::HwlGetSizeAdjustmentMicroTiled(
UINT_32 thickness, ///< [in] thickness
UINT_32 bpp, ///< [in] bits per pixel
ADDR_SURFACE_FLAGS flags, ///< [in] surface flags
UINT_32 numSamples, ///< [in] number of samples
UINT_32 baseAlign, ///< [in] base alignment
UINT_32 pitchAlign, ///< [in] pitch alignment
- UINT_32* pPitch, ///< [in/out] pointer to pitch
- UINT_32* pHeight ///< [in/out] pointer to height
+ UINT_32* pPitch, ///< [in,out] pointer to pitch
+ UINT_32* pHeight ///< [in,out] pointer to height
) const
{
UINT_64 logicalSliceSize;
/**
****************************************************************************************************
-* EgBasedAddrLib::HwlStereoCheckRightOffsetPadding
+* EgBasedLib::HwlStereoCheckRightOffsetPadding
*
* @brief
* check if the height needs extra padding for stereo right eye offset, to avoid swizzling
*
****************************************************************************************************
*/
-UINT_32 EgBasedAddrLib::HwlStereoCheckRightOffsetPadding(
+UINT_32 EgBasedLib::HwlStereoCheckRightOffsetPadding(
ADDR_TILEINFO* pTileInfo ///< Tiling info
) const
{
return stereoHeightAlign;
}
+} // V1
+} // Addr