Xlib programming Reference:
PDF: http://www.x.org/archive/X11R7.0/doc/PDF/xlib.pdf
HTML: http://tronche.com/gui/x/xlib/function-index.html
For indirect rendering through X which the softpipe uses, calls to Xlib are in drisw_glx.c module in src/glx, with the indirection table created when __GLXInitialize is called to initialized GL over X.
Also, an architectural diagram of how VitualGL uses GLX to bind OpenGL rendering context to X windows.