xserver: Branch 'master' - 3 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Aug 21 14:17:34 UTC 2017


 glx/createcontext.c    |   16 +++----
 glx/glxcmds.c          |   68 ++++++++++++++++++++++++--------
 glx/glxcmdsswap.c      |  103 -------------------------------------------------
 glx/glxdri2.c          |   16 +++----
 glx/glxext.c           |   16 +++----
 glx/glxserver.h        |   42 -------------------
 glx/indirect_program.c |    4 -
 glx/single2.c          |    2 
 hw/xwin/glx/indirect.c |    2 
 9 files changed, 80 insertions(+), 189 deletions(-)

New commits:
commit 43878fa8772d8642f601d65e78d2f702ecc0de41
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 16 14:49:18 2017 -0400

    glx: Remove some unused stuff from glxserver.h
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxserver.h b/glx/glxserver.h
index a54ce4b92..31c635b97 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -54,7 +54,6 @@
 ** GLX resources.
 */
 typedef XID GLXContextID;
-typedef XID GLXPixmap;
 typedef XID GLXDrawable;
 
 typedef struct __GLXclientStateRec __GLXclientState;
@@ -156,11 +155,6 @@ typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
 typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
 
 /*
- * Dispatch for GLX commands.
- */
-typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
-
-/*
  * Tables for computing the size of each rendering command.
  */
 typedef int (*gl_proto_size_func) (const GLbyte *, Bool, int);
@@ -177,18 +171,11 @@ typedef struct {
 */
 extern RESTYPE __glXContextRes;
 extern RESTYPE __glXClientRes;
-extern RESTYPE __glXPixmapRes;
 extern RESTYPE __glXDrawableRes;
 
 /************************************************************************/
 
 /*
-** Prototypes.
-*/
-
-extern char *__glXcombine_strings(const char *, const char *);
-
-/*
  * Routines for computing the size of variably-sized rendering commands.
  */
 
diff --git a/glx/single2.c b/glx/single2.c
index e7488194b..36a01f0cb 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -253,7 +253,7 @@ __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
 
 #define SEPARATOR " "
 
-char *
+static char *
 __glXcombine_strings(const char *cext_string, const char *sext_string)
 {
     size_t clen, slen;
commit 3d81abba9ca2f9d57b4c293e3b7fcb32ef853f44
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 16 14:49:17 2017 -0400

    glx: Inline some reply swapping code
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9ad90eec2..6a763970d 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -685,11 +685,12 @@ DoMakeCurrent(__GLXclientState * cl,
     }
 
     if (client->swapped) {
-        __glXSwapMakeCurrentReply(client, &reply);
-    }
-    else {
-        WriteToClient(client, sz_xGLXMakeCurrentReply, &reply);
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
+        __GLX_SWAP_INT(&reply.contextTag);
     }
+    WriteToClient(client, sz_xGLXMakeCurrentReply, &reply);
     return Success;
 }
 
@@ -751,11 +752,11 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
     };
 
     if (client->swapped) {
-        __glXSwapIsDirectReply(client, &reply);
-    }
-    else {
-        WriteToClient(client, sz_xGLXIsDirectReply, &reply);
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
     }
+    WriteToClient(client, sz_xGLXIsDirectReply, &reply);
 
     return Success;
 }
@@ -789,11 +790,14 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
     };
 
     if (client->swapped) {
-        __glXSwapQueryVersionReply(client, &reply);
-    }
-    else {
-        WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
+        __GLX_SWAP_INT(&reply.majorVersion);
+        __GLX_SWAP_INT(&reply.minorVersion);
     }
+
+    WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
     return Success;
 }
 
