[PATCH weston 08/18] toytoolkit: Make the window resizing optimization optional

ppaalanen at gmail.com ppaalanen at gmail.com
Wed May 22 08:03:11 PDT 2013


From: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>

Whether or not a shm pool is used for resizing is now configurable at
build time (--disable-resize-optimization).

[pq: removed an unnecessary hunk from the patch]
---
 clients/window.c | 2 ++
 configure.ac     | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/clients/window.c b/clients/window.c
index 627f1e8..3f54111 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1004,6 +1004,7 @@ shm_surface_prepare(struct toysurface *base, int dx, int dy,
 	if (leaf->cairo_surface)
 		cairo_surface_destroy(leaf->cairo_surface);
 
+#ifdef USE_RESIZE_POOL
 	if (resize_hint && !leaf->resize_pool) {
 		/* Create a big pool to allocate from, while continuously
 		 * resizing. Mmapping a new pool in the server
@@ -1014,6 +1015,7 @@ shm_surface_prepare(struct toysurface *base, int dx, int dy,
 		leaf->resize_pool = shm_pool_create(surface->display,
 						    6 * 1024 * 1024);
 	}
+#endif
 
 	leaf->cairo_surface =
 		display_create_shm_surface(surface->display, &rect,
diff --git a/configure.ac b/configure.ac
index 2aec1bb..323bd87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -239,6 +239,13 @@ if test x$enable_clients = xyes; then
   PKG_CHECK_MODULES(PANGO, [pangocairo], [have_pango=yes], [have_pango=no])
 fi
 
+AC_ARG_ENABLE(resize-optimization,
+              AS_HELP_STRING([--disable-resize-optimization],
+                             [disable resize optimization allocating a big buffer in toytoolkit]),,
+              enable_resize_optimization=yes)
+AS_IF([test "x$enable_resize_optimization" = "xyes"],
+      [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
+
 AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
 AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
 if test x$enable_weston_launch == xyes; then
-- 
1.8.1.5



More information about the wayland-devel mailing list