[PATCH xserver 3/4] vnd: Disable GLX if no vendors successfully initialized

Adam Jackson ajax at redhat.com
Mon Apr 23 20:19:14 UTC 2018


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/vndcmds.c   | 2 ++
 glx/vndext.c    | 9 +++++++++
 glx/vndserver.h | 4 +---
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/glx/vndcmds.c b/glx/vndcmds.c
index c3e1332bf0..493e2bfc04 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 cef306a400..d7936467be 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 12297349c4..a175656ae7 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);
 
-- 
2.17.0



More information about the xorg-devel mailing list