mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcBootManagementLib: Improve Save/RestoreMode
This commit is contained in:
parent
2b70dc077e
commit
78cf64df83
@ -57,10 +57,10 @@ SaveMode (
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
|
||||
|
||||
mSavedConsoleMode = gST->ConOut->Mode->Mode;
|
||||
|
||||
mSavedConsoleControlMode = OcConsoleControlGetMode ();
|
||||
|
||||
mSavedConsoleMode = gST->ConOut->Mode->Mode;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
@ -73,6 +73,15 @@ SaveMode (
|
||||
mSavedGopMode = Gop->Mode->Mode;
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"OCB: Saved mode %d/%d/%u - %r\n",
|
||||
mSavedConsoleControlMode,
|
||||
mSavedConsoleMode,
|
||||
mSavedGopMode,
|
||||
Status
|
||||
));
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -84,7 +93,16 @@ RestoreMode (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
|
||||
UINT32 FoundGopMode;
|
||||
|
||||
OcConsoleControlSetMode (mSavedConsoleControlMode);
|
||||
|
||||
//
|
||||
// This can reset GOP resolution.
|
||||
//
|
||||
gST->ConOut->SetMode (gST->ConOut, mSavedConsoleMode);
|
||||
|
||||
FoundGopMode = MAX_UINT32;
|
||||
if (mSavedGopMode == MAX_UINT32) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
@ -94,16 +112,23 @@ RestoreMode (
|
||||
(VOID **)&Gop
|
||||
);
|
||||
|
||||
if ( !EFI_ERROR (Status)
|
||||
&& (Gop->Mode->Mode != mSavedGopMode))
|
||||
{
|
||||
Status = Gop->SetMode (Gop, mSavedGopMode);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
FoundGopMode = Gop->Mode->Mode;
|
||||
if (Gop->Mode->Mode != mSavedGopMode) {
|
||||
Status = Gop->SetMode (Gop, mSavedGopMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OcConsoleControlSetMode (mSavedConsoleControlMode);
|
||||
|
||||
gST->ConOut->SetMode (gST->ConOut, mSavedConsoleMode);
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"OCB: Restored mode %d/%d/%u(%u) - %r\n",
|
||||
mSavedConsoleControlMode,
|
||||
mSavedConsoleMode,
|
||||
mSavedGopMode,
|
||||
FoundGopMode,
|
||||
Status
|
||||
));
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -65,12 +65,12 @@ GuiOutputConstruct (
|
||||
|| (Gop->Mode->Info->VerticalResolution < MIN_RESOLUTION_VERTICAL * Scale))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
DEBUG_WARN,
|
||||
"OCUI: Expected at least %dx%d for resolution, actual %dx%d\n",
|
||||
MIN_RESOLUTION_HORIZONTAL * Scale,
|
||||
MIN_RESOLUTION_VERTICAL * Scale,
|
||||
Context.Gop->Mode->Info->HorizontalResolution,
|
||||
Context.Gop->Mode->Info->VerticalResolution
|
||||
Gop->Mode->Info->HorizontalResolution,
|
||||
Gop->Mode->Info->VerticalResolution
|
||||
));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user