Used GCC's __builtin_expect when available. Change the way code is
authorIan Romanick <idr@us.ibm.com>
Tue, 21 Dec 2004 23:06:02 +0000 (23:06 +0000)
committerIan Romanick <idr@us.ibm.com>
Tue, 21 Dec 2004 23:06:02 +0000 (23:06 +0000)
generated for commands that can use RenderLarge packets.  Tweak the code for
__glXFlushRenderBuffer slightly.

src/glx/x11/glxext.c
src/glx/x11/indirect.c
src/mesa/glapi/glX_proto_send.py

index c24e22f..1155cd9 100644 (file)
@@ -1263,23 +1263,23 @@ CARD8 __glXSetupForCommand(Display *dpy)
     return priv->majorOpcode;
 }
 
-/*
-** Flush the drawing command transport buffer.
-*/
+/**
+ * Flush the drawing command transport buffer.
+ * 
+ * \param ctx  Context whose transport buffer is to be flushed.
+ * \param pc   Pointer to first unused buffer location.
+ * 
+ * \todo
+ * Modify this function to use \c ctx->pc instead of the explicit
+ * \c pc parameter.
+ */
 GLubyte *__glXFlushRenderBuffer(__GLXcontext *ctx, GLubyte *pc)
 {
-    Display *dpy;
+    Display * const dpy = ctx->currentDpy;
     xGLXRenderReq *req;
-    GLint size;
-
-    if (!(dpy = ctx->currentDpy)) {
-       /* Using the dummy context */
-       ctx->pc = ctx->buf;
-       return ctx->pc;
-    }
+    const GLint size = pc - ctx->buf;
 
-    size = pc - ctx->buf;
-    if (size) {
+    if ( (dpy != NULL) && (size > 0) ) {
        /* Send the entire buffer as an X request */
        LockDisplay(dpy);
        GetReq(GLXRender,req); 
index 48739bb..c476fba 100644 (file)
 #    define NOINLINE
 #  endif
 
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
 /* If the size and opcode values are known at compile-time, this will, on
  * x86 at least, emit them with a single instruction.
  */
@@ -80,7 +84,7 @@ read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_ar
 
 #define X_GLXSingle 0
 
-static NOINLINE GLubyte *
+static NOINLINE FASTCALL GLubyte *
 setup_single_request( __GLXcontext * gc, GLint sop, GLint cmdlen )
 {
     xGLXSingleReq * req;
@@ -95,7 +99,7 @@ setup_single_request( __GLXcontext * gc, GLint sop, GLint cmdlen )
     return (GLubyte *)(req) + sz_xGLXSingleReq;
 }
 
-static NOINLINE GLubyte *
+static NOINLINE FASTCALL GLubyte *
 setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
 {
     xGLXVendorPrivateReq * req;
@@ -120,7 +124,7 @@ generic_3_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 3);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -132,7 +136,7 @@ generic_4_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -144,7 +148,7 @@ generic_6_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 6);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -156,7 +160,7 @@ generic_8_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -168,7 +172,7 @@ generic_12_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 12);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -180,7 +184,7 @@ generic_16_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 16);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -192,7 +196,7 @@ generic_24_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 24);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 static FASTCALL NOINLINE void
@@ -204,7 +208,7 @@ generic_32_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, 32);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLsop_NewList 101
@@ -214,12 +218,11 @@ __indirect_glNewList(GLuint list, GLenum mode)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_NewList, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&list), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&mode), 4);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -231,10 +234,9 @@ __indirect_glEndList(void)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 0;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         (void) setup_single_request(gc, X_GLsop_EndList, cmdlen);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -244,13 +246,11 @@ void
 __indirect_glCallList(GLuint list)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CallList, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&list), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CallLists 2
@@ -258,30 +258,30 @@ void
 __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glCallLists_size(type);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * n));
-    if (dpy == NULL) return;
-    if ( ((gc->pc + cmdlen) > gc->bufEnd)
-         || (cmdlen > gc->maxSmallRenderCommandSize)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-    if (cmdlen <= gc->maxSmallRenderCommandSize) {
-        emit_header(gc->pc, X_GLrop_CallLists, cmdlen);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&n), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&type), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(lists), (compsize * n));
-        gc->pc += cmdlen;
-        if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
-    }
-    else {
-        const GLint op = X_GLrop_CallLists;
-        const GLuint cmdlenLarge = cmdlen + 4;
-        (void) memcpy((void *)(gc->pc + 0), (void *)(&op), 4);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&cmdlenLarge), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&n), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(&type), 4);
-        __glXSendLargeCommand(gc, gc->pc, 16, lists, (compsize * n));
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ( (gc->pc + cmdlen) > gc->bufEnd ) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_CallLists, cmdlen);
+            (void) memcpy((void *)(gc->pc + 4), (void *)(&n), 4);
+            (void) memcpy((void *)(gc->pc + 8), (void *)(&type), 4);
+            (void) memcpy((void *)(gc->pc + 12), (void *)(lists), (compsize * n));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+        }
+        else {
+            const GLint op = X_GLrop_CallLists;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *)(pc + 0), (void *)(&op), 4);
+            (void) memcpy((void *)(pc + 4), (void *)(&cmdlenLarge), 4);
+            (void) memcpy((void *)(pc + 8), (void *)(&n), 4);
+            (void) memcpy((void *)(pc + 12), (void *)(&type), 4);
+            __glXSendLargeCommand(gc, pc, 16, lists, (compsize * n));
+        }
     }
 }
 
@@ -292,12 +292,11 @@ __indirect_glDeleteLists(GLuint list, GLsizei range)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_DeleteLists, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&list), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&range), 4);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -310,12 +309,11 @@ __indirect_glGenLists(GLsizei range)
     Display * const dpy = gc->currentDpy;
     GLuint retval = (GLuint) 0;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GenLists, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&range), 4);
-        retval = (GLuint) read_reply(gc->currentDpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        retval = (GLuint) read_reply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return retval;
 }
@@ -325,13 +323,11 @@ void
 __indirect_glListBase(GLuint base)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ListBase, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&base), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Begin 4
@@ -339,13 +335,11 @@ void
 __indirect_glBegin(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Begin, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3bv 6
@@ -353,15 +347,13 @@ void
 __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3bv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3bv 6
@@ -376,15 +368,13 @@ void
 __indirect_glColor3d(GLdouble red, GLdouble green, GLdouble blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&green), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&blue), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3dv 7
@@ -399,15 +389,13 @@ void
 __indirect_glColor3f(GLfloat red, GLfloat green, GLfloat blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3fv 8
@@ -422,15 +410,13 @@ void
 __indirect_glColor3i(GLint red, GLint green, GLint blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3iv 9
@@ -445,15 +431,13 @@ void
 __indirect_glColor3s(GLshort red, GLshort green, GLshort blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&green), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&blue), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3sv 10
@@ -468,15 +452,13 @@ void
 __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3ubv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3ubv 11
@@ -491,15 +473,13 @@ void
 __indirect_glColor3ui(GLuint red, GLuint green, GLuint blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3uiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3uiv 12
@@ -514,15 +494,13 @@ void
 __indirect_glColor3us(GLushort red, GLushort green, GLushort blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color3usv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&green), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&blue), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color3usv 13
@@ -537,16 +515,14 @@ void
 __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4bv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     (void) memcpy((void *)(gc->pc + 7), (void *)(&alpha), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4bv 14
@@ -561,16 +537,14 @@ void
 __indirect_glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&green), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&blue), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&alpha), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4dv 15
@@ -585,16 +559,14 @@ void
 __indirect_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&alpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4fv 16
@@ -609,16 +581,14 @@ void
 __indirect_glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&alpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4iv 17
@@ -633,16 +603,14 @@ void
 __indirect_glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&green), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&blue), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&alpha), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4sv 18
@@ -657,16 +625,14 @@ void
 __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4ubv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     (void) memcpy((void *)(gc->pc + 7), (void *)(&alpha), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4ubv 19
@@ -681,16 +647,14 @@ void
 __indirect_glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4uiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&alpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4uiv 20
@@ -705,16 +669,14 @@ void
 __indirect_glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Color4usv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&green), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&blue), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&alpha), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Color4usv 21
@@ -729,13 +691,11 @@ void
 __indirect_glEdgeFlag(GLboolean flag)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EdgeFlagv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&flag), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EdgeFlagv 22
