public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Winkelbauer <andreas.winkelbauer@gmx.at>
To: Avi Kivity <avi@qumranet.com>,
	arne.brutschy@ulb.ac.be, lmann@nt.net, Pelle@quicknet.nl
Cc: kvm-devel@lists.sourceforge.net
Subject: [PATCH] fix screen corruption bug in vga_draw_graphic()
Date: Fri, 22 Feb 2008 21:36:43 +0100	[thread overview]
Message-ID: <47BF325B.8050101@gmx.at> (raw)

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

hi,

the attached patch fixes the screen corruption issues which were 
reported by others, see:

http://article.gmane.org/gmane.comp.emulators.kvm.devel/13543
http://article.gmane.org/gmane.comp.emulators.kvm.devel/13409

The bug is kvm specific and can only be observed in graphics mode using 
relatively high resolutions (when one line uses more than one page of 
memory). As far as I've seen this bug is around since commit 
dd9591e0fea25a1414f4a6b2faa61ed733e0acc6 (5 nov 2006).

I've attached two versions of the patch. One just changes the relevant 
line and the other one also cleans up formatting (indention) of the kvm 
specific code.

cheers,
Andi

[-- Attachment #2: vga_draw_graphic.patch --]
[-- Type: text/x-patch, Size: 1489 bytes --]

--- kvm-61.orig/qemu/hw/vga.c	2008-02-19 15:58:28.000000000 +0100
+++ kvm-61/qemu/hw/vga.c	2008-02-22 20:46:14.000000000 +0100
@@ -1558,17 +1558,20 @@ static void vga_draw_graphic(VGAState *s
         update = full_update |
             cpu_physical_memory_get_dirty(page0, VGA_DIRTY_FLAG) |
             cpu_physical_memory_get_dirty(page1, VGA_DIRTY_FLAG);
-	if (kvm_enabled()) {
-		update |= bitmap_get_dirty(bitmap, (page0 - s->vram_offset) >> TARGET_PAGE_BITS);
-		update |= bitmap_get_dirty(bitmap, (page1 - s->vram_offset) >> TARGET_PAGE_BITS);
-	}
+        if (kvm_enabled()) {
+            update |= bitmap_get_dirty(bitmap,
+                (page0 - s->vram_offset) >> TARGET_PAGE_BITS);
+            update |= bitmap_get_dirty(bitmap,
+                (page1 - s->vram_offset) >> TARGET_PAGE_BITS);
+        }
 
         if ((page1 - page0) > TARGET_PAGE_SIZE) {
             /* if wide line, can use another page */
             update |= cpu_physical_memory_get_dirty(page0 + TARGET_PAGE_SIZE,
                                                     VGA_DIRTY_FLAG);
-	    if (kvm_enabled())
-		update |= bitmap_get_dirty(bitmap, (page0 - s->vram_offset) >> TARGET_PAGE_BITS);
+        if (kvm_enabled())
+            update |= bitmap_get_dirty(bitmap, (page0 + TARGET_PAGE_SIZE
+                - s->vram_offset) >> TARGET_PAGE_BITS);
         }
         /* explicit invalidation for the hardware cursor */
         update |= (s->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1;

[-- Attachment #3: vga_draw_graphic-no_formatting_changes.patch --]
[-- Type: text/x-patch, Size: 696 bytes --]

--- kvm-61.orig/qemu/hw/vga.c	2008-02-19 15:58:28.000000000 +0100
+++ kvm-61/qemu/hw/vga.c	2008-02-22 21:01:19.000000000 +0100
@@ -1568,7 +1568,7 @@ static void vga_draw_graphic(VGAState *s
             update |= cpu_physical_memory_get_dirty(page0 + TARGET_PAGE_SIZE,
                                                     VGA_DIRTY_FLAG);
 	    if (kvm_enabled())
-		update |= bitmap_get_dirty(bitmap, (page0 - s->vram_offset) >> TARGET_PAGE_BITS);
+		update |= bitmap_get_dirty(bitmap, (page0 + TARGET_PAGE_SIZE - s->vram_offset) >> TARGET_PAGE_BITS);
         }
         /* explicit invalidation for the hardware cursor */
         update |= (s->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1;

[-- Attachment #4: 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 #5: Type: text/plain, Size: 158 bytes --]

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

             reply	other threads:[~2008-02-22 20:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 20:36 Andreas Winkelbauer [this message]
2008-02-24  7:05 ` [PATCH] fix screen corruption bug in vga_draw_graphic() Avi Kivity
2008-02-25  9:12 ` Arne Brutschy

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=47BF325B.8050101@gmx.at \
    --to=andreas.winkelbauer@gmx.at \
    --cc=Pelle@quicknet.nl \
    --cc=arne.brutschy@ulb.ac.be \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=lmann@nt.net \
    /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