From 4787931fe0b44613c0758d34234f2510ac24e3cf Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 Sep 2010 21:40:40 +0200 Subject: [PATCH] Show mode id --- grub-core/commands/videoinfo.c | 10 +++++++--- grub-core/video/i386/pc/vbe.c | 10 +++++++--- include/grub/video.h | 3 +++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c index 405c73774..e03b3372d 100644 --- a/grub-core/commands/videoinfo.c +++ b/grub-core/commands/videoinfo.c @@ -28,11 +28,15 @@ static int hook (const struct grub_video_mode_info *info) { - grub_printf (" %4d x %4d x %2d ", info->height, info->width, info->bpp); + if (info->mode_number == GRUB_VIDEO_MODE_NUMBER_INVALID) + grub_printf (" "); + else + grub_printf (" 0x%03x ", info->mode_number); + grub_printf ("%4d x %4d x %2d ", info->height, info->width, info->bpp); /* Show mask and position details for direct color modes. */ if (info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB) - grub_printf ("D, mask: %d/%d/%d/%d pos: %d/%d/%d/%d", + grub_printf ("Direct, mask: %d/%d/%d/%d pos: %d/%d/%d/%d", info->red_mask_size, info->green_mask_size, info->blue_mask_size, @@ -42,7 +46,7 @@ hook (const struct grub_video_mode_info *info) info->blue_field_pos, info->reserved_field_pos); if (info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) - grub_printf ("P"); + grub_printf ("Packed"); grub_printf ("\n"); return 0; diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c index 082c9bc84..6b089db04 100644 --- a/grub-core/video/i386/pc/vbe.c +++ b/grub-core/video/i386/pc/vbe.c @@ -547,9 +547,12 @@ doublebuf_pageflipping_set_page (int page) } static void -vbe2videoinfo (const struct grub_vbe_mode_info_block *vbeinfo, +vbe2videoinfo (grub_uint32_t mode, + const struct grub_vbe_mode_info_block *vbeinfo, struct grub_video_mode_info *mode_info) { + mode_info->mode_number = mode; + mode_info->width = vbeinfo->x_resolution; mode_info->height = vbeinfo->y_resolution; switch (vbeinfo->memory_model) @@ -619,7 +622,7 @@ grub_video_vbe_iterate (int (*hook) (const struct grub_video_mode_info *info)) break; } - vbe2videoinfo (&vbe_mode_info, &mode_info); + vbe2videoinfo (*p, &vbe_mode_info, &mode_info); if (hook (&mode_info)) return 1; } @@ -735,7 +738,8 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, return grub_errno; /* Fill mode info details. */ - vbe2videoinfo (&active_vbe_mode_info, &framebuffer.mode_info); + vbe2videoinfo (best_vbe_mode, &active_vbe_mode_info, + &framebuffer.mode_info); { /* Get video RAM size in bytes. */ diff --git a/include/grub/video.h b/include/grub/video.h index d530ab415..40bd5e615 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -117,6 +117,9 @@ struct grub_video_mode_info /* In index color mode, number of colors. In RGB mode this is 256. */ unsigned int number_of_colors; + unsigned int mode_number; +#define GRUB_VIDEO_MODE_NUMBER_INVALID 0xffffffff + /* Optimization hint how binary data is coded. */ enum grub_video_blit_format blit_format;