amdgpu/addrlib: Add a flag to skip calculate indices
authorXavi Zhang <xavi.zhang@amd.com>
Fri, 17 Apr 2015 07:22:34 +0000 (03:22 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 30 Mar 2017 12:44:33 +0000 (14:44 +0200)
This is useful for debugging and special cases for stencil surfaces
do not require texture fetch compatible.

src/amd/addrlib/addrinterface.h
src/amd/addrlib/r800/egbaddrlib.cpp
src/amd/addrlib/r800/siaddrlib.cpp

index 95b187fbebc6d52bb507539f3cbc6d5b49246dd9..3604fb11ce57f93d6c74f82cdf18c0f91ea3c678 100644 (file)
@@ -513,7 +513,8 @@ typedef union _ADDR_SURFACE_FLAGS
                                           ///  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;
index 854d5725df2727461a7d2681fcd851c230cec263..0c1ddca10a3767e04f7706f7c0d43895966f3fca 100644 (file)
@@ -4486,19 +4486,25 @@ ADDR_E_RETURNCODE EgBasedAddrLib::HwlComputeSurfaceInfo(
             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
index 686bb7fc3434675b867b14b42d6e1954c893a256..4822d77a4c2e19a1208ccc099268c0d94a0ae0ce 100644 (file)
@@ -3274,7 +3274,7 @@ VOID SiAddrLib::InitEquationTable()
         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;