pixman: Branch 'master' - 3 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Tue Jan 29 18:42:40 PST 2013


 configure.ac       |    2 
 test/stress-test.c |  123 +++++++++++++++++++++++++++++------------------------
 2 files changed, 69 insertions(+), 56 deletions(-)

New commits:
commit 958bd334b3c17f529c80f2eeef4224f45c62f292
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Jan 29 21:42:02 2013 -0500

    Post-release version bump to 0.29.3

diff --git a/configure.ac b/configure.ac
index 8bd01fa..38f89b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ AC_PREREQ([2.57])
 
 m4_define([pixman_major], 0)
 m4_define([pixman_minor], 29)
-m4_define([pixman_micro], 2)
+m4_define([pixman_micro], 3)
 
 m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro])
 
commit a56707e23bf2d3ef7c2ff9f66f214716791a424d
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Jan 29 20:23:39 2013 -0500

    Pre-release version bump to 0.29.2

diff --git a/configure.ac b/configure.ac
index a93e290..8bd01fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ AC_PREREQ([2.57])
 
 m4_define([pixman_major], 0)
 m4_define([pixman_minor], 29)
-m4_define([pixman_micro], 1)
+m4_define([pixman_micro], 2)
 
 m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro])
 
commit 349015e1fc5d912ba4253133b90e751d0b6ca7f2
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Jan 29 20:23:31 2013 -0500

    stresstest: Ensure that the rasterizer is only given alpha formats
    
    In c2cb303d33ec11390b93cabd90f0f9, return_if_fail()s were added to
    prevent the trapezoid rasterizers from being called with non-alpha
    formats. However, stress-test actually does call the rasterizers with
    non-alpha formats, but because _pixman_log_error() is disabled in
    versions with an odd minor number, the errors never materialized.
    
    Fix this by changing the argument to random format to an enum of three
    values DONT_CARE, PREFER_ALPHA, or REQUIRE_ALPHA, and then in the
    switch that calls the trapezoid rasterizers, pass the appropriate
    value for the function in question.

diff --git a/test/stress-test.c b/test/stress-test.c
index 9d949af..1f03c75 100644
--- a/test/stress-test.c
+++ b/test/stress-test.c
@@ -205,13 +205,21 @@ rand_y (pixman_image_t *image)
 	return log_rand ();
 }
 
+typedef enum
+{
+    DONT_CARE,
+    PREFER_ALPHA,
+    REQUIRE_ALPHA
+} alpha_preference_t;
+
 static pixman_format_code_t
