From: Christian Gmeiner Date: Mon, 29 Jun 2020 10:10:55 +0000 (+0200) Subject: etnaviv: move shader_count to etna_compiler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ee146aad49bc9e724cc93033298195ad1d9e162;p=mesa.git etnaviv: move shader_count to etna_compiler Also fix data race on making the shader's id. Signed-off-by: Christian Gmeiner Reviewed-by: Lucas Stach Part-of: --- diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.h b/src/gallium/drivers/etnaviv/etnaviv_compiler.h index 40409c68d34..af979766ef3 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.h +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.h @@ -49,6 +49,7 @@ * setup. */ struct etna_compiler { + uint32_t shader_count; }; /* compiler output per input/output */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index 173a4681cb2..44ab8eda363 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -34,6 +34,7 @@ #include "tgsi/tgsi_parse.h" #include "nir/tgsi_to_nir.h" +#include "util/u_atomic.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -395,13 +396,13 @@ etna_create_shader_state(struct pipe_context *pctx, { struct etna_context *ctx = etna_context(pctx); struct etna_screen *screen = ctx->screen; + struct etna_compiler *compiler = screen->compiler; struct etna_shader *shader = CALLOC_STRUCT(etna_shader); if (!shader) return NULL; - static uint32_t id; - shader->id = id++; + shader->id = p_atomic_inc_return(&compiler->shader_count); shader->specs = &screen->specs; if (DBG_ENABLED(ETNA_DBG_NIR))