profile/ivi/pixman.git
13 years agoRename FAST_PATH_NO_WIDE_FORMAT to FAST_PATH_NARROW_FORMAT
Søren Sandmann Pedersen [Sun, 29 Aug 2010 21:03:01 +0000 (17:03 -0400)]
Rename FAST_PATH_NO_WIDE_FORMAT to FAST_PATH_NARROW_FORMAT

This avoids a negative in the name. Also, by renaming the "wide"
variable in pixman-general.c to "narrow" and fixing up the logic
correspondingly, the code there reads a lot more straightforwardly.

13 years agoUpdate and extend the alphamap test
Søren Sandmann Pedersen [Sun, 29 Aug 2010 20:59:02 +0000 (16:59 -0400)]
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).

13 years agoAdd fence_malloc() and fence_free().
Søren Sandmann Pedersen [Mon, 13 Sep 2010 18:34:34 +0000 (14:34 -0400)]
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().

13 years agoDo opacity computation with shifts instead of comparing with 0
Søren Sandmann Pedersen [Sun, 12 Sep 2010 08:35:08 +0000 (04:35 -0400)]
Do opacity computation with shifts instead of comparing with 0

Also add a COMPILE_TIME_ASSERT() macro and use it to assert that the
shift is correct.

13 years agoSSE2 optimization for scaled over_8888_8888 operation with nearest filter
Siarhei Siamashka [Wed, 8 Sep 2010 06:16:12 +0000 (09:16 +0300)]
SSE2 optimization for scaled over_8888_8888 operation with nearest filter

This is the first demo implementation, it should be possible to
generalize it later to cover more operations with less lines of code.

It should be also possible to introduce the use of '__builtin_constant_p'
gcc builtin function for an efficient way of checking if 'unit_x' is known
to be zero at compile time (when processing padding pixels for NONE, or
PAD repeat).

Benchmarks from Intel Core i7 860:

== before (nearest OVER) ==
op=3, src_fmt=20028888, dst_fmt=20028888, speed=142.01 MPix/s

== after (nearest OVER) ==
op=3, src_fmt=20028888, dst_fmt=20028888, speed=314.99 MPix/s

== performance of nonscaled operation as a reference ==
op=3, src_fmt=20028888, dst_fmt=20028888, speed=652.09 MPix/s

13 years agoNONE repeat support for fast scaling with nearest filter
Siarhei Siamashka [Thu, 16 Sep 2010 15:25:40 +0000 (18:25 +0300)]
NONE repeat support for fast scaling with nearest filter

Implemented very similar to PAD repeat.

And gcc also seems to be able to completely eliminate the
code responsible for left and right padding pixels for OVER
operation with NONE repeat.

13 years agoPAD repeat support for fast scaling with nearest filter
Siarhei Siamashka [Thu, 16 Sep 2010 14:10:40 +0000 (17:10 +0300)]
PAD repeat support for fast scaling with nearest filter

When processing pixels from the left and right padding, the same
scanline function is used with 'unit_x' set to 0.

Actually appears that gcc can handle this quite efficiently. When
using 'restrict' keyword, it is able to optimize the whole operation
performed on left or right padding pixels to a small unrolled loop
(the code is reduced to a simple fill implementation):

    9b30:       89 08                   mov    %ecx,(%rax)
    9b32:       89 48 04                mov    %ecx,0x4(%rax)
    9b35:       48 83 c0 08             add    $0x8,%rax
    9b39:       49 39 c0                cmp    %rax,%r8
    9b3c:       75 f2                   jne    9b30

Without 'restrict' keyword, there is one instruction more: reloading
source pixel data from memory in the beginning of each iteration. That
is slower, but also acceptable.

13 years agoIntroduce a fake PIXMAN_REPEAT_COVER constant
Siarhei Siamashka [Fri, 17 Sep 2010 13:22:25 +0000 (16:22 +0300)]
Introduce a fake PIXMAN_REPEAT_COVER constant

We need to implement a true PIXMAN_REPEAT_NONE support later (padding
the source with zero pixels). So it's better not to use PIXMAN_REPEAT_NONE
for handling FAST_PATH_SAMPLES_COVER_CLIP special case.

13 years agoNearest scaling fast path macro split into two parts
Siarhei Siamashka [Thu, 16 Sep 2010 10:02:18 +0000 (13:02 +0300)]
Nearest scaling fast path macro split into two parts

Scanline processing is now split into a separate function. This provides
an easy way of overriding it with a platform specific implementation,
which may use SIMD optimizations. Only basic C data types are used as
the arguments for this function, so it may be implemented entirely in
assembly or be generated by some JIT engine.

Also as a result of this split, the complexity of code is reduced a
bit and now it should be easier to introduce support for the currently
missing NONE, PAD and REFLECT repeat types.

