From: Alyssa Rosenzweig Date: Fri, 30 Aug 2019 20:57:20 +0000 (-0700) Subject: pan/midgard: Track shader quadword count while scheduling X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19bceb5812cf3056c1b5ffb3c372d3f8b9872e26;p=mesa.git pan/midgard: Track shader quadword count while scheduling This allow multiblock blend shaders to compute constant colour offsets correctly. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 201999359cf..b63a542e5ad 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -280,6 +280,8 @@ typedef struct compiler_context { /* Alpha ref value passed in */ float alpha_ref; + unsigned quadword_count; + /* The mapping of sysvals to uniforms, the count, and the off-by-one inverse */ unsigned sysvals[MAX_SYSVAL_COUNT]; unsigned sysval_count; diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 765eab36d86..6317e886dcc 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -2807,7 +2807,7 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga disassemble_midgard(program->compiled.data, program->compiled.size); if (midgard_debug & MIDGARD_DBG_SHADERDB) { - unsigned nr_bundles = 0, nr_ins = 0, nr_quadwords = 0; + unsigned nr_bundles = 0, nr_ins = 0; /* Count instructions and bundles */ @@ -2815,8 +2815,6 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga nr_bundles += util_dynarray_num_elements( &block->bundles, midgard_bundle); - nr_quadwords += block->quadword_count; - mir_foreach_bundle_in_block(block, bun) nr_ins += bun->instruction_count; } @@ -2839,7 +2837,7 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga "%d:%d spills:fills\n", SHADER_DB_COUNT++, gl_shader_stage_name(ctx->stage), - nr_ins, nr_bundles, nr_quadwords, + nr_ins, nr_bundles, ctx->quadword_count, nr_registers, nr_threads, ctx->loop_count, ctx->spills, ctx->fills); diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 98d5f1b03f7..7b687766491 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -630,9 +630,8 @@ schedule_block(compiler_context *ctx, midgard_block *block) util_dynarray_append(&block->bundles, midgard_bundle, bundle); if (bundle.has_blend_constant) { - /* TODO: Multiblock? */ - int quadwords_within_block = block->quadword_count + quadword_size(bundle.tag) - 1; - ctx->blend_constant_offset = quadwords_within_block * 0x10; + unsigned offset = ctx->quadword_count + block->quadword_count + quadword_size(bundle.tag) - 1; + ctx->blend_constant_offset = offset * 0x10; } while(skip--) @@ -642,6 +641,7 @@ schedule_block(compiler_context *ctx, midgard_block *block) } block->is_scheduled = true; + ctx->quadword_count += block->quadword_count; } /* The following passes reorder MIR instructions to enable better scheduling */