vesainit: more careful detection of VESA modes
authorH. Peter Anvin <hpa@zytor.com>
Sat, 30 Sep 2006 17:50:56 +0000 (10:50 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sat, 30 Sep 2006 17:50:56 +0000 (10:50 -0700)
com32/lib/sys/vesa/initvesa.c

index 3508444..bcdcc09 100644 (file)
@@ -116,9 +116,13 @@ static int vesacon_set_mode(void)
     return 1;                  /* Function call failed */
   if ( gi->signature != VESA_MAGIC )
     return 2;                  /* No magic */
+#if 1
+  /* Linear frame buffer is a VBE 2.0 feature.  In theory this
+     test is redundant given that we check the bitmasks. */
   if ( gi->version < 0x0200 ) {
     return 3;                  /* VESA 2.0 not supported */
   }
+#endif
 
   /* Copy general info */
   memcpy(&__vesa_info.gi, gi, sizeof *gi);
@@ -145,8 +149,16 @@ static int vesacon_set_mode(void)
          mi->mode_attr, mi->h_res, mi->v_res, mi->bpp, mi->memory_layout,
          mi->rpos, mi->gpos, mi->bpos);
 
-    /* Must be an LFB color graphics mode supported by the hardware */
-    if ( (mi->mode_attr & 0x0099) != 0x0099 )
+    /* Must be an LFB color graphics mode supported by the hardware.
+       
+      The bits tested are:
+       7 - linear frame buffer available
+       4 - graphics mode
+       3 - color mode
+       1 - mode information available (mandatory in VBE 1.2+)
+       0 - mode supported by hardware
+    */
+    if ( (mi->mode_attr & 0x009b) != 0x009b )
       continue;
 
     /* Must be 640x480, 32 bpp */