aboutsummaryrefslogtreecommitdiff
path: root/pixman/test
diff options
context:
space:
mode:
Diffstat (limited to 'pixman/test')
-rw-r--r--pixman/test/blitters-test.c13
-rw-r--r--pixman/test/lowlevel-blt-bench.c13
-rw-r--r--pixman/test/prng-test.c5
-rw-r--r--pixman/test/utils-prng.c58
-rw-r--r--pixman/test/utils-prng.h5
5 files changed, 83 insertions, 11 deletions
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c
index 8766fa800..a2c6ff4d8 100644
--- a/pixman/test/blitters-test.c
+++ b/pixman/test/blitters-test.c
@@ -46,7 +46,16 @@ create_random_image (pixman_format_code_t *allowed_formats,
/* do the allocation */
buf = aligned_malloc (64, stride * height);
- prng_randmemset (buf, stride * height, RANDMEMSET_MORE_00_AND_FF);
+ if (prng_rand_n (4) == 0)
+ {
+ /* uniform distribution */
+ prng_randmemset (buf, stride * height, 0);
+ }
+ else
+ {
+ /* significantly increased probability for 0x00 and 0xFF */
+ prng_randmemset (buf, stride * height, RANDMEMSET_MORE_00_AND_FF);
+ }
img = pixman_image_create_bits (fmt, width, height, buf, stride);
@@ -393,6 +402,6 @@ main (int argc, const char *argv[])
}
return fuzzer_test_main("blitters", 2000000,
- 0xD8265D5E,
+ 0x0CF3283B,
test_composite, argc, argv);
}
diff --git a/pixman/test/lowlevel-blt-bench.c b/pixman/test/lowlevel-blt-bench.c
index 4e16f7ba1..1049e21e7 100644
--- a/pixman/test/lowlevel-blt-bench.c
+++ b/pixman/test/lowlevel-blt-bench.c
@@ -385,6 +385,7 @@ bench_composite (char * testname,
double t1, t2, t3, pix_cnt;
int64_t n, l1test_width, nlines;
double bytes_per_pix = 0;
+ pixman_bool_t bench_pixbuf = FALSE;
pixman_composite_func_t func = pixman_image_composite_wrapper;
@@ -422,16 +423,20 @@ bench_composite (char * testname,
mask_img = NULL;
xmask_img = NULL;
+ if (strcmp (testname, "pixbuf") == 0 || strcmp (testname, "rpixbuf") == 0)
+ {
+ bench_pixbuf = TRUE;
+ }
if (!(mask_flags & SOLID_FLAG) && mask_fmt != PIXMAN_null)
{
bytes_per_pix += (mask_fmt >> 24) / ((op == PIXMAN_OP_SRC) ? 8.0 : 4.0);
mask_img = pixman_image_create_bits (mask_fmt,
WIDTH, HEIGHT,
- mask,
+ bench_pixbuf ? src : mask,
WIDTH * 4);
xmask_img = pixman_image_create_bits (mask_fmt,
XWIDTH, XHEIGHT,
- mask,
+ bench_pixbuf ? src : mask,
XWIDTH * 4);
}
else if (mask_fmt != PIXMAN_null)
@@ -643,6 +648,8 @@ tests_tbl[] =
{ "src_0888_0565", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 },
{ "src_0888_8888", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
{ "src_0888_x888", PIXMAN_r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 },
+ { "src_0888_8888_rev", PIXMAN_b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 },
+ { "src_0888_0565_rev", PIXMAN_b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 },
{ "src_x888_x888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x8r8g8b8 },
{ "src_x888_8888", PIXMAN_x8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
{ "src_8888_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
@@ -707,6 +714,8 @@ tests_tbl[] =
{ "outrev_n_8888_x888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_x8r8g8b8 },
{ "outrev_n_8888_8888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_a8r8g8b8 },
{ "over_reverse_n_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER_REVERSE, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
+ { "pixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8r8g8b8 },
+ { "rpixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8b8g8r8 },
};
int
diff --git a/pixman/test/prng-test.c b/pixman/test/prng-test.c
index 0a3ad5e8f..c1d9320cc 100644
--- a/pixman/test/prng-test.c
+++ b/pixman/test/prng-test.c
@@ -106,7 +106,10 @@ int main (int argc, char *argv[])
{
const uint32_t ref_crc[RANDMEMSET_MORE_00_AND_FF + 1] =
{
- 0xBA06763D, 0x103FC550, 0x8B59ABA5, 0xD82A0F39
+ 0xBA06763D, 0x103FC550, 0x8B59ABA5, 0xD82A0F39,
+ 0xD2321099, 0xFD8C5420, 0xD3B7C42A, 0xFC098093,
+ 0x85E01DE0, 0x6680F8F7, 0x4D32DD3C, 0xAE52382B,
+ 0x149E6CB5, 0x8B336987, 0x15DCB2B3, 0x8A71B781
};
uint32_t crc1, crc2;
uint32_t ref, seed, seed0, seed1, seed2, seed3;
diff --git a/pixman/test/utils-prng.c b/pixman/test/utils-prng.c
index 967b8989a..7b32e3531 100644
--- a/pixman/test/utils-prng.c
+++ b/pixman/test/utils-prng.c
@@ -107,6 +107,7 @@ randmemset_internal (prng_t *prng,
{
prng_t local_prng = *prng;
prng_rand_128_data_t randdata;
+ size_t i;
while (size >= 16)
{
@@ -138,6 +139,22 @@ randmemset_internal (prng_t *prng,
};
randdata.vb &= (t.vb >= const_40);
}
+ if (flags & RANDMEMSET_MORE_FFFFFFFF)
+ {
+ const uint32x4 const_C0000000 =
+ {
+ 0xC0000000, 0xC0000000, 0xC0000000, 0xC0000000
+ };
+ randdata.vw |= ((t.vw << 30) >= const_C0000000);
+ }
+ if (flags & RANDMEMSET_MORE_00000000)
+ {
+ const uint32x4 const_40000000 =
+ {
+ 0x40000000, 0x40000000, 0x40000000, 0x40000000
+ };
+ randdata.vw &= ((t.vw << 30) >= const_40000000);
+ }
#else
#define PROCESS_ONE_LANE(i) \
if (flags & RANDMEMSET_MORE_FF) \
@@ -155,6 +172,18 @@ randmemset_internal (prng_t *prng,
mask_00 |= mask_00 >> 2; \
mask_00 |= mask_00 >> 4; \
randdata.w[i] &= mask_00; \
+ } \
+ if (flags & RANDMEMSET_MORE_FFFFFFFF) \
+ { \
+ int32_t mask_ff = ((t.w[i] << 30) & (t.w[i] << 31)) & \
+ 0x80000000; \
+ randdata.w[i] |= mask_ff >> 31; \
+ } \
+ if (flags & RANDMEMSET_MORE_00000000) \
+ { \
+ int32_t mask_00 = ((t.w[i] << 30) | (t.w[i] << 31)) & \
+ 0x80000000; \
+ randdata.w[i] &= mask_00 >> 31; \
}
PROCESS_ONE_LANE (0)
@@ -198,7 +227,8 @@ randmemset_internal (prng_t *prng,
}
size -= 16;
}
- while (size > 0)
+ i = 0;
+ while (i < size)
{
uint8_t randbyte = prng_rand_r (&local_prng) & 0xFF;
if (flags != 0)
@@ -208,9 +238,25 @@ randmemset_internal (prng_t *prng,
randbyte = 0xFF;
if ((flags & RANDMEMSET_MORE_00) && (t < 0x40))
randbyte = 0x00;
+ if (i % 4 == 0 && i + 4 <= size)
+ {
+ t = prng_rand_r (&local_prng) & 0xFF;
+ if ((flags & RANDMEMSET_MORE_FFFFFFFF) && (t >= 0xC0))
+ {
+ memset(&buf[i], 0xFF, 4);
+ i += 4;
+ continue;
+ }
+ if ((flags & RANDMEMSET_MORE_00000000) && (t < 0x40))
+ {
+ memset(&buf[i], 0x00, 4);
+ i += 4;
+ continue;
+ }
+ }
}
- *buf++ = randbyte;
- size--;
+ buf[i] = randbyte;
+ i++;
}
*prng = local_prng;
}
@@ -218,8 +264,10 @@ randmemset_internal (prng_t *prng,
/*
* Fill memory buffer with random data. Flags argument may be used
* to tweak some statistics properties:
- * RANDMEMSET_MORE_00 - set ~25% of bytes to 0x00
- * RANDMEMSET_MORE_FF - set ~25% of bytes to 0xFF
+ * RANDMEMSET_MORE_00 - set ~25% of bytes to 0x00
+ * RANDMEMSET_MORE_FF - set ~25% of bytes to 0xFF
+ * RANDMEMSET_MORE_00000000 - ~25% chance for 00000000 4-byte clusters
+ * RANDMEMSET_MORE_FFFFFFFF - ~25% chance for FFFFFFFF 4-byte clusters
*/
void prng_randmemset_r (prng_t *prng,
void *voidbuf,
diff --git a/pixman/test/utils-prng.h b/pixman/test/utils-prng.h
index 285107f08..564ffcef1 100644
--- a/pixman/test/utils-prng.h
+++ b/pixman/test/utils-prng.h
@@ -153,7 +153,10 @@ typedef enum
{
RANDMEMSET_MORE_00 = 1, /* ~25% chance for 0x00 bytes */
RANDMEMSET_MORE_FF = 2, /* ~25% chance for 0xFF bytes */
- RANDMEMSET_MORE_00_AND_FF = (RANDMEMSET_MORE_00 | RANDMEMSET_MORE_FF)
+ RANDMEMSET_MORE_00000000 = 4, /* ~25% chance for 0x00000000 clusters */
+ RANDMEMSET_MORE_FFFFFFFF = 8, /* ~25% chance for 0xFFFFFFFF clusters */
+ RANDMEMSET_MORE_00_AND_FF = (RANDMEMSET_MORE_00 | RANDMEMSET_MORE_00000000 |
+ RANDMEMSET_MORE_FF | RANDMEMSET_MORE_FFFFFFFF)
} prng_randmemset_flags_t;
/* Set the 32-bit seed for PRNG */