On 24/04/14 13:19, Frank Binns wrote:
Typically we want swaps to occur during vertical blank to avoid
tearing. However, when the swap interval is 0 we want to go
as quickly as possible even if this results in tearing.

Indicate to the X server that it should attempt to do an
asynchronise swap when the swap interval is 0.

Signed-off-by: Frank Binns <frank.bi...@imgtec.com>
---
  src/glx/dri3_glx.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index b7dac8e..e385723 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -1321,6 +1321,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t 
target_msc, int64_t divisor,
     xcb_connection_t *c = XGetXCBConnection(dpy);
     int buf_id = DRI3_BACK_ID(priv->cur_back);
     int64_t ret = 0;
+   uint32_t options = XCB_PRESENT_OPTION_NONE;
unsigned flags = __DRI2_FLUSH_DRAWABLE;
     if (flush)
@@ -1339,6 +1340,9 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t 
target_msc, int64_t divisor,
        if (target_msc == 0)
           target_msc = priv->msc + priv->swap_interval * (priv->send_sbc - 
priv->recv_sbc);
+ if (priv->swap_interval == 0)
+         options |= XCB_PRESENT_OPTION_ASYNC;
+
        priv->buffers[buf_id]->busy = 1;
        priv->buffers[buf_id]->last_swap = priv->send_sbc;
        xcb_present_pixmap(c,
@@ -1352,7 +1356,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t 
target_msc, int64_t divisor,
                           None,                                 /* target_crtc 
*/
                           None,
                           priv->buffers[buf_id]->sync_fence,
-                         XCB_PRESENT_OPTION_NONE,
+                         options,
                           target_msc,
                           divisor,
                           remainder, 0, NULL);

Ping
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to