From 91986fbbdb467ed2de16767432044ed5e389b189 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 25 Jul 2019 13:26:01 -0700 Subject: [PATCH] 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 --- src/freedreno/ir3/ir3_shader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ +#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, -- 2.30.2