Skip to contentSkip to conversation

video: skip 'text' gfxpayload if not supported, to fallback to default

PATCH In review Mathieu Trudel-Lapierre 4 participants 5 messages Apr 29, 2019 – May 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: skip 'text' gfxpayload if not supported, to fallback to default

On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec with it, which will obviously fail. Fortunately, whatever gfxpayload is set, we still still have the 'auto' default to fall back to. Allow getting to this fallback by not trying to parse 'text' as a modespec.

This is because 'text' correctly doesn't parse as a modespec, and ought to have been ignored before we got to that point, just like it is immediately picked if we're running on a system where 'text' is a supported video mode.

Patch-Name: skip_text_gfxpayload_where_not_supported.patch

---
 grub-core/video/video.c | 2 ++
 1 file changed, 2 insertions(+)
grub-core/video/video.c +2 -0
index f252663c1..983424107 100644
@@ -663,6 +663,8 @@ grub_video_set_mode (const char *modestring,
 
 	      return GRUB_ERR_NONE;
 	    }
+	  else
+	    continue;
 	}
 
       err = parse_modespec (current_mode, &width, &height, &depth);
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Mathieu Trudel-Lapierre

On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec with it, which will obviously fail. Fortunately, whatever gfxpayload is set, we still still have the 'auto' default to fall back to. Allow getting to this fallback by not trying to parse 'text' as a modespec.

Quoted 7 lines

This is because 'text' correctly doesn't parse as a modespec, and ought to have been ignored before we got to that point, just like it is immediately picked if we're running on a system where 'text' is a supported video mode.

If there are no objections I will push it next week.

Daniel

#2 lore raw
Quoted 9 lines · Daniel Kiper
Quoted 8 lines · Mathieu Trudel-Lapierre

On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec with it, which will obviously fail. Fortunately, whatever gfxpayload is set, we still still have the 'auto' default to fall back to. Allow getting to this fallback by not trying to parse 'text' as a modespec.

This is because 'text' correctly doesn't parse as a modespec, and ought to have been ignored before we got to that point, just like it is immediately picked if we're running on a system where 'text' is a supported video mode.

As an aside, in a grub.cfg intended for both legacy and UEFI booting, can I condition setting either 'vga=normal' or 'gfxpayload=text' depending on the context detected by grub? If yes, how?

Best,

Didier

#3 lore raw
Quoted 8 lines · Didier Spaier
Quoted 6 lines · Daniel Kiper
Quoted 5 lines · Mathieu Trudel-Lapierre

On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec with it, which will obviously fail. Fortunately, whatever gfxpayload is set, we still still have the 'auto' default to fall back to. Allow getting to this fallback by not trying to parse 'text' as a modespec.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

This is because 'text' correctly doesn't parse as a modespec, and ought to have been ignored before we got to that point, just like it is immediately picked if we're running on a system where 'text' is a supported video mode.

As an aside, in a grub.cfg intended for both legacy and UEFI booting, can I condition setting either 'vga=normal' or 'gfxpayload=text' depending on the context detected by grub? If yes, how?

In grub.cfg; you can check if you're on the right platform by checking

$grub_platform

On UEFI, it will read "efi".

Signature · 3 lines
Mathieu Trudel-Lapierre <[email protected]>
Freenode: cyphermox, Jabber: [email protected]
4096R/65B58DA1 818A D123 0992 275B 23C2  CF89 C67B B4D6 65B5 8DA1
#4 lore raw
Quoted 18 lines · Mathieu Trudel-Lapierre
Quoted 8 lines · Didier Spaier
Quoted 6 lines · Daniel Kiper
Quoted 5 lines · Mathieu Trudel-Lapierre

On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec with it, which will obviously fail. Fortunately, whatever gfxpayload is set, we still still have the 'auto' default to fall back to. Allow getting to this fallback by not trying to parse 'text' as a modespec.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

This is because 'text' correctly doesn't parse as a modespec, and ought to have been ignored before we got to that point, just like it is immediately picked if we're running on a system where 'text' is a supported video mode.

As an aside, in a grub.cfg intended for both legacy and UEFI booting, can I condition setting either 'vga=normal' or 'gfxpayload=text' depending on the context detected by grub? If yes, how?

Quoted 5 lines

In grub.cfg; you can check if you're on the right platform by checking

$grub_platform

On UEFI, it will read "efi".

Thanks!