pixman: Branch 'master' - 4 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Mon Oct 4 08:30:24 PDT 2010


 pixman/pixman-bits-image.c |    3 
 pixman/pixman-compiler.h   |    3 
 pixman/pixman-fast-path.h  |    4 -
 pixman/pixman-image.c      |   17 -----
 pixman/pixman-private.h    |   58 +++++++----------
 pixman/pixman.c            |  152 ++++++---------------------------------------
 test/utils.c               |   27 +------
 7 files changed, 64 insertions(+), 200 deletions(-)

New commits:
commit b924bb1f8191cc7c386d8211d9822aeeaadcab44
Author: Mika Yrjola <mika.yrjola at movial.com>
Date:   Fri Oct 1 16:17:50 2010 +0300

    Fix "syntax error: empty declaration" warnings.
    
    These minor changes should fix a large number of
    macro declaration - related "syntax error:  empty declaration" warnings
    which are seen while compiling the code with the Solaris Studio
    compiler.

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index c878250..2e83c82 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -944,7 +944,8 @@ convert_r5g6b5 (const uint8_t *row, int x)
 					  convert_ ## format,		\
 					  PIXMAN_ ## format,		\
 					  repeat_mode);			\
-    }
+    }									\
+    extern int no_such_variable
 
 MAKE_BILINEAR_FETCHER (pad_a8r8g8b8,     a8r8g8b8, PIXMAN_REPEAT_PAD);
 MAKE_BILINEAR_FETCHER (none_a8r8g8b8,    a8r8g8b8, PIXMAN_REPEAT_NONE);
diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
index 8f6c787..0e08589 100644
--- a/pixman/pixman-compiler.h
+++ b/pixman/pixman-compiler.h
@@ -191,7 +191,8 @@
 		value = tls_ ## name ## _alloc ();			\
 	}								\
 	return value;							\
-    }
+    }									\
+    extern int no_such_variable						
 
 #   define PIXMAN_GET_THREAD_LOCAL(name)				\
     tls_ ## name ## _get ()
diff --git a/pixman/pixman-fast-path.h b/pixman/pixman-fast-path.h
index ed09ba5..6fe448c 100644
--- a/pixman/pixman-fast-path.h
+++ b/pixman/pixman-fast-path.h
@@ -381,7 +381,9 @@ fast_composite_scaled_nearest_ ## scale_func_name (pixman_implementation_t *imp,
 			  OP, repeat_mode)						\
     FAST_NEAREST_MAINLOOP(scale_func_name##_##OP,					\
 			  scaled_nearest_scanline_ ## scale_func_name ## _ ## OP,	\
-			  src_type_t, dst_type_t, repeat_mode)
+			  src_type_t, dst_type_t, repeat_mode)				\
+											\
+    extern int no_such_variable
 
 
 #define SCALED_NEAREST_FLAGS						\