@@ -743,13 +703,11 @@ void
 __indirect_glEdgeFlagv(const GLboolean * flag)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EdgeFlagv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(flag), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_End 23
@@ -757,12 +715,10 @@ void
 __indirect_glEnd(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_End, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexdv 24
@@ -770,13 +726,11 @@ void
 __indirect_glIndexd(GLdouble c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexdv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&c), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexdv 24
@@ -791,13 +745,11 @@ void
 __indirect_glIndexf(GLfloat c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&c), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexfv 25
@@ -812,13 +764,11 @@ void
 __indirect_glIndexi(GLint c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&c), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexiv 26
@@ -833,13 +783,11 @@ void
 __indirect_glIndexs(GLshort c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexsv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&c), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexsv 27
@@ -847,13 +795,11 @@ void
 __indirect_glIndexsv(const GLshort * c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexsv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(c), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Normal3bv 28
@@ -861,15 +807,13 @@ void
 __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Normal3bv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&nx), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&ny), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&nz), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Normal3bv 28
@@ -884,15 +828,13 @@ void
 __indirect_glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Normal3dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&nx), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&ny), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&nz), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Normal3dv 29
@@ -907,15 +849,13 @@ void
 __indirect_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Normal3fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&nx), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&ny), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&nz), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Normal3fv 30
@@ -930,15 +870,13 @@ void
 __indirect_glNormal3i(GLint nx, GLint ny, GLint nz)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Normal3iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&nx), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&ny), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&nz), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Normal3iv 31
@@ -953,15 +891,13 @@ void
 __indirect_glNormal3s(GLshort nx, GLshort ny, GLshort nz)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Normal3sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&nx), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&ny), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&nz), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Normal3sv 32
@@ -976,14 +912,12 @@ void
 __indirect_glRasterPos2d(GLdouble x, GLdouble y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos2dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos2dv 33
@@ -998,14 +932,12 @@ void
 __indirect_glRasterPos2f(GLfloat x, GLfloat y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos2fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos2fv 34
@@ -1020,14 +952,12 @@ void
 __indirect_glRasterPos2i(GLint x, GLint y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos2iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos2iv 35
@@ -1042,14 +972,12 @@ void
 __indirect_glRasterPos2s(GLshort x, GLshort y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos2sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos2sv 36
@@ -1064,15 +992,13 @@ void
 __indirect_glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos3dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&z), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos3dv 37
@@ -1087,15 +1013,13 @@ void
 __indirect_glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos3fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos3fv 38
@@ -1110,15 +1034,13 @@ void
 __indirect_glRasterPos3i(GLint x, GLint y, GLint z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos3iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos3iv 39
@@ -1133,15 +1055,13 @@ void
 __indirect_glRasterPos3s(GLshort x, GLshort y, GLshort z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos3sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&z), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos3sv 40
@@ -1156,16 +1076,14 @@ void
 __indirect_glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos4dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&z), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&w), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos4dv 41
@@ -1180,16 +1098,14 @@ void
 __indirect_glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos4fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&w), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos4fv 42
@@ -1204,16 +1120,14 @@ void
 __indirect_glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos4iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&w), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos4iv 43
@@ -1228,16 +1142,14 @@ void
 __indirect_glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_RasterPos4sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&z), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&w), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_RasterPos4sv 44
@@ -1252,16 +1164,14 @@ void
 __indirect_glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectdv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x1), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y1), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&x2), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&y2), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectdv 45
@@ -1269,14 +1179,12 @@ void
 __indirect_glRectdv(const GLdouble * v1, const GLdouble * v2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectdv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v1), 16);
     (void) memcpy((void *)(gc->pc + 20), (void *)(v2), 16);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectfv 46
@@ -1284,16 +1192,14 @@ void
 __indirect_glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x1), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y1), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&x2), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&y2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectfv 46
@@ -1301,14 +1207,12 @@ void
 __indirect_glRectfv(const GLfloat * v1, const GLfloat * v2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v1), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(v2), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectiv 47
@@ -1316,16 +1220,14 @@ void
 __indirect_glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x1), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y1), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&x2), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&y2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectiv 47
@@ -1333,14 +1235,12 @@ void
 __indirect_glRectiv(const GLint * v1, const GLint * v2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v1), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(v2), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectsv 48
@@ -1348,16 +1248,14 @@ void
 __indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectsv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x1), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y1), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&x2), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&y2), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rectsv 48
@@ -1365,14 +1263,12 @@ void
 __indirect_glRectsv(const GLshort * v1, const GLshort * v2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rectsv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v1), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord1dv 49
@@ -1380,13 +1276,11 @@ void
 __indirect_glTexCoord1d(GLdouble s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord1dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord1dv 49
@@ -1401,13 +1295,11 @@ void
 __indirect_glTexCoord1f(GLfloat s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord1fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord1fv 50
@@ -1422,13 +1314,11 @@ void
 __indirect_glTexCoord1i(GLint s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord1iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord1iv 51
@@ -1443,13 +1333,11 @@ void
 __indirect_glTexCoord1s(GLshort s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord1sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord1sv 52
@@ -1457,13 +1345,11 @@ void
 __indirect_glTexCoord1sv(const GLshort * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord1sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord2dv 53
@@ -1471,14 +1357,12 @@ void
 __indirect_glTexCoord2d(GLdouble s, GLdouble t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord2dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord2dv 53
@@ -1493,14 +1377,12 @@ void
 __indirect_glTexCoord2f(GLfloat s, GLfloat t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord2fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&t), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord2fv 54
@@ -1515,14 +1397,12 @@ void
 __indirect_glTexCoord2i(GLint s, GLint t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord2iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&t), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord2iv 55
@@ -1537,14 +1417,12 @@ void
 __indirect_glTexCoord2s(GLshort s, GLshort t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord2sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&t), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord2sv 56
@@ -1559,15 +1437,13 @@ void
 __indirect_glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord3dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&r), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord3dv 57
@@ -1582,15 +1458,13 @@ void
 __indirect_glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord3fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&t), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&r), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord3fv 58
@@ -1605,15 +1479,13 @@ void
 __indirect_glTexCoord3i(GLint s, GLint t, GLint r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord3iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&t), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&r), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord3iv 59
@@ -1628,15 +1500,13 @@ void
 __indirect_glTexCoord3s(GLshort s, GLshort t, GLshort r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord3sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&t), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&r), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord3sv 60
@@ -1651,16 +1521,14 @@ void
 __indirect_glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord4dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&r), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&q), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord4dv 61
@@ -1675,16 +1543,14 @@ void
 __indirect_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord4fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&t), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&r), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&q), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord4fv 62
@@ -1699,16 +1565,14 @@ void
 __indirect_glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord4iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&t), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&r), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&q), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord4iv 63
@@ -1723,16 +1587,14 @@ void
 __indirect_glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexCoord4sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&t), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&r), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&q), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexCoord4sv 64
@@ -1747,14 +1609,12 @@ void
 __indirect_glVertex2d(GLdouble x, GLdouble y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex2dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex2dv 65
@@ -1769,14 +1629,12 @@ void
 __indirect_glVertex2f(GLfloat x, GLfloat y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex2fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex2fv 66
@@ -1791,14 +1649,12 @@ void
 __indirect_glVertex2i(GLint x, GLint y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex2iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex2iv 67
@@ -1813,14 +1669,12 @@ void
 __indirect_glVertex2s(GLshort x, GLshort y)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex2sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex2sv 68
@@ -1835,15 +1689,13 @@ void
 __indirect_glVertex3d(GLdouble x, GLdouble y, GLdouble z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex3dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&z), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex3dv 69
@@ -1858,15 +1710,13 @@ void
 __indirect_glVertex3f(GLfloat x, GLfloat y, GLfloat z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex3fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex3fv 70
@@ -1881,15 +1731,13 @@ void
 __indirect_glVertex3i(GLint x, GLint y, GLint z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex3iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex3iv 71
@@ -1904,15 +1752,13 @@ void
 __indirect_glVertex3s(GLshort x, GLshort y, GLshort z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex3sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&z), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex3sv 72
@@ -1927,16 +1773,14 @@ void
 __indirect_glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex4dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&z), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&w), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex4dv 73
@@ -1951,16 +1795,14 @@ void
 __indirect_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex4fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&w), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex4fv 74
@@ -1975,16 +1817,14 @@ void
 __indirect_glVertex4i(GLint x, GLint y, GLint z, GLint w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex4iv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&w), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex4iv 75
@@ -1999,16 +1839,14 @@ void
 __indirect_glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Vertex4sv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&y), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&z), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&w), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Vertex4sv 76
