Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Q2nOE-0002uE-DX for mharc-grub-devel@gnu.org; Thu, 24 Mar 2011 12:28:02 -0400 Received: from [140.186.70.92] (port=44785 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2nOA-0002gQ-ET for grub-devel@gnu.org; Thu, 24 Mar 2011 12:28:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2nNl-0001to-J0 for grub-devel@gnu.org; Thu, 24 Mar 2011 12:27:34 -0400 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:54009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2nNl-0001tU-Eb for grub-devel@gnu.org; Thu, 24 Mar 2011 12:27:33 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Q2nNh-0000TG-Mc; Thu, 24 Mar 2011 16:27:29 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 4.72) (envelope-from ) id 1Q2nNg-00053S-76; Thu, 24 Mar 2011 16:27:28 +0000 Date: Thu, 24 Mar 2011 16:27:27 +0000 From: Colin Watson To: grub-devel@gnu.org Message-ID: <20110324162727.GB19188@riva.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 212.23.3.141 Cc: Felix Kuehling Subject: [PATCH] Switch back to page 0 before loading kernel X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2011 16:28:01 -0000 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 * 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 [cjwatson@ubuntu.com]