Commit Graph

185 Commits

Author SHA1 Message Date
Søren Sandmann
4d4d1760e8 test: Make fuzzer-find-diff.pl executable 2011-06-25 10:17:50 -04:00
Søren Sandmann Pedersen
5715a394c4 blitters-test: Make common formats more likely to be tested.
Move the eight most common formats to the top of the list of image
formats and make create_random_image() much more likely to select one
of those eight formats.

This should help catch more bugs in SIMD optimized operations.
2011-06-25 10:17:05 -04:00
Søren Sandmann Pedersen
a89f8cfaf1 Replace argumentxs to composite functions with a pointer to a struct
This allows more information, such as flags or the composite region,
to be passed to the composite functions.
2011-06-20 02:03:23 -04:00
Andrea Canciani
0f6a4d4588 test: Fix compilation on win32
MSVC complains about uint32_t being used as an expression:

composite.c(902) : error C2275: 'uint32_t' : illegal use of this type
as an expression
2011-05-17 00:29:55 +02:00
Dave Yeo
838c2b593e Check for working mmap()
OS/2 doesn't have a working mmap().
2011-05-09 12:38:44 +02:00
Søren Sandmann Pedersen
b455496890 Offset rendering in pixman_composite_trapezoids() by (x_dst, y_dst)
Previously, this function would do coordinate calculations in such a
way that (x_dst, y_dst) would only affect the alignment of the source
image, but not of the traps, which would always be considered to be in
absolute destination coordinates. This is unlike the
pixman_image_composite() function which also registers the mask to the
destination.

This patch makes it so that traps are also offset by (x_dst, y_dst).

Also add a comment explaining how this function is supposed to
operate, and update tri-test.c and composite-trap-test.c to deal with
the new semantics.
2011-04-18 16:27:29 -04:00
Søren Sandmann Pedersen
ad3cbfb073 test: Fix infinite loop in composite
When run in PIXMAN_RANDOMIZE_TESTS mode, this test would go into an
infinite loop because the loop started at 'seed' but the stop
condition was still N_TESTS.
2011-03-22 13:43:29 -04:00
Alexandros Frantzis
b514e63cfc Add support for the r8g8b8a8 and r8g8b8x8 formats to the tests. 2011-03-22 13:43:29 -04:00
Søren Sandmann Pedersen
7eb0abb5e8 test: Randomize some tests if PIXMAN_RANDOMIZE_TESTS is set
This patch makes so that composite and stress-test will start from a
random seed if the PIXMAN_RANDOMIZE_TESTS environment variable is
set. Running the test suite in this mode is useful to get more test
coverage.

Also, in stress-test.c make it so that setting the initial seed causes
threads to be turned off. This makes it much easier to see when
something fails.
2011-03-19 08:51:35 -04:00
Søren Sandmann Pedersen
84e361c8e3 test: Do endian swapping of the source and destination images.
Otherwise the test fails on big endian. Fix for bug 34767, reported by
Siarhei Siamashka.
2011-03-07 14:08:00 -05:00
Søren Sandmann Pedersen
84f3c5a71a test: In image_endian_swap() use pixman_image_get_format() to get the bpp.
There is no reason to pass in the bpp as an argument; it can be gotten
directly from the image.
2011-03-07 14:07:44 -05:00
Siarhei Siamashka
0df43b8ae5 test: check correctness of 'bilinear_pad_repeat_get_scanline_bounds'
Individual correctness check for the new bilinear scaling related
supplementary function. This test program uses a bit wider range
of input arguments, not covered by other tests.
2011-02-28 15:29:23 +02:00
Andrea Canciani
9ebde285fa test: Silence MSVC warnings
MSVC does not notice non-returning functions (abort() / assert(0))
and warns about paths which end with them in non-void functions:

