pixman: Branch 'master' - 4 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Fri Jul 6 20:52:57 PDT 2012
configure.ac | 3 -
pixman/pixman-fast-path.c | 5 +--
pixman/pixman-matrix.c | 4 +-
test/stress-test.c | 71 +++++++++++++++++++++++++++++++++++-----------
4 files changed, 61 insertions(+), 22 deletions(-)
New commits:
commit d4aa82fb9148862904bb7ca33655ce8d571643b0
Author: Sebastian Bauer <mail at sebastianbauer.info>
Date: Tue Jul 3 05:55:14 2012 -0400
Qualify the static variables in pixman_f_transform_invert() with the const keyword.
Their contents is not overwritten.
diff --git a/pixman/pixman-matrix.c b/pixman/pixman-matrix.c
index 8d0d973..6d215ff 100644
--- a/pixman/pixman-matrix.c
+++ b/pixman/pixman-matrix.c
@@ -471,8 +471,8 @@ pixman_f_transform_invert (struct pixman_f_transform * dst,
{
double det;
int i, j;
- static int a[3] = { 2, 2, 1 };
- static int b[3] = { 1, 0, 0 };
+ static const int a[3] = { 2, 2, 1 };
+ static const int b[3] = { 1, 0, 0 };
det = 0;
for (i = 0; i < 3; i++)
commit f9c91ee2f27eaea68d8c3a130bf7d4bc0c860834
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Sun Jul 1 16:59:53 2012 -0400
Use a compile-time constant for the "K" constraint in the MMX detection.
When compiling with -O0, gcc doesn't understand that in
signed char x = 0;
...
asm ("...",
: "K" (x));
x is constant. Fix this by using an immediate constant instead of a
variable.
diff --git a/configure.ac b/configure.ac
index 2b9d1ba..36f423e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -351,12 +351,11 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main () {
__m64 v = _mm_cvtsi32_si64 (1);
__m64 w;
- signed char x = 0;
/* Some versions of clang will choke on K */
asm ("pshufw %2, %1, %0\n\t"
: "=y" (w)
- : "y" (v), "K" (x)
+ : "y" (v), "K" (5)
);
return _mm_cvtsi64_si32 (v);
commit cd7ecf548a9e8115226bf0fec174f3abc54becb5
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Sun Jul 1 06:54:06 2012 -0400
In fast_composite_tiled_repeat() don't clone images with a palette
In fast_composite_tiled_repeat() if the source image is less than a
certain constant width, a clone is created which is then
pre-repeated. However, the source image's palette, if it has one, is
not cloned, so for indexed images, the pre-repeating would crash.
Fix this by not doing any pre-repeating for images with a palette set.
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index e79b069..9778b0c 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1280,8 +1280,9 @@ fast_composite_tiled_repeat (pixman_implementation_t *imp,
src_bpp = PIXMAN_FORMAT_BPP (src_image->bits.format);
- if (src_image->bits.width < REPEAT_MIN_WIDTH &&
- (src_bpp == 32 || src_bpp == 16 || src_bpp == 8))
+ if (src_image->bits.width < REPEAT_MIN_WIDTH &&
+ (src_bpp == 32 || src_bpp == 16 || src_bpp == 8) &&
+ !src_image->bits.indexed)
{
sx = src_x;
sx = MOD (sx, src_image->bits.width);
commit 7b20ad39f778d765566d3f2c5f7c50964100efc1
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Sun Jul 1 06:53:18 2012 -0400
test: Make stress-test more likely to actually composite something
stress-test current almost never composites anything because the clip
rectangles and transformations are such that either
_pixman_compute_composite_region32() or analyze_extent() will return
FALSE.
Fix this by:
- making log_rand() return smaller numbers so that the clip rectangles
are more likely to be within the destination image
- adding rand_x() and rand_y() functions that pick positions within an
image and using them for positioning alpha maps and source/mask
positions.
- making it less likely that clip regions are used in general
These changes make the test take longer, so speed it up a little by
making most images smaller and by reducing the maximum convolution
filter from 17x19 to 3x4.
With these changes, stress-test reveals a crash in iteration 0xd39
where fast_composite_tiled_repeat() creates an indexed image without a
palette.
diff --git a/test/stress-test.c b/test/stress-test.c
index 7fc067e..9280802 100644
--- a/test/stress-test.c
+++ b/test/stress-test.c
@@ -83,7 +83,7 @@ get_size (void)
default:
case 2:
- return lcg_rand_n (200);
+ return lcg_rand_n (100);
case 4:
return lcg_rand_n (2000) + 1000;
@@ -181,9 +181,27 @@ log_rand (void)
{
uint32_t mask;
- mask = (1 << lcg_rand_n (31)) - 1;
+ mask = (1 << lcg_rand_n (10)) - 1;
- return (lcg_rand () & mask) - (mask >> 1);
+ return (lcg_rand_u32 () & mask) - (mask >> 1);
+}
+
+static int32_t
+rand_x (pixman_image_t *image)
+{
+ if (image->type == BITS)
+ return lcg_rand_n (image->bits.width);
+ else
+ return log_rand ();
+}
+
+static int32_t
+rand_y (pixman_image_t *image)
+{
+ if (image->type == BITS)
+ return lcg_rand_n (image->bits.height);
+ else
+ return log_rand ();
}
static pixman_image_t *
@@ -225,7 +243,7 @@ create_random_bits_image (void)
width = get_size ();
height = get_size ();
- if ((uint64_t)width * height > 200000)
+ while ((uint64_t)width * height > 200000)
{
if (lcg_rand_n(2) == 0)
height = 200000 / width;
@@ -304,8 +322,8 @@ create_random_bits_image (void)
filter = filters[lcg_rand_n (ARRAY_LENGTH (filters))];
if (filter == PIXMAN_FILTER_CONVOLUTION)
{
- int width = lcg_rand_n (17);
- int height = lcg_rand_n (19);
+ int width = lcg_rand_n (3);
+ int height = lcg_rand_n (4);
n_coefficients = width * height + 2;
coefficients = malloc (n_coefficients * sizeof (pixman_fixed_t));
@@ -365,7 +383,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
pixman_image_set_repeat (image, repeat);
/* Alpha map */
- if (allow_alpha_map && lcg_rand_n (3) == 0)
+ if (allow_alpha_map && lcg_rand_n (4) == 0)
{
pixman_image_t *alpha_map;
int16_t x, y;
@@ -376,8 +394,8 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
{
set_general_properties (alpha_map, FALSE);
- x = lcg_rand_N (100000) - 65536;
- y = lcg_rand_N (100000) - 65536;
+ x = rand_x (image) - image->bits.width / 2;
+ y = rand_y (image) - image->bits.height / 2;
pixman_image_set_alpha_map (image, alpha_map, x, y);
@@ -389,14 +407,14 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
pixman_image_set_component_alpha (image, lcg_rand_n (3) == 0);
/* Clip region */
- if (lcg_rand_n (8) != 0)
+ if (lcg_rand_n (8) < 2)
{
pixman_region32_t region;
int i, n_rects;
pixman_region32_init (®ion);
- switch (lcg_rand_n (10))
+ switch (lcg_rand_n (12))
{
case 0:
n_rects = 0;
@@ -433,6 +451,27 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
®ion, ®ion, x, y, width, height);
}
+ if (image->type == BITS && lcg_rand_n (8) != 0)
+ {
+ uint32_t width, height;
+ int x, y;
+ int i;
+
+ /* Also add a couple of clip rectangles inside the image
+ * so that compositing will actually take place.
+ */
+ for (i = 0; i < 5; ++i)
+ {
+ x = lcg_rand_n (2 * image->bits.width) - image->bits.width;
+ y = lcg_rand_n (2 * image->bits.height) - image->bits.height;
+ width = lcg_rand_n (image->bits.width) - x + 10;
+ height = lcg_rand_n (image->bits.height) - y + 10;
+
+ pixman_region32_union_rect (
+ ®ion, ®ion, x, y, width, height);
+ }
+ }
+
pixman_image_set_clip_region32 (image, ®ion);
pixman_region32_fini (®ion);
@@ -762,11 +801,11 @@ run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod)
pixman_image_composite32 (op,
source, mask, dest,
- log_rand(), log_rand(),
- log_rand(), log_rand(),
- log_rand(), log_rand(),
- absolute (log_rand()),
- absolute (log_rand()));
+ rand_x (source), rand_y (source),
+ rand_x (mask), rand_y (mask),
+ 0, 0,
+ dest->bits.width,
+ dest->bits.height);
}
if (source)
pixman_image_unref (source);
More information about the xorg-commit
mailing list