glxclient.h revision 38c51a76533a90cf2c9381c99247cfac45fe70eb
1/*
2 * 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 */
30
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_
40#include <X11/Xproto.h>
41#include <X11/Xlibint.h>
42#include <X11/Xfuncproto.h>
43#include <X11/extensions/extutil.h>
44#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>
50#ifdef WIN32
51#include <stdint.h>
52#endif
53#include "GL/glxproto.h"
54#include "glapi/glapitable.h"
55#include "glxconfig.h"
56#include "glxhash.h"
57#if defined( PTHREADS )
58# include <pthread.h>
59#endif
60
61#include "glxextensions.h"
62
63#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
64
65#define GLX_MAJOR_VERSION 1       /* current version numbers */
66#define GLX_MINOR_VERSION 4
67
68#define __GLX_MAX_TEXTURE_UNITS 32
69
70typedef struct __GLXscreenConfigsRec __GLXscreenConfigs;
71typedef struct __GLXcontextRec __GLXcontext;
72typedef struct __GLXdrawableRec __GLXdrawable;
73typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
74typedef struct _glapi_table __GLapi;
75
76/************************************************************************/
77
78#ifdef GLX_DIRECT_RENDERING
79
80extern void DRI_glXUseXFont(GLXContext CC,
81			    Font font, int first, int count, int listbase);
82
83#endif
84
85#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
86
87/**
88 * Display dependent methods.  This structure is initialized during the
89 * \c driCreateDisplay call.
90 */
91typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
92typedef struct __GLXDRIscreenRec __GLXDRIscreen;
93typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
94typedef struct __GLXDRIcontextRec __GLXDRIcontext;
95
96#include "glxextensions.h"
97
98struct __GLXDRIdisplayRec
99{
100    /**
101     * Method to destroy the private DRI display data.
102     */
103   void (*destroyDisplay) (__GLXDRIdisplay * display);
104
105   __GLXscreenConfigs *(*createScreen)(int screen, __GLXdisplayPrivate * priv);
106};
107
108struct __GLXDRIscreenRec {
109
110   void (*destroyScreen)(__GLXscreenConfigs *psc);
111
112   __GLXcontext *(*createContext)(__GLXscreenConfigs *psc,
113				  struct glx_config *config,
114				  GLXContext shareList, int renderType);
115
116   __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
117				       XID drawable,
118				       GLXDrawable glxDrawable,
119				       struct glx_config *config);
120
121   int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
122			  int64_t divisor, int64_t remainder);
123   void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
124			 int x, int y, int width, int height);
125   int (*getDrawableMSC)(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
126			 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);
132   int (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
133   int (*getSwapInterval)(__GLXDRIdrawable *pdraw);
134};
135
136struct __GLXDRIcontextRec
137{
138   Bool(*bindContext) (__GLXcontext *context, __GLXDRIdrawable *pdraw,
139		       __GLXDRIdrawable *pread);
140   void (*unbindContext) (__GLXcontext *context);
141};
142
143struct __GLXDRIdrawableRec
144{
145   void (*destroyDrawable) (__GLXDRIdrawable * drawable);
146
147   XID xDrawable;
148   XID drawable;
149   __GLXscreenConfigs *psc;
150   GLenum textureTarget;
151   GLenum textureFormat;        /* EXT_texture_from_pixmap support */
152   unsigned long eventMask;
153};
154
155/*
156** Function to create and DRI display data and initialize the display
157** dependent methods.
158*/
159extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
160extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
161extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
162extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
163
164
165/*
166** Functions to obtain driver configuration information from a direct
167** rendering client application
168*/
169extern const char *glXGetScreenDriver(Display * dpy, int scrNum);
170
171extern const char *glXGetDriverConfig(const char *driverName);
172
173#endif
174
175/************************************************************************/
176
177#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
178
179typedef struct __GLXpixelStoreModeRec
180{
181   GLboolean swapEndian;
182   GLboolean lsbFirst;
183   GLuint rowLength;
184   GLuint imageHeight;
185   GLuint imageDepth;
186   GLuint skipRows;
187   GLuint skipPixels;
188   GLuint skipImages;
189   GLuint alignment;
190} __GLXpixelStoreMode;
191
192
193typedef struct __GLXattributeRec
194{
195   GLuint mask;
196
197    /**
198     * Pixel storage state.  Most of the pixel store mode state is kept
199     * here and used by the client code to manage the packing and
200     * unpacking of data sent to/received from the server.
201     */
202   __GLXpixelStoreMode storePack, storeUnpack;
203
204    /**
205     * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
206     * disabled?
207     */
208   GLboolean NoDrawArraysProtocol;
209
210    /**
211     * Vertex Array storage state.  The vertex array component
212     * state is stored here and is used to manage the packing of
213     * DrawArrays data sent to the server.
214     */
215   struct array_state_vector *array_state;
216} __GLXattribute;
217
218typedef struct __GLXattributeMachineRec
219{
220   __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
221   __GLXattribute **stackPointer;
222} __GLXattributeMachine;
223
224struct glx_context_vtable {
225   void (*destroy)(__GLXcontext *ctx);
226   void (*wait_gl)(__GLXcontext *ctx);
227   void (*wait_x)(__GLXcontext *ctx);
228   void (*use_x_font)(__GLXcontext *ctx,
229		      Font font, int first, int count, int listBase);
230   void (*bind_tex_image)(Display * dpy,
231			  GLXDrawable drawable,
232			  int buffer, const int *attrib_list);
233   void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
234
235};
236
237extern void
238glx_send_destroy_context(Display *dpy, XID xid);
239
240/**
241 * GLX state that needs to be kept on the client.  One of these records
242 * exist for each context that has been made current by this client.
243 */
244struct __GLXcontextRec
245{
246    /**
247     * \name Drawing command buffer.
248     *
249     * Drawing commands are packed into this buffer before being sent as a
250     * single GLX protocol request.  The buffer is sent when it overflows or
251     * is flushed by \c __glXFlushRenderBuffer.  \c pc is the next location
252     * in the buffer to be filled.  \c limit is described above in the buffer
253     * slop discussion.
254     *
255     * Commands that require large amounts of data to be transfered will
256     * also use this buffer to hold a header that describes the large
257     * command.
258     *
259     * These must be the first 6 fields since they are static initialized
260     * in the dummy context in glxext.c
261     */
262   /*@{ */
263   GLubyte *buf;
264   GLubyte *pc;
265   GLubyte *limit;
266   GLubyte *bufEnd;
267   GLint bufSize;
268   /*@} */
269
270    /**
271     * The XID of this rendering context.  When the context is created a
272     * new XID is allocated.  This is set to None when the context is
273     * destroyed but is still current to some thread. In this case the
274     * context will be freed on next MakeCurrent.
275     */
276   XID xid;
277
278    /**
279     * The XID of the \c shareList context.
280     */
281   XID share_xid;
282
283    /**
284     * Screen number.
285     */
286   GLint screen;
287   __GLXscreenConfigs *psc;
288
289    /**
290     * \c GL_TRUE if the context was created with ImportContext, which
291     * means the server-side context was created by another X client.
292     */
293   GLboolean imported;
294
295    /**
296     * The context tag returned by MakeCurrent when this context is made
297     * current. This tag is used to identify the context that a thread has
298     * current so that proper server context management can be done.  It is
299     * used for all context specific commands (i.e., \c Render, \c RenderLarge,
300     * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
301     * context)).
302     */
303   GLXContextTag currentContextTag;
304
305    /**
306     * \name Rendering mode
307     *
308     * The rendering mode is kept on the client as well as the server.
309     * When \c glRenderMode is called, the buffer associated with the
310     * previous rendering mode (feedback or select) is filled.
311     */
312   /*@{ */
313   GLenum renderMode;
314   GLfloat *feedbackBuf;
315   GLuint *selectBuf;
316   /*@} */
317
318    /**
319     * This is \c GL_TRUE if the pixel unpack modes are such that an image
320     * can be unpacked from the clients memory by just copying.  It may
321     * still be true that the server will have to do some work.  This
322     * just promises that a straight copy will fetch the correct bytes.
323     */
324   GLboolean fastImageUnpack;
325
326    /**
327     * Fill newImage with the unpacked form of \c oldImage getting it
328     * ready for transport to the server.
329     */
330   void (*fillImage) (__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
331                      GLenum, const GLvoid *, GLubyte *, GLubyte *);
332
333    /**
334     * Client side attribs.
335     */
336   __GLXattributeMachine attributes;
337
338    /**
339     * Client side error code.  This is set when client side gl API
340     * routines need to set an error because of a bad enumerant or
341     * running out of memory, etc.
342     */
343   GLenum error;
344
345    /**
346     * Whether this context does direct rendering.
347     */
348   Bool isDirect;
349
350    /**
351     * \c dpy of current display for this context.  Will be \c NULL if not
352     * current to any display, or if this is the "dummy context".
353     */
354   Display *currentDpy;
355
356    /**
357     * The current drawable for this context.  Will be None if this
358     * context is not current to any drawable.  currentReadable is below.
359     */
360   GLXDrawable currentDrawable;
361
362    /**
363     * \name GL Constant Strings
364     *
365     * Constant strings that describe the server implementation
366     * These pertain to GL attributes, not to be confused with
367     * GLX versioning attributes.
368     */
369   /*@{ */
370   GLubyte *vendor;
371   GLubyte *renderer;
372   GLubyte *version;
373   GLubyte *extensions;
374   /*@} */
375
376    /**
377     * Maximum small render command size.  This is the smaller of 64k and
378     * the size of the above buffer.
379     */
380   GLint maxSmallRenderCommandSize;
381
382    /**
383     * Major opcode for the extension.  Copied here so a lookup isn't
384     * needed.
385     */
386   GLint majorOpcode;
387
388    /**
389     * Pointer to the config used to create this context.
390     */
391   struct glx_config *config;
392
393#ifdef GLX_DIRECT_RENDERING
394#ifdef GLX_USE_APPLEGL
395   void *driContext;
396   Bool do_destroy;
397#else
398   __GLXDRIcontext *driContext;
399#endif
400#endif
401
402    /**
403     * The current read-drawable for this context.  Will be None if this
404     * context is not current to any drawable.
405     *
406     * \since Internal API version 20030606.
407     */
408   GLXDrawable currentReadable;
409
410   /**
411    * Pointer to client-state data that is private to libGL.  This is only
412    * used for indirect rendering contexts.
413    *
414    * No internal API version change was made for this change.  Client-side
415    * drivers should NEVER use this data or even care that it exists.
416    */
417   void *client_state_private;
418
419   /**
420    * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
421    */
422   int renderType;
423
424   /**
425    * \name Raw server GL version
426    *
427    * True core GL version supported by the server.  This is the raw value
428    * returned by the server, and it may not reflect what is actually
429    * supported (or reported) by the client-side library.
430    */
431   /*@{ */
432   int server_major;        /**< Major version number. */
433   int server_minor;        /**< Minor version number. */
434   /*@} */
435
436   /**
437    * Thread ID we're currently current in. Zero if none.
438    */
439   unsigned long thread_id;
440
441   char gl_extension_bits[__GL_EXT_BYTES];
442
443   const struct glx_context_vtable *vtable;
444};
445
446extern Bool
447glx_context_init(__GLXcontext *gc,
448		 __GLXscreenConfigs *psc, struct glx_config *fbconfig);
449
450#define __glXSetError(gc,code)  \
451   if (!(gc)->error) {          \
452      (gc)->error = code;       \
453   }
454
455extern void __glFreeAttributeState(__GLXcontext *);
456
457/************************************************************************/
458
459/**
460 * The size of the largest drawing command known to the implementation
461 * that will use the GLXRender GLX command.  In this case it is
462 * \c glPolygonStipple.
463 */
464#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
465
466/**
467 * To keep the implementation fast, the code uses a "limit" pointer
468 * to determine when the drawing command buffer is too full to hold
469 * another fixed size command.  This constant defines the amount of
470 * space that must always be available in the drawing command buffer
471 * at all times for the implementation to work.  It is important that
472 * the number be just large enough, but not so large as to reduce the
473 * efficacy of the buffer.  The "+32" is just to keep the code working
474 * in case somebody counts wrong.
475 */
476#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
477
478/**
479 * This implementation uses a smaller threshold for switching
480 * to the RenderLarge protocol than the protcol requires so that
481 * large copies don't occur.
482 */
483#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
484
485/**
486 * One of these records exists per screen of the display.  It contains
487 * a pointer to the config data for that screen (if the screen supports GL).
488 */
489struct glx_screen_vtable {
490   __GLXcontext *(*create_context)(__GLXscreenConfigs *psc,
491				   struct glx_config *config,
492				   GLXContext shareList, int renderType);
493};
494
495struct __GLXscreenConfigsRec
496{
497   const struct glx_screen_vtable *vtable;
498
499    /**
500     * GLX extension string reported by the X-server.
501     */
502   const char *serverGLXexts;
503
504    /**
505     * GLX extension string to be reported to applications.  This is the
506     * set of extensions that the application can actually use.
507     */
508   char *effectiveGLXexts;
509
510   __GLXdisplayPrivate *display;
511
512#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
513    /**
514     * Per screen direct rendering interface functions and data.
515     */
516   Display *dpy;
517   int scr;
518
519   __GLXDRIscreen *driScreen;
520#endif
521
522    /**
523     * Linked list of glx visuals and  fbconfigs for this screen.
524     */
525   struct glx_config *visuals, *configs;
526
527    /**
528     * Per-screen dynamic GLX extension tracking.  The \c direct_support
529     * field only contains enough bits for 64 extensions.  Should libGL
530     * ever need to track more than 64 GLX extensions, we can safely grow
531     * this field.  The \c __GLXscreenConfigs structure is not used outside
532     * libGL.
533     */
534   /*@{ */
535   unsigned char direct_support[8];
536   GLboolean ext_list_first_time;
537   /*@} */
538
539};
540
541/**
542 * Per display private data.  One of these records exists for each display
543 * that is using the OpenGL (GLX) extension.
544 */
545struct __GLXdisplayPrivateRec
546{
547   /* The extension protocol codes */
548   XExtCodes *codes;
549   struct __GLXdisplayPrivateRec *next;
550
551    /**
552     * Back pointer to the display
553     */
554   Display *dpy;
555
556    /**
557     * The \c majorOpcode is common to all connections to the same server.
558     * It is also copied into the context structure.
559     */
560   int majorOpcode;
561
562    /**
563     * \name Server Version
564     *
565     * Major and minor version returned by the server during initialization.
566     */
567   /*@{ */
568   int majorVersion, minorVersion;
569   /*@} */
570
571    /**
572     * \name Storage for the servers GLX vendor and versions strings.
573     *
574     * These are the same for all screens on this display. These fields will
575     * be filled in on demand.
576     */
577   /*@{ */
578   const char *serverGLXvendor;
579   const char *serverGLXversion;
580   /*@} */
581
582    /**
583     * Configurations of visuals for all screens on this display.
584     * Also, per screen data which now includes the server \c GLX_EXTENSION
585     * string.
586     */
587   __GLXscreenConfigs **screenConfigs;
588
589#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
590   __glxHashTable *drawHash;
591
592    /**
593     * Per display direct rendering interface functions and data.
594     */
595   __GLXDRIdisplay *driswDisplay;
596   __GLXDRIdisplay *driDisplay;
597   __GLXDRIdisplay *dri2Display;
598#endif
599};
600
601extern int
602glx_screen_init(__GLXscreenConfigs *psc,
603		int screen, __GLXdisplayPrivate * priv);
604
605#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
606extern __GLXDRIdrawable *
607dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
608#endif
609
610extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
611
612extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
613                                GLint totalRequests,
614                                const GLvoid * data, GLint dataLen);
615
616extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
617                                  const GLvoid *, GLint);
618
619/* Initialize the GLX extension for dpy */
620extern __GLXdisplayPrivate *__glXInitialize(Display *);
621
622extern void __glXPreferEGL(int state);
623
624/************************************************************************/
625
626extern int __glXDebug;
627
628/* This is per-thread storage in an MT environment */
629#if defined( PTHREADS )
630
631extern void __glXSetCurrentContext(__GLXcontext * c);
632
633# if defined( GLX_USE_TLS )
634
635extern __thread void *__glX_tls_Context
636   __attribute__ ((tls_model("initial-exec")));
637
638#  define __glXGetCurrentContext() __glX_tls_Context
639
640# else
641
642extern __GLXcontext *__glXGetCurrentContext(void);
643
644# endif /* defined( GLX_USE_TLS ) */
645
646#else
647
648extern __GLXcontext *__glXcurrentContext;
649#define __glXGetCurrentContext() __glXcurrentContext
650#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
651
652#endif /* defined( PTHREADS ) */
653
654extern void __glXSetCurrentContextNull(void);
655
656
657/*
658** Global lock for all threads in this address space using the GLX
659** extension
660*/
661#if defined( PTHREADS )
662extern pthread_mutex_t __glXmutex;
663#define __glXLock()    pthread_mutex_lock(&__glXmutex)
664#define __glXUnlock()  pthread_mutex_unlock(&__glXmutex)
665#else
666#define __glXLock()
667#define __glXUnlock()
668#endif
669
670/*
671** Setup for a command.  Initialize the extension for dpy if necessary.
672*/
673extern CARD8 __glXSetupForCommand(Display * dpy);
674
675/************************************************************************/
676
677/*
678** Data conversion and packing support.
679*/
680
681extern const GLuint __glXDefaultPixelStore[9];
682
683/* Send an image to the server using RenderLarge. */
684extern void __glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
685                                GLint width, GLint height, GLint depth,
686                                GLenum format, GLenum type,
687                                const GLvoid * src, GLubyte * pc,
688                                GLubyte * modes);
689
690/* Return the size, in bytes, of some pixel data */
691extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
692
693/* Return the number of elements per group of a specified format*/
694extern GLint __glElementsPerGroup(GLenum format, GLenum type);
695
696/* Return the number of bytes per element, based on the element type (other
697** than GL_BITMAP).
698*/
699extern GLint __glBytesPerElement(GLenum type);
700
701/*
702** Fill the transport buffer with the data from the users buffer,
703** applying some of the pixel store modes (unpack modes) to the data
704** first.  As a side effect of this call, the "modes" field is
705** updated to contain the modes needed by the server to decode the
706** sent data.
707*/
708extern void __glFillImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
709                          GLenum, const GLvoid *, GLubyte *, GLubyte *);
710
711/* Copy map data with a stride into a packed buffer */
712extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
713extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
714extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
715                          const GLfloat *, GLfloat *);
716extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
717                          const GLdouble *, GLdouble *);
718
719/*
720** Empty an image out of the reply buffer into the clients memory applying
721** the pack modes to pack back into the clients requested format.
722*/
723extern void __glEmptyImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
724                           GLenum, const GLubyte *, GLvoid *);
725
726
727/*
728** Allocate and Initialize Vertex Array client state, and free.
729*/
730extern void __glXInitVertexArrayState(__GLXcontext *);
731extern void __glXFreeVertexArrayState(__GLXcontext *);
732
733/*
734** Inform the Server of the major and minor numbers and of the client
735** libraries extension string.
736*/
737extern void __glXClientInfo(Display * dpy, int opcode);
738
739/************************************************************************/
740
741/*
742** Declarations that should be in Xlib
743*/
744#ifdef __GL_USE_OUR_PROTOTYPES
745extern void _XFlush(Display *);
746extern Status _XReply(Display *, xReply *, int, Bool);
747extern void _XRead(Display *, void *, long);
748extern void _XSend(Display *, const void *, long);
749#endif
750
751
752extern void __glXInitializeVisualConfigFromTags(struct glx_config * config,
753                                                int count, const INT32 * bp,
754                                                Bool tagged_only,
755                                                Bool fbconfig_style_tags);
756
757extern char *__glXQueryServerString(Display * dpy, int opcode,
758                                    CARD32 screen, CARD32 name);
759extern char *__glXGetString(Display * dpy, int opcode,
760                            CARD32 screen, CARD32 name);
761
762extern char *__glXstrdup(const char *str);
763
764
765extern const char __glXGLClientVersion[];
766extern const char __glXGLClientExtensions[];
767
768/* Get the unadjusted system time */
769extern int __glXGetUST(int64_t * ust);
770
771extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
772                                    int32_t * numerator,
773                                    int32_t * denominator);
774
775#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
776extern GLboolean
777__glxGetMscRate(__GLXDRIdrawable *glxDraw,
778		int32_t * numerator, int32_t * denominator);
779
780/* So that dri2.c:DRI2WireToEvent() can access
781 * glx_info->codes->first_event */
782XExtDisplayInfo *__glXFindDisplay (Display *dpy);
783
784extern void
785GarbageCollectDRIDrawables(__GLXscreenConfigs *psc);
786
787extern __GLXDRIdrawable *
788GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable);
789
790#endif
791
792extern __GLXscreenConfigs *
793indirect_create_screen(int screen, __GLXdisplayPrivate * priv);
794
795#endif /* !__GLX_client_h__ */
796