[SeaBIOS] [PATCH 1/4] SeaVGABios/cbvga: Assume VGA compatible GPU in text-mode

Patrick Rudolph siro at das-labor.org
Fri Mar 17 17:49:39 CET 2017


Assume the GPU is VGA compatible when running in text-mode.
Advertise VGA modes using SeaVGABios' stdvga driver.
Microsoft Windows relies on graphics mode 12 as last resort when
running in text mode, even when not advertised.

Allows Windows 7 to boot in 640x480 and 16 colors mode using the
VgaSave driver.
Allows Windows 7 to show the loading bar splash screen.

Known issues:
The palette seems wrong, as colors are swapped ( blue is red, ... ).

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
 vgasrc/cbvga.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index ebd17b0..87ec77e 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -20,6 +20,10 @@ static u32 CBlinelength VAR16;
 
 struct vgamode_s *cbvga_find_mode(int mode)
 {
+    /* Assume VGA compatible hardware in text-mode. */
+    if (GET_GLOBAL(CBmode) == 0x3)
+        return stdvga_find_mode(mode);
+
     if (mode == GET_GLOBAL(CBmode))
         return &CBmodeinfo;
     if (mode == 0x03)
@@ -30,11 +34,11 @@ struct vgamode_s *cbvga_find_mode(int mode)
 void
 cbvga_list_modes(u16 seg, u16 *dest, u16 *last)
 {
-    if (dest<last) {
-        SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode));
-        dest++;
+
+    /* Assume VGA compatible hardware in text-mode. */
+    if (GET_GLOBAL(CBmode) == 0x3) {
+        stdvga_list_modes(seg, dest, last);
     }
-    SET_FARVAR(seg, *dest, 0xffff);
 }
 
 int
@@ -97,6 +101,11 @@ int
 cbvga_set_mode(struct vgamode_s *vmode_g, int flags)
 {
     u8 emul = vmode_g == &CBemulinfo || GET_GLOBAL(CBmode) == 0x03;
+
+    /* Assume VGA compatible hardware in text-mode. */
+    if (GET_GLOBAL(CBmode) == 0x03)
+        return stdvga_set_mode(vmode_g, flags);
+
     MASK_BDA_EXT(flags, BF_EMULATE_TEXT, emul ? BF_EMULATE_TEXT : 0);
     if (!(flags & MF_NOCLEARMEM)) {
         if (GET_GLOBAL(CBmodeinfo.memmodel) == MM_TEXT) {
-- 
2.7.4




More information about the SeaBIOS mailing list