[cairo] XShm when?

Kalle Vahlman kalle.vahlman at gmail.com
Sat Jan 26 03:50:42 PST 2008

2008/1/25, Theo Veenker <Theo.Veenker at let.uu.nl>:
> 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).

I suppose the xshm pixmaps cannot be uploaded to the video memory of
the card while regular pixmaps can. So in the xshm case the pixmap
needs to be uploaded to the video memory while in the normal case it
can already be there and all of the operations actually are done by
the GPU in the video memory which is pretty much the optimum

 > 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?

This could also be due to video memory. This time, the drawing to the
window hits an operation which is not supported and falls back to sw
rendering. If the window happened to be in video memory, it might be
needed to fetch it back (slow!), do some alpha blending or whatever
and put it back to the video memory. If you have a pixmap, it has
better chances of not being in the video memory so operations on it do
not require the slow fetch from video memory.

I'm pretty much guessing here though, I'm not well enough informed
about the X internals to say for sure...

Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi

More information about the cairo mailing list