diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2020-10-08 10:09:56 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-10-09 14:16:41 +0000 |
commit | 0a74a04ba566b859c0bd4aaa0e2528f5ca5f24c7 (patch) | |
tree | 36d555969c9221030710685636925d344ce328d3 /src/panfrost/midgard | |
parent | 78ec5225c2a069955e6304ef26f3b474aaa7885d (diff) |
panfrost: Pass compile arguments through a struct
So we can extend it more easily without having to patch all callers.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7066>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r-- | src/panfrost/midgard/midgard_compile.c | 28 | ||||
-rw-r--r-- | src/panfrost/midgard/midgard_compile.h | 3 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index c8d8961f405..d2c08471bc4 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -2949,7 +2949,8 @@ mir_add_writeout_loops(compiler_context *ctx) } int -midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_blend, unsigned blend_rt, unsigned gpu_id, bool shaderdb) +midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, + const struct panfrost_compile_inputs *inputs) { struct util_dynarray *compiled = &program->compiled; @@ -2960,11 +2961,11 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b ctx->nir = nir; ctx->stage = nir->info.stage; - ctx->is_blend = is_blend; - ctx->blend_rt = MIDGARD_COLOR_RT0 + blend_rt; + ctx->is_blend = inputs->is_blend; + ctx->blend_rt = MIDGARD_COLOR_RT0 + inputs->blend.rt; ctx->blend_input = ~0; ctx->blend_src1 = ~0; - ctx->quirks = midgard_get_quirks(gpu_id); + ctx->quirks = midgard_get_quirks(inputs->gpu_id); /* Start off with a safe cutoff, allowing usage of all 16 work * registers. Later, we'll promote uniform reads to uniform registers @@ -2994,9 +2995,9 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b NIR_PASS_V(nir, nir_lower_var_copies); NIR_PASS_V(nir, nir_lower_vars_to_ssa); - unsigned pan_quirks = panfrost_get_quirks(gpu_id); + unsigned pan_quirks = panfrost_get_quirks(inputs->gpu_id); NIR_PASS_V(nir, pan_lower_framebuffer, - program->rt_formats, is_blend, pan_quirks); + inputs->rt_formats, inputs->is_blend, pan_quirks); NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out, glsl_type_size, 0); @@ -3005,7 +3006,7 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b /* Optimisation passes */ - optimise_nir(nir, ctx->quirks, is_blend); + optimise_nir(nir, ctx->quirks, inputs->is_blend); NIR_PASS_V(nir, midgard_nir_reorder_writeout); @@ -3029,7 +3030,7 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b ctx->func = func; ctx->already_emitted = calloc(BITSET_WORDS(func->impl->ssa_alloc), sizeof(BITSET_WORD)); - if (nir->info.outputs_read && !is_blend) { + if (nir->info.outputs_read && !inputs->is_blend) { emit_block_init(ctx); struct midgard_instruction wait = v_branch(false, false); @@ -3143,10 +3144,15 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b program->blend_patch_offset = ctx->blend_constant_offset; program->tls_size = ctx->tls_size; - if ((midgard_debug & MIDGARD_DBG_SHADERS) && !nir->info.internal) - disassemble_midgard(stdout, program->compiled.data, program->compiled.size, gpu_id, ctx->stage); + if ((midgard_debug & MIDGARD_DBG_SHADERS) && !nir->info.internal) { + disassemble_midgard(stdout, + program->compiled.data, + program->compiled.size, + inputs->gpu_id, ctx->stage); + } - if ((midgard_debug & MIDGARD_DBG_SHADERDB || shaderdb) && !nir->info.internal) { + if ((midgard_debug & MIDGARD_DBG_SHADERDB || inputs->shaderdb) && + !nir->info.internal) { unsigned nr_bundles = 0, nr_ins = 0; /* Count instructions and bundles */ diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h index ffdfb90598c..93ac3a825db 100644 --- a/src/panfrost/midgard/midgard_compile.h +++ b/src/panfrost/midgard/midgard_compile.h @@ -29,7 +29,8 @@ #include "panfrost/util/pan_ir.h" int -midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_blend, unsigned blend_rt, unsigned gpu_id, bool shaderdb); +midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, + const struct panfrost_compile_inputs *inputs); /* NIR options are shared between the standalone compiler and the online * compiler. Defining it here is the simplest, though maybe not the Right |