Preferred resolution detection for VBE.
* grub-core/video/video.c (grub_video_edid_checksum): New function. (grub_video_edid_preferred_mode): Likewise. Try EDID followed by the Flat Panel extension, in line with the X.org VESA driver. * grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_flat_panel_info): New function. (grub_vbe_bios_get_ddc_capabilities): Likewise. (grub_vbe_bios_read_edid): Likewise. (grub_vbe_get_preferred_mode): Likewise. (grub_video_vbe_setup): When the mode is "auto", try to get the preferred mode from VBE, and use the largest mode that is no larger than the preferred mode (some BIOSes expose a preferred mode that is not in their mode list!). If this fails, fall back to 640x480 as a safe conservative choice. (grub_video_vbe_get_edid): New function. (grub_video_vbe_adapter): Add get_edid. * include/grub/video.h (struct grub_vbe_edid_info): New structure. (struct grub_video_adapter): Add get_edid. (grub_video_edid_checksum): Add prototype. (grub_video_edid_preferred_mode): Likewise. * include/grub/i386/pc/vbe.h (struct grub_vbe_flat_panel_info): New structure. * grub-core/commands/videoinfo.c (print_edid): New function. (grub_cmd_videoinfo): Print EDID if available. * util/grub.d/00_header.in (GRUB_GFXMODE): Default to "auto". This is more appropriate on a wider range of platforms than 640x480. * docs/grub.texi (Simple configuration): Update GRUB_GFXMODE documentation.
This commit is contained in:
commit
8fc4fa45c5
8 changed files with 333 additions and 6 deletions
|
@ -86,6 +86,30 @@ hook (const struct grub_video_mode_info *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
print_edid (struct grub_video_edid_info *edid_info)
|
||||
{
|
||||
unsigned int edid_width, edid_height;
|
||||
|
||||
if (grub_video_edid_checksum (edid_info))
|
||||
{
|
||||
grub_printf (" EDID checksum invalid\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
grub_printf (" EDID version: %u.%u\n",
|
||||
edid_info->version, edid_info->revision);
|
||||
if (grub_video_edid_preferred_mode (edid_info, &edid_width, &edid_height)
|
||||
== GRUB_ERR_NONE)
|
||||
grub_printf (" Preferred mode: %ux%u\n", edid_width, edid_height);
|
||||
else
|
||||
{
|
||||
grub_printf (" No preferred mode available\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
|
@ -130,6 +154,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
FOR_VIDEO_ADAPTERS (adapter)
|
||||
{
|
||||
struct grub_video_mode_info info;
|
||||
struct grub_video_edid_info edid_info;
|
||||
|
||||
grub_printf ("Adapter '%s':\n", adapter->name);
|
||||
|
||||
|
@ -164,6 +189,11 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
adapter->iterate (hook);
|
||||
|
||||
if (adapter->get_edid && adapter->get_edid (&edid_info) == GRUB_ERR_NONE)
|
||||
print_edid (&edid_info);
|
||||
else
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
current_mode = NULL;
|
||||
|
||||
if (adapter->id != id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue