From eff25430b4a391409e39337962ff7697165d23c7 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Thu, 24 Jul 2008 21:06:34 -0500 Subject: Don't abort if swrast library is not present GLX is enabled by default, but the current swrast behaviour causes X to abort with fatal error if the swrast dri library dlopen fails. Handle the case where the swrast library is not present, and do not register the GLX extension unless at least one screen has a usable GL provider. --- glx/glxext.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'glx/glxext.c') diff --git a/glx/glxext.c b/glx/glxext.c index 13c65dade..6ba404fb1 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -279,6 +279,7 @@ void GlxExtensionInit(void) ScreenPtr pScreen; int i; __GLXprovider *p; + Bool glx_provided = False; __glXContextRes = CreateNewResourceType((DeleteType)ContextGone); __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); @@ -289,6 +290,29 @@ void GlxExtensionInit(void) if (!AddCallback (&ClientStateCallback, glxClientCallback, 0)) return; + for (i = 0; i < screenInfo.numScreens; i++) { + pScreen = screenInfo.screens[i]; + + for (p = __glXProviderStack; p != NULL; p = p->next) { + if (p->screenProbe(pScreen) != NULL) { + LogMessage(X_INFO, + "GLX: Initialized %s GL provider for screen %d\n", + p->name, i); + break; + } + } + + if (!p) + LogMessage(X_INFO, + "GLX: no usable GL providers found for screen %d\n", i); + else + glx_provided = True; + } + + /* don't register extension if GL is not provided on any screen */ + if (!glx_provided) + return; + /* ** Add extension to server extensions. */ @@ -306,19 +330,6 @@ void GlxExtensionInit(void) } __glXErrorBase = extEntry->errorBase; - - for (i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - - for (p = __glXProviderStack; p != NULL; p = p->next) { - if (p->screenProbe(pScreen) != NULL) { - LogMessage(X_INFO, - "GLX: Initialized %s GL provider for screen %d\n", - p->name, i); - break; - } - } - } } /************************************************************************/ -- cgit v1.2.3