xcompmgr provides the following option:
-s Server-side compositing with hard-edged shadows.
From experimentation, I can say that this is much, much faster than the "client side" options. But what exactly is it doing? In Xorg, what is the difference between client- and server-side compositing?
And, more to the point: what set of Xorg functions would I have to use, if I wanted to implement server-side compositing in e.g. a window manager?
Best Answer
So, looking through the xcompmgr sources, I found that:
The main difference between -s and -c seems to be how the shadow effect itself is implemented, not how the compositing is done. I have some trouble following exactly what is going on (graphics is not my strong point), but the routine for generating "server side" shadows looks simpler. I think it just creates a transparent gray bitmap the size of the window, or something. Point is, it's a less expensive routine.
The functions I want are listed in 'man Xcomposite', and available in X11/extensions/Xcomposite.h. For a compositing manager (or compositing WM), one would specifically want XCompositeRedirectSubwindows() and XCompositeUnredirectSubwindows(). (The latter must be run before closing the X display, otherwise you get a segfault.)