summaryrefslogtreecommitdiff
path: root/src/gallium/targets
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-09-24 15:57:02 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-10-02 23:41:26 +0000
commit76cfd6f1da3748effb480e4f1151910af59fb88a (patch)
tree7f84f221f6f8e4946c8c84a4c14b5e4d952fc0b3 /src/gallium/targets
parent3219b48ae5a5b1288bf1fc1325ebbc7ac9e236df (diff)
gallivm: Allow drivers and state trackers to initialize gallivm LLVM targets v2
Drivers and state trackers that use LLVM for generating code, must register the targets they use with LLVM's global TargetRegistry. The TargetRegistry is not thread-safe, so all targets must be added to the registry before it can be queried for target information. When drivers and state trackers initialize their own targets, they need a way to force gallivm to initialize its targets at the same time. Otherwise, there can be a race condition in some multi-threaded applications (e.g. glx-multihreaded-shader-compile in piglit), when one thread creates a context for a driver that uses LLVM (e.g. radeonsi) and another thread creates a gallivm context (glxContextCreate does this). The race happens when the driver thread initializes its LLVM targets and then starts using the registry before the gallivm thread has a chance to register its targets. This patch allows users to force gallivm to register its targets by calling the gallivm_init_llvm_targets() function. v2: - Use call_once and remove mutexes and static initializations. - Replace gallivm_init_llvm_{begin,end}() with gallivm_init_llvm_targets(). Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Diffstat (limited to 'src/gallium/targets')
-rw-r--r--src/gallium/targets/opencl/Makefile.am3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am
index 4ab706ef2ac..c78b26832ff 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -35,7 +35,8 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \
-lclangEdit \
-lclangLex \
-lclangBasic \
- $(LLVM_LIBS)
+ $(LLVM_LIBS) \
+ $(PTHREAD_LIBS)
nodist_EXTRA_lib@OPENCL_LIBNAME@_la_SOURCES = dummy.cpp
lib@OPENCL_LIBNAME@_la_SOURCES =