profile/ivi/pixman.git
13 years agoGet rid of the classify methods
Søren Sandmann Pedersen [Fri, 10 Dec 2010 20:18:48 +0000 (15:18 -0500)]
Get rid of the classify methods

They are not used anymore, and the linear gradient is now doing the
optimization in a different way.

13 years agoLinear: Optimize for horizontal gradients
Søren Sandmann Pedersen [Fri, 10 Dec 2010 20:14:24 +0000 (15:14 -0500)]
Linear: Optimize for horizontal gradients

If the gradient is horizontal, we can reuse the same scanline over and
over. Add support for this optimization to
_pixman_linear_gradient_iter_init().

13 years agoConsolidate the various get_scanline_32() into get_scanline_narrow()
Søren Sandmann Pedersen [Fri, 10 Dec 2010 19:59:20 +0000 (14:59 -0500)]
Consolidate the various get_scanline_32() into get_scanline_narrow()

The separate get_scanline_32() functions in solid, linear, radial and
conical images are no longer necessary because all access to these
images now go through iterators.

13 years agoAllow NULL property_changed function
Søren Sandmann Pedersen [Fri, 10 Dec 2010 19:44:22 +0000 (14:44 -0500)]
Allow NULL property_changed function

Initialize the field to NULL, and then delete the empty functions from
the solid, linear, radial, and conical images.

13 years agoMove get_scanline_32/64 to the bits part of the image struct
Søren Sandmann Pedersen [Fri, 10 Dec 2010 19:39:01 +0000 (14:39 -0500)]
Move get_scanline_32/64 to the bits part of the image struct

At this point these functions are basically a cache that the bits
image uses for its fetchers, so they can be moved to the bits image.

With the scanline getters only being initialized in the bits image,
the _pixman_image_get_scanline_generic_64 can be moved to
pixman-bits-image.c. That gets rid of the final user of
_pixman_image_get_scanline_32/64, so these can be deleted.

13 years agoUse an iterator in pixman_image_get_solid()
Søren Sandmann Pedersen [Fri, 10 Dec 2010 15:53:02 +0000 (10:53 -0500)]
Use an iterator in pixman_image_get_solid()

This is a step towards getting rid of the
_pixman_image_get_scanline_32/64() functions.

13 years agoVirtualize iterator initialization
Søren Sandmann Pedersen [Fri, 10 Dec 2010 18:26:53 +0000 (13:26 -0500)]
Virtualize iterator initialization

Make src_iter_init() and dest_iter_init() virtual methods in the
implementation struct. This allows individual implementations to plug
in their own CPU specific scanline fetchers.

13 years agoMove iterator initialization to the respective image files
Søren Sandmann Pedersen [Fri, 10 Dec 2010 17:40:26 +0000 (12:40 -0500)]
Move iterator initialization to the respective image files

Instead of calling _pixman_image_get_scanline_32/64(), move the
iterator initialization into the respecive image implementations and
call the scanline generators directly.

13 years agoEliminate the _pixman_image_store_scanline_32/64 functions
Søren Sandmann Pedersen [Fri, 10 Dec 2010 17:31:29 +0000 (12:31 -0500)]
Eliminate the _pixman_image_store_scanline_32/64 functions

They were only called from next_line_write_narrow/wide, so they could
simply be absorbed into those functions.

13 years agoMove initialization of iterators for bits images to pixman-bits-image.c
Søren Sandmann Pedersen [Fri, 10 Dec 2010 17:19:50 +0000 (12:19 -0500)]
Move initialization of iterators for bits images to pixman-bits-image.c

pixman_iter_t is now defined in pixman-private.h, and iterators for
bits images are being initialized in pixman-bits-image.c

13 years agoAdd iterators in the general implementation
Søren Sandmann Pedersen [Fri, 10 Dec 2010 16:30:27 +0000 (11:30 -0500)]
Add iterators in the general implementation

We add a new structure called a pixman_iter_t that encapsulates the
information required to read scanlines from an image. It contains two
functions, get_scanline() and write_back(). The get_scanline()
function will generate pixels for the current scanline. For iterators
for source images, it will also advance to the next scanline. The
write_back() function is only called for destination images. Its
function is to write back the modified pixels to the image and then
advance to the next scanline.

When an iterator is initialized, it is passed this information:

   - The image to iterate

   - The rectangle to be iterated

   - A buffer that the iterator may (but is not required to) use. This
     buffer is guaranteed to have space for at least width pixels.

   - A flag indicating whether a8r8g8b8 or a16r16g16b16 pixels should
     be fetched

There are a number of (eventual) benefits to the iterators:

   - The initialization of the iterator can be virtualized such that
     implementations can plug in their own CPU specific get_scanline()
     and write_back() functions.

   - If an image is horizontal, it can simply plug in an appropriate
     get_scanline(). This way we can get rid of the annoying
     classify() virtual function.

   - In general, iterators can remember what they did on the last
     scanline, so for example a REPEAT_NONE image might reuse the same
     data for all the empty scanlines generated by the zero-extension.

   - More detailed information can be passed to iterator, allowing
     more specialized fetchers to be used.

   - We can fix the bug where destination filters and transformations
     are not currently being ignored as they should be.

However, this initial implementation is not optimized at all. We lose
several existing optimizations:

   - The ability to composite directly in the destination
   - The ability to only fetch one scanline for horizontal images
   - The ability to avoid fetching the src and mask for the CLEAR
     operator

