From ff03f096bfac526914c22ffc4c653de38ecf2cc3 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 11 Aug 2021 10:03:13 -0400 Subject: [PATCH] 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 Part-of: --- 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 80eec2f..e8ebc97 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 651eaf7..5234cc2 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); -- 2.7.4