Commit Graph

1635 Commits

Author SHA1 Message Date
Søren Sandmann Pedersen
6f62231d15 Remove "_raw_" from all the accessors.
There are no non-raw accessors anymore.
2010-08-08 13:57:40 -04:00
Søren Sandmann Pedersen
807fd3c084 Eliminate the store_scanline_{32,64} function pointers.
Now that we can't recurse on alpha maps, they are not needed anymore.
2010-08-08 13:57:40 -04:00
Søren Sandmann Pedersen
e213d5fd62 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.
2010-08-08 13:57:40 -04:00
Søren Sandmann Pedersen
cbb2a0d792 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.
2010-08-08 13:57:40 -04:00
Søren Sandmann Pedersen
6480c92312 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.
2010-08-08 13:57:40 -04:00
Søren Sandmann Pedersen
1cc750ed92 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.
2010-08-08 13:57:39 -04:00
Søren Sandmann Pedersen
5b289d39cf Extend scaling-crash-test in various ways
This extends scaling-crash-test to test some more things:

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

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

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

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

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

Finally, the test now allows the destination buffer to not be changed
at all. This allows pixman to simply bail out in cases where the
transformation too strange.
2010-08-08 13:57:39 -04:00
Søren Sandmann Pedersen
71ff55a3e5 Fix Altivec/OpenBSD patch
As Brad pointed out, I pushed the wrong version of this patch.
2010-08-05 19:00:56 -04:00
Brad Smith
cb50e9cc95 Add support for AltiVec detection for OpenBSD/PowerPC.
Bug 29331.
2010-08-05 12:16:40 -04:00
Søren Sandmann Pedersen
664132128e CODING_STYLE: Delete the stuff about trailing spaces
Also fix various other minor issues.
2010-08-04 09:50:30 -04:00
Søren Sandmann Pedersen
cc9221ce96 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.
2010-08-04 09:12:05 -04:00
Søren Sandmann Pedersen
b243a66041 Add x14r6g6b6 format to blitters-test 2010-08-04 08:58:51 -04:00
Marek Vasut
d6a7b15424 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>
2010-08-04 08:44:24 -04:00
Siarhei Siamashka
226a6df4f9 test: 'scaling-test' updated to provide better coverage
Negative scale factors are now also tested. A small additional
translate transform helps to stress the use of fractional
coordinates better.

