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

Chris Wilson chris at chris-wilson.co.uk
Thu Oct 17 14:21:45 CEST 2013

On Thu, Oct 17, 2013 at 08:09:34AM +0200, Mario wrote:
> So back to my origin mail I would like to know if there is any
> suggestion to accelerate this drawing. Does Quartz prefer any
> specific data format? Or is the way spice-gtk draws the canvas
> better realized different?
> Spice uses simply the drawing of cairo directly - no curves,
> polygons, ... - just drawing. The canvas calculation is done by
> pixman. And pixman calls are way less expensive than this drawing
> function.

The cost here appears to be that OSX is performing a costly ColorSpace
transform for every image upload. We declare the image to upload with
CGColorSpaceCreateDeviceRGB. We also create the CGImage with the
interpolate bit set, which is not required here (and a good candidate
for optimisation). The last unknown flag that we might improve upon is

So to speed up cairo-quartz, you can either implement an accelerated CS
transform inside OS/X, or find the right flag for CGImage creation to
avoid having to do a CS transform at all.

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list