pixman: Branch 'master' - 3 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Tue Apr 13 19:34:18 PDT 2010


 pixman/pixman-compiler.h |   12 ++++++------
 pixman/pixman-mmx.c      |    2 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit a652d5c15476cb60e1ca96ac115df625f8a1b76f
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Wed Apr 7 19:34:41 2010 -0400

    [mmx] Fix mask creation bugs
    
    This line:
    
        mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
    
    only works when mask has 0s in the lower 24 bits, so add
    
         mask &= 0xff000000;
    
    before.
    
    Reported by Todd Rinaldo on the #cairo IRC channel.

diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index e084e7f..d51b40c 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -1385,6 +1385,7 @@ mmx_composite_over_8888_n_8888 (pixman_implementation_t *imp,
     PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
 
     mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);
+    mask &= 0xff000000;
     mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
     vmask = load8888 (mask);
     srca = MC (4x00ff);
@@ -1470,6 +1471,7 @@ mmx_composite_over_x888_n_8888 (pixman_implementation_t *imp,
     PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
     mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);
 
+    mask &= 0xff000000;
     mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
     vmask = load8888 (mask);
     srca = MC (4x00ff);
commit 714559dccda3165a72f0a9935c1edc3aef535f30
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Wed Apr 7 01:44:12 2010 -0400

    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
 
commit 634ba33b5b1fcfd5a0e7910f9991b4ed4f674549
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Wed Apr 7 01:39:14 2010 -0400

    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;							\


More information about the xorg-commit mailing list