Video driver ID.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-13 14:03:18 +01:00
parent 19eb83d486
commit ca732b36c1
5 changed files with 21 additions and 0 deletions

View file

@ -159,10 +159,19 @@ struct grub_video_palette_data
grub_uint8_t a; /* Reserved bits value (0-255). */ grub_uint8_t a; /* Reserved bits value (0-255). */
}; };
typedef enum grub_video_driver_id
{
GRUB_VIDEO_DRIVER_NONE,
GRUB_VIDEO_DRIVER_VBE,
GRUB_VIDEO_DRIVER_EFI_UGA,
GRUB_VIDEO_DRIVER_EFI_GOP
} grub_video_driver_id_t;
struct grub_video_adapter struct grub_video_adapter
{ {
/* The video adapter name. */ /* The video adapter name. */
const char *name; const char *name;
grub_video_driver_id_t id;
/* Initialize the video adapter. */ /* Initialize the video adapter. */
grub_err_t (*init) (void); grub_err_t (*init) (void);
@ -309,5 +318,6 @@ grub_err_t grub_video_get_active_render_target (struct grub_video_render_target
grub_err_t grub_video_set_mode (const char *modestring, grub_err_t grub_video_set_mode (const char *modestring,
int NESTED_FUNC_ATTR (*hook) (grub_video_adapter_t p, int NESTED_FUNC_ATTR (*hook) (grub_video_adapter_t p,
struct grub_video_mode_info *mode_info)); struct grub_video_mode_info *mode_info));
grub_video_driver_id_t grub_video_get_driver_id (void);
#endif /* ! GRUB_VIDEO_HEADER */ #endif /* ! GRUB_VIDEO_HEADER */

View file

@ -353,6 +353,7 @@ grub_video_gop_get_info_and_fini (struct grub_video_mode_info *mode_info,
static struct grub_video_adapter grub_video_gop_adapter = static struct grub_video_adapter grub_video_gop_adapter =
{ {
.name = "EFI GOP driver", .name = "EFI GOP driver",
.id = GRUB_VIDEO_DRIVER_EFI_GOP,
.init = grub_video_gop_init, .init = grub_video_gop_init,
.fini = grub_video_gop_fini, .fini = grub_video_gop_fini,

View file

@ -300,6 +300,7 @@ grub_video_uga_get_info_and_fini (struct grub_video_mode_info *mode_info,
static struct grub_video_adapter grub_video_uga_adapter = static struct grub_video_adapter grub_video_uga_adapter =
{ {
.name = "EFI UGA driver", .name = "EFI UGA driver",
.id = GRUB_VIDEO_DRIVER_EFI_UGA,
.init = grub_video_uga_init, .init = grub_video_uga_init,
.fini = grub_video_uga_fini, .fini = grub_video_uga_fini,

View file

@ -557,6 +557,7 @@ grub_video_vbe_get_info_and_fini (struct grub_video_mode_info *mode_info,
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",
.id = GRUB_VIDEO_DRIVER_VBE,
.init = grub_video_vbe_init, .init = grub_video_vbe_init,
.fini = grub_video_vbe_fini, .fini = grub_video_vbe_fini,

View file

@ -93,6 +93,14 @@ grub_video_get_info (struct grub_video_mode_info *mode_info)
return grub_video_adapter_active->get_info (mode_info); return grub_video_adapter_active->get_info (mode_info);
} }
grub_video_driver_id_t
grub_video_get_driver_id (void)
{
if (! grub_video_adapter_active)
return GRUB_VIDEO_DRIVER_NONE;
return grub_video_adapter_active->id;
}
/* Get information about active video mode. */ /* Get information about active video mode. */
grub_err_t grub_err_t
grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info, grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info,