Later patches will re-introduce these optimizations.

13 years agoARM: do /proc/self/auxv based cpu features detection only in linux
Siarhei Siamashka [Tue, 11 Jan 2011 12:36:24 +0000 (14:36 +0200)]
ARM: do /proc/self/auxv based cpu features detection only in linux

This method is linux specific, but earlier it was tried for any platform
that did not have _MSC_VER macro defined.

13 years agoA new configure option --enable-static-testprogs
Siarhei Siamashka [Mon, 13 Sep 2010 01:21:33 +0000 (04:21 +0300)]
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.

13 years agoMake 'fast_composite_scaled_nearest_*' less suspicious
Siarhei Siamashka [Mon, 10 Jan 2011 16:29:33 +0000 (18:29 +0200)]
Make 'fast_composite_scaled_nearest_*' less suspicious

Taking address of a variable and then using it as an array looks suspicious
to static code analyzers. So change it into an array with 1 element to make
them happy. Both old and new variants of this code are correct because 'vx'
and 'unit_x' arguments are set to 0 and it means that the called scanline
function can only access a single element of 'zero' buffer.

13 years agoBugfix for a corner case in 'pixman_transform_is_inverse'
Siarhei Siamashka [Mon, 10 Jan 2011 16:09:16 +0000 (18:09 +0200)]
Bugfix for a corner case in 'pixman_transform_is_inverse'