13 years agoNearest scaling fast path macros moved to 'pixman-fast-path.h'
Siarhei Siamashka [Thu, 16 Sep 2010 09:31:27 +0000 (12:31 +0300)]
Nearest scaling fast path macros moved to 'pixman-fast-path.h'

These macros with some modifications can can be reused later by
various platform specific implementations, introducing SIMD
optimizations for nearest scaling fast paths.

13 years agoAdd FAST_PATH_NO_ALPHA_MAP to the standard destination flags.
Søren Sandmann Pedersen [Sun, 29 Aug 2010 20:26:45 +0000 (16:26 -0400)]
Add FAST_PATH_NO_ALPHA_MAP to the standard destination flags.

We can't in general take a fast path if the destination has an alpha
map.

13 years agotest: detection of possible floating point registers corruption
Siarhei Siamashka [Thu, 9 Sep 2010 09:02:59 +0000 (12:02 +0300)]
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.

13 years agoARM: added 'neon_composite_over_0565_8_0565' fast path
Siarhei Siamashka [Mon, 6 Sep 2010 22:15:57 +0000 (01:15 +0300)]
ARM: added 'neon_composite_over_0565_8_0565' fast path

13 years agoARM: helper macros for conversion between 8888/x888/0565 formats
Siarhei Siamashka [Mon, 6 Sep 2010 22:10:43 +0000 (01:10 +0300)]
ARM: helper macros for conversion between 8888/x888/0565 formats

13 years agoARM: common init/cleanup macro for saving/restoring NEON registers
Siarhei Siamashka [Mon, 6 Sep 2010 22:05:44 +0000 (01:05 +0300)]
ARM: common init/cleanup macro for saving/restoring NEON registers

This is a typical prologue/epilogue for many NEON fast path functions, so
it makes sense to provide common reusable macros for it in the header file.

13 years agoSilence some warnings about uninitialized variables
Søren Sandmann Pedersen [Thu, 2 Sep 2010 23:43:08 +0000 (19:43 -0400)]
Silence some warnings about uninitialized variables

Neither were real problems, but GCC was complaining about them.

13 years agoWhen pixman_compute_composite_region32() returns FALSE, don't fini the region.
Søren Sandmann Pedersen [Tue, 31 Aug 2010 04:30:54 +0000 (00:30 -0400)]
When pixman_compute_composite_region32() returns FALSE, don't fini the region.

The rule is that the region passed in must be initialized and that the
region returned will still be valid. Ie., the lifecycle is the
responsibility of the caller, regardless of what the function returns.

Previously, compute_composite_region32() would finalize the region and
then return FALSE, and then the caller would finalize the region
again, leading to memory corruption in some cases.

13 years agoStore a2b2g2r2 pixel through the WRITE macro
Søren Sandmann Pedersen [Mon, 30 Aug 2010 04:16:07 +0000 (00:16 -0400)]
Store a2b2g2r2 pixel through the WRITE macro

Otherwise, accessor functions won't work.

13 years agoARM: added 'neon_composite_over_8888_8_0565' fast path
Siarhei Siamashka [Mon, 23 Aug 2010 15:24:32 +0000 (18:24 +0300)]
ARM: added 'neon_composite_over_8888_8_0565' fast path

13 years agoAdd *.exe to .gitignore
Maarten Bosmans [Mon, 30 Aug 2010 06:55:00 +0000 (08:55 +0200)]
Add *.exe to .gitignore

13 years agoUse windows.h directly for mingw32 build
Maarten Bosmans [Sun, 29 Aug 2010 04:28:42 +0000 (06:28 +0200)]
Use windows.h directly for mingw32 build

This patch adresses the issue discussed in
http://lists.freedesktop.org/archives/pixman/2010-April/000163.html

There were only two clashing identifiers.  The first one is IN, which
obviously causes problems in Pixman for lines like

    PIXMAN_STD_FAST_PATH (IN, solid, a8, a8, fast_composite_in_n_8_8),

Fortunately the mingw headers provide a solution: by defining
_NO_W32_PSEUDO_MODIFIERS, these stupid symbols are skipped.

The other name is UINT64, used in pixman-mmx.c. I renamed that
function to to_uint64, but may be another name is more appropriate.

13 years agoBe more paranoid about checking for GTK+
Søren Sandmann Pedersen [Mon, 23 Aug 2010 13:27:38 +0000 (09:27 -0400)]
Be more paranoid about checking for GTK+

From time to time people run into issues where the configure script
detects GTK+ when it is either not installed, or not functional due to
a missing pixman. Most recently:

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

This patch makes the configure script more paranoid by

- always using PKG_CHECK_MODULES and not PKG_CHECK_EXISTS, since it
seems PKG_CHECK_EXISTS will sometimes return true even if a dependency
of GTK+, such as pixman-1, is missing.

