Skip to contentSkip to conversation

fix screen corruption bug in vga_draw_graphic()

PATCH In review Andreas Winkelbauer 3 participants 3 messages Feb 22, 2008 – Feb 25, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix screen corruption bug in vga_draw_graphic()

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

qemu/hw/vga.c +9 -6
@@ -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;
qemu/hw/vga.c +1 -1
@@ -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;

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

_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

#1 lore raw
Quoted 8 lines · Andreas Winkelbauer

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

Quoted 8 lines

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.

Applied the no-formatting version, thanks. Please sign off on patches next time.

The way to apply formatting changes while fixing something is with a separate patch that does nothing but fix the formatting, either on top of the fix, or to be applied before the fix. This way the fixing patch is kept small and easily understandable.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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/
#2 lore raw
In reply to Andreas Winkelbauer

Hey,

this patch works like a charm! No pointer trails, no bars through dialogs... Perfect quality. Thanks alot Andreas!

Arne

Quoted 13 lines · Andreas Winkelbauer

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

Quoted 6 lines

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

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