Commit Graph

147 Commits

Author SHA1 Message Date
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
Søren Sandmann Pedersen
e97da21049 If MAP_ANONYMOUS is not defined, define it to MAP_ANON.
This hopefully fixes the build failure on OS X.
2010-09-21 14:12:00 -04:00
Jonathan Morton
7cd4f2fa20 Add a lowlevel blitter benchmark
This test is a modified version of Siarhei's compositor throughput
benchmark.  It's expanded with explicit reporting of memory bandwidth
consumption for the M-test, and with an additional 8x8-random test
intended to determine peak ops/sec capability.  There are also quite a
lot more operations tested for.
2010-09-21 08:50:18 -04:00
Dmitri Vorobiev
cab3261c0d Add gettime() routine to test utils
Impending benchmark code will need a function to get current time
in seconds, and this patch introduces such routine. We try to use
the POSIX gettimeofday() function when available, and fall back to
clock() when not.
2010-09-21 08:50:17 -04:00
Dmitri Vorobiev
fd3c87d460 Move aligned_malloc() to utils
The aligned_malloc() routine will be used in more than one test utility.
At least, a low-level blitter benchmark needs it. Therefore, let's make
this function a part of common test utilities code.
2010-09-21 08:50:17 -04:00
Søren Sandmann Pedersen
f9778c15e9 Use a macro to generate some {a,x}8r8g8b8, a8, and r5g6b5 bilinear fetchers.
There are versions for all combinations of x8r8g8b8/a8r8g8b8 and
pad/repeat/none/normal repeat modes. The bulk of each scaler is an
inline function that takes a format and a repeat mode as parameters.

The new scalers are all commented out, but the next commits will
enable them one at a time to facilitate bisecting.
2010-09-21 08:50:16 -04:00
Søren Sandmann Pedersen
6d1e10a8b5 test: Add affine-test
This test tests compositing with various affine transformations. It is
almost identical to scaling-test, except that it also applies a random
rotation in addition to the random scaling and translation.
2010-09-21 08:31:09 -04:00
Søren Sandmann Pedersen
ae77548f0d Update and extend the alphamap test
- Test many more combinations of formats

- Test destination alpha maps

- Test various different alpha origins

Also add a transformation to the destination, but comment it out
because it is actually broken at the moment (and pretty difficult to
fix).
2010-09-21 08:28:55 -04:00
Søren Sandmann Pedersen
dc9fe269ea Add fence_malloc() and fence_free().
These variants of malloc() and free() try to surround the allocated
memory with protected pages so that out-of-bounds accessess will cause
a segmentation fault.

If mprotect() and getpagesize() are not available, these functions are
simply equivalent to malloc() and free().
2010-09-21 08:28:55 -04:00
Siarhei Siamashka
ba6c98fc4b test: detection of possible floating point registers corruption
Added a pair of macros which can help to detect corruption
of floating point registers after a function call. This may
happen if _mm_empty() call is forgotten in MMX/SSE2 fast
path code, or ARM NEON assembly optimized function
forgets to save/restore d8-d15 registers before use.
2010-09-13 18:12:31 +03:00
Søren Sandmann Pedersen
e29d9dfcb5 Silence some warnings about uninitialized variables
Neither were real problems, but GCC was complaining about them.
2010-09-08 19:16:21 -04:00
Benjamin Otte
4d8fb1bc01 region: Add a new test region-translate
This test exercises a bug in pixman_region32_translate(). The function
clips the region to int16 coordinates SHRT_MIN/SHRT_MAX.
2010-08-24 12:17:18 +02:00
Søren Sandmann Pedersen
9fe7d32c4b Add alpha-loop test program
This tests what happens if you attempt to make an image with an alpha
map that has the image as its alpha map. This results in an infinite
loop in _pixman_image_validate(), so the test sets up a SIGALRM to
exit if it runs for more than five seconds.
2010-08-15 21:57:18 -04:00
Søren Sandmann Pedersen
5b289d39cf Extend scaling-crash-test in various ways
This extends scaling-crash-test to test some more things:

- All combinations of NEAREST/BILINEAR/CONVOLUTION filters and
  NORMAL/PAD/REFLECT repeat modes.

- Tests various scale factors very close to 1/7th such that the source
  area is very close to edge of the source image.

- The same things, only with scale factors very close to 1/32767th.

- Enables the commented-out tests for accessing memory outside the
  source buffer.

Also there is now a border around the source buffer which has a
different color than the source buffer itself so that if we sample
outside, it will show up.

Finally, the test now allows the destination buffer to not be changed
at all. This allows pixman to simply bail out in cases where the
transformation too strange.
2010-08-08 13:57:39 -04:00
Søren Sandmann Pedersen
b243a66041 Add x14r6g6b6 format to blitters-test 2010-08-04 08:58:51 -04:00
Siarhei Siamashka
226a6df4f9 test: 'scaling-test' updated to provide better coverage
Negative scale factors are now also tested. A small additional
translate transform helps to stress the use of fractional
coordinates better.

