aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavi Zhang <[email protected]>2014-08-20 04:46:51 -0400
committerMarek Olšák <[email protected]>2017-03-30 14:44:33 +0200
commitb5d8120a07802bd14e2031642fb426838a71d31b (patch)
tree976ee83763c81b2c4281f211902552720ac7474a
parent3c3d620cf39ba1755da4faced426739ef653734b (diff)
amdgpu/addrlib: Add GetMaxAlignments
-rw-r--r--src/amd/addrlib/addrinterface.cpp30
-rw-r--r--src/amd/addrlib/addrinterface.h26
-rw-r--r--src/amd/addrlib/core/addrlib.cpp33
-rw-r--r--src/amd/addrlib/core/addrlib.h6
-rw-r--r--src/amd/addrlib/r800/ciaddrlib.cpp40
-rw-r--r--src/amd/addrlib/r800/ciaddrlib.h3
-rw-r--r--src/amd/addrlib/r800/siaddrlib.cpp45
-rw-r--r--src/amd/addrlib/r800/siaddrlib.h2
8 files changed, 184 insertions, 1 deletions
diff --git a/src/amd/addrlib/addrinterface.cpp b/src/amd/addrlib/addrinterface.cpp
index 65569278b1e..b2120c644bf 100644
--- a/src/amd/addrlib/addrinterface.cpp
+++ b/src/amd/addrlib/addrinterface.cpp
@@ -1006,3 +1006,33 @@ ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo(
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;
+}
diff --git a/src/amd/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
index a50717c1ceb..764377a4b47 100644
--- a/src/amd/addrlib/addrinterface.h
+++ b/src/amd/addrlib/addrinterface.h
@@ -2145,6 +2145,32 @@ ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo(
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
diff --git a/src/amd/addrlib/core/addrlib.cpp b/src/amd/addrlib/core/addrlib.cpp
index b92568ec183..4804b0d79d9 100644
--- a/src/amd/addrlib/core/addrlib.cpp
+++ b/src/amd/addrlib/core/addrlib.cpp
@@ -1872,6 +1872,39 @@ ADDR_E_RETURNCODE AddrLib::ComputeCmaskCoordFromAddr(
/**
***************************************************************************************************
+* 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
*
* @brief
diff --git a/src/amd/addrlib/core/addrlib.h b/src/amd/addrlib/core/addrlib.h
index d693fd2bcbf..3221120f8f7 100644
--- a/src/amd/addrlib/core/addrlib.h
+++ b/src/amd/addrlib/core/addrlib.h
@@ -312,6 +312,8 @@ public:
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);
@@ -419,6 +421,10 @@ protected:
{
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
diff --git a/src/amd/addrlib/r800/ciaddrlib.cpp b/src/amd/addrlib/r800/ciaddrlib.cpp
index 5e5110a7016..1176ead49ba 100644
--- a/src/amd/addrlib/r800/ciaddrlib.cpp
+++ b/src/amd/addrlib/r800/ciaddrlib.cpp
@@ -1819,3 +1819,43 @@ VOID CiAddrLib::HwlPadDimensions(
}
}
+/**
+***************************************************************************************************
+* 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;
+}
diff --git a/src/amd/addrlib/r800/ciaddrlib.h b/src/amd/addrlib/r800/ciaddrlib.h
index 4862babb483..5630959f0ac 100644
--- a/src/amd/addrlib/r800/ciaddrlib.h
+++ b/src/amd/addrlib/r800/ciaddrlib.h
@@ -154,7 +154,8 @@ protected:
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,
diff --git a/src/amd/addrlib/r800/siaddrlib.cpp b/src/amd/addrlib/r800/siaddrlib.cpp
index 902e9f27acf..4d791cef2bf 100644
--- a/src/amd/addrlib/r800/siaddrlib.cpp
+++ b/src/amd/addrlib/r800/siaddrlib.cpp
@@ -2816,3 +2816,48 @@ BOOL_32 SiAddrLib::HwlOverrideTileMode(
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;
+}
diff --git a/src/amd/addrlib/r800/siaddrlib.h b/src/amd/addrlib/r800/siaddrlib.h
index 034001a914b..04f7adcac8f 100644
--- a/src/amd/addrlib/r800/siaddrlib.h
+++ b/src/amd/addrlib/r800/siaddrlib.h
@@ -227,6 +227,8 @@ protected:
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,