Commit c285f0a7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Aaron Plattner
Browse files

vdpau_wrapper: make the fixes initialization thread-safe


Reviewed-by: default avatarAaron Plattner <aplattner@nvidia.com>
Signed-off-by: default avatarAaron Plattner <aplattner@nvidia.com>
parent 06215a32
...@@ -21,6 +21,7 @@ endif ...@@ -21,6 +21,7 @@ endif
libvdpau_la_LIBADD = \ libvdpau_la_LIBADD = \
$(DLOPEN_LIBS) \ $(DLOPEN_LIBS) \
$(PTHREAD_LIBS) \
$(XEXT_LIBS) $(XEXT_LIBS)
libvdpau_la_LDFLAGS = -version-info 1:0:0 -no-undefined libvdpau_la_LDFLAGS = -version-info 1:0:0 -no-undefined
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <limits.h> #include <limits.h>
#include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -238,7 +239,6 @@ static void _vdp_close_driver(void) ...@@ -238,7 +239,6 @@ static void _vdp_close_driver(void)
static VdpGetProcAddress * _imp_get_proc_address; static VdpGetProcAddress * _imp_get_proc_address;
static VdpVideoSurfacePutBitsYCbCr * _imp_vid_put_bits_y_cb_cr; static VdpVideoSurfacePutBitsYCbCr * _imp_vid_put_bits_y_cb_cr;
static VdpPresentationQueueSetBackgroundColor * _imp_pq_set_bg_color; static VdpPresentationQueueSetBackgroundColor * _imp_pq_set_bg_color;
static int _inited_fixes;
static int _running_under_flash; static int _running_under_flash;
static int _enable_flash_uv_swap = 1; static int _enable_flash_uv_swap = 1;
static int _disable_flash_pq_bg_color = 1; static int _disable_flash_pq_bg_color = 1;
...@@ -385,11 +385,6 @@ static void init_config(void) ...@@ -385,11 +385,6 @@ static void init_config(void)
static void init_fixes(void) static void init_fixes(void)
{ {
if (_inited_fixes) {
return;
}
_inited_fixes = 1;
init_running_under_flash(); init_running_under_flash();
init_config(); init_config();
} }
...@@ -402,9 +397,10 @@ VdpStatus vdp_device_create_x11( ...@@ -402,9 +397,10 @@ VdpStatus vdp_device_create_x11(
VdpGetProcAddress * * get_proc_address VdpGetProcAddress * * get_proc_address
) )
{ {
static pthread_once_t once = PTHREAD_ONCE_INIT;
VdpStatus status; VdpStatus status;
init_fixes(); pthread_once(&once, init_fixes);
if (!_vdp_imp_device_create_x11_proc) { if (!_vdp_imp_device_create_x11_proc) {
status = _vdp_open_driver(display, screen); status = _vdp_open_driver(display, screen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment