Reviewed-by: Ray Ni <[email protected]>

-----Original Message-----
From: Jiang, Guomin <[email protected]> 
Sent: Tuesday, March 1, 2022 5:19 PM
To: [email protected]
Cc: Andrew Fish <[email protected]>; Ni, Ray <[email protected]>
Subject: [PATCH v2 2/2] EmulatorPkg/EmuGopDxe: Set ModeInfo after Open 
successfully

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668

WindowOpen will fail in some case. for example, without XServer.

Shouldn't set ModeInfo in this case to avoid the caller use it incorrectly

Cc: Andrew Fish <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Guomin Jiang <[email protected]>
---
 EmulatorPkg/EmuGopDxe/GopScreen.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c 
b/EmulatorPkg/EmuGopDxe/GopScreen.c
index 41f748bc6402..9249eca1dd03 100644
--- a/EmulatorPkg/EmuGopDxe/GopScreen.c
+++ b/EmulatorPkg/EmuGopDxe/GopScreen.c
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -108,10 +108,6 @@ EmuGopSetMode (
   }
 
   ModeData                                                 = 
&Private->ModeData[ModeNumber];
-  This->Mode->Mode                                         = ModeNumber;
-  Private->GraphicsOutput.Mode->Info->HorizontalResolution = 
ModeData->HorizontalResolution;
-  Private->GraphicsOutput.Mode->Info->VerticalResolution   = 
ModeData->VerticalResolution;
-  Private->GraphicsOutput.Mode->Info->PixelsPerScanLine    = 
ModeData->HorizontalResolution;
 
   if (Private->HardwareNeedsStarting) {
     Status = EmuGopStartWindow (
@@ -128,6 +124,11 @@ EmuGopSetMode (
     Private->HardwareNeedsStarting = FALSE;
   }
 
+  This->Mode->Mode                                         = ModeNumber;
+  Private->GraphicsOutput.Mode->Info->HorizontalResolution = 
ModeData->HorizontalResolution;
+  Private->GraphicsOutput.Mode->Info->VerticalResolution   = 
ModeData->VerticalResolution;
+  Private->GraphicsOutput.Mode->Info->PixelsPerScanLine    = 
ModeData->HorizontalResolution;
+
   Status = Private->EmuGraphicsWindow->Size (
                                          Private->EmuGraphicsWindow,
                                          ModeData->HorizontalResolution,
--
2.35.1.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87141): https://edk2.groups.io/g/devel/message/87141
Mute This Topic: https://groups.io/mt/89472124/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to