[cairo] cairo and glitz offscreen pixmap

gandalfn gandalfn at club-internet.fr
Sun Aug 3 13:00:10 PDT 2008


Hi,

To begin, i want to explain how i came to made some modifications on
glitz. I already explain, but we use on my job cairo/glitz and we are
really happy of them. But we see sometimes some slowness and cpu crazy
times :).

To fix them, I checked where glitz/cairo backend lost time. It's seem
it's generally in get/set image functions. I began to see how i can
improve set image functionality because we use mostly this function in
our application. My first modifications are to implement texture from
pixmap in glitz and a beginning of offscreen pixmap support. This
improved a little the set image image performance but nothing to
convincing. In fact in most times on architecture which support it, pbo
are faster. To use texture from pixmap in glitz you must create a
surface in classic way of glitz. After create a glitz drawable for a
pixmap which contains image that you want put on your surface with
glitz_glx_create_drawable_for_pixmap, And finally bind it on your
surface with glitz_surface_bind_tex_image.

In the second way, i checked where cairo/glitz backend lost time on get
image and here it lost many time. I made some little performance test
with a 400x400 image size, on a card which support pbo (nvidia 8800GT)
cairo/glitz backend spend ~2ms to get image, and on my old intel 915
cairo/glitz backend spend ~40ms to get image (sic). Well to improve it,
i implemented on glitz pixmap offscreen support, the principle: glitz
create a glxpixmap like pbo where all rendering are made, the most
advantage of glxpixmap is this content is shared between X and OpenGL
and to get image data we can do only an XGetImage or create a xlib
surface.  The performance gain with it are really amazing on my old
intel graphics to get image it spend now ~0.05ms same on nvidia card. I
made a little demo available here: 

http://download.tuxfamily.org/ccm/glitz/glitz_cairo_test-0.1.tar.gz

which create a glitz offscreen surface and render on it, and on expose
event it just set source surface of xlib surface of this pixmap on
window. You can disable offscreen pixmap with -n option to compare the
gain.

Well i am not opengl specialist, i just want gain some performance with
glitz, i'm perhaps on a wrong way. If is a good way, i don't know what
is the better solution for cairo, keep out offscreen pixmap outside the
backend or integrate on it. You need to known this methods needs the
context must be indirect, i also needed to disable AiGLX with intel
graphics on Xorg 1.4 but it's seem its fixed on next release.

What do you think about ?

To finish you can grab my latest glitz modifications on my git repos:

git clone git://git.tuxfamily.org/gitroot/ccm/glitz.git

or the latest tarball here:

http://download.tuxfamily.org/ccm/glitz/glitz-0.5.7.tar.bz2

To work with cairo you need a small patch you can find here :

http://download.tuxfamily.org/ccm/glitz/0001-Fix-glitz-support-for-24.8-fixed-point.patch

or if you use stable release you must use this patch :

http://download.tuxfamily.org/ccm/glitz/0001-cairo-1.6-Fix-glitz-support-for-24.8-fixed-point.patch

And sorry for all my mistakes in English, I don't really have a high
level in English.

Regards,

Nicolas
-- 
gandalfn <gandalfn at club-internet.fr>
<nicolas.bruguier at supersonicimaginefr>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.cairographics.org/archives/cairo/attachments/20080803/984e84ec/attachment.pgp 


More information about the cairo mailing list