commit 73c1fefa1b99efa36b74599f455df9426209378e
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Sep 28 00:51:07 2010 -0400

    Delete simple repeat code
    
    This was supposedly an optimization, but it has pathological cases
    where it definitely isn't. For example a 1 x n image will cause it to
    have terrible memory access patterns and to generate a ton of modulus
    operations.
    
    Since no one has ever measured whether it actually is an improvement,
    and since it is doing the repeating at the wrong the stage in the
    pipeline, and since with the previous commit it can't be triggered
    anymore because we now require SAMPLES_COVER_CLIP for regular fast
    paths, just delete it.

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 9802d8c..7a9c423 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -409,12 +409,6 @@ compute_image_info (pixman_image_t *image)
 	else
 	{
 	    code = image->bits.format;
-
-	    if (!image->common.transform &&
-		image->common.repeat == PIXMAN_REPEAT_NORMAL)
-	    {
-		flags |= FAST_PATH_SIMPLE_REPEAT;
-	    }
 	}
 
 	if (!PIXMAN_FORMAT_A (image->bits.format)				&&
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 59d9c5d..3979f60 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -560,7 +560,7 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_UNIFIED_ALPHA			(1 <<  9)
 #define FAST_PATH_SCALE_TRANSFORM		(1 << 10)
 #define FAST_PATH_NEAREST_FILTER		(1 << 11)
-#define FAST_PATH_SIMPLE_REPEAT			(1 << 12)
+#define FAST_PATH_HAS_TRANSFORM			(1 << 12)
 #define FAST_PATH_IS_OPAQUE			(1 << 13)
 #define FAST_PATH_NEEDS_WORKAROUND		(1 << 14)
 #define FAST_PATH_NO_NONE_REPEAT		(1 << 15)
@@ -570,7 +570,6 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_Y_UNIT_ZERO			(1 << 19)
 #define FAST_PATH_BILINEAR_FILTER		(1 << 20)
 #define FAST_PATH_NO_NORMAL_REPEAT		(1 << 21)
-#define FAST_PATH_HAS_TRANSFORM			(1 << 22)
 
 #define FAST_PATH_PAD_REPEAT						\
     (FAST_PATH_NO_NONE_REPEAT		|				\
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 15e7fbf..3a62b2d 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -377,126 +377,6 @@ pixman_compute_composite_region32 (pixman_region32_t * region,
     return TRUE;
 }
 
-static void
-walk_region_internal (pixman_implementation_t *imp,
-                      pixman_op_t              op,
-                      pixman_image_t *         src_image,
-                      pixman_image_t *         mask_image,
-                      pixman_image_t *         dst_image,
-                      int32_t                  src_x,
-                      int32_t                  src_y,
-                      int32_t                  mask_x,
-                      int32_t                  mask_y,
-                      int32_t                  dest_x,
-                      int32_t                  dest_y,
-                      int32_t                  width,
-                      int32_t                  height,
-                      pixman_bool_t            src_repeat,
-                      pixman_bool_t            mask_repeat,
-                      pixman_region32_t *      region,
-                      pixman_composite_func_t  composite_rect)
-{
-    int w, h, w_this, h_this;
-    int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
-    int src_dy = src_y - dest_y;
-    int src_dx = src_x - dest_x;
-    int mask_dy = mask_y - dest_y;
-    int mask_dx = mask_x - dest_x;
-    const pixman_box32_t *pbox;
-    int n;
-
-    pbox = pixman_region32_rectangles (region, &n);
-
-    /* Fast path for non-repeating sources */
-    if (!src_repeat && !mask_repeat)
-    {
-       while (n--)
-       {
-           (*composite_rect) (imp, op,
-                              src_image, mask_image, dst_image,
-                              pbox->x1 + src_dx,
-                              pbox->y1 + src_dy,
-                              pbox->x1 + mask_dx,
-                              pbox->y1 + mask_dy,
-                              pbox->x1,
-                              pbox->y1,
-                              pbox->x2 - pbox->x1,
-                              pbox->y2 - pbox->y1);
-           
-           pbox++;
-       }
-
-       return;
-    }
-    
-    while (n--)
-    {
-	h = pbox->y2 - pbox->y1;
-	y_src = pbox->y1 + src_dy;
-	y_msk = pbox->y1 + mask_dy;
-	y_dst = pbox->y1;
-
-	while (h)
-	{
-	    h_this = h;
-	    w = pbox->x2 - pbox->x1;
-	    x_src = pbox->x1 + src_dx;
-	    x_msk = pbox->x1 + mask_dx;
-	    x_dst = pbox->x1;
-
-	    if (mask_repeat)
-	    {
-		y_msk = MOD (y_msk, mask_image->bits.height);
-		if (h_this > mask_image->bits.height - y_msk)
-		    h_this = mask_image->bits.height - y_msk;
-	    }
-
-	    if (src_repeat)
-	    {
-		y_src = MOD (y_src, src_image->bits.height);
-		if (h_this > src_image->bits.height - y_src)
-		    h_this = src_image->bits.height - y_src;
-	    }
-
-	    while (w)
-	    {
-		w_this = w;
-
-		if (mask_repeat)
-		{
-		    x_msk = MOD (x_msk, mask_image->bits.width);
-		    if (w_this > mask_image->bits.width - x_msk)
-			w_this = mask_image->bits.width - x_msk;
-		}
-
-		if (src_repeat)
-		{
-		    x_src = MOD (x_src, src_image->bits.width);
-		    if (w_this > src_image->bits.width - x_src)
-			w_this = src_image->bits.width - x_src;
-		}
-
-		(*composite_rect) (imp, op,
-				   src_image, mask_image, dst_image,
-				   x_src, y_src, x_msk, y_msk, x_dst, y_dst,
-				   w_this, h_this);
-		w -= w_this;
-
-		x_src += w_this;
-		x_msk += w_this;
-		x_dst += w_this;
-	    }
-
-	    h -= h_this;
-	    y_src += h_this;
-	    y_msk += h_this;
-	    y_dst += h_this;
-	}
-
-	pbox++;
-    }
-}
-
 #define N_CACHED_FAST_PATHS 8
 
 typedef struct
@@ -949,14 +829,26 @@ pixman_image_composite32 (pixman_op_t      op,
 				   dest_format, dest_flags,
 				   &imp, &func))
     {
-	walk_region_internal (imp, op,
-			      src, mask, dest,
-			      src_x, src_y, mask_x, mask_y,
-			      dest_x, dest_y,
-			      width, height,
-			      (src_flags & FAST_PATH_SIMPLE_REPEAT),
-			      (mask_flags & FAST_PATH_SIMPLE_REPEAT),
-			      &region, func);
+	const pixman_box32_t *pbox;
+	int n;
+
+	pbox = pixman_region32_rectangles (&region, &n);
+	
+	while (n--)
+	{
+	    func (imp, op,
+		  src, mask, dest,
+		  pbox->x1 + src_x - dest_x,
+		  pbox->y1 + src_y - dest_y,
+		  pbox->x1 + mask_x - dest_x,
+		  pbox->y1 + mask_y - dest_y,
+		  pbox->x1,
+		  pbox->y1,
+		  pbox->x2 - pbox->x1,
+		  pbox->y2 - pbox->y1);
+	    
+	    pbox++;
+	}
     }
 
 out:
commit a4d1c9d3831751008db61a48d6a6cb12ed33f314
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Sep 28 00:42:25 2010 -0400

    Fix bug in FAST_PATH_STD_FAST_PATH
    
    The standard fast paths deal with two kinds of images: solids and
    bits. These two image types require different flags, but
    PIXMAN_STD_FAST_PATH uses the same ones for both.
    
    This patch makes it so that solid images just get the standard flags,
    while bits images must be untransformed contain the destination clip
    within the sample grid.
    
    This means that the old FAST_PATH_COVERS_CLIP flag is now not used
    anymore, so it can be deleted.

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 8397f6a..9802d8c 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -363,24 +363,21 @@ compute_image_info (pixman_image_t *image)
 	flags |=
 	    FAST_PATH_NO_PAD_REPEAT		|
 	    FAST_PATH_NO_NONE_REPEAT		|
-	    FAST_PATH_NO_NORMAL_REPEAT		|
-	    FAST_PATH_COVERS_CLIP;
+	    FAST_PATH_NO_NORMAL_REPEAT;
 	break;
 
     case PIXMAN_REPEAT_PAD:
 	flags |=
 	    FAST_PATH_NO_REFLECT_REPEAT		|
 	    FAST_PATH_NO_NONE_REPEAT		|
-	    FAST_PATH_NO_NORMAL_REPEAT		|
-	    FAST_PATH_COVERS_CLIP;
+	    FAST_PATH_NO_NORMAL_REPEAT;
 	break;
 
     default:
 	flags |=
 	    FAST_PATH_NO_REFLECT_REPEAT		|
 	    FAST_PATH_NO_PAD_REPEAT		|
-	    FAST_PATH_NO_NONE_REPEAT		|
-	    FAST_PATH_COVERS_CLIP;
+	    FAST_PATH_NO_NONE_REPEAT;
 	break;
     }
 
