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 <robdclark@gmail.com>
This commit is contained in:
Eric Anholt 2019-07-25 13:26:01 -07:00
parent 6f0521b78c
commit 91986fbbdb

View file

@ -24,6 +24,7 @@
* Rob Clark <robclark@freedesktop.org>
*/
#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,