return returnCode;
}
+/**
+***************************************************************************************************
+* AddrGetMaxAlignments
+*
+* @brief
+* Convert maximum alignments
+*
+* @return
+* ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
+ ADDR_HANDLE hLib, ///< [in] address lib handle
+ ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) ///< [out] output structure
+{
+ AddrLib* pLib = AddrLib::GetAddrLib(hLib);
+
+ ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+ if (pLib != NULL)
+ {
+ returnCode = pLib->GetMaxAlignments(pOut);
+ }
+ else
+ {
+ returnCode = ADDR_ERROR;
+ }
+
+ return returnCode;
+}
const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
ADDR_COMPUTE_DCCINFO_OUTPUT* pOut);
+/**
+***************************************************************************************************
+* ADDR_GET_MAX_ALINGMENTS_OUTPUT
+*
+* @brief
+* Output structure of AddrGetMaxAlignments
+***************************************************************************************************
+*/
+typedef struct _ADDR_GET_MAX_ALINGMENTS_OUTPUT
+{
+ UINT_32 size; ///< Size of this structure in bytes
+ UINT_64 baseAlign; ///< Maximum base alignment in bytes
+} ADDR_GET_MAX_ALINGMENTS_OUTPUT;
+
+/**
+***************************************************************************************************
+* AddrGetMaxAlignments
+*
+* @brief
+* Gets maximnum alignments
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
+ ADDR_HANDLE hLib,
+ ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut);
+
#if defined(__cplusplus)
}
#endif
return returnCode;
}
+/**
+***************************************************************************************************
+* AddrLib::GetMaxAlignments
+*
+* @brief
+* Gets maximum alignments
+*
+* @return
+* ADDR_E_RETURNCODE
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE AddrLib::GetMaxAlignments(
+ ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut ///< [out] output structure
+ ) const
+{
+ ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+ if (GetFillSizeFieldsFlags() == TRUE)
+ {
+ if (pOut->size != sizeof(ADDR_GET_MAX_ALINGMENTS_OUTPUT))
+ {
+ returnCode = ADDR_PARAMSIZEMISMATCH;
+ }
+ }
+
+ if (returnCode == ADDR_OK)
+ {
+ returnCode = HwlGetMaxAlignments(pOut);
+ }
+
+ return returnCode;
+}
+
/**
***************************************************************************************************
* AddrLib::ComputeTileDataWidthAndHeight
BOOL_32 GetExportNorm(
const ELEM_GETEXPORTNORM_INPUT* pIn) const;
+ ADDR_E_RETURNCODE GetMaxAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
+
protected:
AddrLib(); // Constructor is protected
AddrLib(const AddrClient* pClient);
{
return ADDR_NOTSUPPORTED;
}
+
+ /// Pure virtual function to get max alignments
+ virtual ADDR_E_RETURNCODE HwlGetMaxAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const = 0;
+
// Compute attributes
// HTILE
}
}
+/**
+***************************************************************************************************
+* CiAddrLib::HwlGetMaxAlignments
+*
+* @brief
+* Gets maximum alignments
+* @return
+* ADDR_E_RETURNCODE
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE CiAddrLib::HwlGetMaxAlignments(
+ ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut ///< [out] output structure
+ ) const
+{
+ const UINT_32 pipes = HwlGetPipes(&m_tileTable[0].info);
+
+ // Initial size is 64 KiB for PRT.
+ UINT_64 maxBaseAlign = 64 * 1024;
+
+ for (UINT_32 i = 0; i < m_noOfMacroEntries; i++)
+ {
+ // The maximum tile size is 16 byte-per-pixel and either 8-sample or 8-slice.
+ UINT_32 tileSize = m_macroTileTable[i].tileSplitBytes;
+
+ UINT_64 baseAlign = tileSize * pipes * m_macroTileTable[i].banks *
+ m_macroTileTable[i].bankWidth * m_macroTileTable[i].bankHeight;
+
+ if (baseAlign > maxBaseAlign)
+ {
+ maxBaseAlign = baseAlign;
+ }
+ }
+
+ if (pOut != NULL)
+ {
+ pOut->baseAlign = maxBaseAlign;
+ }
+
+ return ADDR_OK;
+}
const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
-protected:
+ virtual ADDR_E_RETURNCODE HwlGetMaxAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
+
virtual VOID HwlPadDimensions(
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 padDims, UINT_32 mipLevel,
return bOverrided;
}
+/**
+***************************************************************************************************
+* SiAddrLib::HwlGetMaxAlignments
+*
+* @brief
+* Gets maximum alignments
+* @return
+* ADDR_E_RETURNCODE
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE SiAddrLib::HwlGetMaxAlignments(
+ ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut ///< [out] output structure
+ ) const
+{
+ const UINT_32 pipes = HwlGetPipes(&m_tileTable[0].info);
+
+ // Initial size is 64 KiB for PRT.
+ UINT_64 maxBaseAlign = 64 * 1024;
+
+ for (UINT_32 i = 0; i < m_noOfEntries; i++)
+ {
+ if ((IsMacroTiled(m_tileTable[i].mode) == TRUE) &&
+ (IsPrtTileMode(m_tileTable[i].mode) == FALSE))
+ {
+ // The maximum tile size is 16 byte-per-pixel and either 8-sample or 8-slice.
+ UINT_32 tileSize = Min(m_tileTable[i].info.tileSplitBytes,
+ MicroTilePixels * 8 * 16);
+
+ UINT_64 baseAlign = tileSize * pipes * m_tileTable[i].info.banks *
+ m_tileTable[i].info.bankWidth * m_tileTable[i].info.bankHeight;
+
+ if (baseAlign > maxBaseAlign)
+ {
+ maxBaseAlign = baseAlign;
+ }
+ }
+ }
+
+ if (pOut != NULL)
+ {
+ pOut->baseAlign = maxBaseAlign;
+ }
+
+ return ADDR_OK;
+}
return TRUE;
}
+ virtual ADDR_E_RETURNCODE HwlGetMaxAlignments(ADDR_GET_MAX_ALINGMENTS_OUTPUT* pOut) const;
+
// Protected non-virtual functions
VOID ComputeTileCoordFromPipeAndElemIdx(
UINT_32 elemIdx, UINT_32 pipe, AddrPipeCfg pipeCfg, UINT_32 pitchInMacroTile,