When 'pixman_transform_multiply' fails, the result of multiplication just
could not have been identity matrix (one of the values in the resulting
matrix can't be represented as 16.16 fixed point value). So it is safe
to return FALSE.

13 years agoWorkaround for a preprocessor issue in old Sun Studio
Siarhei Siamashka [Tue, 4 Jan 2011 11:42:29 +0000 (13:42 +0200)]
Workaround for a preprocessor issue in old Sun Studio

Patch from Peter O'Gorman with some modifications

https://bugs.freedesktop.org//show_bug.cgi?id=32764

13 years agoFix for "syntax error: empty declaration" Solaris Studio warnings
Siarhei Siamashka [Tue, 4 Jan 2011 06:41:02 +0000 (08:41 +0200)]
Fix for "syntax error: empty declaration" Solaris Studio warnings

13 years agoRevert "Fix "syntax error: empty declaration" warnings."
Siarhei Siamashka [Tue, 4 Jan 2011 06:18:38 +0000 (08:18 +0200)]
Revert "Fix "syntax error: empty declaration" warnings."

This reverts commit b924bb1f8191cc7c386d8211d9822aeeaadcab44.

There is a better fix for these Solaris Studio warnings.

13 years agoImprove handling of tangent circles
Andrea Canciani [Tue, 23 Nov 2010 10:37:54 +0000 (11:37 +0100)]
Improve handling of tangent circles

When b is 0, avoid the division by zero and just return transparent
black.

When the solution t would have an invalid radius (negative or outside
[0,1] for none-extended gradients), return transparent black.

13 years agosse2: Skip src pixels that are zero in sse2_composite_over_8888_n_8888()
Søren Sandmann Pedersen [Mon, 20 Dec 2010 21:11:48 +0000 (16:11 -0500)]
sse2: Skip src pixels that are zero in sse2_composite_over_8888_n_8888()

This is a big speed-up in the SVG helicopter game:

   http://ie.microsoft.com/testdrive/Performance/Helicopter/Default.xhtml

when rendered by Firefox 4 since it is compositing big images
consisting almost entirely of zeros.

13 years agoFix divide-by-zero in set_lum().
Søren Sandmann Pedersen [Sat, 18 Dec 2010 11:06:39 +0000 (06:06 -0500)]
Fix divide-by-zero in set_lum().

When (l - min) or (max - l) are zero, simply set all the channels to
the limit, 0 in the case of (l - min), and a in the case of (max - l).

13 years agoAdd a test compositing with the various PDF operators.
Søren Sandmann Pedersen [Sat, 18 Dec 2010 11:05:52 +0000 (06:05 -0500)]
Add a test compositing with the various PDF operators.

The test has floating point exceptions enabled, and currently fails
with a divide-by-zero.

13 years agoFix linking issues when HAVE_FEENABLEEXCEPT is set.
Cyril Brulebois [Sun, 19 Dec 2010 18:37:26 +0000 (19:37 +0100)]
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>
13 years agoRemove stray #include <fenv.h>
Jon TURNEY [Sat, 18 Dec 2010 18:32:39 +0000 (18:32 +0000)]
Remove stray #include <fenv.h>

Remove a stray #include <fenv.h> added in commit 2444b2265abeaf6dcf3df1763bc2711684e63bb8
to fix compilation on platforms which don't have fenv.h

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
13 years agoAdd a stress-test program.
Søren Sandmann Pedersen [Tue, 24 Aug 2010 01:55:02 +0000 (21:55 -0400)]
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.

13 years agoMake the argument to fence_malloc() an int64_t
Søren Sandmann Pedersen [Tue, 12 Oct 2010 14:56:26 +0000 (10:56 -0400)]
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.

13 years agotest/utils.c: Initialize palette->rgba to 0.
Søren Sandmann Pedersen [Sun, 29 Aug 2010 22:02:02 +0000 (18:02 -0400)]
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.

13 years agotest: Move palette initialization to utils.[ch]
Søren Sandmann Pedersen [Tue, 24 Aug 2010 01:02:02 +0000 (21:02 -0400)]
test: Move palette initialization to utils.[ch]

13 years agoExtend gradient-crash-test
Søren Sandmann Pedersen [Wed, 20 Oct 2010 17:12:37 +0000 (13:12 -0400)]
Extend gradient-crash-test

Test the gradients with various transformations, and test cases where
the gradients are specified with two identical points.

13 years agoAdd enable_fp_exceptions() function in utils.[ch]
Søren Sandmann Pedersen [Wed, 20 Oct 2010 17:53:07 +0000 (13:53 -0400)]
Add enable_fp_exceptions() function in utils.[ch]

This function enables floating point traps if possible.

13 years agotest: Make composite test use some existing macros instead of defining its own
Søren Sandmann Pedersen [Tue, 24 Aug 2010 00:56:11 +0000 (20:56 -0400)]
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.

13 years agoCOPYING: added Nokia to the list of copyright holders
Siarhei Siamashka [Fri, 17 Dec 2010 13:29:58 +0000 (15:29 +0200)]
COPYING: added Nokia to the list of copyright holders

13 years agoFix for potential unaligned memory accesses
Siarhei Siamashka [Mon, 29 Nov 2010 22:31:06 +0000 (00:31 +0200)]
Fix for potential unaligned memory accesses

The temporary scanline buffer allocated on stack was declared
as uint8_t array. As a result, the compiler was free to select
any arbitrary alignment for it (even though there is typically
no reason to use really weird alignments here and the stack is
normally at least 4 bytes aligned on most platforms). Having
improper alignment is non-portable and can impact performance
or even make the code misbehave depending on the target platform.

Using uint64_t type for this array should ensure that any possible
memory accesses done by pixman code are going to be handled correctly
(pixman-combine64.c can access this buffer via uint64_t * pointer).

Some alignment related problem was reported in:
http://lists.freedesktop.org/archives/pixman/2010-November/000747.html

13 years agoARM: added 'neon_src_rpixbuf_8888' fast path
Siarhei Siamashka [Thu, 25 Nov 2010 00:28:29 +0000 (02:28 +0200)]
ARM: added 'neon_src_rpixbuf_8888' fast path

With this optimization added, pixman assisted conversion from
non-premultiplied to premultiplied alpha format is now fully
NEON optimized (both with and without R/B color components
swapping in the process).

13 years agoARM: added 'neon_composite_in_n_8' fast path
Siarhei Siamashka [Mon, 29 Nov 2010 07:11:29 +0000 (09:11 +0200)]
ARM: added 'neon_composite_in_n_8' fast path

13 years agoARM: added flags parameter to some asm fast path wrapper macros
Siarhei Siamashka [Mon, 29 Nov 2010 07:00:46 +0000 (09:00 +0200)]
ARM: added flags parameter to some asm fast path wrapper macros

Not all types of operations can be skipped when having transparent
solid source or transparent solid mask. Add an extra flags parameter
for providing this information to the wrappers.

13 years agoARM: added 'neon_composite_add_8888_n_8888' fast path
Siarhei Siamashka [Mon, 29 Nov 2010 01:31:32 +0000 (03:31 +0200)]
ARM: added 'neon_composite_add_8888_n_8888' fast path

13 years agoARM: added 'neon_composite_add_n_8_8888' fast path
Siarhei Siamashka [Mon, 29 Nov 2010 00:38:52 +0000 (02:38 +0200)]
ARM: added 'neon_composite_add_n_8_8888' fast path

13 years agoARM: better NEON instructions scheduling for add_8888_8888_8888
Siarhei Siamashka [Mon, 29 Nov 2010 00:10:22 +0000 (02:10 +0200)]
ARM: better NEON instructions scheduling for add_8888_8888_8888

Provides a minor performance improvement by using pipelining and hiding
instructions latencies. Also do not clobber d0-d3 registers (source
image pixels) while doing calculations in order to allow the use of
the same macro for add_n_8_8888 fast path later.

Benchmark from ARM Cortex-A8 @500MHz:

== before ==

  add_8888_8888_8888 = L1:  95.94  L2:  42.27  M: 25.60 (121.09%)
                       HT:  14.54  VT:  13.13  R: 12.77  RT:  4.49 (48Kops/s)
     add_8888_8_8888 = L1: 104.51  L2:  57.81  M: 36.06 (106.62%)
                       HT:  19.24  VT:  16.45  R: 14.71  RT:  4.80 (51Kops/s)

== after ==

  add_8888_8888_8888 = L1: 106.66  L2:  47.82  M: 27.32 (129.30%)
                       HT:  15.44  VT:  13.96  R: 12.86  RT:  4.48 (48Kops/s)
     add_8888_8_8888 = L1: 107.72  L2:  61.02  M: 38.26 (113.16%)
                       HT:  19.48  VT:  16.72  R: 14.82  RT:  4.80 (51Kops/s)

13 years agoARM: added 'neon_composite_add_8888_8_8888' fast path
Siarhei Siamashka [Sun, 28 Nov 2010 20:05:53 +0000 (22:05 +0200)]
ARM: added 'neon_composite_add_8888_8_8888' fast path

13 years agoARM: added 'neon_composite_over_0565_n_0565' fast path
Siarhei Siamashka [Sat, 27 Nov 2010 13:53:54 +0000 (15:53 +0200)]
ARM: added 'neon_composite_over_0565_n_0565' fast path

13 years agoARM: reuse common NEON code for over_{n_8|8888_n|8888_8}_0565
Siarhei Siamashka [Sat, 27 Nov 2010 02:47:39 +0000 (04:47 +0200)]
ARM: reuse common NEON code for over_{n_8|8888_n|8888_8}_0565

Renamed suppementary macros from 'over_n_8_0565' to 'over_8888_8_0565',
because they can actually support all variants of this operation:
over_8888_8_0565/over_n_8_0565/over_8888_n_0565.

Also 'over_8888_8_0565' now uses more optimized common code instead of its
own variant, improving performance a bit. Even though this operation is
still memory bandwidth limited, scaled variants of these fast paths may
put more stress on CPU later.

Benchmarked on ARM Cortex-A8 @500MHz:

== before ==

    over_8888_8_0565 =  L1:  67.10  L2:  53.82  M: 44.70 (105.17%)
                        HT:  18.73  VT:  16.91  R: 14.25  RT:  4.80 (52Kops/s)

== after ==

    over_8888_8_0565 =  L1:  77.83  L2:  58.14  M: 44.82 (105.52%)
                        HT:  20.58  VT:  17.44  R: 15.05  RT:  4.88 (52Kops/s)

13 years agoARM: added 'neon_composite_over_8888_n_0565' fast path
Siarhei Siamashka [Sat, 27 Nov 2010 01:53:12 +0000 (03:53 +0200)]
ARM: added 'neon_composite_over_8888_n_0565' fast path

13 years agoARM: better NEON instructions scheduling for over_n_8_0565
Siarhei Siamashka [Fri, 26 Nov 2010 15:06:58 +0000 (17:06 +0200)]
ARM: better NEON instructions scheduling for over_n_8_0565

Code rearranged to get better instructions scheduling for ARM Cortex-A8/A9.
Now it is ~30% faster for the pixel data in L1 cache and makes better use
of memory bandwidth when running at lower clock frequencies (ex. 500MHz).
Also register d24 (pixels from the mask image) is now not clobbered by
supplementary macros, which allows to reuse them for the other variants
of compositing operations later.

Benchmark from ARM Cortex-A8 @500MHz:

== before ==

    over_n_8_0565 =  L1:  63.90  L2:  63.15  M: 60.97 ( 73.53%)
                     HT:  28.89  VT:  24.14  R: 21.33  RT:  6.78 (  67Kops/s)

== after ==

    over_n_8_0565 =  L1:  82.64  L2:  75.19  M: 71.52 ( 84.14%)
                     HT:  30.49  VT:  25.56  R: 22.36  RT:  6.89 (  68Kops/s)

13 years agoARM: introduced 'fetch_mask_pixblock' macro to simplify code
Siarhei Siamashka [Sun, 28 Nov 2010 19:45:06 +0000 (21:45 +0200)]
ARM: introduced 'fetch_mask_pixblock' macro to simplify code

This macro hides the implementation details of pixels fetching
for the mask image just like 'fetch_src_pixblock' does for the
source image. This provides more possibilities for reusing the
same code blocks in different compositing functions.

This patch does not introduce any functional changes and the
resulting code in the compiled object file is exactly the same.

13 years agoARM: added 'neon_composite_over_n_8_8' fast path
Siarhei Siamashka [Fri, 26 Nov 2010 06:55:49 +0000 (08:55 +0200)]
ARM: added 'neon_composite_over_n_8_8' fast path

13 years agoC fast path for a1 fill operation
Siarhei Siamashka [Mon, 15 Nov 2010 16:26:43 +0000 (18:26 +0200)]
C fast path for a1 fill operation

Can be used as one of the solutions to fix bug
https://bugs.freedesktop.org/show_bug.cgi?id=31604

13 years agoSun's copyrights belong to Oracle now
Alan Coopersmith [Sun, 21 Nov 2010 19:42:22 +0000 (11:42 -0800)]
Sun's copyrights belong to Oracle now

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
13 years agoFix argument quoting for AC_INIT.
Cyril Brulebois [Wed, 17 Nov 2010 15:16:56 +0000 (16:16 +0100)]
Fix argument quoting for AC_INIT.

One gets rid of this accordingly:
| autoreconf -vfi
| autoreconf: Entering directory `.'
| autoreconf: configure.ac: not using Gettext
| autoreconf: running: aclocal --force
| configure.ac:61: warning: AC_INIT: not a literal: "pixman@lists.freedesktop.org"
| autoreconf: configure.ac: tracing
| configure.ac:61: warning: AC_INIT: not a literal: "pixman@lists.freedesktop.org"

Signed-off-by: Cyril Brulebois <kibi@debian.org>
13 years agoPost-release version bump to 0.21.3
Søren Sandmann Pedersen [Tue, 16 Nov 2010 22:14:47 +0000 (17:14 -0500)]
Post-release version bump to 0.21.3

13 years agoPre-release version bump
Søren Sandmann Pedersen [Tue, 16 Nov 2010 21:43:26 +0000 (16:43 -0500)]
Pre-release version bump

13 years agoGenerate {a,x}8r8g8b8, a8, 565 fetchers for nearest/affine images
Søren Sandmann Pedersen [Wed, 3 Nov 2010 03:38:10 +0000 (23:38 -0400)]
Generate {a,x}8r8g8b8, a8, 565 fetchers for nearest/affine images

There are versions for all combinations of x8r8g8b8/a8r8g8b8 and
pad/repeat/none/normal repeat modes. The bulk of each function is an
inline function that takes a format and a repeat mode as parameters.

13 years agoImprove conical gradients opacity check
Andrea Canciani [Tue, 2 Nov 2010 16:04:35 +0000 (17:04 +0100)]
Improve conical gradients opacity check

Conical gradients are completely opaque if all of their stops are
opaque and the repeat mode is not 'none'.

13 years agoFix opacity check
Andrea Canciani [Tue, 2 Nov 2010 16:02:01 +0000 (17:02 +0100)]
Fix opacity check

Radial gradients are "conical", thus they can have some non-opaque
parts even if all of their stops are completely opaque.

To guarantee that a radial gradient is actually opaque, it needs to
also have one of the two circles containing the other one. In this
case when extrapolating, the whole plane is completely covered (as
explained in the comment in pixman-radial-gradient.c).

13 years agoRemove unused stop_range field
Andrea Canciani [Sun, 31 Oct 2010 15:59:45 +0000 (16:59 +0100)]
Remove unused stop_range field

13 years agoARM: optimization for scaled src_0565_0565 with nearest filter
Siarhei Siamashka [Sun, 3 Oct 2010 22:56:59 +0000 (01:56 +0300)]
ARM: optimization for scaled src_0565_0565 with nearest filter

The performance improvement is only in the ballpark of 5% when
compared against C code built with a reasonably good compiler
(gcc 4.5.1). But gcc 4.4 produces approximately 30% slower code
here, so assembly optimization makes sense to avoid dependency
on the compiler quality and/or optimization options.

Benchmark from ARM11:
    == before ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=34.86 MPix/s

    == after ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=36.62 MPix/s

Benchmark from ARM Cortex-A8:
    == before ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=89.55 MPix/s

    == after ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=94.91 MPix/s

13 years agoARM: NEON optimization for scaled src_0565_8888 with nearest filter
Siarhei Siamashka [Tue, 2 Nov 2010 14:12:42 +0000 (16:12 +0200)]
ARM: NEON optimization for scaled src_0565_8888 with nearest filter

Benchmark from ARM Cortex-A8 @720MHz:
    == before ==
    op=1, src_fmt=10020565, dst_fmt=20028888, speed=8.99 MPix/s

    == after ==
    op=1, src_fmt=10020565, dst_fmt=20028888, speed=76.98 MPix/s

    == unscaled ==
    op=1, src_fmt=10020565, dst_fmt=20028888, speed=137.78 MPix/s

13 years agoARM: NEON optimization for scaled src_8888_0565 with nearest filter
Siarhei Siamashka [Tue, 2 Nov 2010 13:25:51 +0000 (15:25 +0200)]
ARM: NEON optimization for scaled src_8888_0565 with nearest filter

Benchmark from ARM Cortex-A8 @720MHz:
    == before ==
    op=1, src_fmt=20028888, dst_fmt=10020565, speed=42.51 MPix/s

    == after ==
    op=1, src_fmt=20028888, dst_fmt=10020565, speed=55.61 MPix/s

    == unscaled ==
    op=1, src_fmt=20028888, dst_fmt=10020565, speed=117.99 MPix/s

13 years agoARM: NEON optimization for scaled over_8888_0565 with nearest filter
Siarhei Siamashka [Tue, 2 Nov 2010 12:39:02 +0000 (14:39 +0200)]
ARM: NEON optimization for scaled over_8888_0565 with nearest filter

Benchmark from ARM Cortex-A8 @720MHz:
    == before ==
    op=3, src_fmt=20028888, dst_fmt=10020565, speed=10.29 MPix/s

    == after ==
    op=3, src_fmt=20028888, dst_fmt=10020565, speed=36.36 MPix/s

    == unscaled ==
    op=3, src_fmt=20028888, dst_fmt=10020565, speed=79.40 MPix/s

13 years agoARM: NEON optimization for scaled over_8888_8888 with nearest filter
Siarhei Siamashka [Tue, 2 Nov 2010 12:29:57 +0000 (14:29 +0200)]
ARM: NEON optimization for scaled over_8888_8888 with nearest filter

Benchmark from ARM Cortex-A8 @720MHz:
    == before ==
    op=3, src_fmt=20028888, dst_fmt=20028888, speed=12.73 MPix/s

    == after ==
    op=3, src_fmt=20028888, dst_fmt=20028888, speed=28.75 MPix/s

    == unscaled ==
    op=3, src_fmt=20028888, dst_fmt=20028888, speed=53.03 MPix/s

13 years agoARM: performance tuning of NEON nearest scaled pixel fetcher
Siarhei Siamashka [Tue, 2 Nov 2010 17:16:46 +0000 (19:16 +0200)]
ARM: performance tuning of NEON nearest scaled pixel fetcher

Interleaving the use of NEON registers helps to avoid some stalls
in NEON pipeline and provides a small performance improvement.

13 years agoARM: macro template in C code to simplify using scaled fast paths
Siarhei Siamashka [Tue, 2 Nov 2010 12:26:13 +0000 (14:26 +0200)]
ARM: macro template in C code to simplify using scaled fast paths

This template can be used to instantiate scaled fast path functions
by providing main loop code and calling NEON assembly optimized
scanline processing functions from it. Another macro can be used
to simplify adding entries to fast path tables.

13 years agoARM: nearest scaling support for NEON scanline compositing functions
Siarhei Siamashka [Mon, 1 Nov 2010 08:03:59 +0000 (10:03 +0200)]
ARM: nearest scaling support for NEON scanline compositing functions

Now it is possible to generate scanline processing functions
for the case when the source image is scaled with NEAREST filter.

Only 16bpp and 32bpp pixel formats are supported for now. But the
others can be also added later when needed. All the existing NEON
fast path functions should be quite easy to reuse for implementing
fast paths which can work with scaled source images.

13 years agoARM: NEON: source image pixel fetcher can be overrided now
Siarhei Siamashka [Mon, 1 Nov 2010 03:10:34 +0000 (05:10 +0200)]
ARM: NEON: source image pixel fetcher can be overrided now

Added a special macro 'pixld_src' which is now responsible for fetching
pixels from the source image. Right now it just passes all its arguments
directly to 'pixld' macro, but it can be used in the future to provide
a special pixel fetcher for implementing nearest scaling.

The 'pixld_src' has a lot of arguments which define its behavior. But
for each particular fast path implementation, we already know NEON
registers allocation and how many pixels are processed in a single block.
That's why a higher level macro 'fetch_src_pixblock' is also introduced
(it's easier to use because it has no arguments) and used everywhere
in 'pixman-arm-neon-asm.S' instead of VLD instructions.

This patch does not introduce any functional changes and the resulting code
in the compiled object file is exactly the same.

13 years agoARM: fix 'vld1.8'->'vld1.32' typo in add_8888_8888 NEON fast path
Siarhei Siamashka [Tue, 2 Nov 2010 20:53:55 +0000 (22:53 +0200)]
ARM: fix 'vld1.8'->'vld1.32' typo in add_8888_8888 NEON fast path

This was mostly harmless and had no effect on little endian systems.
But wrong vector element size is at least inconsistent and also
can theoretically cause problems on big endian ARM systems.

13 years agoDo CPU features detection from 'constructor' function when compiled with gcc
Siarhei Siamashka [Fri, 24 Sep 2010 13:36:16 +0000 (16:36 +0300)]
Do CPU features detection from 'constructor' function when compiled with gcc

There is attribute 'constructor' supported since gcc 2.7 which allows
to have a constructor function for library initialization. This eliminates
an extra branch for each composite operation and also helps to avoid
complains from race condition detection tools like helgrind.

The other compilers may or may not support this attribute properly.
Ideally, the compilers should fail to compile the code with unknown
attribute, so the configure check should do the right job. But in
reality the problems are surely possible. Fortunately such problems
should be quite easy to find because NULL pointer dereference should
happen almost immediately if the constructor fails to run.

clang 2.7:
  supports __attribute__((constructor)) properly and pretends to be gcc

tcc 0.9.25:
  ignores __attribute__((constructor)), but does not pretend to be gcc

13 years agoDelete the source_image_t struct.
Søren Sandmann Pedersen [Sun, 31 Oct 2010 05:40:57 +0000 (01:40 -0400)]
Delete the source_image_t struct.

It serves no purpose anymore now that the source_class_t field is gone.

13 years ago[mmx] Mark some of the output variables as early-clobber.
Søren Sandmann Pedersen [Sat, 30 Oct 2010 21:20:22 +0000 (17:20 -0400)]
[mmx] Mark some of the output variables as early-clobber.

GCC assumes that input variables in inline assembly are fully consumed
before any output variable is written. This means it may allocate the
variables in the same register unless the output variables are marked
as early-clobber.

From Jeremy Huddleston:

    I noticed a problem building pixman with clang and reported it to
    the clang developers.  They responded back with a comment about
    the inline asm in pixman-mmx.c and suggested a fix:

    """
    Incidentally, Jeremy, in the asm that reads
    __asm__ (
    "movq %7, %0\n"
    "movq %7, %1\n"
    "movq %7, %2\n"
    "movq %7, %3\n"
    "movq %7, %4\n"
    "movq %7, %5\n"
    "movq %7, %6\n"
    : "=y" (v1), "=y" (v2), "=y" (v3),
      "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
    : "y" (vfill));

    all the output operands except the last one should be marked as
    earlyclobber ("=&y"). This is working by accident with gcc.
    """

Cc: jeremyhu@apple.com
Reviewed-by: Matt Turner <mattst88@gmail.com>
13 years agoRemove workaround for a bug in the 1.6 X server.
Søren Sandmann Pedersen [Fri, 29 Oct 2010 00:14:03 +0000 (20:14 -0400)]
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.

13 years agoFixed broken configure check for __thread support
Siarhei Siamashka [Sat, 30 Oct 2010 12:51:30 +0000 (15:51 +0300)]
Fixed broken configure check for __thread support

Somehow the patch from [1] was not applied correctly, fixing that.

1. http://lists.cairographics.org/archives/cairo/2010-September/020826.html

13 years agoCOPYING: Stop saying that a modification is currently under discussion.
Søren Sandmann Pedersen [Mon, 1 Nov 2010 21:52:29 +0000 (17:52 -0400)]
COPYING: Stop saying that a modification is currently under discussion.

Also put the copyright text into a C comment for easier cut and paste.

13 years agoVersion bump 0.21.1.
Søren Sandmann Pedersen [Wed, 27 Oct 2010 21:21:06 +0000 (17:21 -0400)]
Version bump 0.21.1.

The previous bump to 0.20.1 was a mistake; it belongs on the 0.20 branch.

13 years agoPost-release version bump to 0.20.1
Søren Sandmann Pedersen [Wed, 27 Oct 2010 20:58:29 +0000 (16:58 -0400)]
Post-release version bump to 0.20.1

13 years agoPre-release version bump to 0.20.0
Søren Sandmann Pedersen [Wed, 27 Oct 2010 20:51:40 +0000 (16:51 -0400)]
Pre-release version bump to 0.20.0

13 years agoAdded check to find pthread on Haiku.
Scott McCreary [Wed, 27 Oct 2010 19:31:27 +0000 (12:31 -0700)]
Added check to find pthread on Haiku.

13 years agoPlug another leak in alphamap test
Jon TURNEY [Sun, 24 Oct 2010 14:58:39 +0000 (15:58 +0100)]
Plug another leak in alphamap test

Even after commit e46be417cebac984a858da05e61d924889695c9e alphamap
test is still leaking the alphamap pixmap, leading to mmap() failures
on cygwin

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
13 years agoPost-release version bump to 0.19.7
Søren Sandmann Pedersen [Wed, 20 Oct 2010 20:31:57 +0000 (16:31 -0400)]
Post-release version bump to 0.19.7

13 years agoPre-release version bump to 0.19.6
Søren Sandmann Pedersen [Wed, 20 Oct 2010 20:25:55 +0000 (16:25 -0400)]
Pre-release version bump to 0.19.6

13 years agoFix an overflow in the new radial gradient code
Andrea Canciani [Tue, 12 Oct 2010 13:38:20 +0000 (15:38 +0200)]
Fix an overflow in the new radial gradient code

huge-radial in the cairo test suite pointed out an undocumented
overflow in the radial gradient code.
By casting to pixman_fixed_48_16_t before doing the operations,
the overflow can be avoided.

13 years agoRemove the class field from source_image_t
Søren Sandmann Pedersen [Wed, 20 Oct 2010 20:09:44 +0000 (16:09 -0400)]
Remove the class field from source_image_t

The linear gradient was the only image type that relied on the class
being stored in the image struct itself. With the previous changes, it
doesn't need that anymore, so we can delete the field.

13 years agoRemove unused enum value
Andrea Canciani [Wed, 20 Oct 2010 19:24:32 +0000 (21:24 +0200)]
Remove unused enum value

The new linear gradient code doesn't use SOURCE_IMAGE_CLASS_VERTICAL
anymore and it was not used anywhere else.

13 years agoMake classification consistent with rasterization
Andrea Canciani [Mon, 18 Oct 2010 20:21:52 +0000 (22:21 +0200)]
Make classification consistent with rasterization

Use the same computations to classify the gradient and to
rasterize it.
This improves the correctness of the classification by
avoiding integer division.

13 years agoImprove precision of linear gradients
Andrea Canciani [Wed, 11 Aug 2010 07:58:05 +0000 (09:58 +0200)]
Improve precision of linear gradients

Integer division (without keeping the remainder) can discard a lot
of information. Doing the division maths in floating point (and
paying attention to error propagation) allows to greatly improve
the precision of linear gradients.

13 years agoAdd comments about errors
Andrea Canciani [Tue, 12 Oct 2010 07:52:53 +0000 (09:52 +0200)]
Add comments about errors

Explain how errors are introduced in the computation performed for
radial gradients.

13 years agoDraw radial gradients with PDF semantics
Andrea Canciani [Sun, 15 Aug 2010 07:07:33 +0000 (09:07 +0200)]
Draw radial gradients with PDF semantics

Change radial gradient computations and definition to reflect the
radial gradients in PDF specifications (see section 8.7.4.5.4,
Type 3 (Radial) Shadings of the PDF Reference Manual).

Instead of having a valid interpolation parameter value for every
point of the plane, define it only for points withing the area
covered by the family of circles generated by interpolating or
extrapolating the start and end circles.

Points outside this area are now transparent black (rgba 0 0 0 0).
Points within this area have the color assiciated with the maximum
value of the interpolation parameter in that point (if multiple
solutions exist within the range specified by the extend mode).

13 years agoPlug leak in the alphamap test.
Søren Sandmann Pedersen [Fri, 8 Oct 2010 11:44:20 +0000 (07:44 -0400)]
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

13 years agoAdd no-op combiners for DST and the CA versions of the HSL operators.
Søren Sandmann Pedersen [Wed, 6 Oct 2010 06:40:39 +0000 (02:40 -0400)]
Add no-op combiners for DST and the CA versions of the HSL operators.

We already exit early for DST, but for the HSL operators with
component alpha, we crash at the moment. Fix that by adding a dummy
combine_dst() function.

13 years agotest: Add some more colors to the color table in composite.c
Søren Sandmann Pedersen [Tue, 5 Oct 2010 15:05:25 +0000 (11:05 -0400)]
test: Add some more colors to the color table in composite.c

Specifically, add transparent black and superluminescent white with
alpha = 0.

13 years agotest: Parallize composite.c with OpenMP
Søren Sandmann Pedersen [Tue, 5 Oct 2010 13:49:45 +0000 (09:49 -0400)]
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.

13 years agotest: Change composite so that it tests randomly generated images
Søren Sandmann Pedersen [Sun, 7 Mar 2010 16:26:16 +0000 (11:26 -0500)]
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
13 years agotest: Fix eval_diff() so that it provides useful error values.
Søren Sandmann Pedersen [Sun, 7 Mar 2010 16:24:30 +0000 (11:24 -0500)]
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
13 years agotest: Fix bug in color_correct() in composite.c
Søren Sandmann Pedersen [Sun, 7 Mar 2010 15:31:04 +0000 (10:31 -0500)]
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
13 years agoRemove broken optimizations in combine_disjoint_over_u()
Søren Sandmann Pedersen [Tue, 5 Oct 2010 15:08:42 +0000 (11:08 -0400)]
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.

13 years agoARM: restore fallback to ARMv6 implementation from NEON in the delegate chain
Siarhei Siamashka [Mon, 4 Oct 2010 01:49:08 +0000 (04:49 +0300)]
ARM: restore fallback to ARMv6 implementation from NEON in the delegate chain

After fast path cache introduction, the overhead of having this fallback is
insignificant. On the other hand, some of the ARM assembly optimizations (for
example nearest neighbor scaling) do not need NEON.

13 years agoUse more unrolling for scaled src_0565_0565 with nearest filter
Siarhei Siamashka [Wed, 8 Sep 2010 06:30:23 +0000 (09:30 +0300)]
Use more unrolling for scaled src_0565_0565 with nearest filter

Benchmark from Intel Core i7 860:

    == before ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=1335.29 MPix/s

    == after ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=1550.96 MPix/s

    == performance of nonscaled src_0565_0565 operation as a reference ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=2401.31 MPix/s

Benchmark from ARM Cortex-A8:

    == before ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=81.79 MPix/s

    == after ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=89.55 MPix/s

    == performance of nonscaled src_0565_0565 operation as a reference ==
    op=1, src_fmt=10020565, dst_fmt=10020565, speed=197.44 MPix/s

13 years agoARM: added 'neon_composite_out_reverse_8_0565' fast path
Siarhei Siamashka [Thu, 23 Sep 2010 20:41:50 +0000 (23:41 +0300)]
ARM: added 'neon_composite_out_reverse_8_0565' fast path

== before ==

    outrev_8_0565 =  L1:  22.91  L2:  22.40  M: 18.75 ( 10.47%)
                     HT: 12.62   VT: 12.22   R: 11.32  RT:  5.30 (  58Kops/s)

== after ==

    outrev_8_0565 =  L1: 176.27  L2: 151.70  M:108.79 ( 60.81%)
                     HT: 50.43   VT: 37.16   R: 32.26  RT:  9.62 (  97Kops/s)

13 years agoARM: added 'neon_composite_add_0565_8_0565' fast path
Siarhei Siamashka [Thu, 23 Sep 2010 19:28:55 +0000 (22:28 +0300)]
ARM: added 'neon_composite_add_0565_8_0565' fast path

== before ==

    add_0565_8_0565 =  L1:  14.05  L2:  14.03  M: 11.57 ( 12.94%)
                       HT:  8.31   VT:  8.10   R:  7.47  RT:  3.64 (  42Kops/s)

== after ==

    add_0565_8_0565 =  L1: 123.36  L2:  94.70  M: 74.36 ( 83.15%)
                       HT: 31.17   VT:  23.97  R: 21.06  RT:  6.42 (  70Kops/s)

13 years agoARM: NEON: added forgotten cache preload for over_n_8888/over_n_0565
Siarhei Siamashka [Fri, 21 May 2010 13:31:03 +0000 (16:31 +0300)]
ARM: NEON: added forgotten cache preload for over_n_8888/over_n_0565

Prefetch provides up to 40-50% better performance when working
with large images and/or when having lots of L2 cache misses
on ARM Cortex-A8 @ 720MHz:

== before ==

    over_n_8888 =  L1: 225.83  L2: 181.02  M: 55.57 ( 41.41%)
                   HT: 38.96   VT: 36.92   R: 32.84  RT: 14.15 ( 123Kops/s)

    over_n_0565 =  L1: 153.91  L2: 149.69  M: 83.17 ( 30.95%)
                   HT: 50.41   VT: 49.15   R: 40.56  RT: 15.45 ( 131Kops/s)

== after ==

    over_n_8888 =  L1: 222.39  L2: 170.95  M: 76.86 ( 57.27%)
                   HT: 58.80   VT: 53.03   R: 45.51  RT: 14.13 ( 124Kops/s)

    over_n_0565 =  L1: 151.87  L2: 149.54  M:125.63 ( 46.80%)
                   HT: 67.85   VT: 57.54   R: 50.21  RT: 15.32 ( 130Kops/s)

13 years agoFix "syntax error: empty declaration" warnings.
Mika Yrjola [Fri, 1 Oct 2010 13:17:50 +0000 (16:17 +0300)]
Fix "syntax error: empty declaration" warnings.

These minor changes should fix a large number of
macro declaration - related "syntax error:  empty declaration" warnings
which are seen while compiling the code with the Solaris Studio
compiler.

13 years agoDelete simple repeat code
Søren Sandmann Pedersen [Tue, 28 Sep 2010 04:51:07 +0000 (00:51 -0400)]
Delete simple repeat code

This was supposedly an optimization, but it has pathological cases
where it definitely isn't. For example a 1 x n image will cause it to
have terrible memory access patterns and to generate a ton of modulus
operations.

Since no one has ever measured whether it actually is an improvement,
and since it is doing the repeating at the wrong the stage in the
pipeline, and since with the previous commit it can't be triggered
anymore because we now require SAMPLES_COVER_CLIP for regular fast
paths, just delete it.