aboutsummaryrefslogtreecommitdiff
path: root/pixman/test
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-31 08:07:51 +0100
committermarha <marha@users.sourceforge.net>2013-01-31 08:07:51 +0100
commit436f8246cd5a377596f6e42e6562da186ef8df48 (patch)
treea00e72591f276cac16bc0fd65bc263ba89c93c00 /pixman/test
parent69c8cec54b01ed522bf10baf20da70304bac701a (diff)
downloadvcxsrv-436f8246cd5a377596f6e42e6562da186ef8df48.tar.gz
vcxsrv-436f8246cd5a377596f6e42e6562da186ef8df48.tar.bz2
vcxsrv-436f8246cd5a377596f6e42e6562da186ef8df48.zip
libxtrans mesa pixman xkeyboard-config git update 31 jan 2013
libxtrans: bd53f4c8543faf910a7a151241ee07661b4d57ad mesa: a527b2192e3cb4a68af927ab405e38181d2fcf75 pixman: 958bd334b3c17f529c80f2eeef4224f45c62f292 xkeyboard-config: 46cfd7a3b5c6b6e00648407bd4c0dd56ae86d65a
Diffstat (limited to 'pixman/test')
-rw-r--r--pixman/test/lowlevel-blt-bench.c31
-rw-r--r--pixman/test/stress-test.c123
2 files changed, 93 insertions, 61 deletions
diff --git a/pixman/test/lowlevel-blt-bench.c b/pixman/test/lowlevel-blt-bench.c
index 7336fa0d5..8e80b4280 100644
--- a/pixman/test/lowlevel-blt-bench.c
+++ b/pixman/test/lowlevel-blt-bench.c
@@ -33,6 +33,14 @@
#define L1CACHE_SIZE (8 * 1024)
#define L2CACHE_SIZE (128 * 1024)
+/* This is applied to both L1 and L2 tests - alternatively, you could
+ * parameterise bench_L or split it into two functions. It could be
+ * read at runtime on some architectures, but it only really matters
+ * that it's a number that's an integer divisor of both cacheline
+ * lengths, and further, it only really matters for caches that don't
+ * do allocate0on-write. */
+#define CACHELINE_LENGTH (32) /* bytes */
+
#define WIDTH 1920
#define HEIGHT 1080
#define BUFSIZE (WIDTH * HEIGHT * 4)
@@ -168,18 +176,29 @@ bench_L (pixman_op_t op,
int width,
int lines_count)
{
- int64_t i, j;
+ int64_t i, j, k;
int x = 0;
int q = 0;
volatile int qx;
for (i = 0; i < n; i++)
{
- /* touch destination buffer to fetch it into L1 cache */
- for (j = 0; j < width + 64; j += 16) {
- q += dst[j];
- q += src[j];
- }
+ /* For caches without allocate-on-write, we need to force the
+ * destination buffer back into the cache on each iteration,
+ * otherwise if they are evicted during the test, they remain
+ * uncached. This doesn't matter for tests which read the
+ * destination buffer, or for caches that do allocate-on-write,
+ * but in those cases this loop just adds constant time, which
+ * should be successfully cancelled out.
+ */
+ for (j = 0; j < lines_count; j++)
+ {
+ for (k = 0; k < width + 62; k += CACHELINE_LENGTH / sizeof *dst)
+ {
+ q += dst[j * WIDTH + k];
+ }
+ q += dst[j * WIDTH + width + 62];
+ }
if (++x >= 64)
x = 0;
call_func (func, op, src_img, mask_img, dst_img, x, 0, x, 0, 63 - x, 0, width, lines_count);
diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c
index 9d949afad..1f03c7543 100644
--- a/pixman/test/stress-test.c
+++ b/pixman/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);
}