aboutsummaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorJasper St. Pierre <[email protected]>2014-06-24 13:43:53 -0400
committerDave Airlie <[email protected]>2014-06-27 09:44:56 +1000
commitb4dcf87f34f68111acd9d364739938721fc692f4 (patch)
treec6ec355cd8b0911353f149f8f225863b1b18077c /src/glx
parent8cf289c3ef2fcaded5a89f9d7a600f60a5e8356e (diff)
glxext: Send the Drawable's ID in the GLX_BufferSwapComplete event
While the official INTEL_swap_event specification says that the drawable field should contain the GLXDrawable, not the Drawable, the existing DRI2 code in dri2.c that translates from DRI2_BufferSwapComplete sends out GLX_BufferSwapComplete with the Drawable's ID, so existing codebases like Clutter/Cogl rely on getting the Drawable. Match DRI2's error here and stuff the event with the X Drawable, not the GLX drawable. This fixes apps seeing wrong drawables through an indirect GLX context or with DRI3, which uses the GLX_BufferSwapComplete event directly on the wire instead of translates Present in mesa. At the same time, also modify the structure for the event to make sure that clients don't make the same mistake. This is not an API or ABI break, as GLXDrawable and Drawable are both typedefs for XID. Signed-off-by: Jasper St. Pierre <[email protected]> Reviewed-by: Axel Davy <[email protected]> Cc: "10.1 10.2" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/glxext.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 94582f6b2e8..68c359e6e2c 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -134,14 +134,15 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
xGLXBufferSwapComplete2 *awire = (xGLXBufferSwapComplete2 *)wire;
struct glx_drawable *glxDraw = GetGLXDrawable(dpy, awire->drawable);
- aevent->event_type = awire->event_type;
- aevent->drawable = awire->drawable;
- aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
- aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
if (!glxDraw)
return False;
+ aevent->event_type = awire->event_type;
+ aevent->drawable = glxDraw->xDrawable;
+ aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+ aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+
if (awire->sbc < glxDraw->lastEventSbc)
glxDraw->eventSbcWrap += 0x100000000;
glxDraw->lastEventSbc = awire->sbc;