[Mesa-dev] [PATCH] Mesa (master): egl/wayland: Replace wl_display_dispatch_queue with wl_display_roundtrip_queue
kai.chen at intel.com
kai.chen at intel.com
Mon Aug 7 15:34:51 UTC 2017
From: Kai Chen <kai.chen at intel.com>
In function get_back_bo, wl_display_dispatch_queue is used to block on
the server to release one buffer. But it seems this function will block
client as well during polling. Because in some scenarios, such as when
surfaces are moved frequently between two displays under weston
compositor, the screen update will stall frequently and the performance
will drop.
wl_display_roundtrip_queue actually calls into
wl_display_dispatch_queue. But it blocks until the server has processed
all currently issued requests by sending a request first to the display
server and then waiting for a reply. In this way, it seems the client is
not blocked and in the test scenario case above, the performance seems
obviously not to be impacted.
Signed-off-by: Kai Chen <kai.chen at intel.com>
CC: <mesa-stable at lists.freedesktop.org>
---
src/egl/drivers/dri2/platform_wayland.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 73966b7..a74be0d 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -398,8 +398,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_roundtrip_queue blocks until the server has processed all
+ * currently issued requests. In fact, It calls wl_display_dispatch_queue
+ * by sending a request first to the display server and then waiting for
+ * a reply before returning without holding client too long. */
+ if (wl_display_roundtrip_queue(dri2_dpy->wl_dpy,
+ dri2_surf->wl_queue) < 0)
return -1;
}
--
2.9.4
More information about the mesa-dev
mailing list