[cairo] Very slow CGContextDrawImage in cairo-quartz-surface.c

Mario ml at kernelobjects.org
Wed Oct 16 22:31:09 CEST 2013


i just try to compile spice-gtk for OSX. But the rendering algorithm 
does not seem to fit for a remote desktop application.

Drawing works fine as soon as the area is small and there are not too 
many drawings in a short period.

I made a recording of the renderings:

Under the hood spice uses

surf = cairo_image_surface_create_for_data()

for rendering of the content directly (->pixman). spice-gtk always uses 
CAIRO_FORMAT_RGB24 for the image surface.

To display the content spice uses:
cairo_translate(cr, x, y);
cairo_rectangle(cr, 0, 0, w, h);
cairo_scale(cr, s, s);
cairo_set_source_surface(cr, surf, 0, 0);

The cairo library is configured to use quartz. A deeper look into the 
function tree shows that a lot of time is used within 
CGContextDrawImage() -> a lot of time for conversion tasks as it seem.

You can find the function tree here:

Is there anything I can do on the spice side to accelerate rendering? Is 
it useful to convert the image in any way or to split the drawing?

Or do you suggest the use of cairo-gl instead of quartz here?

I noticed there was a GL version of cairo-quartz available:
Was this implementation used in the upstream cairo too?

Thanks in advance,

More information about the cairo mailing list