miinitext.c revision 4202a189
105b261ecSmrg/***********************************************************
205b261ecSmrg
305b261ecSmrgCopyright 1987, 1998  The Open Group
405b261ecSmrg
505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its
605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that
705b261ecSmrgthe above copyright notice appear in all copies and that both that
805b261ecSmrgcopyright notice and this permission notice appear in supporting
905b261ecSmrgdocumentation.
1005b261ecSmrg
1105b261ecSmrgThe above copyright notice and this permission notice shall be included in
1205b261ecSmrgall copies or substantial portions of the Software.
1305b261ecSmrg
1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1505b261ecSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605b261ecSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1705b261ecSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1805b261ecSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1905b261ecSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2005b261ecSmrg
2105b261ecSmrgExcept as contained in this notice, the name of The Open Group shall not be
2205b261ecSmrgused in advertising or otherwise to promote the sale, use or other dealings
2305b261ecSmrgin this Software without prior written authorization from The Open Group.
2405b261ecSmrg
2505b261ecSmrg
2605b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
2705b261ecSmrg
2805b261ecSmrg                        All Rights Reserved
2905b261ecSmrg
3005b261ecSmrgPermission to use, copy, modify, and distribute this software and its
3105b261ecSmrgdocumentation for any purpose and without fee is hereby granted,
3205b261ecSmrgprovided that the above copyright notice appear in all copies and that
3305b261ecSmrgboth that copyright notice and this permission notice appear in
3405b261ecSmrgsupporting documentation, and that the name of Digital not be
3505b261ecSmrgused in advertising or publicity pertaining to distribution of the
3605b261ecSmrgsoftware without specific, written prior permission.
3705b261ecSmrg
3805b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
3905b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
4005b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
4105b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
4205b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
4305b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4405b261ecSmrgSOFTWARE.
4505b261ecSmrg
4605b261ecSmrg******************************************************************/
4705b261ecSmrg
4805b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
4905b261ecSmrg#include <dix-config.h>
5005b261ecSmrg#endif
5105b261ecSmrg
5205b261ecSmrg#ifdef HAVE_XORG_CONFIG_H
5305b261ecSmrg#include <xorg-config.h>
5405b261ecSmrg#endif
5505b261ecSmrg
5605b261ecSmrg#ifdef HAVE_DMX_CONFIG_H
5705b261ecSmrg#include <dmx-config.h>
584202a189Smrg#undef XV
594202a189Smrg#undef DBE
604202a189Smrg#undef XF86VIDMODE
614202a189Smrg#undef XFreeXDGA
624202a189Smrg#undef XF86DRI
634202a189Smrg#undef SCREENSAVER
644202a189Smrg#undef RANDR
654202a189Smrg#undef XFIXES
664202a189Smrg#undef DAMAGE
674202a189Smrg#undef COMPOSITE
684202a189Smrg#undef MITSHM
6905b261ecSmrg#endif
7005b261ecSmrg
7105b261ecSmrg#ifdef HAVE_XNEST_CONFIG_H
7205b261ecSmrg#include <xnest-config.h>
734642e01fSmrg#undef COMPOSITE
7405b261ecSmrg#undef DPMSExtension
7505b261ecSmrg#endif
7605b261ecSmrg
7705b261ecSmrg#ifdef HAVE_KDRIVE_CONFIG_H
7805b261ecSmrg#include <kdrive-config.h>
7905b261ecSmrg/* there must be a better way... */
8005b261ecSmrg#undef XFreeXDGA
8105b261ecSmrg#undef XF86DRI
8205b261ecSmrg#undef XF86VIDMODE
8305b261ecSmrg#endif
8405b261ecSmrg
8505b261ecSmrg#ifdef HAVE_XGL_CONFIG_H
8605b261ecSmrg#include <xgl-config.h>
8705b261ecSmrg#undef XFreeXDGA
8805b261ecSmrg#undef XF86DRI
8905b261ecSmrg#undef XF86VIDMODE
9005b261ecSmrg#endif
9105b261ecSmrg
9205b261ecSmrg#include "misc.h"
9305b261ecSmrg#include "extension.h"
9405b261ecSmrg#include "micmap.h"
9505b261ecSmrg#include "globals.h"
9605b261ecSmrg
9705b261ecSmrg
9805b261ecSmrgextern Bool noTestExtensions;
9905b261ecSmrg
10005b261ecSmrg#ifdef COMPOSITE
10105b261ecSmrgextern Bool noCompositeExtension;
10205b261ecSmrg#endif
10305b261ecSmrg#ifdef DBE
10405b261ecSmrgextern Bool noDbeExtension;
10505b261ecSmrg#endif
10605b261ecSmrg#ifdef DPMSExtension
10705b261ecSmrgextern Bool noDPMSExtension;
10805b261ecSmrg#endif
10905b261ecSmrg#ifdef GLXEXT
11005b261ecSmrgextern Bool noGlxExtension;
11105b261ecSmrg#endif
11205b261ecSmrg#ifdef SCREENSAVER
11305b261ecSmrgextern Bool noScreenSaverExtension;
11405b261ecSmrg#endif
11505b261ecSmrg#ifdef MITSHM
11605b261ecSmrgextern Bool noMITShmExtension;
11705b261ecSmrg#endif
11805b261ecSmrg#ifdef RANDR
11905b261ecSmrgextern Bool noRRExtension;
12005b261ecSmrg#endif
12105b261ecSmrgextern Bool noRenderExtension;
12205b261ecSmrg#ifdef XCSECURITY
12305b261ecSmrgextern Bool noSecurityExtension;
12405b261ecSmrg#endif
12505b261ecSmrg#ifdef RES
12605b261ecSmrgextern Bool noResExtension;
12705b261ecSmrg#endif
12805b261ecSmrg#ifdef XF86BIGFONT
12905b261ecSmrgextern Bool noXFree86BigfontExtension;
13005b261ecSmrg#endif
13105b261ecSmrg#ifdef XFreeXDGA
13205b261ecSmrgextern Bool noXFree86DGAExtension;
13305b261ecSmrg#endif
13405b261ecSmrg#ifdef XF86DRI
13505b261ecSmrgextern Bool noXFree86DRIExtension;
13605b261ecSmrg#endif
13705b261ecSmrg#ifdef XF86VIDMODE
13805b261ecSmrgextern Bool noXFree86VidModeExtension;
13905b261ecSmrg#endif
14005b261ecSmrg#ifdef XFIXES
14105b261ecSmrgextern Bool noXFixesExtension;
14205b261ecSmrg#endif
14305b261ecSmrg#ifdef PANORAMIX
14405b261ecSmrgextern Bool noPanoramiXExtension;
14505b261ecSmrg#endif
1464642e01fSmrg#ifdef INXQUARTZ
1474642e01fSmrgextern Bool noPseudoramiXExtension;
14805b261ecSmrg#endif
1494642e01fSmrg#ifdef XSELINUX
1504642e01fSmrgextern Bool noSELinuxExtension;
15105b261ecSmrg#endif
15205b261ecSmrg#ifdef XV
15305b261ecSmrgextern Bool noXvExtension;
15405b261ecSmrg#endif
1554642e01fSmrgextern Bool noGEExtension;
15605b261ecSmrg
15705b261ecSmrg#ifndef XFree86LOADER
15805b261ecSmrg#define INITARGS void
15905b261ecSmrgtypedef void (*InitExtension)(INITARGS);
16005b261ecSmrg#else /* XFree86Loader */
16105b261ecSmrg#include "loaderProcs.h"
16205b261ecSmrg#endif
16305b261ecSmrg
16405b261ecSmrg#ifdef MITSHM
1654202a189Smrg#include <X11/extensions/shm.h>
16605b261ecSmrg#endif
16705b261ecSmrg#ifdef XTEST
168684baedfSmrg#include <X11/extensions/xtestconst.h>
16905b261ecSmrg#endif
17005b261ecSmrg#include <X11/extensions/XKB.h>
17105b261ecSmrg#ifdef XCSECURITY
17205b261ecSmrg#include "securitysrv.h"
1734202a189Smrg#include <X11/extensions/secur.h>
17405b261ecSmrg#endif
1754642e01fSmrg#ifdef XSELINUX
1764642e01fSmrg#include "xselinux.h"
1774642e01fSmrg#endif
17805b261ecSmrg#ifdef PANORAMIX
17905b261ecSmrg#include <X11/extensions/panoramiXproto.h>
18005b261ecSmrg#endif
18105b261ecSmrg#ifdef XF86BIGFONT
1824202a189Smrg#include <X11/extensions/xf86bigfproto.h>
18305b261ecSmrg#endif
18405b261ecSmrg#ifdef RES
18505b261ecSmrg#include <X11/extensions/XResproto.h>
18605b261ecSmrg#endif
18705b261ecSmrg
18805b261ecSmrg/* FIXME: this whole block of externs should be from the appropriate headers */
18905b261ecSmrg#ifdef MITSHM
19005b261ecSmrgextern void ShmExtensionInit(INITARGS);
19105b261ecSmrg#endif
19205b261ecSmrg#ifdef PANORAMIX
19305b261ecSmrgextern void PanoramiXExtensionInit(INITARGS);
19405b261ecSmrg#endif
1954642e01fSmrg#ifdef INXQUARTZ
1964642e01fSmrgextern void PseudoramiXExtensionInit(INITARGS);
19705b261ecSmrg#endif
1984642e01fSmrgextern void XInputExtensionInit(INITARGS);
19905b261ecSmrg#ifdef XTEST
20005b261ecSmrgextern void XTestExtensionInit(INITARGS);
20105b261ecSmrg#endif
20205b261ecSmrgextern void BigReqExtensionInit(INITARGS);
20305b261ecSmrg#ifdef SCREENSAVER
20405b261ecSmrgextern void ScreenSaverExtensionInit (INITARGS);
20505b261ecSmrg#endif
20605b261ecSmrg#ifdef XV
20705b261ecSmrgextern void XvExtensionInit(INITARGS);
20805b261ecSmrgextern void XvMCExtensionInit(INITARGS);
20905b261ecSmrg#endif
21005b261ecSmrgextern void SyncExtensionInit(INITARGS);
21105b261ecSmrgextern void XkbExtensionInit(INITARGS);
21205b261ecSmrgextern void XCMiscExtensionInit(INITARGS);
21305b261ecSmrg#ifdef XRECORD
21405b261ecSmrgextern void RecordExtensionInit(INITARGS);
21505b261ecSmrg#endif
21605b261ecSmrg#ifdef DBE
21705b261ecSmrgextern void DbeExtensionInit(INITARGS);
21805b261ecSmrg#endif
21905b261ecSmrg#ifdef XCSECURITY
22005b261ecSmrgextern void SecurityExtensionInit(INITARGS);
22105b261ecSmrg#endif
2224642e01fSmrg#ifdef XSELINUX
2234642e01fSmrgextern void SELinuxExtensionInit(INITARGS);
22405b261ecSmrg#endif
22505b261ecSmrg#ifdef XF86BIGFONT
22605b261ecSmrgextern void XFree86BigfontExtensionInit(INITARGS);
22705b261ecSmrg#endif
22805b261ecSmrg#ifdef XF86VIDMODE
22905b261ecSmrgextern void XFree86VidModeExtensionInit(INITARGS);
23005b261ecSmrg#endif
23105b261ecSmrg#ifdef XFreeXDGA
23205b261ecSmrgextern void XFree86DGAExtensionInit(INITARGS);
23305b261ecSmrg#endif
23405b261ecSmrg#ifdef GLXEXT
23505b261ecSmrgtypedef struct __GLXprovider __GLXprovider;
2364642e01fSmrgextern __GLXprovider __glXDRISWRastProvider;
23705b261ecSmrgextern void GlxPushProvider(__GLXprovider *impl);
23805b261ecSmrgextern void GlxExtensionInit(INITARGS);
2394642e01fSmrg#endif
24005b261ecSmrg#ifdef XF86DRI
24105b261ecSmrgextern void XFree86DRIExtensionInit(INITARGS);
24205b261ecSmrg#endif
24305b261ecSmrg#ifdef DPMSExtension
24405b261ecSmrgextern void DPMSExtensionInit(INITARGS);
24505b261ecSmrg#endif
24605b261ecSmrgextern void RenderExtensionInit(INITARGS);
24705b261ecSmrg#ifdef RANDR
24805b261ecSmrgextern void RRExtensionInit(INITARGS);
24905b261ecSmrg#endif
25005b261ecSmrg#ifdef RES
25105b261ecSmrgextern void ResExtensionInit(INITARGS);
25205b261ecSmrg#endif
25305b261ecSmrg#ifdef DMXEXT
25405b261ecSmrgextern void DMXExtensionInit(INITARGS);
25505b261ecSmrg#endif
25605b261ecSmrg#ifdef XFIXES
25705b261ecSmrgextern void XFixesExtensionInit(INITARGS);
25805b261ecSmrg#endif
25905b261ecSmrg#ifdef DAMAGE
26005b261ecSmrgextern void DamageExtensionInit(INITARGS);
26105b261ecSmrg#endif
26205b261ecSmrg#ifdef COMPOSITE
26305b261ecSmrgextern void CompositeExtensionInit(INITARGS);
26405b261ecSmrg#endif
2654642e01fSmrgextern void GEExtensionInit(INITARGS);
26605b261ecSmrg
26705b261ecSmrg/* The following is only a small first step towards run-time
26805b261ecSmrg * configurable extensions.
26905b261ecSmrg */
27005b261ecSmrgtypedef struct {
27105b261ecSmrg    char *name;
27205b261ecSmrg    Bool *disablePtr;
27305b261ecSmrg} ExtensionToggle;
27405b261ecSmrg
27505b261ecSmrgstatic ExtensionToggle ExtensionToggleList[] =
27605b261ecSmrg{
27705b261ecSmrg    /* sort order is extension name string as shown in xdpyinfo */
2784642e01fSmrg    { "Generic Events", &noGEExtension },
27905b261ecSmrg#ifdef COMPOSITE
28005b261ecSmrg    { "Composite", &noCompositeExtension },
28105b261ecSmrg#endif
28205b261ecSmrg#ifdef DAMAGE
28305b261ecSmrg    { "DAMAGE", &noDamageExtension },
28405b261ecSmrg#endif
28505b261ecSmrg#ifdef DBE
28605b261ecSmrg    { "DOUBLE-BUFFER", &noDbeExtension },
28705b261ecSmrg#endif
28805b261ecSmrg#ifdef DPMSExtension
28905b261ecSmrg    { "DPMS", &noDPMSExtension },
29005b261ecSmrg#endif
29105b261ecSmrg#ifdef GLXEXT
29205b261ecSmrg    { "GLX", &noGlxExtension },
29305b261ecSmrg#endif
29405b261ecSmrg#ifdef SCREENSAVER
29505b261ecSmrg    { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
29605b261ecSmrg#endif
29705b261ecSmrg#ifdef MITSHM
29805b261ecSmrg    { SHMNAME, &noMITShmExtension },
29905b261ecSmrg#endif
30005b261ecSmrg#ifdef RANDR
30105b261ecSmrg    { "RANDR", &noRRExtension },
30205b261ecSmrg#endif
30305b261ecSmrg    { "RENDER", &noRenderExtension },
30405b261ecSmrg#ifdef XCSECURITY
30505b261ecSmrg    { "SECURITY", &noSecurityExtension },
30605b261ecSmrg#endif
30705b261ecSmrg#ifdef RES
30805b261ecSmrg    { "X-Resource", &noResExtension },
30905b261ecSmrg#endif
31005b261ecSmrg#ifdef XF86BIGFONT
31105b261ecSmrg    { "XFree86-Bigfont", &noXFree86BigfontExtension },
31205b261ecSmrg#endif
31305b261ecSmrg#ifdef XFreeXDGA
31405b261ecSmrg    { "XFree86-DGA", &noXFree86DGAExtension },
31505b261ecSmrg#endif
31605b261ecSmrg#ifdef XF86DRI
31705b261ecSmrg    { "XFree86-DRI", &noXFree86DRIExtension },
31805b261ecSmrg#endif
31905b261ecSmrg#ifdef XF86VIDMODE
32005b261ecSmrg    { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
32105b261ecSmrg#endif
32205b261ecSmrg#ifdef XFIXES
32305b261ecSmrg    { "XFIXES", &noXFixesExtension },
32405b261ecSmrg#endif
32505b261ecSmrg#ifdef PANORAMIX
32605b261ecSmrg    { "XINERAMA", &noPanoramiXExtension },
32705b261ecSmrg#endif
3284642e01fSmrg    { "XInputExtension", NULL },
3294202a189Smrg    { "XKEYBOARD", NULL },
3304642e01fSmrg#ifdef XSELINUX
3314642e01fSmrg    { "SELinux", &noSELinuxExtension },
33205b261ecSmrg#endif
33305b261ecSmrg    { "XTEST", &noTestExtensions },
33405b261ecSmrg#ifdef XV
33505b261ecSmrg    { "XVideo", &noXvExtension },
33605b261ecSmrg#endif
33705b261ecSmrg    { NULL, NULL }
33805b261ecSmrg};
33905b261ecSmrg
34005b261ecSmrgBool EnableDisableExtension(char *name, Bool enable)
34105b261ecSmrg{
34205b261ecSmrg    ExtensionToggle *ext = &ExtensionToggleList[0];
34305b261ecSmrg
34405b261ecSmrg    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
34505b261ecSmrg	if (strcmp(name, ext->name) == 0) {
3464202a189Smrg	    if (ext->disablePtr != NULL) {
3474202a189Smrg		*ext->disablePtr = !enable;
3484202a189Smrg		return TRUE;
3494202a189Smrg	    } else {
3504202a189Smrg		/* Extension is always on, impossible to disable */
3514202a189Smrg		return enable; /* okay if they wanted to enable,
3524202a189Smrg				  fail if they tried to disable */
3534202a189Smrg	    }
35405b261ecSmrg	}
35505b261ecSmrg    }
35605b261ecSmrg
35705b261ecSmrg    return FALSE;
35805b261ecSmrg}
35905b261ecSmrg
36005b261ecSmrgvoid EnableDisableExtensionError(char *name, Bool enable)
36105b261ecSmrg{
36205b261ecSmrg    ExtensionToggle *ext = &ExtensionToggleList[0];
3634202a189Smrg    Bool found = FALSE;
36405b261ecSmrg
3654202a189Smrg    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
3664202a189Smrg	if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
3674202a189Smrg	    ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
3684202a189Smrg	    found = TRUE;
3694202a189Smrg	    break;
3704202a189Smrg	}
3714202a189Smrg    }
3724202a189Smrg    if (found == FALSE)
3734202a189Smrg	ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
3744642e01fSmrg    ErrorF("[mi] Only the following extensions can be run-time %s:\n",
37505b261ecSmrg	   enable ? "enabled" : "disabled");
3764202a189Smrg    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
3774202a189Smrg	if (ext->disablePtr != NULL) {
3784202a189Smrg	    ErrorF("[mi]    %s\n", ext->name);
3794202a189Smrg	}
3804202a189Smrg    }
38105b261ecSmrg}
38205b261ecSmrg
38305b261ecSmrg#ifndef XFree86LOADER
38405b261ecSmrg
38505b261ecSmrg/*ARGSUSED*/
38605b261ecSmrgvoid
3874642e01fSmrgInitExtensions(int argc, char *argv[])
38805b261ecSmrg{
3894642e01fSmrg    if (!noGEExtension) GEExtensionInit();
3904642e01fSmrg
39105b261ecSmrg#ifdef PANORAMIX
3924642e01fSmrg# if !defined(NO_PANORAMIX)
39305b261ecSmrg  if (!noPanoramiXExtension) PanoramiXExtensionInit();
39405b261ecSmrg# endif
39505b261ecSmrg#endif
3964642e01fSmrg#ifdef INXQUARTZ
3974642e01fSmrg    if(!noPseudoramiXExtension) PseudoramiXExtensionInit();
39805b261ecSmrg#endif
3994642e01fSmrg    ShapeExtensionInit();
40005b261ecSmrg#ifdef MITSHM
40105b261ecSmrg    if (!noMITShmExtension) ShmExtensionInit();
40205b261ecSmrg#endif
4034642e01fSmrg    XInputExtensionInit();
40405b261ecSmrg#ifdef XTEST
40505b261ecSmrg    if (!noTestExtensions) XTestExtensionInit();
40605b261ecSmrg#endif
4074642e01fSmrg    BigReqExtensionInit();
4084642e01fSmrg#if defined(SCREENSAVER)
40905b261ecSmrg    if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
41005b261ecSmrg#endif
41105b261ecSmrg#ifdef XV
41205b261ecSmrg    if (!noXvExtension) {
41305b261ecSmrg      XvExtensionInit();
41405b261ecSmrg      XvMCExtensionInit();
41505b261ecSmrg    }
41605b261ecSmrg#endif
4174642e01fSmrg    SyncExtensionInit();
4184202a189Smrg    XkbExtensionInit();
4194642e01fSmrg    XCMiscExtensionInit();
42005b261ecSmrg#ifdef XRECORD
42105b261ecSmrg    if (!noTestExtensions) RecordExtensionInit();
42205b261ecSmrg#endif
42305b261ecSmrg#ifdef DBE
42405b261ecSmrg    if (!noDbeExtension) DbeExtensionInit();
42505b261ecSmrg#endif
42605b261ecSmrg#ifdef XCSECURITY
42705b261ecSmrg    if (!noSecurityExtension) SecurityExtensionInit();
42805b261ecSmrg#endif
4294642e01fSmrg#ifdef XSELINUX
4304642e01fSmrg    if (!noSELinuxExtension) SELinuxExtensionInit();
43105b261ecSmrg#endif
43205b261ecSmrg#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
43305b261ecSmrg    if (!noDPMSExtension) DPMSExtensionInit();
43405b261ecSmrg#endif
43505b261ecSmrg#ifdef XF86BIGFONT
43605b261ecSmrg    if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
43705b261ecSmrg#endif
4384642e01fSmrg#if !defined(NO_HW_ONLY_EXTS)
43905b261ecSmrg#if defined(XF86VIDMODE)
44005b261ecSmrg    if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit();
44105b261ecSmrg#endif
44205b261ecSmrg#if defined(XFreeXDGA)
44305b261ecSmrg    if (!noXFree86DGAExtension) XFree86DGAExtensionInit();
44405b261ecSmrg#endif
44505b261ecSmrg#ifdef XF86DRI
44605b261ecSmrg    if (!noXFree86DRIExtension) XFree86DRIExtensionInit();
44705b261ecSmrg#endif
44805b261ecSmrg#endif
44905b261ecSmrg#ifdef XFIXES
45005b261ecSmrg    /* must be before Render to layer DisplayCursor correctly */
45105b261ecSmrg    if (!noXFixesExtension) XFixesExtensionInit();
45205b261ecSmrg#endif
45305b261ecSmrg    if (!noRenderExtension) RenderExtensionInit();
45405b261ecSmrg#ifdef RANDR
45505b261ecSmrg    if (!noRRExtension) RRExtensionInit();
45605b261ecSmrg#endif
45705b261ecSmrg#ifdef RES
45805b261ecSmrg    if (!noResExtension) ResExtensionInit();
45905b261ecSmrg#endif
46005b261ecSmrg#ifdef DMXEXT
46105b261ecSmrg    DMXExtensionInit(); /* server-specific extension, cannot be disabled */
46205b261ecSmrg#endif
46305b261ecSmrg#ifdef COMPOSITE
46405b261ecSmrg    if (!noCompositeExtension) CompositeExtensionInit();
46505b261ecSmrg#endif
46605b261ecSmrg#ifdef DAMAGE
46705b261ecSmrg    if (!noDamageExtension) DamageExtensionInit();
46805b261ecSmrg#endif
46905b261ecSmrg
47005b261ecSmrg#ifdef GLXEXT
4714642e01fSmrg    if (serverGeneration == 1)
4724642e01fSmrg	GlxPushProvider(&__glXDRISWRastProvider);
4734642e01fSmrg    if (!noGlxExtension) GlxExtensionInit();
47405b261ecSmrg#endif
47505b261ecSmrg}
47605b261ecSmrg
47705b261ecSmrg#else /* XFree86LOADER */
47805b261ecSmrg/* List of built-in (statically linked) extensions */
47905b261ecSmrgstatic ExtensionModule staticExtensions[] = {
4804642e01fSmrg    { GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL},
4814642e01fSmrg    { ShapeExtensionInit, "SHAPE", NULL, NULL, NULL },
48205b261ecSmrg#ifdef MITSHM
48305b261ecSmrg    { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
48405b261ecSmrg#endif
4854642e01fSmrg    { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
48605b261ecSmrg#ifdef XTEST
48705b261ecSmrg    { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
48805b261ecSmrg#endif
4894642e01fSmrg    { BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL },
4904642e01fSmrg    { SyncExtensionInit, "SYNC", NULL, NULL, NULL },
4914202a189Smrg    { XkbExtensionInit, XkbName, NULL, NULL, NULL },
4924642e01fSmrg    { XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL },
49305b261ecSmrg#ifdef XCSECURITY
4944642e01fSmrg    { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
49505b261ecSmrg#endif
49605b261ecSmrg#ifdef PANORAMIX
49705b261ecSmrg    { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
49805b261ecSmrg#endif
49905b261ecSmrg#ifdef XFIXES
50005b261ecSmrg    /* must be before Render to layer DisplayCursor correctly */
50105b261ecSmrg    { XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL },
50205b261ecSmrg#endif
50305b261ecSmrg#ifdef XF86BIGFONT
50405b261ecSmrg    { XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, NULL, NULL },
50505b261ecSmrg#endif
50605b261ecSmrg    { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
50705b261ecSmrg#ifdef RANDR
50805b261ecSmrg    { RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
50905b261ecSmrg#endif
51005b261ecSmrg#ifdef COMPOSITE
51105b261ecSmrg    { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL },
51205b261ecSmrg#endif
51305b261ecSmrg#ifdef DAMAGE
51405b261ecSmrg    { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
51505b261ecSmrg#endif
51605b261ecSmrg    { NULL, NULL, NULL, NULL, NULL }
51705b261ecSmrg};
51805b261ecSmrg
51905b261ecSmrg/*ARGSUSED*/
52005b261ecSmrgvoid
5214642e01fSmrgInitExtensions(int argc, char *argv[])
52205b261ecSmrg{
52305b261ecSmrg    int i;
52405b261ecSmrg    ExtensionModule *ext;
52505b261ecSmrg    static Bool listInitialised = FALSE;
52605b261ecSmrg
52705b261ecSmrg    if (!listInitialised) {
52805b261ecSmrg	/* Add built-in extensions to the list. */
52905b261ecSmrg	for (i = 0; staticExtensions[i].name; i++)
53005b261ecSmrg	    LoadExtension(&staticExtensions[i], TRUE);
53105b261ecSmrg
53205b261ecSmrg	/* Sort the extensions according the init dependencies. */
53305b261ecSmrg	LoaderSortExtensions();
53405b261ecSmrg	listInitialised = TRUE;
53505b261ecSmrg    }
53605b261ecSmrg
53705b261ecSmrg    for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
53805b261ecSmrg	ext = &ExtensionModuleList[i];
53905b261ecSmrg	if (ext->initFunc != NULL &&
5404202a189Smrg	    (ext->disablePtr == NULL || !*ext->disablePtr)) {
54105b261ecSmrg	    (ext->initFunc)();
54205b261ecSmrg	}
54305b261ecSmrg    }
54405b261ecSmrg}
54505b261ecSmrg
54605b261ecSmrg#endif /* XFree86LOADER */
547