Commit Graph

2394 Commits

Author SHA1 Message Date
Matt Turner
3124a51abb build: Remove useless DEP_CFLAGS/DEP_LIBS variables 2012-09-15 23:46:21 -07:00
Andrea Canciani
46e4faf8ef build: Improve win32 build system
Handle cross-directory dependencies using PHONY targets and clean up
some redundancies.
2012-09-15 07:49:53 +02:00
Andrea Canciani
c89efdd211 mmx: Fix x86 build on MSVC
The MSVC compiler is very strict about variable declarations after
statements.

Move all the declarations of each block before any statement in
the same block to fix multiple instances of:

pixman-mmx.c(xxxx) : error C2275: '__m64' : illegal use of this type
as an expression
2012-09-15 07:49:52 +02:00
Søren Sandmann Pedersen
1e3e569b04 test/utils.c: Use pow(), not powf() in sRGB conversion routines
These functions are operating on double precision values, so use pow()
instead of powf().
2012-08-29 15:05:49 -04:00
Søren Sandmann Pedersen
8577daba04 pixel_checker: Move sRGB conversion into get_limits()
The sRGB conversion has to be done every time the limits are being
computed. Without this fix, pixel_checker_get_min/max() will produce
the wrong results when called from somewhere other than
pixel_checker_check().
2012-08-26 18:13:47 -04:00
Søren Sandmann Pedersen
62eb6e5e05 Remove obsolete TODO file 2012-08-25 17:17:24 -04:00
Søren Sandmann Pedersen
384846b38c Remove pointless declaration of _pixman_image_get_scanline_generic_64()
This declaration used to be necessary when
_pixman_image_get_scanline_generic_64() referred to a structure that
itself referred back to _pixman_image_get_scanline_generic_64().
2012-08-19 13:45:21 -04:00
Søren Sandmann Pedersen
09cb1ae10b demos: Add srgb_trap_test.c
This demo program composites a bunch of trapezoids side by side with
and without gamma aware compositing.
2012-08-09 11:24:37 -04:00
Søren Sandmann Pedersen
04e878c231 Make show_image() cope with more formats
This makes show_image() deal with more formats than just a8r8g8b8, in
particular, a8r8g8b8_sRGB can now be handled.

Images that are passed to show_image with a format of a8r8g8b8_sRGB
are displayed without modification under the assumption that the
monitor is approximately sRGB.

Images with a format of a8r8g8b8 are also displayed without
modification since many other users of show_image() have been
generating essentially sRGB data with this format. Other formats are
also assumed to be gamma compressed; these are converted to a8r8g8b8
before being displayed.

With these changes, srgb-test.c doesn't need to do its own conversion
anymore.
2012-08-09 11:24:37 -04:00
Søren Sandmann Pedersen
8db9ec9814 Define TIMER_BEGIN and TIMER_END even when timers are not enabled
This allows code that uses these macros to build when timers are
disabled.
2012-08-09 11:23:45 -04:00
Søren Sandmann Pedersen
da5268cc19 Post-release version bump to 0.27.3 2012-08-01 15:56:13 -04:00
Søren Sandmann Pedersen
e8ddef78b6 Pre-release version bump to 0.27.2 2012-08-01 15:22:57 -04:00
Sebastian Bauer
c214ca51a0 Use angle brackets form of including config.h 2012-08-01 15:21:51 -04:00
Sebastian Bauer
98617b3796 Added HAVE_CONFIG_H check before including config.h 2012-08-01 15:21:51 -04:00
Søren Sandmann Pedersen
5b0563f39e glyph-test: Avoid setting solid images as alpha maps.
glyph-test would sometimes set a solid image as an alpha map, which is
not allowed. When this happened and the debug spew was enabled,
messages like this one would be generated:

    *** BUG ***
    In pixman_image_set_alpha_map: The expression
            !alpha_map || alpha_map->type == BITS was false
    Set a breakpoint on '_pixman_log_error' to debug

Fix this by not passing the ALLOW_SOLID flag to create_image() when
the resulting is to be used as an alpha map.
2012-07-31 23:51:53 -04:00
Søren Sandmann Pedersen
38fe7cd7be stress-test: Avoid overflows in clip rectangles
The rectangles in the clip region set in set_general_properties()
would sometimes overflow, which would lead to messages like these:

      *** BUG ***
      In pixman_region32_union_rect: Invalid rectangle passed
      Set a breakpoint on '_pixman_log_error' to debug

when the micro version number of pixman is even.

