miinitext.c revision 05b261ec
1/***********************************************************
2
3Copyright 1987, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28                        All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifdef HAVE_DIX_CONFIG_H
49#include <dix-config.h>
50#endif
51
52#ifdef HAVE_XORG_CONFIG_H
53#include <xorg-config.h>
54#endif
55
56#ifdef HAVE_DMX_CONFIG_H
57#include <dmx-config.h>
58#endif
59
60#ifdef HAVE_XNEST_CONFIG_H
61#include <xnest-config.h>
62#undef DPMSExtension
63#endif
64
65#ifdef HAVE_KDRIVE_CONFIG_H
66#include <kdrive-config.h>
67/* there must be a better way... */
68#undef XF86MISC
69#undef XFreeXDGA
70#undef XF86DRI
71#undef XF86VIDMODE
72#endif
73
74#ifdef HAVE_XGL_CONFIG_H
75#include <xgl-config.h>
76#undef XF86MISC
77#undef XFreeXDGA
78#undef XF86DRI
79#undef XF86VIDMODE
80#endif
81
82#include "misc.h"
83#include "extension.h"
84#include "micmap.h"
85#include "globals.h"
86
87#if defined(QNX4) /* sleaze for Watcom on QNX4 ... */
88#undef GLXEXT
89#endif
90
91/* Make sure Xprt only announces extensions it supports */
92#ifdef PRINT_ONLY_SERVER
93#undef MITSHM /* this is incompatible to the vector-based Xprint DDX */
94#undef XKB
95#undef PANORAMIX
96#undef RES
97#undef XINPUT
98#undef XV
99#undef SCREENSAVER
100#undef XIDLE
101#undef XRECORD
102#undef XF86VIDMODE
103#undef XF86MISC
104#undef XFreeXDGA
105#undef XF86DRI
106#undef DPMSExtension
107#undef FONTCACHE
108#undef COMPOSITE
109#undef DAMAGE
110#undef XFIXES
111#undef XEVIE
112#else
113#ifndef LOADABLEPRINTDDX
114#undef XPRINT
115#endif /* LOADABLEPRINTDDX */
116#endif /* PRINT_ONLY_SERVER */
117
118
119extern Bool noTestExtensions;
120
121#ifdef BIGREQS
122extern Bool noBigReqExtension;
123#endif
124#ifdef COMPOSITE
125extern Bool noCompositeExtension;
126#endif
127#ifdef DBE
128extern Bool noDbeExtension;
129#endif
130#ifdef DPMSExtension
131extern Bool noDPMSExtension;
132#endif
133#ifdef EVI
134extern Bool noEVIExtension;
135#endif
136#ifdef FONTCACHE
137extern Bool noFontCacheExtension;
138#endif
139#ifdef GLXEXT
140extern Bool noGlxExtension;
141#endif
142#ifdef SCREENSAVER
143extern Bool noScreenSaverExtension;
144#endif
145#ifdef MITSHM
146extern Bool noMITShmExtension;
147#endif
148#ifdef MITMISC
149extern Bool noMITMiscExtension;
150#endif
151#ifdef MULTIBUFFER
152extern Bool noMultibufferExtension;
153#endif
154#ifdef RANDR
155extern Bool noRRExtension;
156#endif
157#ifdef RENDER
158extern Bool noRenderExtension;
159#endif
160#ifdef SHAPE
161extern Bool noShapeExtension;
162#endif
163#ifdef XCSECURITY
164extern Bool noSecurityExtension;
165#endif
166#ifdef XSYNC
167extern Bool noSyncExtension;
168#endif
169#ifdef TOGCUP
170extern Bool noXcupExtension;
171#endif
172#ifdef RES
173extern Bool noResExtension;
174#endif
175#ifdef XAPPGROUP
176extern Bool noXagExtension;
177#endif
178#ifdef XCMISC
179extern Bool noXCMiscExtension;
180#endif
181#ifdef XEVIE
182extern Bool noXevieExtension;
183#endif
184#ifdef XF86BIGFONT
185extern Bool noXFree86BigfontExtension;
186#endif
187#ifdef XFreeXDGA
188extern Bool noXFree86DGAExtension;
189#endif
190#ifdef XF86DRI
191extern Bool noXFree86DRIExtension;
192#endif
193#ifdef XF86MISC
194extern Bool noXFree86MiscExtension;
195#endif
196#ifdef XF86VIDMODE
197extern Bool noXFree86VidModeExtension;
198#endif
199#ifdef XFIXES
200extern Bool noXFixesExtension;
201#endif
202#ifdef XKB
203/* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */
204extern Bool noXkbExtension;
205#endif
206#ifdef PANORAMIX
207extern Bool noPanoramiXExtension;
208#endif
209#ifdef XINPUT
210extern Bool noXInputExtension;
211#endif
212#ifdef XIDLE
213extern Bool noXIdleExtension;
214#endif
215#ifdef XV
216extern Bool noXvExtension;
217#endif
218
219#ifndef XFree86LOADER
220#define INITARGS void
221typedef void (*InitExtension)(INITARGS);
222#else /* XFree86Loader */
223#include "loaderProcs.h"
224#endif
225
226#ifdef MITSHM
227#define _XSHM_SERVER_
228#include <X11/extensions/shmstr.h>
229#endif
230#ifdef XTEST
231#define _XTEST_SERVER_
232#include <X11/extensions/XTest.h>
233#endif
234#ifdef XKB
235#include <X11/extensions/XKB.h>
236#endif
237#ifdef XPRINT
238#include <X11/extensions/Print.h>
239#endif
240#ifdef XAPPGROUP
241#define _XAG_SERVER_
242#include <X11/extensions/Xagstr.h>
243#endif
244#ifdef XACE
245#include "xace.h"
246#endif
247#ifdef XCSECURITY
248#include "securitysrv.h"
249#include <X11/extensions/securstr.h>
250#endif
251#ifdef PANORAMIX
252#include <X11/extensions/panoramiXproto.h>
253#endif
254#ifdef XF86BIGFONT
255#include <X11/extensions/xf86bigfstr.h>
256#endif
257#ifdef RES
258#include <X11/extensions/XResproto.h>
259#endif
260
261/* FIXME: this whole block of externs should be from the appropriate headers */
262#ifdef EVI
263extern void EVIExtensionInit(INITARGS);
264#endif
265#ifdef MITSHM
266extern void ShmExtensionInit(INITARGS);
267#endif
268#ifdef MULTIBUFFER
269extern void MultibufferExtensionInit(INITARGS);
270#endif
271#ifdef PANORAMIX
272extern void PanoramiXExtensionInit(INITARGS);
273#endif
274#ifdef XINPUT
275extern void XInputExtensionInit(INITARGS);
276#endif
277#ifdef XTEST
278extern void XTestExtensionInit(INITARGS);
279#endif
280#ifdef BIGREQS
281extern void BigReqExtensionInit(INITARGS);
282#endif
283#ifdef MITMISC
284extern void MITMiscExtensionInit(INITARGS);
285#endif
286#ifdef XIDLE
287extern void XIdleExtensionInit(INITARGS);
288#endif
289#ifdef XTRAP
290extern void DEC_XTRAPInit(INITARGS);
291#endif
292#ifdef SCREENSAVER
293extern void ScreenSaverExtensionInit (INITARGS);
294#endif
295#ifdef XV
296extern void XvExtensionInit(INITARGS);
297extern void XvMCExtensionInit(INITARGS);
298#endif
299#ifdef XSYNC
300extern void SyncExtensionInit(INITARGS);
301#endif
302#ifdef XKB
303extern void XkbExtensionInit(INITARGS);
304#endif
305#ifdef XCMISC
306extern void XCMiscExtensionInit(INITARGS);
307#endif
308#ifdef XRECORD
309extern void RecordExtensionInit(INITARGS);
310#endif
311#ifdef DBE
312extern void DbeExtensionInit(INITARGS);
313#endif
314#ifdef XAPPGROUP
315extern void XagExtensionInit(INITARGS);
316#endif
317#ifdef XACE
318extern void XaceExtensionInit(INITARGS);
319#endif
320#ifdef XCSECURITY
321extern void SecurityExtensionSetup(INITARGS);
322extern void SecurityExtensionInit(INITARGS);
323#endif
324#ifdef XPRINT
325extern void XpExtensionInit(INITARGS);
326#endif
327#ifdef XF86BIGFONT
328extern void XFree86BigfontExtensionInit(INITARGS);
329#endif
330#ifdef XF86VIDMODE
331extern void XFree86VidModeExtensionInit(INITARGS);
332#endif
333#ifdef XF86MISC
334extern void XFree86MiscExtensionInit(INITARGS);
335#endif
336#ifdef XFreeXDGA
337extern void XFree86DGAExtensionInit(INITARGS);
338#endif
339#ifdef GLXEXT
340typedef struct __GLXprovider __GLXprovider;
341#ifdef INXDARWINAPP
342extern __GLXprovider* __DarwinglXMesaProvider;
343extern void DarwinGlxPushProvider(__GLXprovider *impl);
344extern void DarwinGlxExtensionInit(INITARGS);
345extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *);
346#else
347extern __GLXprovider __glXMesaProvider;
348extern void GlxPushProvider(__GLXprovider *impl);
349extern void GlxExtensionInit(INITARGS);
350extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
351#endif // INXDARWINAPP
352#endif // GLXEXT
353#ifdef XF86DRI
354extern void XFree86DRIExtensionInit(INITARGS);
355#endif
356#ifdef TOGCUP
357extern void XcupExtensionInit(INITARGS);
358#endif
359#ifdef DPMSExtension
360extern void DPMSExtensionInit(INITARGS);
361#endif
362#ifdef FONTCACHE
363extern void FontCacheExtensionInit(INITARGS);
364#endif
365#ifdef RENDER
366extern void RenderExtensionInit(INITARGS);
367#endif
368#ifdef RANDR
369extern void RRExtensionInit(INITARGS);
370#endif
371#ifdef RES
372extern void ResExtensionInit(INITARGS);
373#endif
374#ifdef DMXEXT
375extern void DMXExtensionInit(INITARGS);
376#endif
377#ifdef XEVIE
378extern void XevieExtensionInit(INITARGS);
379#endif
380#ifdef XFIXES
381extern void XFixesExtensionInit(INITARGS);
382#endif
383#ifdef DAMAGE
384extern void DamageExtensionInit(INITARGS);
385#endif
386#ifdef COMPOSITE
387extern void CompositeExtensionInit(INITARGS);
388#endif
389
390/* The following is only a small first step towards run-time
391 * configurable extensions.
392 */
393typedef struct {
394    char *name;
395    Bool *disablePtr;
396} ExtensionToggle;
397
398static ExtensionToggle ExtensionToggleList[] =
399{
400    /* sort order is extension name string as shown in xdpyinfo */
401#ifdef BIGREQS
402    { "BIG-REQUESTS", &noBigReqExtension },
403#endif
404#ifdef COMPOSITE
405    { "Composite", &noCompositeExtension },
406#endif
407#ifdef DAMAGE
408    { "DAMAGE", &noDamageExtension },
409#endif
410#ifdef DBE
411    { "DOUBLE-BUFFER", &noDbeExtension },
412#endif
413#ifdef DPMSExtension
414    { "DPMS", &noDPMSExtension },
415#endif
416#ifdef EVI
417    { "Extended-Visual-Information", &noEVIExtension },
418#endif
419#ifdef FONTCACHE
420    { "FontCache", &noFontCacheExtension },
421#endif
422#ifdef GLXEXT
423    { "GLX", &noGlxExtension },
424#endif
425#ifdef SCREENSAVER
426    { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
427#endif
428#ifdef MITSHM
429    { SHMNAME, &noMITShmExtension },
430#endif
431#ifdef MITMISC
432    { "MIT-SUNDRY-NONSTANDARD", &noMITMiscExtension },
433#endif
434#ifdef MULTIBUFFER
435    { "Multi-Buffering", &noMultibufferExtension },
436#endif
437#ifdef RANDR
438    { "RANDR", &noRRExtension },
439#endif
440#ifdef RENDER
441    { "RENDER", &noRenderExtension },
442#endif
443#ifdef SHAPE
444    { "SHAPE", &noShapeExtension },
445#endif
446#ifdef XCSECURITY
447    { "SECURITY", &noSecurityExtension },
448#endif
449#ifdef XSYNC
450    { "SYNC", &noSyncExtension },
451#endif
452#ifdef TOGCUP
453    { "TOG-CUP", &noXcupExtension },
454#endif
455#ifdef RES
456    { "X-Resource", &noResExtension },
457#endif
458#ifdef XAPPGROUP
459    { "XC-APPGROUP", &noXagExtension },
460#endif
461#ifdef XCMISC
462    { "XC-MISC", &noXCMiscExtension },
463#endif
464#ifdef XEVIE
465    { "XEVIE", &noXevieExtension },
466#endif
467#ifdef XF86BIGFONT
468    { "XFree86-Bigfont", &noXFree86BigfontExtension },
469#endif
470#ifdef XFreeXDGA
471    { "XFree86-DGA", &noXFree86DGAExtension },
472#endif
473#ifdef XF86DRI
474    { "XFree86-DRI", &noXFree86DRIExtension },
475#endif
476#ifdef XF86MISC
477    { "XFree86-Misc", &noXFree86MiscExtension },
478#endif
479#ifdef XF86VIDMODE
480    { "XFree86-VidModeExtension", &noXFree86VidModeExtension },
481#endif
482#ifdef XFIXES
483    { "XFIXES", &noXFixesExtension },
484#endif
485#ifdef PANORAMIX
486    { "XINERAMA", &noPanoramiXExtension },
487#endif
488#ifdef XINPUT
489    { "XInputExtension", &noXInputExtension },
490#endif
491#ifdef XKB
492    { "XKEYBOARD", &noXkbExtension },
493#endif
494    { "XTEST", &noTestExtensions },
495#ifdef XV
496    { "XVideo", &noXvExtension },
497#endif
498    { NULL, NULL }
499};
500
501Bool EnableDisableExtension(char *name, Bool enable)
502{
503    ExtensionToggle *ext = &ExtensionToggleList[0];
504
505    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
506	if (strcmp(name, ext->name) == 0) {
507	    *ext->disablePtr = !enable;
508	    return TRUE;
509	}
510    }
511
512    return FALSE;
513}
514
515void EnableDisableExtensionError(char *name, Bool enable)
516{
517    ExtensionToggle *ext = &ExtensionToggleList[0];
518
519    ErrorF("Extension \"%s\" is not recognized\n", name);
520    ErrorF("Only the following extensions can be run-time %s:\n",
521	   enable ? "enabled" : "disabled");
522    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++)
523	ErrorF("    %s\n", ext->name);
524}
525
526#ifndef XFree86LOADER
527
528/*ARGSUSED*/
529void
530InitExtensions(argc, argv)
531    int		argc;
532    char	*argv[];
533{
534#ifdef XCSECURITY
535    SecurityExtensionSetup();
536#endif
537#ifdef PANORAMIX
538# if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
539  if (!noPanoramiXExtension) PanoramiXExtensionInit();
540# endif
541#endif
542#ifdef SHAPE
543    if (!noShapeExtension) ShapeExtensionInit();
544#endif
545#ifdef MITSHM
546    if (!noMITShmExtension) ShmExtensionInit();
547#endif
548#ifdef EVI
549    if (!noEVIExtension) EVIExtensionInit();
550#endif
551#ifdef MULTIBUFFER
552    if (!noMultibufferExtension) MultibufferExtensionInit();
553#endif
554#if defined(XINPUT)
555    if (!noXInputExtension) XInputExtensionInit();
556#endif
557#ifdef XTEST
558    if (!noTestExtensions) XTestExtensionInit();
559#endif
560#ifdef BIGREQS
561    if (!noBigReqExtension) BigReqExtensionInit();
562#endif
563#ifdef MITMISC
564    if (!noMITMiscExtension) MITMiscExtensionInit();
565#endif
566#ifdef XIDLE
567    if (!noXIdleExtension) XIdleExtensionInit();
568#endif
569#ifdef XTRAP
570    if (!noTestExtensions) DEC_XTRAPInit();
571#endif
572#if defined(SCREENSAVER) && !defined(PRINT_ONLY_SERVER)
573    if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
574#endif
575#ifdef XV
576    if (!noXvExtension) {
577      XvExtensionInit();
578      XvMCExtensionInit();
579    }
580#endif
581#ifdef XSYNC
582    if (!noSyncExtension) SyncExtensionInit();
583#endif
584#if defined(XKB) && !defined(PRINT_ONLY_SERVER)
585    if (!noXkbExtension) XkbExtensionInit();
586#endif
587#ifdef XCMISC
588    if (!noXCMiscExtension) XCMiscExtensionInit();
589#endif
590#ifdef XRECORD
591    if (!noTestExtensions) RecordExtensionInit();
592#endif
593#ifdef DBE
594    if (!noDbeExtension) DbeExtensionInit();
595#endif
596#ifdef XAPPGROUP
597    if (!noXagExtension) XagExtensionInit();
598#endif
599#ifdef XACE
600    XaceExtensionInit();
601#endif
602#ifdef XCSECURITY
603    if (!noSecurityExtension) SecurityExtensionInit();
604#endif
605#ifdef XPRINT
606    XpExtensionInit(); /* server-specific extension, cannot be disabled */
607#endif
608#ifdef TOGCUP
609    if (!noXcupExtension) XcupExtensionInit();
610#endif
611#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
612    if (!noDPMSExtension) DPMSExtensionInit();
613#endif
614#ifdef FONTCACHE
615    if (!noFontCacheExtension) FontCacheExtensionInit();
616#endif
617#ifdef XF86BIGFONT
618    if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
619#endif
620#if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
621#if defined(XF86VIDMODE)
622    if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit();
623#endif
624#if defined(XF86MISC)
625    if (!noXFree86MiscExtension) XFree86MiscExtensionInit();
626#endif
627#if defined(XFreeXDGA)
628    if (!noXFree86DGAExtension) XFree86DGAExtensionInit();
629#endif
630#ifdef XF86DRI
631    if (!noXFree86DRIExtension) XFree86DRIExtensionInit();
632#endif
633#endif
634
635#ifdef GLXEXT
636#ifdef INXDARWINAPP
637    DarwinGlxPushProvider(__DarwinglXMesaProvider);
638    if (!noGlxExtension) DarwinGlxExtensionInit();
639#else
640    GlxPushProvider(&__glXMesaProvider);
641    if (!noGlxExtension) GlxExtensionInit();
642#endif // INXDARWINAPP
643#endif // GLXEXT
644#ifdef XFIXES
645    /* must be before Render to layer DisplayCursor correctly */
646    if (!noXFixesExtension) XFixesExtensionInit();
647#endif
648#ifdef RENDER
649    if (!noRenderExtension) RenderExtensionInit();
650#endif
651#ifdef RANDR
652    if (!noRRExtension) RRExtensionInit();
653#endif
654#ifdef RES
655    if (!noResExtension) ResExtensionInit();
656#endif
657#ifdef DMXEXT
658    DMXExtensionInit(); /* server-specific extension, cannot be disabled */
659#endif
660#ifdef XEVIE
661    if (!noXevieExtension) XevieExtensionInit();
662#endif
663#ifdef COMPOSITE
664    if (!noCompositeExtension) CompositeExtensionInit();
665#endif
666#ifdef DAMAGE
667    if (!noDamageExtension) DamageExtensionInit();
668#endif
669}
670
671void
672InitVisualWrap()
673{
674    miResetInitVisuals();
675#ifdef GLXEXT
676#ifndef __DARWIN__
677    GlxWrapInitVisuals(&miInitVisualsProc);
678#else
679    DarwinGlxWrapInitVisuals(&miInitVisualsProc);
680#endif
681#endif
682}
683
684#else /* XFree86LOADER */
685/* List of built-in (statically linked) extensions */
686static ExtensionModule staticExtensions[] = {
687#ifdef MITSHM
688    { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
689#endif
690#ifdef XINPUT
691    { XInputExtensionInit, "XInputExtension", &noXInputExtension, NULL, NULL },
692#endif
693#ifdef XTEST
694    { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
695#endif
696#ifdef XIDLE
697    { XIdleExtensionInit, "XIDLE", &noXIdleExtension, NULL, NULL },
698#endif
699#ifdef XKB
700    { XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
701#endif
702#ifdef XAPPGROUP
703    { XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
704#endif
705#ifdef XACE
706    { XaceExtensionInit, XACE_EXTENSION_NAME, NULL, NULL, NULL },
707#endif
708#ifdef XCSECURITY
709    { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, SecurityExtensionSetup, NULL },
710#endif
711#ifdef XPRINT
712    { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
713#endif
714#ifdef PANORAMIX
715    { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
716#endif
717#ifdef XFIXES
718    /* must be before Render to layer DisplayCursor correctly */
719    { XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL },
720#endif
721#ifdef XF86BIGFONT
722    { XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, NULL, NULL },
723#endif
724#ifdef RENDER
725    { RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
726#endif
727#ifdef RANDR
728    { RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
729#endif
730#ifdef COMPOSITE
731    { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL },
732#endif
733#ifdef DAMAGE
734    { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
735#endif
736#ifdef XEVIE
737    { XevieExtensionInit, "XEVIE", &noXevieExtension, NULL },
738#endif
739    { NULL, NULL, NULL, NULL, NULL }
740};
741
742/*ARGSUSED*/
743void
744InitExtensions(argc, argv)
745    int		argc;
746    char	*argv[];
747{
748    int i;
749    ExtensionModule *ext;
750    static Bool listInitialised = FALSE;
751
752    if (!listInitialised) {
753	/* Add built-in extensions to the list. */
754	for (i = 0; staticExtensions[i].name; i++)
755	    LoadExtension(&staticExtensions[i], TRUE);
756
757	/* Sort the extensions according the init dependencies. */
758	LoaderSortExtensions();
759	listInitialised = TRUE;
760    } else {
761	/* Call the setup functions on subsequent server resets as well */
762	for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
763	    ext = &ExtensionModuleList[i];
764	    if (ext->setupFunc != NULL &&
765		(ext->disablePtr == NULL ||
766		 (ext->disablePtr != NULL && !*ext->disablePtr))) {
767		(ext->setupFunc)();
768	    }
769	}
770    }
771
772    for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
773	ext = &ExtensionModuleList[i];
774	if (ext->initFunc != NULL &&
775	    (ext->disablePtr == NULL ||
776	     (ext->disablePtr != NULL && !*ext->disablePtr))) {
777	    (ext->initFunc)();
778	}
779    }
780}
781
782static void (*__miHookInitVisualsFunction)(miInitVisualsProcPtr *);
783
784void
785InitVisualWrap()
786{
787    miResetInitVisuals();
788    if (__miHookInitVisualsFunction)
789	(*__miHookInitVisualsFunction)(&miInitVisualsProc);
790}
791
792_X_EXPORT void
793miHookInitVisuals(void (**old)(miInitVisualsProcPtr *),
794		  void (*new)(miInitVisualsProcPtr *))
795{
796    if (old)
797	*old = __miHookInitVisualsFunction;
798    __miHookInitVisualsFunction = new;
799}
800
801#endif /* XFree86LOADER */
802