@@ -2023,14 +1861,12 @@ void
 __indirect_glClipPlane(GLenum plane, const GLdouble * equation)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 40;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ClipPlane, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(equation), 32);
     (void) memcpy((void *)(gc->pc + 36), (void *)(&plane), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ColorMaterial 78
@@ -2038,14 +1874,12 @@ void
 __indirect_glColorMaterial(GLenum face, GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ColorMaterial, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CullFace 79
@@ -2053,13 +1887,11 @@ void
 __indirect_glCullFace(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CullFace, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Fogf 80
@@ -2067,14 +1899,12 @@ void
 __indirect_glFogf(GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Fogf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Fogfv 81
@@ -2082,15 +1912,13 @@ void
 __indirect_glFogfv(GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glFogfv_size(pname);
     const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Fogfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Fogi 82
@@ -2098,14 +1926,12 @@ void
 __indirect_glFogi(GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Fogi, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Fogiv 83
@@ -2113,15 +1939,13 @@ void
 __indirect_glFogiv(GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glFogiv_size(pname);
     const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Fogiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_FrontFace 84
@@ -2129,13 +1953,11 @@ void
 __indirect_glFrontFace(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_FrontFace, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Hint 85
@@ -2143,14 +1965,12 @@ void
 __indirect_glHint(GLenum target, GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Hint, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Lightf 86
@@ -2158,15 +1978,13 @@ void
 __indirect_glLightf(GLenum light, GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Lightf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&light), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Lightfv 87
@@ -2174,16 +1992,14 @@ void
 __indirect_glLightfv(GLenum light, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glLightfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Lightfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&light), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Lighti 88
@@ -2191,15 +2007,13 @@ void
 __indirect_glLighti(GLenum light, GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Lighti, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&light), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Lightiv 89
@@ -2207,16 +2021,14 @@ void
 __indirect_glLightiv(GLenum light, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glLightiv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Lightiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&light), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LightModelf 90
@@ -2224,14 +2036,12 @@ void
 __indirect_glLightModelf(GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LightModelf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LightModelfv 91
@@ -2239,15 +2049,13 @@ void
 __indirect_glLightModelfv(GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glLightModelfv_size(pname);
     const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LightModelfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LightModeli 92
@@ -2255,14 +2063,12 @@ void
 __indirect_glLightModeli(GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LightModeli, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LightModeliv 93
@@ -2270,15 +2076,13 @@ void
 __indirect_glLightModeliv(GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glLightModeliv_size(pname);
     const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LightModeliv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LineStipple 94
@@ -2286,14 +2090,12 @@ void
 __indirect_glLineStipple(GLint factor, GLushort pattern)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LineStipple, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&factor), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pattern), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LineWidth 95
@@ -2301,13 +2103,11 @@ void
 __indirect_glLineWidth(GLfloat width)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LineWidth, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&width), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Materialf 96
@@ -2315,15 +2115,13 @@ void
 __indirect_glMaterialf(GLenum face, GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Materialf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Materialfv 97
@@ -2331,16 +2129,14 @@ void
 __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glMaterialfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Materialfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Materiali 98
@@ -2348,15 +2144,13 @@ void
 __indirect_glMateriali(GLenum face, GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Materiali, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Materialiv 99
@@ -2364,16 +2158,14 @@ void
 __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glMaterialiv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Materialiv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PointSize 100
@@ -2381,13 +2173,11 @@ void
 __indirect_glPointSize(GLfloat size)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PointSize, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&size), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PolygonMode 101
@@ -2395,14 +2185,12 @@ void
 __indirect_glPolygonMode(GLenum face, GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PolygonMode, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Scissor 103
@@ -2410,16 +2198,14 @@ void
 __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Scissor, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&height), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ShadeModel 104
@@ -2427,13 +2213,11 @@ void
 __indirect_glShadeModel(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ShadeModel, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexParameterf 105
@@ -2441,15 +2225,13 @@ void
 __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexParameterf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexParameterfv 106
@@ -2457,16 +2239,14 @@ void
 __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexParameterfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexParameterfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexParameteri 107
@@ -2474,15 +2254,13 @@ void
 __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexParameteri, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexParameteriv 108
@@ -2490,16 +2268,14 @@ void
 __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexParameteriv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexParameteriv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexEnvf 111
@@ -2507,15 +2283,13 @@ void
 __indirect_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexEnvf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexEnvfv 112
@@ -2523,16 +2297,14 @@ void
 __indirect_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexEnvfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexEnvfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexEnvi 113
@@ -2540,15 +2312,13 @@ void
 __indirect_glTexEnvi(GLenum target, GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexEnvi, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexEnviv 114
@@ -2556,16 +2326,14 @@ void
 __indirect_glTexEnviv(GLenum target, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexEnviv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexEnviv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexGend 115
@@ -2573,15 +2341,13 @@ void
 __indirect_glTexGend(GLenum coord, GLenum pname, GLdouble param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexGend, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&param), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&coord), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&pname), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexGendv 116
@@ -2589,16 +2355,14 @@ void
 __indirect_glTexGendv(GLenum coord, GLenum pname, const GLdouble * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexGendv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexGendv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 8));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexGenf 117
@@ -2606,15 +2370,13 @@ void
 __indirect_glTexGenf(GLenum coord, GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexGenf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexGenfv 118
@@ -2622,16 +2384,14 @@ void
 __indirect_glTexGenfv(GLenum coord, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexGenfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexGenfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexGeni 119
@@ -2639,15 +2399,13 @@ void
 __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexGeni, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_TexGeniv 120
@@ -2655,16 +2413,14 @@ void
 __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glTexGeniv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_TexGeniv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_InitNames 121
@@ -2672,12 +2428,10 @@ void
 __indirect_glInitNames(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_InitNames, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LoadName 122
@@ -2685,13 +2439,11 @@ void
 __indirect_glLoadName(GLuint name)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LoadName, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&name), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PassThrough 123
@@ -2699,13 +2451,11 @@ void
 __indirect_glPassThrough(GLfloat token)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PassThrough, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&token), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PopName 124
@@ -2713,12 +2463,10 @@ void
 __indirect_glPopName(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PopName, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PushName 125
@@ -2726,13 +2474,11 @@ void
 __indirect_glPushName(GLuint name)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PushName, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&name), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_DrawBuffer 126
@@ -2740,13 +2486,11 @@ void
 __indirect_glDrawBuffer(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_DrawBuffer, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Clear 127
@@ -2754,13 +2498,11 @@ void
 __indirect_glClear(GLbitfield mask)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Clear, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mask), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ClearAccum 128
@@ -2768,16 +2510,14 @@ void
 __indirect_glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ClearAccum, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&alpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ClearIndex 129
@@ -2785,13 +2525,11 @@ void
 __indirect_glClearIndex(GLfloat c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ClearIndex, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&c), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ClearColor 130
@@ -2799,16 +2537,14 @@ void
 __indirect_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ClearColor, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&alpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ClearStencil 131
@@ -2816,13 +2552,11 @@ void
 __indirect_glClearStencil(GLint s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ClearStencil, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ClearDepth 132
@@ -2830,13 +2564,11 @@ void
 __indirect_glClearDepth(GLclampd depth)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ClearDepth, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&depth), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_StencilMask 133
@@ -2844,13 +2576,11 @@ void
 __indirect_glStencilMask(GLuint mask)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_StencilMask, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mask), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ColorMask 134
@@ -2858,16 +2588,14 @@ void
 __indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ColorMask, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     (void) memcpy((void *)(gc->pc + 7), (void *)(&alpha), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_DepthMask 135
@@ -2875,13 +2603,11 @@ void
 __indirect_glDepthMask(GLboolean flag)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_DepthMask, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&flag), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_IndexMask 136
@@ -2889,13 +2615,11 @@ void
 __indirect_glIndexMask(GLuint mask)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_IndexMask, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mask), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Accum 137
@@ -2903,14 +2627,12 @@ void
 __indirect_glAccum(GLenum op, GLfloat value)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Accum, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&op), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&value), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PopAttrib 141
@@ -2918,12 +2640,10 @@ void
 __indirect_glPopAttrib(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PopAttrib, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PushAttrib 142
@@ -2931,13 +2651,11 @@ void
 __indirect_glPushAttrib(GLbitfield mask)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PushAttrib, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mask), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MapGrid1d 147
@@ -2945,15 +2663,13 @@ void
 __indirect_glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MapGrid1d, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&u1), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&u2), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&un), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MapGrid1f 148
@@ -2961,15 +2677,13 @@ void
 __indirect_glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MapGrid1f, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&un), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&u1), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&u2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MapGrid2d 149
@@ -2977,9 +2691,7 @@ void
 __indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 44;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MapGrid2d, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&u1), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&u2), 8);
