diff --git a/include/grub/video.h b/include/grub/video.h index faf2973ef..03de1c27b 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -183,9 +183,19 @@ typedef enum grub_video_driver_id GRUB_VIDEO_DRIVER_EFI_UGA, GRUB_VIDEO_DRIVER_EFI_GOP, GRUB_VIDEO_DRIVER_SM712, - GRUB_VIDEO_DRIVER_VGA + GRUB_VIDEO_DRIVER_VGA, + GRUB_VIDEO_DRIVER_SDL } grub_video_driver_id_t; +typedef enum grub_video_adapter_prio + { + GRUB_VIDEO_ADAPTER_PRIO_FALLBACK = 60, + GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY = 70, + GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE = 80, + GRUB_VIDEO_ADAPTER_PRIO_NATIVE = 100 + } grub_video_adapter_prio_t; + + struct grub_video_adapter { /* The next video adapter. */ @@ -195,6 +205,8 @@ struct grub_video_adapter const char *name; grub_video_driver_id_t id; + grub_video_adapter_prio_t prio; + /* Initialize the video adapter. */ grub_err_t (*init) (void); @@ -269,8 +281,11 @@ extern grub_video_adapter_t EXPORT_VAR(grub_video_adapter_list); static inline void grub_video_register (grub_video_adapter_t adapter) { - grub_list_push (GRUB_AS_LIST_P (&grub_video_adapter_list), - GRUB_AS_LIST (adapter)); + grub_video_adapter_t *p; + for (p = &grub_video_adapter_list; *p && (*p)->prio > adapter->prio; + p = &((*p)->next)); + adapter->next = *p; + *p = adapter; } #endif diff --git a/video/efi_gop.c b/video/efi_gop.c index 86a2881f8..4e79b8521 100644 --- a/video/efi_gop.c +++ b/video/efi_gop.c @@ -355,6 +355,8 @@ static struct grub_video_adapter grub_video_gop_adapter = .name = "EFI GOP driver", .id = GRUB_VIDEO_DRIVER_EFI_GOP, + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, + .init = grub_video_gop_init, .fini = grub_video_gop_fini, .setup = grub_video_gop_setup, diff --git a/video/efi_uga.c b/video/efi_uga.c index eb4e6b42e..6352d4342 100644 --- a/video/efi_uga.c +++ b/video/efi_uga.c @@ -302,6 +302,8 @@ static struct grub_video_adapter grub_video_uga_adapter = .name = "EFI UGA driver", .id = GRUB_VIDEO_DRIVER_EFI_UGA, + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY, + .init = grub_video_uga_init, .fini = grub_video_uga_fini, .setup = grub_video_uga_setup, diff --git a/video/emu/sdl.c b/video/emu/sdl.c index d261db6b0..d66b8b0c0 100644 --- a/video/emu/sdl.c +++ b/video/emu/sdl.c @@ -200,6 +200,9 @@ grub_video_sdl_set_active_render_target (struct grub_video_render_target *target static struct grub_video_adapter grub_video_sdl_adapter = { .name = "SDL Video Driver", + .id = GRUB_VIDEO_DRIVER_SDL, + + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, .init = grub_video_sdl_init, .fini = grub_video_sdl_fini, diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c index 72b8f1831..0cc9f8000 100644 --- a/video/i386/pc/vbe.c +++ b/video/i386/pc/vbe.c @@ -783,6 +783,8 @@ static struct grub_video_adapter grub_video_vbe_adapter = .name = "VESA BIOS Extension Video Driver", .id = GRUB_VIDEO_DRIVER_VBE, + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, + .init = grub_video_vbe_init, .fini = grub_video_vbe_fini, .setup = grub_video_vbe_setup, diff --git a/video/i386/pc/vga.c b/video/i386/pc/vga.c index 222a71272..a4fd44ecd 100644 --- a/video/i386/pc/vga.c +++ b/video/i386/pc/vga.c @@ -375,6 +375,8 @@ static struct grub_video_adapter grub_video_vga_adapter = .name = "VGA Video Driver", .id = GRUB_VIDEO_DRIVER_VGA, + .prio = GRUB_VIDEO_ADAPTER_PRIO_FALLBACK, + .init = grub_video_vga_init, .fini = grub_video_vga_fini, .setup = grub_video_vga_setup, diff --git a/video/ieee1275.c b/video/ieee1275.c index 5c6bc1594..9c9477c2b 100644 --- a/video/ieee1275.c +++ b/video/ieee1275.c @@ -254,6 +254,8 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = { .name = "IEEE1275 video driver", + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, + .init = grub_video_ieee1275_init, .fini = grub_video_ieee1275_fini, .setup = grub_video_ieee1275_setup, diff --git a/video/sm712.c b/video/sm712.c index 33861beef..98ce523c9 100644 --- a/video/sm712.c +++ b/video/sm712.c @@ -193,6 +193,8 @@ static struct grub_video_adapter grub_video_sm712_adapter = .name = "SM712 Video Driver", .id = GRUB_VIDEO_DRIVER_SM712, + .prio = GRUB_VIDEO_ADAPTER_PRIO_NATIVE, + .init = grub_video_sm712_video_init, .fini = grub_video_sm712_video_fini, .setup = grub_video_sm712_setup,