[cairo] fbmmx merge

Carl Worth cworth at cworth.org
Fri Aug 12 23:08:06 PDT 2005

On Fri, 12 Aug 2005 23:37:18 -0500, Billy Biggs wrote:
>   Here's a second attempt at a merge of the fbmmx code from xserver/fb.
> ssp fixed a bug today in xserver that was causing one failure, and I've
> attached three more fixes.  With the attached patch, all tests pass,
> both with the SSE and MMX code.

I haven't looked at the text of either patch at all.

But I did run some tests with the cairo patch and things look good. As
you say, all the tests pass. And the one invalid read error that
valgrind was seeing in text-antialias-none gets cleared by this patch,
(at least with gcc4 on my machine).

I tried running gearflowers.svg through to see if the patch sped
things up considerably. At first, I found a startling result:

	$ time svg2png gearflowers.svg gearflowers.png
Before fbmmx patch:
	real    0m4.011s
After:	real    0m17.370s

A 4X slowdown was rather discouraging. Daniel Schleef pointed out the
patch uses inline quite heavily so I should compile with -O2. I did
that and the results were less discouraging:

Before fbmmx patch:
	real    0m3.330s
After:	real    0m2.935s

And here are results from an SVG file that takes a bit longer to

	$ time svg2png gaze.svg gaze.png
Before fbmmx patch:
	real    0m40.030s
After:	real    0m35.700s

Anyway, there's a quick look at things. I have no idea if cairo's
rendering of these SVG files tests anything that's relevant to what
the patch is trying to do. But these are the best guesses I have for
interesting performance cases. I've included below the top bit of the
oprofile report for the gaze test both before and after the
patch. Looks like the gradient computation might be dominating

(I wonder if it's computing gradients for big bounding boxes and then
using only small portions of them. I also wonder if it's computing the
same gradients over and over again.)

Anyway, the patch looks acceptable to me. The new requirement to
compile with -O2 to get decent performance is going to annoy me a
bit. (It basically means I'll have to consciously decide whether to be
in debugging mode or performance testing mode. And I'll likely be in
the wrong mode often and confuse myself with odd behavior for a
while.) Is there any easy way to alleviate this problem?


$ time svg2png gaze.svg gaze.png (without fbmmx patch)
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples  %        app name                 symbol name
6005     14.9923  libcairo.so.2.0.0        _cairo_pattern_acquire_surface
2895      7.2277  libcairo.so.2.0.0        __divdi3
1914      4.7785  libcairo.so.2.0.0        _cairo_pixman_composite_general
1677      4.1868  libcairo.so.2.0.0        _cairo_pattern_calc_color_at_pixel
1621      4.0470  libm-2.3.5.so            __ieee754_acos
1563      3.9022  libz.so.          (no symbols)
1338      3.3405  libcairo.so.2.0.0        _cairo_pixman_combine_over_u
1013      2.5291  libcairo.so.2.0.0        _cairo_pixman_compute_composite_region
976       2.4367  libcairo.so.2.0.0        _cairo_pattern_shader_linear
875       2.1846  libcairo.so.2.0.0        _cairo_pixman_fetch_a8r8g8b8
873       2.1796  libm-2.3.5.so            cos
866       2.1621  libm-2.3.5.so            sin
862       2.1521  libxml2.so.2.6.19        (no symbols)
766       1.9124  libcairo.so.2.0.0        _cairo_pixman_rasterize_edges
759       1.8949  no-vmlinux               (no symbols)
693       1.7302  libc-2.3.5.so            msort_with_tmp

$ time svg2png gaze.svg gaze.png (with fbmmx patch)
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples  %        app name                 symbol name
5998     16.0045  libcairo.so.2.0.0        _cairo_pattern_acquire_surface
3036      8.1010  libcairo.so.2.0.0        __divdi3
2057      5.4887  no-vmlinux               (no symbols)
1800      4.8029  libcairo.so.2.0.0        _cairo_pattern_calc_color_at_pixel
1758      4.6909  libcairo.so.2.0.0        mmxCombineOverU
1584      4.2266  libm-2.3.5.so            __ieee754_acos
1555      4.1492  libz.so.          (no symbols)
1511      4.0318  libcairo.so.2.0.0        mmxCombineMaskU
1113      2.9698  libcairo.so.2.0.0        _cairo_pixman_rasterize_edges
1015      2.7083  libcairo.so.2.0.0        _cairo_pixman_fetch_a8r8g8b8
909       2.4255  libm-2.3.5.so            sin
895       2.3881  libcairo.so.2.0.0        _cairo_pattern_shader_linear
879       2.3454  libm-2.3.5.so            cos
721       1.9238  libc-2.3.5.so            memcpy
690       1.8411  libxml2.so.2.6.19        (no symbols)
673       1.7958  libc-2.3.5.so            msort_with_tmp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050812/1f56c9d8/attachment.pgp

More information about the cairo mailing list