OcConsoleLib: Added Apple variant of GopPassThrough

On MP3,1 with UGA there is a dangling UGA protocol with 1024x768
resolution on ConOut, which points nowhere when no Apple GPU is
installed. Installing GOP on it results in black screen due to
the wrong GOP being chosen for ConOut.

The workaround is not to install the GOP without AppleFramebufferInfo
but this is only applicable to Apple machines, thus the option.
This commit is contained in:
vit9696 2021-05-23 10:32:35 +03:00
parent b265586375
commit 4e0ff2dfa7
14 changed files with 62 additions and 25 deletions

View File

@ -12,6 +12,7 @@ OpenCore Changelog
- Added automatic flavour detection for macOS boot entries
- Added `ProvideCurrentCpuInfo` quirk to provide correct TSC/FSB for Hyper-V virtual machines
- Added Hyper-V device path expansion to allow setting default boot volume
- Added `Apple` variant of `GopPassThrough` to handle only `AppleFramebufferInfo` handles
#### v0.6.9
- Fixed out-of-sync cursor movement rectangle when loading e.g. CrScreenshotDxe

Binary file not shown.

View File

@ -6853,12 +6853,20 @@ functioning. Feature highlights:
\item
\texttt{GopPassThrough}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Type}: \texttt{plist\ string}\\
\textbf{Failsafe}: \texttt{Disabled}\\
\textbf{Description}: Provide GOP protocol instances on top of UGA protocol instances.
This option provides the GOP protocol via a UGA-based proxy
for firmware that do not implement the protocol.
for firmware that do not implement the protocol. The supported values
for the option are as follows:
\begin{itemize}
\tightlist
\item \texttt{Enabled} --- provide GOP for all UGA protocols.
\item \texttt{Apple} --- provide GOP for \texttt{AppleFramebufferInfo}-enabled protocols.
\item \texttt{Disabled} --- do not provide GOP.
\end{itemize}
\emph{Note}: This option requires \texttt{ProvideConsoleGop} to be enabled.

Binary file not shown.

View File

@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Thu May 20 03:32:27 2021
%DIF ADD ../Configuration.tex Thu May 20 03:32:27 2021
%DIF DEL PreviousConfiguration.tex Fri May 7 10:26:40 2021
%DIF ADD ../Configuration.tex Sun May 23 10:10:30 2021
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
@ -6969,14 +6969,23 @@ functioning. Feature highlights:
\DIFaddend \item
\texttt{GopPassThrough}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Type}: \texttt{plist\ \DIFdelbegin \DIFdel{boolean}\DIFdelend \DIFaddbegin \DIFadd{string}\DIFaddend }\\
\textbf{Failsafe}: \texttt{\DIFdelbegin \DIFdel{false}\DIFdelend \DIFaddbegin \DIFadd{Disabled}\DIFaddend }\\
\textbf{Description}: Provide GOP protocol instances on top of UGA protocol instances.
This option provides the GOP protocol via a UGA-based proxy
for firmware that do not implement the protocol.
for firmware that do not implement the protocol. \DIFaddbegin \DIFadd{The supported values
for the option are as follows:
}\DIFaddend
\emph{Note}: This option requires \texttt{ProvideConsoleGop} to be enabled.
\DIFaddbegin \begin{itemize}
\tightlist
\item \texttt{\DIFadd{Enabled}} \DIFadd{--- provide GOP for all UGA protocols.
}\item \texttt{\DIFadd{Apple}} \DIFadd{--- provide GOP for }\texttt{\DIFadd{AppleFramebufferInfo}}\DIFadd{-enabled protocols.
}\item \texttt{\DIFadd{Disabled}} \DIFadd{--- do not provide GOP.
}\end{itemize}
\DIFaddend \emph{Note}: This option requires \texttt{ProvideConsoleGop} to be enabled.
\item
\texttt{IgnoreTextInGraphics}\\

Binary file not shown.

View File

@ -1350,7 +1350,7 @@
<key>ForceResolution</key>
<false/>
<key>GopPassThrough</key>
<false/>
<string>Disabled</string>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>

View File

@ -1688,7 +1688,7 @@
<key>ForceResolution</key>
<false/>
<key>GopPassThrough</key>
<false/>
<string>Disabled</string>
<key>IgnoreTextInGraphics</key>
<false/>
<key>ProvideConsoleGop</key>

View File

