diff mbox series

[5/5] multiboot2: parse vga= option when setting GOP mode

Message ID 20221123154525.63068-6-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series gfx: improvements when using multiboot2 and EFI + misc | expand

Commit Message

Roger Pau Monné Nov. 23, 2022, 3:45 p.m. UTC
Currently the vga command line gfx- option is ignored when booted
using multboot2 and EFI, as the setting of the GOP mode is done way
before the command line is processed.

Add support for parsing the vga gfx- selection if present in order to
set the selected GOP mode.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/efi/efi-boot.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Jan Beulich Dec. 5, 2022, 4:26 p.m. UTC | #1
On 23.11.2022 16:45, Roger Pau Monne wrote:
> Currently the vga command line gfx- option is ignored when booted
> using multboot2 and EFI, as the setting of the GOP mode is done way
> before the command line is processed.
> 
> Add support for parsing the vga gfx- selection if present in order to
> set the selected GOP mode.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
albeit personally I think this should be folded into the previous patch.

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 695491a5b7..e791d65213 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -835,7 +835,22 @@  void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable
 
         if ( vga )
         {
-            gop_mode = efi_find_gop_mode(gop, 0, 0, 0);
+            unsigned int width = 0, height = 0, depth = 0;
+
+            opt = get_option(cmdline, "vga=gfx-");
+            if ( opt )
+            {
+                width = simple_strtoul(opt, &opt, 10);
+                if ( *opt == 'x' )
+                    height = simple_strtoul(opt + 1, &opt, 10);
+                if ( *opt == 'x' )
+                    depth = simple_strtoul(opt + 1, &opt, 10);
+                /* Allow depth to be 0 or unset. */
+                if ( !width || !height )
+                    width = height = depth = 0;
+            }
+
+            gop_mode = efi_find_gop_mode(gop, width, height, depth);
         }
 
         efi_arch_edid(gop_handle);