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