]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
ui/vc: skip text console resize when possible
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 30 Aug 2023 09:38:14 +0000 (13:38 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 4 Sep 2023 10:24:08 +0000 (14:24 +0400)
This function is called on invalidate, on each cursor blink.

Avoid the extra copy when the console size didn't change.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230830093843.3531473-41-marcandre.lureau@redhat.com>

ui/console.c

index 0a48ce91591fac25216acdb7db8451ab67ecb74c..4ee3b77568106edf18baaa73977924e151ab8d39 100644 (file)
@@ -413,13 +413,19 @@ static void text_console_resize(QemuTextConsole *t)
 {
     QemuConsole *s = QEMU_CONSOLE(t);
     TextCell *cells, *c, *c1;
-    int w1, x, y, last_width;
+    int w1, x, y, last_width, w, h;
 
     assert(s->scanout.kind == SCANOUT_SURFACE);
 
+    w = surface_width(s->surface) / FONT_WIDTH;
+    h = surface_height(s->surface) / FONT_HEIGHT;
+    if (w == t->width && h == t->height) {
+        return;
+    }
+
     last_width = t->width;
-    t->width = surface_width(s->surface) / FONT_WIDTH;
-    t->height = surface_height(s->surface) / FONT_HEIGHT;
+    t->width = w;
+    t->height = h;
 
     w1 = last_width;
     if (t->width < w1)