Show adapter-specific info

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-03 22:11:22 +02:00
parent 4787931fe0
commit 380c39cb25
3 changed files with 29 additions and 1 deletions

View file

@ -66,16 +66,27 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
FOR_VIDEO_ADAPTERS (adapter) FOR_VIDEO_ADAPTERS (adapter)
{ {
grub_printf ("Adapter '%s':\n", adapter->name);
if (!adapter->iterate)
{
grub_printf (" No info available\n");
continue;
}
if (adapter->id != id) if (adapter->id != id)
{ {
if (adapter->init ()) if (adapter->init ())
{ {
grub_printf (" Failed\n");
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
continue; continue;
} }
} }
grub_printf ("Adapter '%s':\n", adapter->name); if (adapter->print_adapter_specific_info)
adapter->print_adapter_specific_info ();
adapter->iterate (hook); adapter->iterate (hook);
if (adapter->id != id) if (adapter->id != id)

View file

@ -798,6 +798,20 @@ 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 void
grub_video_vbe_print_adapter_specific_info (void)
{
grub_printf (" VBE info: version: %d.%d OEM software rev: %d.%d\n",
controller_info.version >> 8,
controller_info.version & 0xFF,
controller_info.oem_software_rev >> 8,
controller_info.oem_software_rev & 0xFF);
/* The total_memory field is in 64 KiB units. */
grub_printf (" total memory: %d KiB\n",
(controller_info.total_memory << 16) / 1024);
}
static struct grub_video_adapter grub_video_vbe_adapter = static struct grub_video_adapter grub_video_vbe_adapter =
{ {
.name = "VESA BIOS Extension Video Driver", .name = "VESA BIOS Extension Video Driver",
@ -828,6 +842,7 @@ static struct grub_video_adapter grub_video_vbe_adapter =
.set_active_render_target = grub_video_fb_set_active_render_target, .set_active_render_target = grub_video_fb_set_active_render_target,
.get_active_render_target = grub_video_fb_get_active_render_target, .get_active_render_target = grub_video_fb_get_active_render_target,
.iterate = grub_video_vbe_iterate, .iterate = grub_video_vbe_iterate,
.print_adapter_specific_info = grub_video_vbe_print_adapter_specific_info,
.next = 0 .next = 0
}; };

View file

@ -287,6 +287,8 @@ struct grub_video_adapter
grub_err_t (*get_active_render_target) (struct grub_video_render_target **target); grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
int (*iterate) (int (*hook) (const struct grub_video_mode_info *info)); int (*iterate) (int (*hook) (const struct grub_video_mode_info *info));
void (*print_adapter_specific_info) (void);
}; };
typedef struct grub_video_adapter *grub_video_adapter_t; typedef struct grub_video_adapter *grub_video_adapter_t;