]> xenbits.xensource.com Git - seabios.git/commitdiff
cbvga_list_modes: don't list current mode twice
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 30 May 2018 14:19:02 +0000 (16:19 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 22 Jun 2018 05:44:07 +0000 (07:44 +0200)
In case we've already added the framebuffer video mode
to the list do not add number 0x140.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
vgasrc/cbvga.c

index fb68620067592fb3acff0226f1cee9288ca48ebc..3f16bee10c165c6204ee091bcc14495c5cef0b16 100644 (file)
@@ -104,6 +104,8 @@ struct vgamode_s *cbvga_find_mode(int mode)
 void
 cbvga_list_modes(u16 seg, u16 *dest, u16 *last)
 {
+    int seen = 0;
+
     if (GET_GLOBAL(CBmode) != 0x3) {
         /* Advertise additional SVGA modes for Microsoft NTLDR graphical mode.
          * Microsoft NTLDR:
@@ -119,9 +121,11 @@ cbvga_list_modes(u16 seg, u16 *dest, u16 *last)
                 continue;
             SET_FARVAR(seg, *dest, mode);
             dest++;
+            if (GET_GLOBAL(CBmode) == mode)
+                seen = 1;
         }
     }
-    if (dest < last) {
+    if (dest < last && !seen) {
         SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode));
         dest++;
     }