Mesa (main): freedreno/a5xx: Diff reduction in fd5_layout to fd6_layout.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 4 23:10:00 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Thu Nov  4 09:21:18 2021 -0700

freedreno/a5xx: Diff reduction in fd5_layout to fd6_layout.

This should be exactly equivalent code, except for the is_3d "level <= 1"
which doesn't bring over 6c19d3733185 ("freedreno/a6xx: fix 3d tex
layout") due to it failing our unit tests where we compare to the blob's
behavior.  The layer_stride setup is pulling in what freedreno_resource.c
was doing after the layout setup, so we match fd6 and so that it could
potentially be checked in unit testing.

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

---

 src/freedreno/fdl/fd5_layout.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/freedreno/fdl/fd5_layout.c b/src/freedreno/fdl/fd5_layout.c
index b2d26a40c72..6b56f8343a1 100644
--- a/src/freedreno/fdl/fd5_layout.c
+++ b/src/freedreno/fdl/fd5_layout.c
@@ -61,6 +61,7 @@ fdl5_layout(struct fdl_layout *layout, enum pipe_format format,
       fdl_set_pitchalign(layout, fdl_cpp_shift(layout) + 6);
 
    for (uint32_t level = 0; level < mip_levels; level++) {
+      uint32_t depth = u_minify(depth0, level);
       struct fdl_slice *slice = &layout->slices[level];
       uint32_t tile_mode = fdl_tile_mode(layout, level);
       uint32_t pitch = fdl_pitch(layout, level);
@@ -83,22 +84,27 @@ fdl5_layout(struct fdl_layout *layout, enum pipe_format format,
 
       slice->offset = layout->size;
 
-      const int alignment = is_3d ? 4096 : 1;
-
       /* 1d array and 2d array textures must all have the same layer size
        * for each miplevel on a3xx. 3d textures can have different layer
        * sizes for high levels, but the hw auto-sizer is buggy (or at least
        * different than what this code does), so as soon as the layer size
        * range gets into range, we stop reducing it.
        */
-      if (is_3d && (level == 1 ||
-                    (level > 1 && layout->slices[level - 1].size0 > 0xf000)))
-         slice->size0 = align(nblocksy * pitch, alignment);
-      else if (level == 0 || layout->layer_first || alignment == 1)
-         slice->size0 = align(nblocksy * pitch, alignment);
-      else
-         slice->size0 = layout->slices[level - 1].size0;
+      if (is_3d) {
+         if (level <= 1 || layout->slices[level - 1].size0 > 0xf000) {
+            slice->size0 = align(nblocksy * pitch, 4096);
+         } else {
+            slice->size0 = layout->slices[level - 1].size0;
+         }
+      } else {
+         slice->size0 = nblocksy * pitch;
+      }
+
+      layout->size += slice->size0 * depth * layers_in_level;
+   }
 
-      layout->size += slice->size0 * u_minify(depth0, level) * layers_in_level;
+   if (layout->layer_first) {
+      layout->layer_size = align(layout->size, 4096);
+      layout->size = layout->layer_size * array_size;
    }
 }



More information about the mesa-commit mailing list