panfrost/midgard: Report tls_size
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 19 Jul 2019 23:23:52 +0000 (16:23 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 22 Jul 2019 15:20:34 +0000 (08:20 -0700)
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 <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/compiler.h
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_compile.h
src/panfrost/midgard/midgard_schedule.c

index 91ca185d62834494232c1d231349a819bb1a0740..2ea0cc6ce600614c869eaaa44893afee4038edc2 100644 (file)
@@ -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;
 
index 0f586c051db4b061c9dbfb5bfd5c0d6a454e6dbe..822cc6a0542365d882bec37cd447746e615f7108 100644 (file)
@@ -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);
index 147494b8e8a1a95fc88437f944265937ed2a62e2..c5ce9b7331fe3a859919f9365926046834580610 100644 (file)
@@ -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;
index 152da8de237265e0fe504acf3cb5b7f9c45dcefe..862b9306c15ca069dcc011157be4db93d20fe83d 100644 (file)
@@ -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);
 }