[cairo] cairo+pixman profiling

Jeff Muizelaar jeff at infidigm.net
Mon Nov 5 20:24:13 PST 2007


On Tue, Nov 06, 2007 at 01:03:43PM +0900, Nguyen Vu Hung wrote:
> 2007/11/6, Jeff Muizelaar <jeff at infidigm.net>:
> > These are called when using the software rasterizer. The ideal solution
> > to this problem is replacing the rasterizer. However, that is likely
> > quite a bit of work. There has been discussion about possible
> > implementations but no real conclusions were ever made.
> >
> You are talking about the problems of "software rasterizer".Do you
> know any solutions for "hardware rasterizer"? Is that GPU makes
> rasterization faster?

cairo's software rasterizer is a bad software rasterizer. It is possible
to do much better in software. This thread has a bunch of discussion
about it:
http://lists.cairographics.org/archives/cairo/2007-July/011092.html

> 
> > >
> > > 2. Where unpremultiply_data is callled? What this function does?
> >
> > Probably in the png writing code. It does c*255/alpha on each component
> > of a pixel.
> Thank you. I don't think this bottleneck be be overcome because I need
> to write PNG files ( with alpha channel ).

It is possible to have a faster software implementation of
unpremultiply. You can probably at least double the speed. The basic
trick involves multiplying by the inverse instead of dividing. You can
either computer the inverse at runtime or use a lookup table. I have
some code for this, but I haven't touched it for a while so I'd need to
look it over if I was to post it to the list.

> 
> The algorithm of "pre-multiplied" values as described in "Compositing
> Digital Images"[1]. It is primitive per-byte proccessing. Can it be
> faster if done with hardware? GPU?
> 
> > > _cairo_pixman_composite_solid_mask_nx8x8888mmx
> >
> > _cairo_pixman_composite_solid_mask_nx8x8888mmx this may be able to be
> > optimized further. However, large speedups may be possible just by using
> > a newer version of gcc. Older versions of gcc often do a very bad job
> > optimizing mmx intrinsic code.
> I am using 3.4.6, and the latest gcc is 4.2.2. Which version should i use?

Probably the newer the better.

> And other cairo funtions those make big contributions to the performance:
> 
>   2.18    908.68    28.94
> _cairo_pixman_render_edge_init
>   1.21    924.78    16.10
> _cairo_pixman_render_sample_floor_y
>   1.04    938.56    13.78
> _cairo_pixman_render_sample_ceil_y
>   0.68   1007.55     9.01

I haven't seen these ones before.

> _cairo_bentley_ottmann_tessellate_polygon

I better software rasterizer would avoid tesselating. So this one would
be eliminiated.

>   0.66   1016.28     8.74                             _cairo_fixed_from_double
>   0.64   1024.81     8.53
> _cairo_pixman_render_edge_step
>   0.64   1033.34     8.53                             _compute_face
> 

-Jeff



More information about the cairo mailing list