@@ -2988,7 +2700,7 @@ __indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1
     (void) memcpy((void *)(gc->pc + 36), (void *)(&un), 4);
     (void) memcpy((void *)(gc->pc + 40), (void *)(&vn), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MapGrid2f 150
@@ -2996,9 +2708,7 @@ void
 __indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MapGrid2f, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&un), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&u1), 4);
@@ -3007,7 +2717,7 @@ __indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, G
     (void) memcpy((void *)(gc->pc + 20), (void *)(&v1), 4);
     (void) memcpy((void *)(gc->pc + 24), (void *)(&v2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalCoord1dv 151
@@ -3015,13 +2725,11 @@ void
 __indirect_glEvalCoord1d(GLdouble u)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalCoord1dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&u), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalCoord1dv 151
@@ -3036,13 +2744,11 @@ void
 __indirect_glEvalCoord1f(GLfloat u)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalCoord1fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&u), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalCoord1fv 152
@@ -3057,14 +2763,12 @@ void
 __indirect_glEvalCoord2d(GLdouble u, GLdouble v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalCoord2dv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&u), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&v), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalCoord2dv 153
@@ -3079,14 +2783,12 @@ void
 __indirect_glEvalCoord2f(GLfloat u, GLfloat v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalCoord2fv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&u), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&v), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalCoord2fv 154
@@ -3101,15 +2803,13 @@ void
 __indirect_glEvalMesh1(GLenum mode, GLint i1, GLint i2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalMesh1, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&i1), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&i2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalPoint1 156
@@ -3117,13 +2817,11 @@ void
 __indirect_glEvalPoint1(GLint i)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalPoint1, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&i), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalMesh2 157
@@ -3131,9 +2829,7 @@ void
 __indirect_glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalMesh2, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&i1), 4);
@@ -3141,7 +2837,7 @@ __indirect_glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
     (void) memcpy((void *)(gc->pc + 16), (void *)(&j1), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&j2), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_EvalPoint2 158
@@ -3149,14 +2845,12 @@ void
 __indirect_glEvalPoint2(GLint i, GLint j)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_EvalPoint2, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&i), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&j), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_AlphaFunc 159
@@ -3164,14 +2858,12 @@ void
 __indirect_glAlphaFunc(GLenum func, GLclampf ref)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_AlphaFunc, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&func), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&ref), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_BlendFunc 160
@@ -3179,14 +2871,12 @@ void
 __indirect_glBlendFunc(GLenum sfactor, GLenum dfactor)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_BlendFunc, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&sfactor), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&dfactor), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LogicOp 161
@@ -3194,13 +2884,11 @@ void
 __indirect_glLogicOp(GLenum opcode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LogicOp, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&opcode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_StencilFunc 162
@@ -3208,15 +2896,13 @@ void
 __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_StencilFunc, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&func), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&ref), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&mask), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_StencilOp 163
@@ -3224,15 +2910,13 @@ void
 __indirect_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_StencilOp, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&fail), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&zfail), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&zpass), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_DepthFunc 164
@@ -3240,13 +2924,11 @@ void
 __indirect_glDepthFunc(GLenum func)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_DepthFunc, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&func), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PixelZoom 165
@@ -3254,14 +2936,12 @@ void
 __indirect_glPixelZoom(GLfloat xfactor, GLfloat yfactor)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PixelZoom, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&xfactor), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&yfactor), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PixelTransferf 166
@@ -3269,14 +2949,12 @@ void
 __indirect_glPixelTransferf(GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PixelTransferf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PixelTransferi 167
@@ -3284,14 +2962,12 @@ void
 __indirect_glPixelTransferi(GLenum pname, GLint param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PixelTransferi, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PixelMapfv 168
@@ -3299,30 +2975,29 @@ void
 __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
-    if (mapsize < 0) return;
-    if (dpy == NULL) return;
-    if ( ((gc->pc + cmdlen) > gc->bufEnd)
-         || (cmdlen > gc->maxSmallRenderCommandSize)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-    if (cmdlen <= gc->maxSmallRenderCommandSize) {
-        emit_header(gc->pc, X_GLrop_PixelMapfv, cmdlen);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&map), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&mapsize), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(values), (mapsize * 4));
-        gc->pc += cmdlen;
-        if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
-    }
-    else {
-        const GLint op = X_GLrop_PixelMapfv;
-        const GLuint cmdlenLarge = cmdlen + 4;
-        (void) memcpy((void *)(gc->pc + 0), (void *)(&op), 4);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&cmdlenLarge), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&map), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(&mapsize), 4);
-        __glXSendLargeCommand(gc, gc->pc, 16, values, (mapsize * 4));
+    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ( (gc->pc + cmdlen) > gc->bufEnd ) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_PixelMapfv, cmdlen);
+            (void) memcpy((void *)(gc->pc + 4), (void *)(&map), 4);
+            (void) memcpy((void *)(gc->pc + 8), (void *)(&mapsize), 4);
+            (void) memcpy((void *)(gc->pc + 12), (void *)(values), (mapsize * 4));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+        }
+        else {
+            const GLint op = X_GLrop_PixelMapfv;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *)(pc + 0), (void *)(&op), 4);
+            (void) memcpy((void *)(pc + 4), (void *)(&cmdlenLarge), 4);
+            (void) memcpy((void *)(pc + 8), (void *)(&map), 4);
+            (void) memcpy((void *)(pc + 12), (void *)(&mapsize), 4);
+            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
+        }
     }
 }
 
@@ -3331,30 +3006,29 @@ void
 __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
-    if (mapsize < 0) return;
-    if (dpy == NULL) return;
-    if ( ((gc->pc + cmdlen) > gc->bufEnd)
-         || (cmdlen > gc->maxSmallRenderCommandSize)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-    if (cmdlen <= gc->maxSmallRenderCommandSize) {
-        emit_header(gc->pc, X_GLrop_PixelMapuiv, cmdlen);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&map), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&mapsize), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(values), (mapsize * 4));
-        gc->pc += cmdlen;
-        if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
-    }
-    else {
-        const GLint op = X_GLrop_PixelMapuiv;
-        const GLuint cmdlenLarge = cmdlen + 4;
-        (void) memcpy((void *)(gc->pc + 0), (void *)(&op), 4);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&cmdlenLarge), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&map), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(&mapsize), 4);
-        __glXSendLargeCommand(gc, gc->pc, 16, values, (mapsize * 4));
+    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ( (gc->pc + cmdlen) > gc->bufEnd ) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_PixelMapuiv, cmdlen);
+            (void) memcpy((void *)(gc->pc + 4), (void *)(&map), 4);
+            (void) memcpy((void *)(gc->pc + 8), (void *)(&mapsize), 4);
+            (void) memcpy((void *)(gc->pc + 12), (void *)(values), (mapsize * 4));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+        }
+        else {
+            const GLint op = X_GLrop_PixelMapuiv;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *)(pc + 0), (void *)(&op), 4);
+            (void) memcpy((void *)(pc + 4), (void *)(&cmdlenLarge), 4);
+            (void) memcpy((void *)(pc + 8), (void *)(&map), 4);
+            (void) memcpy((void *)(pc + 12), (void *)(&mapsize), 4);
+            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
+        }
     }
 }
 
@@ -3363,30 +3037,29 @@ void
 __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 2));
