dri3: Don't fail on version mismatch
[mesa.git] / src / glx / indirect_glx.c
index bb121f85b40f3e27061365c617c38cab32d8811e..cfae12f6c0d515d8d10433d09ed335a077626f18 100644 (file)
  *   Kristian Høgsberg (krh@bitplanet.net)
  */
 
+#include <stdbool.h>
+
 #include "glapi.h"
 #include "glxclient.h"
 
+#include "util/debug.h"
+
 #ifndef GLX_USE_APPLEGL
 
 extern struct _glapi_table *__glXNewIndirectAPI(void);
@@ -58,13 +62,13 @@ indirect_destroy_context(struct glx_context *gc)
 }
 
 static Bool
-SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
-                       GLXContextID gc_id, GLXContextTag gc_tag,
-                       GLXDrawable draw, GLXDrawable read,
-                       GLXContextTag *out_tag)
+SendMakeCurrentRequest(Display * dpy, GLXContextID gc_id,
+                       GLXContextTag gc_tag, GLXDrawable draw,
+                       GLXDrawable read, GLXContextTag *out_tag)
 {
    xGLXMakeCurrentReply reply;
    Bool ret;
+   int opcode = __glXSetupForCommand(dpy);
 
    LockDisplay(dpy);
 
@@ -131,9 +135,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
                      GLXDrawable draw, GLXDrawable read)
 {
    GLXContextTag tag;
-   __GLXattribute *state;
    Display *dpy = gc->psc->dpy;
-   int opcode = __glXSetupForCommand(dpy);
    Bool sent;
 
    if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) {
@@ -143,20 +145,13 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
       tag = 0;
    }
 
-   sent = SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read,
+   sent = SendMakeCurrentRequest(dpy, gc->xid, tag, draw, read,
                                 &gc->currentContextTag);
 
    if (!IndirectAPI)
       IndirectAPI = __glXNewIndirectAPI();
    _glapi_set_dispatch(IndirectAPI);
 
-   state = gc->client_state_private;
-   if (state->array_state == NULL) {
-      glGetString(GL_EXTENSIONS);
-      glGetString(GL_VERSION);
-      __glXInitVertexArrayState(gc);
-   }
-
    return !sent;
 }
 
@@ -164,18 +159,17 @@ static void
 indirect_unbind_context(struct glx_context *gc, struct glx_context *new)
 {
    Display *dpy = gc->psc->dpy;
-   int opcode = __glXSetupForCommand(dpy);
 
    if (gc == new)
       return;
    
-   /* We are either switching to no context, away from a indirect
+   /* We are either switching to no context, away from an indirect
     * context to a direct context or from one dpy to another and have
     * to send a request to the dpy to unbind the previous context.
     */
    if (!new || new->isDirect || new->psc->dpy != dpy) {
-      SendMakeCurrentRequest(dpy, opcode, None,
-                            gc->currentContextTag, None, None, NULL);
+      SendMakeCurrentRequest(dpy, None, gc->currentContextTag, None, None,
+                             NULL);
       gc->currentContextTag = 0;
    }
 }
@@ -379,7 +373,7 @@ indirect_create_context(struct glx_screen *psc,
       return NULL;
    }
    gc->client_state_private = state;
-   state->NoDrawArraysProtocol = (getenv("LIBGL_NO_DRAWARRAYS") != NULL);
+   state->NoDrawArraysProtocol = env_var_as_boolean("LIBGL_NO_DRAWARRAYS", false);
 
    /*
     ** Create a temporary buffer to hold GLX rendering commands.  The size