c:\cygwin\home\ranma42\code\fdo\pixman\test\fetch-test.c(114) :
warning C4715: 'reader' : not all control paths return a value
c:\cygwin\home\ranma42\code\fdo\pixman\test\stress-test.c(133) :
warning C4715: 'real_reader' : not all control paths return a value
c:\cygwin\home\ranma42\code\fdo\pixman\test\composite.c(431) :
warning C4715: 'calc_op' : not all control paths return a value

These warnings can be silenced by adding a return after the
termination call.
2011-02-28 10:38:02 +01:00
Andrea Canciani
72f5e5f608 test: Add Makefile for Win32 2011-02-28 10:38:02 +01:00
Andrea Canciani
11305b4ecd test: Fix tests for compilation on Windows
The Microsoft C compiler cannot handle subobject initialization and
Win32 does not provide snprintf.

Work around these limitations by using normal struct initialization
and using sprintf (a manual check shows that the buffer size is
sufficient).
2011-02-28 10:38:02 +01:00
Søren Sandmann Pedersen
4e6dd4928d Add a test program for pixman_composite_trapezoids().
A CRC32 based test program to check that pixman_composite_trapezoids()
actually works.
2011-02-15 09:25:18 -05:00
Søren Sandmann Pedersen
1feaf6bea7 test/Makefile.am: Move all the TEST_LDADD into a new global LDADD.
This gets rid of a bunch of replicated *_LDADD clauses
2011-02-15 09:25:17 -05:00
Søren Sandmann Pedersen
1237fd9bc8 Add @TESTPROGS_EXTRA_LDFLAGS@ to AM_LDFLAGS
Instead of explicitly adding it to each test program.
2011-02-15 09:25:17 -05:00
Søren Sandmann Pedersen
7dfe845786 Move all the GTK+ based test programs to a new subdir, "demos"
This separates the test suite from the random gtk+ using test
programs. "demos" is somewhat misleading because the programs there
are not particularly exciting (with the possible exception of
composite-test which shows off all the compositing operators).
2011-02-15 09:25:17 -05:00
Siarhei Siamashka
e83cee5aac test: Extend scaling-test to support a8/solid mask and ADD operation
Image width also has been increased because SIMD optimizations typically
do more unrolling in the inner loops, and this needs to be tested.
2011-02-15 14:32:01 +02:00
Siarhei Siamashka
3b68c295fd test: affine-test updated to stress 90/180/270 degrees rotation more 2011-02-10 16:17:18 +02:00
Søren Sandmann Pedersen
13aed37758 Add a test for over_x888_8_0565 in lowlevel_blt_bench().
The next few commits will speed this up quite a bit.

Current output:

---
reference memcpy speed = 2217.5MB/s (554.4MP/s for 32bpp fills)
---
over_x888_8_0565 =  L1:  54.67  L2:  54.01  M: 52.33 ( 18.88%)  HT: 37.19  VT: 35.54  R: 29.40  RT: 13.63 ( 162Kops/s)
2011-01-28 14:35:17 -05:00
Rolland Dudemaine
32e556df33 test: Use the right enum types instead of int to fix warnings
Green Hills Software MULTI compiler was producing a number
of warnings due to incorrect uses of int instead of the correct
corresponding pixman_*_t type.
2011-01-26 15:05:18 +02:00
Rolland Dudemaine
e8a1b1c4e5 test: Fix for mismatched 'fence_malloc' prototype/implementation
Solves compilation problem when 'mprotect' is not available. For
example, when using Green Hills Software MULTI compiler or mingw:
http://lists.freedesktop.org/archives/pixman/2011-January/000939.html
2011-01-25 14:34:56 +02:00
Andrea Canciani
2ac4ae1ae2 Add a test for radial gradients
radial-test is a port of the radial-gradient test from the cairo test
suite. It has been modified so that some pixels have 0 in both the a
and b coefficients of the quadratic equation solved by the rasterizer,
to expose a division by zero in the original implementation.
2011-01-19 13:17:03 +01:00
Søren Sandmann Pedersen
9489c2e04a Turn on testing for destination transformation 2011-01-18 12:42:26 -05:00
Siarhei Siamashka
2bbd553bd2 A new configure option --enable-static-testprogs
This option can be used for building fully static binaries of the test
programs so that they can be easily run using qemu-user. With binfmt-misc
configured, 'make check' works fine for crosscompiled pixman builds.
2011-01-16 23:40:34 +02:00
Søren Sandmann Pedersen
3479050216 Add a test compositing with the various PDF operators.
The test has floating point exceptions enabled, and currently fails
with a divide-by-zero.
2010-12-20 19:37:11 -05:00
Cyril Brulebois
45a2d01077 Fix linking issues when HAVE_FEENABLEEXCEPT is set.
All objects using test/util.c fail to link:
|   CCLD   region-test
| /usr/bin/ld: utils.o: in function enable_fp_exceptions:utils.c(.text+0x939): error: undefined reference to 'feenableexcept'