-    if (mapsize < 0) return;
-    if (dpy == NULL) return;
-    if ( ((gc->pc + cmdlen) > gc->bufEnd)
-         || (cmdlen > gc->maxSmallRenderCommandSize)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-    if (cmdlen <= gc->maxSmallRenderCommandSize) {
-        emit_header(gc->pc, X_GLrop_PixelMapusv, cmdlen);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&map), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&mapsize), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(values), (mapsize * 2));
-        gc->pc += cmdlen;
-        if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
-    }
-    else {
-        const GLint op = X_GLrop_PixelMapusv;
-        const GLuint cmdlenLarge = cmdlen + 4;
-        (void) memcpy((void *)(gc->pc + 0), (void *)(&op), 4);
-        (void) memcpy((void *)(gc->pc + 4), (void *)(&cmdlenLarge), 4);
-        (void) memcpy((void *)(gc->pc + 8), (void *)(&map), 4);
-        (void) memcpy((void *)(gc->pc + 12), (void *)(&mapsize), 4);
-        __glXSendLargeCommand(gc, gc->pc, 16, values, (mapsize * 2));
+    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ( (gc->pc + cmdlen) > gc->bufEnd ) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_PixelMapusv, cmdlen);
+            (void) memcpy((void *)(gc->pc + 4), (void *)(&map), 4);
+            (void) memcpy((void *)(gc->pc + 8), (void *)(&mapsize), 4);
+            (void) memcpy((void *)(gc->pc + 12), (void *)(values), (mapsize * 2));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+        }
+        else {
+            const GLint op = X_GLrop_PixelMapusv;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *)(pc + 0), (void *)(&op), 4);
+            (void) memcpy((void *)(pc + 4), (void *)(&cmdlenLarge), 4);
+            (void) memcpy((void *)(pc + 8), (void *)(&map), 4);
+            (void) memcpy((void *)(pc + 12), (void *)(&mapsize), 4);
+            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 2));
+        }
     }
 }
 
@@ -3395,13 +3068,11 @@ void
 __indirect_glReadBuffer(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ReadBuffer, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyPixels 172
@@ -3409,9 +3080,7 @@ void
 __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyPixels, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
@@ -3419,7 +3088,7 @@ __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
     (void) memcpy((void *)(gc->pc + 16), (void *)(&height), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&type), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLsop_GetClipPlane 113
@@ -3429,12 +3098,11 @@ __indirect_glGetClipPlane(GLenum plane, GLdouble * equation)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetClipPlane, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&plane), 4);
-        (void) read_reply(gc->currentDpy, 8, equation, GL_TRUE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 8, equation, GL_TRUE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3446,13 +3114,12 @@ __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetLightfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&light), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3464,13 +3131,12 @@ __indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetLightiv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&light), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3482,13 +3148,12 @@ __indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMapdv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&query), 4);
-        (void) read_reply(gc->currentDpy, 8, v, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 8, v, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3500,13 +3165,12 @@ __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMapfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&query), 4);
-        (void) read_reply(gc->currentDpy, 4, v, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, v, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3518,13 +3182,12 @@ __indirect_glGetMapiv(GLenum target, GLenum query, GLint * v)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMapiv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&query), 4);
-        (void) read_reply(gc->currentDpy, 4, v, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, v, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3536,13 +3199,12 @@ __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMaterialfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&face), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3554,13 +3216,12 @@ __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMaterialiv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&face), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3572,12 +3233,11 @@ __indirect_glGetPixelMapfv(GLenum map, GLfloat * values)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetPixelMapfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&map), 4);
-        (void) read_reply(gc->currentDpy, 4, values, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, values, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3589,12 +3249,11 @@ __indirect_glGetPixelMapuiv(GLenum map, GLuint * values)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetPixelMapuiv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&map), 4);
-        (void) read_reply(gc->currentDpy, 4, values, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, values, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3606,12 +3265,11 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetPixelMapusv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&map), 4);
-        (void) read_reply(gc->currentDpy, 2, values, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 2, values, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3623,13 +3281,12 @@ __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexEnvfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3641,13 +3298,12 @@ __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexEnviv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3659,13 +3315,12 @@ __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexGendv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&coord), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 8, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 8, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3677,13 +3332,12 @@ __indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexGenfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&coord), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3695,13 +3349,12 @@ __indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexGeniv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&coord), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3713,13 +3366,12 @@ __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexParameterfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3731,13 +3383,12 @@ __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexParameteriv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3749,14 +3400,13 @@ __indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GL
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexLevelParameterfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&level), 4);
         (void) memcpy((void *)(pc + 8), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3768,14 +3418,13 @@ __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GL
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexLevelParameteriv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&level), 4);
         (void) memcpy((void *)(pc + 8), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -3788,12 +3437,11 @@ __indirect_glIsList(GLuint list)
     Display * const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_IsList, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&list), 4);
-        retval = (GLboolean) read_reply(gc->currentDpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        retval = (GLboolean) read_reply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return retval;
 }
@@ -3803,14 +3451,12 @@ void
 __indirect_glDepthRange(GLclampd zNear, GLclampd zFar)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_DepthRange, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&zNear), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&zFar), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Frustum 175
@@ -3818,9 +3464,7 @@ void
 __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 52;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Frustum, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&left), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&right), 8);
@@ -3829,7 +3473,7 @@ __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble to
     (void) memcpy((void *)(gc->pc + 36), (void *)(&zNear), 8);
     (void) memcpy((void *)(gc->pc + 44), (void *)(&zFar), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LoadIdentity 176
@@ -3837,12 +3481,10 @@ void
 __indirect_glLoadIdentity(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LoadIdentity, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LoadMatrixf 177
@@ -3850,13 +3492,11 @@ void
 __indirect_glLoadMatrixf(const GLfloat * m)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 68;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LoadMatrixf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(m), 64);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_LoadMatrixd 178
@@ -3864,13 +3504,11 @@ void
 __indirect_glLoadMatrixd(const GLdouble * m)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 132;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_LoadMatrixd, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(m), 128);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MatrixMode 179
@@ -3878,13 +3516,11 @@ void
 __indirect_glMatrixMode(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MatrixMode, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultMatrixf 180
@@ -3892,13 +3528,11 @@ void
 __indirect_glMultMatrixf(const GLfloat * m)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 68;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultMatrixf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(m), 64);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultMatrixd 181
@@ -3906,13 +3540,11 @@ void
 __indirect_glMultMatrixd(const GLdouble * m)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 132;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultMatrixd, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(m), 128);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Ortho 182
@@ -3920,9 +3552,7 @@ void
 __indirect_glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 52;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Ortho, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&left), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&right), 8);
@@ -3931,7 +3561,7 @@ __indirect_glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
     (void) memcpy((void *)(gc->pc + 36), (void *)(&zNear), 8);
     (void) memcpy((void *)(gc->pc + 44), (void *)(&zFar), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PopMatrix 183
@@ -3939,12 +3569,10 @@ void
 __indirect_glPopMatrix(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PopMatrix, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PushMatrix 184
@@ -3952,12 +3580,10 @@ void
 __indirect_glPushMatrix(void)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PushMatrix, cmdlen);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rotated 185
@@ -3965,16 +3591,14 @@ void
 __indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rotated, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&angle), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&z), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Rotatef 186
@@ -3982,16 +3606,14 @@ void
 __indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Rotatef, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&angle), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Scaled 187
@@ -3999,15 +3621,13 @@ void
 __indirect_glScaled(GLdouble x, GLdouble y, GLdouble z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Scaled, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&z), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Scalef 188
@@ -4015,15 +3635,13 @@ void
 __indirect_glScalef(GLfloat x, GLfloat y, GLfloat z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Scalef, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Translated 189
@@ -4031,15 +3649,13 @@ void
 __indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Translated, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&y), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&z), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Translatef 190
@@ -4047,15 +3663,13 @@ void
 __indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Translatef, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Viewport 191
@@ -4063,16 +3677,14 @@ void
 __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Viewport, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&height), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_BindTexture 4117
@@ -4080,14 +3692,12 @@ void
 __indirect_glBindTexture(GLenum target, GLuint texture)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_BindTexture, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&texture), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexubv 194
@@ -4095,13 +3705,11 @@ void
 __indirect_glIndexub(GLubyte c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexubv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&c), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Indexubv 194
@@ -4109,13 +3717,11 @@ void
 __indirect_glIndexubv(const GLubyte * c)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Indexubv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(c), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PolygonOffset 192
