Only try to call DRI function if DRI got initialized properly.
authorKristian Høgsberg <krh@redhat.com>
Mon, 10 Mar 2008 21:59:46 +0000 (17:59 -0400)
committerKristian Høgsberg <krh@redhat.com>
Mon, 10 Mar 2008 22:46:19 +0000 (18:46 -0400)
src/glx/x11/glxcmds.c
src/glx/x11/glxext.c

index c761ddf29ffa57b221690524666face272605f56..1437ea54425ba03a4db4a4ed3435fd2522be790b 100644 (file)
@@ -360,6 +360,10 @@ CreateContext(Display *dpy, XVisualInfo *vis,
              Bool use_glx_1_3, int renderType)
 {
     GLXContext gc;
+#ifdef GLX_DIRECT_RENDERING
+    int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen;
+    __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+#endif
 
     if ( dpy == NULL )
        return NULL;
@@ -373,9 +377,7 @@ CreateContext(Display *dpy, XVisualInfo *vis,
            return NULL;
 
 #ifdef GLX_DIRECT_RENDERING
-       if (allowDirect) {
-           int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen;
-           __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+       if (allowDirect && psc->driScreen) {
            const __GLcontextModes * mode;
 
            if (fbconfig == NULL) {
index 47f8da04b29cec850ac10d770ffc52648ff656d7..bb3fc8940336a5c377e8939bdc9b163f111d684e 100644 (file)
@@ -771,7 +771,8 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
        psc->scr = i;
        psc->dpy = dpy;
 #ifdef GLX_DIRECT_RENDERING
-       psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
+       if (priv->driDisplay)
+           psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
 #endif
     }
     SyncHandle();