X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2Fdri2.c;h=f00b96525aad1c6942ea8ebbfe768a456694260a;hb=108d257a16859898f5ce02f4759c5c58f9b8c050;hp=bcd1f9c90117d8105fb01dcbc0751d6fa08b2de4;hpb=8c472b8f6a612a810aec34283d90bb5aa88bf855;p=mesa.git diff --git a/src/glx/dri2.c b/src/glx/dri2.c index bcd1f9c9011..f00b96525aa 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -38,7 +38,6 @@ #include #include #include -#include "xf86drm.h" #include "dri2.h" #include "glxclient.h" #include "GL/glxext.h" @@ -54,7 +53,8 @@ static char dri2ExtensionName[] = DRI2_NAME; -static XExtensionInfo *dri2Info; +static XExtensionInfo _dri2Info_data; +static XExtensionInfo *dri2Info = &_dri2Info_data; static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info) static Bool @@ -94,7 +94,6 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) switch ((wire->u.u.type & 0x7f) - info->codes->first_event) { -#ifdef X_DRI2SwapBuffers case DRI2_BufferSwapComplete: { GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; @@ -102,6 +101,8 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) __GLXDRIdrawable *pdraw; pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable); + if (pdraw == NULL) + return False; /* Ignore swap events if we're not looking for them */ aevent->type = dri2GetSwapEventType(dpy, awire->drawable); @@ -130,15 +131,17 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; glxDraw = GetGLXDrawable(dpy, pdraw->drawable); - if (awire->sbc < glxDraw->lastEventSbc) - glxDraw->eventSbcWrap += 0x100000000; - glxDraw->lastEventSbc = awire->sbc; - aevent->sbc = awire->sbc + glxDraw->eventSbcWrap; + if (glxDraw != NULL) { + if (awire->sbc < glxDraw->lastEventSbc) + glxDraw->eventSbcWrap += 0x100000000; + glxDraw->lastEventSbc = awire->sbc; + aevent->sbc = awire->sbc + glxDraw->eventSbcWrap; + } else { + aevent->sbc = awire->sbc; + } return True; } -#endif -#ifdef DRI2_InvalidateBuffers case DRI2_InvalidateBuffers: { xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire; @@ -146,7 +149,6 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) dri2InvalidateBuffers(dpy, awire->drawable); return False; } -#endif default: /* client doesn't support server event */ break; @@ -279,7 +281,6 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName) req->window = window; req->driverType = DRI2DriverDRI; -#ifdef DRI2DriverPrimeShift { char *prime = getenv("DRI_PRIME"); if (prime) { @@ -291,7 +292,6 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName) ((primeid & DRI2DriverPrimeMask) << DRI2DriverPrimeShift); } } -#endif if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { UnlockDisplay(dpy);