@ -632,6 +632,7 @@ typedef enum {
_(OC_STRING , ConsoleMode , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
_(OC_STRING , Resolution , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
_(OC_STRING , TextRenderer , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
_(OC_STRING , GopPassThrough , , OC_STRING_CONSTR ("Disabled", _, __), OC_DESTR (OC_STRING)) \
_(BOOLEAN , IgnoreTextInGraphics , , FALSE , ()) \
_(BOOLEAN , ClearScreenOnModeSwitch , , FALSE , ()) \
_(BOOLEAN , ProvideConsoleGop , , FALSE , ()) \
@ -639,7 +640,6 @@ typedef enum {
_(BOOLEAN , ReconnectOnResChange , , FALSE , ()) \
_(BOOLEAN , SanitiseClearScreen , , FALSE , ()) \
_(BOOLEAN , UgaPassThrough , , FALSE , ()) \
_(BOOLEAN , GopPassThrough , , FALSE , ()) \
_(BOOLEAN , DirectGopRendering , , FALSE , ()) \
_(BOOLEAN , ForceResolution , , FALSE , ())
OC_DECLARE (OC_UEFI_OUTPUT)

View File

@ -187,11 +187,13 @@ OcProvideUgaPassThrough (
/**
Provide GOP protocol instances on top of existing UGA instances.
@param[in] ForAll For all instances, otherwises for AppleFramebuffer-enabled only.
@retval EFI_SUCCESS on success.
**/
EFI_STATUS
OcProvideGopPassThrough (
VOID
IN BOOLEAN ForAll
);
/**

View File

@ -761,7 +761,7 @@ mUefiOutputSchema[] = {
OC_SCHEMA_STRING_IN ("ConsoleMode", OC_GLOBAL_CONFIG, Uefi.Output.ConsoleMode),
OC_SCHEMA_BOOLEAN_IN ("DirectGopRendering", OC_GLOBAL_CONFIG, Uefi.Output.DirectGopRendering),
OC_SCHEMA_BOOLEAN_IN ("ForceResolution", OC_GLOBAL_CONFIG, Uefi.Output.ForceResolution),
OC_SCHEMA_BOOLEAN_IN ("GopPassThrough", OC_GLOBAL_CONFIG, Uefi.Output.GopPassThrough),
OC_SCHEMA_STRING_IN ("GopPassThrough", OC_GLOBAL_CONFIG, Uefi.Output.GopPassThrough),
OC_SCHEMA_BOOLEAN_IN ("IgnoreTextInGraphics", OC_GLOBAL_CONFIG, Uefi.Output.IgnoreTextInGraphics),
OC_SCHEMA_BOOLEAN_IN ("ProvideConsoleGop", OC_GLOBAL_CONFIG, Uefi.Output.ProvideConsoleGop),
OC_SCHEMA_BOOLEAN_IN ("ReconnectOnResChange", OC_GLOBAL_CONFIG, Uefi.Output.ReconnectOnResChange),

View File

@ -106,7 +106,7 @@ OcGopDrawBlt (
EFI_STATUS
OcProvideGopPassThrough (
VOID
IN BOOLEAN ForAll
)
{
EFI_STATUS Status;
@ -234,7 +234,7 @@ OcProvideGopPassThrough (
HandleBuffer[Index],
Status
));
if (HasAppleFramebuffer) {
if (HasAppleFramebuffer || !ForAll) {
continue;
}
} else {

View File

@ -184,21 +184,29 @@ OcLoadUefiOutputSupport (
{
EFI_STATUS Status;
CONST CHAR8 *AsciiRenderer;
CONST CHAR8 *GopPassThrough;
OC_CONSOLE_RENDERER Renderer;
UINT32 Width;
UINT32 Height;
UINT32 Bpp;
BOOLEAN SetMax;
if (Config->Uefi.Output.GopPassThrough) {
Status = OcProvideGopPassThrough ();
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_INFO,
"OC: OcProvideGopPassThrough status - %r\n",
Status
));
}
GopPassThrough = OC_BLOB_GET (&Config->Uefi.Output.GopPassThrough);
if (AsciiStrCmp (GopPassThrough, "Enabled") == 0) {
Status = OcProvideGopPassThrough (TRUE);
} else if (AsciiStrCmp (GopPassThrough, "Apple") == 0) {
Status = OcProvideGopPassThrough (FALSE);
} else {
Status = EFI_SUCCESS;
}
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_INFO,
"OC: OcProvideGopPassThrough %a status - %r\n",
GopPassThrough,
Status
));
}
if (Config->Uefi.Output.ProvideConsoleGop) {

View File

@ -397,6 +397,7 @@ CheckUEFIOutput (
UINT32 ErrorCount;
OC_UEFI_CONFIG *UserUefi;
CONST CHAR8 *TextRenderer;
CONST CHAR8 *GopPassThrough;
BOOLEAN IsTextRendererSystem;
BOOLEAN IsClearScreenOnModeSwitchEnabled;
BOOLEAN IsIgnoreTextInGraphicsEnabled;
@ -457,6 +458,14 @@ CheckUEFIOutput (
}
}
GopPassThrough = OC_BLOB_GET (&UserUefi->Output.GopPassThrough);
if (AsciiStrCmp (GopPassThrough, "Enabled") != 0
&& AsciiStrCmp (GopPassThrough, "Disabled") != 0
&& AsciiStrCmp (GopPassThrough, "Apple") != 0) {
DEBUG ((DEBUG_WARN, "UEFI->Output->GopPassThrough is illegal (Can only be Enabled, Disabled, Apple)!\n"));
++ErrorCount;
}
//
// Parse Output->ConsoleMode by calling OpenCore libraries.
//