提交 77b015cf 编写于 作者: V vit9696

OpenCoreUefi: Sync with new text rendering code

上级 a63fe0fb
......@@ -6,6 +6,12 @@ OpenCore Changelog
- Fixed locating DMG recovery in APTIO IV firmwares on FAT32
- Fixed loading DMG recovery in APTIO IV firmwares on FAT32
- Removed `AvoidHighAlloc` quirk due to removed I/O over 4GB
- Moved `ConsoleMode`, `Resolution` options to `Output` section
- Moved console-related UEFI quirks to `Output` section
- Replaced `ConsoleControl` and `BuiltinTextRenderer` with `TextRenderer`
- Added `Scale` option to set builtin text renderer scaling
- Removed `ConsoleBehaviourOs` and `ConsoleBehaviourUi`
- Fixed providing ConsoleOutHandle GOP when running from Shell
#### v0.5.5
- Fixed CPU bus ratio calculation for Nehalem and Westmere
......
此差异已折叠。
此差异已折叠。
......@@ -579,22 +579,12 @@
<array/>
<key>Boot</key>
<dict>
<key>BuiltinTextRenderer</key>
<false/>
<key>ConsoleBehaviourOs</key>
<string></string>
<key>ConsoleBehaviourUi</key>
<string></string>
<key>ConsoleMode</key>
<string></string>
<key>HibernateMode</key>
<string>None</string>
<key>HideSelf</key>
<true/>
<key>PollAppleHotKeys</key>
<false/>
<key>Resolution</key>
<string></string>
<key>ShowPicker</key>
<true/>
<key>TakeoffDelay</key>
......@@ -800,6 +790,29 @@
<key>TimerResolution</key>
<integer>50000</integer>
</dict>
<key>Output</key>
<dict>
<key>TextRenderer</key>
<string>BuiltinGraphics</string>
<key>ConsoleMode</key>
<string></string>
<key>Resolution</key>
<string>Max</string>
<key>ClearScreenOnModeSwitch</key>
<false/>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReplaceTabWithSpace</key>
<false/>
<key>SanitiseClearScreen</key>
<false/>
<key>Scale</key>
<integer>100</integer>
</dict>
<key>Protocols</key>
<dict>
<key>AppleBootPolicy</key>
......@@ -814,8 +827,6 @@
<false/>
<key>AppleUserInterfaceTheme</key>
<false/>
<key>ConsoleControl</key>
<false/>
<key>DataHub</key>
<false/>
<key>DeviceProperties</key>
......@@ -831,28 +842,16 @@
</dict>
<key>Quirks</key>
<dict>
<key>ClearScreenOnModeSwitch</key>
<false/>
<key>ExitBootServicesDelay</key>
<integer>0</integer>
<key>IgnoreInvalidFlexRatio</key>
<false/>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReleaseUsbOwnership</key>
<false/>
<key>ReplaceTabWithSpace</key>
<false/>
<key>RequestBootVarFallback</key>
<false/>
<key>RequestBootVarRouting</key>
<true/>
<key>SanitiseClearScreen</key>
<false/>
<key>UnblockFsConnect</key>
<false/>
</dict>
......
......@@ -579,22 +579,12 @@
<array/>
<key>Boot</key>
<dict>
<key>BuiltinTextRenderer</key>
<false/>
<key>ConsoleBehaviourOs</key>
<string></string>
<key>ConsoleBehaviourUi</key>
<string></string>
<key>ConsoleMode</key>
<string></string>
<key>HibernateMode</key>
<string>None</string>
<key>HideSelf</key>
<true/>
<key>PollAppleHotKeys</key>
<false/>
<key>Resolution</key>
<string></string>
<key>ShowPicker</key>
<true/>
<key>TakeoffDelay</key>
......@@ -903,6 +893,29 @@
<key>TimerResolution</key>
<integer>50000</integer>
</dict>
<key>Output</key>
<dict>
<key>TextRenderer</key>
<string>BuiltinGraphics</string>
<key>ConsoleMode</key>
<string></string>
<key>Resolution</key>
<string>Max</string>
<key>ClearScreenOnModeSwitch</key>
<false/>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReplaceTabWithSpace</key>
<false/>
<key>SanitiseClearScreen</key>
<false/>
<key>Scale</key>
<integer>100</integer>
</dict>
<key>Protocols</key>
<dict>
<key>AppleBootPolicy</key>
......@@ -917,8 +930,6 @@
<false/>
<key>AppleUserInterfaceTheme</key>
<false/>
<key>ConsoleControl</key>
<false/>
<key>DataHub</key>
<false/>
<key>DeviceProperties</key>
......@@ -934,28 +945,16 @@
</dict>
<key>Quirks</key>
<dict>
<key>ClearScreenOnModeSwitch</key>
<false/>
<key>ExitBootServicesDelay</key>
<integer>0</integer>
<key>IgnoreInvalidFlexRatio</key>
<false/>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReleaseUsbOwnership</key>
<false/>
<key>ReplaceTabWithSpace</key>
<false/>
<key>RequestBootVarFallback</key>
<false/>
<key>RequestBootVarRouting</key>
<true/>
<key>SanitiseClearScreen</key>
<false/>
<key>UnblockFsConnect</key>
<false/>
</dict>
......
......@@ -163,19 +163,6 @@ OcLoadUefiSupport (
IN OC_CPU_INFO *CpuInfo
);
/**
Decide whether console controller reconnection is required
upon changing screen resolution.
@param[in] Config OpenCore configuration.
@retval TRUE when required.
**/
BOOLEAN
OcShouldReconnectConsoleOnResolutionChange (
IN OC_GLOBAL_CONFIG *Config
);
/**
Get human readable version string.
......
......@@ -69,16 +69,10 @@ OcStartImage (
OUT CHAR16 **ExitData OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
EFI_CONSOLE_CONTROL_SCREEN_MODE OldMode;
//
// Request OS mode.
//
OcConsoleControlSetBehaviour (
ParseConsoleControlBehaviour (
OC_BLOB_GET (&mOpenCoreConfiguration.Misc.Boot.ConsoleBehaviourOs)
)
);
OldMode = OcConsoleControlSetMode (EfiConsoleControlScreenGraphics);
Status = gBS->StartImage (
ImageHandle,
......@@ -90,14 +84,7 @@ OcStartImage (
DEBUG ((DEBUG_WARN, "OC: Boot failed - %r\n", Status));
}
//
// Restore ui mode.
//
OcConsoleControlSetBehaviour (
ParseConsoleControlBehaviour (
OC_BLOB_GET (&mOpenCoreConfiguration.Misc.Boot.ConsoleBehaviourUi)
)
);
OcConsoleControlSetMode (OldMode);
return Status;
}
......
......@@ -290,10 +290,6 @@ OcMiscLateInit (
{
EFI_STATUS Status;
EFI_STATUS HibernateStatus;
UINT32 Width;
UINT32 Height;
UINT32 Bpp;
BOOLEAN SetMax;
CONST CHAR8 *HibernateMode;
UINT32 HibernateMask;
......@@ -318,76 +314,6 @@ OcMiscLateInit (
}
}
ParseScreenResolution (
OC_BLOB_GET (&Config->Misc.Boot.Resolution),
&Width,
&Height,
&Bpp,
&SetMax
);
DEBUG ((
DEBUG_INFO,
"OC: Requested resolution is %ux%u@%u (max: %d) from %a\n",
Width,
Height,
Bpp,
SetMax,
OC_BLOB_GET (&Config->Misc.Boot.Resolution)
));
if (SetMax || (Width > 0 && Height > 0)) {
Status = SetConsoleResolution (
Width,
Height,
Bpp,
OcShouldReconnectConsoleOnResolutionChange (Config)
);
DEBUG ((
EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
"OC: Changed resolution to %ux%u@%u (max: %d) from %a - %r\n",
Width,
Height,
Bpp,
SetMax,
OC_BLOB_GET (&Config->Misc.Boot.Resolution),
Status
));
}
ParseConsoleMode (
OC_BLOB_GET (&Config->Misc.Boot.ConsoleMode),
&Width,
&Height,
&SetMax
);
DEBUG ((
DEBUG_INFO,
"OC: Requested console mode is %ux%u (max: %d) from %a\n",
Width,
Height,
SetMax,
OC_BLOB_GET (&Config->Misc.Boot.ConsoleMode)
));
if (SetMax || (Width > 0 && Height > 0)) {
Status = SetConsoleMode (Width, Height);
DEBUG ((
EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
"OC: Changed console mode to %ux%u (max: %d) from %a - %r\n",
Width,
Height,
SetMax,
OC_BLOB_GET (&Config->Misc.Boot.ConsoleMode),
Status
));
}
if (Config->Misc.Boot.BuiltinTextRenderer) {
OcInstallCustomConOut ();
}
HibernateMode = OC_BLOB_GET (&Config->Misc.Boot.HibernateMode);
if (AsciiStrCmp (HibernateMode, "None") == 0) {
......@@ -407,7 +333,6 @@ OcMiscLateInit (
HibernateStatus = OcActivateHibernateWake (HibernateMask);
DEBUG ((DEBUG_INFO, "OC: Hibernation detection status is %r\n", HibernateStatus));
(VOID) HibernateStatus;
return Status;
}
......@@ -608,21 +533,4 @@ OcMiscUefiQuirksLoaded (
sizeof (Config->Misc.Security.ScanPolicy),
&Config->Misc.Security.ScanPolicy
);
//
// Regardless of the mode ensure our cursor is disabled as we do not need it.
// This is a bit ugly, but works for most platforms we have:
// - Firstly disable it on platforms that start with it for whatever reason.
// Generally Insyde laptops are happy with that.
// - Secondly change the mode, on APTIO it may reenable the cursor in Text mode.
// - Thirdly disable it again to ensure it is definitely disabled.
//
OcConsoleDisableCursor ();
OcConsoleControlSetBehaviour (
ParseConsoleControlBehaviour (
OC_BLOB_GET (&Config->Misc.Boot.ConsoleBehaviourUi)
)
);
OcConsoleDisableCursor ();
}
......@@ -267,10 +267,6 @@ OcReinstallProtocols (
DEBUG ((DEBUG_ERROR, "OC: Failed to install boot policy protocol\n"));
}
if (OcConsoleControlInstallProtocol (Config->Uefi.Protocols.ConsoleControl) == NULL) {
DEBUG ((DEBUG_ERROR, "OC: Failed to install console control protocol\n"));
}
if (OcDataHubInstallProtocol (Config->Uefi.Protocols.DataHub) == NULL) {
DEBUG ((DEBUG_ERROR, "OC: Failed to install data hub protocol\n"));
}
......@@ -394,12 +390,116 @@ OcLoadUefiInputSupport (
return ExitBs;
}
BOOLEAN
OcShouldReconnectConsoleOnResolutionChange (
STATIC
VOID
OcLoadUefiOutputSupport (
IN OC_GLOBAL_CONFIG *Config
)
{
return Config->Uefi.Quirks.ReconnectOnResChange;
EFI_STATUS Status;
CONST CHAR8 *AsciiRenderer;
OC_CONSOLE_RENDERER Renderer;
UINT32 Width;
UINT32 Height;
UINT32 Bpp;
BOOLEAN SetMax;
if (Config->Uefi.Output.ProvideConsoleGop) {
OcProvideConsoleGop ();
}
OcParseScreenResolution (
OC_BLOB_GET (&Config->Uefi.Output.Resolution),
&Width,
&Height,
&Bpp,
&SetMax
);
DEBUG ((
DEBUG_INFO,
"OC: Requested resolution is %ux%u@%u (max: %d) from %a\n",
Width,
Height,
Bpp,
SetMax,
OC_BLOB_GET (&Config->Uefi.Output.Resolution)
));
if (SetMax || (Width > 0 && Height > 0)) {
Status = OcSetConsoleResolution (
Width,
Height,
Bpp
);
DEBUG ((
EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
"OC: Changed resolution to %ux%u@%u (max: %d) from %a - %r\n",
Width,
Height,
Bpp,
SetMax,
OC_BLOB_GET (&Config->Uefi.Output.Resolution),
Status
));
}
if (Config->Uefi.Output.ReconnectOnResChange) {
OcReconnectConsole ();
}
AsciiRenderer = OC_BLOB_GET (&Config->Uefi.Output.TextRenderer);
if (AsciiRenderer[0] == '\0' || AsciiStrCmp (AsciiRenderer, "BuiltinGraphics") == 0) {
Renderer = OcConsoleRendererBuiltinGraphics;
} else if (AsciiStrCmp (AsciiRenderer, "SystemGraphics") == 0) {
Renderer = OcConsoleRendererSystemGraphics;
} else if (AsciiStrCmp (AsciiRenderer, "SystemText") == 0) {
Renderer = OcConsoleRendererSystemText;
} else if (AsciiStrCmp (AsciiRenderer, "SystemGeneric") == 0) {
Renderer = OcConsoleRendererSystemGeneric;
} else {
DEBUG ((DEBUG_WARN, "OC: Requested unknown renderer %a\n", AsciiRenderer));
Renderer = OcConsoleRendererBuiltinGraphics;
}
OcSetupConsole (
Renderer,
Config->Uefi.Output.Scale,
Config->Uefi.Output.IgnoreTextInGraphics,
Config->Uefi.Output.SanitiseClearScreen,
Config->Uefi.Output.ClearScreenOnModeSwitch,
Config->Uefi.Output.ReplaceTabWithSpace
);
OcParseConsoleMode (
OC_BLOB_GET (&Config->Uefi.Output.ConsoleMode),
&Width,
&Height,
&SetMax
);
DEBUG ((
DEBUG_INFO,
"OC: Requested console mode is %ux%u (max: %d) from %a\n",
Width,
Height,
SetMax,
OC_BLOB_GET (&Config->Uefi.Output.ConsoleMode)
));
if (SetMax || (Width > 0 && Height > 0)) {
Status = OcSetConsoleMode (Width, Height);
DEBUG ((
EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
"OC: Changed console mode to %ux%u (max: %d) from %a - %r\n",
Width,
Height,
SetMax,
OC_BLOB_GET (&Config->Uefi.Output.ConsoleMode),
Status
));
}
}
VOID
......@@ -473,6 +573,7 @@ OcLoadUefiSupport (
OcReinstallProtocols (Config);
AgiExitBs = OcLoadUefiInputSupport (Config);
//
// Setup Apple bootloader specific UEFI features.
//
......@@ -482,17 +583,6 @@ OcLoadUefiSupport (
OcCpuCorrectFlexRatio (CpuInfo);
}
if (Config->Uefi.Quirks.ProvideConsoleGop) {
OcProvideConsoleGop ();
}
OcConsoleControlConfigure (
Config->Uefi.Quirks.IgnoreTextInGraphics,
Config->Uefi.Quirks.SanitiseClearScreen,
Config->Uefi.Quirks.ClearScreenOnModeSwitch,
Config->Uefi.Quirks.ReplaceTabWithSpace
);
//
// Inform platform support whether we want Boot#### routing or not.
//
......@@ -574,6 +664,7 @@ OcLoadUefiSupport (
OcUnblockUnmountedPartitions ();
}
OcLoadUefiOutputSupport (Config);
OcMiscUefiQuirksLoaded (Config);
if (Config->Uefi.ConnectDrivers) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册