Mesa (master): panfrost: Report UBO count

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 24 20:00:12 UTC 2019


Module: Mesa
Branch: master
Commit: 5d60be4e246710fafea52b6d103433ead224a80c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d60be4e246710fafea52b6d103433ead224a80c

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Jun 20 16:16:07 2019 -0700

panfrost: Report UBO count

We look at the highest set bit in the UBO enable mask to work out the
maximum indexable UBO, i.e. the UBO count as we need to report to the
hardware.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_context.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 3cc5988d3cc..c3d9ad1213d 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1001,6 +1001,17 @@ panfrost_map_constant_buffer_cpu(struct panfrost_constant_buffer *buf, unsigned
                 unreachable("No constant buffer");
 }
 
+/* Compute number of UBOs active (more specifically, compute the highest UBO
+ * number addressable -- if there are gaps, include them in the count anyway)
+ * */
+
+static unsigned
+panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage)
+{
+        unsigned mask = ctx->constant_buffer[stage].enabled_mask;
+        return 32 - __builtin_clz(mask);
+}
+
 /* Go through dirty flags and actualise them in the cmdstream. */
 
 void
@@ -1080,8 +1091,10 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
                         ctx->fragment_shader_core.midgard1.work_count = /*MAX2(ctx->fragment_shader_core.midgard1.work_count, ctx->blend->blend_work_count)*/16;
 
                 /* Set late due to depending on render state */
-                /* The one at the end seems to mean "1 UBO" */
-                unsigned flags = MALI_EARLY_Z | 0x200 | 0x2000 | 0x1;
+
+                /* The bottom bits seem to mean UBO count */
+                unsigned ubo_count = panfrost_ubo_count(ctx, PIPE_SHADER_FRAGMENT);
+                unsigned flags = MALI_EARLY_Z | 0x200 | 0x2000 | ubo_count;
 
                 /* Any time texturing is used, derivatives are implicitly
                  * calculated, so we need to enable helper invocations */




More information about the mesa-commit mailing list