[PATCH 1/2] glx: Fix fbconfigs with no corresponding visual

Adam Jackson ajax at redhat.com
Tue Apr 12 12:30:25 PDT 2011


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 at dronecode.org.uk>
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxscreens.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 496cf9e..a5a79a1 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -395,8 +395,14 @@ 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);
+
+	if (!(config->drawableType & GLX_WINDOW_BIT)) {
+	    config->visualID = 0;
 	    continue;
+	}
 
 	/* Create a new X visual for our FBconfig. */
 	visual = AddScreenVisuals(pScreen, 1, depth);
-- 
1.7.4.2



More information about the xorg-devel mailing list