diff options
author | Adam Jackson <ajax@redhat.com> | 2012-09-27 17:44:42 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-05-22 18:08:20 -0700 |
commit | db2e708f31a162c6c66643d3559dd5f3e21ee06b (patch) | |
tree | c45f31e1c5a9c6116322bc2c3bcf6a9ddf274119 | |
parent | 6d684f916b4c33327d32ef1f48803bf90357287f (diff) |
glx: Require at least one True/DirectColor visual
Mesa no longer supports rendering to anything less. GLX 1.2 requires
that the server advertise at least one GLX visual. GLX 1.3 and 1.4 are
more subtle: they require at least one fbconfig capable of window
rendering, and _also_ require that window-capable fbconfigs have a
non-zero value for the GLX_VISUAL_ID. In either case we should refuse
to init GLX if there's not at least one GL-capable visual on at least
one screen.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | glx/glxext.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/glx/glxext.c b/glx/glxext.c index c0142fe2e..c2de3cedd 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -316,6 +316,23 @@ GlxPushProvider(__GLXprovider * provider) __glXProviderStack = provider; } +static Bool +checkScreenVisuals(void) +{ + int i, j; + + for (i = 0; i < screenInfo.numScreens; i++) { + ScreenPtr screen = screenInfo.screens[i]; + for (j = 0; j < screen->numVisuals; j++) { + if (screen->visuals[j].class == TrueColor || + screen->visuals[j].class == DirectColor) + return True; + } + } + + return False; +} + /* ** Initialize the GLX extension. */ @@ -334,6 +351,10 @@ GlxExtensionInit(void) *stack = &__glXDRISWRastProvider; } + /* Mesa requires at least one True/DirectColor visual */ + if (!checkScreenVisuals()) + return; + __glXContextRes = CreateNewResourceType((DeleteType) ContextGone, "GLXContext"); __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone, |