@@ -1738,7 +1742,16 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
     sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
 
     if (client->swapped) {
-        __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+        int length = reply.length;
+
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
+        __GLX_SWAP_INT(&reply.n);
+        WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+        __GLX_SWAP_INT_ARRAY((int *) sendBuf, length);
+        WriteToClient(client, length << 2, sendBuf);
     }
     else {
         WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
@@ -1968,7 +1981,16 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
     };
 
     if (client->swapped) {
-        __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
+        int length = reply.length;
+
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
+        __GLX_SWAP_INT(&reply.numAttribs);
+        WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
+        __GLX_SWAP_INT_ARRAY((int *) attributes, length);
+        WriteToClient(client, length << 2, attributes);
     }
     else {
         WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
@@ -2415,7 +2437,14 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
     memcpy(buf, pGlxScreen->GLXextensions, n);
 
     if (client->swapped) {
-        glxSwapQueryExtensionsStringReply(client, &reply, buf);
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
+        __GLX_SWAP_INT(&reply.n);
+        WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+        __GLX_SWAP_INT_ARRAY((int *) buf, length);
+        WriteToClient(client, length << 2, buf);
     }
     else {
         WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
@@ -2483,7 +2512,14 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
     memcpy(buf, ptr, n);
 
     if (client->swapped) {
-        glxSwapQueryServerStringReply(client, &reply, buf);
+        __GLX_DECLARE_SWAP_VARIABLES;
+        __GLX_SWAP_SHORT(&reply.sequenceNumber);
+        __GLX_SWAP_INT(&reply.length);
+        __GLX_SWAP_INT(&reply.n);
+        WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
+        /** no swap is needed for an array of chars **/
+        /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
+        WriteToClient(client, length << 2, buf);
     }
     else {
         WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index 9ec1222f8..44a09e61c 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -826,109 +826,6 @@ __glXDispSwap_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
 /************************************************************************/
 
 /*
-** Swap replies.
-*/
-
-void
-__glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply * reply)
-{
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    __GLX_SWAP_INT(&reply->contextTag);
-    WriteToClient(client, sz_xGLXMakeCurrentReply, reply);
-}
-
-void
-__glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
-{
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    WriteToClient(client, sz_xGLXIsDirectReply, reply);
-}
-
-void
-__glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
-{
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    __GLX_SWAP_INT(&reply->majorVersion);
-    __GLX_SWAP_INT(&reply->minorVersion);
-    WriteToClient(client, sz_xGLXQueryVersionReply, reply);
-}
-
-void
-glxSwapQueryExtensionsStringReply(ClientPtr client,
-                                  xGLXQueryExtensionsStringReply * reply,
-                                  char *buf)
-{
-    int length = reply->length;
-
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply);
-    __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, buf);
-}
-
-void
-glxSwapQueryServerStringReply(ClientPtr client,
-                              xGLXQueryServerStringReply * reply, char *buf)
-{
-    int length = reply->length;
-
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryServerStringReply, reply);
-    /** no swap is needed for an array of chars **/
-    /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
-    WriteToClient(client, length << 2, buf);
-}
-
-void
-__glXSwapQueryContextInfoEXTReply(ClientPtr client,
-                                  xGLXQueryContextInfoEXTReply * reply,
-                                  int *buf)
-{
-    int length = reply->length;
-
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply);
-    __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, buf);
-}
-
-void
-__glXSwapGetDrawableAttributesReply(ClientPtr client,
-                                    xGLXGetDrawableAttributesReply * reply,
-                                    CARD32 *buf)
-{
-    int length = reply->length;
-
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-    __GLX_SWAP_SHORT(&reply->sequenceNumber);
-    __GLX_SWAP_INT(&reply->length);
-    __GLX_SWAP_INT(&reply->numAttribs);
-    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply);
-    __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, buf);
-}
-
-/************************************************************************/
-
-/*
 ** Render and Renderlarge are not in the GLX API.  They are used by the GLX
 ** client library to send batches of GL rendering commands.
 */
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 547826bd9..a54ce4b92 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -189,28 +189,6 @@ extern RESTYPE __glXDrawableRes;
 extern char *__glXcombine_strings(const char *, const char *);
 
 /*
-** Routines for sending swapped replies.
-*/
-
-extern void __glXSwapMakeCurrentReply(ClientPtr client,
-                                      xGLXMakeCurrentReply * reply);
-extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
-extern void __glXSwapQueryVersionReply(ClientPtr client,
-                                       xGLXQueryVersionReply * reply);
-extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
-                                              xGLXQueryContextInfoEXTReply *
-                                              reply, int *buf);
-extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
-                                                xGLXGetDrawableAttributesReply *
-                                                reply, CARD32 *buf);
-extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
-                                              xGLXQueryExtensionsStringReply *
-                                              reply, char *buf);
-extern void glxSwapQueryServerStringReply(ClientPtr client,
-                                          xGLXQueryServerStringReply * reply,
-                                          char *buf);
-
-/*
  * Routines for computing the size of variably-sized rendering commands.
  */
 
commit 51bab63b7353319c51ec2f1adaed95d86e4f6119
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 16 14:49:16 2017 -0400

    glx: Remove True/False defines
    
    Those are xlib spellings, we say TRUE/FALSE pretty consistently
    elsewhere in the server.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/createcontext.c b/glx/createcontext.c
index 068b35fa7..1216f9412 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -37,29 +37,29 @@ static Bool
 validate_GL_version(int major_version, int minor_version)
 {
     if (major_version <= 0 || minor_version < 0)
-        return False;
+        return FALSE;
 
     switch (major_version) {
     case 1:
         if (minor_version > 5)
-            return False;
+            return FALSE;
         break;
 
     case 2:
         if (minor_version > 1)
-            return False;
+            return FALSE;
         break;
 
     case 3:
         if (minor_version > 3)
-            return False;
+            return FALSE;
         break;
 
     default:
         break;
     }
 
-    return True;
+    return TRUE;
 }
 
 static Bool
@@ -70,9 +70,9 @@ validate_render_type(uint32_t render_type)
     case GLX_COLOR_INDEX_TYPE:
     case GLX_RGBA_FLOAT_TYPE_ARB:
     case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:
-        return True;
+        return TRUE;
     default:
-        return False;
+        return FALSE;
     }
 }
 
@@ -316,7 +316,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
     ctx->config = config;
     ctx->id = req->context;
     ctx->share_id = req->shareList;