- explicitly checking that pixman-1 is installed before enabling GTK+.

Cc: my.somewhat.lengthy.loginname@gmail.com
13 years agoMerge pixman_image_composite32() and do_composite().
Søren Sandmann Pedersen [Sun, 22 Aug 2010 15:09:45 +0000 (11:09 -0400)]
Merge pixman_image_composite32() and do_composite().

There is not much point having a separate function that just validates
the images. Also add a boolean return to lookup_composite_function()
so that we can return if no composite function is found.

13 years agoregion: Fix pixman_region_translate() clipping bug
Benjamin Otte [Mon, 23 Aug 2010 16:20:09 +0000 (18:20 +0200)]
region: Fix pixman_region_translate() clipping bug

Fixes the region-translate test case by clipping region translations to
the newly defined PIXMAN_REGION_MIN/MAX and using the newly introduced
type overflow_int_t to check for the overflow.
Also uses INT16_MAX or INT32_MAX for these values instead of relying on
the size of short and int types.

13 years agoregion: Add a new test region-translate
Benjamin Otte [Tue, 24 Aug 2010 10:17:18 +0000 (12:17 +0200)]
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.

13 years agoPost-release version bump to 0.19.3
Søren Sandmann Pedersen [Sat, 21 Aug 2010 10:39:44 +0000 (06:39 -0400)]
Post-release version bump to 0.19.3

13 years agoPre-release version bump to 0.19.2
Søren Sandmann Pedersen [Sat, 21 Aug 2010 10:33:19 +0000 (06:33 -0400)]
Pre-release version bump to 0.19.2

13 years agoOnly try to compute the FAST_SAMPLES_COVER_CLIP for bits images
Søren Sandmann Pedersen [Mon, 16 Aug 2010 11:24:48 +0000 (07:24 -0400)]
Only try to compute the FAST_SAMPLES_COVER_CLIP for bits images

It doesn't make sense in other cases, and the computation would make
use of image->bits.{width,height} which lead to uninitialized memory
accesses when the image wasn't of type BITS.

13 years agoIntroduce new FAST_PATH_SAMPLES_OPAQUE flag
Søren Sandmann Pedersen [Tue, 10 Aug 2010 00:54:49 +0000 (20:54 -0400)]
Introduce new FAST_PATH_SAMPLES_OPAQUE flag

This flag is set whenever the pixels of a bits image don't have an
alpha channel. Together with FAST_PATH_SAMPLES_COVER_CLIP it implies
that the image effectively is opaque, so we can do operator reductions
such as OVER->SRC.

13 years agopixman_image_set_alpha_map(): Disallow alpha map cycles
Søren Sandmann Pedersen [Wed, 4 Aug 2010 21:51:49 +0000 (17:51 -0400)]
pixman_image_set_alpha_map(): Disallow alpha map cycles

If someone tries to set an alpha map that itself has an alpha map,
simply return. Also, if someone tries to add an alpha map to an image
that is being _used_ as an alpha map, simply return.

This ensures that an alpha map can never have an alpha map.

13 years agoAdd alpha-loop test program
Søren Sandmann Pedersen [Wed, 4 Aug 2010 21:55:14 +0000 (17:55 -0400)]
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.

13 years agoARM: 'neon_combine_out_reverse_u' combiner
Siarhei Siamashka [Mon, 31 May 2010 16:24:43 +0000 (19:24 +0300)]
ARM: 'neon_combine_out_reverse_u' combiner

This operation was seen in mozilla browser profiling logs.
Implemented so that 'over' and 'out_reverse' operations
now reuse common parts of code.

13 years agoCode simplification (no need advancing 'vx' at the end of scanline)
Siarhei Siamashka [Fri, 19 Mar 2010 10:21:32 +0000 (12:21 +0200)]
Code simplification (no need advancing 'vx' at the end of scanline)

13 years agoStore the various bits image fetchers in a table with formats and flags.
Søren Sandmann Pedersen [Fri, 2 Jul 2010 18:14:21 +0000 (14:14 -0400)]
Store the various bits image fetchers in a table with formats and flags.

Similarly to how the fast paths are done, put the various bits_image
fetchers in a table, so that we can quickly find the best one based on
the image's flags and format.

13 years agoAdd some new FAST_PATH flags
Søren Sandmann Pedersen [Fri, 2 Jul 2010 16:53:56 +0000 (12:53 -0400)]
Add some new FAST_PATH flags

The flags are:

 *  AFFINE_TRANSFORM, for affine transforms

 *  Y_UNIT_ZERO, for when the 10 entry in the transformation is zero

 *  FILTER_BILINEAR, for when the image has a bilinear filter

 *  NO_NORMAL_REPEAT, for when the repeat mode is not NORMAL

 *  HAS_TRANSFORM, for when the transform is not NULL

