glx: Fix fbconfigs with no corresponding visual

There are, in general, more fbconfig depths than visual depths.
fbconfigs need not support Window rendering, however any that do must
have an associated visual ID (which we got right), and any that do not
must not claim GLX_WINDOW_BIT in GLX_DRAWABLE_TYPE (which we got
wrong).

Fixes piglit/glx-fbconfig-sanity, assuming you have a sufficiently
recent piglit, as that test formerly wrongly required pixmap-capable
fbconfigs to have a visual.

v2: Additional check for fbconfigs that didn't have GLX_WINDOW_BIT in
    the first place, from previous patch by Jon TURNEY; also, also clear
    ->visualID.

Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2011-04-12 15:30:25 -04:00 committed by Jon TURNEY
parent 9d568450b1
commit 3e8270b869

View File

@ -395,8 +395,15 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
if (depth == pScreen->visuals[i].nplanes)
break;
}
/* if it can't, fix up the fbconfig to not advertise window support */
if (i == pScreen->numVisuals)
config->drawableType &= ~(GLX_WINDOW_BIT);
/* fbconfig must support window drawables */
if (!(config->drawableType & GLX_WINDOW_BIT)) {
config->visualID = 0;
continue;
}
/* Create a new X visual for our FBconfig. */
visual = AddScreenVisuals(pScreen, 1, depth);