[Mesa-dev] [PATCH 1/4] amd/addrlib: add Addr2IsValidDisplaySwizzleMode
Marek Olšák
maraeo at gmail.com
Mon Oct 9 17:05:03 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
Some "standard" (_S) swizzle modes are displayable on Raven,
even though the micro tile mode says it's not displayable.
Expose the addrlib function to the driver.
---
src/amd/addrlib/addrinterface.cpp | 34 ++++++++++++++++++++++++++++++++++
src/amd/addrlib/addrinterface.h | 14 ++++++++++++++
src/amd/addrlib/core/addrlib2.h | 7 +++++++
src/amd/addrlib/gfx9/gfx9addrlib.h | 5 +++--
4 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/src/amd/addrlib/addrinterface.cpp b/src/amd/addrlib/addrinterface.cpp
index 85e298d..638556b 100644
--- a/src/amd/addrlib/addrinterface.cpp
+++ b/src/amd/addrlib/addrinterface.cpp
@@ -1668,10 +1668,44 @@ ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting(
returnCode = pLib->Addr2GetPreferredSurfaceSetting(pIn, pOut);
}
else
{
returnCode = ADDR_ERROR;
}
return returnCode;
}
+/**
+****************************************************************************************************
+* Addr2IsValidDisplaySwizzleMode
+*
+* @brief
+* Return whether the swizzle mode is supported by DCE / DCN.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
+ ADDR_HANDLE hLib,
+ AddrSwizzleMode swizzleMode,
+ UINT_32 bpp,
+ bool *result)
+{
+ ADDR_E_RETURNCODE returnCode;
+
+ V2::Lib* pLib = V2::Lib::GetLib(hLib);
+
+ if (pLib != NULL)
+ {
+ ADDR2_COMPUTE_SURFACE_INFO_INPUT in;
+ in.swizzleMode = swizzleMode;
+ in.bpp = bpp;
+
+ *result = pLib->IsValidDisplaySwizzleMode(&in);
+ returnCode = ADDR_OK;
+ }
+ else
+ {
+ returnCode = ADDR_ERROR;
+ }
+
+ return returnCode;
+}
diff --git a/src/amd/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
index b9d4d8f..f0da083 100644
--- a/src/amd/addrlib/addrinterface.h
+++ b/src/amd/addrlib/addrinterface.h
@@ -3646,15 +3646,29 @@ typedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
*
* @brief
* Suggest a preferred setting for client driver to program HW register
****************************************************************************************************
*/
ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting(
ADDR_HANDLE hLib,
const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut);
+/**
+****************************************************************************************************
+* Addr2IsValidDisplaySwizzleMode
+*
+* @brief
+* Return whether the swizzle mode is supported by DCE / DCN.
+****************************************************************************************************
+*/
+ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
+ ADDR_HANDLE hLib,
+ AddrSwizzleMode swizzleMode,
+ UINT_32 bpp,
+ bool *result);
+
#if defined(__cplusplus)
}
#endif
#endif // __ADDR_INTERFACE_H__
diff --git a/src/amd/addrlib/core/addrlib2.h b/src/amd/addrlib/core/addrlib2.h
index c9d7df0..e98fddc 100644
--- a/src/amd/addrlib/core/addrlib2.h
+++ b/src/amd/addrlib/core/addrlib2.h
@@ -171,20 +171,27 @@ public:
ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut);
ADDR_E_RETURNCODE ComputeSubResourceOffsetForSwizzlePattern(
const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut);
ADDR_E_RETURNCODE Addr2GetPreferredSurfaceSetting(
const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut) const;
+ virtual BOOL_32 IsValidDisplaySwizzleMode(
+ const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
+ {
+ ADDR_NOT_IMPLEMENTED();
+ return ADDR_NOTIMPLEMENTED;
+ }
+
protected:
Lib(); // Constructor is protected
Lib(const Client* pClient);
static const UINT_32 MaxNumOfBpp = 5;
static const Dim2d Block256_2d[MaxNumOfBpp];
static const Dim3d Block1K_3d[MaxNumOfBpp];
static const UINT_32 PrtAlignment = 64 * 1024;
diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.h b/src/amd/addrlib/gfx9/gfx9addrlib.h
index b7d1287..418ccac 100644
--- a/src/amd/addrlib/gfx9/gfx9addrlib.h
+++ b/src/amd/addrlib/gfx9/gfx9addrlib.h
@@ -90,20 +90,23 @@ enum Gfx9DataType
class Gfx9Lib : public Lib
{
public:
/// Creates Gfx9Lib object
static Addr::Lib* CreateObj(const Client* pClient)
{
VOID* pMem = Object::ClientAlloc(sizeof(Gfx9Lib), pClient);
return (pMem != NULL) ? new (pMem) Gfx9Lib(pClient) : NULL;
}
+ virtual BOOL_32 IsValidDisplaySwizzleMode(
+ const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
+
protected:
Gfx9Lib(const Client* pClient);
virtual ~Gfx9Lib();
virtual BOOL_32 HwlIsStandardSwizzle(
AddrResourceType resourceType,
AddrSwizzleMode swizzleMode) const
{
return m_swizzleModeTable[swizzleMode].isStd ||
(IsTex3d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp);
@@ -398,20 +401,18 @@ private:
UINT_32 metaBlkDepthLog2, UINT_32 compBlkWidthLog2,
UINT_32 compBlkHeightLog2, UINT_32 compBlkDepthLog2) const;
virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
VOID GetMetaMipInfo(UINT_32 numMipLevels, Dim3d* pMetaBlkDim,
BOOL_32 dataThick, ADDR2_META_MIP_INFO* pInfo,
UINT_32 mip0Width, UINT_32 mip0Height, UINT_32 mip0Depth,
UINT_32* pNumMetaBlkX, UINT_32* pNumMetaBlkY, UINT_32* pNumMetaBlkZ) const;
- BOOL_32 IsValidDisplaySwizzleMode(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
-
Gfx9ChipSettings m_settings;
};
} // V2
} // Addr
#endif
--
2.7.4
More information about the mesa-dev
mailing list