From: Dave Airlie <airlied@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/6] Fix VMware VGA depth computation
Date: Fri, 18 Dec 2009 08:08:09 +1000 [thread overview]
Message-ID: <1261087691-8319-5-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1261087691-8319-4-git-send-email-airlied@gmail.com>
From: Anthony Liguori <aliguori@us.ibm.com>
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>
---
hw/vmware_vga.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index fcb6808..ae91327 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);
}
--
1.6.5.2
next prev parent reply other threads:[~2009-12-17 22:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-17 22:08 [Qemu-devel] qemu fixup patch sequence Dave Airlie
2009-12-17 22:08 ` [Qemu-devel] [PATCH 1/6] vmware: setup PCI BAR 2 for FIFO as per vmware spec Dave Airlie
2009-12-17 22:08 ` [Qemu-devel] [PATCH 2/6] Make sure to enable dirty tracking of VBE vram mapping Dave Airlie
2009-12-17 22:08 ` [Qemu-devel] [PATCH 3/6] Make sure to enable dirty log tracking for VMware VGA Dave Airlie
2009-12-17 22:08 ` Dave Airlie [this message]
2009-12-17 22:08 ` [Qemu-devel] [PATCH 5/6] VMware VGA: Only enable dirty log tracking when fifo is disabled Dave Airlie
2009-12-17 22:08 ` [Qemu-devel] [PATCH 6/6] vmware: increase cursor buffer size Dave Airlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1261087691-8319-5-git-send-email-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).