xserver: Branch 'master' - 4 commits

Adam Jackson ajax at kemper.freedesktop.org
Tue Apr 24 18:41:27 UTC 2018


 dix/extension.c |   16 +++++++++++++---
 glx/glxext.c    |    5 +++--
 glx/vndcmds.c   |    2 ++
 glx/vndext.c    |    9 +++++++++
 glx/vndserver.h |    4 +---
 5 files changed, 28 insertions(+), 8 deletions(-)

New commits:
commit 79a7137557d33d4e92713ae8cabe838c44fea488
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Apr 23 16:19:15 2018 -0400

    glx: Require depth > 12 for GLX visuals
    
    fb is happy to do TrueColor to 8bpp drawables, but mesa is not. Depth 12
    is the biggest pseudocolor anyone ever really did, and 15 is the least
    truecolor.
    
    Without this Xvfb at depth 8 would "have" GLX, but no vendors
    would actually back any of the screens. libGL will attempt to call
    GLXQueryServerString to figure out the GLX version, and vnd will throw
    an error because there's no vendor to dispatch that to, and then clients
    crash.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/glxext.c b/glx/glxext.c
index 46ff19236..99f866104 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -289,8 +289,9 @@ checkScreenVisuals(void)
     for (i = 0; i < screenInfo.numScreens; i++) {
         ScreenPtr screen = screenInfo.screens[i];
         for (j = 0; j < screen->numVisuals; j++) {
-            if (screen->visuals[j].class == TrueColor ||
-                screen->visuals[j].class == DirectColor)
+            if ((screen->visuals[j].class == TrueColor ||
+                 screen->visuals[j].class == DirectColor) &&
+                screen->visuals[j].nplanes > 12)
                 return TRUE;
         }
     }
commit 818885e6198cf2883155cb3d2e22c8c7bc4239fb
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Apr 23 16:19:14 2018 -0400

    vnd: Disable GLX if no vendors successfully initialized
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/vndcmds.c b/glx/vndcmds.c
index c3e1332bf..493e2bfc0 100644
--- a/glx/vndcmds.c
+++ b/glx/vndcmds.c
@@ -472,6 +472,8 @@ void GlxDispatchReset(void)
 int GlxDispatchRequest(ClientPtr client)
 {
     REQUEST(xReq);
+    if (GlxExtensionEntry->base == 0)
+        return BadRequest;
     if (stuff->data < OPCODE_ARRAY_LEN) {
         if (dispatchFuncs[stuff->data] == NULL) {
             // Try to find a dispatch stub.
diff --git a/glx/vndext.c b/glx/vndext.c
index cef306a40..d7936467b 100644
--- a/glx/vndext.c
+++ b/glx/vndext.c
@@ -39,6 +39,7 @@
 #include <GL/glxproto.h>
 #include "vndservervendor.h"
 
+ExtensionEntry *GlxExtensionEntry;
 int GlxErrorBase = 0;
 static CallbackListRec vndInitCallbackList;
 static CallbackListPtr vndInitCallbackListPtr = &vndInitCallbackList;
@@ -202,6 +203,7 @@ void
 GlxExtensionInit(void)
 {
     ExtensionEntry *extEntry;
+    GlxExtensionEntry = NULL;
 
     // Init private keys, per-screen data
     if (!dixRegisterPrivateKey(&glvXGLVScreenPrivKey, PRIVATE_SCREEN, 0))
@@ -228,8 +230,15 @@ GlxExtensionInit(void)
         return;
     }
 
+    GlxExtensionEntry = extEntry;
     GlxErrorBase = extEntry->errorBase;
     CallCallbacks(&vndInitCallbackListPtr, extEntry);
+
+    /* We'd better have found at least one vendor */
+    for (int i = 0; i < screenInfo.numScreens; i++)
+        if (GlxGetVendorForScreen(serverClient, screenInfo.screens[i]))
+            return;
+    extEntry->base = 0;
 }
 
 static int
diff --git a/glx/vndserver.h b/glx/vndserver.h
index 12297349c..a175656ae 100644
--- a/glx/vndserver.h
+++ b/glx/vndserver.h
@@ -62,9 +62,7 @@ typedef struct GlxClientPrivRec {
 extern int GlxErrorBase;
 extern RESTYPE idResource;
 
-// Defined in glxext.c.
-const ExtensionEntry *GlxGetExtensionEntry(void);
-
+extern ExtensionEntry *GlxExtensionEntry;
 Bool GlxDispatchInit(void);
 void GlxDispatchReset(void);
 
commit fc25bceb515e5c18eecdebf5933c3e05cdac1a5a
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Apr 23 16:19:13 2018 -0400

    dix: Allow an extension to disable itself
    
    GLX registers an extension before we know if there are any screens that
    can actually do it. It's inconvenient to shrink the extension list, so
    instead allow the extension to simply zero out its base opcode to
    indicate that it needed to panic and disable itself.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/extension.c b/dix/extension.c
index 7d432c722..9c158ba93 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -215,6 +215,8 @@ ExtensionAvailable(ClientPtr client, ExtensionEntry *ext)
 {
     if (XaceHook(XACE_EXT_ACCESS, client, ext) != Success)
         return FALSE;
+    if (!ext->base)
+        return FALSE;
     return TRUE;
 }
 
commit 73a1cb9c92c936c2c1ae3d69fed743e21916d687
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Apr 23 16:19:12 2018 -0400

    dix: Factor out extension availability check
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/extension.c b/dix/extension.c
index b4c1c5f16..7d432c722 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -210,6 +210,14 @@ CloseDownExtensions(void)
     lastError = FirstExtensionError;
 }
 
+static Bool
+ExtensionAvailable(ClientPtr client, ExtensionEntry *ext)
+{
+    if (XaceHook(XACE_EXT_ACCESS, client, ext) != Success)
+        return FALSE;
+    return TRUE;
+}
+
 int
 ProcQueryExtension(ClientPtr client)
 {
@@ -231,7 +239,7 @@ ProcQueryExtension(ClientPtr client)
         reply.present = xFalse;
     else {
         i = FindExtension((char *) &stuff[1], stuff->nbytes);
-        if (i < 0 || XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
+        if (i < 0 || !ExtensionAvailable(client, extensions[i]))
             reply.present = xFalse;
         else {
             reply.present = xTrue;
@@ -266,7 +274,7 @@ ProcListExtensions(ClientPtr client)
 
         for (i = 0; i < NumExtensions; i++) {
             /* call callbacks to find out whether to show extension */
-            if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success)
+            if (!ExtensionAvailable(client, extensions[i]))
                 continue;
 
             total_length += strlen(extensions[i]->name) + 1;
@@ -279,7 +287,7 @@ ProcListExtensions(ClientPtr client)
         for (i = 0; i < NumExtensions; i++) {
             int len;
 
-            if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success)
+            if (!ExtensionAvailable(client, extensions[i]))
                 continue;
 
             *bufptr++ = len = strlen(extensions[i]->name);


More information about the xorg-commit mailing list