Skip to contentSkip to conversation

ui/console: Fix console resize with placeholder surface

PATCH Superseded Tianlan Zhou 3 participants 3 messages Feb 7, 2024 – Feb 8, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/console: Fix console resize with placeholder surface

In qemu_console_resize(), the old surface of the console is keeped if the new console size is the same as the old one. If the old surface is a placeholder, and the new size of console is the same as the placeholder surface (640*480), the surface won't be replace.
In this situation, the surface's QEMU_PLACEHOLDER_FLAG flag is still set, so the console won't be displayed in SDL display mode.
This patch fixes this problem by forcing a new surface if the old one is a placeholder.

---
 ui/console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/console.c +1 -1
index 7db921e3b7..832055675c 100644
@@ -1577,7 +1577,7 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
     assert(QEMU_IS_GRAPHIC_CONSOLE(s));
 
     if ((s->scanout.kind != SCANOUT_SURFACE ||
-         (surface && surface->flags & QEMU_ALLOCATED_FLAG)) &&
+         (surface && !is_buffer_shared(surface) && !is_placeholder(surface))) &&
         qemu_console_get_width(s, -1) == width &&
         qemu_console_get_height(s, -1) == height) {
         return;
Signature · 1 line
2.38.1.windows.1
#1 lore raw

07.02.2024 20:20, Tianlan Zhou :

Quoted 8 lines

In qemu_console_resize(), the old surface of the console is keeped if the new console size is the same as the old one. If the old surface is a placeholder, and the new size of console is the same as the placeholder surface (640*480), the surface won't be replace.
In this situation, the surface's QEMU_PLACEHOLDER_FLAG flag is still set, so the console won't be displayed in SDL display mode.
This patch fixes this problem by forcing a new surface if the old one is a placeholder.

Cc qemu-stable

/mjt

Reviewed-by on v1 1/1
#2 lore raw
In reply to Tianlan Zhou

Hi

Quoted 29 lines · Tianlan Zhou

In qemu_console_resize(), the old surface of the console is keeped if the new console size is the same as the old one. If the old surface is a placeholder, and the new size of console is the same as the placeholder surface (640*480), the surface won't be replace.
In this situation, the surface's QEMU_PLACEHOLDER_FLAG flag is still set, so the console won't be displayed in SDL display mode.
This patch fixes this problem by forcing a new surface if the old one is a placeholder.

---
 ui/console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/console.c +1 -2
index 7db921e3b7..832055675c 100644
@@ -1577,7 +1577,7 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
     assert(QEMU_IS_GRAPHIC_CONSOLE(s));
 
     if ((s->scanout.kind != SCANOUT_SURFACE ||
-         (surface && surface->flags & QEMU_ALLOCATED_FLAG)) &&
+         (surface && !is_buffer_shared(surface) && !is_placeholder(surface))) &&
         qemu_console_get_width(s, -1) == width &&
         qemu_console_get_height(s, -1) == height) {
         return;
--
Quoted 3 lines

2.38.1.windows.1

Signature · 1 line
Marc-André Lureau