aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_sfbd.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-12-09 11:00:42 -0500
committerAlyssa Rosenzweig <[email protected]>2019-12-13 10:26:35 -0500
commitb0e915b4e657e83e251d21a429037ebdfb5c614a (patch)
treebff113b6aab0d3d940eff460c0009f80f9ee105a /src/gallium/drivers/panfrost/pan_sfbd.c
parent7597015b851db366824355bd42a59c1a67b1343c (diff)
panfrost: Emit SFBD/MFBD after a batch, instead of before
The size of the scratchpad (as well as some tiler details) depend on the contents of the batch, so we need to wait to defer filling out the FBD until after all draws are queued. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_sfbd.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_sfbd.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c
index 9bbc875d98a..ccf23253b51 100644
--- a/src/gallium/drivers/panfrost/pan_sfbd.c
+++ b/src/gallium/drivers/panfrost/pan_sfbd.c
@@ -194,6 +194,37 @@ panfrost_sfbd_set_zsbuf(
unreachable("Unsupported depth/stencil format.");
}
+
+static struct mali_single_framebuffer
+panfrost_emit_sfbd(struct panfrost_batch *batch, unsigned vertex_count)
+{
+ unsigned width = batch->key.width;
+ unsigned height = batch->key.height;
+
+ struct mali_single_framebuffer framebuffer = {
+ .width = MALI_POSITIVE(width),
+ .height = MALI_POSITIVE(height),
+ .unknown2 = 0x1f,
+ .format = {
+ .unk3 = 0x3,
+ },
+ .clear_flags = 0x1000,
+ .scratchpad = panfrost_batch_get_scratchpad(batch)->gpu,
+ .tiler = panfrost_emit_midg_tiler(batch, vertex_count),
+ };
+
+ return framebuffer;
+}
+
+void
+panfrost_attach_sfbd(struct panfrost_batch *batch, unsigned vertex_count)
+{
+ struct mali_single_framebuffer sfbd =
+ panfrost_emit_sfbd(batch, vertex_count);
+
+ memcpy(batch->framebuffer.cpu, &sfbd, sizeof(sfbd));
+}
+
/* Creates an SFBD for the FRAGMENT section of the bound framebuffer */
mali_ptr