Also the number of iterations to run by default increased in order
to compensate increased variety of operations to be tested.
2010-07-27 16:07:34 +03:00
Siarhei Siamashka
af3eeaeb13 test: 'scaling-crash-test' added
This test tries to exploit some corner cases and previously known
bugs in nearest neighbor scaling fast path code, attempting to
crash pixman or cause some other nasty effect.
2010-07-27 16:07:07 +03:00
Søren Sandmann Pedersen
90483fcabb bits: Fix potential divide-by-zero in projective code
If the homogeneous coordinate is 0, just set the coordinates to 0.
2010-07-23 19:16:43 -04:00
Søren Sandmann Pedersen
bf125fbbb7 [sse2] Add sse2_composite_add_n_8()
This shows up when epiphany displays the "ImageTest" on
glimr.rubyforge.org/cake/canvas.html
2010-07-22 07:39:49 -04:00
Søren Sandmann Pedersen
16ae3285e6 [sse2] Add sse2_composite_in_n_8()
This shows up when epiphany displays the "ImageTest" on
glimr.rubyforge.org/cake/canvas.html
2010-07-22 07:39:49 -04:00
Søren Sandmann Pedersen
e0b430a13e [sse2] Add sse2_composite_src_x888_8888()
This operation shows up when Firefox displays
http://dougx.net/plunder/plunder.html
2010-07-22 07:39:49 -04:00
Søren Sandmann Pedersen
16bae83475 [fast] Add fast_composite_src_x888_8888()
This shows up on when Firefox displays http://dougx.net/plunder/plunder.html
2010-07-22 07:39:49 -04:00
M Joonas Pihlaja
9399b1a5af Fix thinko in configure.ac's macro to test linking.
Copy-paste carnage.  Renames save_{cflags,libs,ldflags} to
save_{CFLAGS,LIBS,LDFLAGS}.
2010-07-21 23:52:23 +03:00
M Joonas Pihlaja
5537e51cd0 Avoid trailing slashes on automake install dirs.
The install-sh on a Solaris box couldn't copy with
trailing slashes.
2010-07-21 23:52:23 +03:00
M Joonas Pihlaja
1d9c6fa623 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.
2010-07-21 23:52:23 +03:00
M Joonas Pihlaja
d95ae70604 Check that the OpenMP pragmas don't cause link errors.
This patch adds extra guards around our use of
OpenMP pragmas and checks that the pragmas won't
cause link errors.  This fixes the build on
Tru64 and Solaris with the native compilers and clang.
2010-07-21 23:52:23 +03:00
M Joonas Pihlaja
eb247ac377 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
2010-07-21 23:52:22 +03:00
M Joonas Pihlaja
dbf35f1f27 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.
2010-07-21 23:52:22 +03:00
Søren Sandmann Pedersen
9897bb4eee 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.
2010-07-13 15:46:21 -04:00
Søren Sandmann Pedersen
ce3d9fca73 fast-path: Some formatting fixes
Add spaces before parentheses; fix indentation in the macro.
2010-07-12 09:46:37 -04:00
Søren Sandmann Pedersen
839326e471 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).
2010-07-12 09:46:37 -04:00
Søren Sandmann Pedersen
e13d9f9684 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.
2010-07-12 09:46:37 -04:00
Søren Sandmann Pedersen
2e7fb66553 When converting indexed formats to 64 bits, don't correct for channel widths
Indexed formats are mapped to a8r8g8b8 with full precision, so when
expanding we shouldn't correct for the width of the channels
2010-07-11 09:43:56 -04:00
Søren Sandmann Pedersen
2df6dac0be test: Make sure the palettes for indexed format roundtrip properly
The palettes for indexed formats must satisfy the condition that if
some index maps to a color C, then the 15 bit version of that color
must map back to the index. This ensures that the destination operator
is always a no-op, which seems like a reasonable assumption to make.
2010-07-11 09:43:56 -04:00
Søren Sandmann Pedersen
5dd59c8b7c Split the fast path caching into its own force_inline function
The do_composite() function is a lot more readable this way.
2010-07-11 09:43:56 -04:00
Søren Sandmann Pedersen
98d19d9abd 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.
2010-07-11 09:43:55 -04:00
Søren Sandmann Pedersen
f18bcf1f6e 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.
2010-07-11 09:43:55 -04:00
Søren Sandmann Pedersen
5c935473d8 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.
2010-07-10 21:05:27 -04:00
Søren Sandmann Pedersen
7114b2d63b 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.
2010-07-07 06:50:45 -04:00
Søren Sandmann Pedersen
a92e4a6a94 Minor tweaks to README 2010-07-06 19:15:29 -04:00
Søren Sandmann Pedersen
ca846806cb Store the conical angle in floating point radians, not fixed point degrees
This is a slight simplification.
2010-06-24 14:56:09 -04:00
Søren Sandmann Pedersen
3074d57b56 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.
2010-06-20 04:45:20 -04:00
Søren Sandmann Pedersen
66365b5ef1 Make separate gray scanline storers.
For gray formats the palettes are indexed by luminance, not RGB, so we
can't use the color storers for gray too.
2010-06-18 20:33:02 -04:00
Søren Sandmann Pedersen
4e1d4847c9 When storing a g1 pixel, store the lowest bit, rather than comparing with 0. 2010-06-18 20:33:02 -04:00
Andrea Canciani
445eb6385f test: verify that gradients do not crash pixman
Test gradients under particular conditions (no stops, all the stops
at the same offset) to check that pixman does not misbehave.
2010-06-09 17:30:41 +02:00
Andrea Canciani
de03202581 support single-stop gradients
Just like conical gradients, linear and radial gradients can now
have a single stop.
2010-06-09 17:30:41 +02:00
Søren Sandmann Pedersen
32bd31d677 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.
2010-06-09 07:17:59 -04:00
Jeff Muizelaar
78778e5963 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>
2010-06-03 23:18:16 +03:00
Robert Hooker
8814afc5fd Prepare changelog for upload 2010-05-14 13:06:08 -04:00
Robert Hooker
1773c6829c Bump changelogs. 2010-05-14 12:57:58 -04:00
Robert Hooker
c42434196b Merge branch 'upstream-experimental' into debian-experimental 2010-05-14 12:31:03 -04:00
Siarhei Siamashka
cfc4e38852 test: added OpenMP support for better utilization of multiple CPU cores
Some of the tests are quite heavy CPU users and may benefit from
using multiple CPU cores, so the programs from 'test' directory
are now built with OpenMP support. OpenMP is easy to use, portable
and also takes care of making a decision about how many threads
to spawn.
2010-05-13 21:04:55 +03:00