[Mesa-dev] [PATCH 027/140] amdgpu/addrlib: Add a flag to skip calculate indices

Marek Olšák maraeo at gmail.com
Mon Mar 20 22:42:37 UTC 2017


From: Xavi Zhang <xavi.zhang at amd.com>

This is useful for debugging and special cases for stencil surfaces
do not require texture fetch compatible.
---
 src/amd/addrlib/addrinterface.h     |  3 ++-
 src/amd/addrlib/r800/egbaddrlib.cpp | 30 ++++++++++++++++++------------
 src/amd/addrlib/r800/siaddrlib.cpp  |  2 +-
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/amd/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
index 95b187f..3604fb1 100644
--- a/src/amd/addrlib/addrinterface.h
+++ b/src/amd/addrlib/addrinterface.h
@@ -506,21 +506,22 @@ typedef union _ADDR_SURFACE_FLAGS
         UINT_32 czDispCompatible     : 1; ///< SI+: CZ family has a HW bug needs special alignment.
                                           ///  This flag indicates we need to follow the
                                           ///  alignment with CZ families or other ASICs under
                                           ///  PX configuration + CZ.
         UINT_32 nonSplit             : 1; ///< CI: depth texture should not be split
         UINT_32 disableLinearOpt     : 1; ///< Disable tile mode optimization to linear
         UINT_32 needEquation         : 1; ///< Make the surface tile setting equation compatible.
                                           ///  This flag indicates we need to override tile
                                           ///  mode to PRT_* tile mode to disable slice rotation,
                                           ///  which is needed by swizzle pattern equation.
-        UINT_32 reserved             : 8; ///< Reserved bits
+        UINT_32 skipIndicesOutput    : 1; ///< Skipping indices in output.
+        UINT_32 reserved             : 7; ///< Reserved bits
     };
 
     UINT_32 value;
 } ADDR_SURFACE_FLAGS;
 
 /**
 ***************************************************************************************************
 *   ADDR_COMPUTE_SURFACE_INFO_INPUT
 *
 *   @brief
diff --git a/src/amd/addrlib/r800/egbaddrlib.cpp b/src/amd/addrlib/r800/egbaddrlib.cpp
index 854d572..0c1ddca 100644
--- a/src/amd/addrlib/r800/egbaddrlib.cpp
+++ b/src/amd/addrlib/r800/egbaddrlib.cpp
@@ -4479,33 +4479,39 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceInfo(
         if (pOut->pTileInfo == NULL)
         {
             pOut->pTileInfo = &tileInfo;
         }
 
         if (DispatchComputeSurfaceInfo(pIn, pOut) == FALSE)
         {
             retCode = ADDR_INVALIDPARAMS;
         }
 
-        // Returns an index
-        pOut->tileIndex = HwlPostCheckTileIndex(pOut->pTileInfo,
-                                                pOut->tileMode,
-                                                pOut->tileType,
-                                                pOut->tileIndex);
-
-        if (IsMacroTiled(pOut->tileMode) && (pOut->macroModeIndex == TileIndexInvalid))
+        // In case client uses tile info as input and would like to calculate a correct size and
+        // alignment together with tile info as output when the tile info is not suppose to have any
+        // matching indices in tile mode tables.
+        if (pIn->flags.skipIndicesOutput == FALSE)
         {
-            pOut->macroModeIndex = HwlComputeMacroModeIndex(pOut->tileIndex,
-                                                            pIn->flags,
-                                                            pIn->bpp,
-                                                            pIn->numSamples,
-                                                            pOut->pTileInfo);
+            // Returns an index
+            pOut->tileIndex = HwlPostCheckTileIndex(pOut->pTileInfo,
+                                                    pOut->tileMode,
+                                                    pOut->tileType,
+                                                    pOut->tileIndex);
+
+            if (IsMacroTiled(pOut->tileMode) && (pOut->macroModeIndex == TileIndexInvalid))
+            {
+                pOut->macroModeIndex = HwlComputeMacroModeIndex(pOut->tileIndex,
+                                                                pIn->flags,
+                                                                pIn->bpp,
+                                                                pIn->numSamples,
+                                                                pOut->pTileInfo);
+            }
         }
 
         // Resets pTileInfo to NULL if the internal tile info is used
         if (pOut->pTileInfo == &tileInfo)
         {
 #if DEBUG
             // Client does not pass in a valid pTileInfo
             if (IsMacroTiled(pOut->tileMode))
             {
                 // If a valid index is returned, then no pTileInfo is okay
diff --git a/src/amd/addrlib/r800/siaddrlib.cpp b/src/amd/addrlib/r800/siaddrlib.cpp
index 686bb7f..4822d77 100644
--- a/src/amd/addrlib/r800/siaddrlib.cpp
+++ b/src/amd/addrlib/r800/siaddrlib.cpp
@@ -3267,21 +3267,21 @@ VOID SiAddrLib::InitEquationTable()
 
     memset(m_blockSlices, 0, sizeof(m_blockSlices));
 
     // Loop all possible bpp
     for (UINT_32 log2ElementBytes = 0; log2ElementBytes < MaxNumElementBytes; log2ElementBytes++)
     {
         // Get bits per pixel
         UINT_32 bpp = 1 << (log2ElementBytes + 3);
 
         // Loop all possible tile index
-        for (INT_32 tileIndex = 0; tileIndex < m_noOfEntries; tileIndex++)
+        for (INT_32 tileIndex = 0; tileIndex < static_cast<INT_32>(m_noOfEntries); tileIndex++)
         {
             UINT_32 equationIndex = ADDR_INVALID_EQUATION_INDEX;
 
             AddrTileConfig tileConfig = m_tileTable[tileIndex];
 
             ADDR_SURFACE_FLAGS flags = {{0}};
 
             // Compute tile info, hardcode numSamples to 1 because MSAA is not supported
             // in swizzle pattern equation
             HwlComputeMacroModeIndex(tileIndex, flags, bpp, 1, &tileConfig.info, NULL, NULL);
-- 
2.7.4



More information about the mesa-dev mailing list