Mesa (main): panfrost: Unit test stride calculations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 3 14:38:09 UTC 2022


Module: Mesa
Branch: main
Commit: 6d0505701d0c5de8a357b736b411f041787adf37
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d0505701d0c5de8a357b736b411f041787adf37

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Apr 27 14:50:59 2022 -0400

panfrost: Unit test stride calculations

These have reasonable interpretations now, and the three row strides have been
deduplicated. So add stride expectations to our ASTC unit tests.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16201>

---

 src/panfrost/lib/tests/test-layout.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/panfrost/lib/tests/test-layout.cpp b/src/panfrost/lib/tests/test-layout.cpp
index 7dcc2de1eb1..8fa598cfcf8 100644
--- a/src/panfrost/lib/tests/test-layout.cpp
+++ b/src/panfrost/lib/tests/test-layout.cpp
@@ -211,9 +211,12 @@ TEST(Layout, ImplicitLayoutInterleavedASTC5x5)
    /* The image is 50x50 pixels, with 5x5 blocks. So it is a 10x10 grid of ASTC
     * blocks. 4x4 tiles of ASTC blocks are u-interleaved, so we have to round up
     * to a 12x12 grid. So we need space for 144 ASTC blocks. Each ASTC block is
-    * 16 bytes (128-bits), so we require 2304 bytes.
+    * 16 bytes (128-bits), so we require 2304 bytes, with a row stride of 12 *
+    * 16 * 4 = 192 bytes.
     */
    EXPECT_EQ(l.slices[0].offset, 0);
+   EXPECT_EQ(l.slices[0].row_stride, 768);
+   EXPECT_EQ(l.slices[0].surface_stride, 2304);
    EXPECT_EQ(l.slices[0].size, 2304);
 }
 
@@ -233,10 +236,12 @@ TEST(Layout, ImplicitLayoutLinearASTC5x5)
    ASSERT_TRUE(pan_image_layout_init(&l, NULL));
 
    /* The image is 50x50 pixels, with 5x5 blocks. So it is a 10x10 grid of ASTC
-    * blocks. Each ASTC block is 16 bytes, so the row stride is 160 bytes.
-    * Rows are cache-line aligned to 192 bytes. There are 10 rows, so we have
+    * blocks. Each ASTC block is 16 bytes, so the row stride is 160 bytes,
+    * rounded up to the cache line (192 bytes).  There are 10 rows, so we have
     * 1920 bytes total.
     */
    EXPECT_EQ(l.slices[0].offset, 0);
+   EXPECT_EQ(l.slices[0].row_stride, 192);
+   EXPECT_EQ(l.slices[0].surface_stride, 1920);
    EXPECT_EQ(l.slices[0].size, 1920);
 }



More information about the mesa-commit mailing list