From 4c6c9431d2f72d6b7397a39e81e0112a01e3ec97 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 25 Mar 2011 00:03:54 +0000 Subject: [PATCH] * grub-core/video/fb/video_fb.c (grub_video_fb_get_info_and_fini): Switch back to page zero before loading a kernel, since some kernel drivers expect that. Thanks to: Felix Kuehling. --- ChangeLog | 7 +++++++ grub-core/video/fb/video_fb.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8744dbff3..b556c77e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-03-24 Colin Watson + + * grub-core/video/fb/video_fb.c (grub_video_fb_get_info_and_fini): + Switch back to page zero before loading a kernel, since some kernel + drivers expect that. + Thanks to: Felix Kuehling. + 2011-03-24 Vladimir Serbinenko * grub-core/lib/relocator.c (grub_relocator_alloc_chunk_addr) diff --git a/grub-core/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c index 69626be5c..768b63328 100644 --- a/grub-core/video/fb/video_fb.c +++ b/grub-core/video/fb/video_fb.c @@ -1505,6 +1505,20 @@ grub_video_fb_get_info_and_fini (struct grub_video_mode_info *mode_info, { grub_memcpy (mode_info, &(framebuffer.front_target->mode_info), sizeof (*mode_info)); + + /* We are about to load a kernel. Switch back to page zero, since some + kernel drivers expect that. */ + if ((mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED) + && framebuffer.set_page && framebuffer.displayed_page != 0) + { + /* Ensure both pages are exactly in sync. */ + grub_memcpy (framebuffer.back_target->data, + framebuffer.front_target->data, + framebuffer.back_target->mode_info.pitch + * framebuffer.back_target->mode_info.height); + grub_video_swap_buffers (); + } + *framebuf = framebuffer.front_target->data; grub_video_fb_fini ();