[Mesa-dev] [PATCH 042/140] amdgpu/addrlib: Always returns pixelPitch in original pixels

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


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

---
 src/amd/addrlib/core/addrlib1.cpp | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/amd/addrlib/core/addrlib1.cpp b/src/amd/addrlib/core/addrlib1.cpp
index 34e286e..d65fd02 100644
--- a/src/amd/addrlib/core/addrlib1.cpp
+++ b/src/amd/addrlib/core/addrlib1.cpp
@@ -374,35 +374,31 @@ ADDR_E_RETURNCODE Lib::ComputeSurfaceInfo(
 #if DEBUG
             if (localIn.flags.display)
             {
                 ADDR_ASSERT((pOut->pitchAlign % 32) == 0);
             }
 #endif //DEBUG
 
             if (localIn.format != ADDR_FMT_INVALID)
             {
                 //
-                // 96 bits surface of level 1+ requires element pitch of 32 bits instead
-                // In hwl function we skip multiplication of 3 then we should skip division of 3
-                // We keep pitch that represents 32 bit element instead of 96 bits since we
-                // will get an odd number if divided by 3.
+                // Note: For 96 bit surface, the pixelPitch returned might be an odd number, but it
+                // is okay to program texture pitch as HW's mip calculator would multiply 3 first,
+                // then do the appropriate paddings (linear alignment requirement and possible the
+                // nearest power-of-two for mipmaps), which results in the original pitch.
                 //
-                if (!((expandX == 3) && (localIn.mipLevel > 0)))
-                {
-
-                    GetElemLib()->RestoreSurfaceInfo(elemMode,
-                                                     expandX,
-                                                     expandY,
-                                                     &localIn.bpp,
-                                                     &pOut->pixelPitch,
-                                                     &pOut->pixelHeight);
-                }
+                GetElemLib()->RestoreSurfaceInfo(elemMode,
+                                                 expandX,
+                                                 expandY,
+                                                 &localIn.bpp,
+                                                 &pOut->pixelPitch,
+                                                 &pOut->pixelHeight);
             }
 
             if (localIn.flags.qbStereo)
             {
                 if (pOut->pStereoInfo)
                 {
                     ComputeQbStereoInfo(pOut);
                 }
             }
 
-- 
2.7.4



More information about the mesa-dev mailing list