[RFC PATCH] glxvnd: Various fixes
Kyle Brenneman
kbrenneman at nvidia.com
Fri Oct 20 17:31:16 UTC 2017
This is a follow-on to the GLXVND patches by Adam Jackson, sent out on
8/30/2017. This still mostly proof-of-concept, but it's enough to at least
build and run.
Fix various compiler warnings.
Fix GlxGetXIDMap so that it calls dixLookupResourceByClass instead of
dixLookupResourceByType.
Update the autotools build system to include the glxvnd files.
In glxvnd, don't skip initializing GLX if the vendor list is empty. The init
callbacks themselves might allocate vendor handles.
Reworked the GLVND vendor initialization functions to work with the full
xfree86 server.
xorgGlxCreateVendor now just registers the xorgGlxServerInit callback with
GLVND. All of the actual initialization is in xorgGlxServerInit.
xorgGlxServerInit now initializes all screens, not just one. It'll go through
the provider stack for each of them.
Added __glXProviderStack and GlxPushProvider back in.
---
glx/Makefile.am | 6 +-
glx/glxext.c | 115 +++++++++++++++++++++-------------
glx/vnd_dispatch_stubs.c | 139 ++++++++++++++++++++++++-----------------
glx/vndcmds.c | 7 ++-
glx/vndext.c | 15 +++--
glx/vndserver.h | 2 +
glx/vndservermapping.c | 2 +-
hw/kdrive/ephyr/ephyr.c | 2 +-
hw/vfb/InitOutput.c | 2 +-
hw/xfree86/dixmods/glxmodule.c | 1 +
hw/xquartz/darwin.c | 2 +-
hw/xwayland/xwayland.c | 2 +-
hw/xwin/winscrinit.c | 2 +-
include/glx_extinit.h | 2 +-
14 files changed, 181 insertions(+), 118 deletions(-)
diff --git a/glx/Makefile.am b/glx/Makefile.am
index 699de63..6af56c1 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -80,6 +80,10 @@ libglx_la_SOURCES = \
singlesize.h \
swap_interval.c \
unpack.h \
- xfont.c
+ xfont.c \
+ vndcmds.c \
+ vndext.c \
+ vndservermapping.c \
+ vndservervendor.c
libglx_la_LIBADD = $(DLOPEN_LIBS)
diff --git a/glx/glxext.c b/glx/glxext.c
index 19d83f4..f699ce7 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -297,6 +297,15 @@ glxClientCallback(CallbackListPtr *list, void *closure, void *data)
/************************************************************************/
+static __GLXprovider *__glXProviderStack = &__glXDRISWRastProvider;
+
+void
+GlxPushProvider(__GLXprovider * provider)
+{
+ provider->next = __glXProviderStack;
+ __glXProviderStack = provider;
+}
+
static Bool
checkScreenVisuals(void)
{
@@ -493,62 +502,84 @@ xorgGlxServerPreInit(const ExtensionEntry *extEntry)
return glxGeneration == serverGeneration;
}
+static GlxServerVendor *glvnd_vendor = NULL;
+
+static GlxServerVendor *
+xorgGlxInitGLVNDVendor(void)
+{
+ if (glvnd_vendor == NULL) {
+ GlxServerImports *imports = NULL;
+ imports = glxServer.allocateServerImports();
+
+ if (imports != NULL) {
+ imports->extensionCloseDown = xorgGlxCloseExtension;
+ imports->handleRequest = xorgGlxHandleRequest;
+ imports->getDispatchAddress = xorgGlxGetDispatchAddress;
+ imports->makeCurrent = xorgGlxMakeCurrent;
+ glvnd_vendor = glxServer.createVendor(imports);
+ glxServer.freeServerImports(imports);
+ }
+ }
+ return glvnd_vendor;
+}
+
static void
xorgGlxServerInit(CallbackListPtr *pcbl, void *param, void *ext)
{
const ExtensionEntry *extEntry = ext;
- xorgVendorInitClosure *closure = param;
- ScreenPtr screen = closure->screen;
- __GLXprovider *p = closure->provider;
- __GLXscreen *s = NULL;
+ int i;
- if (!xorgGlxServerPreInit(extEntry))
- goto out;
+ if (!xorgGlxServerPreInit(extEntry)) {
+ return;
+ }
+
+ if (!xorgGlxInitGLVNDVendor()) {
+ return;
+ }
- if (!(s = p->screenProbe(screen)))
- goto out;
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ __GLXprovider *p;
- if (!glxServer.setScreenVendor(screen, closure->vendor))
- goto out;
+ if (glxServer.getVendorForScreen(NULL, pScreen) != NULL) {
+ // There's already a vendor registered.
+ LogMessage(X_INFO, "GLX: Another vendor is already registered for screen %d\n", i);
+ continue;
+ }
+
+ for (p = __glXProviderStack; p != NULL; p = p->next) {
+ __GLXscreen *glxScreen = p->screenProbe(pScreen);
+ if (glxScreen != NULL) {
+ LogMessage(X_INFO,
+ "GLX: Initialized %s GL provider for screen %d\n",
+ p->name, i);
+ break;
+ }
-out:
- /* XXX chirp on error */
- free(param);
- return;
+ }
+
+ if (p) {
+ glxServer.setScreenVendor(pScreen, glvnd_vendor);
+ } else {
+ LogMessage(X_INFO,
+ "GLX: no usable GL providers found for screen %d\n", i);
+ }
+ }
}
Bool
-xorgGlxCreateVendor(ScreenPtr pScreen, __GLXprovider *provider)
+xorgGlxCreateVendor(void)
{
- GlxServerVendor *vendor = NULL;
- GlxServerImports *imports = NULL;
- xorgVendorInitClosure *closure = NULL;
-
- /* XXX kind of an fb assumption, wrong for nest/dmx */
- if (!provider)
- provider = &__glXDRISWRastProvider;
-
- imports = glxServer.allocateServerImports();
- closure = calloc(1, sizeof(xorgVendorInitClosure));
-
- if (imports && closure) {
- imports->extensionCloseDown = xorgGlxCloseExtension;
- imports->handleRequest = xorgGlxHandleRequest;
- imports->getDispatchAddress = xorgGlxGetDispatchAddress;
- imports->makeCurrent = xorgGlxMakeCurrent;
- closure->screen = pScreen;
- closure->provider = provider;
- closure->vendor = glxServer.createVendor(imports);
- if (closure->vendor) {
- return AddCallback(glxServer.extensionInitCallback,
- xorgGlxServerInit, closure);
+ // HACK: This is called per-screen from Xvfb and such, so make sure we only
+ // add the callback once.
+ static Bool callbackAdded = FALSE;
+ if (!callbackAdded) {
+ if (AddCallback(glxServer.extensionInitCallback,
+ xorgGlxServerInit, NULL)) {
+ callbackAdded = TRUE;
}
- } else {
- glxServer.freeServerImports(imports);
- free(closure);
}
-
- return !!vendor;
+ return callbackAdded;
}
/************************************************************************/
diff --git a/glx/vnd_dispatch_stubs.c b/glx/vnd_dispatch_stubs.c
index 82170ac..f99dff0 100644
--- a/glx/vnd_dispatch_stubs.c
+++ b/glx/vnd_dispatch_stubs.c
@@ -11,9 +11,10 @@
static int dispatch_Render(ClientPtr client)
{
REQUEST(xGLXRenderReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 contextTag = GlxCheckSwap(client, stuff->contextTag);
+ CARD32 contextTag;
GlxServerVendor *vendor = NULL;
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ contextTag = GlxCheckSwap(client, stuff->contextTag);
if (!glxServer.getContextTag(client, contextTag, &vendor, NULL)) {
vendor = NULL;
}
@@ -29,9 +30,10 @@ static int dispatch_Render(ClientPtr client)
static int dispatch_RenderLarge(ClientPtr client)
{
REQUEST(xGLXRenderLargeReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 contextTag = GlxCheckSwap(client, stuff->contextTag);
+ CARD32 contextTag;
GlxServerVendor *vendor = NULL;
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ contextTag = GlxCheckSwap(client, stuff->contextTag);
if (!glxServer.getContextTag(client, contextTag, &vendor, NULL)) {
vendor = NULL;
}
@@ -47,10 +49,11 @@ static int dispatch_RenderLarge(ClientPtr client)
static int dispatch_CreateContext(ClientPtr client)
{
REQUEST(xGLXCreateContextReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, context;
GlxServerVendor *vendor = NULL;
- CARD32 context = GlxCheckSwap(client, stuff->context);
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ context = GlxCheckSwap(client, stuff->context);
LEGAL_NEW_RESOURCE(context, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -73,9 +76,10 @@ static int dispatch_CreateContext(ClientPtr client)
static int dispatch_DestroyContext(ClientPtr client)
{
REQUEST(xGLXDestroyContextReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 context = GlxCheckSwap(client, stuff->context);
+ CARD32 context;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ context = GlxCheckSwap(client, stuff->context);
vendor = glxServer.getXIDMap(context);
if (vendor != NULL) {
int ret;
@@ -92,9 +96,10 @@ static int dispatch_DestroyContext(ClientPtr client)
static int dispatch_WaitGL(ClientPtr client)
{
REQUEST(xGLXWaitGLReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 contextTag = GlxCheckSwap(client, stuff->contextTag);
+ CARD32 contextTag;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ contextTag = GlxCheckSwap(client, stuff->contextTag);
if (!glxServer.getContextTag(client, contextTag, &vendor, NULL)) {
vendor = NULL;
}
@@ -110,9 +115,10 @@ static int dispatch_WaitGL(ClientPtr client)
static int dispatch_WaitX(ClientPtr client)
{
REQUEST(xGLXWaitXReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 contextTag = GlxCheckSwap(client, stuff->contextTag);
+ CARD32 contextTag;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ contextTag = GlxCheckSwap(client, stuff->contextTag);
if (!glxServer.getContextTag(client, contextTag, &vendor, NULL)) {
vendor = NULL;
}
@@ -128,9 +134,10 @@ static int dispatch_WaitX(ClientPtr client)
static int dispatch_UseXFont(ClientPtr client)
{
REQUEST(xGLXUseXFontReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 contextTag = GlxCheckSwap(client, stuff->contextTag);
+ CARD32 contextTag;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ contextTag = GlxCheckSwap(client, stuff->contextTag);
if (!glxServer.getContextTag(client, contextTag, &vendor, NULL)) {
vendor = NULL;
}
@@ -146,10 +153,11 @@ static int dispatch_UseXFont(ClientPtr client)
static int dispatch_CreateGLXPixmap(ClientPtr client)
{
REQUEST(xGLXCreateGLXPixmapReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, glxpixmap;
GlxServerVendor *vendor = NULL;
- CARD32 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
LEGAL_NEW_RESOURCE(glxpixmap, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -172,9 +180,10 @@ static int dispatch_CreateGLXPixmap(ClientPtr client)
static int dispatch_GetVisualConfigs(ClientPtr client)
{
REQUEST(xGLXGetVisualConfigsReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
}
@@ -190,9 +199,10 @@ static int dispatch_GetVisualConfigs(ClientPtr client)
static int dispatch_DestroyGLXPixmap(ClientPtr client)
{
REQUEST(xGLXDestroyGLXPixmapReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
+ CARD32 glxpixmap;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
vendor = glxServer.getXIDMap(glxpixmap);
if (vendor != NULL) {
int ret;
@@ -206,9 +216,10 @@ static int dispatch_DestroyGLXPixmap(ClientPtr client)
static int dispatch_QueryExtensionsString(ClientPtr client)
{
REQUEST(xGLXQueryExtensionsStringReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
}
@@ -224,9 +235,10 @@ static int dispatch_QueryExtensionsString(ClientPtr client)
static int dispatch_QueryServerString(ClientPtr client)
{
REQUEST(xGLXQueryServerStringReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
}
@@ -242,9 +254,10 @@ static int dispatch_QueryServerString(ClientPtr client)
static int dispatch_ChangeDrawableAttributes(ClientPtr client)
{
REQUEST(xGLXChangeDrawableAttributesReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 drawable = GlxCheckSwap(client, stuff->drawable);
+ CARD32 drawable;
GlxServerVendor *vendor = NULL;
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ drawable = GlxCheckSwap(client, stuff->drawable);
vendor = glxServer.getXIDMap(drawable);
if (vendor != NULL) {
int ret;
@@ -258,10 +271,11 @@ static int dispatch_ChangeDrawableAttributes(ClientPtr client)
static int dispatch_CreateNewContext(ClientPtr client)
{
REQUEST(xGLXCreateNewContextReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, context;
GlxServerVendor *vendor = NULL;
- CARD32 context = GlxCheckSwap(client, stuff->context);
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ context = GlxCheckSwap(client, stuff->context);
LEGAL_NEW_RESOURCE(context, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -284,10 +298,11 @@ static int dispatch_CreateNewContext(ClientPtr client)
static int dispatch_CreatePbuffer(ClientPtr client)
{
REQUEST(xGLXCreatePbufferReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, pbuffer;
GlxServerVendor *vendor = NULL;
- CARD32 pbuffer = GlxCheckSwap(client, stuff->pbuffer);
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ pbuffer = GlxCheckSwap(client, stuff->pbuffer);
LEGAL_NEW_RESOURCE(pbuffer, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -310,10 +325,11 @@ static int dispatch_CreatePbuffer(ClientPtr client)
static int dispatch_CreatePixmap(ClientPtr client)
{
REQUEST(xGLXCreatePixmapReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, glxpixmap;
GlxServerVendor *vendor = NULL;
- CARD32 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
LEGAL_NEW_RESOURCE(glxpixmap, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -336,10 +352,11 @@ static int dispatch_CreatePixmap(ClientPtr client)
static int dispatch_CreateWindow(ClientPtr client)
{
REQUEST(xGLXCreateWindowReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, glxwindow;
GlxServerVendor *vendor = NULL;
- CARD32 glxwindow = GlxCheckSwap(client, stuff->glxwindow);
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ glxwindow = GlxCheckSwap(client, stuff->glxwindow);
LEGAL_NEW_RESOURCE(glxwindow, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -362,10 +379,11 @@ static int dispatch_CreateWindow(ClientPtr client)
static int dispatch_CreateContextAttribsARB(ClientPtr client)
{
REQUEST(xGLXCreateContextAttribsARBReq);
- REQUEST_AT_LEAST_SIZE(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen, context;
GlxServerVendor *vendor = NULL;
- CARD32 context = GlxCheckSwap(client, stuff->context);
+ REQUEST_AT_LEAST_SIZE(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
+ context = GlxCheckSwap(client, stuff->context);
LEGAL_NEW_RESOURCE(context, client);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
@@ -388,9 +406,10 @@ static int dispatch_CreateContextAttribsARB(ClientPtr client)
static int dispatch_DestroyPbuffer(ClientPtr client)
{
REQUEST(xGLXDestroyPbufferReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 pbuffer = GlxCheckSwap(client, stuff->pbuffer);
+ CARD32 pbuffer;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ pbuffer = GlxCheckSwap(client, stuff->pbuffer);
vendor = glxServer.getXIDMap(pbuffer);
if (vendor != NULL) {
int ret;
@@ -407,9 +426,10 @@ static int dispatch_DestroyPbuffer(ClientPtr client)
static int dispatch_DestroyPixmap(ClientPtr client)
{
REQUEST(xGLXDestroyPixmapReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
+ CARD32 glxpixmap;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ glxpixmap = GlxCheckSwap(client, stuff->glxpixmap);
vendor = glxServer.getXIDMap(glxpixmap);
if (vendor != NULL) {
int ret;
@@ -426,9 +446,10 @@ static int dispatch_DestroyPixmap(ClientPtr client)
static int dispatch_DestroyWindow(ClientPtr client)
{
REQUEST(xGLXDestroyWindowReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 glxwindow = GlxCheckSwap(client, stuff->glxwindow);
+ CARD32 glxwindow;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ glxwindow = GlxCheckSwap(client, stuff->glxwindow);
vendor = glxServer.getXIDMap(glxwindow);
if (vendor != NULL) {
int ret;
@@ -445,9 +466,10 @@ static int dispatch_DestroyWindow(ClientPtr client)
static int dispatch_GetDrawableAttributes(ClientPtr client)
{
REQUEST(xGLXGetDrawableAttributesReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 drawable = GlxCheckSwap(client, stuff->drawable);
+ CARD32 drawable;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ drawable = GlxCheckSwap(client, stuff->drawable);
vendor = glxServer.getXIDMap(drawable);
if (vendor != NULL) {
int ret;
@@ -461,9 +483,10 @@ static int dispatch_GetDrawableAttributes(ClientPtr client)
static int dispatch_GetFBConfigs(ClientPtr client)
{
REQUEST(xGLXGetFBConfigsReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 screen = GlxCheckSwap(client, stuff->screen);
+ CARD32 screen;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ screen = GlxCheckSwap(client, stuff->screen);
if (screen < screenInfo.numScreens) {
vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]);
}
@@ -479,9 +502,10 @@ static int dispatch_GetFBConfigs(ClientPtr client)
static int dispatch_QueryContext(ClientPtr client)
{
REQUEST(xGLXQueryContextReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 context = GlxCheckSwap(client, stuff->context);
+ CARD32 context;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ context = GlxCheckSwap(client, stuff->context);
vendor = glxServer.getXIDMap(context);
if (vendor != NULL) {
int ret;
@@ -495,9 +519,10 @@ static int dispatch_QueryContext(ClientPtr client)
static int dispatch_IsDirect(ClientPtr client)
{
REQUEST(xGLXIsDirectReq);
- REQUEST_SIZE_MATCH(*stuff);
- CARD32 context = GlxCheckSwap(client, stuff->context);
+ CARD32 context;
GlxServerVendor *vendor = NULL;
+ REQUEST_SIZE_MATCH(*stuff);
+ context = GlxCheckSwap(client, stuff->context);
vendor = glxServer.getXIDMap(context);
if (vendor != NULL) {
int ret;
diff --git a/glx/vndcmds.c b/glx/vndcmds.c
index 0ad68e9..489e259 100644
--- a/glx/vndcmds.c
+++ b/glx/vndcmds.c
@@ -301,8 +301,8 @@ static int dispatch_GLXMakeCurrentReadSGI(ClientPtr client)
static int dispatch_GLXCopyContext(ClientPtr client)
{
REQUEST(xGLXCopyContextReq);
- REQUEST_SIZE_MATCH(*stuff);
GlxServerVendor *vendor;
+ REQUEST_SIZE_MATCH(*stuff);
// If we've got a context tag, then we'll use it to select a vendor. If we
// don't have a tag, then we'll look up one of the contexts. In either
@@ -355,9 +355,10 @@ static int dispatch_GLXSwapBuffers(ClientPtr client)
static int dispatch_GLXSingle(ClientPtr client)
{
REQUEST(xGLXSingleReq);
+ GlxContextTagInfo *tagInfo;
REQUEST_AT_LEAST_SIZE(*stuff);
- GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, GlxCheckSwap(client, stuff->contextTag));
+ tagInfo = GlxLookupContextTag(client, GlxCheckSwap(client, stuff->contextTag));
if (tagInfo != NULL) {
return tagInfo->vendor->glxvc.handleRequest(client);
} else {
@@ -399,7 +400,7 @@ Bool GlxDispatchInit(void)
vendorPrivHash = ht_create(sizeof(CARD32), sizeof(GlxVendorPrivDispatch),
ht_generic_hash, ht_generic_compare,
- &vendorPrivSetup);
+ (void *) &vendorPrivSetup);
if (!vendorPrivHash) {
return FALSE;
}
diff --git a/glx/vndext.c b/glx/vndext.c
index 658e292..7cef8f4 100644
--- a/glx/vndext.c
+++ b/glx/vndext.c
@@ -172,9 +172,6 @@ void GlxExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (xorg_list_is_empty(&GlxVendorList))
- return;
-
// Init private keys, per-screen data
if (!dixRegisterPrivateKey(&glvXGLVScreenPrivKey, PRIVATE_SCREEN, 0))
return;
@@ -204,12 +201,12 @@ void GlxExtensionInit(void)
CallCallbacks(&vndInitCallbackList, extEntry);
}
-int ForwardRequest(GlxServerVendor *vendor, ClientPtr client)
+static int ForwardRequest(GlxServerVendor *vendor, ClientPtr client)
{
return vendor->glxvc.handleRequest(client);
}
-Bool GetContextTag(ClientPtr client, GLXContextTag tag, GlxServerVendor **vendor, void **data)
+static Bool GetContextTag(ClientPtr client, GLXContextTag tag, GlxServerVendor **vendor, void **data)
{
GlxContextTagInfo *tagInfo = GlxLookupContextTag(client, tag);
GlxServerVendor *foundVendor = NULL;
@@ -228,12 +225,12 @@ Bool GetContextTag(ClientPtr client, GLXContextTag tag, GlxServerVendor **vendor
return (foundVendor != NULL);
}
-GlxServerImports *GlxAllocateServerImports(void)
+static GlxServerImports *GlxAllocateServerImports(void)
{
return calloc(1, sizeof(GlxServerImports));
}
-void GlxFreeServerImports(GlxServerImports *imports)
+static void GlxFreeServerImports(GlxServerImports *imports)
{
free(imports);
}
@@ -259,7 +256,9 @@ _X_EXPORT const GlxServerExports glxServer = {
ForwardRequest, // forwardRequest
};
-_X_EXPORT const GlxServerExports *glvndGetExports(void)
+_X_EXPORT const GlxServerExports *glvndGetExports(void);
+
+const GlxServerExports *glvndGetExports(void)
{
return &glxServer;
}
diff --git a/glx/vndserver.h b/glx/vndserver.h
index 7f1e89c..83b78db 100644
--- a/glx/vndserver.h
+++ b/glx/vndserver.h
@@ -65,6 +65,8 @@ extern RESTYPE idResource;
// Defined in glxext.c.
const ExtensionEntry *GlxGetExtensionEntry(void);
+void GlxExtensionInit(void);
+
Bool GlxDispatchInit(void);
void GlxDispatchReset(void);
diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c
index c6ef711..fd3be92 100644
--- a/glx/vndservermapping.c
+++ b/glx/vndservermapping.c
@@ -55,7 +55,7 @@ GlxServerVendor *GlxGetXIDMap(XID id)
// wasn't created through GLX, like a regular X window or pixmap. Try
// to look up a matching drawable to find a screen number for it.
void *ptr = NULL;
- int rv = dixLookupResourceByType(&ptr, id, RC_DRAWABLE, NULL,
+ int rv = dixLookupResourceByClass(&ptr, id, RC_DRAWABLE, NULL,
DixGetAttrAccess);
if (rv == Success && ptr != NULL) {
DrawablePtr draw = (DrawablePtr) ptr;
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index bead930..8b6b0f2 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -698,7 +698,7 @@ ephyrFinishInitScreen(ScreenPtr pScreen)
#endif
#ifdef GLXEXT
if (!noGlxExtension)
- xorgGlxCreateVendor(pScreen, NULL);
+ xorgGlxCreateVendor();
#endif
scrpriv->BlockHandler = pScreen->BlockHandler;
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 819bbf3..ff566a9 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -936,7 +936,7 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
#ifdef GLXEXT
if (!noGlxExtension)
- xorgGlxCreateVendor(pScreen, NULL);
+ xorgGlxCreateVendor();
#endif
pScreen->InstallColormap = vfbInstallColormap;
diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c
index bf7e659..c3d92fa 100644
--- a/hw/xfree86/dixmods/glxmodule.c
+++ b/hw/xfree86/dixmods/glxmodule.c
@@ -83,6 +83,7 @@ glxSetup(void *module, void *opts, int *errmaj, int *errmin)
provider = LoaderSymbol("__glXDRI2Provider");
if (provider)
GlxPushProvider(provider);
+ xorgGlxCreateVendor();
LoadExtensionList(GLXExt, ARRAY_SIZE(GLXExt), FALSE);
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index bf7e249..ba990df 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -273,7 +273,7 @@ DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
#endif
#ifdef GLXEXT
if (!noGlxExtension)
- xorgGlxCreateVendor(pScreen, NULL);
+ xorgGlxCreateVendor();
#endif
// this must be initialized (why doesn't X have a default?)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 207edcd..c229ec9 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -985,7 +985,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
#ifdef GLXEXT
if (!noGlxExtension)
- xorgGlxCreateVendor(pScreen, NULL);
+ xorgGlxCreateVendor();
#endif
xwl_screen->RealizeWindow = pScreen->RealizeWindow;
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 179cd82..8e32723 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -371,7 +371,7 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
__GLXprovider *provider = NULL;
if (g_fNativeGl)
__GLXprovider = &__glXWGLProvider;
- xorgGlxCreateVendor(pScreen, provider);
+ xorgGlxCreateVendor();
}
#endif
diff --git a/include/glx_extinit.h b/include/glx_extinit.h
index a57da76..d717908 100644
--- a/include/glx_extinit.h
+++ b/include/glx_extinit.h
@@ -40,7 +40,7 @@ struct __GLXprovider {
extern __GLXprovider __glXDRISWRastProvider;
void GlxPushProvider(__GLXprovider * provider);
-Bool xorgGlxCreateVendor(ScreenPtr pScreen, __GLXprovider *provider);
+Bool xorgGlxCreateVendor(void);
#endif
#endif
--
2.7.4
More information about the xorg-devel
mailing list