pixman: Branch 'master' - 4 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Sun May 9 11:42:40 PDT 2010
configure.ac | 3 ++
pixman/pixman-compiler.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++
test/gtk-utils.c | 2 +
3 files changed, 70 insertions(+)
New commits:
commit 164fe215f2c904cf74537caf9d76b7f9ce2667ec
Merge: e1594f2... 5158d67...
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Sun May 9 14:24:24 2010 -0400
Merge branch 'for-master'
commit e1594f204d3a3c2d2083793c8830f0ebf390ed66
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Thu May 6 01:05:40 2010 +0300
test/gtk-utils: Set the size of the window to the size of the image
diff --git a/test/gtk-utils.c b/test/gtk-utils.c
index 751a164..0e7cb5c 100644
--- a/test/gtk-utils.c
+++ b/test/gtk-utils.c
@@ -92,6 +92,8 @@ show_image (pixman_image_t *image)
height = pixman_image_get_height (image);
stride = pixman_image_get_stride (image);
+ gtk_window_set_default_size (GTK_WINDOW (window), width, height);
+
format = image->bits.format;
if (format == PIXMAN_a8r8g8b8)
commit 5158d6740c8e2643611a623a0caa649f4b0bc5bd
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Sat Apr 24 18:43:38 2010 -0400
Add macros for thread local storage on MinGW 32
These macros are identical to the ones that Tor Lillqvist posted here:
http://lists.freedesktop.org/archives/pixman/2010-April/000160.html
with one exception: the variable is allocated with calloc() and not
malloc().
Cc: tml at iki.fi
diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
index 531c8c9..1a1350d 100644
--- a/pixman/pixman-compiler.h
+++ b/pixman/pixman-compiler.h
@@ -77,6 +77,71 @@
# define PIXMAN_GET_THREAD_LOCAL(name) \
(&name)
+#elif defined(__MINGW32__) && !defined(__WIN64)
+
+/* We can't include <windows.h> as it causes carious clashes with
+ * identifiers in pixman, sigh. So just declare the functions we need
+ * here.
+ */
+extern __stdcall long InterlockedCompareExchange(long volatile *, long, long);
+#define InterlockedCompareExchangePointer(d,e,c) \
+ (void *)InterlockedCompareExchange((long volatile *)(d),(long)(e),(long)(c))
+extern __stdcall int TlsAlloc (void);
+extern __stdcall void *TlsGetValue (unsigned);
+extern __stdcall int TlsSetValue (unsigned, void *);
+extern __stdcall void *CreateMutexA(void *, int, char *);
+extern __stdcall int CloseHandle(void *);
+extern __stdcall unsigned WaitForSingleObject (void *, unsigned);
+extern __stdcall int ReleaseMutex (void *);
+
+# 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) \
+ { \
+ type *value = calloc (1, sizeof (type)); \
+ if (value) \
+ TlsSetValue (tls_ ## name ## _index, value); \
+ return value; \
+ } \
+ \
+ static force_inline type * \
+ tls_ ## name ## _get (void) \
+ { \
+ type *value; \
+ if (!tls_ ## name ## _initialized) \
+ { \
+ if (!tls_ ## name ## _mutex) \
+ { \
+ void *mutex = CreateMutexA (NULL, 0, NULL); \
+ if (InterlockedCompareExchangePointer ( \
+ &tls_ ## name ## _mutex, mutex, NULL) != NULL) \
+ { \
+ CloseHandle (mutex); \
+ } \
+ } \
+ WaitForSingleObject (tls_ ## name ## _mutex, 0xFFFFFFFF); \
+ if (!tls_ ## name ## _initialized) \
+ { \
+ tls_ ## name ## _index = TlsAlloc (); \
+ tls_ ## name ## _initialized = 1; \
+ } \
+ ReleaseMutex (tls_ ## name ## _mutex); \
+ } \
+ if (tls_ ## name ## _index == 0xFFFFFFFF) \
+ return NULL; \
+ value = TlsGetValue (tls_ ## name ## _index); \
+ if (!value) \
+ value = tls_ ## name ## _alloc (); \
+ return value; \
+ }
+
+# define PIXMAN_GET_THREAD_LOCAL(name) \
+ tls_ ## name ## _get ()
+
#elif defined(_MSC_VER)
# define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
commit 582fa58bba7008c2b852ba56557612866f7522d5
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Fri Apr 23 12:34:19 2010 -0400
Don't use __thread on MinGW.
It is apparently broken. See this:
http://mingw-users.1079350.n2.nabble.com/gcc-4-4-multi-threaded-exception-handling-thread-specifier-not-working-td3440749.html
We'll need to support thread local storage on MinGW32 some other way.
Cc: tml at iki.fi
diff --git a/configure.ac b/configure.ac
index aabe721..c9d0c66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -524,6 +524,9 @@ support_for__thread=no
AC_MSG_CHECKING(for __thread)
AC_COMPILE_IFELSE([
+#ifdef __MINGW32__
+#error MinGW has broken __thread support
+#endif
__thread int x ;
int main () { return 0; }
], support_for__thread=yes)
More information about the xorg-commit
mailing list