-    ctx->idExists = True;
+    ctx->idExists = TRUE;
     ctx->isDirect = req->isDirect;
     ctx->renderMode = GL_RENDER;
     ctx->resetNotificationStrategy = reset;
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 701944283..9961c1bfb 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -344,11 +344,11 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
     unsigned i;
 
     if (num_attribs == 0)
-        return True;
+        return TRUE;
 
     if (attribs == NULL) {
         *error = BadImplementation;
-        return False;
+        return FALSE;
     }
 
     *major_ver = 1;
@@ -381,13 +381,13 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
                 break;
             default:
                 *error = __glXError(GLXBadProfileARB);
-                return False;
+                return FALSE;
             }
             break;
         case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
             if (screen->dri2->base.version >= 4) {
                 *error = BadValue;
-                return False;
+                return FALSE;
             }
 
             switch (attribs[i * 2 + 1]) {
@@ -399,14 +399,14 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
                 break;
             default:
                 *error = BadValue;
-                return False;
+                return FALSE;
             }
             break;
         default:
             /* If an unknown attribute is received, fail.
              */
             *error = BadValue;
-            return False;
+            return FALSE;
         }
     }
 
@@ -414,7 +414,7 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
      */
     if ((*flags & ~ALL_DRI_CTX_FLAGS) != 0) {
         *error = BadValue;
-        return False;
+        return FALSE;
     }
 
     /* If the core profile is requested for a GL version is less than 3.2,
@@ -428,7 +428,7 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
     }
 
     *error = Success;
-    return True;
+    return TRUE;
 }
 
 static void
diff --git a/glx/glxext.c b/glx/glxext.c
index e88bbd107..9b4d81641 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -97,7 +97,7 @@ ContextGone(__GLXcontext * cx, XID id)
         __glXFreeContext(cx);
     }
 
-    return True;
+    return TRUE;
 }
 
 static __GLXcontext *glxPendingDestroyContexts;
@@ -146,7 +146,7 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
 
     glxPriv->destroy(glxPriv);
 
-    return True;
+    return TRUE;
 }
 
 Bool
@@ -155,12 +155,12 @@ __glXAddContext(__GLXcontext * cx)
     /* Register this context as a resource.
      */
     if (!AddResource(cx->id, __glXContextRes, (void *)cx)) {
-	return False;
+	return FALSE;
     }
 
     cx->next = glxAllContexts;
     glxAllContexts = cx;
-    return True;
+    return TRUE;
 }
 
 static void
@@ -321,11 +321,11 @@ checkScreenVisuals(void)
         for (j = 0; j < screen->numVisuals; j++) {
             if (screen->visuals[j].class == TrueColor ||
                 screen->visuals[j].class == DirectColor)
-                return True;
+                return TRUE;
         }
     }
 
-    return False;
+    return FALSE;
 }
 
 static void
@@ -355,7 +355,7 @@ GlxExtensionInit(void)
     ScreenPtr pScreen;
     int i;
     __GLXprovider *p, **stack;
-    Bool glx_provided = False;
+    Bool glx_provided = FALSE;
 
     if (serverGeneration == 1) {
         for (stack = &__glXProviderStack; *stack; stack = &(*stack)->next)
@@ -402,7 +402,7 @@ GlxExtensionInit(void)
             LogMessage(X_INFO,
                        "GLX: no usable GL providers found for screen %d\n", i);
         else
-            glx_provided = True;
+            glx_provided = TRUE;
     }
 
     /* don't register extension if GL is not provided on any screen */
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 732ed9d8e..547826bd9 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -65,13 +65,6 @@ typedef struct __GLXcontext __GLXcontext;
 #include "glxdrawable.h"
 #include "glxcontext.h"
 
-#ifndef True
-#define True 1
-#endif
-#ifndef False
-#define False 0
-#endif
-
 extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
 extern __GLXclientState *glxGetClient(ClientPtr pClient);
 
diff --git a/glx/indirect_program.c b/glx/indirect_program.c
index 69a050820..c7bfa03ca 100644
--- a/glx/indirect_program.c
+++ b/glx/indirect_program.c
@@ -112,7 +112,7 @@ __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
     PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
         __glGetProcAddress("glGetProgramStringARB");
 
-    return DoGetProgramString(cl, pc, get_program, get_program_string, False);
+    return DoGetProgramString(cl, pc, get_program, get_program_string, FALSE);
 }
 
 int
@@ -123,5 +123,5 @@ __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
     PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
         __glGetProcAddress("glGetProgramStringARB");
 
-    return DoGetProgramString(cl, pc, get_program, get_program_string, True);
+    return DoGetProgramString(cl, pc, get_program, get_program_string, TRUE);
 }
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index ad79d249d..d6640700e 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -1403,7 +1403,7 @@ glxWinContextMakeCurrent(__GLXcontext * base)
          * feature so just error out if it can't work.
          */
         if (!scr->has_WGL_ARB_make_current_read)
-            return False;
+            return FALSE;
 
         /*
            If there is a separate read drawable, create a separate read DC, and


More information about the xorg-commit mailing list