summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2018-04-23 16:19:14 -0400
committerAdam Jackson <ajax@redhat.com>2018-04-24 14:36:04 -0400
commit818885e6198cf2883155cb3d2e22c8c7bc4239fb (patch)
treef12fa63bb29ffd77426e8024b95e4255c5b46dea
parentfc25bceb515e5c18eecdebf5933c3e05cdac1a5a (diff)
vnd: Disable GLX if no vendors successfully initialized
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--glx/vndcmds.c2
-rw-r--r--glx/vndext.c9
-rw-r--r--glx/vndserver.h4
3 files changed, 12 insertions, 3 deletions
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);