freedreno: Fix resource layout dump loop.
authorEric Anholt <eric@anholt.net>
Tue, 12 May 2020 21:41:53 +0000 (14:41 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 14 May 2020 14:12:15 +0000 (14:12 +0000)
Apparently I've never dumped a fully populated slices array, so the 0-init
always terminated the loop.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5020>

src/freedreno/fdl/freedreno_layout.c

index 9f8f660b80af726faee84db78c6df543c45c5d3b..226382f271a8985a970e18bd82cc582ffff3d2e9 100644 (file)
@@ -45,7 +45,7 @@ fdl_layout_buffer(struct fdl_layout *layout, uint32_t size)
 void
 fdl_dump_layout(struct fdl_layout *layout)
 {
-       for (uint32_t level = 0; level < layout->slices[level].size0; level++) {
+       for (uint32_t level = 0; level < ARRAY_SIZE(layout->slices) && layout->slices[level].size0; level++) {
                struct fdl_slice *slice = &layout->slices[level];
                struct fdl_slice *ubwc_slice = &layout->ubwc_slices[level];