From: Michel Dänzer <daen...@vmware.com> The guess can be wrong if the DRI driver loaded by the server doesn't support invalidate events.
Also check that the DRI driver actually has an invalidate hook before calling it. --- src/glx/dri2_glx.c | 28 +++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 6cd70be..b41bfe5 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -89,6 +89,7 @@ struct __GLXDRIdrawablePrivateRec }; static void dri2WaitX(__GLXDRIdrawable * pdraw); +static void dri2DoInvalidateBuffers(__GLXDRIdrawable *pdraw); static void dri2DestroyContext(__GLXDRIcontext * context, @@ -335,7 +336,7 @@ dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate) /* Old servers don't send invalidate events */ if (!pdp->invalidateAvailable) - dri2InvalidateBuffers(priv->dpy, pdraw->base.xDrawable); + dri2DoInvalidateBuffers(pdraw); dri2WaitGL(loaderPrivate); } @@ -399,7 +400,7 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, /* Old servers don't send invalidate events */ if (!pdp->invalidateAvailable) - dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable); + dri2DoInvalidateBuffers(pdraw); /* Old servers can't handle swapbuffers */ if (!pdp->swapAvailable) { @@ -506,14 +507,31 @@ static const __DRIextension *loader_extensions_old[] = { NULL }; +static void +dri2DoInvalidateBuffers(__GLXDRIdrawable *pdraw) +{ +#if __DRI2_FLUSH_VERSION >= 3 + if (pdraw->psc->f && pdraw->psc->f->base.version >= 3) + pdraw->psc->f->invalidate(pdraw->driDrawable); +#endif +} + _X_HIDDEN void dri2InvalidateBuffers(Display *dpy, XID drawable) { __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); #if __DRI2_FLUSH_VERSION >= 3 - if (pdraw && pdraw->psc->f) - pdraw->psc->f->invalidate(pdraw->driDrawable); + if (pdraw) { + __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw; + __GLXdisplayPrivate *dpyPriv = __glXInitialize(priv->base.psc->dpy); + __GLXDRIdisplayPrivate *pdp = + (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display; + + pdp->invalidateAvailable = GL_TRUE; + + dri2DoInvalidateBuffers(pdraw); + } #endif } @@ -684,7 +702,7 @@ dri2CreateDisplay(Display * dpy) pdp->driPatch = 0; pdp->swapAvailable = (pdp->driMinor >= 2); - pdp->invalidateAvailable = (pdp->driMinor >= 3); + pdp->invalidateAvailable = GL_FALSE; /* Will set to TRUE on event receipt */ pdp->base.destroyDisplay = dri2DestroyDisplay; pdp->base.createScreen = dri2CreateScreen; -- 1.7.0 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev