Move DRI context functions into dri_glx.c.

Also drop isDirect flag; if gc->driContext is non-NULL, it's direct.
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 2e883c6..853940b 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -59,6 +59,8 @@
 #endif
 
 typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
+typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
+
 struct __GLXDRIdisplayPrivateRec {
     __GLXDRIdisplay base;
 
@@ -70,6 +72,12 @@
     int driPatch;
 };
 
+struct __GLXDRIcontextPrivateRec {
+    __GLXDRIcontext base;
+    __DRIcontext driContext;
+    XID hwContextID;
+};
+
 #ifndef DEFAULT_DRIVER_DIR
 /* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
 #define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
@@ -657,40 +665,79 @@
     return psp;
 }
 
-
-static void driCreateContext(__GLXscreenConfigs *psc,
-			     const __GLcontextModes *mode,
-			     GLXContext gc,
-			     GLXContext shareList, int renderType)
+static void driDestroyContext(__GLXDRIcontext *context,
+			      __GLXscreenConfigs *psc, Display *dpy)
 {
+    __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+			
+    (*pcp->driContext.destroyContext)(&pcp->driContext);
+
+    XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
+}
+
+static Bool driBindContext(__GLXDRIcontext *context,
+			   __GLXDRIdrawable *draw, __GLXDRIdrawable *read)
+{
+    __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+
+    return (*pcp->driContext.bindContext)(&pcp->driContext,
+					  &draw->driDrawable,
+					  &read->driDrawable);
+}
+
+static void driUnbindContext(__GLXDRIcontext *context)
+{
+    __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+
+    (*pcp->driContext.unbindContext)(&pcp->driContext);
+}
+
+static __GLXDRIcontext *driCreateContext(__GLXscreenConfigs *psc,
+					 const __GLcontextModes *mode,
+					 GLXContext gc,
+					 GLXContext shareList, int renderType)
+{
+    __GLXDRIcontextPrivate *pcp, *pcp_shared;
     drm_context_t hwContext;
-    __DRIcontext *shared;
+    __DRIcontext *shared = NULL;
 
     if (psc && psc->driScreen) {
-	shared = (shareList != NULL) ? &shareList->driContext : NULL;
+	if (shareList) {
+	    pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
+	    shared = &pcp_shared->driContext;
+	}
+
+	pcp = Xmalloc(sizeof *pcp);
+	if (pcp == NULL)
+	    return NULL;
 
 	if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr,
 					    mode->visualID,
-					    &gc->hwContextID, &hwContext))
-	    /* gah, handle this better */
-	    return;
+					    &pcp->hwContextID, &hwContext)) {
+	    Xfree(pcp);
+	    return NULL;
+	}
 
-	gc->driContext.private = 
-	    (*psc->__driScreen.createNewContext)( &psc->__driScreen,
-						  mode, renderType,
-						  shared,
-						  hwContext,
-						  &gc->driContext );
-	if (gc->driContext.private) {
-	    gc->isDirect = GL_TRUE;
-	    gc->screen = mode->screen;
-	    gc->psc = psc;
-	    gc->mode = mode;
+	pcp->driContext.private = 
+	    (*psc->__driScreen.createNewContext)(&psc->__driScreen,
+						 mode, renderType,
+						 shared,
+						 hwContext,
+						 &pcp->driContext);
+	if (pcp->driContext.private == NULL) {
+	    XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
+	    Xfree(pcp);
+	    return NULL;
 	}
-	else {
-	    XF86DRIDestroyContext(psc->dpy, psc->scr, gc->hwContextID);
-	}
+
+	pcp->base.destroyContext = driDestroyContext;
+	pcp->base.bindContext = driBindContext;
+	pcp->base.unbindContext = driUnbindContext;
+
+	return &pcp->base;
     }
+
+    return NULL;
 }
 
 
