summaryrefslogtreecommitdiff
path: root/src/glx/dri2_glx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r--src/glx/dri2_glx.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 15a3ea5907..29d589cdb9 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -67,6 +67,7 @@ struct __GLXDRIdisplayPrivateRec
int driMinor;
int driPatch;
int swapAvailable;
+ int invalidateAvailable;
};
struct __GLXDRIcontextPrivateRec
@@ -310,12 +311,18 @@ dri2WaitGL(__GLXDRIdrawable * pdraw)
XFixesDestroyRegion(pdraw->psc->dpy, region);
}
-
static void
-dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate)
{
- (void) driDrawable;
- dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
+ __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
+ __GLXdisplayPrivate *priv = __glXInitialize(pdraw->base.psc->dpy);
+ __GLXDRIdisplayPrivate *pdp = (__GLXDRIdisplayPrivate *)priv->dri2Display;
+
+ /* Old servers don't send invalidate events */
+ if (!pdp->invalidateAvailable)
+ dri2InvalidateBuffers(priv->dpy, pdraw->base.xDrawable);
+
+ dri2WaitGL(loaderPrivate);
}
@@ -375,6 +382,10 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
(*pdraw->psc->f->flush)(pdraw->driDrawable);
#endif
+ /* Old servers don't send invalidate events */
+ if (!pdp->invalidateAvailable)
+ dri2InvalidateBuffers(dpyPriv->dpy, pdraw->xDrawable);
+
/* Old servers can't handle swapbuffers */
if (!pdp->swapAvailable) {
dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
@@ -386,11 +397,6 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
remainder, &ret);
#endif
-#if __DRI2_FLUSH_VERSION >= 2
- if (pdraw->psc->f)
- (*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable);
-#endif
-
return ret;
}
@@ -485,6 +491,17 @@ static const __DRIextension *loader_extensions_old[] = {
NULL
};
+_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);
+#endif
+}
+
static __GLXDRIscreen *
dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
__GLXdisplayPrivate * priv)
@@ -651,11 +668,8 @@ dri2CreateDisplay(Display * dpy)
}
pdp->driPatch = 0;
- pdp->swapAvailable = 0;
-#ifdef X_DRI2SwapBuffers
- if (pdp->driMinor >= 2)
- pdp->swapAvailable = 1;
-#endif
+ pdp->swapAvailable = (pdp->driMinor >= 2);
+ pdp->invalidateAvailable = (pdp->driMinor >= 3);
pdp->base.destroyDisplay = dri2DestroyDisplay;
pdp->base.createScreen = dri2CreateScreen;