summary refs log tree commit diff stats
path: root/hw/display/vga.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-06-05 15:14:41 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-06-19 12:42:03 +0200
commitb1cf266c82cb1211ee2785f1813a6a3f3e693390 (patch)
tree05a0cccb86b8fd82b4235bc12db26c1f5f884c02 /hw/display/vga.c
parente7b53d160f61b3de2c1db6007848ac6748d93ab4 (diff)
downloadfocaccia-qemu-b1cf266c82cb1211ee2785f1813a6a3f3e693390.tar.gz
focaccia-qemu-b1cf266c82cb1211ee2785f1813a6a3f3e693390.zip
stdvga: fix screen blanking
In case the display surface uses a shared buffer (i.e. uses vga vram
directly instead of a shadow) go unshare the buffer before clearing it.

This avoids vga memory corruption, which in turn fixes unblanking not
working properly with X11.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2067
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20240605131444.797896-2-kraxel@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/display/vga.c')
-rw-r--r--hw/display/vga.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 30facc6c8e..be2b19b839 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1762,6 +1762,13 @@ static void vga_draw_blank(VGACommonState *s, int full_update)
     if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
         return;
 
+    if (is_buffer_shared(surface)) {
+        /* unshare buffer, otherwise the blanking corrupts vga vram */
+        surface = qemu_create_displaysurface(s->last_scr_width,
+                                             s->last_scr_height);
+        dpy_gfx_replace_surface(s->con, surface);
+    }
+
     w = s->last_scr_width * surface_bytes_per_pixel(surface);
     d = surface_data(surface);
     for(i = 0; i < s->last_scr_height; i++) {