[cairo] glitztest and pbuffers

David Reveman c99drn at cs.umu.se
Wed May 26 18:04:50 PDT 2004

I'll try to give you a (not so long?) explanation of how offscreen
surfaces are handled in glitz. I think it will answer your questions.

There are onscreen and offscreen surfaces in glitz (similar to windows
and pixmaps for X).  A texture is an offscreen surface and a pbuffer is
an offscreen surface. The only difference is that you can draw to a
pbuffer but not to a texture, however you can still transfer pixel data
to textures and use them as source surfaces.

The glitz user doesn't really need to care about all this. One great
advantage with glitz is that it abstracts away the pbuffer notion. The
glitz user only need to care about finding an offscreen surface format
the supports drawing and glitz will create the surface in the best
possible way (pbuffer, superbuffer...).

glitztest doesn't care if the offscreen format is drawable or not, it
just creates four offscreen surfaces using the best format it can find.
On systems without pbuffer support, this format and the four surfaces
will turn out to be read only. glitztest is aware of this and will then
not try to do any drawing operations on these surfaces. However, I think
it's actually only one test that needs offscreen drawing so most test
will work just fine without "offscreen drawing" support. 

This means that the application needs to handle the drawing when it
cannot find a drawable offscreen format with glitz.
e.g. when using glitz with cairo:
will create an offscreen glitz surface. Whenever cairo sends a drawing
operation to this surface, the gl backend will check if the surface is
drawable. If the surface is drawable then the operation will be carried
out by glitz otherwise the gl backend will do something like this:

glitz_surface_read_pixels (surface, &pixels);
image = cairo_image_surface_for_data (pixels);
pixman_drawing_operation (image);
glitz_surface_draw_pixels (surface, pixels);

On Wed, 2004-05-26 at 16:34 -0700, Jon Smirl wrote:
> Does glitztest work without pbuffers? miniglx doesn't have pbuffers implemented.
> The background surface is created as an offscreen surface but then
> glXMakeCurrent() is used on it. This makes me think it was meant to be a
> pbuffer.

A backend should never try to make a "not drawable" surface current, it
should instead make the root context and the root drawable current and
return "not supported" to the glitz core.

> glitztest creates five surfaces and then uses them for various things. I'm
> confused here, is glitztest really trying to create five drawing surfaces? Or is
> this one drawing surface (the window) and four textures?

I think the above should answer this.

> What does glitz use as a fallback for offscreen textures when the GL
> implementation doesn't support it?

this too.

More information about the cairo mailing list