diff options
author | marha <marha@users.sourceforge.net> | 2012-07-11 11:55:48 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-07-11 11:55:48 +0200 |
commit | 6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab (patch) | |
tree | 21e1af7ee94600e349ae21353dc11963a06e988d /xorg-server/mi/miinitext.c | |
parent | 75f57cf199b6c042b0f7515e3a1ab80f7ccecfab (diff) | |
parent | d137057fd13e83ec15ab416c7fe774741da06047 (diff) | |
download | vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.tar.gz vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.tar.bz2 vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/shm.c
xorg-server/Xext/sync.c
xorg-server/Xext/xf86bigfont.c
xorg-server/Xi/opendev.c
xorg-server/dix/dispatch.c
xorg-server/include/globals.h
xorg-server/mi/miinitext.c
Diffstat (limited to 'xorg-server/mi/miinitext.c')
-rw-r--r-- | xorg-server/mi/miinitext.c | 415 |
1 files changed, 145 insertions, 270 deletions
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c index 823a946a7..d95d0210f 100644 --- a/xorg-server/mi/miinitext.c +++ b/xorg-server/mi/miinitext.c @@ -44,21 +44,46 @@ SOFTWARE. ******************************************************************/ +/* + * Copyright (c) 2000 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> +#include "xf86Extensions.h" #endif #ifdef HAVE_DMX_CONFIG_H #include <dmx-config.h> #undef XV #undef DBE -#undef XF86VIDMODE -#undef XFreeXDGA -#undef XF86DRI #undef SCREENSAVER #undef RANDR #undef XFIXES @@ -75,138 +100,24 @@ SOFTWARE. #ifdef HAVE_KDRIVE_CONFIG_H #include <kdrive-config.h> -/* there must be a better way... */ -#undef XFreeXDGA -#undef XF86DRI -#undef XF86VIDMODE #endif #ifdef HAVE_XGL_CONFIG_H #include <xgl-config.h> -#undef XFreeXDGA -#undef XF86DRI -#undef XF86VIDMODE #endif #include "misc.h" #include "extension.h" +#include "extinit.h" #include "micmap.h" #include "globals.h" -extern Bool noGEExtension; - -#ifndef XFree86LOADER -#define INITARGS void -typedef void (*InitExtension) (INITARGS); -#else /* XFree86Loader */ -#include "loaderProcs.h" -#endif - -#ifdef MITSHM -#include <X11/extensions/shm.h> -#endif -#ifdef XTEST -#include <X11/extensions/xtestconst.h> -#endif -#include <X11/extensions/XKB.h> -#ifdef XCSECURITY -#include "securitysrv.h" -#include <X11/extensions/secur.h> -#endif -#ifdef XSELINUX -#include "xselinux.h" -#endif -#ifdef PANORAMIX -#include <X11/extensions/panoramiXproto.h> -#endif -#ifdef XF86BIGFONT -#include <X11/extensions/xf86bigfproto.h> -#endif -#ifdef RES -#include <X11/extensions/XResproto.h> -#endif - -/* FIXME: this whole block of externs should be from the appropriate headers */ -#ifdef MITSHM -extern void ShmExtensionInit(INITARGS); -#endif -#ifdef PANORAMIX -extern void PanoramiXExtensionInit(INITARGS); -#endif -#ifdef INXQUARTZ -extern void PseudoramiXExtensionInit(INITARGS); -#endif -extern void XInputExtensionInit(INITARGS); - -#ifdef XTEST -extern void XTestExtensionInit(INITARGS); -#endif -extern void BigReqExtensionInit(INITARGS); - -#ifdef SCREENSAVER -extern void ScreenSaverExtensionInit(INITARGS); -#endif -#ifdef XV -extern void XvExtensionInit(INITARGS); -extern void XvMCExtensionInit(INITARGS); -#endif -extern void SyncExtensionInit(INITARGS); -extern void XkbExtensionInit(INITARGS); -extern void XCMiscExtensionInit(INITARGS); - -#ifdef XRECORD -extern void RecordExtensionInit(INITARGS); -#endif -#ifdef DBE -extern void DbeExtensionInit(INITARGS); -#endif -#ifdef XCSECURITY -extern void SecurityExtensionInit(INITARGS); -#endif -#ifdef XSELINUX -extern void SELinuxExtensionInit(INITARGS); -#endif -#ifdef XF86BIGFONT -extern void XFree86BigfontExtensionInit(INITARGS); -#endif -#ifdef XF86VIDMODE -extern void XFree86VidModeExtensionInit(INITARGS); -#endif -#ifdef XFreeXDGA -extern void XFree86DGAExtensionInit(INITARGS); -#endif #ifdef GLXEXT typedef struct __GLXprovider __GLXprovider; extern __GLXprovider __glXDRISWRastProvider; extern void GlxPushProvider(__GLXprovider * impl); extern void GlxExtensionInit(INITARGS); #endif -#ifdef XF86DRI -extern void XFree86DRIExtensionInit(INITARGS); -#endif -#ifdef DPMSExtension -extern void DPMSExtensionInit(INITARGS); -#endif -extern void RenderExtensionInit(INITARGS); - -#ifdef RANDR -extern void RRExtensionInit(INITARGS); -#endif -#ifdef RES -extern void ResExtensionInit(INITARGS); -#endif -#ifdef DMXEXT -extern void DMXExtensionInit(INITARGS); -#endif -#ifdef XFIXES -extern void XFixesExtensionInit(INITARGS); -#endif -#ifdef DAMAGE -extern void DamageExtensionInit(INITARGS); -#endif -#ifdef COMPOSITE -extern void CompositeExtensionInit(INITARGS); -#endif /* The following is only a small first step towards run-time * configurable extensions. @@ -253,6 +164,7 @@ static ExtensionToggle ExtensionToggleList[] = { #ifdef XF86BIGFONT {"XFree86-Bigfont", &noXFree86BigfontExtension}, #endif +#ifdef XorgLoader #ifdef XFreeXDGA {"XFree86-DGA", &noXFree86DGAExtension}, #endif @@ -262,6 +174,7 @@ static ExtensionToggle ExtensionToggleList[] = { #ifdef XF86VIDMODE {"XFree86-VidModeExtension", &noXFree86VidModeExtension}, #endif +#endif #ifdef XFIXES {"XFIXES", &noXFixesExtension}, #endif @@ -277,15 +190,16 @@ static ExtensionToggle ExtensionToggleList[] = { #ifdef XV {"XVideo", &noXvExtension}, #endif - {NULL, NULL} }; Bool EnableDisableExtension(const char *name, Bool enable) { - ExtensionToggle *ext = &ExtensionToggleList[0]; + ExtensionToggle *ext; + int i; - for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) { + for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) { + ext = &ExtensionToggleList[i]; if (strcmp(name, ext->name) == 0) { if (ext->disablePtr != NULL) { *ext->disablePtr = !enable; @@ -326,184 +240,93 @@ EnableDisableExtensionError(const char *name, Bool enable) } } -#ifndef XFree86LOADER - - /*ARGSUSED*/ void -InitExtensions(int argc, char *argv[]) -{ - if (!noGEExtension) - GEExtensionInit(); - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - PanoramiXExtensionInit(); -#endif -#ifdef INXQUARTZ - if (!noPseudoramiXExtension) - PseudoramiXExtensionInit(); -#endif - ShapeExtensionInit(); +/* List of built-in (statically linked) extensions */ +static ExtensionModule staticExtensions[] = { + {GEExtensionInit, "Generic Event Extension", &noGEExtension}, + {ShapeExtensionInit, "SHAPE", NULL}, #ifdef MITSHM - if (!noMITShmExtension) - ShmExtensionInit(); + {ShmExtensionInit, SHMNAME, &noMITShmExtension}, #endif - XInputExtensionInit(); + {XInputExtensionInit, "XInputExtension", NULL}, #ifdef XTEST - if (!noTestExtensions) - XTestExtensionInit(); -#endif - BigReqExtensionInit(); -#if defined(SCREENSAVER) - if (!noScreenSaverExtension) - ScreenSaverExtensionInit(); -#endif -#ifdef XV - if (!noXvExtension) { - XvExtensionInit(); - XvMCExtensionInit(); - } -#endif - SyncExtensionInit(); - XkbExtensionInit(); - XCMiscExtensionInit(); -#ifdef XRECORD - if (!noTestExtensions) - RecordExtensionInit(); -#endif -#ifdef DBE - if (!noDbeExtension) - DbeExtensionInit(); + {XTestExtensionInit, XTestExtensionName, &noTestExtensions}, #endif + {BigReqExtensionInit, "BIG-REQUESTS", NULL}, + {SyncExtensionInit, "SYNC", NULL}, + {XkbExtensionInit, XkbName, NULL}, + {XCMiscExtensionInit, "XC-MISC", NULL}, #ifdef XCSECURITY - if (!noSecurityExtension) - SecurityExtensionInit(); -#endif -#ifdef XSELINUX - if (!noSELinuxExtension) - SELinuxExtensionInit(); -#endif -#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS) - if (!noDPMSExtension) - DPMSExtensionInit(); -#endif -#ifdef XF86BIGFONT - if (!noXFree86BigfontExtension) - XFree86BigfontExtensionInit(); -#endif -#if !defined(NO_HW_ONLY_EXTS) -#if defined(XF86VIDMODE) - if (!noXFree86VidModeExtension) - XFree86VidModeExtensionInit(); -#endif -#if defined(XFreeXDGA) - if (!noXFree86DGAExtension) - XFree86DGAExtensionInit(); -#endif -#ifdef XF86DRI - if (!noXFree86DRIExtension) - XFree86DRIExtensionInit(); + {SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension}, #endif +#ifdef PANORAMIX + {PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension}, #endif #ifdef XFIXES /* must be before Render to layer DisplayCursor correctly */ - if (!noXFixesExtension) - XFixesExtensionInit(); + {XFixesExtensionInit, "XFIXES", &noXFixesExtension}, #endif - if (!noRenderExtension) - RenderExtensionInit(); -#ifdef RANDR - if (!noRRExtension) - RRExtensionInit(); -#endif -#ifdef RES - if (!noResExtension) - ResExtensionInit(); +#ifdef XF86BIGFONT + {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension}, #endif -#ifdef DMXEXT - DMXExtensionInit(); /* server-specific extension, cannot be disabled */ + {RenderExtensionInit, "RENDER", &noRenderExtension}, +#ifdef RANDR + {RRExtensionInit, "RANDR", &noRRExtension}, #endif #ifdef COMPOSITE - if (!noCompositeExtension) - CompositeExtensionInit(); + {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension}, #endif #ifdef DAMAGE - if (!noDamageExtension) - DamageExtensionInit(); + {DamageExtensionInit, "DAMAGE", &noDamageExtension}, #endif - -#ifdef GLXEXT - if (serverGeneration == 1) - { - GlxPushProvider(&__glXDRISWRastProvider); - glxWinPushNativeProvider(); - } - if (!noGlxExtension) - GlxExtensionInit(); - -#endif -} - -#else /* XFree86LOADER */ -/* List of built-in (statically linked) extensions */ -static ExtensionModule staticExtensions[] = { - {GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL}, - {ShapeExtensionInit, "SHAPE", NULL, NULL, NULL}, -#ifdef MITSHM - {ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL}, -#endif - {XInputExtensionInit, "XInputExtension", NULL, NULL, NULL}, -#ifdef XTEST - {XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL}, -#endif - {BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL}, - {SyncExtensionInit, "SYNC", NULL, NULL, NULL}, - {XkbExtensionInit, XkbName, NULL, NULL, NULL}, - {XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL}, -#ifdef XCSECURITY - {SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, - NULL}, +#ifdef SCREENSAVER + {ScreenSaverExtensionInit, ScreenSaverName, &noScreenSaverExtension}, #endif -#ifdef PANORAMIX - {PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, - NULL, NULL}, +#ifdef DBE + {DbeExtensionInit, "DOUBLE-BUFFER", &noDbeExtension}, #endif -#ifdef XFIXES - /* must be before Render to layer DisplayCursor correctly */ - {XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL}, +#ifdef XRECORD + {RecordExtensionInit, "RECORD", &noTestExtensions}, #endif -#ifdef XF86BIGFONT - {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, - NULL, NULL}, +#ifdef DPMSExtension + {DPMSExtensionInit, DPMSExtensionName, &noDPMSExtension}, #endif - {RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL}, -#ifdef RANDR - {RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL}, +#ifdef RES + {ResExtensionInit, XRES_NAME, &noResExtension}, #endif -#ifdef COMPOSITE - {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL}, +#ifdef XV + {XvExtensionInit, XvName, &noXvExtension}, + {XvMCExtensionInit, XvMCName, &noXvExtension}, #endif -#ifdef DAMAGE - {DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL}, +#ifdef XSELINUX + {SELinuxExtensionInit, SELINUX_EXTENSION_NAME, &noSELinuxExtension}, #endif - {NULL, NULL, NULL, NULL, NULL} }; - /*ARGSUSED*/ void +static ExtensionModule *ExtensionModuleList = NULL; +static int numExtensionModules = 0; + +static void +AddStaticExtensions(void) +{ + static Bool listInitialised = FALSE; + int i; + + if (listInitialised) + return; + listInitialised = TRUE; + + /* Add built-in extensions to the list. */ + for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) + LoadExtension(&staticExtensions[i], TRUE); +} + +void InitExtensions(int argc, char *argv[]) { int i; ExtensionModule *ext; - static Bool listInitialised = FALSE; - if (!listInitialised) { - /* Add built-in extensions to the list. */ - for (i = 0; staticExtensions[i].name; i++) - LoadExtension(&staticExtensions[i], TRUE); - - /* Sort the extensions according the init dependencies. */ - LoaderSortExtensions(); - listInitialised = TRUE; - } + AddStaticExtensions(); for (i = 0; ExtensionModuleList[i].name != NULL; i++) { ext = &ExtensionModuleList[i]; @@ -512,6 +335,58 @@ InitExtensions(int argc, char *argv[]) (ext->initFunc) (); } } +#ifdef GLXEXT + if (!noGlxExtension) + GlxExtensionInit(); + +#endif } -#endif /* XFree86LOADER */ +static ExtensionModule * +NewExtensionModule(void) +{ + ExtensionModule *save = ExtensionModuleList; + int n; + + /* Make sure built-in extensions get added to the list before those + * in modules. */ + AddStaticExtensions(); + + /* Sanity check */ + if (!ExtensionModuleList) + numExtensionModules = 0; + + n = numExtensionModules + 1; + ExtensionModuleList = realloc(ExtensionModuleList, + (n + 1) * sizeof(ExtensionModule)); + if (ExtensionModuleList == NULL) { + ExtensionModuleList = save; + return NULL; + } + else { + numExtensionModules++; + ExtensionModuleList[numExtensionModules].name = NULL; + return ExtensionModuleList + (numExtensionModules - 1); + } +} + +void +LoadExtension(ExtensionModule * e, Bool builtin) +{ + ExtensionModule *newext; + + if (e == NULL || e->name == NULL) + return; + + if (!(newext = NewExtensionModule())) + return; + + if (builtin) + ErrorF("Initializing built-in extension %s\n", e->name); + else + ErrorF("Loading extension %s\n", e->name); + + newext->name = e->name; + newext->initFunc = e->initFunc; + newext->disablePtr = e->disablePtr; +} |