From 19bceb5812cf3056c1b5ffb3c372d3f8b9872e26 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 30 Aug 2019 13:57:20 -0700 Subject: [PATCH] pan/midgard: Track shader quadword count while scheduling This allow multiblock blend shaders to compute constant colour offsets correctly. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 2 ++ src/panfrost/midgard/midgard_compile.c | 6 ++---- src/panfrost/midgard/midgard_schedule.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 2019993..b63a542 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 765eab3..6317e88 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 98d5f1b..7b68776 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 */ -- 2.7.4