diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-08-30 13:38:14 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-09-04 14:24:08 +0400 |
commit | 9cb737b77d9cc43a9bed305cbb105928a3dda54b (patch) | |
tree | ddf9343abf533d40aec8b8f194b0a50ffbb277b0 /ui | |
parent | 3f9c21325c4c2005a852744db1016c479d60cb55 (diff) | |
download | qemu-9cb737b77d9cc43a9bed305cbb105928a3dda54b.zip qemu-9cb737b77d9cc43a9bed305cbb105928a3dda54b.tar.gz qemu-9cb737b77d9cc43a9bed305cbb105928a3dda54b.tar.bz2 |
ui/vc: skip text console resize when possible
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>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/console.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/console.c b/ui/console.c index 0a48ce9..4ee3b77 100644 --- a/ui/console.c +++ b/ui/console.c @@ -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) |