From 03dc4bc3e80c68e48e0a2f9d698f92f4e0f58041 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 18 Nov 2022 22:59:42 -0500 Subject: [PATCH] asahi: Calculate tilebuffer layout per batch It won't be fixed soon. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 13 +++++++++++++ src/gallium/drivers/asahi/agx_state.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 6ec5dcb3fc3..54062b5e5b0 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1559,6 +1559,19 @@ agx_batch_init_state(struct agx_batch *batch) agx_ppp_fini(&out, &ppp); batch->encoder_current = out; + + /* Choose a tilebuffer layout given the framebuffer key */ + enum pipe_format formats[PIPE_MAX_COLOR_BUFS] = { 0 }; + for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) { + struct pipe_surface *surf = batch->key.cbufs[i]; + if (surf) + formats[i] = surf->format; + } + + batch->tilebuffer_layout = + agx_build_tilebuffer_layout(formats, batch->key.nr_cbufs, + util_framebuffer_get_num_samples(&batch->key)); + } static enum agx_object_type diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index 22f9d7b37ce..310196b926a 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -33,6 +33,7 @@ #include "asahi/lib/agx_bo.h" #include "asahi/lib/agx_device.h" #include "asahi/lib/pool.h" +#include "asahi/lib/agx_tilebuffer.h" #include "asahi/compiler/agx_compile.h" #include "asahi/layout/layout.h" #include "compiler/nir/nir_lower_blend.h" @@ -97,6 +98,8 @@ struct agx_batch { struct pipe_framebuffer_state key; uint64_t seqnum; + struct agx_tilebuffer_layout tilebuffer_layout; + /* PIPE_CLEAR_* bitmask */ uint32_t clear, draw, load;