summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Chen <[email protected]>2017-08-07 08:34:51 -0700
committerEmil Velikov <[email protected]>2017-08-29 19:14:13 +0100
commit5d5a13e375038e7dd9e758c9cb681273a34289c8 (patch)
tree00997cc5a8ae83d014ac9c70b73e38126201fdc6
parent9d6d567046d40216478610bdc312b18e46f3de5f (diff)
egl/wayland: Use roundtrips when awaiting buffer release
In get_back_bo, we use wl_display_dispatch_queue() to block and wait for a buffer release event. However, not all Wayland compositors flush the client socket on posting a buffer-release event, so by only blocking client-side, we may block indefinitely, or at least need to wait for an input event / frame completion to arrive for the compositor to flush. We now use dispatch_queue as a first pass, but if our entire buffer pool is exhausted, use a roundtrip (an immediately-triggered wl_callback) to ensure that the compositor flushes out our release event immediately. [daniels: Modified comment and commit message.] Signed-off-by: Kai Chen <[email protected]> Reviewed-by: Daniel Stone <[email protected]> CC: <[email protected]> (cherry picked from commit 151188d1e330a7a5f110bbc8251680121a1a84a6)
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index ff35507d255..2bdbff90f73 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -403,8 +403,13 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
break;
/* If we don't have a buffer, then block on the server to release one for
- * us, and try again. */
- if (wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_surf->wl_queue) < 0)
+ * us, and try again. wl_display_dispatch_queue will process any pending
+ * events, however not all servers flush on issuing a buffer release
+ * event. So, we spam the server with roundtrips as they always cause a
+ * client flush.
+ */
+ if (wl_display_roundtrip_queue(dri2_dpy->wl_dpy,
+ dri2_surf->wl_queue) < 0)
return -1;
}