# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1197460921 0
# Node ID 20898120c8f9b56902ceedb8deaf977175445f2f
# Parent 51c9755a52d52bb639bf332dfeb9edf5fd54e637
ioemu/qemu vga: save and restore vram buffer (take 2)
The existing stdvga driver from xen-unstable tools/ioemu/hw/vga* does
not save the emulated VGA memory contents. The symptoms include video
malfunction after restore, including black screen (which can often be
fixed by asking the guest to redraw) but also missing font setup etc.
The attached patch fixes this by saving the entire VGA memory buffer,
just like the Xen ioemu Cirrus emulator does.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/ioemu/hw/vga.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff -r 51c9755a52d5 -r 20898120c8f9 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c Wed Dec 12 12:00:46 2007 +0000
+++ b/tools/ioemu/hw/vga.c Wed Dec 12 12:02:01 2007 +0000
@@ -1742,6 +1742,7 @@ static void vga_save(QEMUFile *f, void *
static void vga_save(QEMUFile *f, void *opaque)
{
VGAState *s = opaque;
+ uint32_t vram_size;
#ifdef CONFIG_BOCHS_VBE
int i;
#endif
@@ -1783,17 +1784,21 @@ static void vga_save(QEMUFile *f, void *
#else
qemu_put_byte(f, 0);
#endif
+ vram_size = s->vram_size;
+ qemu_put_be32s(f, &vram_size);
+ qemu_put_buffer(f, s->vram_ptr, s->vram_size);
}
static int vga_load(QEMUFile *f, void *opaque, int version_id)
{
VGAState *s = opaque;
int is_vbe, ret;
+ uint32_t vram_size;
#ifdef CONFIG_BOCHS_VBE
int i;
#endif
- if (version_id > 2)
+ if (version_id > 3)
return -EINVAL;
if (s->pci_dev && version_id >= 2) {
@@ -1839,6 +1844,13 @@ static int vga_load(QEMUFile *f, void *o
if (is_vbe)
return -EINVAL;
#endif
+ if (version_id >= 3) {
+ /* people who restore old images may be lucky ... */
+ qemu_get_be32s(f, &vram_size);
+ if (vram_size != s->vram_size)
+ return -EINVAL;
+ qemu_get_buffer(f, s->vram_ptr, s->vram_size);
+ }
/* force refresh */
s->graphic_mode = -1;
@@ -2052,7 +2064,7 @@ static void vga_init(VGAState *s)
{
int vga_io_memory;
- register_savevm("vga", 0, 2, vga_save, vga_load, s);
+ register_savevm("vga", 0, 3, vga_save, vga_load, s);
register_ioport_write(0x3c0, 16, 1, vga_ioport_write, s);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|