[Mesa-dev] [PATCH 023/140] amdgpu/addrlib: Add new interface to support macro mode index query
Marek Olšák
maraeo at gmail.com
Mon Mar 20 22:42:33 UTC 2017
From: Frans Gu <frans.gu at amd.com>
---
src/amd/addrlib/addrinterface.cpp | 32 +++++++++++++++++++++++++++++
src/amd/addrlib/addrinterface.h | 42 +++++++++++++++++++++++++++++++++++++++
src/amd/addrlib/core/addrlib1.cpp | 37 ++++++++++++++++++++++++++++++++++
src/amd/addrlib/core/addrlib1.h | 4 ++++
4 files changed, 115 insertions(+)
diff --git a/src/amd/addrlib/addrinterface.cpp b/src/amd/addrlib/addrinterface.cpp
index 8e6e7ea..196cd69 100644
--- a/src/amd/addrlib/addrinterface.cpp
+++ b/src/amd/addrlib/addrinterface.cpp
@@ -904,20 +904,52 @@ ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
else
{
returnCode = ADDR_ERROR;
}
return returnCode;
}
/**
***************************************************************************************************
+* AddrGetMacroModeIndex
+*
+* @brief
+* Get macro mode index based on input parameters
+*
+* @return
+* ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
+ ADDR_HANDLE hLib, ///< address lib handle
+ const ADDR_GET_MACROMODEINDEX_INPUT* pIn, ///< [in] input
+ ADDR_GET_MACROMODEINDEX_OUTPUT* pOut) ///< [out] macro mode index
+{
+ AddrLib1* pLib = AddrLib1::GetAddrLib1(hLib);
+
+ ADDR_E_RETURNCODE returnCode;
+
+ if (pLib != NULL)
+ {
+ returnCode = pLib->GetMacroModeIndex(pIn, pOut);
+ }
+ else
+ {
+ returnCode = ADDR_ERROR;
+ }
+
+ return returnCode;
+}
+
+/**
+***************************************************************************************************
* AddrConvertTileIndex1
*
* @brief
* Convert tile index to tile mode/type/info
*
* @return
* ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
***************************************************************************************************
*/
ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1(
diff --git a/src/amd/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
index 0795967..cc1024b 100644
--- a/src/amd/addrlib/addrinterface.h
+++ b/src/amd/addrlib/addrinterface.h
@@ -1957,21 +1957,63 @@ typedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT
*
* @brief
* Convert tile index to tile mode/type/info
***************************************************************************************************
*/
ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
ADDR_HANDLE hLib,
const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
ADDR_CONVERT_TILEINDEX_OUTPUT* pOut);
+/**
+***************************************************************************************************
+* ADDR_GET_MACROMODEINDEX_INPUT
+*
+* @brief
+* Input structure for AddrGetMacroModeIndex
+***************************************************************************************************
+*/
+typedef struct _ADDR_GET_MACROMODEINDEX_INPUT
+{
+ UINT_32 size; ///< Size of this structure in bytes
+ ADDR_SURFACE_FLAGS flags; ///< Surface flag
+ INT_32 tileIndex; ///< Tile index
+ UINT_32 bpp; ///< Bits per pixel
+ UINT_32 numFrags; ///< Number of color fragments
+} ADDR_GET_MACROMODEINDEX_INPUT;
+/**
+***************************************************************************************************
+* ADDR_GET_MACROMODEINDEX_OUTPUT
+*
+* @brief
+* Output structure for AddrGetMacroModeIndex
+***************************************************************************************************
+*/
+typedef struct _ADDR_GET_MACROMODEINDEX_OUTPUT
+{
+ UINT_32 size; ///< Size of this structure in bytes
+ INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI)
+} ADDR_GET_MACROMODEINDEX_OUTPUT;
+
+/**
+***************************************************************************************************
+* AddrGetMacroModeIndex
+*
+* @brief
+* Get macro mode index based on input parameters
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
+ ADDR_HANDLE hLib,
+ const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
+ ADDR_GET_MACROMODEINDEX_OUTPUT* pOut);
/**
***************************************************************************************************
* ADDR_CONVERT_TILEINDEX1_INPUT
*
* @brief
* Input structure for AddrConvertTileIndex1 (without macro mode index)
***************************************************************************************************
*/
typedef struct _ADDR_CONVERT_TILEINDEX1_INPUT
diff --git a/src/amd/addrlib/core/addrlib1.cpp b/src/amd/addrlib/core/addrlib1.cpp
index f0fd08c..6895917 100644
--- a/src/amd/addrlib/core/addrlib1.cpp
+++ b/src/amd/addrlib/core/addrlib1.cpp
@@ -1074,20 +1074,57 @@ ADDR_E_RETURNCODE AddrLib1::ConvertTileIndex(
returnCode = HwlConvertTileInfoToHW(&hwInput, &hwOutput);
}
}
return returnCode;
}
/**
***************************************************************************************************
+* AddrLib1::GetMacroModeIndex
+*
+* @brief
+* Get macro mode index based on input info
+*
+* @return
+* ADDR_E_RETURNCODE
+***************************************************************************************************
+*/
+ADDR_E_RETURNCODE AddrLib1::GetMacroModeIndex(
+ const ADDR_GET_MACROMODEINDEX_INPUT* pIn, ///< [in] input structure
+ ADDR_GET_MACROMODEINDEX_OUTPUT* pOut ///< [out] output structure
+ ) const
+{
+ ADDR_E_RETURNCODE returnCode = ADDR_OK;
+
+ if (GetFillSizeFieldsFlags())
+ {
+ if ((pIn->size != sizeof(ADDR_GET_MACROMODEINDEX_INPUT)) ||
+ (pOut->size != sizeof(ADDR_GET_MACROMODEINDEX_OUTPUT)))
+ {
+ returnCode = ADDR_PARAMSIZEMISMATCH;
+ }
+ }
+
+ if (returnCode == ADDR_OK)
+ {
+ ADDR_TILEINFO tileInfo = {0};
+ pOut->macroModeIndex = HwlComputeMacroModeIndex(pIn->tileIndex, pIn->flags, pIn->bpp,
+ pIn->numFrags, &tileInfo);
+ }
+
+ return returnCode;
+}
+
+/**
+***************************************************************************************************
* AddrLib1::ConvertTileIndex1
*
* @brief
* Convert tile index to tile mode/type/info
*
* @return
* ADDR_E_RETURNCODE
***************************************************************************************************
*/
ADDR_E_RETURNCODE AddrLib1::ConvertTileIndex1(
diff --git a/src/amd/addrlib/core/addrlib1.h b/src/amd/addrlib/core/addrlib1.h
index 25af637..94ca5a5 100644
--- a/src/amd/addrlib/core/addrlib1.h
+++ b/src/amd/addrlib/core/addrlib1.h
@@ -136,20 +136,24 @@ public:
ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
ADDR_E_RETURNCODE ConvertTileInfoToHW(
const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
ADDR_E_RETURNCODE ConvertTileIndex(
const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
+ ADDR_E_RETURNCODE GetMacroModeIndex(
+ const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
+ ADDR_GET_MACROMODEINDEX_OUTPUT* pOut) const;
+
ADDR_E_RETURNCODE ConvertTileIndex1(
const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,
ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
ADDR_E_RETURNCODE GetTileIndex(
const ADDR_GET_TILEINDEX_INPUT* pIn,
ADDR_GET_TILEINDEX_OUTPUT* pOut) const;
ADDR_E_RETURNCODE ComputeHtileInfo(
const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn,
--
2.7.4
More information about the mesa-dev
mailing list