summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_screen.c
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2014-02-07 19:29:06 +0800
committerKenneth Graunke <kenneth@whitecape.org>2014-02-11 02:21:41 -0800
commitb47d231526821f5cff99546a984103a7222bc66c (patch)
tree403fa616a8d8d8ea43552d3a010eb4675a07705c /src/mesa/drivers/dri/i965/intel_screen.c
parente95a4ed2967346e6ff7efb9897d8c430fcaa90f7 (diff)
downloadexternal_mesa3d-b47d231526821f5cff99546a984103a7222bc66c.zip
external_mesa3d-b47d231526821f5cff99546a984103a7222bc66c.tar.gz
external_mesa3d-b47d231526821f5cff99546a984103a7222bc66c.tar.bz2
glsl: Add locking to builtin_builder singleton
Consider a multithreaded program with two contexts A and B, and the following scenario: 1. Context A calls initialize(), which allocates mem_ctx and starts building built-ins. 2. Context B calls initialize(), which sees mem_ctx != NULL and assumes everything is already set up. It returns. 3. Context B calls find(), which fails to find the built-in since it hasn't been created yet. 4. Context A finally finishes initializing the built-ins. This will break at step 3. Adding a lock ensures that subsequent callers of initialize() will wait until initialization is actually complete. Similarly, if any thread calls release while another thread is still initializing, or calling find(), the mem_ctx/shader would get free'd while from under it, leading to corruption or use-after-free crashes. Fixes sporadic failures in Piglit's glx-multithread-shader-compile. Bugzilla: https://bugs.freedesktop.org/69200 Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "10.1 10.0" <mesa-stable@lists.freedesktop.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_screen.c')
0 files changed, 0 insertions, 0 deletions