freedreno/a4xx: restore pitch to bytes change to layout code
authorJonathan Marek <jonathan@marek.ca>
Fri, 22 May 2020 14:12:02 +0000 (10:12 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sun, 21 Jun 2020 21:11:50 +0000 (21:11 +0000)
I lost this change when rebasing the commit moving this.

Fixes: aa2186db0 ("freedreno: move a4xx specific layout code to a4xx code")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5132>

src/gallium/drivers/freedreno/a4xx/fd4_resource.c

index f0c4de9b3160994b15d59df48b0ffbf11cd6841b..04b812ebf438957594980fcb211d085ddbebed09 100644 (file)
@@ -47,10 +47,10 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma
                uint32_t blocks;
 
                if (layout == UTIL_FORMAT_LAYOUT_ASTC)
-                       slice->pitch = width =
-                               util_align_npot(width, pitchalign * util_format_get_blockwidth(format));
+                       width = util_align_npot(width, pitchalign * util_format_get_blockwidth(format));
                else
-                       slice->pitch = width = align(width, pitchalign);
+                       width = align(width, pitchalign);
+               slice->pitch = util_format_get_nblocksx(format, width) * rsc->layout.cpp;
                slice->offset = size;
                blocks = util_format_get_nblocks(format, width, height);
                /* 1d array and 2d array textures must all have the same layer size