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