miinitext.c revision 684baedf
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>
5805b261ecSmrg#endif
5905b261ecSmrg
6005b261ecSmrg#ifdef HAVE_XNEST_CONFIG_H
6105b261ecSmrg#include <xnest-config.h>
624642e01fSmrg#undef COMPOSITE
6305b261ecSmrg#undef DPMSExtension
6405b261ecSmrg#endif
6505b261ecSmrg
6605b261ecSmrg#ifdef HAVE_KDRIVE_CONFIG_H
6705b261ecSmrg#include <kdrive-config.h>
6805b261ecSmrg/* there must be a better way... */
6905b261ecSmrg#undef XFreeXDGA
7005b261ecSmrg#undef XF86DRI
7105b261ecSmrg#undef XF86VIDMODE
7205b261ecSmrg#endif
7305b261ecSmrg
7405b261ecSmrg#ifdef HAVE_XGL_CONFIG_H
7505b261ecSmrg#include <xgl-config.h>
7605b261ecSmrg#undef XFreeXDGA
7705b261ecSmrg#undef XF86DRI
7805b261ecSmrg#undef XF86VIDMODE
7905b261ecSmrg#endif
8005b261ecSmrg
8105b261ecSmrg#include "misc.h"
8205b261ecSmrg#include "extension.h"
8305b261ecSmrg#include "micmap.h"
8405b261ecSmrg#include "globals.h"
8505b261ecSmrg
8605b261ecSmrg
8705b261ecSmrgextern Bool noTestExtensions;
8805b261ecSmrg
8905b261ecSmrg#ifdef COMPOSITE
9005b261ecSmrgextern Bool noCompositeExtension;
9105b261ecSmrg#endif
9205b261ecSmrg#ifdef DBE
9305b261ecSmrgextern Bool noDbeExtension;
9405b261ecSmrg#endif
9505b261ecSmrg#ifdef DPMSExtension
9605b261ecSmrgextern Bool noDPMSExtension;
9705b261ecSmrg#endif
9805b261ecSmrg#ifdef GLXEXT
9905b261ecSmrgextern Bool noGlxExtension;
10005b261ecSmrg#endif
10105b261ecSmrg#ifdef SCREENSAVER
10205b261ecSmrgextern Bool noScreenSaverExtension;
10305b261ecSmrg#endif
10405b261ecSmrg#ifdef MITSHM
10505b261ecSmrgextern Bool noMITShmExtension;
10605b261ecSmrg#endif
10705b261ecSmrg#ifdef MULTIBUFFER
10805b261ecSmrgextern Bool noMultibufferExtension;
10905b261ecSmrg#endif
11005b261ecSmrg#ifdef RANDR
11105b261ecSmrgextern Bool noRRExtension;
11205b261ecSmrg#endif
11305b261ecSmrg#ifdef RENDER
11405b261ecSmrgextern Bool noRenderExtension;
11505b261ecSmrg#endif
11605b261ecSmrg#ifdef XCSECURITY
11705b261ecSmrgextern Bool noSecurityExtension;
11805b261ecSmrg#endif
11905b261ecSmrg#ifdef RES
12005b261ecSmrgextern Bool noResExtension;
12105b261ecSmrg#endif
12205b261ecSmrg#ifdef XF86BIGFONT
12305b261ecSmrgextern Bool noXFree86BigfontExtension;
12405b261ecSmrg#endif
12505b261ecSmrg#ifdef XFreeXDGA
12605b261ecSmrgextern Bool noXFree86DGAExtension;
12705b261ecSmrg#endif
12805b261ecSmrg#ifdef XF86DRI
12905b261ecSmrgextern Bool noXFree86DRIExtension;
13005b261ecSmrg#endif
13105b261ecSmrg#ifdef XF86VIDMODE
13205b261ecSmrgextern Bool noXFree86VidModeExtension;
13305b261ecSmrg#endif
13405b261ecSmrg#ifdef XFIXES
13505b261ecSmrgextern Bool noXFixesExtension;
13605b261ecSmrg#endif
13705b261ecSmrg#ifdef XKB
13805b261ecSmrg/* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */
13905b261ecSmrgextern Bool noXkbExtension;
14005b261ecSmrg#endif
14105b261ecSmrg#ifdef PANORAMIX
14205b261ecSmrgextern Bool noPanoramiXExtension;
14305b261ecSmrg#endif
1444642e01fSmrg#ifdef INXQUARTZ
1454642e01fSmrgextern Bool noPseudoramiXExtension;
14605b261ecSmrg#endif
1474642e01fSmrg#ifdef XSELINUX
1484642e01fSmrgextern Bool noSELinuxExtension;
14905b261ecSmrg#endif
15005b261ecSmrg#ifdef XV
15105b261ecSmrgextern Bool noXvExtension;
15205b261ecSmrg#endif
1534642e01fSmrgextern Bool noGEExtension;
15405b261ecSmrg
15505b261ecSmrg#ifndef XFree86LOADER
15605b261ecSmrg#define INITARGS void
15705b261ecSmrgtypedef void (*InitExtension)(INITARGS);
15805b261ecSmrg#else /* XFree86Loader */
15905b261ecSmrg#include "loaderProcs.h"
16005b261ecSmrg#endif
16105b261ecSmrg
16205b261ecSmrg#ifdef MITSHM
16305b261ecSmrg#define _XSHM_SERVER_
16405b261ecSmrg#include <X11/extensions/shmstr.h>
165684baedfSmrg#include <X11/extensions/shmproto.h>
16605b261ecSmrg#endif
16705b261ecSmrg#ifdef XTEST
16805b261ecSmrg#define _XTEST_SERVER_
169684baedfSmrg#include <X11/extensions/xtestconst.h>
17005b261ecSmrg#endif
17105b261ecSmrg#ifdef XKB
17205b261ecSmrg#include <X11/extensions/XKB.h>
17305b261ecSmrg#endif
17405b261ecSmrg#ifdef XCSECURITY
17505b261ecSmrg#include "securitysrv.h"
176684baedfSmrg#include <X11/extensions/securproto.h>
17705b261ecSmrg#endif
1784642e01fSmrg#ifdef XSELINUX
1794642e01fSmrg#include "xselinux.h"
1804642e01fSmrg#endif
18105b261ecSmrg#ifdef PANORAMIX
18205b261ecSmrg#include <X11/extensions/panoramiXproto.h>
18305b261ecSmrg#endif
18405b261ecSmrg#ifdef XF86BIGFONT
18505b261ecSmrg#include <X11/extensions/xf86bigfstr.h>
18605b261ecSmrg#endif
18705b261ecSmrg#ifdef RES
18805b261ecSmrg#include <X11/extensions/XResproto.h>
18905b261ecSmrg#endif
19005b261ecSmrg
19105b261ecSmrg/* FIXME: this whole block of externs should be from the appropriate headers */
19205b261ecSmrg#ifdef MITSHM
19305b261ecSmrgextern void ShmExtensionInit(INITARGS);
19405b261ecSmrg#endif
19505b261ecSmrg#ifdef MULTIBUFFER
19605b261ecSmrgextern void MultibufferExtensionInit(INITARGS);
19705b261ecSmrg#endif
19805b261ecSmrg#ifdef PANORAMIX
19905b261ecSmrgextern void PanoramiXExtensionInit(INITARGS);
20005b261ecSmrg#endif
2014642e01fSmrg#ifdef INXQUARTZ
2024642e01fSmrgextern void PseudoramiXExtensionInit(INITARGS);
20305b261ecSmrg#endif
2044642e01fSmrgextern void XInputExtensionInit(INITARGS);
20505b261ecSmrg#ifdef XTEST
20605b261ecSmrgextern void XTestExtensionInit(INITARGS);
20705b261ecSmrg#endif
20805b261ecSmrgextern void BigReqExtensionInit(INITARGS);
20905b261ecSmrg#ifdef SCREENSAVER
21005b261ecSmrgextern void ScreenSaverExtensionInit (INITARGS);
21105b261ecSmrg#endif
21205b261ecSmrg#ifdef XV
21305b261ecSmrgextern void XvExtensionInit(INITARGS);
21405b261ecSmrgextern void XvMCExtensionInit(INITARGS);
21505b261ecSmrg#endif
21605b261ecSmrgextern void SyncExtensionInit(INITARGS);
21705b261ecSmrg#ifdef XKB
21805b261ecSmrgextern void XkbExtensionInit(INITARGS);
21905b261ecSmrg#endif
22005b261ecSmrgextern void XCMiscExtensionInit(INITARGS);
22105b261ecSmrg#ifdef XRECORD
22205b261ecSmrgextern void RecordExtensionInit(INITARGS);
22305b261ecSmrg#endif
22405b261ecSmrg#ifdef DBE
22505b261ecSmrgextern void DbeExtensionInit(INITARGS);
22605b261ecSmrg#endif
22705b261ecSmrg#ifdef XCSECURITY
22805b261ecSmrgextern void SecurityExtensionInit(INITARGS);
22905b261ecSmrg#endif
2304642e01fSmrg#ifdef XSELINUX
2314642e01fSmrgextern void SELinuxExtensionInit(INITARGS);
23205b261ecSmrg#endif
23305b261ecSmrg#ifdef XF86BIGFONT
23405b261ecSmrgextern void XFree86BigfontExtensionInit(INITARGS);
23505b261ecSmrg#endif
23605b261ecSmrg#ifdef XF86VIDMODE
23705b261ecSmrgextern void XFree86VidModeExtensionInit(INITARGS);
23805b261ecSmrg#endif
23905b261ecSmrg#ifdef XFreeXDGA
24005b261ecSmrgextern void XFree86DGAExtensionInit(INITARGS);
24105b261ecSmrg#endif
24205b261ecSmrg#ifdef GLXEXT
24305b261ecSmrgtypedef struct __GLXprovider __GLXprovider;
2444642e01fSmrgextern __GLXprovider __glXDRISWRastProvider;
24505b261ecSmrgextern void GlxPushProvider(__GLXprovider *impl);
24605b261ecSmrgextern void GlxExtensionInit(INITARGS);
2474642e01fSmrg#endif
24805b261ecSmrg#ifdef XF86DRI
24905b261ecSmrgextern void XFree86DRIExtensionInit(INITARGS);
25005b261ecSmrg#endif
25105b261ecSmrg#ifdef DPMSExtension
25205b261ecSmrgextern void DPMSExtensionInit(INITARGS);
25305b261ecSmrg#endif
25405b261ecSmrg#ifdef RENDER
25505b261ecSmrgextern void RenderExtensionInit(INITARGS);
25605b261ecSmrg#endif
25705b261ecSmrg#ifdef RANDR
25805b261ecSmrgextern void RRExtensionInit(INITARGS);
25905b261ecSmrg#endif
26005b261ecSmrg#ifdef RES
26105b261ecSmrgextern void ResExtensionInit(INITARGS);
26205b261ecSmrg#endif
26305b261ecSmrg#ifdef DMXEXT
26405b261ecSmrgextern void DMXExtensionInit(INITARGS);
26505b261ecSmrg#endif
26605b261ecSmrg#ifdef XFIXES
26705b261ecSmrgextern void XFixesExtensionInit(INITARGS);
26805b261ecSmrg#endif
26905b261ecSmrg#ifdef DAMAGE
27005b261ecSmrgextern void DamageExtensionInit(INITARGS);
27105b261ecSmrg#endif
27205b261ecSmrg#ifdef COMPOSITE
27305b261ecSmrgextern void CompositeExtensionInit(INITARGS);
27405b261ecSmrg#endif
2754642e01fSmrgextern void GEExtensionInit(INITARGS);
27605b261ecSmrg
27705b261ecSmrg/* The following is only a small first step towards run-time
27805b261ecSmrg * configurable extensions.
27905b261ecSmrg */
28005b261ecSmrgtypedef struct {
28105b261ecSmrg    char *name;
28205b261ecSmrg    Bool *disablePtr;
28305b261ecSmrg} ExtensionToggle;
28405b261ecSmrg
28505b261ecSmrgstatic ExtensionToggle ExtensionToggleList[] =
28605b261ecSmrg{
28705b261ecSmrg    /* sort order is extension name string as shown in xdpyinfo */
2884642e01fSmrg    { "Generic Events", &noGEExtension },
28905b261ecSmrg#ifdef COMPOSITE
29005b261ecSmrg    { "Composite", &noCompositeExtension },
29105b261ecSmrg#endif
29205b261ecSmrg#ifdef DAMAGE
29305b261ecSmrg    { "DAMAGE", &noDamageExtension },
29405b261ecSmrg#endif
29505b261ecSmrg#ifdef DBE
29605b261ecSmrg    { "DOUBLE-BUFFER", &noDbeExtension },
29705b261ecSmrg#endif
29805b261ecSmrg#ifdef DPMSExtension
29905b261ecSmrg    { "DPMS", &noDPMSExtension },
30005b261ecSmrg#endif
30105b261ecSmrg#ifdef GLXEXT
30205b261ecSmrg    { "GLX", &noGlxExtension },
30305b261ecSmrg#endif
30405b261ecSmrg#ifdef SCREENSAVER
30505b261ecSmrg    { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
30605b261ecSmrg#endif
30705b261ecSmrg#ifdef MITSHM
30805b261ecSmrg    { SHMNAME, &noMITShmExtension },
30905b261ecSmrg#endif
31005b261ecSmrg#ifdef MULTIBUFFER
31105b261ecSmrg    { "Multi-Buffering", &noMultibufferExtension },
31205b261ecSmrg#endif
31305b261ecSmrg#ifdef RANDR
31405b261ecSmrg    { "RANDR", &noRRExtension },
31505b261ecSmrg#endif
31605b261ecSmrg#ifdef RENDER
31705b261ecSmrg    { "RENDER", &noRenderExtension },
31805b261ecSmrg#endif
31905b261ecSmrg#ifdef XCSECURITY
32005b261ecSmrg    { "SECURITY", &noSecurityExtension },
32105b261ecSmrg#endif
32205b261ecSmrg#ifdef RES
32305b261ecSmrg    { "X-Resource", &noResExtension },
32405b261ecSmrg#endif
32505b261ecSmrg#ifdef XF86BIGFONT
32605b261ecSmrg    { "XFree86-Bigfont", &noXFree86BigfontExtension },
32705b261ecSmrg#endif
32805b261ecSmrg#ifdef XFreeXDGA
32905b261ecSmrg    { "XFree86-DGA", &noXFree86DGAExtension },
33005b261ecSmrg#endif
33105b261ecSmrg#ifdef XF86DRI
33205b261ecSmrg    { "XFree86-DRI", &noXFree86DRIExtension },
33305b261ecSmrg#endif
33405b261ecSmrg#ifdef XF86VIDMODE
33505b261ecSmrg    { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
33605b261ecSmrg#endif
33705b261ecSmrg#ifdef XFIXES
33805b261ecSmrg    { "XFIXES", &noXFixesExtension },
33905b261ecSmrg#endif
34005b261ecSmrg#ifdef PANORAMIX
34105b261ecSmrg    { "XINERAMA", &noPanoramiXExtension },
34205b261ecSmrg#endif
3434642e01fSmrg    { "XInputExtension", NULL },
34405b261ecSmrg#ifdef XKB
34505b261ecSmrg    { "XKEYBOARD", &noXkbExtension },
3464642e01fSmrg#endif
3474642e01fSmrg#ifdef XSELINUX
3484642e01fSmrg    { "SELinux", &noSELinuxExtension },
34905b261ecSmrg#endif
35005b261ecSmrg    { "XTEST", &noTestExtensions },
35105b261ecSmrg#ifdef XV
35205b261ecSmrg    { "XVideo", &noXvExtension },
35305b261ecSmrg#endif
35405b261ecSmrg    { NULL, NULL }
35505b261ecSmrg};
35605b261ecSmrg
35705b261ecSmrgBool EnableDisableExtension(char *name, Bool enable)
35805b261ecSmrg{
35905b261ecSmrg    ExtensionToggle *ext = &ExtensionToggleList[0];
36005b261ecSmrg
36105b261ecSmrg    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
36205b261ecSmrg	if (strcmp(name, ext->name) == 0) {
36305b261ecSmrg	    *ext->disablePtr = !enable;
36405b261ecSmrg	    return TRUE;
36505b261ecSmrg	}
36605b261ecSmrg    }
36705b261ecSmrg
36805b261ecSmrg    return FALSE;
36905b261ecSmrg}
37005b261ecSmrg
37105b261ecSmrgvoid EnableDisableExtensionError(char *name, Bool enable)
37205b261ecSmrg{
37305b261ecSmrg    ExtensionToggle *ext = &ExtensionToggleList[0];
37405b261ecSmrg
3754642e01fSmrg    ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
3764642e01fSmrg    ErrorF("[mi] Only the following extensions can be run-time %s:\n",
37705b261ecSmrg	   enable ? "enabled" : "disabled");
37805b261ecSmrg    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++)
3794642e01fSmrg	ErrorF("[mi]    %s\n", ext->name);
38005b261ecSmrg}
38105b261ecSmrg
38205b261ecSmrg#ifndef XFree86LOADER
38305b261ecSmrg
38405b261ecSmrg/*ARGSUSED*/
38505b261ecSmrgvoid
3864642e01fSmrgInitExtensions(int argc, char *argv[])
38705b261ecSmrg{
3884642e01fSmrg    if (!noGEExtension) GEExtensionInit();
3894642e01fSmrg
39005b261ecSmrg#ifdef PANORAMIX
3914642e01fSmrg# if !defined(NO_PANORAMIX)
39205b261ecSmrg  if (!noPanoramiXExtension) PanoramiXExtensionInit();
39305b261ecSmrg# endif
39405b261ecSmrg#endif
3954642e01fSmrg#ifdef INXQUARTZ
3964642e01fSmrg    if(!noPseudoramiXExtension) PseudoramiXExtensionInit();
39705b261ecSmrg#endif
3984642e01fSmrg    ShapeExtensionInit();
39905b261ecSmrg#ifdef MITSHM
40005b261ecSmrg    if (!noMITShmExtension) ShmExtensionInit();
40105b261ecSmrg#endif
40205b261ecSmrg#ifdef MULTIBUFFER
40305b261ecSmrg    if (!noMultibufferExtension) MultibufferExtensionInit();
40405b261ecSmrg#endif
4054642e01fSmrg    XInputExtensionInit();
40605b261ecSmrg#ifdef XTEST
40705b261ecSmrg    if (!noTestExtensions) XTestExtensionInit();
40805b261ecSmrg#endif
4094642e01fSmrg    BigReqExtensionInit();
4104642e01fSmrg#if defined(SCREENSAVER)
41105b261ecSmrg    if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
41205b261ecSmrg#endif
41305b261ecSmrg#ifdef XV
41405b261ecSmrg    if (!noXvExtension) {
41505b261ecSmrg      XvExtensionInit();
41605b261ecSmrg      XvMCExtensionInit();
41705b261ecSmrg    }
41805b261ecSmrg#endif
4194642e01fSmrg    SyncExtensionInit();
4204642e01fSmrg#if defined(XKB)
42105b261ecSmrg    if (!noXkbExtension) XkbExtensionInit();
42205b261ecSmrg#endif
4234642e01fSmrg    XCMiscExtensionInit();
42405b261ecSmrg#ifdef XRECORD
42505b261ecSmrg    if (!noTestExtensions) RecordExtensionInit();
42605b261ecSmrg#endif
42705b261ecSmrg#ifdef DBE
42805b261ecSmrg    if (!noDbeExtension) DbeExtensionInit();
42905b261ecSmrg#endif
43005b261ecSmrg#ifdef XCSECURITY
43105b261ecSmrg    if (!noSecurityExtension) SecurityExtensionInit();
43205b261ecSmrg#endif
4334642e01fSmrg#ifdef XSELINUX
4344642e01fSmrg    if (!noSELinuxExtension) SELinuxExtensionInit();
43505b261ecSmrg#endif
43605b261ecSmrg#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
43705b261ecSmrg    if (!noDPMSExtension) DPMSExtensionInit();
43805b261ecSmrg#endif
43905b261ecSmrg#ifdef XF86BIGFONT
44005b261ecSmrg    if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
44105b261ecSmrg#endif
4424642e01fSmrg#if !defined(NO_HW_ONLY_EXTS)
44305b261ecSmrg#if defined(XF86VIDMODE)
44405b261ecSmrg    if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit();
44505b261ecSmrg#endif
44605b261ecSmrg#if defined(XFreeXDGA)
44705b261ecSmrg    if (!noXFree86DGAExtension) XFree86DGAExtensionInit();
44805b261ecSmrg#endif
44905b261ecSmrg#ifdef XF86DRI
45005b261ecSmrg    if (!noXFree86DRIExtension) XFree86DRIExtensionInit();
45105b261ecSmrg#endif
45205b261ecSmrg#endif
45305b261ecSmrg#ifdef XFIXES
45405b261ecSmrg    /* must be before Render to layer DisplayCursor correctly */
45505b261ecSmrg    if (!noXFixesExtension) XFixesExtensionInit();
45605b261ecSmrg#endif
45705b261ecSmrg#ifdef RENDER
45805b261ecSmrg    if (!noRenderExtension) RenderExtensionInit();
45905b261ecSmrg#endif
46005b261ecSmrg#ifdef RANDR
46105b261ecSmrg    if (!noRRExtension) RRExtensionInit();
46205b261ecSmrg#endif
46305b261ecSmrg#ifdef RES
46405b261ecSmrg    if (!noResExtension) ResExtensionInit();
46505b261ecSmrg#endif
46605b261ecSmrg#ifdef DMXEXT
46705b261ecSmrg    DMXExtensionInit(); /* server-specific extension, cannot be disabled */
46805b261ecSmrg#endif
46905b261ecSmrg#ifdef COMPOSITE
47005b261ecSmrg    if (!noCompositeExtension) CompositeExtensionInit();
47105b261ecSmrg#endif
47205b261ecSmrg#ifdef DAMAGE
47305b261ecSmrg    if (!noDamageExtension) DamageExtensionInit();
47405b261ecSmrg#endif
47505b261ecSmrg
47605b261ecSmrg#ifdef GLXEXT
4774642e01fSmrg    if (serverGeneration == 1)
4784642e01fSmrg	GlxPushProvider(&__glXDRISWRastProvider);
4794642e01fSmrg    if (!noGlxExtension) GlxExtensionInit();
48005b261ecSmrg#endif
48105b261ecSmrg}
48205b261ecSmrg
48305b261ecSmrg#else /* XFree86LOADER */
48405b261ecSmrg/* List of built-in (statically linked) extensions */
48505b261ecSmrgstatic ExtensionModule staticExtensions[] = {
4864642e01fSmrg    { GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL},
4874642e01fSmrg    { ShapeExtensionInit, "SHAPE", NULL, NULL, NULL },
48805b261ecSmrg#ifdef MITSHM
48905b261ecSmrg    { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
49005b261ecSmrg#endif
4914642e01fSmrg    { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
49205b261ecSmrg#ifdef XTEST
49305b261ecSmrg    { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
49405b261ecSmrg#endif
4954642e01fSmrg    { BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL },
4964642e01fSmrg    { SyncExtensionInit, "SYNC", NULL, NULL, NULL },
49705b261ecSmrg#ifdef XKB
49805b261ecSmrg    { XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
49905b261ecSmrg#endif
5004642e01fSmrg    { XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL },
50105b261ecSmrg#ifdef XCSECURITY
5024642e01fSmrg    { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
50305b261ecSmrg#endif
50405b261ecSmrg#ifdef PANORAMIX
50505b261ecSmrg    { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
50605b261ecSmrg#endif
50705b261ecSmrg#ifdef XFIXES
50805b261ecSmrg    /* must be before Render to layer DisplayCursor correctly */
50905b261ecSmrg    { XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL },
51005b261ecSmrg#endif
51105b261ecSmrg#ifdef XF86BIGFONT
51205b261ecSmrg    { XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, NULL, NULL },
51305b261ecSmrg#endif
51405b261ecSmrg#ifdef RENDER
51505b261ecSmrg    { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
51605b261ecSmrg#endif
51705b261ecSmrg#ifdef RANDR
51805b261ecSmrg    { RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
51905b261ecSmrg#endif
52005b261ecSmrg#ifdef COMPOSITE
52105b261ecSmrg    { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL },
52205b261ecSmrg#endif
52305b261ecSmrg#ifdef DAMAGE
52405b261ecSmrg    { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
52505b261ecSmrg#endif
52605b261ecSmrg    { NULL, NULL, NULL, NULL, NULL }
52705b261ecSmrg};
52805b261ecSmrg
52905b261ecSmrg/*ARGSUSED*/
53005b261ecSmrgvoid
5314642e01fSmrgInitExtensions(int argc, char *argv[])
53205b261ecSmrg{
53305b261ecSmrg    int i;
53405b261ecSmrg    ExtensionModule *ext;
53505b261ecSmrg    static Bool listInitialised = FALSE;
53605b261ecSmrg
53705b261ecSmrg    if (!listInitialised) {
53805b261ecSmrg	/* Add built-in extensions to the list. */
53905b261ecSmrg	for (i = 0; staticExtensions[i].name; i++)
54005b261ecSmrg	    LoadExtension(&staticExtensions[i], TRUE);
54105b261ecSmrg
54205b261ecSmrg	/* Sort the extensions according the init dependencies. */
54305b261ecSmrg	LoaderSortExtensions();
54405b261ecSmrg	listInitialised = TRUE;
54505b261ecSmrg    }
54605b261ecSmrg
54705b261ecSmrg    for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
54805b261ecSmrg	ext = &ExtensionModuleList[i];
54905b261ecSmrg	if (ext->initFunc != NULL &&
55005b261ecSmrg	    (ext->disablePtr == NULL ||
55105b261ecSmrg	     (ext->disablePtr != NULL && !*ext->disablePtr))) {
55205b261ecSmrg	    (ext->initFunc)();
55305b261ecSmrg	}
55405b261ecSmrg    }
55505b261ecSmrg}
55605b261ecSmrg
55705b261ecSmrg#endif /* XFree86LOADER */
558