pixman: Branch '0.32' - 2 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Fri Jul 4 22:35:19 PDT 2014


 configure.ac               |   18 ++++++++++++++++++
 pixman/pixman-bits-image.c |    2 +-
 test/utils-prng.c          |   10 +++++-----
 test/utils-prng.h          |    9 ++++-----
 4 files changed, 28 insertions(+), 11 deletions(-)

New commits:
commit 9f18ea3483dbdce88134e6cc52bb219303e53729
Author: Siarhei Siamashka <siarhei.siamashka at gmail.com>
Date:   Fri Mar 7 06:39:42 2014 +0200

    configure.ac: Check if the compiler supports GCC vector extensions
    
    The Intel Compiler 14.0.0 claims version GCC 4.7.3 compatibility
    via __GNUC__/__GNUC__MINOR__ macros, but does not provide the same
    level of GCC vector extensions support as the original GCC compiler:
        http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html
    
    Which results in the following compilation failure:
    
    In file included from ../test/utils.h(7),
                     from ../test/utils.c(3):
    ../test/utils-prng.h(138): error: expression must have integral type
          uint32x4 e = x->a - ((x->b << 27) + (x->b >> (32 - 27)));
                                ^
    
    The problem is fixed by doing a special check in configure for
    this feature.

diff --git a/configure.ac b/configure.ac
index 5a059f0..777e881 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1060,6 +1060,24 @@ fi
 
 AC_MSG_RESULT($support_for_builtin_clz)
 
+dnl =====================================
+dnl GCC vector extensions
+
+support_for_gcc_vector_extensions=no
+
+AC_MSG_CHECKING(for GCC vector extensions)
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
+unsigned int __attribute__ ((vector_size(16))) e, a, b;
+int main (void) { e = a - ((b << 27) + (b >> (32 - 27))) + 1; return e[0]; }
+]])], support_for_gcc_vector_extensions=yes)
+
+if test x$support_for_gcc_vector_extensions = xyes; then
+   AC_DEFINE([HAVE_GCC_VECTOR_EXTENSIONS], [],
+             [Whether the compiler supports GCC vector extensions])
+fi
+
+AC_MSG_RESULT($support_for_gcc_vector_extensions)
+
 dnl ==================
 dnl libpng
 
diff --git a/test/utils-prng.c b/test/utils-prng.c
index 7b32e35..c27b5be 100644
--- a/test/utils-prng.c
+++ b/test/utils-prng.c
@@ -27,7 +27,7 @@
 #include "utils.h"
 #include "utils-prng.h"
 
-#if defined(GCC_VECTOR_EXTENSIONS_SUPPORTED) && defined(__SSE2__)
+#if defined(HAVE_GCC_VECTOR_EXTENSIONS) && defined(__SSE2__)
 #include <xmmintrin.h>
 #endif
 
@@ -52,7 +52,7 @@ void smallprng_srand_r (smallprng_t *x, uint32_t seed)
  */
 void prng_srand_r (prng_t *x, uint32_t seed)
 {
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
     int i;
     prng_rand_128_data_t dummy;
     smallprng_srand_r (&x->p0, seed);
@@ -75,7 +75,7 @@ void prng_srand_r (prng_t *x, uint32_t seed)
 static force_inline void
 store_rand_128_data (void *addr, prng_rand_128_data_t *d, int aligned)
 {
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
     if (aligned)
     {
         *(uint8x16 *)addr = d->vb;
@@ -120,7 +120,7 @@ randmemset_internal (prng_t                  *prng,
         {
             prng_rand_128_r (&local_prng, &t);
             prng_rand_128_r (&local_prng, &randdata);
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
             if (flags & RANDMEMSET_MORE_FF)
             {
                 const uint8x16 const_C0 =
@@ -199,7 +199,7 @@ randmemset_internal (prng_t                  *prng,
         }
         else
         {
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
             const uint8x16 bswap_shufflemask =
             {
                 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12
diff --git a/test/utils-prng.h b/test/utils-prng.h
index 564ffce..f9ae8dd 100644
--- a/test/utils-prng.h
+++ b/test/utils-prng.h
@@ -79,8 +79,7 @@
 
 /*****************************************************************************/
 
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
-#define GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
 typedef uint32_t uint32x4 __attribute__ ((vector_size(16)));
 typedef uint8_t  uint8x16 __attribute__ ((vector_size(16)));
 #endif
@@ -92,7 +91,7 @@ typedef struct
 
 typedef struct
 {
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
     uint32x4 a, b, c, d;
 #else
     smallprng_t p1, p2, p3, p4;
@@ -104,7 +103,7 @@ typedef union
 {
     uint8_t  b[16];
     uint32_t w[4];
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
     uint8x16 vb;
     uint32x4 vw;
 #endif
@@ -134,7 +133,7 @@ prng_rand_r (prng_t *x)
 static force_inline void
 prng_rand_128_r (prng_t *x, prng_rand_128_data_t *data)
 {
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
     uint32x4 e = x->a - ((x->b << 27) + (x->b >> (32 - 27)));
     x->a = x->b ^ ((x->c << 17) ^ (x->c >> (32 - 17)));
     x->b = x->c + x->d;
commit 50d7b5fa8ea2ae119f35c20ab0dd0413d5103cbb
Author: Søren Sandmann <ssp at redhat.com>
Date:   Wed Apr 9 14:14:12 2014 -0400

    create_bits(): Cast the result of height * stride to size_t
    
    In create_bits() both height and stride are ints, so the result is
    also an int, which will overflow if height or stride are big enough
    and size_t is bigger than int.
    
    This patch simply casts height to size_t to prevent these overflows,
    which prevents the crash in:
    
        https://bugzilla.redhat.com/show_bug.cgi?id=972647
    
    It's not even close to fixing the full problem of supporting big
    images in pixman.
    
    See also
    
        https://bugs.freedesktop.org/show_bug.cgi?id=69014

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index f9121a3..dcdcc69 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -926,7 +926,7 @@ create_bits (pixman_format_code_t format,
     if (_pixman_multiply_overflows_size (height, stride))
 	return NULL;
 
-    buf_size = height * stride;
+    buf_size = (size_t)height * stride;
 
     if (rowstride_bytes)
 	*rowstride_bytes = stride;


More information about the xorg-commit mailing list