Also the number of iterations to run by default increased in order
to compensate increased variety of operations to be tested.
2010-07-27 16:07:34 +03:00
Siarhei Siamashka
af3eeaeb13 test: 'scaling-crash-test' added
This test tries to exploit some corner cases and previously known
bugs in nearest neighbor scaling fast path code, attempting to
crash pixman or cause some other nasty effect.
2010-07-27 16:07:07 +03:00
M Joonas Pihlaja
d95ae70604 Check that the OpenMP pragmas don't cause link errors.
This patch adds extra guards around our use of
OpenMP pragmas and checks that the pragmas won't
cause link errors.  This fixes the build on
Tru64 and Solaris with the native compilers and clang.
2010-07-21 23:52:23 +03:00
Søren Sandmann Pedersen
2e7fb66553 When converting indexed formats to 64 bits, don't correct for channel widths
Indexed formats are mapped to a8r8g8b8 with full precision, so when
expanding we shouldn't correct for the width of the channels
2010-07-11 09:43:56 -04:00
Søren Sandmann Pedersen
2df6dac0be test: Make sure the palettes for indexed format roundtrip properly
The palettes for indexed formats must satisfy the condition that if
some index maps to a color C, then the 15 bit version of that color
must map back to the index. This ensures that the destination operator
is always a no-op, which seems like a reasonable assumption to make.
2010-07-11 09:43:56 -04:00
Søren Sandmann Pedersen
66365b5ef1 Make separate gray scanline storers.
For gray formats the palettes are indexed by luminance, not RGB, so we
can't use the color storers for gray too.
2010-06-18 20:33:02 -04:00
Søren Sandmann Pedersen
4e1d4847c9 When storing a g1 pixel, store the lowest bit, rather than comparing with 0. 2010-06-18 20:33:02 -04:00
Andrea Canciani
445eb6385f test: verify that gradients do not crash pixman
Test gradients under particular conditions (no stops, all the stops
at the same offset) to check that pixman does not misbehave.
2010-06-09 17:30:41 +02:00
Siarhei Siamashka
cfc4e38852 test: added OpenMP support for better utilization of multiple CPU cores
Some of the tests are quite heavy CPU users and may benefit from
using multiple CPU cores, so the programs from 'test' directory
are now built with OpenMP support. OpenMP is easy to use, portable
and also takes care of making a decision about how many threads
to spawn.
2010-05-13 21:04:55 +03:00
Siarhei Siamashka
f905ebb03d test: scaling-test updated to use new fuzzer_test_main() function 2010-05-13 21:04:36 +03:00
Siarhei Siamashka
be387701a5 test: blitters-test updated to use new fuzzer_test_main() function 2010-05-13 21:04:31 +03:00
Siarhei Siamashka
9ed9abd154 test: blitters-test-bisect.rb converted to perl
This new script can be used to run continuously to compare two test
programs based on fuzzer_test_main() function from 'util.c' and
narrow down to a single problematic test from the batch which results
in different behavior.
2010-05-13 21:03:07 +03:00
Siarhei Siamashka
30c3e91c3f test: main loop from blitters-test added as a new function to utils.c
This new generalized function can be reused in both blitters-test
and scaling-test. Final checksum calculation changed in order to make
it parallelizable (it is a sum of individual 32-bit values returned
by a callback function, which is now responsible for running test-specific
code). Return values may be crc32, some other hash or even just zero on
success and non-zero on error (in this case, the expected result of the
whole test run should be 0).
2010-05-13 21:02:27 +03:00
Søren Sandmann Pedersen
e1594f204d test/gtk-utils: Set the size of the window to the size of the image 2010-05-06 01:05:40 +03:00
Søren Sandmann Pedersen
2d65fb033b Don't consider indexed formats opaque.
The indexed formats have 0 bits of alpha, but can't be considered
opaque because there may be non-opaque colors in the palette.
2010-05-03 10:59:36 +03:00
Søren Sandmann Pedersen
526132fa65 Remove alphamap from the GTK+ part of tests/Makefile.am
It doesn't use GTK+ and it was already listed in the non-GTK+ part.
2010-04-22 12:14:23 -04:00
Jon TURNEY
69f1ec9a78 Avoid a potential division-by-zero exeception in window-test
Avoid a division-by-zero exception if the first number returned by
rand() is a multiple of 500, causing us to create a zero width pixmap,
and then attempt to use get_rand(0) when generating a random stride...

Fixes https://bugs.freedesktop.org/attachment.cgi?id=34162
2010-03-17 20:25:25 -04:00
Søren Sandmann Pedersen
de27f45ddd Ensure that only the low 4 bit of 4 bit pixels are stored.
In some cases we end up trying to use the STORE_4 macro with an 8 bit
values, which resulted in other pixels getting overwritten. Fix this
by always masking off the low 4 bits.

This fixes blitters-test on big-endian machines.
2010-03-17 11:02:58 -04:00
Søren Sandmann Pedersen
ff30a5cbb9 test: Add support for indexed formats to blitters-test
These formats work fine, they just need to have a palette set.
2010-03-14 12:25:17 -04:00
Søren Sandmann Pedersen
9a8e404d44 test: Remove obsolete comment 2010-03-03 13:37:20 -05:00
Søren Sandmann Pedersen
16ef3ab230 Add a1-trap-test
When a trapezoid sample point is exactly on a polygon edge, the rule
is that it is considered inside the trapezoid if the edge is a top or
left edge, but outside for bottom and right edges.

This program tests that for a1 trapezoids.
2010-02-24 21:01:24 -05:00
Alexander Larsson
f32d585069 Test pixman_region32_init_from_image in region-test 2010-02-19 11:25:41 +01:00
Søren Sandmann Pedersen
c066c347ae Fix some warnings 2010-01-19 14:23:57 -05:00
Søren Sandmann Pedersen
042f978b04 test: Add new alphamap test program.
This program demonstrates three bugs relating to alpha maps:

- When fetching from an alpha map into 32 bit intermediates, we use
  the fetcher from the image, and not the one from the alpha map.

- For 64 bit intermediates we call fetch_pixel_generic_lossy_32()
  which then calls fetch_pixel_raw_64, which is NULL because alpha
  images are never validated.

- The alpha map should be used *in place* of any existing alpha
  channel, but we are actually multiplying it onto the image.
2010-01-17 16:47:15 -05:00