Fix this by detecting the overflow and clamping such that the x2/y2
coordinates are less than INT32_MAX.
2012-07-31 23:51:53 -04:00
Søren Sandmann Pedersen
24d83cbf3d Add make-srgb.pl to EXTRA_DIST
Otherwise make distcheck doesn't pass.
2012-07-31 23:51:52 -04:00
Antti S. Lankila
72ba0b9555 Add tests to validate new sRGB behavior
Composite checks random combinations of operations that now also have
sRGB sources, masks and destinations, and stress-test validates the
read/write primitives.
2012-07-30 15:44:38 -04:00
Antti S. Lankila
a161a6ba23 Add sRGB blending demo program
Simple sRGB color blender test can be used to determine if the sRGB processing
works as expected. It blends alpha ramps of purple and green together such that
at midpoint of image, 50 % blend of both is realized. At that point, sRGB-aware
processing yields a result close to #bbb rather than #888, which is the linear
light blending result.

The demo also contains the sample computation for sRGB premultiplied alpha.
2012-07-30 15:40:16 -04:00
Antti S. Lankila
7460457f80 Add support for sRGB surfaces
sRGB format is defined as a new format type, PIXMAN_TYPE_ARGB_SRGB. One form of
this type is provided, PIXMAN_a8r8g8b8_sRGB. Use of an sRGB format triggers
wide processing, and the pixel fetch/store functions handle the relevant
conversion between color spaces. Pixman itself is thought to compose in the
linearized sRGB color space.

sRGB conversion is tabularized. For sRGB to linear, we are using only 256
values because the current source format uses 8 bits per component precision.
For linear to sRGB, it turns out that only 4096 brightness levels are required
to generate all of the 256 sRGB color values, and therefore only 12 bits per
component are considered during store. As a special case, a no-op
sRGB->linear->sRGB conversion is constructed to be lossless by adjusting the
sRGB->linear conversion table where necessary.
2012-07-30 15:37:26 -04:00
Antti S. Lankila
1dcca0f7ae Remove unnecessary dst initialization
The initialization work is already performed correctly in image_init().
2012-07-29 11:01:11 -04:00
Cyril Brulebois
1713a099d6 Upload to unstable. 2012-06-27 12:11:58 +02:00
Cyril Brulebois
9026e61d84 Disable loongson2f optimizations, fix FTBFS on mipsel. 2012-06-27 11:21:54 +02:00
Søren Sandmann Pedersen
56321eff65 Make pixman-mmx.c compile on x86-32 without optimization
When not optimizing, write _mm_shuffle_pi16() as a statement
expression with inline assembly. That way we avoid
__builtin_ia32_pshufw(), which is only available when compiling with
-msse, while still allowing the non-optimizing gcc to understand that
the second argument is a compile time constant.

Tested-by: Knut Petersen <knut_petersen@t-online.de>
2012-06-20 02:53:31 -04:00
Søren Sandmann Pedersen
0c81957e9b Cleanups and simplifications in x86 CPU feature detection
A new function pixman_cpuid() is added that runs the cpuid instruction
and returns the results. On GCC this function uses inline assembly; on
MSVC, the function calls the __cpuid intrinsic.

There is also a new function called have_cpuid() which detects whether
cpuid is available. On x86-64 and MSVC, it simply returns TRUE; on
x86-32 bit, it checks whether the 22nd bit of eflags can be
modified. On MSVC this does have the consequence that pixman will no
longer work CPUS without cpuid (ie., older than 486 and some 486
models).

These two functions together makes it possible to write a generic
detect_cpu_features() in plain C. This function is then used in a new
have_feature() function that checks whether a specific set of feature
bits is available.

Aside from the cleanups and simplifications, the main benefit from
this patch is that pixman now can do feature detection on x86-64, so
that newer instruction sets such as SSSE3 and SSE4.1 can be used. (And
apparently the assumption that x86-64 CPUs always have MMX and SSE2 is
no longer correct: Knight's Corner is x86-64, but doesn't have them).

V2: Rename the constants in the getisax() code, as pointed out by Alan
Coopersmith. Also reinstate the result variable and initialize
features to 0.

V3: Fixes for the fact that the upper 32 bits of a 64 bit register are
zeroed whenever the corresponding 32 bit register is written to.

V4: Fixes for the fact that in 32 bit mode, when gcc is not optimizing
there were not enough registers available. The new code uses the "a",
"b", "c", and "d" constraints instead, and has two separate versions
for 32 and 64 bit modes.
2012-06-20 02:51:04 -04:00
Sebastian Bauer
4d641c3803 Changed the style of two function headers
Declare functions *_inverse() and *_contains_rectangle() in the same
way as the other functions are declared. This doesn't imply any semantic
changes. It's just a unification of coding styles.
2012-07-08 18:49:24 -04:00
Nemanja Lukic
86ad09b548 MIPS: DSPr2: Added more bilinear fast paths (without mask)
Performance numbers before/after on MIPS-74kc @ 1GHz:

