grub_video_get_edid is not usable from grub_vbe_get_preferred_mode, as a
video adapter has not necessarily yet been set. Use grub_video_vbe_get_edid and grub_video_edid_checksum directly instead. Remove grub_video_get_edid as it now has no users. Reported by: Marjo Mercado.
This commit is contained in:
parent
cb918eddf4
commit
9b300caf84
4 changed files with 21 additions and 41 deletions
|
@ -1,9 +1,8 @@
|
||||||
2011-01-15 Colin Watson <cjwatson@ubuntu.com>
|
2011-01-17 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
Preferred resolution detection for VBE.
|
Preferred resolution detection for VBE.
|
||||||
|
|
||||||
* grub-core/video/video.c (grub_video_edid_checksum): New function.
|
* grub-core/video/video.c (grub_video_edid_checksum): New function.
|
||||||
(grub_video_get_edid): Likewise.
|
|
||||||
(grub_video_edid_preferred_mode): Likewise. Try EDID followed by
|
(grub_video_edid_preferred_mode): Likewise. Try EDID followed by
|
||||||
the Flat Panel extension, in line with the X.org VESA driver.
|
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):
|
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_flat_panel_info):
|
||||||
|
@ -21,7 +20,6 @@
|
||||||
* include/grub/video.h (struct grub_vbe_edid_info): New structure.
|
* include/grub/video.h (struct grub_vbe_edid_info): New structure.
|
||||||
(struct grub_video_adapter): Add get_edid.
|
(struct grub_video_adapter): Add get_edid.
|
||||||
(grub_video_edid_checksum): Add prototype.
|
(grub_video_edid_checksum): Add prototype.
|
||||||
(grub_video_get_edid): Likewise.
|
|
||||||
(grub_video_edid_preferred_mode): Likewise.
|
(grub_video_edid_preferred_mode): Likewise.
|
||||||
* include/grub/i386/pc/vbe.h (struct grub_vbe_flat_panel_info): New
|
* include/grub/i386/pc/vbe.h (struct grub_vbe_flat_panel_info): New
|
||||||
structure.
|
structure.
|
||||||
|
|
|
@ -377,6 +377,24 @@ grub_vbe_probe (struct grub_vbe_info_block *info_block)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_video_vbe_get_edid (struct grub_video_edid_info *edid_info)
|
||||||
|
{
|
||||||
|
struct grub_video_edid_info *edid_info_lowmem;
|
||||||
|
|
||||||
|
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
|
||||||
|
edid_info_lowmem =
|
||||||
|
(struct grub_video_edid_info *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||||
|
grub_memset (edid_info_lowmem, 0, sizeof (*edid_info_lowmem));
|
||||||
|
|
||||||
|
if (grub_vbe_bios_read_edid (edid_info_lowmem) != GRUB_VBE_STATUS_OK)
|
||||||
|
return grub_error (GRUB_ERR_BAD_DEVICE, "EDID information not available");
|
||||||
|
|
||||||
|
grub_memcpy (edid_info, edid_info_lowmem, sizeof (*edid_info));
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
|
grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +412,8 @@ grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
|
||||||
&& (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff)
|
&& (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff)
|
||||||
== GRUB_VBE_STATUS_OK)
|
== GRUB_VBE_STATUS_OK)
|
||||||
{
|
{
|
||||||
if (grub_video_get_edid (&edid_info) == GRUB_ERR_NONE
|
if (grub_video_vbe_get_edid (&edid_info) == GRUB_ERR_NONE
|
||||||
|
&& grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE
|
||||||
&& grub_video_edid_preferred_mode (&edid_info, width, height)
|
&& grub_video_edid_preferred_mode (&edid_info, width, height)
|
||||||
== GRUB_ERR_NONE)
|
== GRUB_ERR_NONE)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
@ -969,24 +988,6 @@ grub_video_vbe_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
||||||
return grub_video_fb_get_info_and_fini (mode_info, framebuf);
|
return grub_video_fb_get_info_and_fini (mode_info, framebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_video_vbe_get_edid (struct grub_video_edid_info *edid_info)
|
|
||||||
{
|
|
||||||
struct grub_video_edid_info *edid_info_lowmem;
|
|
||||||
|
|
||||||
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
|
|
||||||
edid_info_lowmem =
|
|
||||||
(struct grub_video_edid_info *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
|
||||||
grub_memset (edid_info_lowmem, 0, sizeof (*edid_info_lowmem));
|
|
||||||
|
|
||||||
if (grub_vbe_bios_read_edid (edid_info_lowmem) != GRUB_VBE_STATUS_OK)
|
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE, "EDID information not available");
|
|
||||||
|
|
||||||
grub_memcpy (edid_info, edid_info_lowmem, sizeof (*edid_info));
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grub_video_vbe_print_adapter_specific_info (void)
|
grub_video_vbe_print_adapter_specific_info (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -393,24 +393,6 @@ grub_video_edid_checksum (struct grub_video_edid_info *edid_info)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t
|
|
||||||
grub_video_get_edid (struct grub_video_edid_info *edid_info)
|
|
||||||
{
|
|
||||||
if (! grub_video_adapter_active)
|
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
|
|
||||||
|
|
||||||
if (! grub_video_adapter_active->get_edid)
|
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE,
|
|
||||||
"EDID information unavailable for this video mode");
|
|
||||||
|
|
||||||
if (grub_video_adapter_active->get_edid (edid_info) != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
if (grub_video_edid_checksum (edid_info) != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
|
grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
|
||||||
unsigned int *width, unsigned int *height)
|
unsigned int *width, unsigned int *height)
|
||||||
|
|
|
@ -486,7 +486,6 @@ grub_err_t EXPORT_FUNC (grub_video_set_active_render_target) (struct grub_video_
|
||||||
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
|
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
|
||||||
|
|
||||||
grub_err_t grub_video_edid_checksum (struct grub_video_edid_info *edid_info);
|
grub_err_t grub_video_edid_checksum (struct grub_video_edid_info *edid_info);
|
||||||
grub_err_t grub_video_get_edid (struct grub_video_edid_info *edid_info);
|
|
||||||
grub_err_t grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
|
grub_err_t grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
|
||||||
unsigned int *width,
|
unsigned int *width,
|
||||||
unsigned int *height);
|
unsigned int *height);
|
||||||
|
|
Loading…
Reference in a new issue