[cairo] Re: Cairo performance issues.

Daniel Amelang daniel.amelang at gmail.com
Wed Mar 7 12:38:31 PST 2007

On 3/7/07, leonid.zolotarev at nokia.com <leonid.zolotarev at nokia.com> wrote:
> Hello Daniel,

Hello Leonid, I hope you don't mind if we take this to the cairo list,
as there's nothing about your questions that are specific to me. Also,
it would be advantageous to get other's help on this, too. And others
might benefit from the answer given.

> I work for Maemo project and currently we are suffering from some severe
> performance issues related to Cairo library.
> We manage to identify two most severe issues which affect the Cairo
> performance on Maemo platform:
> 1. 'cairo_xlib_surface_backend - paint' function implementation is missing
> and Cairo does composite fallback for each paint operation because of that.

This is a red herring. The fact that the xlib surface doesn't
implement "paint" does _not_ mean that it falls back to pixman
compositing. The actual compositing is done by the surface's
composite_trapezoids function, which _is_ implemented by the xlib
surface. So, nothing to worry about here, really.

> 2. Cairo does not support 16 bit color bitmaps natively and composite
> operation is very slow because it shall convert from 32/24 to 16 all the
> time.
> You can find more details on these issues from the following bug report:
> https://bugs.freedesktop.org/show_bug.cgi?id=10208

First off, do you really have to recomposite at each scroll step? Are
the two layers that are composited together changing position relative
to one another? If not, try caching the results of the compositing
onto one surface and just scroll that surface.

Now, assuming you do have to recomposite at each scroll step, you can
try making the two surfaces of the same type (it looks like you're
mixing an image surface with an xlib one, is that right? Or are you
using the deprecated CAIRO_FORMAT_RGB16_565 format?).

In other words, try creating two image surfaces and doing your
compositing on those. Or, turn your image into an xlib surface (this
is the "right" thing to do, BTW), so you have two xlib surfaces and
then cairo will push the compositing down into the (theoretically
optimized) X Render implementation for the device.

> Could you, please, help us to resolve at least the first issue because this
> is something that affect the Cairo performance most of all?
> I'd also appreciate if you provide us with some guidelines on the second
> issue as well.

Hope that helps.

> Regards,
> Leonid.


More information about the cairo mailing list