On Thu, Sep 24, 2015 at 6:32 PM, Tom Stellard <thomas.stell...@amd.com> wrote: > This fixes a race condition in the glx-multithreaded-shader-compile > test. > > CC: "10.6 11.0" <mesa-sta...@lists.freedesktop.org> > --- > src/gallium/drivers/radeon/radeon_llvm_emit.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c > b/src/gallium/drivers/radeon/radeon_llvm_emit.c > index 0002559..045665a 100644 > --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c > +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c > @@ -25,6 +25,7 @@ > */ > #include "radeon_llvm_emit.h" > #include "radeon_elf_util.h" > +#include "gallivm/lp_bld_misc.h" > #include "util/u_memory.h" > #include "pipe/p_shader_tokens.h" > > @@ -88,6 +89,7 @@ static void init_r600_target() > { > static unsigned initialized = 0; > if (!initialized) { > + gallivm_init_llvm_begin(); > #if HAVE_LLVM < 0x0307 > LLVMInitializeR600TargetInfo(); > LLVMInitializeR600Target(); > @@ -101,6 +103,7 @@ static void init_r600_target() > > #endif > initialized = 1; > + gallivm_init_llvm_end();
BTW, this code can call the LLVM initialize functions twice, because 2 threads can enter the (!initialized) branch at the same time. Perhaps gallivm_init_llvm_begin/end should be called outside the branch? Marek _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev