diff options
author | Eric Anholt <[email protected]> | 2019-07-25 13:26:01 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-07-29 12:50:49 -0700 |
commit | 91986fbbdb467ed2de16767432044ed5e389b189 (patch) | |
tree | 3cfcd497bc85e0dc8687fef088e0f6779632b263 /src/freedreno/ir3/ir3_shader.c | |
parent | 6f0521b78cfec6d461e17d293b9c90fc391cc795 (diff) |
freedreno: Fix data race on making the shader's id.
The value is only used for IR3_DBG_DISASM, but it cleans up the
helgrind output.
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/freedreno/ir3/ir3_shader.c')
-rw-r--r-- | src/freedreno/ir3/ir3_shader.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index bbe27ce4dbb..7c686f0ee2a 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -24,6 +24,7 @@ * Rob Clark <[email protected]> */ +#include "util/u_atomic.h" #include "util/u_string.h" #include "util/u_memory.h" #include "util/u_format.h" @@ -278,7 +279,7 @@ ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir) mtx_init(&shader->variants_lock, mtx_plain); shader->compiler = compiler; - shader->id = ++shader->compiler->shader_count; + shader->id = p_atomic_inc_return(&shader->compiler->shader_count); shader->type = nir->info.stage; NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, |