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 <af...@apple.com>
Cc: Ray Ni <ray...@intel.com>
Signed-off-by: Guomin Jiang <guomin.ji...@intel.com>
---
 EmulatorPkg/EmuGopDxe/GopScreen.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c 
b/EmulatorPkg/EmuGopDxe/GopScreen.c
index 41f748bc6402..ec5ef795d6e5 100644
--- a/EmulatorPkg/EmuGopDxe/GopScreen.c
+++ b/EmulatorPkg/EmuGopDxe/GopScreen.c
@@ -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 (#86844): https://edk2.groups.io/g/devel/message/86844
Mute This Topic: https://groups.io/mt/89310228/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to