@@ -400,8 +397,6 @@ compute_image_info (pixman_image_t *image)
 
 	if (image->solid.color.alpha == 0xffff)
 	    flags |= FAST_PATH_IS_OPAQUE;
-
-	flags |= FAST_PATH_COVERS_CLIP;
 	break;
 
     case BITS:
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index d85868f..59d9c5d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -554,9 +554,9 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_NO_PAD_REPEAT			(1 <<  3)
 #define FAST_PATH_NO_REFLECT_REPEAT		(1 <<  4)
 #define FAST_PATH_NO_ACCESSORS			(1 <<  5)
-#define FAST_PATH_NARROW_FORMAT		(1 <<  6)
-#define FAST_PATH_COVERS_CLIP			(1 <<  7)
+#define FAST_PATH_NARROW_FORMAT			(1 <<  6)
 #define FAST_PATH_COMPONENT_ALPHA		(1 <<  8)
+#define FAST_PATH_SAMPLES_OPAQUE		(1 <<  7)
 #define FAST_PATH_UNIFIED_ALPHA			(1 <<  9)
 #define FAST_PATH_SCALE_TRANSFORM		(1 << 10)
 #define FAST_PATH_NEAREST_FILTER		(1 << 11)
@@ -571,7 +571,6 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_BILINEAR_FILTER		(1 << 20)
 #define FAST_PATH_NO_NORMAL_REPEAT		(1 << 21)
 #define FAST_PATH_HAS_TRANSFORM			(1 << 22)
