diff options
author | Jesse Barnes <[email protected]> | 2011-05-06 10:31:24 -0700 |
---|---|---|
committer | Jesse Barnes <[email protected]> | 2011-07-08 12:38:20 -0700 |
commit | 4df137691ee29bb812347fa2c5f19095243ede22 (patch) | |
tree | d8785b7099a772d4993b3855e65173d0b090868d /src/glx/dri2.c | |
parent | 1e39fc784bc3d0d5ad01d9c147529ac0e10f1262 (diff) |
GLX/DRI2: handle swap event swap count wrapping
Create a new GLX drawable struct to track client related info, and add a
wrap counter to it drawable and track it as we receive events. This
allows us to support the full 64 bits of the event structure we pass to
the client even though the server only gives us a 32 bit count.
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-by: Jeremy Huddleston <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Diffstat (limited to 'src/glx/dri2.c')
-rw-r--r-- | src/glx/dri2.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c index 8654a37688f..229840d6919 100644 --- a/src/glx/dri2.c +++ b/src/glx/dri2.c @@ -88,6 +88,7 @@ static Bool DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); + struct glx_drawable *glxDraw; XextCheckExtension(dpy, info, dri2ExtensionName, False); @@ -98,6 +99,9 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) { GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire; + __GLXDRIdrawable *pdraw; + + pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable); /* Ignore swap events if we're not looking for them */ aevent->type = dri2GetSwapEventType(dpy, awire->drawable); @@ -124,7 +128,13 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) } aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; - aevent->sbc = awire->sbc; + + glxDraw = GetGLXDrawable(dpy, pdraw->drawable); + if (awire->sbc < glxDraw->lastEventSbc) + glxDraw->eventSbcWrap += 0x100000000; + glxDraw->lastEventSbc = awire->sbc; + aevent->sbc = awire->sbc + glxDraw->eventSbcWrap; + return True; } #endif |