[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [kvm-devel] [PATCH] Don't explicitly set BAR values for
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] Re: [kvm-devel] [PATCH] Don't explicitly set BAR values for VMware VGA |
Date: |
Sat, 23 Feb 2008 16:59:27 -0600 |
User-agent: |
Thunderbird 2.0.0.9 (X11/20080214) |
andrzej zaborowski wrote:
Oh, good question, and I think the answer be the reason why it's not
working here (*slaps self*). I'll apply the patch if you can confirm
that it works with some Ms Windows install.
I just tried with Windows XP and I have no problem detecting the card
with this patch.
FWIW, I needed to use the following patch to avoid SEGVs as it seems
there's a bug in the emulation where the update region is larger than
the screen. My first impression is that it's related to cursor drawing
as it only happens when I click on the start button and the update
region height is 36 pixels which looks like a cursor size to me. This
is true with or without the BAR patch though. I'll look into it a
little more and see what's going on.
Regards,
Anthony Liguori
I just launched the VM and checked what kind of Ms Windows set up this
is and it's a "Windows XP professional 2002" with VMware Tools
installed, and all the files on it have last modification date in 2004
or earlier. Apparently I stole the already set up VM from my dad's
computer on which he used VMware, somewhere in 2004. I then converted
the image to raw and always performed my tests with -snapshot on.
This may be why the system is unwilling to use different base
addresses.
diff --git a/qemu/hw/vmware_vga.c b/qemu/hw/vmware_vga.c
index f2a298e..0204d88 100644
--- a/qemu/hw/vmware_vga.c
+++ b/qemu/hw/vmware_vga.c
@@ -295,12 +295,31 @@ static inline void vmsvga_update_rect(struct
vmsvga_state_s *s,
int x, int y, int w, int h)
{
#ifndef DIRECT_VRAM
- int line = h;
- int bypl = s->bypp * s->width;
- int width = s->bypp * w;
- int start = s->bypp * x + bypl * y;
- uint8_t *src = s->vram + start;
- uint8_t *dst = s->ds->data + start;
+ int line;
+ int bypl;
+ int width;
+ int start;
+ uint8_t *src;
+ uint8_t *dst;
+
+ if ((x + w) > s->ds->width) {
+ fprintf(stderr, "update width too large x: %d, w: %d\n", x, w);
+ x = MIN(x, s->ds->width);
+ w = s->ds->width - x;
+ }
+
+ if ((y + h) > s->ds->height) {
+ fprintf(stderr, "update height too large y: %d, h: %d\n", y, h);
+ y = MIN(y, s->ds->height);
+ h = s->ds->height - y;
+ }
+
+ line = h;
+ bypl = s->bypp * s->width;
+ width = s->bypp * w;
+ start = s->bypp * x + bypl * y;
+ src = s->vram + start;
+ dst = s->ds->data + start;
for (; line > 0; line --, src += bypl, dst += bypl)
memcpy(dst, src, width);