Add mouse and keyboard configuration file
[profile/ivi/xorg-x11-server.git] / glx / glxserver.h
1 #ifdef HAVE_DIX_CONFIG_H
2 #include <dix-config.h>
3 #endif
4
5 #ifndef _GLX_server_h_
6 #define _GLX_server_h_
7
8 /*
9  * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
10  * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice including the dates of first publication and
20  * either this permission notice or a reference to
21  * http://oss.sgi.com/projects/FreeB/
22  * shall be included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27  * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
29  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30  * SOFTWARE.
31  *
32  * Except as contained in this notice, the name of Silicon Graphics, Inc.
33  * shall not be used in advertising or otherwise to promote the sale, use or
34  * other dealings in this Software without prior written authorization from
35  * Silicon Graphics, Inc.
36  */
37
38 #include <X11/X.h>
39 #include <X11/Xproto.h>
40 #include <X11/Xmd.h>
41 #include <misc.h>
42 #include <dixstruct.h>
43 #include <pixmapstr.h>
44 #include <gcstruct.h>
45 #include <extnsionst.h>
46 #include <resource.h>
47 #include <scrnintstr.h>
48
49 /*
50 ** The X header misc.h defines these math functions.
51 */
52 #undef abs
53 #undef fabs
54
55 #define GL_GLEXT_PROTOTYPES /* we want prototypes */
56 #include <GL/gl.h>
57 #include <GL/glxproto.h>
58
59 /*
60 ** GLX resources.
61 */
62 typedef XID GLXContextID;
63 typedef XID GLXPixmap;
64 typedef XID GLXDrawable;
65
66 typedef struct __GLXclientStateRec __GLXclientState;
67 typedef struct __GLXdrawable __GLXdrawable;
68 typedef struct __GLXcontext __GLXcontext;
69
70 #include "glxscreens.h"
71 #include "glxdrawable.h"
72 #include "glxcontext.h"
73
74 #ifndef True
75 #define True 1
76 #endif
77 #ifndef False
78 #define False 0
79 #endif
80
81 extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
82 extern __GLXclientState *glxGetClient(ClientPtr pClient);
83
84 /************************************************************************/
85
86 void GlxExtensionInit(void);
87
88 void GlxSetVisualConfigs(int nconfigs, 
89                          void *configs, void **privates);
90
91 void __glXScreenInitVisuals(__GLXscreen *screen);
92
93 /*
94 ** The last context used (from the server's persective) is cached.
95 */
96 extern __GLXcontext *__glXLastContext;
97 extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
98
99 extern ClientPtr __pGlxClient;
100
101 int __glXError(int error);
102
103 /*
104 ** Macros to set, unset, and retrieve the flag that says whether a context
105 ** has unflushed commands.
106 */
107 #define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE
108 #define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE
109 #define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands)
110
111 /************************************************************************/
112
113 typedef struct __GLXprovider __GLXprovider;
114 struct __GLXprovider {
115     __GLXscreen *(*screenProbe)(ScreenPtr pScreen);
116     const char    *name;
117     __GLXprovider *next;
118 };
119
120 void GlxPushProvider(__GLXprovider *provider);
121
122 enum {
123     GLX_MINIMAL_VISUALS,
124     GLX_TYPICAL_VISUALS,
125     GLX_ALL_VISUALS
126 };
127
128 void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
129                                    void (*leave)(GLboolean));
130 void __glXenterServer(GLboolean rendering);
131 void __glXleaveServer(GLboolean rendering);
132
133 void glxSuspendClients(void);
134 void glxResumeClients(void);
135
136 /*
137 ** State kept per client.
138 */
139 struct __GLXclientStateRec {
140     /*
141     ** Whether this structure is currently being used to support a client.
142     */
143     Bool inUse;
144
145     /*
146     ** Buffer for returned data.
147     */
148     GLbyte *returnBuf;
149     GLint returnBufSize;
150
151     /*
152     ** Keep track of large rendering commands, which span multiple requests.
153     */
154     GLint largeCmdBytesSoFar;           /* bytes received so far        */
155     GLint largeCmdBytesTotal;           /* total bytes expected         */
156     GLint largeCmdRequestsSoFar;        /* requests received so far     */
157     GLint largeCmdRequestsTotal;        /* total requests expected      */
158     GLbyte *largeCmdBuf;
159     GLint largeCmdBufSize;
160
161     /*
162     ** Keep a list of all the contexts that are current for this client's
163     ** threads.
164     */
165     __GLXcontext **currentContexts;
166     GLint numCurrentContexts;
167
168     /* Back pointer to X client record */
169     ClientPtr client;
170
171     int GLClientmajorVersion;
172     int GLClientminorVersion;
173     char *GLClientextensions;
174 };
175
176 /************************************************************************/
177
178 /*
179 ** Dispatch tables.
180 */
181 typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
182 typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
183 typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
184
185 /*
186  * Dispatch for GLX commands.
187  */
188 typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
189
190 /*
191  * Tables for computing the size of each rendering command.
192  */
193 typedef int (*gl_proto_size_func)(const GLbyte *, Bool);
194
195 typedef struct {
196     int bytes;
197     gl_proto_size_func varsize;
198 } __GLXrenderSizeData;
199
200 /************************************************************************/
201
202 /*
203 ** X resources.
204 */
205 extern RESTYPE __glXContextRes;
206 extern RESTYPE __glXClientRes;
207 extern RESTYPE __glXPixmapRes;
208 extern RESTYPE __glXDrawableRes;
209
210 /************************************************************************/
211
212 /*
213 ** Prototypes.
214 */
215
216 extern char *__glXcombine_strings(const char *, const char *);
217
218 /*
219 ** Routines for sending swapped replies.
220 */
221
222 extern void __glXSwapMakeCurrentReply(ClientPtr client,
223                                       xGLXMakeCurrentReply *reply);
224 extern void __glXSwapIsDirectReply(ClientPtr client,
225                                    xGLXIsDirectReply *reply);
226 extern void __glXSwapQueryVersionReply(ClientPtr client,
227                                        xGLXQueryVersionReply *reply);
228 extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
229                                               xGLXQueryContextInfoEXTReply *reply,
230                                               int *buf);
231 extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
232                                                 xGLXGetDrawableAttributesReply *reply, CARD32 *buf);
233 extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
234                                 xGLXQueryExtensionsStringReply *reply, char *buf);
235 extern void glxSwapQueryServerStringReply(ClientPtr client,
236                                 xGLXQueryServerStringReply *reply, char *buf);
237
238
239 /*
240  * Routines for computing the size of variably-sized rendering commands.
241  */
242
243 extern int __glXTypeSize(GLenum enm);
244 extern int __glXImageSize(GLenum format, GLenum type,
245     GLenum target, GLsizei w, GLsizei h, GLsizei d,
246     GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows,
247     GLint alignment);
248
249 extern unsigned glxMajorVersion;
250 extern unsigned glxMinorVersion;
251
252 extern int __glXEventBase;
253
254 #endif /* !__GLX_server_h__ */