amdgpu/addrlib: support non-power2 height alignment (for linear surface)
authorRoy Zhan <roy.zhan@amd.com>
Sun, 10 Jan 2016 12:56:11 +0000 (07:56 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 30 Mar 2017 12:44:33 +0000 (14:44 +0200)
src/amd/addrlib/core/addrlib1.cpp

index 040891c431c07a8bb8ac2aa522b47a2eaf89e665..34e286e4dd3ff5c588e5bed9678fbe660f763abd 100644 (file)
@@ -3278,7 +3278,16 @@ VOID Lib::PadDimensions(
 
     if (padDims > 1)
     {
-        *pHeight = PowTwoAlign((*pHeight), heightAlign);
+        if (IsPow2(heightAlign))
+        {
+            *pHeight = PowTwoAlign((*pHeight), heightAlign);
+        }
+        else
+        {
+            *pHeight += heightAlign - 1;
+            *pHeight /= heightAlign;
+            *pHeight *= heightAlign;
+        }
     }
 
     if (padDims > 2 || thickness > 1)