@@ -824,7 +871,7 @@
     pdpyp->base.destroyDisplay = driDestroyDisplay;
     pdpyp->base.createScreen = driCreateScreen;
 
-    return (void *)pdpyp;
+    return &pdpyp->base;
 }
 
 #endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index d99918a..259add7 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -95,6 +95,7 @@
 typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
 typedef struct __GLXDRIscreenRec __GLXDRIscreen;
 typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
+typedef struct __GLXDRIcontextRec __GLXDRIcontext;
 
 struct __GLXDRIdisplayRec {
     /**
@@ -110,15 +111,26 @@
 
     void (*destroyScreen)(__GLXscreenConfigs *psc);
 
-    void (*createContext)(__GLXscreenConfigs *psc,
-			  const __GLcontextModes *mode,
-			  GLXContext gc, GLXContext shareList, int renderType);
-
+    __GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc,
+				      const __GLcontextModes *mode,
+				      GLXContext gc,
+				      GLXContext shareList, int renderType);
+	
     __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
 					GLXDrawable drawable,
 					GLXContext gc);
 };
 
+struct __GLXDRIcontextRec {
+    void (*destroyContext)(__GLXDRIcontext *context, __GLXscreenConfigs *psc,
+			   Display *dpy);
+    Bool (*bindContext)(__GLXDRIcontext *context,
+			__GLXDRIdrawable *pdraw,
+			__GLXDRIdrawable *pread);
+    
+    void (*unbindContext)(__GLXDRIcontext *context);
+};
+
 struct __GLXDRIdrawableRec {
     XID drawable;
     __GLXscreenConfigs *psc;
@@ -296,11 +308,6 @@
     GLenum error;
 
     /**
-     * Whether this context does direct rendering.
-     */
-    Bool isDirect;
-
-    /**
      * \c dpy of current display for this context.  Will be \c NULL if not
      * current to any display, or if this is the "dummy context".
      */
@@ -349,15 +356,7 @@
     const __GLcontextModes * mode;
 
 #ifdef GLX_DIRECT_RENDERING
-    /**
-     * Per context direct rendering interface functions and data.
-     */
-    __DRIcontext driContext;
-
-    /**
-     * XID for the server side drm_context_t
-     */
-    XID hwContextID;
+    __GLXDRIcontext *driContext;
 #endif
 
     /**
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 6b34acf..7364128 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -313,7 +313,6 @@
     */
     gc->fastImageUnpack = GL_FALSE;
     gc->fillImage = __glFillImage;
-    gc->isDirect = GL_FALSE;
     gc->pc = gc->buf;
     gc->bufEnd = gc->buf + bufSize;
     if (__glXDebug) {
@@ -398,7 +397,14 @@
 		mode = fbconfig;
 	    }
 
-	    psc->driScreen->createContext(psc, mode, gc, shareList, renderType);
+	    gc->driContext = psc->driScreen->createContext(psc, mode, gc,
+							   shareList,
+							   renderType);
+	    if (gc->driContext != NULL) {
+		gc->screen = mode->screen;
+		gc->psc = psc;
+		gc->mode = mode;
+	    }
 	}
 #endif
 
@@ -414,7 +420,7 @@
 	    req->visual = vis->visualid;
 	    req->screen = vis->screen;
 	    req->shareList = shareList ? shareList->xid : None;
-	    req->isDirect = gc->isDirect;
+	    req->isDirect = gc->driContext != NULL;
 	}
 	else if ( use_glx_1_3 ) {
 	    xGLXCreateNewContextReq *req;
@@ -428,7 +434,7 @@
 	    req->screen = fbconfig->screen;
 	    req->renderType = renderType;
 	    req->shareList = shareList ? shareList->xid : None;
-	    req->isDirect = gc->isDirect;
+	    req->isDirect = gc->driContext != NULL;
 	}
 	else {
 	    xGLXVendorPrivateWithReplyReq *vpreq;
@@ -446,7 +452,7 @@
 	    req->screen = fbconfig->screen;
 	    req->renderType = renderType;
 	    req->shareList = shareList ? shareList->xid : None;
-	    req->isDirect = gc->isDirect;
+	    req->isDirect = gc->driContext != NULL;
 	}
 
 	UnlockDisplay(dpy);
