panfrost: Unit test stride calculations
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 27 Apr 2022 18:50:59 +0000 (14:50 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 3 May 2022 14:20:15 +0000 (14:20 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16201>

src/panfrost/lib/tests/test-layout.cpp

index 7dcc2de..8fa598c 100644 (file)
@@ -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);
 }