wayland: avoid dropping surfaces when possible
authorChristian Hergert <christian@hergert.me>
Thu, 17 Mar 2016 06:35:20 +0000 (23:35 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 22 Mar 2016 02:03:20 +0000 (22:03 -0400)
If the configure-event gives us the same size as we had before,
which is common for animation resizes, then try to keep the
existing buffer around. This saves us a memfd_create() syscall
on every frame.

https://bugzilla.gnome.org/show_bug.cgi?id=763350

gdk/wayland/gdkwindow-wayland.c

index 707b2dcb438a2b9c79627c50f8665a23a9d6c530..46255ef2775c172be52bb1fb3741347e4d7085b2 100644 (file)
@@ -256,6 +256,11 @@ gdk_wayland_window_update_size (GdkWindow *window,
   GdkRectangle area;
   cairo_region_t *region;
 
+  if ((window->width == width) &&
+      (window->height == height) &&
+      (impl->scale == scale))
+    return;
+
   drop_cairo_surfaces (window);
 
   window->width = width;