blob: df51f2b8ce4703baae0482e36571d4f8dc2a08d8 [file] [log] [blame]
Adam Jacksoncb3610e2004-10-25 21:09:16 +00001/*
Adam Jacksondc8058c2008-09-19 17:16:53 -04002 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
29 */
Adam Jacksoncb3610e2004-10-25 21:09:16 +000030
31/**
32 * \file glxclient.h
33 * Direct rendering support added by Precision Insight, Inc.
34 *
35 * \author Kevin E. Martin <kevin@precisioninsight.com>
36 */
37
38#ifndef _GLX_client_h_
39#define _GLX_client_h_
Adam Jacksoncb3610e2004-10-25 21:09:16 +000040#include <X11/Xproto.h>
41#include <X11/Xlibint.h>
Kristian Høgsberg38c51a72010-07-28 10:20:41 -040042#include <X11/Xfuncproto.h>
Robert Bragg7a9329b2010-01-20 03:01:14 +000043#include <X11/extensions/extutil.h>
Adam Jacksoncb3610e2004-10-25 21:09:16 +000044#define GLX_GLXEXT_PROTOTYPES
45#include <GL/glx.h>
46#include <GL/glxext.h>
47#include <string.h>
48#include <stdlib.h>
49#include <stdio.h>
Adam Jacksonad919c32004-11-15 15:31:32 +000050#include <stdint.h>
Emil Velikova385d182015-03-06 16:54:59 +000051#include <pthread.h>
Adam Jacksoncb3610e2004-10-25 21:09:16 +000052#include "GL/glxproto.h"
Kristian Høgsberg65d98e22010-07-28 10:13:44 -040053#include "glxconfig.h"
Kristian Høgsberg4a22ae82007-01-07 08:12:01 -050054#include "glxhash.h"
Brian Paul0339e7d2015-03-03 09:51:19 -070055#include "util/macros.h"
Adam Jacksoncb3610e2004-10-25 21:09:16 +000056
Jeremy Huddlestonec770152008-08-08 02:37:14 -070057#include "glxextensions.h"
58
Kyle Brennemance562f92017-01-04 11:31:58 -070059#if defined(USE_LIBGLVND)
Kyle Brenneman22a9e002016-05-11 14:01:53 -040060#define _GLX_PUBLIC _X_HIDDEN
61#else
62#define _GLX_PUBLIC _X_EXPORT
63#endif
Brian Paula25e1aa2008-09-18 13:26:30 -060064
Jose Fonseca52c74432016-04-26 19:48:12 +010065#ifdef __cplusplus
66extern "C" {
67#endif
68
69
RALOVICH, Kristóf08962682009-08-12 12:41:22 +020070#define GLX_MAJOR_VERSION 1 /* current version numbers */
71#define GLX_MINOR_VERSION 4
Adam Jacksoncb3610e2004-10-25 21:09:16 +000072
73#define __GLX_MAX_TEXTURE_UNITS 32
74
Kristian Høgsbergc356f582010-07-28 11:16:00 -040075struct glx_display;
76struct glx_context;
Adam Jacksoncb3610e2004-10-25 21:09:16 +000077
78/************************************************************************/
79
80#ifdef GLX_DIRECT_RENDERING
81
Kristian Høgsbergc356f582010-07-28 11:16:00 -040082extern void DRI_glXUseXFont(struct glx_context *ctx,
Kristian Høgsberg7b7845a2010-07-22 22:24:00 -040083 Font font, int first, int count, int listbase);
Adam Jacksoncb3610e2004-10-25 21:09:16 +000084
Jeremy Huddleston80b280d2010-04-02 01:35:19 -070085#endif
86
87#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
88
Adam Jacksoncb3610e2004-10-25 21:09:16 +000089/**
90 * Display dependent methods. This structure is initialized during the
91 * \c driCreateDisplay call.
92 */
Kristian Høgsberg425f9ed2008-03-08 19:02:10 -050093typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
Kristian Høgsberg92d2a782008-03-08 20:34:24 -050094typedef struct __GLXDRIscreenRec __GLXDRIscreen;
Kristian Høgsberg20b92302008-03-08 21:02:23 -050095typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
Kristian Høgsberg92d2a782008-03-08 20:34:24 -050096
RALOVICH, Kristóf08962682009-08-12 12:41:22 +020097struct __GLXDRIdisplayRec
98{
Adam Jacksoncb3610e2004-10-25 21:09:16 +000099 /**
100 * Method to destroy the private DRI display data.
101 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200102 void (*destroyDisplay) (__GLXDRIdisplay * display);
Kristian Høgsberga1ea6f62008-03-08 19:15:50 -0500103
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400104 struct glx_screen *(*createScreen)(int screen, struct glx_display * priv);
Kristian Høgsberg92d2a782008-03-08 20:34:24 -0500105};
106
Jesse Barnesdaf7fe62009-09-15 23:23:09 -0700107struct __GLXDRIscreenRec {
Kristian Høgsberg92d2a782008-03-08 20:34:24 -0500108
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400109 void (*destroyScreen)(struct glx_screen *psc);
Kristian Høgsberg92d2a782008-03-08 20:34:24 -0500110
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400111 struct glx_context *(*createContext)(struct glx_screen *psc,
112 struct glx_config *config,
113 struct glx_context *shareList,
114 int renderType);
Kristian Høgsbergf56b5692008-08-13 11:46:25 -0400115
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400116 __GLXDRIdrawable *(*createDrawable)(struct glx_screen *psc,
Jesse Barnesdaf7fe62009-09-15 23:23:09 -0700117 XID drawable,
118 GLXDrawable glxDrawable,
Kristian Høgsberg6ddf66e2010-07-28 10:07:52 -0400119 struct glx_config *config);
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200120
Jesse Barnesdaf7fe62009-09-15 23:23:09 -0700121 int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
Marek Olšák5b7e9b72012-11-13 17:06:37 +0100122 int64_t divisor, int64_t remainder, Bool flush);
Jesse Barnesdaf7fe62009-09-15 23:23:09 -0700123 void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
Marek Olšák5b7e9b72012-11-13 17:06:37 +0100124 int x, int y, int width, int height, Bool flush);
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400125 int (*getDrawableMSC)(struct glx_screen *psc, __GLXDRIdrawable *pdraw,
Jesse Barnesdaf7fe62009-09-15 23:23:09 -0700126 int64_t *ust, int64_t *msc, int64_t *sbc);
127 int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc,
128 int64_t divisor, int64_t remainder, int64_t *ust,
129 int64_t *msc, int64_t *sbc);
130 int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
131 int64_t *msc, int64_t *sbc);
Kristian Høgsberg089fc372010-07-19 16:39:53 -0400132 int (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
Jesse Barnesefc82e72009-11-10 13:28:01 -0800133 int (*getSwapInterval)(__GLXDRIdrawable *pdraw);
Adel Gadllaha69fabc2014-02-24 20:44:42 +0100134 int (*getBufferAge)(__GLXDRIdrawable *pdraw);
Kristian Høgsberg20b92302008-03-08 21:02:23 -0500135};
136
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200137struct __GLXDRIdrawableRec
138{
139 void (*destroyDrawable) (__GLXDRIdrawable * drawable);
Kristian Høgsberg91104252008-03-12 02:18:12 -0400140
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200141 XID xDrawable;
142 XID drawable;
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400143 struct glx_screen *psc;
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200144 GLenum textureTarget;
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200145 GLenum textureFormat; /* EXT_texture_from_pixmap support */
Nick Bowlerf8d81c32010-07-14 12:01:49 -0400146 unsigned long eventMask;
Stéphane Marchesinbf69ce32011-06-15 15:09:12 -0700147 int refcount;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000148};
149
150/*
151** Function to create and DRI display data and initialize the display
152** dependent methods.
153*/
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200154extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
155extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
156extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
Jon Turney533b3532016-07-11 21:38:16 +0100157extern __GLXDRIdisplay *dri3_create_display(Display * dpy);
158extern __GLXDRIdisplay *driwindowsCreateDisplay(Display * dpy);
159
160/*
161**
162*/
Francisco Jerez61d26bc2010-02-08 19:27:56 +0100163extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
Luca Barbieria0e51032010-09-22 07:44:59 +0200164extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable);
Francisco Jerez61d26bc2010-02-08 19:27:56 +0100165
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000166/*
167** Functions to obtain driver configuration information from a direct
168** rendering client application
169*/
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200170extern const char *glXGetScreenDriver(Display * dpy, int scrNum);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000171
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200172extern const char *glXGetDriverConfig(const char *driverName);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000173
174#endif
175
176/************************************************************************/
177
178#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
179
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200180typedef struct __GLXpixelStoreModeRec
181{
182 GLboolean swapEndian;
183 GLboolean lsbFirst;
184 GLuint rowLength;
185 GLuint imageHeight;
186 GLuint imageDepth;
187 GLuint skipRows;
188 GLuint skipPixels;
189 GLuint skipImages;
190 GLuint alignment;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000191} __GLXpixelStoreMode;
192
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000193
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200194typedef struct __GLXattributeRec
195{
196 GLuint mask;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000197
Ian Romanickfdb07632005-02-22 22:36:31 +0000198 /**
199 * Pixel storage state. Most of the pixel store mode state is kept
200 * here and used by the client code to manage the packing and
201 * unpacking of data sent to/received from the server.
202 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200203 __GLXpixelStoreMode storePack, storeUnpack;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000204
Ian Romanickfdb07632005-02-22 22:36:31 +0000205 /**
206 * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
207 * disabled?
208 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200209 GLboolean NoDrawArraysProtocol;
210
Ian Romanickfdb07632005-02-22 22:36:31 +0000211 /**
212 * Vertex Array storage state. The vertex array component
213 * state is stored here and is used to manage the packing of
214 * DrawArrays data sent to the server.
215 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200216 struct array_state_vector *array_state;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000217} __GLXattribute;
218
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200219typedef struct __GLXattributeMachineRec
220{
221 __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
222 __GLXattribute **stackPointer;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000223} __GLXattributeMachine;
224
Emil Velikov13faddb2016-05-30 10:56:33 +0100225struct mesa_glinterop_device_info;
226struct mesa_glinterop_export_in;
227struct mesa_glinterop_export_out;
Marek Olšák37d3a262016-03-03 18:43:53 +0100228
Kristian Høgsberg643b2af2010-05-21 10:36:56 -0400229struct glx_context_vtable {
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400230 void (*destroy)(struct glx_context *ctx);
Kristian Høgsbergc491e582010-07-28 15:33:09 -0400231 int (*bind)(struct glx_context *context, struct glx_context *old,
232 GLXDrawable draw, GLXDrawable read);
Ian Romanick8a4b36d2011-11-28 17:47:59 -0800233 void (*unbind)(struct glx_context *context, struct glx_context *new_ctx);
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400234 void (*wait_gl)(struct glx_context *ctx);
235 void (*wait_x)(struct glx_context *ctx);
236 void (*use_x_font)(struct glx_context *ctx,
Kristian Høgsberg7b7845a2010-07-22 22:24:00 -0400237 Font font, int first, int count, int listBase);
Kristian Høgsberg643b2af2010-05-21 10:36:56 -0400238 void (*bind_tex_image)(Display * dpy,
239 GLXDrawable drawable,
240 int buffer, const int *attrib_list);
241 void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
Jeremy Huddleston559e4f82011-06-15 00:27:55 -0700242 void * (*get_proc_address)(const char *symbol);
Marek Olšák37d3a262016-03-03 18:43:53 +0100243 int (*interop_query_device_info)(struct glx_context *ctx,
Emil Velikov13faddb2016-05-30 10:56:33 +0100244 struct mesa_glinterop_device_info *out);
Marek Olšák37d3a262016-03-03 18:43:53 +0100245 int (*interop_export_object)(struct glx_context *ctx,
Emil Velikov13faddb2016-05-30 10:56:33 +0100246 struct mesa_glinterop_export_in *in,
247 struct mesa_glinterop_export_out *out);
Kristian Høgsberg643b2af2010-05-21 10:36:56 -0400248};
249
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000250/**
251 * GLX state that needs to be kept on the client. One of these records
252 * exist for each context that has been made current by this client.
253 */
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400254struct glx_context
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200255{
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000256 /**
257 * \name Drawing command buffer.
258 *
259 * Drawing commands are packed into this buffer before being sent as a
260 * single GLX protocol request. The buffer is sent when it overflows or
261 * is flushed by \c __glXFlushRenderBuffer. \c pc is the next location
262 * in the buffer to be filled. \c limit is described above in the buffer
263 * slop discussion.
264 *
265 * Commands that require large amounts of data to be transfered will
266 * also use this buffer to hold a header that describes the large
267 * command.
268 *
269 * These must be the first 6 fields since they are static initialized
270 * in the dummy context in glxext.c
271 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200272 /*@{ */
273 GLubyte *buf;
274 GLubyte *pc;
275 GLubyte *limit;
276 GLubyte *bufEnd;
277 GLint bufSize;
278 /*@} */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000279
Kristian Høgsberg3ea3f5e2010-09-07 14:32:28 -0400280 const struct glx_context_vtable *vtable;
281
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000282 /**
283 * The XID of this rendering context. When the context is created a
284 * new XID is allocated. This is set to None when the context is
285 * destroyed but is still current to some thread. In this case the
286 * context will be freed on next MakeCurrent.
287 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200288 XID xid;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000289
290 /**
291 * The XID of the \c shareList context.
292 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200293 XID share_xid;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000294
295 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000296 * Screen number.
297 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200298 GLint screen;
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400299 struct glx_screen *psc;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000300
301 /**
302 * \c GL_TRUE if the context was created with ImportContext, which
303 * means the server-side context was created by another X client.
304 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200305 GLboolean imported;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000306
307 /**
308 * The context tag returned by MakeCurrent when this context is made
309 * current. This tag is used to identify the context that a thread has
310 * current so that proper server context management can be done. It is
311 * used for all context specific commands (i.e., \c Render, \c RenderLarge,
312 * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
313 * context)).
314 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200315 GLXContextTag currentContextTag;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000316
317 /**
318 * \name Rendering mode
319 *
320 * The rendering mode is kept on the client as well as the server.
321 * When \c glRenderMode is called, the buffer associated with the
322 * previous rendering mode (feedback or select) is filled.
323 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200324 /*@{ */
325 GLenum renderMode;
326 GLfloat *feedbackBuf;
327 GLuint *selectBuf;
328 /*@} */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000329
330 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000331 * Fill newImage with the unpacked form of \c oldImage getting it
332 * ready for transport to the server.
333 */
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400334 void (*fillImage) (struct glx_context *, GLint, GLint, GLint, GLint, GLenum,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200335 GLenum, const GLvoid *, GLubyte *, GLubyte *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000336
337 /**
Ian Romanick29206ae2005-07-29 17:30:18 +0000338 * Client side attribs.
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000339 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200340 __GLXattributeMachine attributes;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000341
342 /**
343 * Client side error code. This is set when client side gl API
344 * routines need to set an error because of a bad enumerant or
345 * running out of memory, etc.
346 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200347 GLenum error;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000348
349 /**
Xiang, Haihaoae2c31e2008-03-18 15:02:57 +0800350 * Whether this context does direct rendering.
351 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200352 Bool isDirect;
Xiang, Haihaoae2c31e2008-03-18 15:02:57 +0800353
Jeremy Huddleston488d6c72011-06-05 18:02:44 -0400354#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_APPLEGL)
355 void *driContext;
Jeremy Huddleston488d6c72011-06-05 18:02:44 -0400356#endif
357
Xiang, Haihaoae2c31e2008-03-18 15:02:57 +0800358 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000359 * \c dpy of current display for this context. Will be \c NULL if not
360 * current to any display, or if this is the "dummy context".
361 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200362 Display *currentDpy;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000363
364 /**
365 * The current drawable for this context. Will be None if this
366 * context is not current to any drawable. currentReadable is below.
367 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200368 GLXDrawable currentDrawable;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000369
370 /**
371 * \name GL Constant Strings
372 *
373 * Constant strings that describe the server implementation
374 * These pertain to GL attributes, not to be confused with
375 * GLX versioning attributes.
376 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200377 /*@{ */
378 GLubyte *vendor;
379 GLubyte *renderer;
380 GLubyte *version;
381 GLubyte *extensions;
382 /*@} */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000383
384 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000385 * Maximum small render command size. This is the smaller of 64k and
386 * the size of the above buffer.
387 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200388 GLint maxSmallRenderCommandSize;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000389
390 /**
391 * Major opcode for the extension. Copied here so a lookup isn't
392 * needed.
393 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200394 GLint majorOpcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000395
Kristian Høgsberg286ce272007-11-06 14:34:15 -0500396 /**
Kristian Høgsberg6ddf66e2010-07-28 10:07:52 -0400397 * Pointer to the config used to create this context.
Kristian Høgsberg286ce272007-11-06 14:34:15 -0500398 */
Kristian Høgsberg6ddf66e2010-07-28 10:07:52 -0400399 struct glx_config *config;
Kristian Høgsberg286ce272007-11-06 14:34:15 -0500400
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000401 /**
402 * The current read-drawable for this context. Will be None if this
403 * context is not current to any drawable.
404 *
405 * \since Internal API version 20030606.
406 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200407 GLXDrawable currentReadable;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000408
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200409 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000410 * Pointer to client-state data that is private to libGL. This is only
411 * used for indirect rendering contexts.
412 *
413 * No internal API version change was made for this change. Client-side
414 * drivers should NEVER use this data or even care that it exists.
415 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200416 void *client_state_private;
Ian Romanickfdb07632005-02-22 22:36:31 +0000417
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000418 /**
419 * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
420 */
421 int renderType;
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200422
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000423 /**
424 * \name Raw server GL version
425 *
426 * True core GL version supported by the server. This is the raw value
427 * returned by the server, and it may not reflect what is actually
428 * supported (or reported) by the client-side library.
429 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200430 /*@{ */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000431 int server_major; /**< Major version number. */
432 int server_minor; /**< Minor version number. */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200433 /*@} */
Ian Romanickfdb07632005-02-22 22:36:31 +0000434
Thomas Hellstrom96fd3df2009-04-02 11:00:41 +0200435 /**
Eric Anholt49d7e482011-02-03 17:26:02 -0800436 * Number of threads we're currently current in.
Thomas Hellstrom96fd3df2009-04-02 11:00:41 +0200437 */
Eric Anholt49d7e482011-02-03 17:26:02 -0800438 unsigned long thread_refcount;
Thomas Hellstrom96fd3df2009-04-02 11:00:41 +0200439
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200440 char gl_extension_bits[__GL_EXT_BYTES];
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000441};
442
Kristian Høgsberg31819832010-07-22 21:24:14 -0400443extern Bool
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400444glx_context_init(struct glx_context *gc,
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400445 struct glx_screen *psc, struct glx_config *fbconfig);
Kristian Høgsberg31819832010-07-22 21:24:14 -0400446
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200447#define __glXSetError(gc,code) \
448 if (!(gc)->error) { \
449 (gc)->error = code; \
450 }
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000451
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400452extern void __glFreeAttributeState(struct glx_context *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000453
454/************************************************************************/
455
456/**
457 * The size of the largest drawing command known to the implementation
458 * that will use the GLXRender GLX command. In this case it is
459 * \c glPolygonStipple.
460 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200461#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000462
463/**
464 * To keep the implementation fast, the code uses a "limit" pointer
465 * to determine when the drawing command buffer is too full to hold
466 * another fixed size command. This constant defines the amount of
467 * space that must always be available in the drawing command buffer
468 * at all times for the implementation to work. It is important that
469 * the number be just large enough, but not so large as to reduce the
470 * efficacy of the buffer. The "+32" is just to keep the code working
471 * in case somebody counts wrong.
472 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200473#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000474
475/**
476 * This implementation uses a smaller threshold for switching
477 * to the RenderLarge protocol than the protcol requires so that
478 * large copies don't occur.
479 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200480#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000481
482/**
483 * One of these records exists per screen of the display. It contains
484 * a pointer to the config data for that screen (if the screen supports GL).
485 */
Kristian Høgsberg6ec39db2010-07-23 16:15:31 -0400486struct glx_screen_vtable {
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400487 struct glx_context *(*create_context)(struct glx_screen *psc,
488 struct glx_config *config,
489 struct glx_context *shareList,
490 int renderType);
Ian Romanick43409fa2011-11-30 13:06:59 -0800491
492 struct glx_context *(*create_context_attribs)(struct glx_screen *psc,
493 struct glx_config *config,
494 struct glx_context *shareList,
495 unsigned num_attrib,
496 const uint32_t *attribs,
497 unsigned *error);
Ian Romanick6c28c032013-02-15 22:35:24 -0800498 int (*query_renderer_integer)(struct glx_screen *psc,
499 int attribute,
Brian Paul75982a52013-11-08 09:00:46 -0700500 unsigned int *value);
Ian Romanick6c28c032013-02-15 22:35:24 -0800501 int (*query_renderer_string)(struct glx_screen *psc,
502 int attribute,
503 const char **value);
Kristian Høgsberg6ec39db2010-07-23 16:15:31 -0400504};
505
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400506struct glx_screen
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200507{
Kristian Høgsberg6ec39db2010-07-23 16:15:31 -0400508 const struct glx_screen_vtable *vtable;
509
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000510 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000511 * GLX extension string reported by the X-server.
512 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200513 const char *serverGLXexts;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000514
515 /**
516 * GLX extension string to be reported to applications. This is the
517 * set of extensions that the application can actually use.
518 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200519 char *effectiveGLXexts;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000520
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400521 struct glx_display *display;
Kristian Høgsberg03775512010-07-19 21:00:09 -0400522
Kristian Høgsberg60fce152010-09-07 12:40:37 -0400523 Display *dpy;
524 int scr;
525
Jeremy Huddleston80b280d2010-04-02 01:35:19 -0700526#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000527 /**
528 * Per screen direct rendering interface functions and data.
529 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200530 __GLXDRIscreen *driScreen;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000531#endif
532
533 /**
Kristian Høgsberg6c533ea2007-10-16 16:07:47 -0400534 * Linked list of glx visuals and fbconfigs for this screen.
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000535 */
Kristian Høgsberg6ddf66e2010-07-28 10:07:52 -0400536 struct glx_config *visuals, *configs;
Ian Romanickc39bf5e2005-07-24 06:29:14 +0000537
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000538 /**
539 * Per-screen dynamic GLX extension tracking. The \c direct_support
540 * field only contains enough bits for 64 extensions. Should libGL
541 * ever need to track more than 64 GLX extensions, we can safely grow
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400542 * this field. The \c struct glx_screen structure is not used outside
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000543 * libGL.
544 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200545 /*@{ */
546 unsigned char direct_support[8];
547 GLboolean ext_list_first_time;
548 /*@} */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000549
Kristian Høgsbergaceccda2007-05-10 15:52:22 -0400550};
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000551
552/**
553 * Per display private data. One of these records exists for each display
554 * that is using the OpenGL (GLX) extension.
555 */
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400556struct glx_display
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200557{
Kristian Høgsbergab434f62010-07-22 21:11:02 -0400558 /* The extension protocol codes */
559 XExtCodes *codes;
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400560 struct glx_display *next;
Kristian Høgsbergab434f62010-07-22 21:11:02 -0400561
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000562 /**
563 * Back pointer to the display
564 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200565 Display *dpy;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000566
567 /**
568 * The \c majorOpcode is common to all connections to the same server.
569 * It is also copied into the context structure.
570 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200571 int majorOpcode;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000572
573 /**
574 * \name Server Version
575 *
576 * Major and minor version returned by the server during initialization.
577 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200578 /*@{ */
579 int majorVersion, minorVersion;
580 /*@} */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000581
582 /**
583 * \name Storage for the servers GLX vendor and versions strings.
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200584 *
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000585 * These are the same for all screens on this display. These fields will
586 * be filled in on demand.
587 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200588 /*@{ */
589 const char *serverGLXvendor;
590 const char *serverGLXversion;
591 /*@} */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000592
593 /**
594 * Configurations of visuals for all screens on this display.
595 * Also, per screen data which now includes the server \c GLX_EXTENSION
596 * string.
597 */
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400598 struct glx_screen **screens;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000599
Jesse Barnes4df13762011-05-06 10:31:24 -0700600 __glxHashTable *glXDrawHash;
601
Jeremy Huddleston80b280d2010-04-02 01:35:19 -0700602#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
Kristian Høgsberge3e81962010-07-19 21:15:50 -0400603 __glxHashTable *drawHash;
604
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000605 /**
606 * Per display direct rendering interface functions and data.
607 */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200608 __GLXDRIdisplay *driswDisplay;
609 __GLXDRIdisplay *driDisplay;
610 __GLXDRIdisplay *dri2Display;
Keith Packard2d946012013-11-04 18:15:51 -0800611 __GLXDRIdisplay *dri3Display;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000612#endif
Jon Turney533b3532016-07-11 21:38:16 +0100613#ifdef GLX_USE_WINDOWSGL
614 __GLXDRIdisplay *windowsdriDisplay;
615#endif
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000616};
617
Jesse Barnes4df13762011-05-06 10:31:24 -0700618struct glx_drawable {
619 XID xDrawable;
620 XID drawable;
621
622 uint32_t lastEventSbc;
623 int64_t eventSbcWrap;
624};
625
Kristian Høgsbergf9721152010-07-19 14:57:59 -0400626extern int
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400627glx_screen_init(struct glx_screen *psc,
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400628 int screen, struct glx_display * priv);
Henri Verbeetbfc88952011-01-29 15:00:48 -0800629extern void
630glx_screen_cleanup(struct glx_screen *psc);
Kristian Høgsbergf9721152010-07-19 14:57:59 -0400631
Kristian Høgsbergc1cbdbf2010-07-20 07:43:50 -0400632#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
Kristian Høgsberg3750ebd2010-07-19 09:37:07 -0400633extern __GLXDRIdrawable *
634dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
Kristian Høgsbergc1cbdbf2010-07-20 07:43:50 -0400635#endif
Kristian Høgsbergaceccda2007-05-10 15:52:22 -0400636
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400637extern GLubyte *__glXFlushRenderBuffer(struct glx_context *, GLubyte *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000638
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400639extern void __glXSendLargeChunk(struct glx_context * gc, GLint requestNumber,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200640 GLint totalRequests,
641 const GLvoid * data, GLint dataLen);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000642
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400643extern void __glXSendLargeCommand(struct glx_context *, const GLvoid *, GLint,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200644 const GLvoid *, GLint);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000645
646/* Initialize the GLX extension for dpy */
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400647extern struct glx_display *__glXInitialize(Display *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000648
649/************************************************************************/
650
651extern int __glXDebug;
652
653/* This is per-thread storage in an MT environment */
Ian Romanick02986cb2005-04-18 16:59:53 +0000654
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400655extern void __glXSetCurrentContext(struct glx_context * c);
Ian Romanick02986cb2005-04-18 16:59:53 +0000656
657# if defined( GLX_USE_TLS )
658
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200659extern __thread void *__glX_tls_Context
660 __attribute__ ((tls_model("initial-exec")));
Ian Romanick02986cb2005-04-18 16:59:53 +0000661
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200662# define __glXGetCurrentContext() __glX_tls_Context
Ian Romanick02986cb2005-04-18 16:59:53 +0000663
664# else
665
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400666extern struct glx_context *__glXGetCurrentContext(void);
Ian Romanick02986cb2005-04-18 16:59:53 +0000667
668# endif /* defined( GLX_USE_TLS ) */
669
George Sapountzisdf04ffb2008-04-18 17:28:34 +0300670extern void __glXSetCurrentContextNull(void);
671
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000672
673/*
674** Global lock for all threads in this address space using the GLX
675** extension
676*/
Ian Romanick02986cb2005-04-18 16:59:53 +0000677extern pthread_mutex_t __glXmutex;
678#define __glXLock() pthread_mutex_lock(&__glXmutex)
679#define __glXUnlock() pthread_mutex_unlock(&__glXmutex)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000680
681/*
682** Setup for a command. Initialize the extension for dpy if necessary.
683*/
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200684extern CARD8 __glXSetupForCommand(Display * dpy);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000685
686/************************************************************************/
687
688/*
689** Data conversion and packing support.
690*/
691
Ian Romanick5f1f2292005-01-07 02:39:09 +0000692extern const GLuint __glXDefaultPixelStore[9];
693
694/* Send an image to the server using RenderLarge. */
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400695extern void __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200696 GLint width, GLint height, GLint depth,
697 GLenum format, GLenum type,
698 const GLvoid * src, GLubyte * pc,
699 GLubyte * modes);
Ian Romanick5f1f2292005-01-07 02:39:09 +0000700
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000701/* Return the size, in bytes, of some pixel data */
Ian Romanick5f1f2292005-01-07 02:39:09 +0000702extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000703
704/* Return the number of elements per group of a specified format*/
705extern GLint __glElementsPerGroup(GLenum format, GLenum type);
706
707/* Return the number of bytes per element, based on the element type (other
708** than GL_BITMAP).
709*/
710extern GLint __glBytesPerElement(GLenum type);
711
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000712/*
713** Fill the transport buffer with the data from the users buffer,
714** applying some of the pixel store modes (unpack modes) to the data
715** first. As a side effect of this call, the "modes" field is
716** updated to contain the modes needed by the server to decode the
717** sent data.
718*/
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400719extern void __glFillImage(struct glx_context *, GLint, GLint, GLint, GLint, GLenum,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200720 GLenum, const GLvoid *, GLubyte *, GLubyte *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000721
722/* Copy map data with a stride into a packed buffer */
723extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
724extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
725extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200726 const GLfloat *, GLfloat *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000727extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200728 const GLdouble *, GLdouble *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000729
730/*
731** Empty an image out of the reply buffer into the clients memory applying
732** the pack modes to pack back into the clients requested format.
733*/
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400734extern void __glEmptyImage(struct glx_context *, GLint, GLint, GLint, GLint, GLenum,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200735 GLenum, const GLubyte *, GLvoid *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000736
737
738/*
Kristof Raloviche2060342008-08-20 15:18:38 -0600739** Allocate and Initialize Vertex Array client state, and free.
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000740*/
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400741extern void __glXInitVertexArrayState(struct glx_context *);
742extern void __glXFreeVertexArrayState(struct glx_context *);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000743
744/*
745** Inform the Server of the major and minor numbers and of the client
746** libraries extension string.
747*/
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200748extern void __glXClientInfo(Display * dpy, int opcode);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000749
Ian Romanick6ccda722011-11-28 17:50:07 -0800750_X_HIDDEN void
751__glX_send_client_info(struct glx_display *glx_dpy);
752
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000753/************************************************************************/
754
755/*
756** Declarations that should be in Xlib
757*/
758#ifdef __GL_USE_OUR_PROTOTYPES
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200759extern void _XFlush(Display *);
760extern Status _XReply(Display *, xReply *, int, Bool);
761extern void _XRead(Display *, void *, long);
762extern void _XSend(Display *, const void *, long);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000763#endif
764
765
Kristian Høgsberg6ddf66e2010-07-28 10:07:52 -0400766extern void __glXInitializeVisualConfigFromTags(struct glx_config * config,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200767 int count, const INT32 * bp,
768 Bool tagged_only,
769 Bool fbconfig_style_tags);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000770
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200771extern char *__glXQueryServerString(Display * dpy, int opcode,
772 CARD32 screen, CARD32 name);
773extern char *__glXGetString(Display * dpy, int opcode,
774 CARD32 screen, CARD32 name);
RALOVICH, Kristóf54444242008-10-18 16:53:08 +0200775
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000776extern const char __glXGLClientVersion[];
777extern const char __glXGLClientExtensions[];
778
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000779/* Get the unadjusted system time */
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200780extern int __glXGetUST(int64_t * ust);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000781
Kristian Høgsberg286ce272007-11-06 14:34:15 -0500782extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
RALOVICH, Kristóf08962682009-08-12 12:41:22 +0200783 int32_t * numerator,
784 int32_t * denominator);
Ian Romanickfc5b57b2006-08-29 15:38:19 +0000785
Jeremy Huddleston80b280d2010-04-02 01:35:19 -0700786#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
Kristian Høgsberg7a66e542010-07-21 14:09:49 -0400787extern GLboolean
Lauri Kasanenfe2079c2013-12-15 12:37:55 +0200788__glxGetMscRate(struct glx_screen *psc,
Kristian Høgsberg7a66e542010-07-21 14:09:49 -0400789 int32_t * numerator, int32_t * denominator);
Robert Bragg7a9329b2010-01-20 03:01:14 +0000790
791/* So that dri2.c:DRI2WireToEvent() can access
792 * glx_info->codes->first_event */
793XExtDisplayInfo *__glXFindDisplay (Display *dpy);
Kristian Høgsberg97ec6072010-02-15 11:12:28 -0500794
Kristian Høgsbergc796bb02010-07-22 23:45:18 -0400795extern void
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400796GarbageCollectDRIDrawables(struct glx_screen *psc);
Kristian Høgsbergc796bb02010-07-22 23:45:18 -0400797
Kristian Høgsberg97ec6072010-02-15 11:12:28 -0500798extern __GLXDRIdrawable *
Kristian Høgsbergeeaab202010-07-22 22:36:37 -0400799GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable);
Jeremy Huddleston1885cf22011-06-05 18:50:55 -0400800#endif
Kristian Høgsberg97ec6072010-02-15 11:12:28 -0500801
Ian Romanick588042a2011-11-30 10:33:37 -0800802extern struct glx_screen *GetGLXScreenConfigs(Display * dpy, int scrn);
803
Jeremy Huddleston1885cf22011-06-05 18:50:55 -0400804#ifdef GLX_USE_APPLEGL
805extern struct glx_screen *
806applegl_create_screen(int screen, struct glx_display * priv);
807
808extern struct glx_context *
809applegl_create_context(struct glx_screen *psc,
810 struct glx_config *mode,
811 struct glx_context *shareList, int renderType);
812
813extern int
814applegl_create_display(struct glx_display *display);
Kristian Høgsberg286ce272007-11-06 14:34:15 -0500815#endif
816
Tomasz Lis2eed9ff2013-07-18 14:19:38 -0700817extern Bool validate_renderType_against_config(const struct glx_config *config,
818 int renderType);
819
Jesse Barnes4df13762011-05-06 10:31:24 -0700820
821extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable);
822extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw,
823 XID xDrawable, GLXDrawable drawable);
824extern void DestroyGLXDrawable(Display *dpy, GLXDrawable drawable);
825
Kristian Høgsbergf485ee72010-07-29 18:44:26 -0400826extern struct glx_context dummyContext;
827
Kristian Høgsberg66fc35c2010-07-28 10:28:43 -0400828extern struct glx_screen *
Kristian Høgsbergc356f582010-07-28 11:16:00 -0400829indirect_create_screen(int screen, struct glx_display * priv);
Kristian Høgsberg68499162010-07-28 16:40:43 -0400830extern struct glx_context *
831indirect_create_context(struct glx_screen *psc,
832 struct glx_config *mode,
833 struct glx_context *shareList, int renderType);
Tomasz Lis27c8aa52013-07-17 13:49:18 +0200834extern struct glx_context *
835indirect_create_context_attribs(struct glx_screen *base,
836 struct glx_config *config_base,
837 struct glx_context *shareList,
838 unsigned num_attribs,
839 const uint32_t *attribs,
840 unsigned *error);
Kristian Høgsberg6ec39db2010-07-23 16:15:31 -0400841
Adam Jacksona48a6b82017-11-14 15:13:05 -0500842
843extern int __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
844 int attribute, unsigned int *value);
845
Jose Fonseca52c74432016-04-26 19:48:12 +0100846#ifdef __cplusplus
847}
848#endif
849
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000850#endif /* !__GLX_client_h__ */