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

OpenCoreUefi: Sync with new text rendering code

上级 a63fe0fb
...@@ -6,6 +6,12 @@ OpenCore Changelog ...@@ -6,6 +6,12 @@ OpenCore Changelog
- Fixed locating DMG recovery in APTIO IV firmwares on FAT32 - Fixed locating DMG recovery in APTIO IV firmwares on FAT32
- Fixed loading 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 - 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 #### v0.5.5
- Fixed CPU bus ratio calculation for Nehalem and Westmere - Fixed CPU bus ratio calculation for Nehalem and Westmere
......
此差异已折叠。
此差异已折叠。
...@@ -579,22 +579,12 @@ ...@@ -579,22 +579,12 @@
<array/> <array/>
<key>Boot</key> <key>Boot</key>
<dict> <dict>
<key>BuiltinTextRenderer</key>
<false/>
<key>ConsoleBehaviourOs</key>
<string></string>
<key>ConsoleBehaviourUi</key>
<string></string>
<key>ConsoleMode</key>
<string></string>
<key>HibernateMode</key> <key>HibernateMode</key>
<string>None</string> <string>None</string>
<key>HideSelf</key> <key>HideSelf</key>
<true/> <true/>
<key>PollAppleHotKeys</key> <key>PollAppleHotKeys</key>
<false/> <false/>
<key>Resolution</key>
<string></string>
<key>ShowPicker</key> <key>ShowPicker</key>
<true/> <true/>
<key>TakeoffDelay</key> <key>TakeoffDelay</key>
...@@ -800,6 +790,29 @@ ...@@ -800,6 +790,29 @@
<key>TimerResolution</key> <key>TimerResolution</key>
<integer>50000</integer> <integer>50000</integer>
</dict> </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> <key>Protocols</key>
<dict> <dict>
<key>AppleBootPolicy</key> <key>AppleBootPolicy</key>
...@@ -814,8 +827,6 @@ ...@@ -814,8 +827,6 @@
<false/> <false/>
<key>AppleUserInterfaceTheme</key> <key>AppleUserInterfaceTheme</key>
<false/> <false/>
<key>ConsoleControl</key>
<false/>
<key>DataHub</key> <key>DataHub</key>
<false/> <false/>
<key>DeviceProperties</key> <key>DeviceProperties</key>
...@@ -831,28 +842,16 @@ ...@@ -831,28 +842,16 @@
</dict> </dict>
<key>Quirks</key> <key>Quirks</key>
<dict> <dict>
<key>ClearScreenOnModeSwitch</key>
<false/>
<key>ExitBootServicesDelay</key> <key>ExitBootServicesDelay</key>
<integer>0</integer> <integer>0</integer>
<key>IgnoreInvalidFlexRatio</key> <key>IgnoreInvalidFlexRatio</key>
<false/> <false/>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReleaseUsbOwnership</key> <key>ReleaseUsbOwnership</key>
<false/> <false/>
<key>ReplaceTabWithSpace</key>
<false/>
<key>RequestBootVarFallback</key> <key>RequestBootVarFallback</key>
<false/> <false/>
<key>RequestBootVarRouting</key> <key>RequestBootVarRouting</key>
<true/> <true/>
<key>SanitiseClearScreen</key>
<false/>
<key>UnblockFsConnect</key> <key>UnblockFsConnect</key>
<false/> <false/>
</dict> </dict>
......
...@@ -579,22 +579,12 @@ ...@@ -579,22 +579,12 @@
<array/> <array/>
<key>Boot</key> <key>Boot</key>
<dict> <dict>
<key>BuiltinTextRenderer</key>
<false/>
<key>ConsoleBehaviourOs</key>
<string></string>
<key>ConsoleBehaviourUi</key>
<string></string>
<key>ConsoleMode</key>
<string></string>
<key>HibernateMode</key> <key>HibernateMode</key>
<string>None</string> <string>None</string>
<key>HideSelf</key> <key>HideSelf</key>
<true/> <true/>
<key>PollAppleHotKeys</key> <key>PollAppleHotKeys</key>
<false/> <false/>
<key>Resolution</key>
<string></string>
<key>ShowPicker</key> <key>ShowPicker</key>
<true/> <true/>
<key>TakeoffDelay</key> <key>TakeoffDelay</key>
...@@ -903,6 +893,29 @@ ...@@ -903,6 +893,29 @@
<key>TimerResolution</key> <key>TimerResolution</key>
<integer>50000</integer> <integer>50000</integer>
</dict> </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> <key>Protocols</key>
<dict> <dict>
<key>AppleBootPolicy</key> <key>AppleBootPolicy</key>
...@@ -917,8 +930,6 @@ ...@@ -917,8 +930,6 @@
<false/> <false/>
<key>AppleUserInterfaceTheme</key> <key>AppleUserInterfaceTheme</key>
<false/> <false/>
<key>ConsoleControl</key>
<false/>
<key>DataHub</key> <key>DataHub</key>
<false/> <false/>
<key>DeviceProperties</key> <key>DeviceProperties</key>
...@@ -934,28 +945,16 @@ ...@@ -934,28 +945,16 @@
</dict> </dict>
<key>Quirks</key> <key>Quirks</key>
<dict> <dict>
<key>ClearScreenOnModeSwitch</key>
<false/>
<key>ExitBootServicesDelay</key> <key>ExitBootServicesDelay</key>
<integer>0</integer> <integer>0</integer>
<key>IgnoreInvalidFlexRatio</key> <key>IgnoreInvalidFlexRatio</key>
<false/> <false/>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReleaseUsbOwnership</key> <key>ReleaseUsbOwnership</key>
<false/> <false/>
<key>ReplaceTabWithSpace</key>
<false/>
<key>RequestBootVarFallback</key> <key>RequestBootVarFallback</key>
<false/> <false/>
<key>RequestBootVarRouting</key> <key>RequestBootVarRouting</key>
<true/> <true/>
<key>SanitiseClearScreen</key>
<false/>
<key>UnblockFsConnect</key> <key>UnblockFsConnect</key>
<false/> <false/>
</dict> </dict>
......
...@@ -163,19 +163,6 @@ OcLoadUefiSupport ( ...@@ -163,19 +163,6 @@ OcLoadUefiSupport (
IN OC_CPU_INFO *CpuInfo 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. Get human readable version string.
......
...@@ -69,16 +69,10 @@ OcStartImage ( ...@@ -69,16 +69,10 @@ OcStartImage (
OUT CHAR16 **ExitData OPTIONAL OUT CHAR16 **ExitData OPTIONAL
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_CONSOLE_CONTROL_SCREEN_MODE OldMode;
// OldMode = OcConsoleControlSetMode (EfiConsoleControlScreenGraphics);
// Request OS mode.
//
OcConsoleControlSetBehaviour (
ParseConsoleControlBehaviour (
OC_BLOB_GET (&mOpenCoreConfiguration.Misc.Boot.ConsoleBehaviourOs)
)
);
Status = gBS->StartImage ( Status = gBS->StartImage (
ImageHandle, ImageHandle,
...@@ -90,14 +84,7 @@ OcStartImage ( ...@@ -90,14 +84,7 @@ OcStartImage (
DEBUG ((DEBUG_WARN, "OC: Boot failed - %r\n", Status)); DEBUG ((DEBUG_WARN, "OC: Boot failed - %r\n", Status));
} }
// OcConsoleControlSetMode (OldMode);
// Restore ui mode.
//
OcConsoleControlSetBehaviour (
ParseConsoleControlBehaviour (
OC_BLOB_GET (&mOpenCoreConfiguration.Misc.Boot.ConsoleBehaviourUi)
)
);
return Status; return Status;
} }
......
...@@ -290,10 +290,6 @@ OcMiscLateInit ( ...@@ -290,10 +290,6 @@ OcMiscLateInit (
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_STATUS HibernateStatus; EFI_STATUS HibernateStatus;
UINT32 Width;
UINT32 Height;
UINT32 Bpp;
BOOLEAN SetMax;
CONST CHAR8 *HibernateMode; CONST CHAR8 *HibernateMode;
UINT32 HibernateMask; UINT32 HibernateMask;
...@@ -318,76 +314,6 @@ OcMiscLateInit ( ...@@ -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); HibernateMode = OC_BLOB_GET (&Config->Misc.Boot.HibernateMode);
if (AsciiStrCmp (HibernateMode, "None") == 0) { if (AsciiStrCmp (HibernateMode, "None") == 0) {
...@@ -407,7 +333,6 @@ OcMiscLateInit ( ...@@ -407,7 +333,6 @@ OcMiscLateInit (
HibernateStatus = OcActivateHibernateWake (HibernateMask); HibernateStatus = OcActivateHibernateWake (HibernateMask);
DEBUG ((DEBUG_INFO, "OC: Hibernation detection status is %r\n", HibernateStatus)); DEBUG ((DEBUG_INFO, "OC: Hibernation detection status is %r\n", HibernateStatus));
(VOID) HibernateStatus;
return Status; return Status;
} }
...@@ -608,21 +533,4 @@ OcMiscUefiQuirksLoaded ( ...@@ -608,21 +533,4 @@ OcMiscUefiQuirksLoaded (
sizeof (Config->Misc.Security.ScanPolicy), sizeof (Config->Misc.Security.ScanPolicy),
&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 ( ...@@ -267,10 +267,6 @@ OcReinstallProtocols (
DEBUG ((DEBUG_ERROR, "OC: Failed to install boot policy protocol\n")); 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) { if (OcDataHubInstallProtocol (Config->Uefi.Protocols.DataHub) == NULL) {
DEBUG ((DEBUG_ERROR, "OC: Failed to install data hub protocol\n")); DEBUG ((DEBUG_ERROR, "OC: Failed to install data hub protocol\n"));
} }
...@@ -394,12 +390,116 @@ OcLoadUefiInputSupport ( ...@@ -394,12 +390,116 @@ OcLoadUefiInputSupport (
return ExitBs; return ExitBs;
} }
BOOLEAN STATIC
OcShouldReconnectConsoleOnResolutionChange ( VOID
OcLoadUefiOutputSupport (
IN OC_GLOBAL_CONFIG *Config 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 VOID
...@@ -473,6 +573,7 @@ OcLoadUefiSupport ( ...@@ -473,6 +573,7 @@ OcLoadUefiSupport (
OcReinstallProtocols (Config); OcReinstallProtocols (Config);
AgiExitBs = OcLoadUefiInputSupport (Config); AgiExitBs = OcLoadUefiInputSupport (Config);
// //
// Setup Apple bootloader specific UEFI features. // Setup Apple bootloader specific UEFI features.
// //
...@@ -482,17 +583,6 @@ OcLoadUefiSupport ( ...@@ -482,17 +583,6 @@ OcLoadUefiSupport (
OcCpuCorrectFlexRatio (CpuInfo); 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. // Inform platform support whether we want Boot#### routing or not.
// //
...@@ -574,6 +664,7 @@ OcLoadUefiSupport ( ...@@ -574,6 +664,7 @@ OcLoadUefiSupport (
OcUnblockUnmountedPartitions (); OcUnblockUnmountedPartitions ();
} }
OcLoadUefiOutputSupport (Config);
OcMiscUefiQuirksLoaded (Config); OcMiscUefiQuirksLoaded (Config);
if (Config->Uefi.ConnectDrivers) { if (Config->Uefi.ConnectDrivers) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册