nil: Fix image array layer alignments
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Tue, 31 Jan 2023 02:11:50 +0000 (20:11 -0600)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:31:55 +0000 (21:31 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/nil/nil_image.c
src/nouveau/nil/nil_image.h

index f657795..7caeaa2 100644 (file)
@@ -188,8 +188,11 @@ nil_image_init(struct nouveau_ws_device *dev,
                       (uint64_t)lvl_ext_B.d;
    }
 
+   /* Align the image and array stride to a single level0 tile */
+   image->align_B = nil_tiling_size_B(image->levels[0].tiling);
+
    /* I have no idea why but hardware seems to align layer strides */
-   image->array_stride_B = ALIGN(layer_size_B, 0x800);
+   image->array_stride_B = ALIGN(layer_size_B, image->align_B);
 
    image->size_B = (uint64_t)image->array_stride_B * image->extent_px.a;
 
index e837849..6957395 100644 (file)
@@ -101,6 +101,7 @@ struct nil_image {
 
    uint32_t array_stride_B;
 
+   uint32_t align_B;
    uint64_t size_B;
 };