Mesa (main): pan/bi: Make bi_opt_push_ubo optional

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 18:14:05 UTC 2021


Module: Mesa
Branch: main
Commit: ff03f096bfac526914c22ffc4c653de38ecf2cc3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff03f096bfac526914c22ffc4c653de38ecf2cc3

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Aug 11 10:03:13 2021 -0400

pan/bi: Make bi_opt_push_ubo optional

It's an optimization pass -- omitting it should not cause MMU faults
(!). Make sure the UBO push mask is set regardless of whether the pass
is called, and just call the pass when required.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12328>

---

 src/panfrost/bifrost/bi_opt_push_ubo.c | 6 ------
 src/panfrost/bifrost/bifrost_compile.c | 9 ++++++++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/panfrost/bifrost/bi_opt_push_ubo.c b/src/panfrost/bifrost/bi_opt_push_ubo.c
index 80eec2f7088..e8ebc971f5d 100644
--- a/src/panfrost/bifrost/bi_opt_push_ubo.c
+++ b/src/panfrost/bifrost/bi_opt_push_ubo.c
@@ -128,12 +128,6 @@ bi_pick_ubo(struct panfrost_ubo_push *push, struct bi_ubo_analysis *analysis)
 void
 bi_opt_push_ubo(bi_context *ctx)
 {
-        if (ctx->inputs->no_ubo_to_push) {
-                /* If nothing is pushed, all UBOs need to be uploaded */
-                ctx->ubo_mask = ~0;
-                return;
-        }
-
         /* This pass only runs once */
         assert(ctx->info->push.count == 0);
 
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 651eaf7d690..5234cc22f75 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -3576,6 +3576,10 @@ bifrost_compile_shader_nir(nir_shader *nir,
         ctx->stage = nir->info.stage;
         ctx->quirks = bifrost_get_quirks(inputs->gpu_id);
         ctx->arch = inputs->gpu_id >> 12;
+
+        /* If nothing is pushed, all UBOs need to be uploaded */
+        ctx->ubo_mask = ~0;
+
         list_inithead(&ctx->blocks);
 
         /* Lower gl_Position pre-optimisation, but after lowering vars to ssa
@@ -3677,7 +3681,10 @@ bifrost_compile_shader_nir(nir_shader *nir,
         bi_validate(ctx, "Early lowering");
 
         /* Runs before copy prop */
-        bi_opt_push_ubo(ctx);
+        if (!ctx->inputs->no_ubo_to_push) {
+                bi_opt_push_ubo(ctx);
+        }
+
         bi_opt_constant_fold(ctx);
 
         bi_opt_copy_prop(ctx);



More information about the mesa-commit mailing list