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 * SPDX-License-Identifier: SGI-B-2.0 6 */ 7 8 /** 9 * \file glxclient.h 10 * Direct rendering support added by Precision Insight, Inc. 11 * 12 * \author Kevin E. Martin <kevin@precisioninsight.com> 13 */ 14 15 #ifndef _GLX_client_h_ 16 #define _GLX_client_h_ 17 #include <X11/Xproto.h> 18 #include <X11/Xlibint.h> 19 #include <X11/Xfuncproto.h> 20 #include <X11/extensions/extutil.h> 21 #define GLX_GLXEXT_PROTOTYPES 22 #include <GL/glx.h> 23 #include <GL/glxext.h> 24 #include <string.h> 25 #include <stdlib.h> 26 #include <stdio.h> 27 #include <stdint.h> 28 #include <pthread.h> 29 #include "GL/glxproto.h" 30 #include "glxconfig.h" 31 #include "glxhash.h" 32 #include "util/macros.h" 33 #include "util/u_thread.h" 34 #include "util/set.h" 35 #include "loader.h" 36 #include "glxextensions.h" 37 38 #if defined(USE_LIBGLVND) 39 #define _GLX_PUBLIC _X_HIDDEN 40 #else 41 #define _GLX_PUBLIC _X_EXPORT 42 #endif 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 extern void glx_message(int level, const char *f, ...) PRINTFLIKE(2, 3); 49 50 #define DebugMessageF(...) glx_message(_LOADER_DEBUG, __VA_ARGS__) 51 #define InfoMessageF(...) glx_message(_LOADER_INFO, __VA_ARGS__) 52 #define ErrorMessageF(...) glx_message(_LOADER_WARNING, __VA_ARGS__) 53 #define CriticalErrorMessageF(...) glx_message(_LOADER_FATAL, __VA_ARGS__) 54 55 56 #define GLX_MAJOR_VERSION 1 /* current version numbers */ 57 #define GLX_MINOR_VERSION 4 58 59 struct glx_display; 60 struct glx_context; 61 62 /************************************************************************/ 63 64 #ifdef GLX_DIRECT_RENDERING 65 66 extern void DRI_glXUseXFont(struct glx_context *ctx, 67 Font font, int first, int count, int listbase); 68 69 #endif 70 71 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 72 73 /** 74 * Display dependent methods. This structure is initialized during the 75 * \c driCreateDisplay call. 76 */ 77 typedef struct __GLXDRIdisplayRec __GLXDRIdisplay; 78 typedef struct __GLXDRIscreenRec __GLXDRIscreen; 79 typedef struct __GLXDRIdrawableRec __GLXDRIdrawable; 80 81 #define GLX_LOADER_USE_ZINK ((struct glx_screen *)(uintptr_t)-1) 82 83 struct __GLXDRIdisplayRec 84 { 85 /** 86 * Method to destroy the private DRI display data. 87 */ 88 void (*destroyDisplay) (__GLXDRIdisplay * display); 89 90 struct glx_screen *(*createScreen)(int screen, struct glx_display * priv); 91 }; 92 93 struct __GLXDRIscreenRec { 94 95 void (*destroyScreen)(struct glx_screen *psc); 96 97 __GLXDRIdrawable *(*createDrawable)(struct glx_screen *psc, 98 XID drawable, 99 GLXDrawable glxDrawable, 100 int type, 101 struct glx_config *config); 102 103 int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc, 104 int64_t divisor, int64_t remainder, Bool flush); 105 void (*copySubBuffer)(__GLXDRIdrawable *pdraw, 106 int x, int y, int width, int height, Bool flush); 107 int (*getDrawableMSC)(struct glx_screen *psc, __GLXDRIdrawable *pdraw, 108 int64_t *ust, int64_t *msc, int64_t *sbc); 109 int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc, 110 int64_t divisor, int64_t remainder, int64_t *ust, 111 int64_t *msc, int64_t *sbc); 112 int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust, 113 int64_t *msc, int64_t *sbc); 114 int (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval); 115 int (*getSwapInterval)(__GLXDRIdrawable *pdraw); 116 int (*getBufferAge)(__GLXDRIdrawable *pdraw); 117 void (*bindTexImage)(__GLXDRIdrawable *pdraw, int buffer, const int *attribs); 118 void (*releaseTexImage)(__GLXDRIdrawable *pdraw, int buffer); 119 120 int maxSwapInterval; 121 }; 122 123 struct __GLXDRIdrawableRec 124 { 125 void (*destroyDrawable) (__GLXDRIdrawable * drawable); 126 127 XID xDrawable; 128 XID drawable; 129 struct glx_screen *psc; 130 GLenum textureTarget; 131 GLenum textureFormat; /* EXT_texture_from_pixmap support */ 132 unsigned long eventMask; 133 int refcount; 134 }; 135 136 /* 137 ** Function to create and DRI display data and initialize the display 138 ** dependent methods. 139 */ 140 extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy, bool zink); 141 extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy); 142 extern __GLXDRIdisplay *dri3_create_display(Display * dpy); 143 extern __GLXDRIdisplay *driwindowsCreateDisplay(Display * dpy); 144 145 /* 146 ** 147 */ 148 extern void dri2InvalidateBuffers(Display *dpy, XID drawable); 149 extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable); 150 151 /* 152 ** Functions to obtain driver configuration information from a direct 153 ** rendering client application 154 */ 155 extern const char *glXGetScreenDriver(Display * dpy, int scrNum); 156 157 extern const char *glXGetDriverConfig(const char *driverName); 158 159 #endif 160 161 /************************************************************************/ 162 163 #define __GL_CLIENT_ATTRIB_STACK_DEPTH 16 164 165 typedef struct __GLXpixelStoreModeRec 166 { 167 GLboolean swapEndian; 168 GLboolean lsbFirst; 169 GLuint rowLength; 170 GLuint imageHeight; 171 GLuint imageDepth; 172 GLuint skipRows; 173 GLuint skipPixels; 174 GLuint skipImages; 175 GLuint alignment; 176 } __GLXpixelStoreMode; 177 178 179 typedef struct __GLXattributeRec 180 { 181 GLuint mask; 182 183 /** 184 * Pixel storage state. Most of the pixel store mode state is kept 185 * here and used by the client code to manage the packing and 186 * unpacking of data sent to/received from the server. 187 */ 188 __GLXpixelStoreMode storePack, storeUnpack; 189 190 /** 191 * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically 192 * disabled? 193 */ 194 GLboolean NoDrawArraysProtocol; 195 196 /** 197 * Vertex Array storage state. The vertex array component 198 * state is stored here and is used to manage the packing of 199 * DrawArrays data sent to the server. 200 */ 201 struct array_state_vector *array_state; 202 } __GLXattribute; 203 204 typedef struct __GLXattributeMachineRec 205 { 206 __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; 207 __GLXattribute **stackPointer; 208 } __GLXattributeMachine; 209 210 struct mesa_glinterop_device_info; 211 struct mesa_glinterop_export_in; 212 struct mesa_glinterop_export_out; 213 struct mesa_glinterop_flush_out; 214 215 struct glx_context_vtable { 216 void (*destroy)(struct glx_context *ctx); 217 int (*bind)(struct glx_context *context, GLXDrawable draw, GLXDrawable read); 218 void (*unbind)(struct glx_context *context); 219 void (*wait_gl)(struct glx_context *ctx); 220 void (*wait_x)(struct glx_context *ctx); 221 int (*interop_query_device_info)(struct glx_context *ctx, 222 struct mesa_glinterop_device_info *out); 223 int (*interop_export_object)(struct glx_context *ctx, 224 struct mesa_glinterop_export_in *in, 225 struct mesa_glinterop_export_out *out); 226 int (*interop_flush_objects)(struct glx_context *ctx, 227 unsigned count, struct mesa_glinterop_export_in *objects, 228 struct mesa_glinterop_flush_out *out); 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 */ 235 struct 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 transferred 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 struct glx_screen *psc; 277 278 /** 279 * \c GL_TRUE if the context was created with ImportContext, which 280 * means the server-side context was created by another X client. 281 */ 282 GLboolean imported; 283 284 /** 285 * The context tag returned by MakeCurrent when this context is made 286 * current. This tag is used to identify the context that a thread has 287 * current so that proper server context management can be done. It is 288 * used for all context specific commands (i.e., \c Render, \c RenderLarge, 289 * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old 290 * context)). 291 */ 292 GLXContextTag currentContextTag; 293 294 /** 295 * \name Rendering mode 296 * 297 * The rendering mode is kept on the client as well as the server. 298 * When \c glRenderMode is called, the buffer associated with the 299 * previous rendering mode (feedback or select) is filled. 300 */ 301 /*@{ */ 302 GLenum renderMode; 303 GLfloat *feedbackBuf; 304 GLuint *selectBuf; 305 /*@} */ 306 307 /** 308 * Client side attribs. 309 */ 310 __GLXattributeMachine attributes; 311 312 /** 313 * Client side error code. This is set when client side gl API 314 * routines need to set an error because of a bad enumerant or 315 * running out of memory, etc. 316 */ 317 GLenum error; 318 319 /** 320 * Whether this context does direct rendering. 321 */ 322 Bool isDirect; 323 324 /* Backend private state for the context */ 325 void *driContext; 326 327 /** 328 * \c dpy of current display for this context. Will be \c NULL if not 329 * current to any display, or if this is the "dummy context". 330 */ 331 Display *currentDpy; 332 333 /** 334 * The current drawable for this context. Will be None if this 335 * context is not current to any drawable. currentReadable is below. 336 */ 337 GLXDrawable currentDrawable; 338 339 /** 340 * \name GL Constant Strings 341 * 342 * Constant strings that describe the server implementation 343 * These pertain to GL attributes, not to be confused with 344 * GLX versioning attributes. 345 */ 346 /*@{ */ 347 GLubyte *vendor; 348 GLubyte *renderer; 349 GLubyte *version; 350 GLubyte *extensions; 351 /*@} */ 352 353 /** 354 * Maximum small render command size. This is the smaller of 64k and 355 * the size of the above buffer. 356 */ 357 GLint maxSmallRenderCommandSize; 358 359 /** 360 * Major opcode for the extension. Copied here so a lookup isn't 361 * needed. 362 */ 363 GLint majorOpcode; 364 365 /** 366 * Pointer to the config used to create this context. 367 */ 368 struct glx_config *config; 369 370 /** 371 * The current read-drawable for this context. Will be None if this 372 * context is not current to any drawable. 373 * 374 * \since Internal API version 20030606. 375 */ 376 GLXDrawable currentReadable; 377 378 /** 379 * Pointer to client-state data that is private to libGL. This is only 380 * used for indirect rendering contexts. 381 * 382 * No internal API version change was made for this change. Client-side 383 * drivers should NEVER use this data or even care that it exists. 384 */ 385 void *client_state_private; 386 387 /** 388 * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE. 389 */ 390 int renderType; 391 392 /** 393 * \name Raw server GL version 394 * 395 * True core GL version supported by the server. This is the raw value 396 * returned by the server, and it may not reflect what is actually 397 * supported (or reported) by the client-side library. 398 */ 399 /*@{ */ 400 int server_major; /**< Major version number. */ 401 int server_minor; /**< Minor version number. */ 402 /*@} */ 403 404 /** 405 * GLX_ARB_create_context_no_error setting for this context. 406 * This needs to be kept here to enforce shared context rules. 407 */ 408 Bool noError; 409 410 char gl_extension_bits[__GL_EXT_BYTES]; 411 }; 412 413 extern Bool 414 glx_context_init(struct glx_context *gc, 415 struct glx_screen *psc, struct glx_config *fbconfig); 416 417 #define __glXSetError(gc,code) \ 418 if (!(gc)->error) { \ 419 (gc)->error = code; \ 420 } 421 422 /************************************************************************/ 423 424 /** 425 * The size of the largest drawing command known to the implementation 426 * that will use the GLXRender GLX command. In this case it is 427 * \c glPolygonStipple. 428 */ 429 #define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156 430 431 /** 432 * To keep the implementation fast, the code uses a "limit" pointer 433 * to determine when the drawing command buffer is too full to hold 434 * another fixed size command. This constant defines the amount of 435 * space that must always be available in the drawing command buffer 436 * at all times for the implementation to work. It is important that 437 * the number be just large enough, but not so large as to reduce the 438 * efficacy of the buffer. The "+32" is just to keep the code working 439 * in case somebody counts wrong. 440 */ 441 #define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32) 442 443 /** 444 * This implementation uses a smaller threshold for switching 445 * to the RenderLarge protocol than the protocol requires so that 446 * large copies don't occur. 447 */ 448 #define __GLX_RENDER_CMD_SIZE_LIMIT 4096 449 450 /** 451 * One of these records exists per screen of the display. It contains 452 * a pointer to the config data for that screen (if the screen supports GL). 453 */ 454 struct glx_screen_vtable { 455 struct glx_context *(*create_context)(struct glx_screen *psc, 456 struct glx_config *config, 457 struct glx_context *shareList, 458 int renderType); 459 460 /* The error outparameter abuses the fact that the only possible errors are 461 * GLXBadContext (0), GLXBadFBConfig (9), GLXBadProfileARB (13), BadValue 462 * (2), BadMatch (8), and BadAlloc (11). Since those don't collide we just 463 * use them directly rather than try to offset or use a sign convention. 464 */ 465 struct glx_context *(*create_context_attribs)(struct glx_screen *psc, 466 struct glx_config *config, 467 struct glx_context *shareList, 468 unsigned num_attrib, 469 const uint32_t *attribs, 470 unsigned *error); 471 int (*query_renderer_integer)(struct glx_screen *psc, 472 int attribute, 473 unsigned int *value); 474 int (*query_renderer_string)(struct glx_screen *psc, 475 int attribute, 476 const char **value); 477 478 char *(*get_driver_name)(struct glx_screen *psc); 479 }; 480 481 struct glx_screen 482 { 483 const struct glx_screen_vtable *vtable; 484 const struct glx_context_vtable *context_vtable; 485 486 /** 487 * \name Storage for the GLX vendor, version, and extension strings 488 */ 489 /*@{ */ 490 const char *serverGLXexts; 491 const char *serverGLXvendor; 492 const char *serverGLXversion; 493 /*@} */ 494 495 /** 496 * GLX extension string to be reported to applications. This is the 497 * set of extensions that the application can actually use. 498 */ 499 char *effectiveGLXexts; 500 501 struct glx_display *display; 502 503 Display *dpy; 504 int scr; 505 bool force_direct_context; 506 bool allow_invalid_glx_destroy_window; 507 bool keep_native_window_glx_drawable; 508 509 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 510 /** 511 * Per screen direct rendering interface functions and data. 512 */ 513 __GLXDRIscreen *driScreen; 514 #endif 515 516 /** 517 * Linked list of glx visuals and fbconfigs for this screen. 518 */ 519 struct glx_config *visuals, *configs; 520 521 /** 522 * Per-screen dynamic GLX extension tracking. The \c direct_support 523 * field only contains enough bits for 64 extensions. Should libGL 524 * ever need to track more than 64 GLX extensions, we can safely grow 525 * this field. The \c struct glx_screen structure is not used outside 526 * libGL. 527 */ 528 /*@{ */ 529 unsigned char direct_support[__GLX_EXT_BYTES]; 530 GLboolean ext_list_first_time; 531 532 unsigned char glx_force_enabled[__GLX_EXT_BYTES]; 533 unsigned char glx_force_disabled[__GLX_EXT_BYTES]; 534 535 unsigned char gl_force_enabled[__GL_EXT_BYTES]; 536 unsigned char gl_force_disabled[__GL_EXT_BYTES]; 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 */ 545 struct glx_display 546 { 547 struct glx_display *next; 548 549 /* The extension protocol codes */ 550 XExtCodes codes; 551 552 /** 553 * Back pointer to the display 554 */ 555 Display *dpy; 556 557 /** 558 * \name Minor Version 559 * 560 * Minor version returned by the server during initialization. The major 561 * version is asserted to be 1 during extension setup. 562 */ 563 /*@{ */ 564 int minorVersion; 565 /*@} */ 566 567 /** 568 * Configurations of visuals for all screens on this display. 569 * Also, per screen data which now includes the server \c GLX_EXTENSION 570 * string. 571 */ 572 struct glx_screen **screens; 573 574 __glxHashTable *glXDrawHash; 575 576 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 577 __glxHashTable *drawHash; 578 579 /** 580 * GLXDrawable created from native window and about to be released. 581 */ 582 struct set *zombieGLXDrawable; 583 584 /** 585 * Per display direct rendering interface functions and data. 586 */ 587 __GLXDRIdisplay *driswDisplay; 588 __GLXDRIdisplay *dri2Display; 589 __GLXDRIdisplay *dri3Display; 590 #endif 591 #ifdef GLX_USE_WINDOWSGL 592 __GLXDRIdisplay *windowsdriDisplay; 593 #endif 594 }; 595 596 struct glx_drawable { 597 XID xDrawable; 598 XID drawable; 599 600 uint32_t lastEventSbc; 601 int64_t eventSbcWrap; 602 }; 603 604 extern int 605 glx_screen_init(struct glx_screen *psc, 606 int screen, struct glx_display * priv); 607 extern void 608 glx_screen_cleanup(struct glx_screen *psc); 609 610 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 611 extern __GLXDRIdrawable * 612 dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id); 613 #endif 614 615 extern GLubyte *__glXFlushRenderBuffer(struct glx_context *, GLubyte *); 616 617 extern void __glXSendLargeChunk(struct glx_context * gc, GLint requestNumber, 618 GLint totalRequests, 619 const GLvoid * data, GLint dataLen); 620 621 extern void __glXSendLargeCommand(struct glx_context *, const GLvoid *, GLint, 622 const GLvoid *, GLint); 623 624 /* Initialize the GLX extension for dpy */ 625 extern struct glx_display *__glXInitialize(Display *); 626 627 /************************************************************************/ 628 629 extern int __glXDebug; 630 631 /* This is per-thread storage in an MT environment */ 632 633 extern void __glXSetCurrentContext(struct glx_context * c); 634 635 extern __THREAD_INITIAL_EXEC void *__glX_tls_Context; 636 637 # define __glXGetCurrentContext() __glX_tls_Context 638 639 extern void __glXSetCurrentContextNull(void); 640 641 642 /* 643 ** Global lock for all threads in this address space using the GLX 644 ** extension 645 */ 646 extern pthread_mutex_t __glXmutex; 647 #define __glXLock() pthread_mutex_lock(&__glXmutex) 648 #define __glXUnlock() pthread_mutex_unlock(&__glXmutex) 649 650 /* 651 ** Setup for a command. Initialize the extension for dpy if necessary. 652 */ 653 extern CARD8 __glXSetupForCommand(Display * dpy); 654 655 /************************************************************************/ 656 657 /* 658 ** Data conversion and packing support. 659 */ 660 661 extern const GLuint __glXDefaultPixelStore[9]; 662 663 /* Send an image to the server using RenderLarge. */ 664 extern void __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, 665 GLint width, GLint height, GLint depth, 666 GLenum format, GLenum type, 667 const GLvoid * src, GLubyte * pc, 668 GLubyte * modes); 669 670 /* Return the size, in bytes, of some pixel data */ 671 extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum); 672 673 /* Return the number of elements per group of a specified format*/ 674 extern GLint __glElementsPerGroup(GLenum format, GLenum type); 675 676 /* Return the number of bytes per element, based on the element type (other 677 ** than GL_BITMAP). 678 */ 679 extern GLint __glBytesPerElement(GLenum type); 680 681 /* 682 ** Fill the transport buffer with the data from the users buffer, 683 ** applying some of the pixel store modes (unpack modes) to the data 684 ** first. As a side effect of this call, the "modes" field is 685 ** updated to contain the modes needed by the server to decode the 686 ** sent data. 687 */ 688 extern void __glFillImage(struct glx_context *, GLint, GLint, GLint, GLint, GLenum, 689 GLenum, const GLvoid *, GLubyte *, GLubyte *); 690 691 /* Copy map data with a stride into a packed buffer */ 692 extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *); 693 extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *); 694 extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint, 695 const GLfloat *, GLfloat *); 696 extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint, 697 const GLdouble *, GLdouble *); 698 699 /* 700 ** Empty an image out of the reply buffer into the clients memory applying 701 ** the pack modes to pack back into the clients requested format. 702 */ 703 extern void __glEmptyImage(struct glx_context *, GLint, GLint, GLint, GLint, GLenum, 704 GLenum, const GLubyte *, GLvoid *); 705 706 707 /* 708 ** Allocate and Initialize Vertex Array client state, and free. 709 */ 710 extern void __glXInitVertexArrayState(struct glx_context *); 711 extern void __glXFreeVertexArrayState(struct glx_context *); 712 713 extern void glxSendClientInfo(struct glx_display *glx_dpy, int screen); 714 715 /************************************************************************/ 716 717 extern void __glXInitializeVisualConfigFromTags(struct glx_config * config, 718 int count, const INT32 * bp, 719 Bool tagged_only, 720 Bool fbconfig_style_tags); 721 722 extern char *__glXQueryServerString(Display *dpy, CARD32 screen, CARD32 name); 723 extern char *__glXGetString(Display *dpy, CARD32 screen, CARD32 name); 724 725 extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, 726 int32_t * numerator, 727 int32_t * denominator); 728 729 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 730 extern GLboolean 731 __glxGetMscRate(struct glx_screen *psc, 732 int32_t * numerator, int32_t * denominator); 733 734 /* So that dri2.c:DRI2WireToEvent() can access 735 * glx_info->codes->first_event */ 736 XExtDisplayInfo *__glXFindDisplay (Display *dpy); 737 738 extern __GLXDRIdrawable * 739 GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable); 740 #endif 741 742 extern struct glx_screen *GetGLXScreenConfigs(Display * dpy, int scrn); 743 744 #ifdef GLX_USE_APPLEGL 745 extern struct glx_screen * 746 applegl_create_screen(int screen, struct glx_display * priv); 747 748 extern struct glx_context * 749 applegl_create_context(struct glx_screen *psc, 750 struct glx_config *mode, 751 struct glx_context *shareList, int renderType); 752 753 extern int 754 applegl_create_display(struct glx_display *display); 755 756 extern void * 757 applegl_get_proc_address(const char *symbol); 758 #endif 759 760 extern Bool validate_renderType_against_config(const struct glx_config *config, 761 int renderType); 762 763 764 extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable); 765 extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw, 766 XID xDrawable, GLXDrawable drawable); 767 extern void DestroyGLXDrawable(Display *dpy, GLXDrawable drawable); 768 769 extern struct glx_context dummyContext; 770 771 extern struct glx_screen * 772 indirect_create_screen(int screen, struct glx_display * priv); 773 extern struct glx_context * 774 indirect_create_context(struct glx_screen *psc, 775 struct glx_config *mode, 776 struct glx_context *shareList, int renderType); 777 extern struct glx_context * 778 indirect_create_context_attribs(struct glx_screen *base, 779 struct glx_config *config_base, 780 struct glx_context *shareList, 781 unsigned num_attribs, 782 const uint32_t *attribs, 783 unsigned *error); 784 785 786 extern int __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable, 787 int attribute, unsigned int *value); 788 789 #ifdef __cplusplus 790 } 791 #endif 792 793 #endif /* !__GLX_client_h__ */ 794