Bug 882173 - Build pixman with TLS support. r=jrmuizel
authorJoe Drew <joe@drew.ca>
Wed, 12 Jun 2013 16:05:39 -0400
changeset 146478 addf66960e85286a6d7dd7d82cc5abf04d119797
parent 146477 19671f660736c53032e0b46929b44c36503a761c
child 146479 00a8c9c3fe5d4e713590945e37d404ccad6549a7
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs882173
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 882173 - Build pixman with TLS support. r=jrmuizel
gfx/cairo/libpixman/src/Makefile.in
gfx/cairo/libpixman/src/pixman-compiler.h
gfx/cairo/pixman-xp-dll-workaround
--- a/gfx/cairo/libpixman/src/Makefile.in
+++ b/gfx/cairo/libpixman/src/Makefile.in
@@ -12,17 +12,23 @@ include $(DEPTH)/config/autoconf.mk
 LIBRARY_NAME	= mozlibpixman
 MSVC_ENABLE_PGO := 1
 LIBXUL_LIBRARY = 1
 
 ifeq ($(OS_TARGET),Android)
 MODULE_OPTIMIZE_FLAGS = -O2
 endif
 
-DEFINES += -DPIXMAN_NO_TLS
+ifdef MOZ_USE_PTHREADS
+DEFINES += -DHAVE_PTHREAD_SETSPECIFIC
+endif
+
+ifdef _MSC_VER
+DEFINES += -DPIXMAN_USE_XP_DLL_TLS_WORKAROUND
+endif
 
 # Build MMX code either with VC or with gcc-on-x86
 ifdef _MSC_VER
 ifeq (86,$(findstring 86,$(OS_TEST)))
 ifneq (64,$(findstring 64,$(OS_TEST)))
 USE_MMX=1
 endif
 USE_SSE2=1
--- a/gfx/cairo/libpixman/src/pixman-compiler.h
+++ b/gfx/cairo/libpixman/src/pixman-compiler.h
@@ -114,20 +114,22 @@
 
 #elif defined(TLS)
 
 #   define PIXMAN_DEFINE_THREAD_LOCAL(type, name)			\
     static TLS type name
 #   define PIXMAN_GET_THREAD_LOCAL(name)				\
     (&name)
 
-#elif defined(__MINGW32__)
+#elif defined(__MINGW32__) || defined(PIXMAN_USE_XP_DLL_TLS_WORKAROUND)
 
 #   define _NO_W32_PSEUDO_MODIFIERS
 #   include <windows.h>
+#undef IN
+#undef OUT
 
 #   define PIXMAN_DEFINE_THREAD_LOCAL(type, name)			\
     static volatile int tls_ ## name ## _initialized = 0;		\
     static void *tls_ ## name ## _mutex = NULL;				\
     static unsigned tls_ ## name ## _index;				\
 									\
     static type *							\
     tls_ ## name ## _alloc (void)					\
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/pixman-xp-dll-workaround
@@ -0,0 +1,27 @@
+diff --git a/gfx/cairo/libpixman/src/pixman-compiler.h b/gfx/cairo/libpixman/src/pixman-compiler.h
+--- a/gfx/cairo/libpixman/src/pixman-compiler.h
++++ b/gfx/cairo/libpixman/src/pixman-compiler.h
+@@ -114,20 +114,22 @@
+ 
+ #elif defined(TLS)
+ 
+ #   define PIXMAN_DEFINE_THREAD_LOCAL(type, name)			\
+     static TLS type name
+ #   define PIXMAN_GET_THREAD_LOCAL(name)				\
+     (&name)
+ 
+-#elif defined(__MINGW32__)
++#elif defined(__MINGW32__) || defined(PIXMAN_USE_XP_DLL_TLS_WORKAROUND)
+ 
+ #   define _NO_W32_PSEUDO_MODIFIERS
+ #   include <windows.h>
++#undef IN
++#undef OUT
+ 
+ #   define PIXMAN_DEFINE_THREAD_LOCAL(type, name)			\
+     static volatile int tls_ ## name ## _initialized = 0;		\
+     static void *tls_ ## name ## _mutex = NULL;				\
+     static unsigned tls_ ## name ## _index;				\
+ 									\
+     static type *							\
+     tls_ ## name ## _alloc (void)					\