From 3e8270b869ebf788778d5d56107f6d47c7c050d0 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 12 Apr 2011 15:30:25 -0400 Subject: [PATCH] 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 Signed-off-by: Adam Jackson --- glx/glxscreens.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/glx/glxscreens.c b/glx/glxscreens.c index 496cf9e14..c4ad42648 100644 --- a/glx/glxscreens.c +++ b/glx/glxscreens.c @@ -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);