[cairo] XShm when?

Theo Veenker Theo.Veenker at let.uu.nl
Fri Jan 25 06:01:49 PST 2008


Carl Worth wrote:
> One question here is what cases of cairo XPutImage are hurting you? Is
> it doing things like:
> 
> 	cairo_set_source_surface (cr, image_surface);
> 	cairo_paint (cr);
> 
> That is, uploading image data through cairo API? In this case, then
> yes you could manually do an XShm upload instead, (with a rather
> marked lack of convenience). This is the case I'd really like to see
> the XShm work address.

Yes I need to display image sequences (but also animation of simple
geometric shapes). I noticed however the strange thing that using a
pixmap created by XShmCreatePixmap() instead of a regular pixmap can
actually have a negative effect on performance.

I did this
   XSync
   timestamp 1
   draw some lines and rects to 500x500 pixmap surface
   cairo_paint pixmap to window surface
   XSync
   timestamp 2

This took 15ms to complete (on average) on a rather slow system (1.8GHz,
Matrox G450) for both regular and xshm pixmaps. But on another system
(3GHz, nvidia 7300) I get 2.5ms for the regular pixmap case and 6ms for
the xshm pixmap. When I time the drawing to the pixmap and the copying
from the pixmap seperately I see both parts are slower then for the
regular pixmap. I haven't tested yet but I suppose having direct access
to the pixel data from client side more then compensates for the
performance panelty (on this particular system).

Another thing that wonders me is on my slow systems drawing to an xlib
window surface is 2x slower than drawing to a pixmap followed by copying/
painting the pixmap to the window. In other words double buffering
is faster than single buffering. What could be the cause of this?

I suspect the observed effects are not due to cairo, could they?

> 
> Or is it something else? Such as XPutImage calls from rendering due to
> cairo having to fallback to image-based rendering. If something like
> that, then perhaps there's something more significant you can do to
> address the performance problems. So let us know.
> 

I think I was a bit hasty in saying that it was a XPutImage call that
took too long. That was my conclusion thinking cairo did client side
rendering (playing with AGG distorted my view a bit).


>> PS. is the search thingy on
> http://lists.cairographics.org/archives/cairo/
>> up to date? Entering xshm for example yields no results.
> 
> Thanks for pointing this out. It looks like this got changed to search
> for "lists.freedesktop.org" at some point instead of the correct
> "lists.cairographics.org". I've fixed that now and I now get 51
> results with a search for "xshm".

Maybe you reverted it back? It still reads lists.freedesktop.org.

Theo




More information about the cairo mailing list