bugGNU GRUB - Bugs: bug #49814, vbe does not reset display start


You are not allowed to post comments on this tracker with your current authentication level.

bug #49814: vbe does not reset display start

Submitted by:  Stas Sergeev <stsp>
Submitted on:  Fri 09 Dec 2016 03:35:00 PM UTC  
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  stsp
Open/Closed:  Open Release: 
Release:  Git master Reproducibility:  Intermittent
Planned Release:  2.03+

Thu 06 Apr 2017 04:48:26 PM UTC, comment #5:

> The bug happens only if grub works in gfx
> mode but the boot happens in text mode.

Good catch. I won't claim to fully understand this code, but as far as I can tell in grub_video_set_mode()

- if we have "keep" we simply return keeping current adapter
- if we have graphic mode, we reinitialize adapter

in both cases we later reset current page in grub_video_fb_get_info_and_fini(). But if we have test mode then

- we shut down current video adapter without changing current page, and probably reset it to NULL

it means we are left with whatever was set before.

May be we need wrapper around ->fini() method that resets current page (moving code from grub_video_fb_get_info_and_fini()).

Andrei Borzenkov <arvidjaar>
Project Member
Thu 06 Apr 2017 12:02:31 PM UTC, comment #4:

I think grub restores the display start only
when the boot happens in graphics mode. In fact,
I wasn't able to reproduce the problem in that
case. The bug happens only if grub works in gfx
mode but the boot happens in text mode.
In this case, when the app under booted OS activates
the video mode that was previously used by grub,
then, out of sudden, display_start appears to be
the one that grub have left.
As I initially said, this is not a grub's bug -
video bios should not preserve any values across
mode switching. Unfortunately the buggy bios does
exactly this, and grub can provide a work-around
by resetting display_start even when it is going
to switch to text mode.
So could you please confirm if grub resets the
display_start even before the text-mode boot?

Stas Sergeev <stsp>
Mon 03 Apr 2017 12:19:38 PM UTC, comment #3:


I am very sorry to not participate here, but the
savannah e-mails got spam-blocked. :(

So the problem is likely that I am not using the
linux loader then? The relevant config part is:
menuentry 'KOS_64' {
gfxmode text
set gfxpayload=1920x1080x32
multiboot /boot/x86_64-vmkos.img

Let me know if additional info is needed.
Unfortunately I don't have the patch because
I simply changed the driver to reset display_start
by hands.

Stas Sergeev <stsp>
Fri 09 Dec 2016 04:41:11 PM UTC, comment #2:

> When exiting and setting the old mode, it doesn't
> reset the display start.

It should do it in grub_video_fb_get_info_and_fini() which should be called by at least linux loaders (via grub_video_get_info_and_fini). Please give more details about your setup and grub.cfg.

Andrei Borzenkov <arvidjaar>
Project Member
Fri 09 Dec 2016 04:29:12 PM UTC, comment #1:

Could you attach proposed patch?

Andrei Borzenkov <arvidjaar>
Project Member
Fri 09 Dec 2016 03:35:00 PM UTC, original submission:


grub2's vbe module uses page flipping.
When exiting and setting the old mode, it doesn't
reset the display start.
This is perfectly fine as long as the vbios does things right.
Unfortunately some vbioses forget to reset the display start
when setting new mode, and even when doing POST.
The result is that when some app sets the video mode and draws,
there is just a blank screen.
This bug has very poor reproducibility before you find out
its roots. For example it you set a too small timeout in grub,
there will be no problem, because the problem happens only when
the timeout clocks are ticking. So, after about a month of
debugging, I finally know how to reproduce it reliably: set
quite large timeout (>3sec), wait for the timer to appear and
start ticking, then press Enter. In this case grub will exit
with active page not within the first frame buffer (depending
on the luck, may need a few retries), and, if the vbios is buggy
too, you get the permanent blank screen.

The easiest work-around is so that grub to reset the display
start before restoring the original video mode.

Stas Sergeev <stsp>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by phcoder (Updated the item)
  • -email is unavailable- added by arvidjaar (Posted a comment)
  • -email is unavailable- added by stsp (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    Sun 05 Mar 2017 07:16:20 PM UTC phcoder Planned ReleaseNone => 2.03+

    Back to the top

    Powered by Savane 3.1-cleanup1