From: Alyssa Rosenzweig Date: Fri, 19 Jul 2019 23:23:52 +0000 (-0700) Subject: panfrost/midgard: Report tls_size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0d0061b18aa39179552fe6f6c49e3f0ad63a9c1;p=mesa.git panfrost/midgard: Report tls_size Pipe through the number of bytes of spilled memory used from the compiler into the main driver, where it will be used to allocate the Thread Local Storage buffer. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 91ca185d628..2ea0cc6ce60 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -194,6 +194,9 @@ typedef struct compiler_context { /* Tracking for blend constant patching */ int blend_constant_offset; + /* Number of bytes used for Thread Local Storage */ + unsigned tls_size; + /* Current NIR function */ nir_function *func; diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 0f586c051db..822cc6a0542 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -2706,6 +2706,7 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl program->uniform_cutoff = ctx->uniform_cutoff; program->blend_patch_offset = ctx->blend_constant_offset; + program->tls_size = ctx->tls_size; if (midgard_debug & MIDGARD_DBG_SHADERS) disassemble_midgard(program->compiled.data, program->compiled.size); diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h index 147494b8e8a..c5ce9b7331f 100644 --- a/src/panfrost/midgard/midgard_compile.h +++ b/src/panfrost/midgard/midgard_compile.h @@ -83,6 +83,10 @@ typedef struct { int blend_patch_offset; + /* The number of bytes to allocate per-thread for Thread Local Storage + * (register spilling), or zero if no spilling is used */ + unsigned tls_size; + /* IN: For a fragment shader with a lowered alpha test, the ref value */ float alpha_ref; } midgard_program; diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 152da8de237..862b9306c15 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -788,5 +788,10 @@ schedule_program(compiler_context *ctx) assert(0); } + /* Report spilling information. spill_count is in 128-bit slots (vec4 x + * fp32), but tls_size is in bytes, so multiply by 16 */ + + ctx->tls_size = spill_count * 16; + install_registers(ctx, g); }