xserver: Branch 'master'

Adam Jackson ajax at kemper.freedesktop.org
Fri Mar 24 16:03:46 UTC 2017


 glx/glxcmds.c |   39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

New commits:
commit f4b78286ea8d4c94a913a02a3579cbe55e8f1f6b
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Mar 20 13:08:19 2017 -0400

    glx: Fix MakeCurrent with no drawables
    
    GLX_ARB_create_context, which we aspire to support, allows making GL 3.0
    or newer contexts current with null current drawables. Strictly this
    might not be legal for pre-3.0 contexts, but there's no harm in allowing
    it anyway.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 67f950967..af36cf154 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -560,19 +560,14 @@ DoMakeCurrent(__GLXclientState * cl,
     __GLXdrawable *drawPriv = NULL;
     __GLXdrawable *readPriv = NULL;
     int error;
-    GLuint mask;
 
-    /*
-     ** If one is None and the other isn't, it's a bad match.
-     */
-
-    mask = (drawId == None) ? (1 << 0) : 0;
-    mask |= (readId == None) ? (1 << 1) : 0;
-    mask |= (contextId == None) ? (1 << 2) : 0;
+    /* Drawables but no context makes no sense */
+    if (!contextId && (drawId || readId))
+        return BadMatch;
 
-    if ((mask != 0x00) && (mask != 0x07)) {
+    /* If either drawable is null, the other must be too */
+    if ((drawId == None) != (readId == None))
         return BadMatch;
-    }
 
     /*
      ** Lookup old context.  If we have one, it must be in a usable state.
@@ -608,20 +603,20 @@ DoMakeCurrent(__GLXclientState * cl,
             return BadAccess;
         }
 
-        assert(drawId != None);
-        assert(readId != None);
-
-        drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
-        if (drawPriv == NULL)
-            return status;
-
-        readPriv = __glXGetDrawable(glxc, readId, client, &status);
-        if (readPriv == NULL)
-            return status;
+        if (drawId) {
+            drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
+            if (drawPriv == NULL)
+                return status;
+        }
 
-    }
-    else {
+        if (readId) {
+            readPriv = __glXGetDrawable(glxc, readId, client, &status);
+            if (readPriv == NULL)
+                return status;
+        }
+    } else {
         /* Switching to no context.  Ignore new drawable. */
+
         glxc = 0;
         drawPriv = 0;
         readPriv = 0;


More information about the xorg-commit mailing list