]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Pass more appropriate video id to Linux.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 10 Jan 2011 23:02:01 +0000 (00:02 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 10 Jan 2011 23:02:01 +0000 (00:02 +0100)
* grub-core/loader/i386/linux.c (grub_linux_setup_video): Use
grub_video_get_driver_id and variable gfxpayloadforcelfb to
fill have_vga.
(grub_linux_boot): Rely on grub_linux_setup_video to fill have_vga and
shift params->lfb_size.
* include/grub/i386/linux.h: Make an enume out of have_vga values.

BUGS [new file with mode: 0644]
ChangeLog
grub-core/loader/i386/linux.c
include/grub/i386/linux.h

diff --git a/BUGS b/BUGS
new file mode 100644 (file)
index 0000000..0faebcd
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,2 @@
+Currently search and assembling multidevice abstractions scans all the devices which can be slow.
+Cache isn't used correctly for video which results in slowness.
index 63a0ee46c3c67111d02fb47f8a19014d7381e429..1a6a71bc573016b3ab7aa5bae554cb511691a844 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-10  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Pass more appropriate video id to Linux.
+
+       * grub-core/loader/i386/linux.c (grub_linux_setup_video): Use
+       grub_video_get_driver_id and variable gfxpayloadforcelfb to
+       fill have_vga.
+       (grub_linux_boot): Rely on grub_linux_setup_video to fill have_vga and
+       shift params->lfb_size.
+       * include/grub/i386/linux.h: Make an enume out of have_vga values.
+
 2011-01-10  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/grub-menulst2cfg.c: Add missing include of misc.h.
index 80f583cefaf7b6fbe6cfc351e51c4ac7114f5fd6..80960570b0cf3a60c06031a452df9c9261ddd5d2 100644 (file)
@@ -313,6 +313,13 @@ grub_linux_setup_video (struct linux_kernel_params *params)
   struct grub_video_mode_info mode_info;
   void *framebuffer;
   grub_err_t err;
+  grub_video_driver_id_t driver_id;
+  char *gfxlfbvar = grub_env_get ("gfxpayloadforcelfb");
+
+  driver_id = grub_video_get_driver_id ();
+
+  if (driver_id == GRUB_VIDEO_DRIVER_NONE)
+    return 1;
 
   err = grub_video_get_info_and_fini (&mode_info, &framebuffer);
 
@@ -339,12 +346,40 @@ grub_linux_setup_video (struct linux_kernel_params *params)
   params->reserved_mask_size = mode_info.reserved_mask_size;
   params->reserved_field_pos = mode_info.reserved_field_pos;
 
+  if (gfxlfbvar && (gfxlfbvar[0] == '1' || gfxlfbvar[0] == 'y'))
+    params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE;
+  else
+    {
+      switch (driver_id)
+       {
+       case GRUB_VIDEO_DRIVER_VBE:
+         params->lfb_size >>= 16;
+         params->have_vga = GRUB_VIDEO_LINUX_TYPE_VESA;
+         break;
+       
+       case GRUB_VIDEO_DRIVER_EFI_UGA:
+       case GRUB_VIDEO_DRIVER_EFI_GOP:
+         params->have_vga = GRUB_VIDEO_LINUX_TYPE_EFIFB;
+         break;
+
+         /* FIXME: check if better id is available.  */
+       case GRUB_VIDEO_DRIVER_SM712:
+       case GRUB_VIDEO_DRIVER_VGA:
+       case GRUB_VIDEO_DRIVER_CIRRUS:
+       case GRUB_VIDEO_DRIVER_BOCHS:
+         /* Make gcc happy. */
+       case GRUB_VIDEO_DRIVER_SDL:
+       case GRUB_VIDEO_DRIVER_NONE:
+         params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE;
+         break;
+       }
+    }
 
 #ifdef GRUB_MACHINE_PCBIOS
   /* VESA packed modes may come with zeroed mask sizes, which need
      to be set here according to DAC Palette width.  If we don't,
      this results in Linux displaying a black screen.  */
-  if (mode_info.bpp <= 8)
+  if (driver_id == GRUB_VIDEO_DRIVER_VBE && mode_info.bpp <= 8)
     {
       struct grub_vbe_info_block controller_info;
       int status;
@@ -457,15 +492,7 @@ grub_linux_boot (void)
       grub_errno = GRUB_ERR_NONE;
     }
 
-  if (! grub_linux_setup_video (params))
-    {
-      /* Use generic framebuffer unless VESA is known to be supported.  */
-      if (params->have_vga != GRUB_VIDEO_LINUX_TYPE_VESA)
-       params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE;
-      else
-       params->lfb_size >>= 16;
-    }
-  else
+  if (grub_linux_setup_video (params))
     {
 #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
       params->have_vga = GRUB_VIDEO_LINUX_TYPE_TEXT;
@@ -771,10 +798,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
                break;
              }
 
-           /* We can't detect VESA, but user is implicitly telling us that it
-              is built-in because `vga=' parameter was used.  */
-           params->have_vga = GRUB_VIDEO_LINUX_TYPE_VESA;
-
            linux_mode = &grub_vesa_mode_table[vid_mode
                                               - GRUB_VESA_MODE_TABLE_START];
 
index 9ba83eee21c9d6b095c2b7826c8828353f818c4f..fed58a63049dad1cb65a039c1b5c3476b6bff209 100644 (file)
@@ -79,9 +79,13 @@ struct grub_e820_mmap
   grub_uint32_t type;
 } __attribute__((packed));
 
-#define GRUB_VIDEO_LINUX_TYPE_TEXT     0x01
-#define GRUB_VIDEO_LINUX_TYPE_VESA     0x23    /* VESA VGA in graphic mode.  */
-#define GRUB_VIDEO_LINUX_TYPE_SIMPLE   0x70    /* Linear framebuffer without any additional functions.  */
+enum
+  {
+    GRUB_VIDEO_LINUX_TYPE_TEXT = 0x01,
+    GRUB_VIDEO_LINUX_TYPE_VESA = 0x23,    /* VESA VGA in graphic mode.  */
+    GRUB_VIDEO_LINUX_TYPE_EFIFB = 0x70,    /* EFI Framebuffer.  */
+    GRUB_VIDEO_LINUX_TYPE_SIMPLE = 0x70    /* Linear framebuffer without any additional functions.  */
+  };
 
 /* For the Linux/i386 boot protocol version 2.03.  */
 struct linux_kernel_header