lowlevel-blt-bench -b

Referent (before):
  src_8888_8888 =  L1:   8.18  L2:   7.79  M:  6.32 ( 33.51%)  HT:  5.78  VT:  5.70  R:  5.61  RT:  3.79 (  29Kops/s)
  src_8888_0565 =  L1:   6.90  L2:   7.14  M:  6.47 ( 25.75%)  HT:  5.54  VT:  5.51  R:  5.46  RT:  3.53 (  28Kops/s)
  src_0565_x888 =  L1:   3.76  L2:   3.71  M:  3.37 ( 13.41%)  HT:  3.26  VT:  3.22  R:  3.20  RT:  2.58 (  23Kops/s)
  src_0565_0565 =  L1:   3.59  L2:   3.56  M:  3.47 (  9.19%)  HT:  3.19  VT:  3.18  R:  3.16  RT:  2.46 (  22Kops/s)
 over_8888_8888 =  L1:   5.99  L2:   5.66  M:  4.95 ( 26.28%)  HT:  4.40  VT:  4.38  R:  4.31  RT:  3.02 (  26Kops/s)
  add_8888_8888 =  L1:   6.84  L2:   6.39  M:  5.48 ( 29.09%)  HT:  4.80  VT:  4.79  R:  4.70  RT:  3.20 (  27Kops/s)

Optimized:
  src_8888_8888 =  L1:  18.27  L2:  16.69  M: 12.87 ( 68.25%)  HT: 11.80  VT: 11.61  R: 10.60  RT:  7.05 (  41Kops/s)
  src_8888_0565 =  L1:  15.18  L2:  14.10  M: 11.75 ( 46.71%)  HT: 10.64  VT: 10.50  R: 10.03  RT:  7.15 (  41Kops/s)
  src_0565_x888 =  L1:  10.45  L2:   9.96  M:  9.23 ( 36.72%)  HT:  8.39  VT:  8.29  R:  8.02  RT:  5.75 (  37Kops/s)
  src_0565_0565 =  L1:   9.37  L2:   8.98  M:  8.50 ( 22.53%)  HT:  7.71  VT:  7.66  R:  7.52  RT:  5.59 (  37Kops/s)
 over_8888_8888 =  L1:  12.21  L2:  11.01  M:  8.56 ( 45.36%)  HT:  7.71  VT:  7.64  R:  7.43  RT:  5.51 (  36Kops/s)
  add_8888_8888 =  L1:  17.72  L2:  15.16  M: 10.78 ( 57.13%)  HT:  9.46  VT:  9.30  R:  9.00  RT:  6.03 (  38Kops/s)
2012-07-08 21:38:14 +03:00
Nemanja Lukic
707a8be112 MIPS: DSPr2: Added several bilinear fast paths with a8 mask
Performance numbers before/after on MIPS-74kc @ 1GHz:

lowlevel-blt-bench -b

Referent (before):

  src_8888_8_8888 =  L1:   6.37  L2:   6.08  M:  5.46 ( 32.57%)  HT:  4.64  VT:  4.61  R:  4.52  RT:  2.85 (  23Kops/s)
  src_8888_8_0565 =  L1:   5.89  L2:   5.66  M:  5.11 ( 23.71%)  HT:  4.36  VT:  4.34  R:  4.26  RT:  2.71 (  22Kops/s)
  src_0565_8_x888 =  L1:   3.32  L2:   3.27  M:  3.17 ( 14.71%)  HT:  2.86  VT:  2.84  R:  2.81  RT:  2.07 (  19Kops/s)
  src_0565_8_0565 =  L1:   3.19  L2:   3.15  M:  3.05 ( 10.11%)  HT:  2.75  VT:  2.74  R:  2.71  RT:  2.00 (  18Kops/s)
 over_8888_8_8888 =  L1:   4.99  L2:   4.71  M:  4.11 ( 27.22%)  HT:  3.59  VT:  3.58  R:  3.50  RT:  2.36 (  21Kops/s)
  add_8888_8_8888 =  L1:   5.60  L2:   5.26  M:  4.52 ( 29.95%)  HT:  3.92  VT:  3.89  R:  3.80  RT:  2.49 (  21Kops/s)

