diff options
-rw-r--r-- | glx/glxdri2.c | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c index edd29b0e1..79d7767cc 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -95,6 +95,7 @@ struct __GLXDRIdrawable { int height; __DRIbuffer buffers[MAX_DRAWABLE_BUFFERS]; int count; + XID dri2ref; }; static void @@ -107,8 +108,10 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable) /* If the X window was destroyed, the dri DestroyWindow hook will * aready have taken care of this, so only call if pDraw isn't NULL. */ - if (drawable->pDraw != NULL) + if (drawable->pDraw != NULL) { + FreeResource(private->dri2ref, RT_NONE); DRI2DestroyDrawable(drawable->pDraw); + } __glXDrawableRelease(drawable); @@ -217,15 +220,8 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) __GLXDRIscreen *screen = priv->screen; CARD64 unused; -#if __DRI2_FLUSH_VERSION >= 3 - if (screen->flush) { - (*screen->flush->flush)(priv->driDrawable); - (*screen->flush->invalidate)(priv->driDrawable); - } -#else if (screen->flush) - (*screen->flush->flushInvalidate)(priv->driDrawable); -#endif + (*screen->flush->flush)(priv->driDrawable); if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, __glXdriSwapEvent, drawable->pDraw) != Success) @@ -474,6 +470,16 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, return &private->base; } +static void +__glXDRIinvalidateEvent(DrawablePtr pDraw, void *priv) +{ + __GLXDRIdrawable *draw = priv; + __GLXDRIscreen *screen = draw->screen; + + if (screen->flush) + screen->flush->invalidate(draw->driDrawable); +} + static __DRIbuffer * dri2GetBuffers(__DRIdrawable *driDrawable, int *width, int *height, @@ -482,16 +488,20 @@ dri2GetBuffers(__DRIdrawable *driDrawable, { __GLXDRIdrawable *private = loaderPrivate; DRI2BufferPtr *buffers; - int i; - int j; + int i, j, ret; - buffers = DRI2GetBuffers(private->base.pDraw, - width, height, attachments, count, out_count); + buffers = DRI2GetBuffers(private->base.pDraw, width, height, attachments, + count, out_count); if (*out_count > MAX_DRAWABLE_BUFFERS) { *out_count = 0; return NULL; } - + + ret = DRI2TrackClient(private->base.pDraw, serverClient, + __glXDRIinvalidateEvent, private, &private->dri2ref); + if (ret != Success) + return NULL; + private->width = *width; private->height = *height; @@ -526,7 +536,7 @@ dri2GetBuffersWithFormat(__DRIdrawable *driDrawable, { __GLXDRIdrawable *private = loaderPrivate; DRI2BufferPtr *buffers; - int i; + int i, ret; int j = 0; buffers = DRI2GetBuffersWithFormat(private->base.pDraw, @@ -537,6 +547,11 @@ dri2GetBuffersWithFormat(__DRIdrawable *driDrawable, return NULL; } + ret = DRI2TrackClient(private->base.pDraw, serverClient, + __glXDRIinvalidateEvent, private, &private->dri2ref); + if (ret != Success) + return NULL; + private->width = *width; private->height = *height; |