freedreno/a6xx: Pick blitter swap based on resource tiling
authorKristian H. Kristensen <hoegsberg@google.com>
Tue, 26 Nov 2019 05:50:57 +0000 (21:50 -0800)
committerKristian H. Kristensen <hoegsberg@google.com>
Thu, 19 Dec 2019 17:56:05 +0000 (09:56 -0800)
The linear levels in a tiled resource are stored in the canonical
swap, WZYX.  We need to pick the swap based on whether or not the
resource is tiled, not whether the the level in question is tiled.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2848>

src/gallium/drivers/freedreno/a6xx/fd6_blitter.c

index 98e2ab9..58b564f 100644 (file)
@@ -387,8 +387,11 @@ emit_blit_or_clear_texture(struct fd_context *ctx, struct fd_ringbuffer *ring,
        stile = fd_resource_tile_mode(info->src.resource, info->src.level);
        dtile = fd_resource_tile_mode(info->dst.resource, info->dst.level);
 
-       sswap = stile ? WZYX : fd6_pipe2swap(info->src.format);
-       dswap = dtile ? WZYX : fd6_pipe2swap(info->dst.format);
+       /* Linear levels of a tiled resource are always WZYX, so look at
+        * rsc->tile_mode to determine the swap.
+        */
+       sswap = src->layout.tile_mode ? WZYX : fd6_pipe2swap(info->src.format);
+       dswap = dst->layout.tile_mode ? WZYX : fd6_pipe2swap(info->dst.format);
 
        if (util_format_is_compressed(info->src.format)) {
                debug_assert(info->src.format == info->dst.format);