@@ -4123,14 +3729,12 @@ void
 __indirect_glPolygonOffset(GLfloat factor, GLfloat units)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PolygonOffset, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&factor), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&units), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLsop_AreTexturesResident 143
@@ -4141,14 +3745,12 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, GLboolean *
     Display * const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (n < 0) return retval;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_AreTexturesResident, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
         (void) memcpy((void *)(pc + 4), (void *)(textures), (n * 4));
-        retval = (GLboolean) read_reply(gc->currentDpy, 1, residences, GL_TRUE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        retval = (GLboolean) read_reply(dpy, 1, residences, GL_TRUE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return retval;
 }
@@ -4158,9 +3760,7 @@ void
 __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 32;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyTexImage1D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&level), 4);
@@ -4170,7 +3770,7 @@ __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, G
     (void) memcpy((void *)(gc->pc + 24), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&border), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyTexImage2D 4120
@@ -4178,9 +3778,7 @@ void
 __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyTexImage2D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&level), 4);
@@ -4191,7 +3789,7 @@ __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, G
     (void) memcpy((void *)(gc->pc + 28), (void *)(&height), 4);
     (void) memcpy((void *)(gc->pc + 32), (void *)(&border), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyTexSubImage1D 4121
@@ -4199,9 +3797,7 @@ void
 __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyTexSubImage1D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&level), 4);
@@ -4210,7 +3806,7 @@ __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint
     (void) memcpy((void *)(gc->pc + 20), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 24), (void *)(&width), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyTexSubImage2D 4122
@@ -4218,9 +3814,7 @@ void
 __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 36;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyTexSubImage2D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&level), 4);
@@ -4231,7 +3825,7 @@ __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint
     (void) memcpy((void *)(gc->pc + 28), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 32), (void *)(&height), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLsop_DeleteTextures 144
@@ -4241,13 +3835,11 @@ __indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (n < 0) return;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_DeleteTextures, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
         (void) memcpy((void *)(pc + 4), (void *)(textures), (n * 4));
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4259,12 +3851,11 @@ __indirect_glGenTextures(GLsizei n, GLuint * textures)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GenTextures, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
-        (void) read_reply(gc->currentDpy, 4, textures, GL_TRUE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, textures, GL_TRUE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4277,12 +3868,11 @@ __indirect_glIsTexture(GLuint texture)
     Display * const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_IsTexture, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&texture), 4);
-        retval = (GLboolean) read_reply(gc->currentDpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        retval = (GLboolean) read_reply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return retval;
 }
@@ -4292,16 +3882,15 @@ void
 __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures, const GLclampf * priorities)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8 + __GLX_PAD((n * 4)) + __GLX_PAD((n * 4));
-    if (n < 0) return;
-    (void) dpy;
-    emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
-    (void) memcpy((void *)(gc->pc + 4), (void *)(&n), 4);
-    (void) memcpy((void *)(gc->pc + 8), (void *)(textures), (n * 4));
-    (void) memcpy((void *)(gc->pc + 8), (void *)(priorities), (n * 4));
-    gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
+        (void) memcpy((void *)(gc->pc + 4), (void *)(&n), 4);
+        (void) memcpy((void *)(gc->pc + 8), (void *)(textures), (n * 4));
+        (void) memcpy((void *)(gc->pc + 8), (void *)(priorities), (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    }
 }
 
 #define X_GLrop_BlendColor 4096
@@ -4309,16 +3898,14 @@ void
 __indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_BlendColor, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&alpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_BlendEquation 4097
@@ -4326,13 +3913,11 @@ void
 __indirect_glBlendEquation(GLenum mode)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_BlendEquation, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&mode), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ColorTableParameterfv 2054
@@ -4340,16 +3925,14 @@ void
 __indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glColorTableParameterfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ColorTableParameterfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ColorTableParameteriv 2055
@@ -4357,16 +3940,14 @@ void
 __indirect_glColorTableParameteriv(GLenum target, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glColorTableParameteriv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ColorTableParameteriv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyColorTable 2056
@@ -4374,9 +3955,7 @@ void
 __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyColorTable, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&internalformat), 4);
@@ -4384,7 +3963,7 @@ __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint
     (void) memcpy((void *)(gc->pc + 16), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&width), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLsop_GetColorTableParameterfv 148
@@ -4394,13 +3973,12 @@ __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat * par
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetColorTableParameterfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4412,13 +3990,12 @@ __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint * param
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetColorTableParameteriv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4428,9 +4005,7 @@ void
 __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyColorSubTable, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&start), 4);
@@ -4438,7 +4013,7 @@ __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, G
     (void) memcpy((void *)(gc->pc + 16), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&width), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ConvolutionParameterf 4103
@@ -4446,15 +4021,13 @@ void
 __indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ConvolutionParameterf, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&params), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ConvolutionParameterfv 4104
@@ -4462,16 +4035,14 @@ void
 __indirect_glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glConvolutionParameterfv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ConvolutionParameterfv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ConvolutionParameteri 4105
@@ -4479,15 +4050,13 @@ void
 __indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ConvolutionParameteri, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&params), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ConvolutionParameteriv 4106
@@ -4495,16 +4064,14 @@ void
 __indirect_glConvolutionParameteriv(GLenum target, GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glConvolutionParameteriv_size(pname);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ConvolutionParameteriv, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyConvolutionFilter1D 4107
@@ -4512,9 +4079,7 @@ void
 __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyConvolutionFilter1D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&internalformat), 4);
@@ -4522,7 +4087,7 @@ __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint
     (void) memcpy((void *)(gc->pc + 16), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&width), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyConvolutionFilter2D 4108
@@ -4530,9 +4095,7 @@ void
 __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyConvolutionFilter2D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&internalformat), 4);
@@ -4541,7 +4104,7 @@ __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint
     (void) memcpy((void *)(gc->pc + 20), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 24), (void *)(&height), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLsop_GetConvolutionParameterfv 151
@@ -4551,13 +4114,12 @@ __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat * pa
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetConvolutionParameterfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4569,13 +4131,12 @@ __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint * para
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetConvolutionParameteriv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4587,13 +4148,12 @@ __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat * para
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetHistogramParameterfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4605,13 +4165,12 @@ __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, GLint * params
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetHistogramParameteriv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4623,13 +4182,12 @@ __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMinmaxParameterfv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4641,13 +4199,12 @@ __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMinmaxParameteriv, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
         (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
-        (void) read_reply(gc->currentDpy, 4, params, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -4657,16 +4214,14 @@ void
 __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Histogram, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&internalformat), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&sink), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_Minmax 4111
@@ -4674,15 +4229,13 @@ void
 __indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_Minmax, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&internalformat), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&sink), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ResetHistogram 4112
@@ -4690,13 +4243,11 @@ void
 __indirect_glResetHistogram(GLenum target)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ResetHistogram, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ResetMinmax 4113
@@ -4704,13 +4255,11 @@ void
 __indirect_glResetMinmax(GLenum target)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ResetMinmax, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_CopyTexSubImage3D 4123
@@ -4718,9 +4267,7 @@ void
 __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 40;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_CopyTexSubImage3D, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&level), 4);
@@ -4732,7 +4279,7 @@ __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint
     (void) memcpy((void *)(gc->pc + 32), (void *)(&width), 4);
     (void) memcpy((void *)(gc->pc + 36), (void *)(&height), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ActiveTextureARB 197
@@ -4740,13 +4287,11 @@ void
 __indirect_glActiveTextureARB(GLenum texture)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ActiveTextureARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&texture), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1dvARB 198
@@ -4754,14 +4299,12 @@ void
 __indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1dvARB 198
@@ -4769,14 +4312,12 @@ void
 __indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1fvARB 199
@@ -4784,14 +4325,12 @@ void
 __indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1fvARB 199
@@ -4799,14 +4338,12 @@ void
 __indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1ivARB 200
