diff options
author | Tom Stellard <[email protected]> | 2015-09-24 15:57:02 +0000 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2015-10-02 23:41:26 +0000 |
commit | 76cfd6f1da3748effb480e4f1151910af59fb88a (patch) | |
tree | 7f84f221f6f8e4946c8c84a4c14b5e4d952fc0b3 /src/gallium/drivers | |
parent | 3219b48ae5a5b1288bf1fc1325ebbc7ac9e236df (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 <[email protected]>
Reviewed-by: Mathias Fröhlich <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
CC: "10.6 11.0" <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
0 files changed, 0 insertions, 0 deletions