Felix Kuehling reported intermittent black-screen problems when
switching Linux VT on certain configurations.  This happens because in
the case where we're using double-buffering we pass a framebuffer base
to the kernel corresponding to whichever page we happened to be using as
the front target when we shut down the video subsystem, and not all
kernel drivers are happy with this.  It would be better to consistently
use page zero.

2011-03-24  Colin Watson  <cjwat...@ubuntu.com>

        * 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.

=== modified file 'grub-core/video/fb/video_fb.c'
--- grub-core/video/fb/video_fb.c       2010-05-16 13:01:54 +0000
+++ grub-core/video/fb/video_fb.c       2011-03-24 16:21:25 +0000
@@ -1505,6 +1505,20 @@ grub_video_fb_get_info_and_fini (struct
 {
   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 ();

-- 
Colin Watson                                       [cjwat...@ubuntu.com]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to