summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2009-12-18 08:08:09 +1000
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-19 08:26:23 -0600
commit4b5db3749c5fdba93e1ac0e8748c9a9a1064319f (patch)
treeabdc1d9efe2d7ea855cdf8cacca990bd6fcd4ebc
parenta1497a782c3e3b12e53dcab668ad5d6d00f9a0e6 (diff)
downloadqemu-4b5db3749c5fdba93e1ac0e8748c9a9a1064319f.tar.gz
Fix VMware VGA depth computation
VMware VGA requires that the depth presented to the guest is the same as the DisplaySurface that it renders to. This is because it performs a very simple memcpy() to blit from one surface to another. We currently hardcode a 24-bit depth. The surface allocator for SDL may, and usually will, allocate a surface with a different depth causing screen corruption. This changes the code to allocate the DisplaySurface before initializing the device which allows the depth of the DisplaySurface to be used instead of hardcoding something. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit a6109ff1b5d7184a9d490c4ff94f175940232ebd)
-rw-r--r--hw/vmware_vga.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index fcb680878d..ae913270f6 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -915,8 +915,8 @@ static void vmsvga_reset(struct vmsvga_state_s *s)
s->width = -1;
s->height = -1;
s->svgaid = SVGA_ID;
- s->depth = 24;
- s->bypp = (s->depth + 7) >> 3;
+ s->depth = ds_get_bits_per_pixel(s->vga.ds);
+ s->bypp = ds_get_bytes_per_pixel(s->vga.ds);
s->cursor.on = 0;
s->redraw_fifo_first = 0;
s->redraw_fifo_last = 0;
@@ -1114,6 +1114,11 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size)
s->scratch_size = SVGA_SCRATCH_SIZE;
s->scratch = qemu_malloc(s->scratch_size * 4);
+ s->vga.ds = graphic_console_init(vmsvga_update_display,
+ vmsvga_invalidate_display,
+ vmsvga_screen_dump,
+ vmsvga_text_update, s);
+
vmsvga_reset(s);
s->fifo_size = SVGA_FIFO_SIZE;
@@ -1124,11 +1129,6 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size)
vga_init(&s->vga);
vmstate_register(0, &vmstate_vga_common, &s->vga);
- s->vga.ds = graphic_console_init(vmsvga_update_display,
- vmsvga_invalidate_display,
- vmsvga_screen_dump,
- vmsvga_text_update, s);
-
vga_init_vbe(&s->vga);
rom_add_vga(VGABIOS_FILENAME);
}