I ultimately went with a solution similar to the one that OpenText
submitted back in the day
(
https://sourceforge.net/p/virtualgl/mailman/message/27118523/), and
that solution is now available for testing in the dev branch. The faker
now separates 2D X server visuals into categories based on visual depth
(and, if depth == 32, bits per component as well), visual class, and
stereo capabilities (i.e. the characteristics of 2D X server visuals
that VirtualGL actually cares about.) For each of those categories, the
faker cycles through all of the permutations of desired OpenGL rendering
attributes (alpha channel, double buffering, stencil buffering, depth
buffer, and multisampling) and assigns as many permutations of those
attributes as possible to the available 2D X server visuals in the
category. This works well with X proxies, such as TurboVNC, that have a
built-in software OpenGL implementation, because that gives those X
proxies a lot of available visuals. X proxies that lack a built-in
software OpenGL implementation (such as TurboVNC < 2.2 or TurboVNC 2.2+
when started with '-extension GLX') will generally only have two or
three visuals, so VirtualGL tries to front-load the rendering attribute
permutations in such a way that the first visual in a given category has
all of the rendering attributes, except multisampling, that an
application would want. Since VGL_SAMPLES now affects "default FB
configs" that are assigned to "unknown" visuals (visuals that aren't
obtained from glXChooseVisual() or glXGetVisualFromFBConfig()),
VGL_SAMPLES can easily be used to attach multisampling properties to the
first visual, if necessary. Thus, while VGL_DEFAULTFBCONFIG still
works, it is now mostly useless, and documentation for it has been
removed. The only thing that VGL_DEFAULTFBCONFIG can do that
VGL_FORCEALPHA and VGL_SAMPLES can't already do is disable features
(double buffering, alpha channel, stencil buffer) for all default FB
configs, and there shouldn't ever be a need to do that with modern
applications and GPUs.
I also wrote a script that catalogues the output of 'vglrun glxinfo'
with many different permutations of VGL and Xvfb settings. I now
maintain an offline Git repository with expected results from this
script on my three main VirtualGL test platforms, so that should help
prevent regressions in the VirtualGL visual matching algorithms.
I experimented with attaching a matching GLXFBConfig to the X Visual
structure using the XExtData mechanism, but that didn't work very well,
because X Visual structures survive for the entire duration of the X
connection (as opposed to XVisualInfo structures, which are created and
destroyed on demand at the behest of the calling program.) Also, since
the VirtualGL VisualHash class hashes XVisualInfo pointers to
GLXFBConfigs, it already accomplishes what I would have tried to
accomplish below. I was, however, able to use the XExtData mechanism to
clean up the visual attribute table in glxvisual.cpp (the VA table is
now attached to the Screen structure, since that data is per-screen) and
eliminate the display hash (which tracks the X displays that should be
excluded from GLX interposition-- mainly for use by ParaView and such.)
VirtualGL now also maintains its own FB config structures, and pointers
to these are passed back to the 3D application as GLXFBConfigs. That is
about to be necessary as I refactor the back end to use EGL and FBOs.