-random_format (pixman_bool_t prefer_alpha)
+random_format (alpha_preference_t alpha)
 {
     pixman_format_code_t format;
     int n = prng_rand_n (ARRAY_LENGTH (image_formats));
 
-    if (prefer_alpha && prng_rand_n (4) != 0)
+    if (alpha >= PREFER_ALPHA &&
+	(alpha == REQUIRE_ALPHA || prng_rand_n (4) != 0))
     {
         do
         {
@@ -227,7 +235,7 @@ random_format (pixman_bool_t prefer_alpha)
 }
 
 static pixman_image_t *
-create_random_bits_image (pixman_bool_t prefer_alpha)
+create_random_bits_image (alpha_preference_t alpha_preference)
 {
     pixman_format_code_t format;
     pixman_indexed_t *indexed;
@@ -241,7 +249,7 @@ create_random_bits_image (pixman_bool_t prefer_alpha)
     int n_coefficients = 0;
 
     /* format */
-    format = random_format (prefer_alpha);
+    format = random_format (alpha_preference);
 
     indexed = NULL;
     if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR)
@@ -410,7 +418,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
 	pixman_image_t *alpha_map;
 	int16_t x, y;
 
-	alpha_map = create_random_bits_image (FALSE);
+	alpha_map = create_random_bits_image (DONT_CARE);
 
 	if (alpha_map)
 	{
@@ -493,7 +501,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
 		    width = INT32_MAX - x;
 		if (height + y < y)
 		    height = INT32_MAX - y;
-		
+
 		pixman_region32_union_rect (
 		    &region, &region, x, y, width, height);
 	    }
@@ -716,7 +724,7 @@ create_random_image (void)
     {
     default:
     case 0:
-	result = create_random_bits_image (FALSE);
+	result = create_random_bits_image (DONT_CARE);
 	break;
 
     case 1:
@@ -848,62 +856,66 @@ run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod)
     }
 
     source = mask = dest = NULL;
-    
+
     prng_srand (seed);
 
     if (prng_rand_n (8) == 0)
     {
         int n_traps;
         pixman_trapezoid_t *trapezoids;
+	int p = prng_rand_n (3);
 
-        dest = create_random_bits_image (TRUE);
+	if (p == 0)
+	    dest = create_random_bits_image (DONT_CARE);
+	else
+	    dest = create_random_bits_image (REQUIRE_ALPHA);
 
-        if (dest)
-        {
-            set_general_properties (dest, TRUE);
+	if (!dest)
+	    goto out;
+
+	set_general_properties (dest, TRUE);
+
+	if (!(trapezoids = create_random_trapezoids (
+		  &n_traps, dest->bits.width, dest->bits.height)))
+	{
+	    goto out;
+	}
 
-            trapezoids = create_random_trapezoids (
-                &n_traps, dest->bits.width, dest->bits.height);
-
-            if (trapezoids)
-            {
-                switch (prng_rand_n (3))
-                {
-                case 0:
-                    pixman_rasterize_trapezoid (
-                        dest, &trapezoids[prng_rand_n (n_traps)],
-                        rand_x (dest), rand_y (dest));
-                    break;
-
-                case 1:
-                    source = create_random_image ();
-
-                    if (source)
-                    {
-                        op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))];
-                        
-                        pixman_composite_trapezoids (
-                            op, source, dest,
-                            random_format (TRUE),
-                            rand_x (source), rand_y (source),
-                            rand_x (dest), rand_y (dest),
-                            n_traps, trapezoids);
-                    }
-                    break;
-
-                case 2:
-                    pixman_add_trapezoids (
-                        dest, rand_x (dest), rand_y (dest), n_traps, trapezoids);
-                    break;
-                }
-
-                free (trapezoids);
-            }
+	switch (p)
+	{
+	case 0:
+	    source = create_random_image ();
+
+	    if (source)
+	    {
+		op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))];
+
+		pixman_composite_trapezoids (
+		    op, source, dest,
+		    random_format (REQUIRE_ALPHA),
+		    rand_x (source), rand_y (source),
+		    rand_x (dest), rand_y (dest),
+		    n_traps, trapezoids);
+	    }
+	    break;
+
+	case 1:
+	    pixman_rasterize_trapezoid (
+		dest, &trapezoids[prng_rand_n (n_traps)],
+		rand_x (dest), rand_y (dest));
+	    break;
+
+	case 2:
+	    pixman_add_trapezoids (
+		dest, rand_x (dest), rand_y (dest), n_traps, trapezoids);
+	    break;
         }
+
+	free (trapezoids);
     }
     else
     {
-        dest = create_random_bits_image (FALSE);
+        dest = create_random_bits_image (DONT_CARE);
         source = create_random_image ();
         mask = create_random_image ();
 
@@ -917,16 +929,17 @@ run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod)
                                       source, mask, dest,
                                       rand_x (source), rand_y (source),
                                       rand_x (mask), rand_y (mask),
-                                      0, 0, 
+                                      0, 0,
                                       dest->bits.width,
                                       dest->bits.height);
         }
     }
 
-        if (source)
-            pixman_image_unref (source);
-        if (mask)
-            pixman_image_unref (mask);
+out:
+    if (source)
+	pixman_image_unref (source);
+    if (mask)
+	pixman_image_unref (mask);
     if (dest)
 	pixman_image_unref (dest);
 }


More information about the xorg-commit mailing list