Only show bootsplash during boot menu.
authorKevin O'Connor <kevin@koconnor.net>
Thu, 26 Aug 2010 01:07:48 +0000 (21:07 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 26 Aug 2010 01:07:48 +0000 (21:07 -0400)
When the bootsplash picture is shown, it's not possible to see text.
So, only display the picture while prompting the user for the boot
menu.

src/biosvar.h
src/boot.c
src/bootsplash.c
src/post.c
src/util.h

index 415f9581b8e5867bcbeb058e2e6b9d9c12ad5c9b..2b755e3f419c8a8f3ae9b0e5fc772c073a73db27 100644 (file)
@@ -222,7 +222,6 @@ struct extended_bios_data_area_s {
     u8 other2[0xC4];
 
     // 0x121 - Begin custom storage.
-    u8 bootsplash_active;
     u8 ps2ctr;
     struct usbkeyinfo usbkey_last;
 
index 44964a7070e0c972becabe58b1a9dba1c75c1094..021b8ac070170be378c558f8d0f76e436a44ad3a 100644 (file)
@@ -227,7 +227,9 @@ interactive_bootmenu(void)
 
     printf("Press F12 for boot menu.\n\n");
 
+    enable_bootsplash();
     int scan_code = get_keystroke(CONFIG_BOOTMENU_WAIT);
+    disable_bootsplash();
     if (scan_code != 0x86)
         /* not F12 */
         return;
@@ -343,9 +345,6 @@ boot_prep(void)
 static void
 call_boot_entry(u16 bootseg, u16 bootip, u8 bootdrv)
 {
-    /* Go back to text, the OS might expect it... (Can't do this any later) */
-    disable_bootsplash();
-
     dprintf(1, "Booting from %04x:%04x\n", bootseg, bootip);
     struct bregs br;
     memset(&br, 0, sizeof(br));
@@ -430,7 +429,6 @@ boot_cbfs(struct ipl_entry_s *ie)
             return;
         if (count--)
             continue;
-        disable_bootsplash();
         cbfs_run_payload(file);
     }
 }
index 14bdd4cfaa6b931032e30236039b0fd4934f75ac..8f42dfde209af4cf6616ce48fdbbe39a95e6b131 100644 (file)
@@ -92,8 +92,8 @@ call16_int10(struct bregs *br)
  * VGA text / graphics console
  ****************************************************************/
 
-static void
-enable_vga_text_console(void)
+void
+enable_vga_console(void)
 {
     dprintf(1, "Turning on vga text mode console\n");
     struct bregs br;
@@ -141,29 +141,27 @@ find_videomode(struct vesa_info *vesa_info, struct vesa_mode_info *mode_info
     }
 }
 
+static int BootsplashActive;
+
 void
-enable_vga_console(void)
+enable_bootsplash(void)
 {
-    struct vesa_info *vesa_info = NULL;
-    struct vesa_mode_info *mode_info = NULL;
-    struct jpeg_decdata *jpeg = NULL;
-    u8 *filedata = NULL, *picture = NULL;
-
     if (!CONFIG_BOOTSPLASH)
-        goto gotext;
+        return;
     dprintf(3, "Checking for bootsplash\n");
     u32 file = romfile_find("bootsplash.jpg");
     if (!file)
-        goto gotext;
+        return;
     int filesize = romfile_size(file);
 
-    filedata = malloc_tmphigh(filesize);
-    vesa_info = malloc_tmplow(sizeof(*vesa_info));
-    mode_info = malloc_tmplow(sizeof(*mode_info));
-    jpeg = jpeg_alloc();
+    u8 *picture = NULL;
+    u8 *filedata = malloc_tmphigh(filesize);
+    struct vesa_info *vesa_info = malloc_tmplow(sizeof(*vesa_info));
+    struct vesa_mode_info *mode_info = malloc_tmplow(sizeof(*mode_info));
+    struct jpeg_decdata *jpeg = jpeg_alloc();
     if (!filedata || !jpeg || !vesa_info || !mode_info) {
         warn_noalloc();
-        goto gotext;
+        goto done;
     }
 
     /* Check whether we have a VESA 2.0 compliant BIOS */
@@ -177,7 +175,7 @@ enable_vga_console(void)
     call16_int10(&br);
     if (vesa_info->vesa_signature != VESA_SIGNATURE) {
         dprintf(1,"No VBE2 found.\n");
-        goto gotext;
+        goto done;
     }
 
     /* Print some debugging information about our card. */
@@ -194,7 +192,7 @@ enable_vga_console(void)
     int ret = jpeg_decode(jpeg, filedata);
     if (ret) {
         dprintf(1, "jpeg_decode failed with return code %d...\n", ret);
-        goto gotext;
+        goto done;
     }
     int width, height;
     jpeg_get_size(jpeg, &width, &height);
@@ -202,7 +200,7 @@ enable_vga_console(void)
     // Try to find a graphics mode with the corresponding dimensions.
     int videomode = find_videomode(vesa_info, mode_info, width, height);
     if (videomode < 0)
-        goto gotext;
+        goto done;
     void *framebuffer = mode_info->phys_base_ptr;
     int depth = mode_info->bits_per_pixel;
     dprintf(3, "mode: %04x\n", videomode);
@@ -215,13 +213,13 @@ enable_vga_console(void)
     picture = malloc_tmphigh(imagesize);
     if (!picture) {
         warn_noalloc();
-        goto gotext;
+        goto done;
     }
     dprintf(5, "Decompressing bootsplash.jpg\n");
     ret = jpeg_show(jpeg, picture, width, height, depth);
     if (ret) {
         dprintf(1, "jpeg_show failed with return code %d...\n", ret);
-        goto gotext;
+        goto done;
     }
 
     /* Switch to graphics mode */
@@ -232,32 +230,29 @@ enable_vga_console(void)
     call16_int10(&br);
     if (br.ax != 0x4f) {
         dprintf(1, "set_mode failed.\n");
-        goto gotext;
+        goto done;
     }
 
     /* Show the picture */
     dprintf(5, "Showing bootsplash.jpg\n");
     iomemcpy(framebuffer, picture, imagesize);
     dprintf(5, "Bootsplash copy complete\n");
-    SET_EBDA(bootsplash_active, 1);
+    BootsplashActive = 1;
 
-cleanup:
+done:
     free(filedata);
     free(picture);
     free(vesa_info);
     free(mode_info);
     free(jpeg);
     return;
-gotext:
-    enable_vga_text_console();
-    goto cleanup;
 }
 
 void
 disable_bootsplash(void)
 {
-    if (!CONFIG_BOOTSPLASH || !GET_EBDA(bootsplash_active))
+    if (!CONFIG_BOOTSPLASH || !BootsplashActive)
         return;
-    SET_EBDA(bootsplash_active, 0);
-    enable_vga_text_console();
+    BootsplashActive = 0;
+    enable_vga_console();
 }
index 56e5eb5bbd66896a285b57de949d9789b12e0da3..5d0e2cb1f35bc01f305c69dc6b23354c483f1290 100644 (file)
@@ -265,10 +265,6 @@ _start(void)
     // Write protect bios memory.
     make_bios_readonly();
 
-    // Disable bootsplash if something has hooked int19.
-    if (GET_IVT(0x19).segoff != FUNC16(entry_19_official).segoff)
-        disable_bootsplash();
-
     // Invoke int 19 to start boot process.
     dprintf(3, "Jump to int19\n");
     struct bregs br;
index 45896c6d8c0d7f22b1500cf6ee95fa355e6d82aa..3d68d455e10e84f69c7acdfd0478f821b45041f1 100644 (file)
@@ -383,6 +383,7 @@ extern u32 RomEnd;
 
 // bootsplash.c
 void enable_vga_console(void);
+void enable_bootsplash(void);
 void disable_bootsplash(void);
 
 // resume.c