Imported Upstream version 1.15.1
[deb_xorg-server.git] / glx / glxserver.h
CommitLineData
a09e091a
JB
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*/
57typedef XID GLXContextID;
58typedef XID GLXPixmap;
59typedef XID GLXDrawable;
60
61typedef struct __GLXclientStateRec __GLXclientState;
62typedef struct __GLXdrawable __GLXdrawable;
63typedef 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
76extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
77extern __GLXclientState *glxGetClient(ClientPtr pClient);
78
79/************************************************************************/
80
81void GlxSetVisualConfigs(int nconfigs, void *configs, void **privates);
82
83void __glXScreenInitVisuals(__GLXscreen * screen);
84
85/*
86** The last context used (from the server's persective) is cached.
87*/
88extern __GLXcontext *__glXLastContext;
89extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
90 int *);
91
92int __glXError(int error);
93
94/************************************************************************/
95
96typedef struct __GLXprovider __GLXprovider;
97struct __GLXprovider {
98 __GLXscreen *(*screenProbe) (ScreenPtr pScreen);
99 const char *name;
100 __GLXprovider *next;
101};
102extern __GLXprovider __glXDRISWRastProvider;
103
104void GlxPushProvider(__GLXprovider * provider);
105
106enum {
107 GLX_MINIMAL_VISUALS,
108 GLX_TYPICAL_VISUALS,
109 GLX_ALL_VISUALS
110};
111
112void __glXsetEnterLeaveServerFuncs(void (*enter) (GLboolean),
113 void (*leave) (GLboolean));
114void __glXenterServer(GLboolean rendering);
115void __glXleaveServer(GLboolean rendering);
116
117void glxSuspendClients(void);
118void glxResumeClients(void);
119
120typedef void (*glx_func_ptr)(void);
121typedef glx_func_ptr (*glx_gpa_proc)(const char *);
122void __glXsetGetProcAddress(glx_gpa_proc get_proc_address);
123void *__glGetProcAddress(const char *);
124
125void
126__glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
127 CARD64 msc, CARD32 sbc);
128
129#if PRESENT
130void
131__glXregisterPresentCompleteNotify(void);
132#endif
133
134/*
135** State kept per client.
136*/
137struct __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*/
170typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
171typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
172typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
173
174/*
175 * Dispatch for GLX commands.
176 */
177typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
178
179/*
180 * Tables for computing the size of each rendering command.
181 */
182typedef int (*gl_proto_size_func) (const GLbyte *, Bool);
183
184typedef struct {
185 int bytes;
186 gl_proto_size_func varsize;
187} __GLXrenderSizeData;
188
189/************************************************************************/
190
191/*
192** X resources.
193*/
194extern RESTYPE __glXContextRes;
195extern RESTYPE __glXClientRes;
196extern RESTYPE __glXPixmapRes;
197extern RESTYPE __glXDrawableRes;
198
199/************************************************************************/
200
201/*
202** Prototypes.
203*/
204
205extern char *__glXcombine_strings(const char *, const char *);
206
207/*
208** Routines for sending swapped replies.
209*/
210
211extern void __glXSwapMakeCurrentReply(ClientPtr client,
212 xGLXMakeCurrentReply * reply);
213extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
214extern void __glXSwapQueryVersionReply(ClientPtr client,
215 xGLXQueryVersionReply * reply);
216extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
217 xGLXQueryContextInfoEXTReply *
218 reply, int *buf);
219extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
220 xGLXGetDrawableAttributesReply *
221 reply, CARD32 *buf);
222extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
223 xGLXQueryExtensionsStringReply *
224 reply, char *buf);
225extern 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
233extern int __glXTypeSize(GLenum enm);
234extern 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
239extern unsigned glxMajorVersion;
240extern unsigned glxMinorVersion;
241
242extern int __glXEventBase;
243
244#endif /* !__GLX_server_h__ */