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

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
This commit is contained in:
Guomin Jiang 2022-02-22 11:29:23 +08:00 committed by mergify[bot]
parent 906242343f
commit b422b0fcf9
1 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/*++ @file /*++ @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. Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
@ -108,10 +108,6 @@ EmuGopSetMode (
} }
ModeData = &Private->ModeData[ModeNumber]; 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) { if (Private->HardwareNeedsStarting) {
Status = EmuGopStartWindow ( Status = EmuGopStartWindow (
@ -128,6 +124,11 @@ EmuGopSetMode (
Private->HardwareNeedsStarting = FALSE; 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 ( Status = Private->EmuGraphicsWindow->Size (
Private->EmuGraphicsWindow, Private->EmuGraphicsWindow,
ModeData->HorizontalResolution, ModeData->HorizontalResolution,