console: skip same-size resize
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 26 Aug 2016 09:47:11 +0000 (13:47 +0400)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 28 Sep 2016 10:49:26 +0000 (12:49 +0200)
virtio-gpu does a set-scanout at each frame (it might be a driver
regression). qemu_console_resize() recreate a surface even if the size
didn't change, and this shows up in profiling reports because the
surface is cleared. With this patch, I get a +15-20% glmark2
improvement.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20160826094711.14470-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/console.c

index 3940762851a6886d7a12bd67991a051e33a69146..394786b3c792cbfd78ec467f3b62fa1d44499e30 100644 (file)
@@ -2101,6 +2101,13 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
     DisplaySurface *surface;
 
     assert(s->console_type == GRAPHIC_CONSOLE);
+
+    if (s->surface &&
+        pixman_image_get_width(s->surface->image) == width &&
+        pixman_image_get_height(s->surface->image) == height) {
+        return;
+    }
+
     surface = qemu_create_displaysurface(width, height);
     dpy_gfx_replace_surface(s, surface);
 }