diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2007-12-12 12:02:01 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2007-12-12 12:02:01 +0000 |
commit | 2d9284c4a58976f7549729b9e2129151bd8a9bc7 (patch) | |
tree | 73ed8bea9b89bb7f84ca365e40dac9af02433c79 | |
parent | 8e7e63dc88d4ede72b5d684a4e1765b95a62882e (diff) | |
download | xen-2d9284c4a58976f7549729b9e2129151bd8a9bc7.tar.gz xen-2d9284c4a58976f7549729b9e2129151bd8a9bc7.tar.bz2 xen-2d9284c4a58976f7549729b9e2129151bd8a9bc7.zip |
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@eu.citrix.com>
-rw-r--r-- | tools/ioemu/hw/vga.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/ioemu/hw/vga.c b/tools/ioemu/hw/vga.c index cb34f289fb..17538bbddc 100644 --- a/tools/ioemu/hw/vga.c +++ b/tools/ioemu/hw/vga.c @@ -1742,6 +1742,7 @@ static CPUWriteMemoryFunc *vga_mem_write[3] = { 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 *opaque) #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 *opaque, int version_id) 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); |