From 53e8f0a9f7dcc4c2f9f738f01cfd978066b89165 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 12 Dec 2023 13:36:11 +0800 Subject: [PATCH] hw/display: fix qemu_console_resize being called from the TCG thread --- hw/display/esp_rgb.c | 9 ++++++--- include/hw/display/esp_rgb.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/display/esp_rgb.c b/hw/display/esp_rgb.c index f8ba3ca50812..dff424650748 100644 --- a/hw/display/esp_rgb.c +++ b/hw/display/esp_rgb.c @@ -110,9 +110,7 @@ static void esp_rgb_write(void *opaque, hwaddr addr, s->height = MAX(s->height, 10); /* Update the window size */ - if (s->con) { - qemu_console_resize(s->con, s->width, s->height); - } + s->do_update_size = true; break; case A_RGB_UPDATE_STATUS: @@ -147,6 +145,11 @@ static void rgb_update(void* opaque) { ESPRgbState* s = (ESPRgbState*) opaque; + if (s->con && s->do_update_size) { + qemu_console_resize(s->con, s->width, s->height); + s->do_update_size = false; + } + if (s->con && s->update_area) { uint32_t src = s->color_content; AddressSpace* src_as = NULL; diff --git a/include/hw/display/esp_rgb.h b/include/hw/display/esp_rgb.h index 8f480a99d373..0ed87b8778a1 100644 --- a/include/hw/display/esp_rgb.h +++ b/include/hw/display/esp_rgb.h @@ -28,6 +28,7 @@ typedef struct ESPRgbState { /* Window size */ uint32_t width; uint32_t height; + bool do_update_size; /* Update area */ bool update_area;