pixman git + 0.18.0: add patches to fix TLS behaviour
authorKoen Kooi <koen@openembedded.org>
Thu, 15 Apr 2010 08:53:15 +0000 (10:53 +0200)
committerKoen Kooi <koen@openembedded.org>
Thu, 15 Apr 2010 08:53:15 +0000 (10:53 +0200)
recipes/xorg-lib/pixman/calloc.patch [new file with mode: 0644]
recipes/xorg-lib/pixman/tls.patch [new file with mode: 0644]
recipes/xorg-lib/pixman_0.18.0.bb
recipes/xorg-lib/pixman_git.bb

diff --git a/recipes/xorg-lib/pixman/calloc.patch b/recipes/xorg-lib/pixman/calloc.patch
new file mode 100644 (file)
index 0000000..4a60d7e
--- /dev/null
@@ -0,0 +1,23 @@
+From 634ba33b5b1fcfd5a0e7910f9991b4ed4f674549 Mon Sep 17 00:00:00 2001
+From: Søren Sandmann Pedersen <ssp@redhat.com>
+Date: Wed, 07 Apr 2010 05:39:14 +0000
+Subject: Fix uninitialized cache when pthreads are used
+
+The thread local cache is allocated with malloc(), but we rely on it
+being initialized to zero, so allocate it with calloc() instead.
+---
+diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
+index a4e3f88..cdac0d8 100644
+--- a/pixman/pixman-compiler.h
++++ b/pixman/pixman-compiler.h
+@@ -101,7 +101,7 @@
+     static type *                                                     \
+     tls_ ## name ## _alloc (key)                                      \
+     {                                                                 \
+-      type *value = malloc (sizeof (type));                           \
++      type *value = calloc (1, sizeof (type));                        \
+       if (value)                                                      \
+           pthread_setspecific (key, value);                           \
+       return value;                                                   \
+--
+cgit v0.8.3-6-g21f6
diff --git a/recipes/xorg-lib/pixman/tls.patch b/recipes/xorg-lib/pixman/tls.patch
new file mode 100644 (file)
index 0000000..316caed
--- /dev/null
@@ -0,0 +1,59 @@
+From 714559dccda3165a72f0a9935c1edc3aef535f30 Mon Sep 17 00:00:00 2001
+From: Søren Sandmann Pedersen <ssp@redhat.com>
+Date: Wed, 07 Apr 2010 05:44:12 +0000
+Subject: Fixes for pthread thread local storage.
+
+The tls_name_key variable is passed to tls_name_get(), and the first
+time this happens it isn't initialized. tls_name_get() then passes it
+on to tls_name_alloc() which passes it on to pthread_setspecific()
+leading to undefined behavior.
+
+None of this is actually necessary at all because there is only one
+such variable per thread local variable, so it doesn't need to passed
+as a parameter at all.
+
+All of this was pointed out by Tor Lillqvist on the cairo mailing
+list.
+---
+diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
+index cdac0d8..531c8c9 100644
+--- a/pixman/pixman-compiler.h
++++ b/pixman/pixman-compiler.h
+@@ -99,16 +99,16 @@
+     }                                                                 \
+                                                                       \
+     static type *                                                     \
+-    tls_ ## name ## _alloc (key)                                      \
++    tls_ ## name ## _alloc (void)                                     \
+     {                                                                 \
+       type *value = calloc (1, sizeof (type));                        \
+       if (value)                                                      \
+-          pthread_setspecific (key, value);                           \
++          pthread_setspecific (tls_ ## name ## _key, value);          \
+       return value;                                                   \
+     }                                                                 \
+                                                                       \
+     static force_inline type *                                                \
+-    tls_ ## name ## _get (key)                                                \
++    tls_ ## name ## _get (void)                                               \
+     {                                                                 \
+       type *value = NULL;                                             \
+       if (pthread_once (&tls_ ## name ## _once_control,               \
+@@ -116,13 +116,13 @@
+       {                                                               \
+           value = pthread_getspecific (tls_ ## name ## _key);         \
+           if (!value)                                                 \
+-              value = tls_ ## name ## _alloc (key);                   \
++              value = tls_ ## name ## _alloc ();                      \
+       }                                                               \
+       return value;                                                   \
+     }
+ #   define PIXMAN_GET_THREAD_LOCAL(name)                              \
+-    tls_ ## name ## _get (tls_ ## name ## _key)
++    tls_ ## name ## _get ()
+ #else
+--
+cgit v0.8.3-6-g21f6
index f22d52b..07966f8 100644 (file)
@@ -1,8 +1,9 @@
 require pixman.inc
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
 DEFAULT_PREFERENCE = "-1"
 DEFAULT_PREFERENCE_shr = "2"
+DEFAULT_PREFERENCE_angstrom = "2"
  
 SRC_URI += "\
            file://0001-Generic-C-implementation-of-pixman_blt-with-overlapp.patch;patch=1 \
@@ -10,6 +11,8 @@ SRC_URI += "\
            file://0003-Support-of-overlapping-src-dst-for-pixman_blt_sse2.patch;patch=1 \
            file://0004-Support-of-overlapping-src-dst-for-pixman_blt_neon.patch;patch=1 \
            file://0005-ARM-added-NEON-optimizations-for-fetch-store-r5g6b5-.patch;patch=1 \
+           file://calloc.patch;patch=1 \
+           file://tls.patch;patch=1 \
 "
 
 SRC_URI[archive.md5sum] = "a4fb870fc325be258089f1683642e976"
index 70886ed..915ca93 100644 (file)
@@ -1,6 +1,6 @@
 require pixman.inc
 PV = "0.17.13"
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 PR_append = "+gitr${SRCREV}"
 
 SRCREV = "69f1ec9a7827aeb522fcae99846237ef0f896e7b"
@@ -16,6 +16,8 @@ SRC_URI = "git://anongit.freedesktop.org/pixman;protocol=git;branch=master \
            file://0006-Revert-ARM-SIMD-Try-without-any-CFLAGS-before-forcin.patch;patch=1 \ 
            file://over-n-8-0565.patch;patch=1 \
            file://src-8888-0565.patch;patch=1 \
+           file://calloc.patch;patch=1 \
+           file://tls.patch;patch=1 \
 "
 
 S = "${WORKDIR}/git"