Optimized:

  src_8888_8_8888 =  L1:  13.19  L2:  12.13  M:  9.75 ( 58.22%)  HT:  8.60  VT:  8.44  R:  7.90  RT:  5.06 (  33Kops/s)
  src_8888_8_0565 =  L1:  11.64  L2:  10.81  M:  9.18 ( 42.63%)  HT:  8.04  VT:  7.90  R:  7.57  RT:  5.02 (  32Kops/s)
  src_0565_8_x888 =  L1:   8.34  L2:   7.95  M:  7.29 ( 33.85%)  HT:  6.55  VT:  6.48  R:  6.25  RT:  4.35 (  30Kops/s)
  src_0565_8_0565 =  L1:   7.71  L2:   7.35  M:  6.90 ( 22.90%)  HT:  6.14  VT:  6.10  R:  5.94  RT:  4.07 (  29Kops/s)
 over_8888_8_8888 =  L1:   9.73  L2:   8.99  M:  7.15 ( 47.41%)  HT:  6.40  VT:  6.30  R:  6.11  RT:  4.28 (  30Kops/s)
  add_8888_8_8888 =  L1:  13.01  L2:  11.72  M:  8.70 ( 57.68%)  HT:  7.59  VT:  7.46  R:  7.20  RT:  4.74 (  32Kops/s)
2012-07-08 21:38:09 +03:00
Søren Sandmann Pedersen
6aac8e8570 Simplify CPU detection on PPC.
Get rid of the initialized and have_vmx static variables in
pixman-ppc.c There is no point to them since CPU detection only
happens once per process.

On Linux, just read /proc/self/auxv instead of generating the filename
with getpid() and don't bother with the stack buffer. Instead just
read the aux entries one by one.
2012-07-07 01:09:23 -04:00
Søren Sandmann Pedersen
4b78d78537 Simplifications to ARM CPU detection
Organize pixman-arm.c such that each operating system/compiler exports
a detect_cpu_features() function that returns a bitmask with the
various features that we are interested in. A new function
have_feature() then calls this function, caches the result, and return
whether the given feature is available.

The result is that all the pixman_have_arm_<feature> functions become
redundant and can be deleted.
2012-07-07 01:09:23 -04:00
Søren Sandmann Pedersen
8b795a9c17 Simplify MIPS CPU detection
There is no reason to have pixman_have_<feature> functions when all
they do is call pixman_have_mips_feature().

Instead rename pixman_have_mips_feature() to have_feature() and call
it directly from _pixman_mips_get_implementations(). Also on
non-Linux, just make have_feature() return FALSE.
2012-07-07 01:09:23 -04:00
Søren Sandmann Pedersen
16502dd3ae Move the remaining bits of pixman-cpu into pixman-implementation.c 2012-07-07 01:09:23 -04:00
Søren Sandmann Pedersen
5813bb96ae Move MIPS specific CPU detection to its own file, pixman-mips.c 2012-07-07 01:09:23 -04:00
Søren Sandmann Pedersen
4ac0a1d60f Move PowerPC specific CPU detection to its own file pixman-ppc.c 2012-07-07 01:09:23 -04:00
Søren Sandmann Pedersen
8590415f0e Move ARM specific CPU detection to a new file pixman-arm.c
Similar to the x86 commit, this moves the ARM specific CPU detection
to its own file which exports a pixman_arm_get_implementations()
function that is supposed to be a noop on non-ARM.
2012-07-07 01:09:22 -04:00
Søren Sandmann Pedersen
39ac18570a Move x86 specific CPU detection to a new file pixman-x86.c
Extract the x86 specific parts of pixman-cpu.c and put them in their
own file called pixman-x86.c which exports one function
pixman_x86_get_implementations() that creates the MMX and SSE2
implementations. This file is supposed to be compiled on all
architectures, but pixman_x86_get_implementations() should be a noop
on non-x86.
2012-07-06 23:53:19 -04:00
Søren Sandmann Pedersen
1a3b7614a9 pixman-cpu.c: Rename disabled to _pixman_disabled() and export it 2012-07-06 23:52:14 -04:00
Sebastian Bauer
d4aa82fb91 Qualify the static variables in pixman_f_transform_invert() with the const keyword.
Their contents is not overwritten.
2012-07-06 23:50:21 -04:00
Søren Sandmann Pedersen
f9c91ee2f2 Use a compile-time constant for the "K" constraint in the MMX detection.
When compiling with -O0, gcc doesn't understand that in

     signed char x = 0;

     ...

     asm ("...",
     	  : "K" (x));

x is constant. Fix this by using an immediate constant instead of a
variable.
2012-07-02 18:21:21 -04:00
Søren Sandmann Pedersen
cd7ecf548a In fast_composite_tiled_repeat() don't clone images with a palette
In fast_composite_tiled_repeat() if the source image is less than a
certain constant width, a clone is created which is then
pre-repeated. However, the source image's palette, if it has one, is
not cloned, so for indexed images, the pre-repeating would crash.

