[cairo] XDBE

Soeren Sandmann sandmann at daimi.au.dk
Wed Nov 23 21:36:49 PST 2005

Jim Gettys <jg at freedesktop.org> writes:

> The fedora folks have been experimenting with this using the Sync
> extension.
> Basically, you can create a simple convention that tells the window
> manager when the application is at a good state to display the window.
> This, in concert with composite, eliminates all distracting intermediate
> drawing from being visible to the user.

The protocol that gtk+ and metacity use, which is documented in the
cvs version of the freedesktop wm spec, does not in fact eliminate all
distracting intermediate drawing. What it does is more limited:

Every time the window manager resizes the frame, it also sends a
message to the application "Here is a number n -- a ConfigureNotify
will follow very shortly. When you have handled all associated
repainting, please send the number back to me." The window manager
then waits for the reply before doing the next resize (metacity has a
timeout of 1s so that stuck applications can still have their windows

This eliminates the long lag between window manager frame and
application in the non-composited case. With composite it is
sufficient to give good, mostly artefact-free resizing as luminocity

The protocol is not sufficient to give completely perfect display
though; for example it doesn't handle mapping of new windows; they
will still be blank for a moment before the app gets around to drawing
on them.

Coming up with a good "this-window-is-ready-to-be-painted" protocol is
not completely straightforward if you want it to be free of roundtrips
while not having buggy or slow applications lock up the entire screen.

One thing that might be interesting is a SyncWaitCounter with a
timeout. That way the compositing manager could do this:

SyncWaitCounter (damaged_window_1_ready && 
                 damaged_window_2_ready &&
Draw window_1
Draw window_2
Draw window_n
SwapBuffer (if using DBE).

Ie., wait for all windows to be ready-to-paint, but no longer than
10ms, after which the windows are drawn, ready-to-paint or not.


More information about the cairo mailing list