-#define FAST_PATH_SAMPLES_OPAQUE		(1 << 23)
 
 #define FAST_PATH_PAD_REPEAT						\
     (FAST_PATH_NO_NONE_REPEAT		|				\
@@ -593,29 +592,25 @@ _pixman_choose_implementation (void);
      FAST_PATH_NO_NORMAL_REPEAT		|				\
      FAST_PATH_NO_PAD_REPEAT)
 
-#define _FAST_PATH_STANDARD_FLAGS					\
-    (FAST_PATH_ID_TRANSFORM		|				\
-     FAST_PATH_NO_ALPHA_MAP		|				\
-     FAST_PATH_NO_CONVOLUTION_FILTER	|				\
-     FAST_PATH_NO_PAD_REPEAT		|				\
-     FAST_PATH_NO_REFLECT_REPEAT	|				\
+#define FAST_PATH_STANDARD_FLAGS					\
+    (FAST_PATH_NO_CONVOLUTION_FILTER	|				\
      FAST_PATH_NO_ACCESSORS		|				\
-     FAST_PATH_NARROW_FORMAT		|				\
-     FAST_PATH_COVERS_CLIP)
-
-#define FAST_PATH_STD_SRC_FLAGS						\
-    _FAST_PATH_STANDARD_FLAGS
-#define FAST_PATH_STD_MASK_U_FLAGS					\
-    (_FAST_PATH_STANDARD_FLAGS		|				\
-     FAST_PATH_UNIFIED_ALPHA)
-#define FAST_PATH_STD_MASK_CA_FLAGS					\
-    (_FAST_PATH_STANDARD_FLAGS		|				\
-     FAST_PATH_COMPONENT_ALPHA)
+     FAST_PATH_NO_ALPHA_MAP		|				\
+     FAST_PATH_NARROW_FORMAT)
+
 #define FAST_PATH_STD_DEST_FLAGS					\
     (FAST_PATH_NO_ACCESSORS		|				\
      FAST_PATH_NO_ALPHA_MAP		|				\
      FAST_PATH_NARROW_FORMAT)
 
+#define SOURCE_FLAGS(format)						\
+    (FAST_PATH_STANDARD_FLAGS |						\
+     ((PIXMAN_ ## format == PIXMAN_solid) ?				\
+      0 : (FAST_PATH_SAMPLES_COVER_CLIP | FAST_PATH_ID_TRANSFORM)))
+
+#define MASK_FLAGS(format, extra)					\
+    ((PIXMAN_ ## format == PIXMAN_null) ? 0 : (SOURCE_FLAGS (format) | extra))
+
 #define FAST_PATH(op, src, src_flags, mask, mask_flags, dest, dest_flags, func) \
     PIXMAN_OP_ ## op,							\
     PIXMAN_ ## src,							\
@@ -628,19 +623,19 @@ _pixman_choose_implementation (void);
 
 #define PIXMAN_STD_FAST_PATH(op, src, mask, dest, func)			\
     { FAST_PATH (							\
-	  op,								\
-	  src, FAST_PATH_STD_SRC_FLAGS,					\
-	  mask, (PIXMAN_ ## mask) ? FAST_PATH_STD_MASK_U_FLAGS : 0,	\
-	  dest, FAST_PATH_STD_DEST_FLAGS,				\
-	  func) }
+	    op,								\
+	    src,  SOURCE_FLAGS (src),					\
+	    mask, MASK_FLAGS (mask, FAST_PATH_UNIFIED_ALPHA),		\
+	    dest, FAST_PATH_STD_DEST_FLAGS,				\
+	    func) }
 
 #define PIXMAN_STD_FAST_PATH_CA(op, src, mask, dest, func)		\
     { FAST_PATH (							\
-	  op,								\
-	  src, FAST_PATH_STD_SRC_FLAGS,					\
-	  mask, FAST_PATH_STD_MASK_CA_FLAGS,				\
-	  dest, FAST_PATH_STD_DEST_FLAGS,				\
-	  func) }
+	    op,								\
+	    src,  SOURCE_FLAGS (src),					\
+	    mask, MASK_FLAGS (mask, FAST_PATH_COMPONENT_ALPHA),		\
+	    dest, FAST_PATH_STD_DEST_FLAGS,				\
+	    func) }
 
 /* Memory allocation helpers */
 void *