Also add some new FAST_PATH_REPEAT_* macros. These are just shorthands
for the image not having any of the other repeat modes. For example
REPEAT_NORMAL is (NO_NONE | NO_PAD | NO_REFLECT).

13 years agoRemove "_raw_" from all the accessors.
Søren Sandmann Pedersen [Fri, 2 Jul 2010 16:45:44 +0000 (12:45 -0400)]
Remove "_raw_" from all the accessors.

There are no non-raw accessors anymore.

13 years agoEliminate the store_scanline_{32,64} function pointers.
Søren Sandmann Pedersen [Fri, 2 Jul 2010 16:34:42 +0000 (12:34 -0400)]
Eliminate the store_scanline_{32,64} function pointers.

Now that we can't recurse on alpha maps, they are not needed anymore.

13 years agoSplit bits_image_fetch_transformed() into two functions.
Søren Sandmann Pedersen [Fri, 2 Jul 2010 16:31:50 +0000 (12:31 -0400)]
Split bits_image_fetch_transformed() into two functions.

One function deals with the common affine, no-alpha-map case. The
other deals with perspective transformations and alpha maps.

13 years agoEliminate get_pixel_32() and get_pixel_64() from bits_image.
Søren Sandmann Pedersen [Fri, 2 Jul 2010 16:11:44 +0000 (12:11 -0400)]
Eliminate get_pixel_32() and get_pixel_64() from bits_image.

These functions can simply be passed as arguments to the various pixel
fetchers. We don't need to store them. Since they are known at compile
time and the pixel fetchers are force_inline, this is not a
performance issue.

Also temporarily make all pixel access go through the alpha path.

13 years agoEliminate recursion from alpha map code
Søren Sandmann Pedersen [Fri, 2 Jul 2010 15:58:23 +0000 (11:58 -0400)]
Eliminate recursion from alpha map code

Alpha maps with alpha maps are no longer supported. It's not a useful
feature and it could could lead to infinite recursion.

13 years agoReplace compute_src_extent_flags() with analyze_extents()
Søren Sandmann Pedersen [Thu, 22 Jul 2010 08:27:45 +0000 (04:27 -0400)]
Replace compute_src_extent_flags() with analyze_extents()

This commit fixes two separate problems: 1. Incorrect computation of
the FAST_PATH_SAMPLES_COVER_CLIP flag, and 2. FAST_PATH_16BIT_SAFE is
a nonsensical thing to compute.

== 1. Incorrect computation of SAMPLES_COVER_CLIP:

Previously we were using pixman_transform_bounds() to compute which
source samples would be used for a composite operation. This is
incorrect for several reasons:

(a) pixman_transform_bounds() is transforming the integer bounding box
of the destination samples, where it should be transforming the
bounding box of the samples themselves. In other words, it is too
pessimistic in some cases.

(b) pixman_transform_bounds() is not rounding the same way as we do
during sampling. For example, for a NEAREST filter we subtract
pixman_fixed_e before rounding off to the nearest sample so that a
transformed value of 1 will round to the sample at 0.5 and not to the
one at 1.5. However, pixman_transform_bounds() would simply truncate
to 1 which would imply that the first sample to be used was the one at
1.5. In other words, it is too optimistic in some cases.

(c) The result of pixman_transform_bounds() does not account for the
interpolation filter applied to the source.

== 2. FAST_PATH_16BIT_SAFE is nonsensical

The FAST_PATH_16BIT_SAFE is a flag that indicates that various
computations can be safely done within a 16.16 fixed-point
variable. It was used by certain fast paths who relied on those
computations succeeding. The problem is that many other compositing
functions were making similar assumptions but not actually requiring
the flag to be set. Notably, all the general compositing functions
simply walk the source region using 16.16 variables. If the
transformation happens to overflow, strange things will happen.

So instead of computing this flag in certain cases, it is better to
simply detect that overflows will happen and not try to composite at
all in that case. This has the advantage that most compositing
functions can be written naturally way.

It does have the disadvantage that we are giving up on some cases that
previously worked, but those are all corner cases where the areas
involved were very close to the limits of the coordinate
system. Relying on these working reliably was always a somewhat
dubious proposition. The most important case that might have worked
previously was untransformed compositing involving images larger than
32 bits. But even in those cases, if you had REPEAT_PAD or
REPEAT_REFLECT turned on, you would hit bits_image_fetch_transformed()
which has the 16 bit limitations.

== Fixes

This patch fixes both problems by introducing a new function called
analyze_extents() that has the responsibility to reject corner cases,
and to compute flags based on the extents.