Fix this by not doing any pre-repeating for images with a palette set.
2012-07-02 18:21:21 -04:00
Søren Sandmann Pedersen
7b20ad39f7 test: Make stress-test more likely to actually composite something
stress-test current almost never composites anything because the clip
rectangles and transformations are such that either
_pixman_compute_composite_region32() or analyze_extent() will return
FALSE.

Fix this by:

- making log_rand() return smaller numbers so that the clip rectangles
  are more likely to be within the destination image

- adding rand_x() and rand_y() functions that pick positions within an
  image and using them for positioning alpha maps and source/mask
  positions.

- making it less likely that clip regions are used in general

These changes make the test take longer, so speed it up a little by
making most images smaller and by reducing the maximum convolution
filter from 17x19 to 3x4.

With these changes, stress-test reveals a crash in iteration 0xd39
where fast_composite_tiled_repeat() creates an indexed image without a
palette.
2012-07-02 18:21:21 -04:00
Matt Turner
4cdf8e9f3a sse2: add missing ABGR entires for bilinear src_8888_8888 2012-07-01 16:35:46 -04:00
Matt Turner
ef99f9e972 loongson: optimize _mm_set_pi* functions with shuffle instructions 2012-07-01 16:34:45 -04:00
Matt Turner
9aa8e3a260 mmx: optimize bilinear function when using 7-bit precision
Loongson:
image             firefox-fishtank 1037.738 1040.218   0.19%    3/3
image             firefox-fishtank 1056.611 1057.581   0.20%    3/3

ARM/iwMMXt:
image             firefox-fishtank 1487.282 1492.640   0.17%    3/3
image             firefox-fishtank 1363.913 1364.366   0.11%    3/3
2012-07-01 16:34:21 -04:00
Matt Turner
1ad6ae6ee8 mmx: add scaled bilinear over_8888_8_8888
Loongson:
image             firefox-fishtank 1665.163 1670.370   0.17%    3/3
image             firefox-fishtank 1037.738 1040.218   0.19%    3/3

ARM/iwMMXt:
image             firefox-fishtank 2042.723 2045.308   0.10%    3/3
image             firefox-fishtank 1487.282 1492.640   0.17%    3/3
2012-07-01 16:34:14 -04:00
Matt Turner
c43de364cb mmx: add scaled bilinear over_8888_8888
Loongson:
image         firefox-planet-gnome  157.012  158.087   0.30%    6/6
image         firefox-planet-gnome  156.617  157.109   0.15%    5/6

ARM/iwMMXt:
image         firefox-planet-gnome  148.086  149.339   0.76%    6/6
image         firefox-planet-gnome  144.939  146.123   0.61%    6/6
2012-07-01 16:33:19 -04:00
Matt Turner
9209cd746b mmx: add scaled bilinear src_8888_8888
Loongson:
image         firefox-planet-gnome  170.025  170.229   0.09%    3/4
image         firefox-planet-gnome  157.012  158.087   0.30%    6/6

ARM/iwMMXt:
image         firefox-planet-gnome  164.192  164.875   0.34%    3/4
image         firefox-planet-gnome  148.086  149.339   0.76%    6/6
2012-07-01 16:33:08 -04:00
Matt Turner
51f27d7364 mmx: Use expand_alpha instead of mask/shift 2012-07-01 16:25:30 -04:00
Siarhei Siamashka
b0855f095a Change default bilinear interpolation precision to 7 bits
This improves performance for the current SSE2 code. Further
reduction to 4 bits may be considered later if it proves
to allow additional speedup.
2012-07-01 23:00:34 +03:00
Siarhei Siamashka
c430b1dba7 sse2: _mm_madd_epi16 for faster bilinear scaling with 7-bit precision
Reducing interpolation precision allows the use of PMADDWD instruction.
This makes bilinear scaling much faster (on Intel Core i7):

8-bit: image             firefox-fishtank   57.584   58.349   0.74%    3/3
7-bit: image             firefox-fishtank   51.139   51.229   0.30%    3/3

8-bit: src_8888_8888 =  L1: 228.71  L2: 226.52  M:224.82 ( 14.95%)  HT:183.22  VT:154.02  R:171.72  RT:109.36
7-bit: src_8888_8888 =  L1: 320.45  L2: 317.43  M:314.38 ( 20.77%)  HT:215.13  VT:177.35  R:204.46  RT:121.93
2012-07-01 22:40:23 +03:00