Skip to contentSkip to conversation

partial fix for cirrus_vga mode switch corruption...

PATCH New Leonardo E. Reiter 1 participant 1 message Feb 2, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 partial fix for cirrus_vga mode switch corruption...

The attached patch corrects display mode switch corruption in Windows 2000 and XP guests when using cirrus_vga. I'm not sure it's correct and it's certainly a hack, but apparently win2k/xp are expecting the video RAM to be reset to all 1's after mode switches. After lots of trial and error, I discovered that setting the vram to all 1's should only be done on mode switches to 8bpp or higher depth.

The only drawback to applying this patch as is, is that when switching back from the monitor, the Windows guest's screen will be reset to solid white. Using the monitor in graphics mode is not a priority for me, but it should be easy to put a check in the code to avoid the memset() if the user is switching back from the monitor rather than Windows itself doing a mode switch.

I've found that on rare occasion, even with this patch, mode switches still cause display corruption. For the most part however, the attached hack does the job.

Regards,

Leo Reiter

Signature · 8 lines
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing from Desktop to Data Center
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com

Index: hw/vga.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/vga.c,v
retrieving revision 1.41

vga.c +2 -0
diff -a -u -r1.41 vga.c
@@ -1364,6 +1364,8 @@
 
     if (disp_width != s->last_width ||
         height != s->last_height) {
+        if (cirrus_vga_enabled && s->get_bpp(s) >= 8)
+            memset(s->vram_ptr, 0xff, s->vram_size);
         dpy_resize(s->ds, disp_width, height);
         s->last_scr_width = disp_width;
         s->last_scr_height = height;