From 380c39cb25e2905d66cefda5638ddbf448430149 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 Sep 2010 22:11:22 +0200 Subject: [PATCH] Show adapter-specific info --- grub-core/commands/videoinfo.c | 13 ++++++++++++- grub-core/video/i386/pc/vbe.c | 15 +++++++++++++++ include/grub/video.h | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c index e03b3372d..a9e8be745 100644 --- a/grub-core/commands/videoinfo.c +++ b/grub-core/commands/videoinfo.c @@ -66,16 +66,27 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)), 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->init ()) { + grub_printf (" Failed\n"); grub_errno = GRUB_ERR_NONE; continue; } } - grub_printf ("Adapter '%s':\n", adapter->name); + if (adapter->print_adapter_specific_info) + adapter->print_adapter_specific_info (); + adapter->iterate (hook); if (adapter->id != id) diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c index 6b089db04..1d2a9ac76 100644 --- a/grub-core/video/i386/pc/vbe.c +++ b/grub-core/video/i386/pc/vbe.c @@ -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); } +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 = { .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, .get_active_render_target = grub_video_fb_get_active_render_target, .iterate = grub_video_vbe_iterate, + .print_adapter_specific_info = grub_video_vbe_print_adapter_specific_info, .next = 0 }; diff --git a/include/grub/video.h b/include/grub/video.h index 40bd5e615..1c1bf16ab 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -287,6 +287,8 @@ struct grub_video_adapter grub_err_t (*get_active_render_target) (struct grub_video_render_target **target); 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;