There's indeed no explicit dependency on -lm, and if HAVE_FEENABLEEXCEPT
happens to be set, test/util.c uses feenableexcept(), which is nowhere
to be found while linking.

Fix this by adding -lm to TEST_LDADD, although two alternatives could be
thought of:
 - Only specifying -lm for objects using util.c.
 - Introducing a conditional to add -lm only when configure detects
   have_feenableexcept=yes.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
2010-12-20 09:55:07 -05:00
Jon TURNEY
303de045ff Remove stray #include <fenv.h>
Remove a stray #include <fenv.h> added in commit 2444b2265a
to fix compilation on platforms which don't have fenv.h

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2010-12-18 16:29:12 -05:00
Søren Sandmann Pedersen
f914cf4486 Add a stress-test program.
This test program tries to use as many rarely-used features as
possible, including alpha maps, accessor functions, oddly-sized
images, strange transformations, conical gradients, etc.

The hope is to provoke crashes or irregular behavior in pixman.
2010-12-17 17:03:29 -05:00
Søren Sandmann Pedersen
7d7b03c091 Make the argument to fence_malloc() an int64_t
That way we can detect if someone attempts to allocate a negative size
and abort instead of just returning NULL and segfaulting later.
2010-12-17 17:01:52 -05:00
Søren Sandmann Pedersen
d41522113e test/utils.c: Initialize palette->rgba to 0.
That way it can be used with palettes that are not statically
allocated, without causing valgrind issues.
2010-12-17 16:57:53 -05:00
Søren Sandmann Pedersen
337f0bff0d test: Move palette initialization to utils.[ch] 2010-12-17 16:57:53 -05:00
Søren Sandmann Pedersen
2444b2265a Extend gradient-crash-test
Test the gradients with various transformations, and test cases where
the gradients are specified with two identical points.
2010-12-17 16:57:38 -05:00
Søren Sandmann Pedersen
de2e51dacb Add enable_fp_exceptions() function in utils.[ch]
This function enables floating point traps if possible.
2010-12-17 16:57:18 -05:00
Søren Sandmann Pedersen
a2afcc9ba4 test: Make composite test use some existing macros instead of defining its own
Also move the ARRAY_LENGTH macro into utils.h so it can be used elsewhere.
2010-12-17 16:57:18 -05:00
Søren Sandmann Pedersen
9c19a85b00 Remove workaround for a bug in the 1.6 X server.
There used to be a bug in the X server where it would rely on
out-of-bounds accesses when it was asked to composite with a
window as the source. It would create a pixman image pointing
to some bogus position in memory, but then set a clip region
to the position where the actual bits were.

Due to a bug in old versions of pixman, where it would not clip
against the image bounds when a clip region was set, this would
actually work. So when the pixman bug was fixed, a workaround was
added to allow certain out-of-bound accesses.

