[Pixman] [PATCH 0/3] Test negative strides

Søren Sandmann sandmann at cs.au.dk
Fri Sep 27 15:42:12 PDT 2013


Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:

>> Somehow I missed the "case 16:" case. New patch below; also available in
>> the negative-strides branch of my repository on fd.o.
>
> Thanks, this works. I have just independently found the same problem,
> but was running some additional tests.

Thanks for testing; I'll push the patch soon.

> By the way, print_image() does not behave in the same way on big and
> little endian systems, which makes debugging a little bit more
> difficult.

On blitters-test, print_image() ends up being called before
endian-swapping, so it will produce different output on big vs little
endian. But in the other tests, it looks like the call is after the
swapping.

If the problem is just blitters-test, then it's easy enough to fix; the
patch below should do it. I guess it might even make sense to add a
"verbose" argument to compute_crc32_for_image() and move the print code
there so that the order isn't accidentally reversed in new code.


Søren


>From 096406c3a1e62486f48dadd303c252be081e07d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= <ssp at redhat.com>
Date: Fri, 27 Sep 2013 18:29:12 -0400
Subject: [PATCH] blitters-test: if verbose, print the image after CRC32 computation

The CRC32 computation will endian swap the image before computing the
check sum so that the same bytes will be checked on both big and
little endian.

When verbose, printing of the image would previously happen before the
endian swap which led to different output on big vs. little endian.

This patch moves the call to compute_crc32_for_image() out of
free_random_image() and places it before the call to print_image() so
that the output will now be independent of endianness.
---
 test/blitters-test.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/test/blitters-test.c b/test/blitters-test.c
index af94835..0f1a5ee 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -85,24 +85,18 @@ create_random_image (pixman_format_code_t *allowed_formats,
 }
 
 /* Free random image, and optionally update crc32 based on its data */
-static uint32_t
+static void
 free_random_image (uint32_t initcrc,
 		   pixman_image_t *img,
 		   pixman_format_code_t fmt)
 {
-    uint32_t crc32 = 0;
     uint32_t *data = pixman_image_get_data (img);
 
-    if (fmt != PIXMAN_null)
-	crc32 = compute_crc32_for_image (initcrc, img);
-
     if (img->bits.rowstride < 0)
 	data += img->bits.rowstride * (img->bits.height - 1);
 
     pixman_image_unref (img);
     free (data);
-
-    return crc32;
 }
 
 static pixman_op_t op_list[] = {
@@ -363,11 +357,13 @@ test_composite (int testnum, int verbose)
     pixman_image_composite (op, src_img, mask_img, dst_img,
 			    src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h);
 
+    crc32 = compute_crc32_for_image (0, dst_img);
+    
     if (verbose)
 	print_image (dst_img);
 
     free_random_image (0, src_img, PIXMAN_null);
-    crc32 = free_random_image (0, dst_img, dst_fmt);
+    free_random_image (0, dst_img, dst_fmt);
 
     if (mask_img)
     {
-- 
1.7.1



More information about the Pixman mailing list