All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: andrzej zaborowski <balrogg@gmail.com>
Cc: kvm-devel@lists.sourceforge.net, qemu-devel@nongnu.org,
	Avi Kivity <avi@qumranet.com>
Subject: Re: [PATCH] Don't explicitly set BAR values for VMware VGA
Date: Sat, 23 Feb 2008 16:59:27 -0600	[thread overview]
Message-ID: <47C0A54F.80504@codemonkey.ws> (raw)
In-Reply-To: <fb249edb0802221702j2fadbd18ja6c4962f3c478d0b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]

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.
>   


[-- Attachment #2: qemu-vmware-check-update.patch --]
[-- Type: text/x-diff, Size: 1193 bytes --]

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);

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 158 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: andrzej zaborowski <balrogg@gmail.com>
Cc: kvm-devel@lists.sourceforge.net, qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <47C0A54F.80504@codemonkey.ws> (raw)
In-Reply-To: <fb249edb0802221702j2fadbd18ja6c4962f3c478d0b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]

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.
>   


[-- Attachment #2: qemu-vmware-check-update.patch --]
[-- Type: text/x-diff, Size: 1193 bytes --]

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);

  reply	other threads:[~2008-02-23 22:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 19:40 [PATCH] Don't explicitly set BAR values for VMware VGA Anthony Liguori
2008-02-22 19:40 ` [Qemu-devel] " Anthony Liguori
2008-02-22 19:40 ` [PATCH 1/3] Move common VGAState attributes to VGA_STATE_COMMON Anthony Liguori
2008-02-24  8:31   ` Avi Kivity
2008-02-24 15:16     ` Anthony Liguori
2008-02-24 15:38       ` Avi Kivity
2008-02-22 19:40 ` [PATCH 2/3] Factor out the VGA vram mapping updating routine Anthony Liguori
2008-02-22 19:40 ` [PATCH 3/3] Enable VGA optimization for VMware VGA Anthony Liguori
2008-02-22 22:29 ` [PATCH] Don't explicitly set BAR values " Anthony Liguori
2008-02-22 22:29   ` [Qemu-devel] Re: [kvm-devel] " Anthony Liguori
2008-02-22 23:45 ` andrzej zaborowski
2008-02-22 23:45   ` [Qemu-devel] " andrzej zaborowski
2008-02-23  0:03   ` Anthony Liguori
2008-02-23  0:03     ` [Qemu-devel] " Anthony Liguori
2008-02-23  1:02     ` andrzej zaborowski
2008-02-23  1:02       ` [Qemu-devel] " andrzej zaborowski
2008-02-23 22:59       ` Anthony Liguori [this message]
2008-02-23 22:59         ` [Qemu-devel] Re: [kvm-devel] " Anthony Liguori
2008-02-24  7:09 ` Avi Kivity
2008-02-24  7:09   ` [Qemu-devel] " Avi Kivity

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=47C0A54F.80504@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@qumranet.com \
    --cc=balrogg@gmail.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.