However, the 1.6 X server is so old now that we can remove this
workaround. This does mean that if you update pixman to 0.22 or later,
you will need to use a 1.7 X server or later.
2010-11-04 21:03:38 -04:00
Jon TURNEY
00fdb3d8e8 Plug another leak in alphamap test
Even after commit e46be417ce alphamap
test is still leaking the alphamap pixmap, leading to mmap() failures
on cygwin

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2010-10-24 15:38:14 -04:00
Søren Sandmann Pedersen
e46be417ce Plug leak in the alphamap test.
The images are being created with non-NULL data, so we have to free it
outselves. This is important because the Cygwin tinderbox is running
out of memory and produces this:

    mmap failed on 20000 1507328
    mmap failed on 40000 1507328
    mmap failed on 20000 1507328
    mmap failed on 40000 1507328
    mmap failed on 40000 1507328
    mmap failed on 40000 1507328

http://tinderbox.x.org/builds/2010-10-05-0014/logs/pixman/#check
2010-10-11 12:06:20 -04:00
Søren Sandmann Pedersen
233b27257b test: Add some more colors to the color table in composite.c
Specifically, add transparent black and superluminescent white with
alpha = 0.
2010-10-11 12:06:20 -04:00
Søren Sandmann Pedersen
3f7da59352 test: Parallize composite.c with OpenMP
Each test uses the test number as the random number seed; if it
didn't, all the threads would run the same tests since they would all
start from the same seed.
2010-10-11 12:06:20 -04:00
Søren Sandmann Pedersen
a10ccc9f30 test: Change composite so that it tests randomly generated images
Previously this test would try to exhaustively test all combinations
of formats and operators, which meant that it would take hours to run.
Instead, generate images randomly and test compositing those.

Cc: chris@chris-wilson.co.uk
2010-10-11 12:06:20 -04:00
Søren Sandmann Pedersen
55e4065cbb test: Fix eval_diff() so that it provides useful error values.
Previously, this function would evaluate the error under the
assumption that the format was 565 or wider. This patch changes it to
take the actual format into account.

With that fixed, we can turn on testing for the rest of the formats.

Cc: chris@chris-wilson.co.uk
2010-10-11 12:06:20 -04:00
Søren Sandmann Pedersen
fe411cf2ac test: Fix bug in color_correct() in composite.c
This function was using the number of bits in a channel as if it were
a mask, which lead to many spurious errors. With that fixed, we can
turn on testing for all formats where all channels have 5 or more
bits.

Cc: chris@chris-wilson.co.uk
2010-10-11 12:06:20 -04:00
Søren Sandmann Pedersen
4e89a5b7f3 Remove broken optimizations in combine_disjoint_over_u()
The first broken optimization is that it checks "a != 0x00" where it
should check "s != 0x00". The other is that it skips the computation
when alpha is 0xff. That is wrong because in the formula:

     min (1, (1 - Aa)/Ab)

the render specification states that if Ab is 0, the quotient is
defined to positive infinity. That is the case even if (1 - Aa) is 0.
2010-10-11 12:06:20 -04:00
Dmitri Vorobiev
10e13135c3 Some clean-ups in fence_malloc() and fence_free()
This patch removes an unnecessary typecast of MAP_FAILED,
replaces an erroneous free() by the correct munmap() in the
error path for a failing mprotect(), and, finally, removes
redundant calls to mprotect() that aren't necessary, because
munmap() doesn't call for any specific memory protection.
2010-09-29 02:15:12 -04:00
Søren Sandmann Pedersen
ba693d2e88 Fix search-and-replace issue in lowlevel-blt-bench.c 2010-09-28 02:52:17 -04:00
Søren Sandmann Pedersen
77d3e5f6ff Rename all the fast paths with _8000 in their names to _8
This inconsistent naming somehow survived the refactoring from a while
back.
2010-09-28 00:07:47 -04:00
Dmitri Vorobiev
56777f3f67 Use <sys/mman.h> macros only when they are available
Not all systems are regular Unices, so let's be careful with the
mmap()-related stuff, which might be unavailable. This patch makes
sure that mmap() and friends is used only when the <sys/mman.h>
header is found.
2010-09-23 16:02:29 -04:00