@@ -504,12 +510,9 @@
 
 #ifdef GLX_DIRECT_RENDERING
     /* Destroy the direct rendering context */
-    if (gc->isDirect) {
-	if (gc->driContext.private) {
-	    (*gc->driContext.destroyContext)(&gc->driContext);
-	    XF86DRIDestroyContext(dpy, gc->psc->scr, gc->hwContextID);
-	    gc->driContext.private = NULL;
-	}
+    if (gc->driContext) {
+	(*gc->driContext->destroyContext)(gc->driContext, gc->psc, dpy);
+	gc->driContext = NULL;
 	GarbageCollectDRIDrawables(dpy, gc->psc);
     }
 #endif
@@ -591,7 +594,7 @@
     __glXFlushRenderBuffer(gc, gc->pc);
 
 #ifdef GLX_DIRECT_RENDERING
-    if (gc->isDirect) {
+    if (gc->driContext) {
 /* This bit of ugliness unwraps the glFinish function */
 #ifdef glFinish
 #undef glFinish
@@ -627,7 +630,7 @@
     __glXFlushRenderBuffer(gc, gc->pc);
 
 #ifdef GLX_DIRECT_RENDERING
-    if (gc->isDirect) {
+    if (gc->driContext) {
 	XSync(dpy, False);
 	return;
     }
@@ -657,7 +660,7 @@
     (void) __glXFlushRenderBuffer(gc, gc->pc);
 
 #ifdef GLX_DIRECT_RENDERING
-    if (gc->isDirect) {
+    if (gc->driContext) {
       DRI_glXUseXFont(font, first, count, listBase);
       return;
     }
@@ -697,7 +700,7 @@
     }
 
 #ifdef GLX_DIRECT_RENDERING
-    if (gc->isDirect) {
+    if (gc->driContext) {
 	/* NOT_DONE: This does not work yet */
     }
 #endif
@@ -769,7 +772,7 @@
     if (!gc) {
 	return GL_FALSE;
 #ifdef GLX_DIRECT_RENDERING
-    } else if (gc->isDirect) {
+    } else if (gc->driContext) {
 	return GL_TRUE;
 #endif
     }
@@ -1519,7 +1522,7 @@
     int retVal;
 
     /* get the information from the server if we don't have it already */
-    if (!ctx->isDirect && (ctx->mode == NULL)) {
+    if (!ctx->driContext && (ctx->mode == NULL)) {
 	retVal = __glXQueryContextInfo(dpy, ctx);
 	if (Success != retVal) return retVal;
     }
@@ -1713,7 +1716,7 @@
    }
 
 #ifdef __DRI_SWAP_CONTROL
-   if ( gc->isDirect ) {
+   if (gc->driContext) {
        __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
 							     gc->screen );
        __DRIdrawable * const pdraw = GetDRIDrawable( gc->currentDpy,
@@ -1765,7 +1768,7 @@
       return GLX_BAD_VALUE;
    }
 
-   if ( (gc != NULL) && gc->isDirect ) {
+   if (gc != NULL && gc->driContext) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
 							    gc->screen );
       
@@ -1791,7 +1794,7 @@
 #ifdef __DRI_SWAP_CONTROL
    GLXContext gc = __glXGetCurrentContext();
 
-   if ( (gc != NULL) && gc->isDirect ) {
+   if (gc != NULL && gc->driContext) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
 							    gc->screen );
       
@@ -1916,7 +1919,7 @@
    GLXContext gc = __glXGetCurrentContext();
 
 
-   if ( (gc != NULL) && gc->isDirect ) {
+   if (gc != NULL && gc->driContext) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
 							    gc->screen );
       if ( psc->msc && psc->driScreen ) {
@@ -1945,7 +1948,7 @@
    if ( divisor <= 0 || remainder < 0 )
      return GLX_BAD_VALUE;
 
-   if ( (gc != NULL) && gc->isDirect ) {
+   if (gc != NULL && gc->driContext) {
       __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
 							    gc->screen );
       if (psc->msc != NULL && psc->driScreen ) {
@@ -2554,7 +2557,7 @@
     }
  
 #ifdef GLX_DIRECT_RENDERING
-    if (gc->isDirect)
+    if (gc->driContext)
 	return;
 #endif
 
@@ -2606,7 +2609,7 @@
 	return;
 
 #ifdef GLX_DIRECT_RENDERING
-    if (gc->isDirect)
+    if (gc->driContext)
 	return;
 #endif
 
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 2f32618..012a910 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -1177,7 +1177,7 @@
 
 
 #ifdef GLX_DIRECT_RENDERING
-static __DRIdrawable *
+static __GLXDRIdrawable *
 FetchDRIDrawable(Display *dpy, GLXDrawable drawable, GLXContext gc)
 {
     __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
@@ -1189,26 +1189,9 @@
     
     psc = &priv->screenConfigs[gc->screen];
     if (__glxHashLookup(psc->drawHash, drawable, (void *) &pdraw) == 0)
-	return &pdraw->driDrawable;
+	return pdraw;
 
-    pdraw = psc->driScreen->createDrawable(psc, drawable, gc);
-
-    return &pdraw->driDrawable;
-}
-
-static Bool BindContextWrapper( Display *dpy, GLXContext gc,
-				GLXDrawable draw, GLXDrawable read )
-{
-    __DRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
-    __DRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
-
-    return (*gc->driContext.bindContext)(&gc->driContext, pdraw, pread);
-}
-
-
-static Bool UnbindContextWrapper( GLXContext gc )
-{
-    return (*gc->driContext.unbindContext)(&gc->driContext);
+    return psc->driScreen->createDrawable(psc, drawable, gc);
 }
 #endif /* GLX_DIRECT_RENDERING */
 
@@ -1241,27 +1224,23 @@
 	return GL_FALSE;
     }
 
-#ifndef GLX_DIRECT_RENDERING
-    if (gc && gc->isDirect) {
-	return GL_FALSE;
-    }
-#endif
-
     _glapi_check_multithread();
 
 #ifdef GLX_DIRECT_RENDERING
     /* Bind the direct rendering context to the drawable */
-    if (gc && gc->isDirect) {
-	bindReturnValue = (gc->driContext.private) 
-	  ? BindContextWrapper(dpy, gc, draw, read)
-	  : False;
+    if (gc && gc->driContext) {
+	__GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
+	__GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
+
+	bindReturnValue =
+	    (gc->driContext->bindContext) (gc->driContext, pdraw, pread);
     } else
 #endif
     {
 	/* Send a glXMakeCurrent request to bind the new context. */
 	bindReturnValue = 
 	  SendMakeCurrentRequest(dpy, opcode, gc ? gc->xid : None,
-				 ((dpy != oldGC->currentDpy) || oldGC->isDirect)
+				 ((dpy != oldGC->currentDpy) || oldGC->driContext)
 				 ? None : oldGC->currentContextTag,
 				 draw, read, &reply);
     }
@@ -1271,8 +1250,8 @@
 	return False;
     }
 
-    if ((dpy != oldGC->currentDpy || (gc && gc->isDirect)) &&
-	!oldGC->isDirect && oldGC != &dummyContext) {
+    if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
+	!oldGC->driContext && oldGC != &dummyContext) {
 	xGLXMakeCurrentReply dummy_reply;
 
 	/* We are either switching from one dpy to another and have to
@@ -1286,8 +1265,8 @@
 				      & dummy_reply);
     }
 #ifdef GLX_DIRECT_RENDERING
-    else if (oldGC->isDirect && oldGC->driContext.private) {
-	(void) UnbindContextWrapper(oldGC);
+    else if (oldGC->driContext) {
+	oldGC->driContext->unbindContext(oldGC->driContext);
     }
 #endif
 
@@ -1317,15 +1296,11 @@
 		 */
 #ifdef GLX_DIRECT_RENDERING
 		/* Destroy the old direct rendering context */
-		if (oldGC->isDirect) {
-		    if (oldGC->driContext.private) {
-			(*oldGC->driContext.destroyContext)
-			    (&oldGC->driContext);
-			XF86DRIDestroyContext(oldGC->createDpy,
-					      oldGC->psc->scr,
-					      gc->hwContextID);
-			oldGC->driContext.private = NULL;
-		    }
+		if (oldGC->driContext) {
+		    oldGC->driContext->destroyContext(oldGC->driContext,
+						      oldGC->psc,
+						      oldGC->createDpy);
+		    oldGC->driContext = NULL;
 		}
 #endif
 		__glXFreeContext(oldGC);
@@ -1338,7 +1313,7 @@
 	    gc->currentDrawable = draw;
 	    gc->currentReadable = read;
 
-            if (!gc->isDirect) {
+            if (!gc->driContext) {
                if (!IndirectAPI)
                   IndirectAPI = __glXNewIndirectAPI();
                _glapi_set_dispatch(IndirectAPI);
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index a8a649c..871addd 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -5124,7 +5124,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         return CALL_AreTexturesResident(GET_DISPATCH(),
                                         (n, textures, residences));
     } else {
@@ -5274,7 +5274,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -5342,7 +5342,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GenTextures(GET_DISPATCH(), (n, textures));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -5404,7 +5404,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         return CALL_IsTexture(GET_DISPATCH(), (texture));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -5718,7 +5718,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -5791,7 +5791,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetColorTableParameterfv(GET_DISPATCH(),
                                       (target, pname, params));
     } else {
@@ -5861,7 +5861,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetColorTableParameteriv(GET_DISPATCH(),
                                       (target, pname, params));
     } else {
@@ -6184,7 +6184,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetConvolutionFilter(GET_DISPATCH(),
                                   (target, format, type, image));
     } else {
@@ -6259,7 +6259,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetConvolutionParameterfv(GET_DISPATCH(),
                                        (target, pname, params));
     } else {
@@ -6329,7 +6329,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetConvolutionParameteriv(GET_DISPATCH(),
                                        (target, pname, params));
     } else {
@@ -6406,7 +6406,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetHistogram(GET_DISPATCH(),
                           (target, reset, format, type, values));
     } else {
@@ -6480,7 +6480,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -6548,7 +6548,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -6620,7 +6620,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -6691,7 +6691,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
@@ -6756,7 +6756,7 @@
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
         CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
     } else {
         __GLXcontext *const gc = __glXGetCurrentContext();
diff --git a/src/glx/x11/singlepix.c b/src/glx/x11/singlepix.c
index a7b5b79..bc5b162 100644
--- a/src/glx/x11/singlepix.c
+++ b/src/glx/x11/singlepix.c
@@ -118,7 +118,7 @@
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
 
-    if (gc->isDirect) {
+    if (gc->driContext) {
 	CALL_GetSeparableFilter(GET_DISPATCH(),
 				(target, format, type, row, column, span));
 	return;
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py
index 6207b00..b00b8a1 100644
--- a/src/mesa/glapi/glX_proto_send.py
+++ b/src/mesa/glapi/glX_proto_send.py
@@ -373,7 +373,7 @@
 				print '{'
 				print '    __GLXcontext * const gc = __glXGetCurrentContext();'
 				print ''
-				print '    if (gc->isDirect) {'
+				print '    if (gc->driContext) {'
 				print '    %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string())
 				print '    } else {'
 				footer = '}\n}\n'