]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
stdvga: fix screen blanking
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 5 Jun 2024 13:14:41 +0000 (15:14 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 20 Jun 2024 07:04:36 +0000 (10:04 +0300)
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>
(cherry picked from commit b1cf266c82cb1211ee2785f1813a6a3f3e693390)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/display/vga.c

index 37557c3442aa8b709e74930502ed3a573da3d222..cb6b6ee2ca7dda750efc4b8b3bcae0dc0b3789cc 100644 (file)
@@ -1748,6 +1748,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++) {