@@ -4814,14 +4351,12 @@ void
 __indirect_glMultiTexCoord1iARB(GLenum target, GLint s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1ivARB 200
@@ -4829,14 +4364,12 @@ void
 __indirect_glMultiTexCoord1ivARB(GLenum target, const GLint * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1svARB 201
@@ -4844,14 +4377,12 @@ void
 __indirect_glMultiTexCoord1sARB(GLenum target, GLshort s)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord1svARB 201
@@ -4859,14 +4390,12 @@ void
 __indirect_glMultiTexCoord1svARB(GLenum target, const GLshort * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord1svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2dvARB 202
@@ -4874,15 +4403,13 @@ void
 __indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2dvARB 202
@@ -4890,14 +4417,12 @@ void
 __indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v), 16);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2fvARB 203
@@ -4905,15 +4430,13 @@ void
 __indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2fvARB 203
@@ -4921,14 +4444,12 @@ void
 __indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2ivARB 204
@@ -4936,15 +4457,13 @@ void
 __indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2ivARB 204
@@ -4952,14 +4471,12 @@ void
 __indirect_glMultiTexCoord2ivARB(GLenum target, const GLint * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2svARB 205
@@ -4967,15 +4484,13 @@ void
 __indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&t), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord2svARB 205
@@ -4983,14 +4498,12 @@ void
 __indirect_glMultiTexCoord2svARB(GLenum target, const GLshort * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord2svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3dvARB 206
@@ -4998,16 +4511,14 @@ void
 __indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 32;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&r), 8);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3dvARB 206
@@ -5015,14 +4526,12 @@ void
 __indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 32;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v), 24);
     (void) memcpy((void *)(gc->pc + 28), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3fvARB 207
@@ -5030,16 +4539,14 @@ void
 __indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&r), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3fvARB 207
@@ -5047,14 +4554,12 @@ void
 __indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 12);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3ivARB 208
@@ -5062,16 +4567,14 @@ void
 __indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&r), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3ivARB 208
@@ -5079,14 +4582,12 @@ void
 __indirect_glMultiTexCoord3ivARB(GLenum target, const GLint * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 12);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3svARB 209
@@ -5094,16 +4595,14 @@ void
 __indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 2);
     (void) memcpy((void *)(gc->pc + 10), (void *)(&t), 2);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&r), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord3svARB 209
@@ -5111,14 +4610,12 @@ void
 __indirect_glMultiTexCoord3svARB(GLenum target, const GLshort * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord3svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 6);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4dvARB 210
@@ -5126,9 +4623,7 @@ void
 __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 40;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&s), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&t), 8);
@@ -5136,7 +4631,7 @@ __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble
     (void) memcpy((void *)(gc->pc + 28), (void *)(&q), 8);
     (void) memcpy((void *)(gc->pc + 36), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4dvARB 210
@@ -5144,14 +4639,12 @@ void
 __indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 40;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4dvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(v), 32);
     (void) memcpy((void *)(gc->pc + 36), (void *)(&target), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4fvARB 211
@@ -5159,9 +4652,7 @@ void
 __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
@@ -5169,7 +4660,7 @@ __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r,
     (void) memcpy((void *)(gc->pc + 16), (void *)(&r), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&q), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4fvARB 211
@@ -5177,14 +4668,12 @@ void
 __indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4fvARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 16);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4ivARB 212
@@ -5192,9 +4681,7 @@ void
 __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 4);
@@ -5202,7 +4689,7 @@ __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint
     (void) memcpy((void *)(gc->pc + 16), (void *)(&r), 4);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&q), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4ivARB 212
@@ -5210,14 +4697,12 @@ void
 __indirect_glMultiTexCoord4ivARB(GLenum target, const GLint * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 24;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4ivARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 16);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4svARB 213
@@ -5225,9 +4710,7 @@ void
 __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&s), 2);
@@ -5235,7 +4718,7 @@ __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r,
     (void) memcpy((void *)(gc->pc + 12), (void *)(&r), 2);
     (void) memcpy((void *)(gc->pc + 14), (void *)(&q), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_MultiTexCoord4svARB 213
@@ -5243,14 +4726,12 @@ void
 __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort * v)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_MultiTexCoord4svARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(v), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SampleCoverageARB 229
@@ -5258,14 +4739,12 @@ void
 __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SampleCoverageARB, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&value), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&invert), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLvop_AreTexturesResidentEXT 11
@@ -5276,14 +4755,12 @@ __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolea
     Display * const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (n < 0) return retval;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const * pc = setup_vendor_request(gc, X_GLXVendorPrivateWithReply, X_GLvop_AreTexturesResidentEXT, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
         (void) memcpy((void *)(pc + 4), (void *)(textures), (n * 4));
-        retval = (GLboolean) read_reply(gc->currentDpy, 1, residences, GL_TRUE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        retval = (GLboolean) read_reply(dpy, 1, residences, GL_TRUE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return retval;
 }
@@ -5295,12 +4772,11 @@ __indirect_glGenTexturesEXT(GLsizei n, GLuint * textures)
     __GLXcontext * const gc = __glXGetCurrentContext();
     Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_vendor_request(gc, X_GLXVendorPrivateWithReply, X_GLvop_GenTexturesEXT, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
-        (void) read_reply(gc->currentDpy, 4, textures, GL_TRUE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        (void) read_reply(dpy, 4, textures, GL_TRUE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return;
 }
@@ -5313,12 +4789,11 @@ __indirect_glIsTextureEXT(GLuint texture)
     Display * const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
     const GLuint cmdlen = 4;
-    (void) dpy;
-    if (dpy != NULL) {
+    if (__builtin_expect(dpy != NULL, 1)) {
         GLubyte const * pc = setup_vendor_request(gc, X_GLXVendorPrivateWithReply, X_GLvop_IsTextureEXT, cmdlen);
         (void) memcpy((void *)(pc + 0), (void *)(&texture), 4);
-        retval = (GLboolean) read_reply(gc->currentDpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(gc->currentDpy); SyncHandle();
+        retval = (GLboolean) read_reply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
     }
     return retval;
 }
@@ -5328,14 +4803,12 @@ void
 __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SampleMaskSGIS, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&value), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&invert), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SamplePatternSGIS 2049
@@ -5343,13 +4816,11 @@ void
 __indirect_glSamplePatternSGIS(GLenum pattern)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SamplePatternSGIS, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pattern), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PointParameterfEXT 2065
@@ -5357,14 +4828,12 @@ void
 __indirect_glPointParameterfEXT(GLenum pname, GLfloat param)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PointParameterfEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&param), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PointParameterfvEXT 2066
@@ -5372,15 +4841,13 @@ void
 __indirect_glPointParameterfvEXT(GLenum pname, const GLfloat * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glPointParameterfvEXT_size(pname);
     const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PointParameterfvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_WindowPos3fvMESA 230
@@ -5388,15 +4855,13 @@ void
 __indirect_glWindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_WindowPos3fvMESA, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&x), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&y), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&z), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_WindowPos3fvMESA 230
@@ -5411,16 +4876,14 @@ void
 __indirect_glBlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 20;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_BlendFuncSeparateEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&sfactorRGB), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&dfactorRGB), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&sfactorAlpha), 4);
     (void) memcpy((void *)(gc->pc + 16), (void *)(&dfactorAlpha), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_FogCoordfvEXT 4124
@@ -5428,13 +4891,11 @@ void
 __indirect_glFogCoordfEXT(GLfloat coord)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_FogCoordfvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_FogCoordfvEXT 4124
@@ -5449,13 +4910,11 @@ void
 __indirect_glFogCoorddEXT(GLdouble coord)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_FogCoorddvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&coord), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_FogCoorddvEXT 4125
@@ -5470,15 +4929,13 @@ void
 __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3bvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3bvEXT 4126
@@ -5493,15 +4950,13 @@ void
 __indirect_glSecondaryColor3dEXT(GLdouble red, GLdouble green, GLdouble blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 28;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3dvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 8);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&green), 8);
     (void) memcpy((void *)(gc->pc + 20), (void *)(&blue), 8);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3dvEXT 4130
@@ -5516,15 +4971,13 @@ void
 __indirect_glSecondaryColor3fEXT(GLfloat red, GLfloat green, GLfloat blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3fvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3fvEXT 4129
@@ -5539,15 +4992,13 @@ void
 __indirect_glSecondaryColor3iEXT(GLint red, GLint green, GLint blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3ivEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3ivEXT 4128
@@ -5562,15 +5013,13 @@ void
 __indirect_glSecondaryColor3sEXT(GLshort red, GLshort green, GLshort blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3svEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&green), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&blue), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3svEXT 4128
@@ -5585,15 +5034,13 @@ void
 __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3ubvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 1);
     (void) memcpy((void *)(gc->pc + 5), (void *)(&green), 1);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&blue), 1);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3ubvEXT 4131