It does this through a new compute_sample_extents() function that will
compute a conservative (but tight) approximation to the bounding box
of the samples that will actually be needed. By basing the computation
on the positions of the _sample_ locations in the destination, and by
taking the interpolation filter into account, it fixes problem one.

The same function is also used with a one-pixel expanded version of
the destination extents. By checking if the transformed bounding box
will overflow 16.16 fixed point, it fixes problem two.

13 years agoExtend scaling-crash-test in various ways
Søren Sandmann Pedersen [Wed, 28 Jul 2010 06:11:08 +0000 (02:11 -0400)]
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.

13 years agoFix Altivec/OpenBSD patch
Søren Sandmann Pedersen [Thu, 5 Aug 2010 23:00:56 +0000 (19:00 -0400)]
Fix Altivec/OpenBSD patch

As Brad pointed out, I pushed the wrong version of this patch.

13 years agoAdd support for AltiVec detection for OpenBSD/PowerPC.
Brad Smith [Sat, 31 Jul 2010 09:07:02 +0000 (05:07 -0400)]
Add support for AltiVec detection for OpenBSD/PowerPC.

Bug 29331.

13 years agoCODING_STYLE: Delete the stuff about trailing spaces
Søren Sandmann Pedersen [Wed, 4 Aug 2010 13:50:30 +0000 (09:50 -0400)]
CODING_STYLE: Delete the stuff about trailing spaces

Also fix various other minor issues.

13 years agoIf we bail out of do_composite, make sure to undo any workarounds.
Søren Sandmann Pedersen [Wed, 28 Jul 2010 07:17:35 +0000 (03:17 -0400)]
If we bail out of do_composite, make sure to undo any workarounds.

The workaround for an old X bug has to be undone if we bail from
do_composite, so we can't just return.

13 years agoAdd x14r6g6b6 format to blitters-test
Søren Sandmann Pedersen [Wed, 4 Aug 2010 12:58:51 +0000 (08:58 -0400)]
Add x14r6g6b6 format to blitters-test

13 years agoAdd support for 32bpp X14R6G6B6 format.
Marek Vasut [Sun, 1 Aug 2010 00:18:52 +0000 (02:18 +0200)]
Add support for 32bpp X14R6G6B6 format.

This format is used on PXA framebuffer with some boards. It uses only 18 bits
from the 32 bit framebuffer to interpret color.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
13 years agotest: 'scaling-test' updated to provide better coverage
Siarhei Siamashka [Wed, 14 Jul 2010 13:43:16 +0000 (16:43 +0300)]
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.

13 years agotest: 'scaling-crash-test' added
Siarhei Siamashka [Mon, 19 Jul 2010 17:25:05 +0000 (20:25 +0300)]
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.

13 years agobits: Fix potential divide-by-zero in projective code
Søren Sandmann Pedersen [Fri, 16 Jul 2010 03:40:28 +0000 (23:40 -0400)]
bits: Fix potential divide-by-zero in projective code

If the homogeneous coordinate is 0, just set the coordinates to 0.

14 years ago[sse2] Add sse2_composite_add_n_8()
Søren Sandmann Pedersen [Mon, 26 Apr 2010 00:25:50 +0000 (20:25 -0400)]
[sse2] Add sse2_composite_add_n_8()

This shows up when epiphany displays the "ImageTest" on
glimr.rubyforge.org/cake/canvas.html

14 years ago[sse2] Add sse2_composite_in_n_8()
Søren Sandmann Pedersen [Sun, 25 Apr 2010 23:54:28 +0000 (19:54 -0400)]
[sse2] Add sse2_composite_in_n_8()

This shows up when epiphany displays the "ImageTest" on
glimr.rubyforge.org/cake/canvas.html

14 years ago[sse2] Add sse2_composite_src_x888_8888()
Søren Sandmann Pedersen [Tue, 13 Jul 2010 04:31:35 +0000 (00:31 -0400)]
[sse2] Add sse2_composite_src_x888_8888()

This operation shows up when Firefox displays
http://dougx.net/plunder/plunder.html

14 years ago[fast] Add fast_composite_src_x888_8888()
Søren Sandmann Pedersen [Tue, 13 Jul 2010 04:08:10 +0000 (00:08 -0400)]
[fast] Add fast_composite_src_x888_8888()

This shows up on when Firefox displays http://dougx.net/plunder/plunder.html

14 years agoFix thinko in configure.ac's macro to test linking.
M Joonas Pihlaja [Wed, 14 Jul 2010 06:51:27 +0000 (09:51 +0300)]
Fix thinko in configure.ac's macro to test linking.

Copy-paste carnage.  Renames save_{cflags,libs,ldflags} to
save_{CFLAGS,LIBS,LDFLAGS}.

