Lines Matching +full:xquartz +full:-
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
33 * GLX protocol interface boot-strap code.
54 #include <X11/Xlib-xcb.h>
105 * a GLX event, and then handle the various sub-event types there, rather in XEXT_GENERATE_ERROR_STRING()
117 switch ((wire->u.u.type & 0x7f) - glx_dpy->codes->first_event) { in XEXT_GENERATE_ERROR_STRING()
122 aevent->event_type = awire->type; in XEXT_GENERATE_ERROR_STRING()
123 aevent->serial = awire->sequenceNumber; in XEXT_GENERATE_ERROR_STRING()
124 aevent->event_type = awire->event_type; in XEXT_GENERATE_ERROR_STRING()
125 aevent->draw_type = awire->draw_type; in XEXT_GENERATE_ERROR_STRING()
126 aevent->drawable = awire->drawable; in XEXT_GENERATE_ERROR_STRING()
127 aevent->buffer_mask = awire->buffer_mask; in XEXT_GENERATE_ERROR_STRING()
128 aevent->aux_buffer = awire->aux_buffer; in XEXT_GENERATE_ERROR_STRING()
129 aevent->x = awire->x; in XEXT_GENERATE_ERROR_STRING()
130 aevent->y = awire->y; in XEXT_GENERATE_ERROR_STRING()
131 aevent->width = awire->width; in XEXT_GENERATE_ERROR_STRING()
132 aevent->height = awire->height; in XEXT_GENERATE_ERROR_STRING()
133 aevent->count = awire->count; in XEXT_GENERATE_ERROR_STRING()
140 struct glx_drawable *glxDraw = GetGLXDrawable(dpy, awire->drawable); in XEXT_GENERATE_ERROR_STRING()
145 aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); in XEXT_GENERATE_ERROR_STRING()
146 aevent->send_event = (awire->type & 0x80) != 0; in XEXT_GENERATE_ERROR_STRING()
147 aevent->display = dpy; in XEXT_GENERATE_ERROR_STRING()
148 aevent->event_type = awire->event_type; in XEXT_GENERATE_ERROR_STRING()
149 aevent->drawable = glxDraw->xDrawable; in XEXT_GENERATE_ERROR_STRING()
150 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; in XEXT_GENERATE_ERROR_STRING()
151 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; in XEXT_GENERATE_ERROR_STRING()
153 /* Handle 32-Bit wire sbc wraparound in both directions to cope with out in XEXT_GENERATE_ERROR_STRING()
154 * of sequence 64-Bit sbc's in XEXT_GENERATE_ERROR_STRING()
156 if ((int64_t) awire->sbc < ((int64_t) glxDraw->lastEventSbc - 0x40000000)) in XEXT_GENERATE_ERROR_STRING()
157 glxDraw->eventSbcWrap += 0x100000000; in XEXT_GENERATE_ERROR_STRING()
158 if ((int64_t) awire->sbc > ((int64_t) glxDraw->lastEventSbc + 0x40000000)) in XEXT_GENERATE_ERROR_STRING()
159 glxDraw->eventSbcWrap -= 0x100000000; in XEXT_GENERATE_ERROR_STRING()
160 glxDraw->lastEventSbc = awire->sbc; in XEXT_GENERATE_ERROR_STRING()
161 aevent->sbc = awire->sbc + glxDraw->eventSbcWrap; in XEXT_GENERATE_ERROR_STRING()
183 switch (event->type) { in __glXEventToWire()
214 screens = ScreenCount(priv->dpy); in FreeScreenConfigs()
216 psc = priv->screens[i]; in FreeScreenConfigs()
220 if (psc->driScreen) { in FreeScreenConfigs()
221 psc->driScreen->destroyScreen(psc); in FreeScreenConfigs()
229 free((char *) priv->screens); in FreeScreenConfigs()
230 priv->screens = NULL; in FreeScreenConfigs()
239 if (priv->dpy == gc->currentDpy) { in glx_display_free()
240 gc->vtable->destroy(gc); in glx_display_free()
245 free((char *) priv->serverGLXvendor); in glx_display_free()
246 free((char *) priv->serverGLXversion); in glx_display_free()
248 __glxHashDestroy(priv->glXDrawHash); in glx_display_free()
251 __glxHashDestroy(priv->drawHash); in glx_display_free()
254 if (priv->driswDisplay) in glx_display_free()
255 (*priv->driswDisplay->destroyDisplay) (priv->driswDisplay); in glx_display_free()
256 priv->driswDisplay = NULL; in glx_display_free()
259 if (priv->driDisplay) in glx_display_free()
260 (*priv->driDisplay->destroyDisplay) (priv->driDisplay); in glx_display_free()
261 priv->driDisplay = NULL; in glx_display_free()
263 if (priv->dri2Display) in glx_display_free()
264 (*priv->dri2Display->destroyDisplay) (priv->dri2Display); in glx_display_free()
265 priv->dri2Display = NULL; in glx_display_free()
267 if (priv->dri3Display) in glx_display_free()
268 (*priv->dri3Display->destroyDisplay) (priv->dri3Display); in glx_display_free()
269 priv->dri3Display = NULL; in glx_display_free()
273 if (priv->windowsdriDisplay) in glx_display_free()
274 (*priv->windowsdriDisplay->destroyDisplay) (priv->windowsdriDisplay); in glx_display_free()
275 priv->windowsdriDisplay = NULL; in glx_display_free()
290 for (priv = glx_displays; priv; prev = &priv->next, priv = priv->next) { in __glXCloseDisplay()
291 if (priv->dpy == dpy) { in __glXCloseDisplay()
292 *prev = priv->next; in __glXCloseDisplay()
322 if (reply->major_version != GLX_MAJOR_VERSION) { in QueryVersion()
326 *major = reply->major_version; in QueryVersion()
327 *minor = min(reply->minor_version, GLX_MINOR_VERSION); in QueryVersion()
371 config->visualID = *bp++; in __glXInitializeVisualConfigFromTags()
373 config->visualType = convert_from_x_visual_type(*bp++); in __glXInitializeVisualConfigFromTags()
375 config->rgbMode = *bp++; in __glXInitializeVisualConfigFromTags()
377 config->redBits = *bp++; in __glXInitializeVisualConfigFromTags()
378 config->greenBits = *bp++; in __glXInitializeVisualConfigFromTags()
379 config->blueBits = *bp++; in __glXInitializeVisualConfigFromTags()
380 config->alphaBits = *bp++; in __glXInitializeVisualConfigFromTags()
381 config->accumRedBits = *bp++; in __glXInitializeVisualConfigFromTags()
382 config->accumGreenBits = *bp++; in __glXInitializeVisualConfigFromTags()
383 config->accumBlueBits = *bp++; in __glXInitializeVisualConfigFromTags()
384 config->accumAlphaBits = *bp++; in __glXInitializeVisualConfigFromTags()
386 config->doubleBufferMode = *bp++; in __glXInitializeVisualConfigFromTags()
387 config->stereoMode = *bp++; in __glXInitializeVisualConfigFromTags()
389 config->rgbBits = *bp++; in __glXInitializeVisualConfigFromTags()
390 config->depthBits = *bp++; in __glXInitializeVisualConfigFromTags()
391 config->stencilBits = *bp++; in __glXInitializeVisualConfigFromTags()
392 config->numAuxBuffers = *bp++; in __glXInitializeVisualConfigFromTags()
393 config->level = *bp++; in __glXInitializeVisualConfigFromTags()
397 config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT; in __glXInitializeVisualConfigFromTags()
399 count -= 18; in __glXInitializeVisualConfigFromTags()
401 count -= __GLX_MIN_CONFIG_PROPS; in __glXInitializeVisualConfigFromTags()
405 config->sRGBCapable = GL_FALSE; in __glXInitializeVisualConfigFromTags()
414 config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1 in __glXInitializeVisualConfigFromTags()
424 config->rgbBits = *bp++; in __glXInitializeVisualConfigFromTags()
427 config->level = *bp++; in __glXInitializeVisualConfigFromTags()
436 config->numAuxBuffers = *bp++; in __glXInitializeVisualConfigFromTags()
439 config->redBits = *bp++; in __glXInitializeVisualConfigFromTags()
442 config->greenBits = *bp++; in __glXInitializeVisualConfigFromTags()
445 config->blueBits = *bp++; in __glXInitializeVisualConfigFromTags()
448 config->alphaBits = *bp++; in __glXInitializeVisualConfigFromTags()
451 config->depthBits = *bp++; in __glXInitializeVisualConfigFromTags()
454 config->stencilBits = *bp++; in __glXInitializeVisualConfigFromTags()
457 config->accumRedBits = *bp++; in __glXInitializeVisualConfigFromTags()
460 config->accumGreenBits = *bp++; in __glXInitializeVisualConfigFromTags()
463 config->accumBlueBits = *bp++; in __glXInitializeVisualConfigFromTags()
466 config->accumAlphaBits = *bp++; in __glXInitializeVisualConfigFromTags()
469 config->visualRating = *bp++; in __glXInitializeVisualConfigFromTags()
472 config->visualType = *bp++; in __glXInitializeVisualConfigFromTags()
475 config->transparentPixel = *bp++; in __glXInitializeVisualConfigFromTags()
478 config->transparentIndex = *bp++; in __glXInitializeVisualConfigFromTags()
481 config->transparentRed = *bp++; in __glXInitializeVisualConfigFromTags()
484 config->transparentGreen = *bp++; in __glXInitializeVisualConfigFromTags()
487 config->transparentBlue = *bp++; in __glXInitializeVisualConfigFromTags()
490 config->transparentAlpha = *bp++; in __glXInitializeVisualConfigFromTags()
493 config->visualID = *bp++; in __glXInitializeVisualConfigFromTags()
496 config->drawableType = *bp++; in __glXInitializeVisualConfigFromTags()
499 config->drawableType |= GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT; in __glXInitializeVisualConfigFromTags()
506 config->xRenderable = *bp++; in __glXInitializeVisualConfigFromTags()
509 config->fbconfigID = *bp++; in __glXInitializeVisualConfigFromTags()
512 config->maxPbufferWidth = *bp++; in __glXInitializeVisualConfigFromTags()
515 config->maxPbufferHeight = *bp++; in __glXInitializeVisualConfigFromTags()
518 config->maxPbufferPixels = *bp++; in __glXInitializeVisualConfigFromTags()
522 config->optimalPbufferWidth = *bp++; in __glXInitializeVisualConfigFromTags()
525 config->optimalPbufferHeight = *bp++; in __glXInitializeVisualConfigFromTags()
528 config->visualSelectGroup = *bp++; in __glXInitializeVisualConfigFromTags()
534 config->swapMethod = *bp++; in __glXInitializeVisualConfigFromTags()
539 config->swapMethod = GLX_SWAP_UNDEFINED_OML; in __glXInitializeVisualConfigFromTags()
545 config->sampleBuffers = *bp++; in __glXInitializeVisualConfigFromTags()
548 config->samples = *bp++; in __glXInitializeVisualConfigFromTags()
557 config->bindToTextureRgb = *bp++; in __glXInitializeVisualConfigFromTags()
560 config->bindToTextureRgba = *bp++; in __glXInitializeVisualConfigFromTags()
563 config->bindToMipmapTexture = *bp++; in __glXInitializeVisualConfigFromTags()
566 config->bindToTextureTargets = *bp++; in __glXInitializeVisualConfigFromTags()
569 config->yInverted = *bp++; in __glXInitializeVisualConfigFromTags()
573 config->sRGBCapable = *bp++; in __glXInitializeVisualConfigFromTags()
597 config->renderType = renderType; in __glXInitializeVisualConfigFromTags()
598 config->floatMode = (renderType & in __glXInitializeVisualConfigFromTags()
602 * config->rgbMode. The only way to communicate that the config is in __glXInitializeVisualConfigFromTags()
603 * floating-point is via GLX_RENDER_TYPE, so this cannot be a float in __glXInitializeVisualConfigFromTags()
606 config->renderType = in __glXInitializeVisualConfigFromTags()
607 (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; in __glXInitializeVisualConfigFromTags()
615 if (config->floatMode) in __glXInitializeVisualConfigFromTags()
616 config->drawableType &= GLX_PBUFFER_BIT; in __glXInitializeVisualConfigFromTags()
654 m->drawableType = GLX_WINDOW_BIT; in createConfigsFromProperties()
657 * The XQuartz 2.3.2.1 X server doesn't set this properly, so in createConfigsFromProperties()
661 m->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT; in createConfigsFromProperties()
665 m->screen = screen; in createConfigsFromProperties()
666 m = m->next; in createConfigsFromProperties()
681 Display *dpy = priv->dpy; in getVisualConfigs()
685 psc->visuals = NULL; in getVisualConfigs()
687 req->reqType = priv->majorOpcode; in getVisualConfigs()
688 req->glxCode = X_GLXGetVisualConfigs; in getVisualConfigs()
689 req->screen = screen; in getVisualConfigs()
694 psc->visuals = createConfigsFromProperties(dpy, in getVisualConfigs()
701 return psc->visuals != NULL; in getVisualConfigs()
711 Display *dpy = priv->dpy; in getFBConfigs()
713 psc->serverGLXexts = in getFBConfigs()
714 __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); in getFBConfigs()
716 if (psc->serverGLXexts == NULL) { in getFBConfigs()
722 psc->configs = NULL; in getFBConfigs()
723 if (atof(priv->serverGLXversion) >= 1.3) { in getFBConfigs()
725 fb_req->reqType = priv->majorOpcode; in getFBConfigs()
726 fb_req->glxCode = X_GLXGetFBConfigs; in getFBConfigs()
727 fb_req->screen = screen; in getFBConfigs()
729 else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) { in getFBConfigs()
731 sz_xGLXGetFBConfigsSGIXReq - in getFBConfigs()
734 sgi_req->reqType = priv->majorOpcode; in getFBConfigs()
735 sgi_req->glxCode = X_GLXVendorPrivateWithReply; in getFBConfigs()
736 sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX; in getFBConfigs()
737 sgi_req->screen = screen; in getFBConfigs()
745 psc->configs = createConfigsFromProperties(dpy, in getFBConfigs()
752 return psc->configs != NULL; in getFBConfigs()
760 psc->ext_list_first_time = GL_TRUE; in glx_screen_init()
761 psc->scr = screen; in glx_screen_init()
762 psc->dpy = priv->dpy; in glx_screen_init()
763 psc->display = priv; in glx_screen_init()
777 if (psc->configs) { in glx_screen_cleanup()
778 glx_config_destroy_list(psc->configs); in glx_screen_cleanup()
779 free(psc->effectiveGLXexts); in glx_screen_cleanup()
780 psc->configs = NULL; /* NOTE: just for paranoia */ in glx_screen_cleanup()
782 if (psc->visuals) { in glx_screen_cleanup()
783 glx_config_destroy_list(psc->visuals); in glx_screen_cleanup()
784 psc->visuals = NULL; /* NOTE: just for paranoia */ in glx_screen_cleanup()
786 free((char *) psc->serverGLXexts); in glx_screen_cleanup()
803 priv->screens = malloc(screens * sizeof *priv->screens); in AllocAndFetchScreenConfigs()
804 if (!priv->screens) in AllocAndFetchScreenConfigs()
807 priv->serverGLXversion = in AllocAndFetchScreenConfigs()
808 __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION); in AllocAndFetchScreenConfigs()
809 if (priv->serverGLXversion == NULL) { in AllocAndFetchScreenConfigs()
819 if (priv->dri3Display) in AllocAndFetchScreenConfigs()
820 psc = (*priv->dri3Display->createScreen) (i, priv); in AllocAndFetchScreenConfigs()
822 if (psc == NULL && priv->dri2Display) in AllocAndFetchScreenConfigs()
823 psc = (*priv->dri2Display->createScreen) (i, priv); in AllocAndFetchScreenConfigs()
824 if (psc == NULL && priv->driDisplay) in AllocAndFetchScreenConfigs()
825 psc = (*priv->driDisplay->createScreen) (i, priv); in AllocAndFetchScreenConfigs()
829 if (psc == NULL && priv->windowsdriDisplay) in AllocAndFetchScreenConfigs()
830 psc = (*priv->windowsdriDisplay->createScreen) (i, priv); in AllocAndFetchScreenConfigs()
833 if (psc == NULL && priv->driswDisplay) in AllocAndFetchScreenConfigs()
834 psc = (*priv->driswDisplay->createScreen) (i, priv); in AllocAndFetchScreenConfigs()
844 priv->screens[i] = psc; in AllocAndFetchScreenConfigs()
864 for (dpyPriv = glx_displays; dpyPriv; dpyPriv = dpyPriv->next) { in __glXInitialize()
865 if (dpyPriv->dpy == dpy) { in __glXInitialize()
878 dpyPriv->codes = XInitExtension(dpy, __glXExtensionName); in __glXInitialize()
879 if (!dpyPriv->codes) { in __glXInitialize()
884 dpyPriv->dpy = dpy; in __glXInitialize()
885 dpyPriv->majorOpcode = dpyPriv->codes->major_opcode; in __glXInitialize()
886 dpyPriv->serverGLXvendor = 0x0; in __glXInitialize()
887 dpyPriv->serverGLXversion = 0x0; in __glXInitialize()
892 if (!QueryVersion(dpy, dpyPriv->majorOpcode, in __glXInitialize()
893 &dpyPriv->majorVersion, &dpyPriv->minorVersion) in __glXInitialize()
894 || (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion < 1)) { in __glXInitialize()
900 XESetWireToEvent(dpy, dpyPriv->codes->first_event + i, __glXWireToEvent); in __glXInitialize()
901 XESetEventToWire(dpy, dpyPriv->codes->first_event + i, __glXEventToWire); in __glXInitialize()
904 XESetCloseDisplay(dpy, dpyPriv->codes->extension, __glXCloseDisplay); in __glXInitialize()
905 XESetErrorString (dpy, dpyPriv->codes->extension,__glXErrorString); in __glXInitialize()
907 dpyPriv->glXDrawHash = __glxHashCreate(); in __glXInitialize()
913 dpyPriv->drawHash = __glxHashCreate(); in __glXInitialize()
924 dpyPriv->dri3Display = dri3_create_display(dpy); in __glXInitialize()
926 dpyPriv->dri2Display = dri2CreateDisplay(dpy); in __glXInitialize()
927 dpyPriv->driDisplay = driCreateDisplay(dpy); in __glXInitialize()
931 dpyPriv->driswDisplay = driswCreateDisplay(dpy); in __glXInitialize()
943 dpyPriv->windowsdriDisplay = driwindowsCreateDisplay(dpy); in __glXInitialize()
957 for (d = glx_displays; d; d = d->next) { in __glXInitialize()
958 if (d->dpy == dpy) { in __glXInitialize()
965 dpyPriv->next = glx_displays; in __glXInitialize()
985 if (gc->currentDpy) { in __glXSetupForCommand()
987 (void) __glXFlushRenderBuffer(gc, gc->pc); in __glXSetupForCommand()
989 if (gc->currentDpy == dpy) { in __glXSetupForCommand()
991 return gc->majorOpcode; in __glXSetupForCommand()
1006 return priv->majorOpcode; in __glXSetupForCommand()
1016 * Modify this function to use \c ctx->pc instead of the explicit
1022 Display *const dpy = ctx->currentDpy; in __glXFlushRenderBuffer()
1024 const GLint size = pc - ctx->buf; in __glXFlushRenderBuffer()
1027 xcb_glx_render(c, ctx->currentContextTag, size, in __glXFlushRenderBuffer()
1028 (const uint8_t *) ctx->buf); in __glXFlushRenderBuffer()
1032 ctx->pc = ctx->buf; in __glXFlushRenderBuffer()
1033 return ctx->pc; in __glXFlushRenderBuffer()
1057 Display *dpy = gc->currentDpy; in __glXSendLargeChunk()
1059 xcb_glx_render_large(c, gc->currentContextTag, requestNumber, in __glXSendLargeChunk()
1092 maxSize = (ctx->bufSize + sz_xGLXRenderReq) - sz_xGLXRenderLargeReq; in __glXSendLargeCommand()
1106 for (requestNumber = 2; requestNumber <= (totalRequests - 1); in __glXSendLargeCommand()
1110 dataLen -= maxSize; in __glXSendLargeCommand()
1124 GLubyte *p = ctx->buf; in __glXDumpDrawBuffer()
1125 GLubyte *end = ctx->pc; in __glXDumpDrawBuffer()
1133 length -= 4; in __glXDumpDrawBuffer()
1138 length -= 4; in __glXDumpDrawBuffer()