diff --git a/pixman/pixman.c b/pixman/pixman.c
index bd9305b..15e7fbf 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -746,7 +746,7 @@ analyze_extent (pixman_image_t *image, int x, int y,
 	    extents->x2 - x <= image->bits.width &&
 	    extents->y2 - y <= image->bits.height)
 	{
-	    *flags |= (FAST_PATH_SAMPLES_COVER_CLIP | FAST_PATH_COVERS_CLIP);
+	    *flags |= FAST_PATH_SAMPLES_COVER_CLIP;
 	    return TRUE;
 	}
     
@@ -789,7 +789,7 @@ analyze_extent (pixman_image_t *image, int x, int y,
 	    ex.x1 >= 0 && ex.y1 >= 0 &&
 	    ex.x2 <= image->bits.width && ex.y2 <= image->bits.height)
 	{
-	    *flags |= (FAST_PATH_SAMPLES_COVER_CLIP | FAST_PATH_COVERS_CLIP);
+	    *flags |= FAST_PATH_SAMPLES_COVER_CLIP;
 	}
     }
     else
commit 10e13135c3538f0909f27eaacc17e9e13f199a7c
Author: Dmitri Vorobiev <dmitri.vorobiev at movial.com>
Date:   Tue Sep 28 14:42:02 2010 +0300

    Some clean-ups in fence_malloc() and fence_free()
    
    This patch removes an unnecessary typecast of MAP_FAILED,
    replaces an erroneous free() by the correct munmap() in the
    error path for a failing mprotect(), and, finally, removes
    redundant calls to mprotect() that aren't necessary, because
    munmap() doesn't call for any specific memory protection.

diff --git a/test/utils.c b/test/utils.c
index 2ed5051..f6278fe 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -243,7 +243,7 @@ fence_malloc (uint32_t len)
     addr = mmap (NULL, n_bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
 		 -1, 0);
 
-    if (addr == (void *)MAP_FAILED)
+    if (addr == MAP_FAILED)
     {
 	printf ("mmap failed on %u %u\n", len, n_bytes);
 	return NULL;
@@ -259,20 +259,12 @@ fence_malloc (uint32_t len)
     ((info_t *)initial_page)->trailing = trailing_protected;
     ((info_t *)initial_page)->n_bytes = n_bytes;
 
-    if (mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
-		  PROT_NONE) == -1)
+    if ((mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
+		  PROT_NONE) == -1) ||
+	(mprotect (trailing_protected, N_TRAILING_PROTECTED * page_size,
+		  PROT_NONE) == -1))
     {
-	free (addr);
-	return NULL;
-    }
-
-    if (mprotect (trailing_protected, N_TRAILING_PROTECTED * page_size,
-		  PROT_NONE) == -1)
-    {
-	mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
-		  PROT_READ | PROT_WRITE);
-
-	free (addr);
+	munmap (addr, n_bytes);
 	return NULL;
     }
 
@@ -287,13 +279,6 @@ fence_free (void *data)
     uint8_t *leading_protected = payload - N_LEADING_PROTECTED * page_size;
     uint8_t *initial_page = leading_protected - page_size;
     info_t *info = (info_t *)initial_page;
-    uint8_t *trailing_protected = info->trailing;
-
-    mprotect (leading_protected, N_LEADING_PROTECTED * page_size,
-	      PROT_READ | PROT_WRITE);
-
-    mprotect (trailing_protected, N_LEADING_PROTECTED * page_size,
-	      PROT_READ | PROT_WRITE);
 
     munmap (info->addr, info->n_bytes);
 }


More information about the xorg-commit mailing list