mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcConsoleLib: Fix rotation and EfiBoot bridging
This commit is contained in:
parent
479a5b15f3
commit
e094c2bd95
Binary file not shown.
@ -6782,7 +6782,9 @@ functioning. Feature highlights:
|
||||
there is an obvious benefit as it may result in issues such as slower scrolling.
|
||||
|
||||
This renderer fully supports \texttt{AppleEg2Info} protocol and will provide
|
||||
screen rotation for all EFI applications.
|
||||
screen rotation for all EFI applications. In order to provide seamless rotation
|
||||
compatibility with \texttt{EfiBoot}, builtin \texttt{AppleFramebufferInfo} should
|
||||
also be used, i.e. it may need to be overridden on Mac EFI.
|
||||
|
||||
\item
|
||||
\texttt{GopPassThrough}\\
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
\documentclass[]{article}
|
||||
%DIF LATEXDIFF DIFFERENCE FILE
|
||||
%DIF DEL PreviousConfiguration.tex Fri May 7 10:26:40 2021
|
||||
%DIF ADD ../Configuration.tex Sun May 9 00:12:30 2021
|
||||
%DIF ADD ../Configuration.tex Sun May 9 02:38:36 2021
|
||||
|
||||
\usepackage{lmodern}
|
||||
\usepackage{amssymb,amsmath}
|
||||
@ -6842,7 +6842,9 @@ functioning. Feature highlights:
|
||||
there is an obvious benefit as it may result in issues such as slower scrolling.
|
||||
|
||||
\DIFaddbegin \DIFadd{This renderer fully supports }\texttt{\DIFadd{AppleEg2Info}} \DIFadd{protocol and will provide
|
||||
screen rotation for all EFI applications.
|
||||
screen rotation for all EFI applications. In order to provide seamless rotation
|
||||
compatibility with }\texttt{\DIFadd{EfiBoot}}\DIFadd{, builtin }\texttt{\DIFadd{AppleFramebufferInfo}} \DIFadd{should
|
||||
also be used, i.e. it may need to be overridden on Mac EFI.
|
||||
}
|
||||
|
||||
\DIFaddend \item
|
||||
|
||||
Binary file not shown.
@ -194,13 +194,24 @@ STATIC
|
||||
VOID
|
||||
SwitchMode (
|
||||
IN OUT EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Source
|
||||
IN BOOLEAN UseCustom
|
||||
)
|
||||
{
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Source;
|
||||
|
||||
ASSERT (This != NULL);
|
||||
ASSERT (This->Mode != NULL);
|
||||
ASSERT (This->Mode->Info != NULL);
|
||||
ASSERT (Source != NULL);
|
||||
|
||||
if (UseCustom) {
|
||||
Source = &mGop.CustomModeInfo;
|
||||
This->Mode->FrameBufferBase = 0;
|
||||
This->Mode->FrameBufferSize = 0;
|
||||
} else {
|
||||
Source = &mGop.OriginalModeInfo;
|
||||
This->Mode->FrameBufferBase = mGop.OriginalFrameBufferBase;
|
||||
This->Mode->FrameBufferSize = mGop.OriginalFrameBufferSize;
|
||||
}
|
||||
|
||||
This->Mode->Info->VerticalResolution = Source->VerticalResolution;
|
||||
This->Mode->Info->HorizontalResolution = Source->HorizontalResolution;
|
||||
@ -233,6 +244,14 @@ RotateMode (
|
||||
This->Mode->Info->PixelsPerScanLine = This->Mode->Info->HorizontalResolution;
|
||||
}
|
||||
|
||||
mGop.OriginalFrameBufferBase = This->Mode->FrameBufferBase;
|
||||
mGop.OriginalFrameBufferSize = This->Mode->FrameBufferSize;
|
||||
|
||||
if (Rotation != 0) {
|
||||
This->Mode->FrameBufferBase = 0;
|
||||
This->Mode->FrameBufferSize = 0;
|
||||
}
|
||||
|
||||
CopyMem (&mGop.CustomModeInfo, This->Mode->Info, sizeof (mGop.CustomModeInfo));
|
||||
}
|
||||
|
||||
@ -309,11 +328,11 @@ DirectGopSetMode (
|
||||
//
|
||||
// Protect from mishandling of rotated info.
|
||||
//
|
||||
SwitchMode (This, &mGop.OriginalModeInfo);
|
||||
SwitchMode (This, FALSE);
|
||||
|
||||
Status = mGop.OriginalGopSetMode (This, ModeNumber);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SwitchMode (This, &mGop.CustomModeInfo);
|
||||
SwitchMode (This, TRUE);
|
||||
mGop.FramebufferContext = Original;
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
@ -326,7 +345,7 @@ DirectGopSetMode (
|
||||
RotateMode (This, mGop.Rotation);
|
||||
|
||||
mGop.FramebufferContext = DirectGopFromTarget (
|
||||
This->Mode->FrameBufferBase,
|
||||
mGop.OriginalFrameBufferBase,
|
||||
&mGop.OriginalModeInfo,
|
||||
&mGop.FramebufferContextPageCount
|
||||
);
|
||||
@ -360,10 +379,10 @@ DirectQueryMode (
|
||||
EFI_STATUS Status;
|
||||
UINT32 HorizontalResolution;
|
||||
|
||||
SwitchMode (This, &mGop.OriginalModeInfo);
|
||||
SwitchMode (This, FALSE);
|
||||
Status = mGop.OriginalGopQueryMode (This, ModeNumber, SizeOfInfo, Info);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SwitchMode (This, &mGop.CustomModeInfo);
|
||||
SwitchMode (This, TRUE);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -523,7 +542,7 @@ OcUseDirectGop (
|
||||
RotateMode (Gop, mGop.Rotation);
|
||||
|
||||
mGop.FramebufferContext = DirectGopFromTarget (
|
||||
Gop->Mode->FrameBufferBase,
|
||||
mGop.OriginalFrameBufferBase,
|
||||
&mGop.OriginalModeInfo,
|
||||
&mGop.FramebufferContextPageCount
|
||||
);
|
||||
@ -562,3 +581,15 @@ OcUseDirectGop (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CONST CONSOLE_GOP_CONTEXT *
|
||||
InternalGetDirectGopContext (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
if (mGop.Rotation != 0 && mGop.OriginalGopSetMode != NULL) {
|
||||
return &mGop;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -56,9 +56,22 @@ typedef struct CONSOLE_GOP_CONTEXT {
|
||||
///
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION OriginalModeInfo;
|
||||
///
|
||||
/// Original (not rotated) linear frame buffer.
|
||||
///
|
||||
EFI_PHYSICAL_ADDRESS OriginalFrameBufferBase;
|
||||
///
|
||||
/// Original (not rotated) linear frame buffer size.
|
||||
///
|
||||
UINTN OriginalFrameBufferSize;
|
||||
///
|
||||
/// Ours (rotated) mode informaation.
|
||||
///
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION CustomModeInfo;
|
||||
} CONSOLE_GOP_CONTEXT;
|
||||
|
||||
CONST CONSOLE_GOP_CONTEXT *
|
||||
InternalGetDirectGopContext (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // CONSOLE_GOP_INTERNAL_H
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
**/
|
||||
|
||||
#include "OcConsoleLibInternal.h"
|
||||
#include "ConsoleGopInternal.h"
|
||||
|
||||
#include <Protocol/AppleFramebufferInfo.h>
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
@ -41,6 +42,7 @@ AppleFramebufferGetInfo (
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
CONST CONSOLE_GOP_CONTEXT *DirectConsole;
|
||||
|
||||
if (This == NULL
|
||||
|| FramebufferBase == NULL
|
||||
@ -52,6 +54,17 @@ AppleFramebufferGetInfo (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DirectConsole = InternalGetDirectGopContext ();
|
||||
if (DirectConsole != NULL) {
|
||||
*FramebufferBase = DirectConsole->OriginalFrameBufferBase;
|
||||
*FramebufferSize = (UINT32) DirectConsole->OriginalFrameBufferSize;
|
||||
*ScreenRowBytes = (UINT32) (DirectConsole->OriginalModeInfo.PixelsPerScanLine * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
*ScreenWidth = DirectConsole->CustomModeInfo.HorizontalResolution;
|
||||
*ScreenHeight = DirectConsole->CustomModeInfo.VerticalResolution;
|
||||
*ScreenDepth = DEFAULT_COLOUR_DEPTH;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
[Guids]
|
||||
gAppleVendorVariableGuid
|
||||
gAppleBootVariableGuid
|
||||
|
||||
[Protocols]
|
||||
gAppleFramebufferInfoProtocolGuid
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user