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

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


Hi,

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:
wwwlehre.dhbw-stuttgart.de/~lombardo/spicy_osx.mov

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);
cairo_fill(cr);
[...]

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:
wwwlehre.dhbw-stuttgart.de/~lombardo/exp_call_tree_spicy.png

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:
http://opensource.apple.com/source/WebCore/WebCore-1A543a/platform/cairo/cairo/src/cairo-quartz2.h
http://opensource.apple.com/source/WebCore/WebCore-1A543a/platform/cairo/cairo/src/cairo-quartz2-surface.c
Was this implementation used in the upstream cairo too?

Thanks in advance,
Mario


More information about the cairo mailing list