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

Submitter:  Stas Sergeev <stsp>
Submitted:  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:  Git master
Release:  Reproducibility:  Intermittent
Planned Release:  2.03+

Jump to the original submission

Thu 05 Jul 2018 02:01:36 PM UTC, comment #7: 

Oops, please use patch from this comment
(prev one was bad).

(file #44510)

Stas Sergeev <stsp>
Thu 05 Jul 2018 01:58:54 PM UTC, comment #6: 

As this bug keeps hitting all i915 notebooks
(read: all notebooks), I had to dig a bit more.
The fix is attached.

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


I tried that and this didn't work.
Below are the 2 code pathes:

1.
grub_video_get_info_and_fini() ->
grub_video_vbe_get_info_and_fini() ->
grub_video_fb_get_info_and_fini() ->
{ set_page();  grub_video_fb_fini() }

2.
grub_video_set_mode() ->
grub_video_vbe_fini() ->
{ grub_vbe_bios_set_mode(); grub_video_fb_fini() }

If you move set_page() to grub_video_fb_fini(),
then it will work for case 1 but not for case 2,
as in case 2 it will be called after grub_vbe_bios_set_mode(),
yielding no results. Of course I could also move
grub_video_fb_fini() before grub_vbe_bios_set_mode(),
but not knowing the grub code well enough I was
afraid that then grub_vbe_bios_set_mode() will
use some already freed resources.
So I attached the simplest possible solution that
can't potentially break anything.

What do you think?

(file #44509)

Stas Sergeev <stsp>
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>
Group 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: 

Hi.

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' {
        recordfail
        load_video
        gfxmode text
        set gfxpayload=1920x1080x32
        multiboot /boot/x86_64-vmkos.img
        boot
}
---

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>
Group Member
Fri 09 Dec 2016 04:29:12 PM UTC, comment #1: 

Could you attach proposed patch?

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

Hello.

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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-07-05 stsp Attached File- Added 0001-reset-display_start-before-switching-mode.patch, #44510
    2018-07-05 stsp Attached File- Added 0001-reset-display_start-before-switching-mode.patch, #44509
    2017-03-05 phcoder Planned ReleaseNone 2.03+

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code