test: larger 0xFF/0x00 filled clusters in random images for blitters-test
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>
Mon, 4 Mar 2013 22:59:13 +0000 (00:59 +0200)
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>
Sun, 28 Apr 2013 19:14:47 +0000 (22:14 +0300)
commit59109f32930a0c163628f8087cbb0a15b19cb96b
tree68f958ecda2e709a5787c3503f37e49945eb8ce4
parenta99147d1ea0d67f635f9284c242485fb5621cab3
test: larger 0xFF/0x00 filled clusters in random images for blitters-test

Current blitters-test program had difficulties detecting a bug in
over_n_8888_8888_ca implementation for MIPS DSPr2:

    http://lists.freedesktop.org/archives/pixman/2013-March/002645.html

In order to hit the buggy code path, two consecutive mask values had
to be equal to 0xFFFFFFFF because of loop unrolling. The current
blitters-test generates random images in such a way that each byte
has 25% probability for having 0xFF value. Hence each 32-bit mask
value has ~0.4% probability for 0xFFFFFFFF. Because we are testing
many compositing operations with many pixels, encountering at least
one 0xFFFFFFFF mask value reasonably fast is not a problem. If a
bug related to 0xFFFFFFFF mask value is artificialy introduced into
over_n_8888_8888_ca generic C function, it gets detected on 675591
iteration in blitters-test (out of 2000000).

However two consecutive 0xFFFFFFFF mask values are much less likely
to be generated, so the bug was missed by blitters-test.

This patch addresses the problem by also randomly setting the 32-bit
values in images to either 0xFFFFFFFF or 0x00000000 (also with 25%
probability). It allows to have larger clusters of consecutive 0x00
or 0xFF bytes in images which may have special shortcuts for handling
them in unrolled or SIMD optimized code.
test/blitters-test.c
test/prng-test.c
test/utils-prng.c
test/utils-prng.h