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

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


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 31 Mar 2023 11:59:44 +0200
  • 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=FtEAq5Ug7QXlXwnPC+8yAaWQRyQAyZNLb8vOr9AL0ng=; b=f9EpS/0FNO9XokSp7TGJff8wMiufzZRq2aVO9Wu3fqjTeYGO7Keb04y5hfS/sPuWdTvzM1NipZCKgLhSGZAk0WQjNsRCWuz+60BXznNuPQJXvOL7DjS/6/4PVah2PxLsWB1TK02eyXipRN/x58+9a7La7g1Gl0PdezZj7nKrg6AEOB8HkpfGjN+3f1SP9qpqciNKRNYhZiFGgjmm88IdHrcF9P/TanzPAVuF7qTEt/huo7sxoYgxHT88dEjzXbAbT+NGkQeWop5z26oUJBX/f3QuOj7EDWPaqbqaJIunskZWBRAn6nZfV8d0N9M1CHSVb0TL2viRic1Pzply7y0Auw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=igjDDLpU9rUeXuHFQN0gC7VKP+Mxmzg5imRcMyyrv6BFJ7pe2bKHOLDPiWaxs+x8sblVFXer9kgGHw+tMRpCl/Y69eW9ag7e8Zigha3wDbN1s5BJLOQ3eKuOX/9XK+Hg6dWk07/twjXl9f3MgkJzuYKqfFwfWGfGFFKuenBAOnOWEdwPiz52YqOROqncxVo8awomgApWihXiU5Tka+RBXTZ3N8F98fDEXi/zlWC9GwnKJ92fMtAfy2LWDYhsFjwj+DrjqFGko8OBkvCn1AZUqi9e/w5wFD1r51Yg9qLTOG6u2ttWt60X7OKSRB9sNcLocj7MqT7VDwSSlY3ZJa0VVA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 31 Mar 2023 10:00:23 +0000
  • Ironport-data: A9a23:0TQopaP1jG0qD57vrR23lsFynXyQoLVcMsEvi/4bfWQNrUorhGEHn 2VKXjyBa/iNYmfxeY9xaIi3oxhTsJbSndYxSQto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvLrRC9H5qyo42tD5QVmPJingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0rx5M1hsy +1JEQEyXgiNxLic246yTMA506zPLOGzVG8ekldJ6GiASN0BGNXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PRxujeOpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+tqyr22LeRxn+nMG4UPKS60L1zn1Sv+lFQAh4Xf2aZhNy6kkHrDrqzL GRRoELCt5Ma5EGtC9XwQRC8iHqFpQIHHcpdFfUg7wOAwbaS5ByWbkAGRDNcbN0ttOctWCcnk FSOmrvU6SdHtbSUTTeW8e6SpDbrYCwNdzZdOGkDUBcP5MTlrMcrlBXTQ91/EamzyNroBTX3x DPMpy8771kOsfM2O2yA1Qivq1qRSlLhF2bZOi2/srqZ0z5E
  • Ironport-hdrordr: A9a23:lL8nLqvPPJ97VxMW7/7YC2QB7skDpdV00zEX/kB9WHVpm62j5r mTdZEgvyMc5wxwZJhNo6HmBEDiex3hHPxOkOws1N6ZNWGMhILCFvAH0WKN+UyHJ8Q8zIJgPG VbHpSWxOeeMXFKyeH9/Qm2E9wp3dmA97rAv5a8815dCSZtdqFu7w1wFwacFVczbw9bApA0UL qa6cwvnUvDRZ3fVKWGOkU=
  • 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>
---
Changes since v1:
 - Only update cols or rows if the value is 0.
 - Leave depth alone.
---
 xen/common/efi/boot.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b69c83e354..766a2553be 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -930,6 +930,27 @@ 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.
+             */
+            if ( !cols )
+                cols = mode_info->HorizontalResolution;
+            if ( !rows )
+                rows = mode_info->VerticalResolution;
+        }
+    }
+
     for ( i = size = 0; i < gop->Mode->MaxMode; ++i )
     {
         unsigned int bpp = 0;
-- 
2.40.0




 


Rackspace

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