14 years agoAvoid trailing slashes on automake install dirs.
M Joonas Pihlaja [Sun, 11 Jul 2010 16:59:01 +0000 (19:59 +0300)]
Avoid trailing slashes on automake install dirs.

The install-sh on a Solaris box couldn't copy with
trailing slashes.

14 years agoCheck for specific flags by actually trying to compile and link.
M Joonas Pihlaja [Sat, 10 Jul 2010 12:36:41 +0000 (15:36 +0300)]
Check for specific flags by actually trying to compile and link.

Instead of relying on preprocessor version checks to see if a
some compiler flags are supported, actually try to compile and
link a test program with the flags.

14 years agoCheck that the OpenMP pragmas don't cause link errors.
M Joonas Pihlaja [Sat, 10 Jul 2010 01:41:01 +0000 (02:41 +0100)]
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.

14 years agoDon't trust OpenBSD's gcc to produce working code for __thread.
M Joonas Pihlaja [Fri, 9 Jul 2010 09:09:07 +0000 (12:09 +0300)]
Don't trust OpenBSD's gcc to produce working code for __thread.

The gcc on OpenBSD 4.5 to 4.7 at least produces bad code for __thread,
without as much as a warning.

See PR #6410 "Using __thread TLS variables compiles ok but segfault at runtime."

http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=6410

14 years agoTry harder to find suitable flags for pthreads.
M Joonas Pihlaja [Fri, 9 Jul 2010 09:07:35 +0000 (12:07 +0300)]
Try harder to find suitable flags for pthreads.

The flags -D_REENTRANT -lpthread work on more systems than
does -pthread unfortunately, so give that a go too.

14 years agoCheck for read accessors before taking the bilinear fast path
Søren Sandmann Pedersen [Mon, 12 Jul 2010 19:13:49 +0000 (15:13 -0400)]
Check for read accessors before taking the bilinear fast path

The bilinear fast path accesses pixels directly, so if the image has a
read accessor, then it can't be used.

14 years agofast-path: Some formatting fixes
Søren Sandmann Pedersen [Sun, 11 Jul 2010 23:58:49 +0000 (19:58 -0400)]
fast-path: Some formatting fixes

Add spaces before parentheses; fix indentation in the macro.

14 years agoIn the FAST_NEAREST macro call the function 8888_8888 and not x888_x888
Søren Sandmann Pedersen [Sun, 11 Jul 2010 23:57:29 +0000 (19:57 -0400)]
In the FAST_NEAREST macro call the function 8888_8888 and not x888_x888

The x888 suggests that they have something to do with the x8r8g8b8
formats, but that's not the case; they are assuming a8r8g8b8
formats. (Although in some cases they also work for x8r8g8b8 type
formats).

14 years agoMake the repeat mode explicit in the FAST_NEAREST macro.
Søren Sandmann Pedersen [Sun, 11 Jul 2010 23:45:22 +0000 (19:45 -0400)]
Make the repeat mode explicit in the FAST_NEAREST macro.

Before, it was 0 or 1 meaning 'no repeat' and 'normal repeat'
respectively. Now we explicitly pass in either NONE or NORMAL.

14 years agoWhen converting indexed formats to 64 bits, don't correct for channel widths
Søren Sandmann Pedersen [Sun, 11 Jul 2010 00:47:01 +0000 (20:47 -0400)]
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

14 years agotest: Make sure the palettes for indexed format roundtrip properly
Søren Sandmann Pedersen [Sat, 10 Jul 2010 22:40:06 +0000 (18:40 -0400)]
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.

14 years agoSplit the fast path caching into its own force_inline function
Søren Sandmann Pedersen [Sat, 10 Jul 2010 20:49:51 +0000 (16:49 -0400)]
Split the fast path caching into its own force_inline function

The do_composite() function is a lot more readable this way.

14 years agoCache the implementation along with the fast paths.
Søren Sandmann Pedersen [Sat, 10 Jul 2010 20:08:51 +0000 (16:08 -0400)]
Cache the implementation along with the fast paths.

When calling a fast path, we need to pass the corresponding
implementation since it might contain information necessary to run the
fast path.

14 years agoHide the global implementation variable behind a force_inline function.
Søren Sandmann Pedersen [Sat, 10 Jul 2010 19:47:12 +0000 (15:47 -0400)]
Hide the global implementation variable behind a force_inline function.

Previously the global variable was called 'imp' which was confusing
with the argument to various other functions also being called imp.

14 years agoFix memory leak in the pthreads thread local storage code
Søren Sandmann Pedersen [Wed, 30 Jun 2010 06:31:10 +0000 (02:31 -0400)]
Fix memory leak in the pthreads thread local storage code

When a thread exits, we leak whatever is stored in thread local
variables, so install a destructor to free it.

