[Mesa-dev] [PATCH 049/140] amdgpu/addrlib: Fix the issue that tcCompatible HTILE slice size is not calculated correctly

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


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/amd/addrlib/addrinterface.h   |  2 ++
 src/amd/addrlib/core/addrlib1.cpp | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/src/amd/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
index 8506a45..d2d6d94 100644
--- a/src/amd/addrlib/addrinterface.h
+++ b/src/amd/addrlib/addrinterface.h
@@ -899,20 +899,22 @@ typedef struct _ADDR_COMPUTE_HTILE_INFO_OUTPUT
     UINT_32 pitch;              ///< Pitch in pixels of depth buffer represented in this
                                 ///  HTile buffer. This might be larger than original depth
                                 ///  buffer pitch when called with an unaligned pitch.
     UINT_32 height;             ///< Height in pixels, as above
     UINT_64 htileBytes;         ///< Size of HTILE buffer, in bytes
     UINT_32 baseAlign;          ///< Base alignment
     UINT_32 bpp;                ///< Bits per pixel for HTILE is how many bits for an 8x8 block!
     UINT_32 macroWidth;         ///< Macro width in pixels, actually squared cache shape
     UINT_32 macroHeight;        ///< Macro height in pixels
     UINT_64 sliceSize;          ///< Slice size, in bytes.
+    BOOL_32 sliceInterleaved;   ///< Flag to indicate if different slice's htile is interleaved
+                                ///  Compute engine clear can't be used if htile is interleaved
 } ADDR_COMPUTE_HTILE_INFO_OUTPUT;
 
 /**
 ****************************************************************************************************
 *   AddrComputeHtileInfo
 *
 *   @brief
 *       Compute Htile pitch, height, base alignment and size in bytes
 ****************************************************************************************************
 */
diff --git a/src/amd/addrlib/core/addrlib1.cpp b/src/amd/addrlib/core/addrlib1.cpp
index fb33145..809bca2 100644
--- a/src/amd/addrlib/core/addrlib1.cpp
+++ b/src/amd/addrlib/core/addrlib1.cpp
@@ -1288,20 +1288,36 @@ ADDR_E_RETURNCODE Lib::ComputeHtileInfo(
                                          isWidth8,
                                          isHeight8,
                                          pIn->pTileInfo,
                                          &pOut->pitch,
                                          &pOut->height,
                                          &pOut->htileBytes,
                                          &pOut->macroWidth,
                                          &pOut->macroHeight,
                                          &pOut->sliceSize,
                                          &pOut->baseAlign);
+
+            if (pIn->flags.tcCompatible && (pIn->numSlices > 1))
+            {
+                pOut->sliceSize = pIn->pitch * pIn->height * 4 / (8 * 8);
+
+                const UINT_32 align = HwlGetPipes(pIn->pTileInfo) * pIn->pTileInfo->banks * m_pipeInterleaveBytes;
+
+                if ((pOut->sliceSize % align) == 0)
+                {
+                    pOut->sliceInterleaved = FALSE;
+                }
+                else
+                {
+                    pOut->sliceInterleaved = TRUE;
+                }
+            }
         }
     }
 
     return returnCode;
 }
 
 /**
 ****************************************************************************************************
 *   Lib::ComputeCmaskInfo
 *
-- 
2.7.4



More information about the mesa-dev mailing list