diff options
author | RĂ©mi Denis-Courmont <remid@nvidia.com> | 2014-10-29 14:47:00 +0200 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2014-11-04 15:51:14 -0800 |
commit | c285f0a78cb87340dc9d6a373f69c92ad95f3fe2 (patch) | |
tree | 6f35c15e1d7a24fd73586a18e76146db22989a47 | |
parent | 06215a32a6e321f27a5c56aa2c6d91c2771a6cc0 (diff) |
vdpau_wrapper: make the fixes initialization thread-safe
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/vdpau_wrapper.c | 10 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 2e8e868..0ce8460 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,6 +21,7 @@ endif libvdpau_la_LIBADD = \ $(DLOPEN_LIBS) \ + $(PTHREAD_LIBS) \ $(XEXT_LIBS) libvdpau_la_LDFLAGS = -version-info 1:0:0 -no-undefined diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c index 8f40b23..8f263c5 100644 --- a/src/vdpau_wrapper.c +++ b/src/vdpau_wrapper.c @@ -27,6 +27,7 @@ #include <dlfcn.h> #include <limits.h> +#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -238,7 +239,6 @@ static void _vdp_close_driver(void) static VdpGetProcAddress * _imp_get_proc_address; static VdpVideoSurfacePutBitsYCbCr * _imp_vid_put_bits_y_cb_cr; static VdpPresentationQueueSetBackgroundColor * _imp_pq_set_bg_color; -static int _inited_fixes; static int _running_under_flash; static int _enable_flash_uv_swap = 1; static int _disable_flash_pq_bg_color = 1; @@ -385,11 +385,6 @@ static void init_config(void) static void init_fixes(void) { - if (_inited_fixes) { - return; - } - _inited_fixes = 1; - init_running_under_flash(); init_config(); } @@ -402,9 +397,10 @@ VdpStatus vdp_device_create_x11( VdpGetProcAddress * * get_proc_address ) { + static pthread_once_t once = PTHREAD_ONCE_INIT; VdpStatus status; - init_fixes(); + pthread_once(&once, init_fixes); if (!_vdp_imp_device_create_x11_proc) { status = _vdp_open_driver(display, screen); |