panfrost: Generate polygon list manually for SFBD
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 29 Oct 2019 14:42:03 +0000 (15:42 +0100)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Wed, 6 Nov 2019 15:19:31 +0000 (16:19 +0100)
On clears without draws, the SFBD GPUs need for userspace to generate
the trivial polygon list.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_job.c

index b7b7771..14996b6 100644 (file)
@@ -57,6 +57,7 @@
 static struct midgard_tiler_descriptor
 panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
 {
+        struct panfrost_screen *screen = pan_screen(batch->ctx->base.screen);
         struct midgard_tiler_descriptor t = {};
         unsigned height = batch->key.height;
         unsigned width = batch->key.width;
@@ -100,6 +101,15 @@ panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
 
                 /* Disable the tiler */
                 t.hierarchy_mask |= MALI_TILER_DISABLED;
+
+                if (screen->require_sfbd) {
+                        t.hierarchy_mask = 0xFFF; /* TODO: What's this? */
+                        t.polygon_list_size = 0x200;
+
+                        /* We don't have a SET_VALUE job, so write the polygon list manually */
+                        uint32_t *polygon_list_body = (uint32_t *) (tiler_dummy->cpu + header_size);
+                        polygon_list_body[0] = 0xa0000000; /* TODO: Just that? */
+                }
         }
 
         t.polygon_list_body =
index 9cff523..8df3480 100644 (file)
@@ -670,11 +670,18 @@ panfrost_batch_get_tiler_heap(struct panfrost_batch *batch)
 struct panfrost_bo *
 panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch)
 {
+        struct panfrost_screen *screen = pan_screen(batch->ctx->base.screen);
+
+        uint32_t create_flags = 0;
+
         if (batch->tiler_dummy)
                 return batch->tiler_dummy;
 
+        if (!screen->require_sfbd)
+                create_flags = PAN_BO_INVISIBLE;
+
         batch->tiler_dummy = panfrost_batch_create_bo(batch, 4096,
-                                                      PAN_BO_INVISIBLE,
+                                                      create_flags,
                                                       PAN_BO_ACCESS_PRIVATE |
                                                       PAN_BO_ACCESS_RW |
                                                       PAN_BO_ACCESS_VERTEX_TILER |