aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/scaling-bench.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-09-18 08:03:04 +0200
committermarha <marha@users.sourceforge.net>2013-09-18 08:03:04 +0200
commit7f669a708bd35bdf8e842f762ec68f9ad0ec0486 (patch)
tree332fc6d6e6f70503d717249e4e387bf3eea29637 /pixman/test/scaling-bench.c
parenta7d3f63ee5e292379ed6d6eba0c65512205a4786 (diff)
downloadvcxsrv-7f669a708bd35bdf8e842f762ec68f9ad0ec0486.tar.gz
vcxsrv-7f669a708bd35bdf8e842f762ec68f9ad0ec0486.tar.bz2
vcxsrv-7f669a708bd35bdf8e842f762ec68f9ad0ec0486.zip
libX11 mesa pixman xserver git update 18 Sep 2013
xserver commit 8010d3a48bd0b224dcb0883e39c2351ad364d846 libX11 commit 5dcb40f28d59587597d2ff6e6ac64c71cfe6ff7b pixman commit 58a79dfe6d1fd62c2b66c69fdb64f6b8ecf61da5 mesa commit a3b51a22f71819236baa6bbda9d0d050914b149d
Diffstat (limited to 'pixman/test/scaling-bench.c')
-rw-r--r--pixman/test/scaling-bench.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/pixman/test/scaling-bench.c b/pixman/test/scaling-bench.c
index b39adeff5..365e79850 100644
--- a/pixman/test/scaling-bench.c
+++ b/pixman/test/scaling-bench.c
@@ -3,6 +3,7 @@
#define SOURCE_WIDTH 320
#define SOURCE_HEIGHT 240
+#define TEST_REPEATS 3
static pixman_image_t *
make_source (void)
@@ -39,30 +40,40 @@ main ()
"time per pixel / ns");
for (scale = 0.1; scale < 10.005; scale += 0.01)
{
+ int i;
int dest_width = SOURCE_WIDTH * scale + 0.5;
int dest_height = SOURCE_HEIGHT * scale + 0.5;
+ int dest_byte_stride = (dest_width * 4 + 15) & ~15;
pixman_fixed_t s = (1 / scale) * 65536.0 + 0.5;
pixman_transform_t transform;
pixman_image_t *dest;
- double t1, t2;
+ double t1, t2, t = -1;
+ uint32_t *dest_buf = aligned_malloc (16, dest_byte_stride * dest_height);
+ memset (dest_buf, 0, dest_byte_stride * dest_height);
pixman_transform_init_scale (&transform, s, s);
pixman_image_set_transform (src, &transform);
dest = pixman_image_create_bits (
- PIXMAN_a8r8g8b8, dest_width, dest_height, NULL, -1);
+ PIXMAN_a8r8g8b8, dest_width, dest_height, dest_buf, dest_byte_stride);
+
+ for (i = 0; i < TEST_REPEATS; i++)
+ {
+ t1 = gettime();
+ pixman_image_composite (
+ PIXMAN_OP_OVER, src, NULL, dest,
+ scale, scale, 0, 0, 0, 0, dest_width, dest_height);
+ t2 = gettime();
+ if (t < 0 || t2 - t1 < t)
+ t = t2 - t1;
+ }
- t1 = gettime();
- pixman_image_composite (
- PIXMAN_OP_OVER, src, NULL, dest,
- scale, scale, 0, 0, 0, 0, dest_width, dest_height);
- t2 = gettime();
-
printf ("%6.2f : %4dx%-4d => %4dx%-4d : %12.4f : %12.4f\n",
scale, SOURCE_WIDTH, SOURCE_HEIGHT, dest_width, dest_height,
- (t2 - t1) * 1000, ((t2 - t1) / (dest_width * dest_height)) * 1000000000);
+ t * 1000, (t / (dest_width * dest_height)) * 1000000000);
pixman_image_unref (dest);
+ free (dest_buf);
}
return 0;