From c3f3685fd655550bb189aac814126e5feb56db2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 9 Oct 2017 18:31:12 +0200 Subject: [PATCH] amd/addrlib: add Addr2IsValidDisplaySwizzleMode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. Reviewed-by: Nicolai Hähnle --- 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 85e298ddf2d..638556bd893 100644 --- a/src/amd/addrlib/addrinterface.cpp +++ b/src/amd/addrlib/addrinterface.cpp @@ -1675,3 +1675,37 @@ ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting( 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 b9d4d8f782c..f0da083af5d 100644 --- a/src/amd/addrlib/addrinterface.h +++ b/src/amd/addrlib/addrinterface.h @@ -3653,6 +3653,20 @@ ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting( 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 diff --git a/src/amd/addrlib/core/addrlib2.h b/src/amd/addrlib/core/addrlib2.h index c9d7df0303e..e98fddcd2d0 100644 --- a/src/amd/addrlib/core/addrlib2.h +++ b/src/amd/addrlib/core/addrlib2.h @@ -178,6 +178,13 @@ public: 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); diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.h b/src/amd/addrlib/gfx9/gfx9addrlib.h index b7d12871665..418ccac5142 100644 --- a/src/amd/addrlib/gfx9/gfx9addrlib.h +++ b/src/amd/addrlib/gfx9/gfx9addrlib.h @@ -97,6 +97,9 @@ public: 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(); @@ -405,8 +408,6 @@ private: 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; }; -- 2.30.2