1 /**************************************************************************
3 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sub license, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial portions
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
22 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Kevin E. Martin <kevin@precisioninsight.com>
34 #ifdef HAVE_XORG_CONFIG_H
35 #include <xorg-config.h>
38 #include "xf86Module.h"
45 typedef struct __GLXscreen __GLXscreen
;
46 typedef struct __GLXprovider __GLXprovider
;
47 struct __GLXprovider
{
48 __GLXscreen
*(*screenProbe
)(ScreenPtr pScreen
);
53 extern void GlxPushProvider(__GLXprovider
*provider
);
54 extern void GlxExtensionInit(void);
55 extern void GlxWrapInitVisuals(miInitVisualsProcPtr
*);
57 static MODULESETUPPROTO(glxSetup
);
59 static const char *initdeps
[] = { "DOUBLE-BUFFER", NULL
};
61 static ExtensionModule GLXExt
=
70 static XF86ModuleVersionInfo VersRec
=
79 ABI_EXTENSION_VERSION
,
84 _X_EXPORT XF86ModuleData glxModuleData
= { &VersRec
, glxSetup
, NULL
};
86 /* We do a little proxy dance here, so we can avoid loading GLcore
87 * unless we really need to.*/
89 static pointer glxModule
;
92 __glXMesaProxyScreenProbe(ScreenPtr pScreen
)
95 static __GLXprovider
*provider
;
97 if (provider
== NULL
) {
98 GLcore
= LoadSubModule(glxModule
, "GLcore", NULL
, NULL
, NULL
, NULL
,
103 provider
= LoaderSymbol("__glXMesaProvider");
104 if (provider
== NULL
)
108 return provider
->screenProbe(pScreen
);
111 static __GLXprovider __glXMesaProxyProvider
= {
112 __glXMesaProxyScreenProbe
,
119 glxSetup(pointer module
, pointer opts
, int *errmaj
, int *errmin
)
121 static Bool setupDone
= FALSE
;
122 __GLXprovider
*provider
;
125 if (errmaj
) *errmaj
= LDR_ONCEONLY
;
132 GlxPushProvider(&__glXMesaProxyProvider
);
134 xf86Msg(xf86Info
.aiglxFrom
, "AIGLX %s\n",
135 xf86Info
.aiglx
? "enabled" : "disabled");
136 if (xf86Info
.aiglx
) {
137 provider
= LoaderSymbol("__glXDRIProvider");
139 GlxPushProvider(provider
);
142 LoadExtension(&GLXExt
, FALSE
);
143 /* Wrap the init visuals routine in micmap.c */
144 GlxWrapInitVisuals(&miInitVisualsProc
);
145 /* Make sure this gets wrapped each time InitVisualWrap is called */
146 miHookInitVisuals(NULL
, GlxWrapInitVisuals
);