aboutsummaryrefslogtreecommitdiff
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
parente7b53d160f61b3de2c1db6007848ac6748d93ab4 (diff)
downloadqemu-b1cf266c82cb1211ee2785f1813a6a3f3e693390.zip
qemu-b1cf266c82cb1211ee2785f1813a6a3f3e693390.tar.gz
qemu-b1cf266c82cb1211ee2785f1813a6a3f3e693390.tar.bz2
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>
-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 30facc6..be2b19b 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++) {