14 years agoMake the combiner macros less likely to cause name collisions.
Søren Sandmann Pedersen [Thu, 1 Jul 2010 20:54:30 +0000 (16:54 -0400)]
Make the combiner macros less likely to cause name collisions.

Protect the arguments to the combiner macros with parentheses, and
postfix their temporary variables with underscores to avoid name space
collisions with the surrounding code.

Alexander Shulgin pointed out that underscore-prefixed identifiers are
reserved for the C implementation, so we use postfix underscores
instead.

14 years agoMinor tweaks to README
Søren Sandmann Pedersen [Mon, 21 Jun 2010 19:30:46 +0000 (15:30 -0400)]
Minor tweaks to README

14 years agoStore the conical angle in floating point radians, not fixed point degrees
Søren Sandmann Pedersen [Sun, 20 Jun 2010 17:12:27 +0000 (13:12 -0400)]
Store the conical angle in floating point radians, not fixed point degrees

This is a slight simplification.

14 years agoFix conical gradients to match QConicalGradient from Qt
Søren Sandmann Pedersen [Sat, 19 Jun 2010 22:57:45 +0000 (18:57 -0400)]
Fix conical gradients to match QConicalGradient from Qt

Under the assumption that pixman gradients are supposed to match
QConicalgradient, described here:

        http://doc.trolltech.com/4.4/qconicalgradient.html

this patch fixes two separate bugs in pixman-conical-gradient.c.

The first bug is that the output of atan2() is in the range of [-pi,
pi], which means the parameter into the gradient can be negative. This
is wrong since a QConicalGradient always interpolates around the
center from 0 to 1. The fix for that is to (a) make sure the given
angle is between 0 and 360, and (b) add or subtract 2 * M_PI if the
computed angle ends up outside [0, 2 * pi].

The other bug is that we were interpolating clockwise, whereas
QConicalGradient calls for a counter-clockwise interpolation. This is
easily fixed by subtracting the parameter from 1.

Finally, this patch encapsulates the computation in a new force-inline
function so that it can be reused in both the affine and non-affine
case.

14 years agoMake separate gray scanline storers.
Søren Sandmann Pedersen [Sun, 30 May 2010 22:26:28 +0000 (18:26 -0400)]
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.

14 years agoWhen storing a g1 pixel, store the lowest bit, rather than comparing with 0.
Søren Sandmann Pedersen [Sun, 30 May 2010 20:52:09 +0000 (16:52 -0400)]
When storing a g1 pixel, store the lowest bit, rather than comparing with 0.

14 years agotest: verify that gradients do not crash pixman
Andrea Canciani [Wed, 9 Jun 2010 14:35:37 +0000 (16:35 +0200)]
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.

14 years agosupport single-stop gradients
Andrea Canciani [Tue, 8 Jun 2010 18:36:15 +0000 (20:36 +0200)]
support single-stop gradients

Just like conical gradients, linear and radial gradients can now
have a single stop.

14 years agoEliminate mask_bits from all the scanline fetchers.
Søren Sandmann Pedersen [Wed, 19 May 2010 02:27:46 +0000 (22:27 -0400)]
Eliminate mask_bits from all the scanline fetchers.

Back in the day, the mask_bits argument was used to distinguish
between masks used for component alpha (where it was 0xffffffff) and
masks for unified alpha (where it was 0xff000000). In this way, the
fetchers could check if just the alpha channel was 0 and in that case
avoid fetching the source.

However, we haven't actually used it like that for a long time; it is
currently always either 0xffffffff or 0 (if the mask is NULL). It also
doesn't seem worthwhile resurrecting it because for premultiplied
buffers, if alpha is 0, then so are the color channels
normally.

This patch eliminates the mask_bits and changes the fetchers to just
assume it is 0xffffffff if mask is non-NULL.

14 years agocreate getter for component alpha
Jeff Muizelaar [Mon, 15 Mar 2010 12:56:38 +0000 (14:56 +0200)]
create getter for component alpha

This patch comes from the mozilla central tree. See
http://hg.mozilla.org/mozilla-central/rev/89338a224278 for the
original changeset.

Signed-off-by: Jeff Muizelaar <jmuizelaar@mozilla.com>
Signed-off-by: Egor Starkov <egor.starkov@nokia.com>
Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Signed-off-by: Siarhei Siamashka <siarhei.siamashka@nokia.com>
14 years agotest: added OpenMP support for better utilization of multiple CPU cores
Siarhei Siamashka [Tue, 11 May 2010 22:34:57 +0000 (01:34 +0300)]
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.

14 years agotest: scaling-test updated to use new fuzzer_test_main() function
Siarhei Siamashka [Tue, 11 May 2010 21:10:04 +0000 (00:10 +0300)]
test: scaling-test updated to use new fuzzer_test_main() function

