summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-19 16:23:52 -0700
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-22 08:20:34 -0700
commitf0d0061b18aa39179552fe6f6c49e3f0ad63a9c1 (patch)
treef6c4606dffff0c726594783bbb1efed8e27a4a82 /src
parentf1dcaa0df67aa92ff236418e125adf3299bbf0fd (diff)
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 <alyssa.rosenzweig@collabora.com>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/midgard/compiler.h3
-rw-r--r--src/panfrost/midgard/midgard_compile.c1
-rw-r--r--src/panfrost/midgard/midgard_compile.h4
-rw-r--r--src/panfrost/midgard/midgard_schedule.c5
4 files changed, 13 insertions, 0 deletions
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);
}