Imported Upstream version 1.15.1
[deb_xorg-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 #define GL_GLEXT_PROTOTYPES /* we want prototypes */
50 #include <GL/gl.h>
51 #include <GL/glext.h>
52 #include <GL/glxproto.h>
53
54 /*
55 ** GLX resources.
56 */
57 typedef XID GLXContextID;
58 typedef XID GLXPixmap;
59 typedef XID GLXDrawable;
60
61 typedef struct __GLXclientStateRec __GLXclientState;
62 typedef struct __GLXdrawable __GLXdrawable;
63 typedef struct __GLXcontext __GLXcontext;
64
65 #include "glxscreens.h"
66 #include "glxdrawable.h"
67 #include "glxcontext.h"
68
69 #ifndef True
70 #define True 1
71 #endif
72 #ifndef False
73 #define False 0
74 #endif
75
76 extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
77 extern __GLXclientState *glxGetClient(ClientPtr pClient);
78
79 /************************************************************************/
80
81 void GlxSetVisualConfigs(int nconfigs, void *configs, void **privates);
82
83 void __glXScreenInitVisuals(__GLXscreen * screen);
84
85 /*
86 ** The last context used (from the server's persective) is cached.
87 */
88 extern __GLXcontext *__glXLastContext;
89 extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
90 int *);
91
92 int __glXError(int error);
93
94 /************************************************************************/
95
96 typedef struct __GLXprovider __GLXprovider;
97 struct __GLXprovider {
98 __GLXscreen *(*screenProbe) (ScreenPtr pScreen);
99 const char *name;
100 __GLXprovider *next;
101 };
102 extern __GLXprovider __glXDRISWRastProvider;
103
104 void GlxPushProvider(__GLXprovider * provider);
105
106 enum {
107 GLX_MINIMAL_VISUALS,
108 GLX_TYPICAL_VISUALS,
109 GLX_ALL_VISUALS
110 };
111
112 void __glXsetEnterLeaveServerFuncs(void (*enter) (GLboolean),
113 void (*leave) (GLboolean));
114 void __glXenterServer(GLboolean rendering);
115 void __glXleaveServer(GLboolean rendering);
116
117 void glxSuspendClients(void);
118 void glxResumeClients(void);
119
120 typedef void (*glx_func_ptr)(void);
121 typedef glx_func_ptr (*glx_gpa_proc)(const char *);
122 void __glXsetGetProcAddress(glx_gpa_proc get_proc_address);
123 void *__glGetProcAddress(const char *);
124
125 void
126 __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
127 CARD64 msc, CARD32 sbc);
128
129 #if PRESENT
130 void
131 __glXregisterPresentCompleteNotify(void);
132 #endif
133
134 /*
135 ** State kept per client.
136 */
137 struct __GLXclientStateRec {
138 /*
139 ** Whether this structure is currently being used to support a client.
140 */
141 Bool inUse;
142
143 /*
144 ** Buffer for returned data.
145 */
146 GLbyte *returnBuf;
147 GLint returnBufSize;
148
149 /*
150 ** Keep track of large rendering commands, which span multiple requests.
151 */
152 GLint largeCmdBytesSoFar; /* bytes received so far */
153 GLint largeCmdBytesTotal; /* total bytes expected */
154 GLint largeCmdRequestsSoFar; /* requests received so far */
155 GLint largeCmdRequestsTotal; /* total requests expected */
156 GLbyte *largeCmdBuf;
157 GLint largeCmdBufSize;
158
159 /* Back pointer to X client record */
160 ClientPtr client;
161
162 char *GLClientextensions;
163 };
164
165 /************************************************************************/
166
167 /*
168 ** Dispatch tables.
169 */
170 typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
171 typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
172 typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
173
174 /*
175 * Dispatch for GLX commands.
176 */
177 typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
178
179 /*
180 * Tables for computing the size of each rendering command.
181 */
182 typedef int (*gl_proto_size_func) (const GLbyte *, Bool);
183
184 typedef struct {
185 int bytes;
186 gl_proto_size_func varsize;
187 } __GLXrenderSizeData;
188
189 /************************************************************************/
190
191 /*
192 ** X resources.
193 */
194 extern RESTYPE __glXContextRes;
195 extern RESTYPE __glXClientRes;
196 extern RESTYPE __glXPixmapRes;
197 extern RESTYPE __glXDrawableRes;
198
199 /************************************************************************/
200
201 /*
202 ** Prototypes.
203 */
204
205 extern char *__glXcombine_strings(const char *, const char *);
206
207 /*
208 ** Routines for sending swapped replies.
209 */
210
211 extern void __glXSwapMakeCurrentReply(ClientPtr client,
212 xGLXMakeCurrentReply * reply);
213 extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
214 extern void __glXSwapQueryVersionReply(ClientPtr client,
215 xGLXQueryVersionReply * reply);
216 extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
217 xGLXQueryContextInfoEXTReply *
218 reply, int *buf);
219 extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
220 xGLXGetDrawableAttributesReply *
221 reply, CARD32 *buf);
222 extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
223 xGLXQueryExtensionsStringReply *
224 reply, char *buf);
225 extern void glxSwapQueryServerStringReply(ClientPtr client,
226 xGLXQueryServerStringReply * reply,
227 char *buf);
228
229 /*
230 * Routines for computing the size of variably-sized rendering commands.
231 */
232
233 extern int __glXTypeSize(GLenum enm);
234 extern int __glXImageSize(GLenum format, GLenum type,
235 GLenum target, GLsizei w, GLsizei h, GLsizei d,
236 GLint imageHeight, GLint rowLength, GLint skipImages,
237 GLint skipRows, GLint alignment);
238
239 extern unsigned glxMajorVersion;
240 extern unsigned glxMinorVersion;
241
242 extern int __glXEventBase;
243
244 #endif /* !__GLX_server_h__ */