diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-08-18 08:46:02 -0400 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2011-10-02 03:53:55 +0200 |
commit | 0502da1ade9d887ed4ee1a4b42ba01a5e78c8e6f (patch) | |
tree | 55733994bcbec578ed6efba2c88612441d8ee0ba | |
parent | bb38f931a8b883b50858462882e458424dd4ee3a (diff) |
glx: Don't flush twice if we fallback to dri2CopySubBuffer
The flush extensions flush call indicates end of frame and should only
be called once per frame. However, in the dri2SwapBuffer fallback
path, we call flush and then call dri2CopySubBuffer, which also calls
flush. Refactor the code to only call flush once.
(cherry picked from commit 4a7667b96b7bd7cdffbe929182c15935b74facd2)
-rw-r--r-- | src/glx/dri2_glx.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 80e4da30beb..f093f0f31ad 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -539,6 +539,11 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, (struct dri2_display *)dpyPriv->dri2Display; CARD64 ret = 0; + /* Old servers can't handle swapbuffers */ + if (!pdp->swapAvailable) { + dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height); + } else { +#ifdef X_DRI2SwapBuffers #ifdef __DRI2_FLUSH if (psc->f) { struct glx_context *gc = __glXGetCurrentContext(); @@ -549,21 +554,15 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, } #endif + DRI2SwapBuffers(psc->base.dpy, pdraw->xDrawable, + target_msc, divisor, remainder, &ret); +#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); - return 0; - } - -#ifdef X_DRI2SwapBuffers - DRI2SwapBuffers(psc->base.dpy, pdraw->xDrawable, target_msc, divisor, - remainder, &ret); -#endif - return ret; } |