freedreno: Swap the whole resource layout in shadowing.
authorEric Anholt <eric@anholt.net>
Thu, 12 Dec 2019 20:49:12 +0000 (12:49 -0800)
committerMarge Bot <eric+marge@anholt.net>
Tue, 4 Feb 2020 23:18:00 +0000 (23:18 +0000)
Let's not have to worry about whether this unusual code path gets
updated whenever we adjust what is in the layout struct.

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

src/gallium/drivers/freedreno/freedreno_resource.c

index 0f48e5878ffa315a3e2c763e6da74a87dacabdb0..b92663c90a3e4f80b4a6a61857833c7c2049556c 100644 (file)
@@ -223,11 +223,7 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
        /* TODO valid_buffer_range?? */
        swap(rsc->bo,        shadow->bo);
        swap(rsc->write_batch,   shadow->write_batch);
-       for (int level = 0; level <= prsc->last_level; level++) {
-               swap(rsc->layout.slices[level], shadow->layout.slices[level]);
-               swap(rsc->layout.ubwc_slices[level], shadow->layout.ubwc_slices[level]);
-       }
-       swap(rsc->layout.ubwc_layer_size, shadow->layout.ubwc_layer_size);
+       swap(rsc->layout, shadow->layout);
        rsc->seqno = p_atomic_inc_return(&ctx->screen->rsc_seqno);
 
        /* at this point, the newly created shadow buffer is not referenced