Commit Graph

33 Commits

Author SHA1 Message Date
Ben Avison
a82e519944 scaling-test: list more details when verbose
Add mask details to the output.

[Pekka: redo whitespace and print src,dst,mask x and y.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
2015-08-28 14:24:28 +03:00
Søren Sandmann Pedersen
aa5c45254e test: Test negative strides
Pixman supports negative strides, but up until now they haven't been
tested outside of stress-test. This commit adds testing of negative
strides to blitters-test, scaling-test, affine-test, rotate-test, and
composite-traps-test.
2013-09-19 21:37:56 -04:00
Søren Sandmann Pedersen
4312f07736 test: Share the image printing code
The affine-test, blitters-test, and scaling-test all have the ability
to print out the bytes of the destination image. Share this code by
moving it to utils.c.

At the same time make the code work correctly with negative strides.
2013-09-19 21:37:56 -04:00
Søren Sandmann Pedersen
51d7135456 {scaling,affine,composite-traps}-test: Use compute_crc32_for_image()
By using this function instead of compute_crc32() the alpha masking
code and the call to image_endian_swap() are not duplicated.
2013-09-19 21:37:56 -04:00
Søren Sandmann Pedersen
a4c79d695d Drop support for 8-bit precision in bilinear filtering
The default has been 7-bit for a while now, and the quality
improvement with 8-bit precision is not enough to justify keeping the
code around as a compile-time option.
2013-09-07 17:19:50 -04:00
Søren Sandmann Pedersen
4eb9a24aba utils.[ch]: Add new format_name() function
This function returns the name of the given format code, which is
useful for printing out debug information. The function is written as
a switch without a default value so that the compiler will warn if new
formats are added in the future. The fake formats used in the fast
path tables are also recognized.

The function is used in alpha_map.c, where it replaces an existing
format_name() function, and in blitters-test.c, affine-test.c, and
scaling-test.c.
2013-01-23 12:24:31 -05:00
Søren Sandmann Pedersen
1676b49389 test/utils.[ch]: Add new function operator_name()
This function returns the name of the given operator, which is useful
for printing out debug information. The function is done as a switch
without a default value so that the compiler will warn if new
operators are added in the future.

The function is used in affine-test.c, scaling-test.c, and
blitters-test.c.
2013-01-23 12:24:31 -05:00
Siarhei Siamashka
ebedd9a2ad test: Get rid of the obsolete 'prng_rand_N' and 'prng_rand_u32'
They are the same as 'prng_rand_n' and 'prng_rand'
2012-12-06 17:20:38 +02:00
Siarhei Siamashka
b31a696263 test: Switch to the new PRNG instead of old LCG
Wallclock time for running pixman "make check" (compile time not included):

----------------------------+----------------+-----------------------------+
                            | old PRNG (LCG) |   new PRNG (Bob Jenkins)    |
       Processor type       +----------------+------------+----------------+
                            |    gcc 4.5     |  gcc 4.5   | gcc 4.7 (simd) |
----------------------------+----------------+------------+----------------+
quad Intel Core i7  @2.8GHz |    0m49.494s   |  0m43.722s |    0m37.560s   |
dual ARM Cortex-A15 @1.7GHz |     5m8.465s   |  4m37.375s |    3m45.819s   |
     IBM Cell PPU   @3.2GHz |    23m0.821s   | 20m38.316s |   16m37.513s   |
----------------------------+----------------+------------+----------------+

But some tests got a particularly large boost. For example benchmarking and
profiling blitters-test on Core i7:

=== before ===

$ time ./blitters-test

real    0m10.907s
user    0m55.650s
sys     0m0.000s

  70.45%  blitters-test  blitters-test       [.] create_random_image
  15.81%  blitters-test  blitters-test       [.] compute_crc32_for_image_internal
   2.26%  blitters-test  blitters-test       [.] _pixman_implementation_lookup_composite
   1.07%  blitters-test  libc-2.15.so        [.] _int_free
   0.89%  blitters-test  libc-2.15.so        [.] malloc_consolidate
   0.87%  blitters-test  libc-2.15.so        [.] _int_malloc
   0.75%  blitters-test  blitters-test       [.] combine_conjoint_general_u
   0.61%  blitters-test  blitters-test       [.] combine_disjoint_general_u
   0.40%  blitters-test  blitters-test       [.] test_composite
   0.31%  blitters-test  libc-2.15.so        [.] _int_memalign
   0.31%  blitters-test  blitters-test       [.] _pixman_bits_image_setup_accessors
   0.28%  blitters-test  libc-2.15.so        [.] malloc

=== after ===

$ time ./blitters-test

real    0m3.655s
user    0m20.550s
sys     0m0.000s

  41.77%  blitters-test.n  blitters-test.new  [.] compute_crc32_for_image_internal
  15.77%  blitters-test.n  blitters-test.new  [.] prng_randmemset_r
   6.15%  blitters-test.n  blitters-test.new  [.] _pixman_implementation_lookup_composite
   3.09%  blitters-test.n  libc-2.15.so       [.] _int_free
   2.68%  blitters-test.n  libc-2.15.so       [.] malloc_consolidate
   2.39%  blitters-test.n  libc-2.15.so       [.] _int_malloc
   2.27%  blitters-test.n  blitters-test.new  [.] create_random_image
   2.22%  blitters-test.n  blitters-test.new  [.] combine_conjoint_general_u
   1.52%  blitters-test.n  blitters-test.new  [.] combine_disjoint_general_u
   1.40%  blitters-test.n  blitters-test.new  [.] test_composite
   1.02%  blitters-test.n  blitters-test.new  [.] prng_srand_r
   1.00%  blitters-test.n  blitters-test.new  [.] _pixman_image_validate
   0.96%  blitters-test.n  blitters-test.new  [.] _pixman_bits_image_setup_accessors
   0.90%  blitters-test.n  libc-2.15.so       [.] malloc
2012-12-06 17:20:35 +02:00
Siarhei Siamashka
309e66f047 test: Search/replace 'lcg_*' -> 'prng_*'
The 'lcg' prefix is going to be misleading if we replace
PRNG algorithm.
2012-12-06 17:20:31 +02:00
Søren Sandmann Pedersen
f0816ddaf4 Round fixed-point multiplication
After two fixed-point numbers are multiplied, the result is shifted
into place, but up until now pixman has simply discarded the low-order
bits instead of rounding to the closest number.

Fix that by adding 0x8000 (or 0x2 in one place) before shifting and
update the test checksums to match.
2012-11-20 03:23:51 -05:00
Søren Sandmann Pedersen
35be7acb66 Add PIXMAN_x8b8g8r8 and PIXMAN_a8b8g8r8 formats to scaling-test
Update the CRC values based on what the general implementation
reports. This reveals a bug in the fast implementation:

    % env PIXMAN_DISABLE="mmx sse2" ./test/scaling-test
    pixman: Disabled mmx implementation
    pixman: Disabled sse2 implementation
    scaling test failed! (checksum=AA722B06, expected 03A23E0C)

vs.

    % env PIXMAN_DISABLE="mmx sse2 fast" ./test/scaling-test
    pixman: Disabled fast implementation
    pixman: Disabled mmx implementation
    pixman: Disabled sse2 implementation
    scaling test passed (checksum=03A23E0C)

Reviewed-by: Matt Turner <mattst88@gmail.com>
2012-09-22 23:40:52 -04:00
Siarhei Siamashka
ccd31896bc Bilinear interpolation precision is now configurable at compile time
Macro BILINEAR_INTERPOLATION_BITS in pixman-private.h selects
the number of fractional bits used for bilinear interpolation.

scaling-test and affine-test have checksums for 4-bit, 7-bit
and 8-bit configurations.
2012-07-01 21:45:43 +03:00
Andrea Canciani
06760f5cb0 test: Cleanup includes
All the tests are linked to libutil, hence it makes sence to always
include utils.h and reuse what it provides (config.h inclusion, access
to private pixman APIs, ARRAY_LENGTH, ...).
2011-11-09 09:17:00 +01: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
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
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
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
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
f905ebb03d test: scaling-test updated to use new fuzzer_test_main() function 2010-05-13 21:04:36 +03:00
Søren Sandmann Pedersen
13f4e02b14 test: Move image_endian_swap() from blitters-test.c to utils.[ch] 2009-11-17 00:32:03 -05:00
Søren Sandmann Pedersen
24e203a8a8 test: Move random number generator from blitters/scaling-test to utils.[ch] 2009-11-17 00:32:03 -05:00
Søren Sandmann Pedersen
cc34554652 test: In scaling-test use the crc32 from utils.c 2009-11-17 00:32:03 -05:00
Søren Sandmann Pedersen
f0c157f888 Extend scaling-test to also test bilinear filtering. 2009-10-26 13:04:21 -04:00
Benjamin Otte
fa49ef81f7 Add default cases for all switch statements
Fixes compilation with -Wswitch-default. Compilation with -Wswitch-enums
works fine as is.
2009-10-20 00:40:40 +02:00
Søren Sandmann Pedersen
83f6e2eacf Reindent and rename identifiers in scaling-test.c 2009-07-13 19:58:04 -04:00
Siarhei Siamashka
51418786e4 Return nonzero code from scaling-test program in case of failure.
This can potentially help in tests automation.
2009-07-10 13:50:15 -04:00
Siarhei Siamashka
71862fe84e Fix scaling-test to work on big endian systems 2009-07-10 13:50:15 -04:00
Søren Sandmann Pedersen
0fce356762 Add workarounds for X servers doing out-of-bounds accesses.
Old X servers rely on out-of-bounds accesses when they are asked
to composite with a window as the source. They create a pixman image
pointing to some bogus position in memory, but then they set a clip
region to the position where the actual bits are.

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.

The workaround added by this commit is to try and detect whether a
source drawable is actually a window without a client clip set. Such a
window will generally have a clip region that corresponds exactly to
the hierarchy clip in the server, whereas pixmaps will have a clip
region that is an exact match to the drawable.

When we detect such a window, we allow a fast path to run that would
normally be rejected due to the sources not completely subsuming the
composite region.

Fixed X servers should call the new function
pixman_disable_out_of_bounds_workaround() to disable the workaround.

This was reported in bug 22484.
2009-07-10 02:57:09 -04:00
Søren Sandmann Pedersen
6b34482870 Update the CRC value in scaling-test.c.
The changes in pixman behavior justifying this are:

- New clipping rules

- Bug fixes in region code. In particular, when
  pixman_region_init_rects() is called on these two boxes:

	{ 2, 6, 7, 6 }
	{ 4, 1, 6, 7 }

  it now ignores the first one, which is empty and produces

	{ 4, 1, 6, 7 }

  Previously, it would produce:

	{ 2, 1, 7, 7 }

  for some reason.
2009-07-09 04:04:00 -04:00
Siarhei Siamashka
21034db1da Scaling test updated to provide better coverage for problematic cases
Now scaling test should reliably detect problems in new scaling code.
Maximum image size reduced to improve performance (more tests can be
run per second) and also simplify detected errors analysis.
2009-05-29 22:23:22 -04:00
Siarhei Siamashka
dbb72c02fd Updated scaling test to support rgb565, source clipping, etc.
Now test provides better coverage for various image scaling
cases. Unused byte for x8r8g8b8 format is ignored. Running
the test program without any command line options provides
a PASS/FAIL verdict based on the precalculated crc32 value
for using pixman with all the fastpath functions disabled,
which should simplify testing for correcteness.
2009-04-24 21:51:30 -04:00
Siarhei Siamashka
a9adae3dc3 Image scaling regression test script
This test script can help in finding regressions in image scaling
fastpath implementations. It uses test program compiled with
and without fastpath code and can compare results of execution
for different pseudorandom compositing operations involving scaling.

Signed-off-by: Søren Sandmann Pedersen <sandmann@redhat.com>
2009-03-31 21:30:03 -04:00