@@ -5608,15 +5055,13 @@ void
 __indirect_glSecondaryColor3uiEXT(GLuint red, GLuint green, GLuint blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 16;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3uivEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&green), 4);
     (void) memcpy((void *)(gc->pc + 12), (void *)(&blue), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3uivEXT 4133
@@ -5631,15 +5076,13 @@ void
 __indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_SecondaryColor3usvEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&red), 2);
     (void) memcpy((void *)(gc->pc + 6), (void *)(&green), 2);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&blue), 2);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_SecondaryColor3usvEXT 4132
@@ -5654,14 +5097,12 @@ void
 __indirect_glPointParameteriNV(GLenum pname, GLint params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 12;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PointParameteriNV, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(&params), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_PointParameterivNV 4222
@@ -5669,15 +5110,13 @@ void
 __indirect_glPointParameterivNV(GLenum pname, const GLint * params)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint compsize = __glPointParameterivNV_size(pname);
     const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_PointParameterivNV, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&pname), 4);
     (void) memcpy((void *)(gc->pc + 8), (void *)(params), (compsize * 4));
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
 #define X_GLrop_ActiveStencilFaceEXT 4220
@@ -5685,12 +5124,10 @@ void
 __indirect_glActiveStencilFaceEXT(GLenum face)
 {
     __GLXcontext * const gc = __glXGetCurrentContext();
-    Display * const dpy = gc->currentDpy;
     const GLuint cmdlen = 8;
-    (void) dpy;
     emit_header(gc->pc, X_GLrop_ActiveStencilFaceEXT, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), (void *)(&face), 4);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
index 418f140..15be86b 100644 (file)
@@ -56,6 +56,10 @@ class PrintGlxProtoStubs(glX_XML.GlxProto):
                glX_XML.printFastcall()
                glX_XML.printNoinline()
                print ''
+               print '#if !defined __GNUC__ || __GNUC__ < 3'
+               print '#  define __builtin_expect(x, y) x'
+               print '#endif'
+               print ''
                print '/* If the size and opcode values are known at compile-time, this will, on'
                print ' * x86 at least, emit them with a single instruction.'
                print ' */'
@@ -91,7 +95,7 @@ read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_ar
 
 #define X_GLXSingle 0
 
-static NOINLINE GLubyte *
+static NOINLINE FASTCALL GLubyte *
 setup_single_request( __GLXcontext * gc, GLint sop, GLint cmdlen )
 {
     xGLXSingleReq * req;
@@ -106,7 +110,7 @@ setup_single_request( __GLXcontext * gc, GLint sop, GLint cmdlen )
     return (GLubyte *)(req) + sz_xGLXSingleReq;
 }
 
-static NOINLINE GLubyte *
+static NOINLINE FASTCALL GLubyte *
 setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
 {
     xGLXVendorPrivateReq * req;
@@ -147,7 +151,7 @@ generic_%u_byte( GLint rop, const void * ptr )
     emit_header(gc->pc, rop, cmdlen);
     (void) memcpy((void *)(gc->pc + 4), ptr, %u);
     gc->pc += cmdlen;
-    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 """ % (n, n + 4, n)
 
@@ -189,8 +193,22 @@ generic_%u_byte( GLint rop, const void * ptr )
                self.common_func_print_just_header(f)
 
                print '    __GLXcontext * const gc = __glXGetCurrentContext();'
-               print '    Display * const dpy = gc->currentDpy;'
-                       
+               
+               # The only reason that single and vendor private commands need
+               # a variable called 'dpy' is becuase they use the SyncHandle
+               # macro.  For whatever brain-dead reason, that macro is hard-
+               # coded to use a variable called 'dpy' instead of taking a
+               # parameter.
+
+               if not f.glx_rop:
+                       print '    Display * const dpy = gc->currentDpy;'
+                       skip_condition = "dpy != NULL"
+               elif f.can_be_large:
+                       skip_condition = "gc->currentDpy != NULL"
+               else:
+                       skip_condition = None
+
+
                if f.fn_return_type != 'void':
                        print '    %s retval = (%s) 0;' % (f.fn_return_type, f.fn_return_type)
 
@@ -199,26 +217,23 @@ generic_%u_byte( GLint rop, const void * ptr )
 
                print '    const GLuint cmdlen = %s;' % (f.command_length())
 
-               if f.counter != None:
-                       print '    if (%s < 0) %s' % (f.counter, f.return_string())
+               if f.counter:
+                       if skip_condition:
+                               skip_condition = "(%s >= 0) && (%s)" % (f.counter, skip_condition)
+                       else:
+                               skip_condition = "%s >= 0" % (f.counter)
 
-               if f.can_be_large:
-                       print '    if (dpy == NULL) return;'
-                       print '    if ( ((gc->pc + cmdlen) > gc->bufEnd)'
-                       print '         || (cmdlen > gc->maxSmallRenderCommandSize)) {'
-                       print '        (void) __glXFlushRenderBuffer(gc, gc->pc);'
-                       print '    }'
-               else:
-                       print '    (void) dpy;'
 
-               return
+               if skip_condition:
+                       print '    if (__builtin_expect(%s, 1)) {' % (skip_condition)
+                       return 1
+               else:
+                       return 0
 
 
        def printSingleFunction(self, f):
                self.common_func_print_header(f)
 
-               print '    if (dpy != NULL) {'
-
                if f.fn_parameters != []:
                        pc_decl = "GLubyte const * pc ="
                else:
@@ -249,9 +264,9 @@ generic_%u_byte( GLint rop, const void * ptr )
                        else:
                                aa = "GL_FALSE"
 
-                       print "       %s read_reply(gc->currentDpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
+                       print "       %s read_reply(dpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
 
-               print '        UnlockDisplay(gc->currentDpy); SyncHandle();'
+               print '        UnlockDisplay(dpy); SyncHandle();'
                print '    }'
                print '    %s' % f.return_string()
                print '}'
@@ -278,33 +293,41 @@ generic_%u_byte( GLint rop, const void * ptr )
                                        print ''
                                        return
 
-               self.common_func_print_header(f)
-
-               if f.can_be_large:
-                       print '    if (cmdlen <= gc->maxSmallRenderCommandSize) {'
+               if self.common_func_print_header(f):
                        indent = "    "
+                       trailer = "    }"
                else:
                        indent = ""
+                       trailer = None
+
+               if f.can_be_large:
+                       print '%s    if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent)
+                       print '%s        if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent)
+                       print '%s            (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
+                       print '%s        }' % (indent)
+                       indent += "    "
 
                print '%s    emit_header(gc->pc, %s, cmdlen);' % (indent, f.opcode_real_name())
 
                self.common_emit_args(f, "gc->pc", indent, 4, 0)
                print '%s    gc->pc += cmdlen;' % (indent)
-               print '%s    if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent)
+               print '%s    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent)
 
                if f.can_be_large:
-                       print '    }'
-                       print '    else {'
-                       print '        const GLint op = %s;' % (f.opcode_real_name())
-                       print '        const GLuint cmdlenLarge = cmdlen + 4;'
-                       print '        (void) memcpy((void *)(gc->pc + 0), (void *)(&op), 4);'
-                       print '        (void) memcpy((void *)(gc->pc + 4), (void *)(&cmdlenLarge), 4);'
-                       offset = self.common_emit_args(f, "gc->pc", indent, 8, 1)
+                       print '%s}' % (indent)
+                       print '%selse {' % (indent)
+                       print '%s    const GLint op = %s;' % (indent, f.opcode_real_name())
+                       print '%s    const GLuint cmdlenLarge = cmdlen + 4;' % (indent)
+                       print '%s    GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
+                       print '%s    (void) memcpy((void *)(pc + 0), (void *)(&op), 4);' % (indent)
+                       print '%s    (void) memcpy((void *)(pc + 4), (void *)(&cmdlenLarge), 4);' % (indent)
+                       offset = self.common_emit_args(f, "pc", indent, 8, 1)
                        
                        p = f.variable_length_parameter()
-                       print '        __glXSendLargeCommand(gc, gc->pc, %u, %s, %s);' % (offset + 8, p.name, p.size_string())
-                       print '    }'
+                       print '%s    __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (indent, offset + 8, p.name, p.size_string())
+                       print '%s}' % (indent)
 
+               if trailer: print trailer
                print '}'
                print ''
                return