panfrost: Don't reserve for NPOT w/o instancing
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 17 Aug 2020 18:46:56 +0000 (14:46 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 20 Aug 2020 16:15:02 +0000 (18:15 +0200)
It's impossible. Down to 5 slabs + 45368.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6373>

src/gallium/drivers/panfrost/pan_cmdstream.c

index 79a05341b8b0d023d234604db0e903b6b7627b70..43c64e4a2c4d5306e1e9f125a10dc23c22eba773 100644 (file)
@@ -1331,10 +1331,13 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
         unsigned instance_shift = vertex_postfix->instance_shift;
         unsigned instance_odd = vertex_postfix->instance_odd;
 
-        /* Worst case: everything is NPOT */
+        /* Worst case: everything is NPOT, which is only possible if instancing
+         * is enabled. Otherwise single record is gauranteed */
+        bool could_npot = instance_shift || instance_odd;
 
         struct panfrost_transfer S = panfrost_pool_alloc_aligned(&batch->pool,
-                        MALI_ATTRIBUTE_BUFFER_LENGTH * PIPE_MAX_ATTRIBS * 2,
+                        MALI_ATTRIBUTE_BUFFER_LENGTH * PIPE_MAX_ATTRIBS *
+                        (could_npot ? 2 : 1),
                         MALI_ATTRIBUTE_BUFFER_LENGTH);
 
         struct panfrost_transfer T = panfrost_pool_alloc_aligned(&batch->pool,