Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
elmarco committed Sep 4, 2023
1 parent 3f9c213 commit 9cb737b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ui/console.c
Expand Up @@ -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)
Expand Down

0 comments on commit 9cb737b

Please sign in to comment.