]> xenbits.xensource.com Git - seabios.git/commitdiff
vgabios: Fix cirrus memory clear on mode switch.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 9 Mar 2013 18:04:47 +0000 (13:04 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 9 Mar 2013 18:10:45 +0000 (13:10 -0500)
The cirrus_clear_vram() code wasn't actually doing anything because of
a u8 overflow.  Fix that.

Fill with 0xff when performing a legacy cirrus mode switch (WinXP has
been observed to incorrectly render dialog boxes if the memory is
filled to 0).  This was the behavior of the original LGPL vgabios
code.  To support this, add mechanism (MF_LEGACY) to allow vga drivers
to detect if the mode switch is from vesa or int10.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
vgasrc/clext.c
vgasrc/vgabios.c
vgasrc/vgabios.h

index d02b8802fd2d5315347f3a55c070a4a71ca10384..8eb226afc9a080f04174d957ef97df9fa165fd2f 100644 (file)
@@ -443,14 +443,14 @@ cirrus_enable_16k_granularity(void)
 }
 
 static void
-cirrus_clear_vram(void)
+cirrus_clear_vram(u16 fill)
 {
     cirrus_enable_16k_granularity();
-    u8 count = GET_GLOBAL(VBE_total_memory) / (16 * 1024);
-    u8 i;
+    int count = GET_GLOBAL(VBE_total_memory) / (16 * 1024);
+    int i;
     for (i=0; i<count; i++) {
         stdvga_grdc_write(0x09, i);
-        memset16_far(SEG_GRAPH, 0, 0, 16 * 1024);
+        memset16_far(SEG_GRAPH, 0, fill, 16 * 1024);
     }
     stdvga_grdc_write(0x09, 0x00);
 }
@@ -469,7 +469,8 @@ clext_set_mode(struct vgamode_s *vmode_g, int flags)
     if (!(flags & MF_LINEARFB))
         cirrus_enable_16k_granularity();
     if (!(flags & MF_NOCLEARMEM))
-        cirrus_clear_vram();
+        // fill with 0xff to keep win 2K happy
+        cirrus_clear_vram(flags & MF_LEGACY ? 0xffff : 0x0000);
     return 0;
 }
 
index 6abe6395114b7592df2f1e5e62e182a0a6e840d9..987a25944a4aa48a2fa825873251611f6d39c69a 100644 (file)
@@ -420,7 +420,7 @@ handle_1000(struct bregs *regs)
     else
         regs->al = 0x30;
 
-    int flags = GET_BDA(modeset_ctl) & (MF_NOPALETTE|MF_GRAYSUM);
+    int flags = MF_LEGACY | (GET_BDA(modeset_ctl) & (MF_NOPALETTE|MF_GRAYSUM));
     if (regs->al & 0x80)
         flags |= MF_NOCLEARMEM;
 
index ff5ec457a636fa95cf12cbf4e92478f9b4b60770..5adbf4b2df44ad57bcf43741f052e5194f2f25a4 100644 (file)
@@ -39,6 +39,7 @@ struct saveBDAstate {
 };
 
 // Mode flags
+#define MF_LEGACY     0x0001
 #define MF_GRAYSUM    0x0002
 #define MF_NOPALETTE  0x0008
 #define MF_CUSTOMCRTC 0x0800