14 years agotest: blitters-test updated to use new fuzzer_test_main() function
Siarhei Siamashka [Tue, 11 May 2010 20:21:05 +0000 (23:21 +0300)]
test: blitters-test updated to use new fuzzer_test_main() function

14 years agotest: blitters-test-bisect.rb converted to perl
Siarhei Siamashka [Tue, 11 May 2010 19:57:48 +0000 (22:57 +0300)]
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.

14 years agotest: main loop from blitters-test added as a new function to utils.c
Siarhei Siamashka [Tue, 11 May 2010 19:46:47 +0000 (22:46 +0300)]
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).

14 years agoMerge branch 'for-master'
Søren Sandmann Pedersen [Sun, 9 May 2010 18:24:24 +0000 (14:24 -0400)]
Merge branch 'for-master'

14 years agotest/gtk-utils: Set the size of the window to the size of the image
Søren Sandmann Pedersen [Wed, 5 May 2010 22:05:40 +0000 (01:05 +0300)]
test/gtk-utils: Set the size of the window to the size of the image

14 years agoAdd support for compiling pixman without thread/tls support
Jeff Muizelaar [Tue, 4 May 2010 15:55:30 +0000 (11:55 -0400)]
Add support for compiling pixman without thread/tls support

14 years agoAdd macros for thread local storage on MinGW 32
Søren Sandmann Pedersen [Sat, 24 Apr 2010 22:43:38 +0000 (18:43 -0400)]
Add macros for thread local storage on MinGW 32

These macros are identical to the ones that Tor Lillqvist posted here:

    http://lists.freedesktop.org/archives/pixman/2010-April/000160.html

with one exception: the variable is allocated with calloc() and not
malloc().

Cc: tml@iki.fi
14 years agoDon't use __thread on MinGW.
Søren Sandmann Pedersen [Fri, 23 Apr 2010 16:34:19 +0000 (12:34 -0400)]
Don't use __thread on MinGW.

It is apparently broken. See this:

http://mingw-users.1079350.n2.nabble.com/gcc-4-4-multi-threaded-exception-handling-thread-specifier-not-working-td3440749.html

We'll need to support thread local storage on MinGW32 some other way.

Cc: tml@iki.fi
14 years agoAdd support for 8bpp to pixman_fill_sse2()
Søren Sandmann Pedersen [Mon, 29 Mar 2010 03:02:43 +0000 (23:02 -0400)]
Add support for 8bpp to pixman_fill_sse2()

14 years agosse2: Add sse2_composite_over_reverse_n_8888
Søren Sandmann Pedersen [Sat, 24 Apr 2010 17:11:50 +0000 (13:11 -0400)]
sse2: Add sse2_composite_over_reverse_n_8888

This is a small speed-up for the poppler benchmark:

Before:
[ # ]  backend                         test   min(s) median(s) stddev. count
[  0]    image                      poppler    4.443    4.474   0.31%    6/6

After:
[ # ]  backend                         test   min(s) median(s) stddev. count
[  0]    image                      poppler    4.224    4.248   0.42%    6/6

14 years agoDon't consider indexed formats opaque.
Søren Sandmann Pedersen [Sat, 24 Apr 2010 19:15:05 +0000 (15:15 -0400)]
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.

14 years agoAdd an over_8888_8888_8888 sse2 fast path.
Søren Sandmann Pedersen [Thu, 25 Feb 2010 00:21:50 +0000 (19:21 -0500)]
Add an over_8888_8888_8888 sse2 fast path.

14 years agoAdd pixman_region{,32}_intersect_rect()
Søren Sandmann Pedersen [Wed, 18 Feb 2009 04:03:25 +0000 (23:03 -0500)]
Add pixman_region{,32}_intersect_rect()

14 years agoRename fast_composite_src_8888_x888 to fast_composite_src_memcpy()
Søren Sandmann Pedersen [Wed, 22 Jul 2009 00:52:26 +0000 (20:52 -0400)]
Rename fast_composite_src_8888_x888 to fast_composite_src_memcpy()

Then generalize it and use it for SRC copying between various
identical formats.

14 years agoAdd missing HAVE_CONFIG_H guards for config.h inclusion
Jeff Muizelaar [Tue, 27 Apr 2010 19:23:20 +0000 (15:23 -0400)]
Add missing HAVE_CONFIG_H guards for config.h inclusion

14 years agoRemove alphamap from the GTK+ part of tests/Makefile.am
Søren Sandmann Pedersen [Thu, 22 Apr 2010 16:14:23 +0000 (12:14 -0400)]
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.

14 years agoAdd pixman_image_get_format() accessor
Søren Sandmann Pedersen [Wed, 21 Apr 2010 13:59:29 +0000 (09:59 -0400)]
Add pixman_image_get_format() accessor