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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-11 00:02:01 +01:00
parent c2fa6cbb42
commit 3395fe5230
4 changed files with 57 additions and 17 deletions

2
BUGS Normal file
View File

@ -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.

View File

@ -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> 2011-01-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-menulst2cfg.c: Add missing include of misc.h. * util/grub-menulst2cfg.c: Add missing include of misc.h.

View File

@ -313,6 +313,13 @@ grub_linux_setup_video (struct linux_kernel_params *params)
struct grub_video_mode_info mode_info; struct grub_video_mode_info mode_info;
void *framebuffer; void *framebuffer;
grub_err_t err; 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); 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_mask_size = mode_info.reserved_mask_size;
params->reserved_field_pos = mode_info.reserved_field_pos; 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 #ifdef GRUB_MACHINE_PCBIOS
/* VESA packed modes may come with zeroed mask sizes, which need /* VESA packed modes may come with zeroed mask sizes, which need
to be set here according to DAC Palette width. If we don't, to be set here according to DAC Palette width. If we don't,
this results in Linux displaying a black screen. */ 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; struct grub_vbe_info_block controller_info;
int status; int status;
@ -457,15 +492,7 @@ grub_linux_boot (void)
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
} }
if (! grub_linux_setup_video (params)) 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 defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
params->have_vga = GRUB_VIDEO_LINUX_TYPE_TEXT; params->have_vga = GRUB_VIDEO_LINUX_TYPE_TEXT;
@ -771,10 +798,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
break; 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 linux_mode = &grub_vesa_mode_table[vid_mode
- GRUB_VESA_MODE_TABLE_START]; - GRUB_VESA_MODE_TABLE_START];

View File

@ -79,9 +79,13 @@ struct grub_e820_mmap
grub_uint32_t type; grub_uint32_t type;
} __attribute__((packed)); } __attribute__((packed));
#define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01 enum
#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. */ 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. */ /* For the Linux/i386 boot protocol version 2.03. */
struct linux_kernel_header struct linux_kernel_header