[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/5] efi: try to use the currently set GOP mode


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 23 Nov 2022 16:45:22 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I67lgI11eTbs3SxHKjPkzA3VPvUoeQg5Ok/IMGaO6DU=; b=jY+2C0hXbmg4mlAiJpM9IpIXnTPOzFu218yQ3FRtvHFAF+C6mL/GRjTey3N6Xr6GNqKs/KcbfiqCrXbhhTzp7JviIGGCrL0yXduHPF31KaLe/BdEOXj9WbEgG7yALLP2N8A8ivlewGoeqmW31dpxslHcWnnk6K1kGhuBIrvF3WJsslotGKliBLCxB8QmMevkFn/ujmNJHftmmqKxo4S6pJoCFlnAyz9kAdgfC1ZDVMMt6UwKLl0BMUvkr8LvtP9HUp8afEiHHmsoC+T0FttWgKMYLFROwfGcCEpouLaPdO2cvaCVELBh5nU+s4ER4fe4x4H+MAVmzSA0PUfZJ35l7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X0/xB+/uEDWZFZmVvl0mwnarpo3o/1LX15ESmMhGMFPchr2FGOW7c12Qj6DADANkt6pjAD+34GOy5LNeKuUuLqyKW3tzjvnamJKWxGqAf3hc7R2ArMCOYlRf55H7Aki+wexvTsSy5eApMQSvg4WiMfQiqcJHnki0OdzIDFj/9Yz7LSrs8FVuo3arun6O5kHsINmz+OOHXBMeEW42GdRawBe1yKNt4dSps0FfYVpxJY9rYNjAV5AGAH2l2OhBXcwKqynO/j/cg53323+9VlNBmZ3Z4fOkC3l/Lxy6VQvk3aJ7xnoW/RhfdxLEKWAXRJ+/AQdrxBTmtTyX0Qca+c3/LA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: marmarek@xxxxxxxxxxxxxxxxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Wed, 23 Nov 2022 15:45:59 +0000
  • Ironport-data: A9a23:9CFyeKBLddc5aBVW/xviw5YqxClBgxIJ4kV8jS/XYbTApDsqhWQDx mcXXGrUP63fajHwfNh1ady+/EkAsZ6BmoNiQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nNHuCnYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFtcpvlDs15K6o4WpC5QRkDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIwxM9nITlp1 6MjdiEsURCRpt69wL74Vbw57igjBJGD0II3nFhFlW2cKMl8BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTK/uxuvDG7IA9ZidABNPLPfdOHX4NNl1uwr WPa5WXpRBodMbRzzBLVri78376VxksXXqoLDoKx+dsyj2ae4WEOJjQdVwK7nfC23xvWt9V3b hZ8FjAVhbg/8gmnQ8fwWzW8oWWYpVgMVtxICeo45QqRjK3O7G6xA2EeSzdbZd8OtckoRCcr3 FuEg9PoAzN0tLSfD3ma89+8rzm/JCwUJm8qfjIfQE0O5NyLnW0ophfGT9ImFbHviNTwQW302 2rT83F4gKgPh8kW0an95UrAnz+nupnOSEgy+xnTWWWmqAh+YeZJerCV1LQS1t4YRK7xc7VLl CFsdxS2hAzWMaywqQ==
  • Ironport-hdrordr: A9a23:U3lO9K0B++xxdi2iVKDViQqjBdJxeYIsimQD101hICG9Lfb0qy n+pp4mPEHP4wr5OEtOpTlPAtjjfZq6z+8O3WBxB8bYYOCCggeVxe5ZnO/fKlHbexEWs9QtrJ uIEJIOd+EYc2IK6voSiTPQe7hA/DDEytHRuQ639QYQcegAUdAE0+4WMHf5LqUgLzM2eKbRWa DskPZvln6FQzA6f867Dn4KU6zqoMDKrovvZVorFgMq8w6HiBKv8frfHwKD1hkTfjtTyfN6mF K12TDR1+GGibWW2xXc32jc49B/n8bg8MJKAIihm9UYMTLljyevfcBEV6eZtD44jemz4BIBkc XKoT0nI8NvgkmhNV2dkF/I4U3NwTwu43jtxRuxhmbim9XwQHYfB9BajYxUXxPF4w541esMmJ 5j7ia8jd56HBnAlCPy65zhUAxrrFO9pT4HnfQIh3JSfIMCYPt6rJAZ/mlSDJAcdRiKobwPIa 1LNoXx9fxWeVSVYzTwuXRu+sWlWjAJEhKPUiE5y7mo+gkTuEo841oTxcQZkHtF3ok6UYN46+ PNNbktvK1ST+cNBJgNStspcI+SMCjgUBjMOGWdLRDMD6ccIU/ArJbx/fEc+PyqQpoV15E/8a 6xH2+wjVRCO34GNPf+n6Giqnv2MSeAtHXWu41jDqFCy/zBrOGBC1zHdLgs+/HQ0cn3TPerH8 pbA6gmc8MLHVGeZ7qh4DeOKqW6UUNuNvH9muxLL25m8fi7XbHCh6j8TMv5AobLPHINZl7fa0 FzLwQbYv8wo3yWZg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Modify efi_find_gop_mode() so that passing cols or rows as 0 is
interpreted as a request to attempt to keep the currently set mode,
and do so if the mode query for information is successful and the depth
is supported.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/common/efi/boot.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 7e8a8b7857..b91a7179a9 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -864,6 +864,26 @@ static UINTN __init 
efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
     UINTN gop_mode = ~0, info_size, size;
     unsigned int i;
 
+    if ( (!cols || !rows) && gop->Mode->Mode < gop->Mode->MaxMode )
+    {
+        /* If no (valid) resolution suggested, try to use the current mode. */
+        status = gop->QueryMode(gop, gop->Mode->Mode, &info_size, &mode_info);
+        if ( EFI_ERROR(status) )
+            PrintErr(L"Invalid current graphics mode\r\n");
+        else if ( mode_info->PixelFormat < PixelBltOnly )
+            return gop->Mode->Mode;
+        else
+        {
+            /*
+             * Try to find a mode with the same resolution and a valid pixel
+             * format.
+             */
+            cols = mode_info->HorizontalResolution;
+            rows = mode_info->VerticalResolution;
+            depth = 0;
+        }
+    }
+
     for ( i = size = 0; i < gop->Mode->MaxMode; ++i )
     {
         unsigned int bpp = 0;
-- 
2.37.3




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.