sync tracker to remove duplicate display mode in ConOut virtual handle GOP instance.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4533 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -170,7 +170,8 @@ STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
|
||||
NULL
|
||||
},
|
||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
|
||||
(TEXT_OUT_GOP_MODE *) NULL,
|
||||
(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) NULL,
|
||||
0,
|
||||
0,
|
||||
TRUE,
|
||||
{
|
||||
@ -233,7 +234,8 @@ STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
|
||||
NULL
|
||||
},
|
||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
|
||||
(TEXT_OUT_GOP_MODE *) NULL,
|
||||
(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) NULL,
|
||||
0,
|
||||
0,
|
||||
TRUE,
|
||||
{
|
||||
@ -663,6 +665,7 @@ ConSplitterTextOutConstructor (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
|
||||
//
|
||||
// Copy protocols template
|
||||
@ -722,21 +725,24 @@ ConSplitterTextOutConstructor (
|
||||
}
|
||||
//
|
||||
// Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel
|
||||
// DevNull will be updated to user-defined mode after driver has started.
|
||||
//
|
||||
if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (TEXT_OUT_GOP_MODE))) == NULL) {
|
||||
if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
ConOutPrivate->GraphicsOutputModeBuffer[0].HorizontalResolution = 800;
|
||||
ConOutPrivate->GraphicsOutputModeBuffer[0].VerticalResolution = 600;
|
||||
Info = &ConOutPrivate->GraphicsOutputModeBuffer[0];
|
||||
Info->Version = 0;
|
||||
Info->HorizontalResolution = 800;
|
||||
Info->VerticalResolution = 600;
|
||||
Info->PixelFormat = PixelBltOnly;
|
||||
Info->PixelsPerScanLine = 800;
|
||||
CopyMem (ConOutPrivate->GraphicsOutput.Mode->Info, Info, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||
ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
|
||||
//
|
||||
// Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()
|
||||
// GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat
|
||||
// GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
|
||||
// GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
|
||||
//
|
||||
ConOutPrivate->GraphicsOutput.Mode->Info->Version = 0;
|
||||
ConOutPrivate->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
|
||||
ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
ConOutPrivate->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
|
||||
ConOutPrivate->GraphicsOutput.Mode->FrameBufferSize = 0;
|
||||
|
||||
@ -2464,14 +2470,15 @@ Returns:
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
TEXT_OUT_GOP_MODE *Mode;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;
|
||||
UINTN SizeOfInfo;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *CurrentGraphicsOutputMode;
|
||||
TEXT_OUT_GOP_MODE *ModeBuffer;
|
||||
TEXT_OUT_GOP_MODE *MatchedMode;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *ModeBuffer;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *MatchedMode;
|
||||
UINTN NumberIndex;
|
||||
BOOLEAN Match;
|
||||
BOOLEAN AlreadyExist;
|
||||
|
||||
if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
@ -2479,6 +2486,17 @@ Returns:
|
||||
|
||||
CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;
|
||||
|
||||
Index = 0;
|
||||
|
||||
if (Private->CurrentNumberOfUgaDraw != 0) {
|
||||
//
|
||||
// If any UGA device has already been added, then there is no need to
|
||||
// calculate intersection of display mode of different GOP/UGA device,
|
||||
// since only one display mode will be exported (i.e. user-defined mode)
|
||||
//
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
if (Private->CurrentNumberOfGraphicsOutput == 0) {
|
||||
//
|
||||
@ -2494,7 +2512,7 @@ Returns:
|
||||
//
|
||||
// Allocate resource for the private mode buffer
|
||||
//
|
||||
ModeBuffer = AllocatePool (sizeof (TEXT_OUT_GOP_MODE) * GraphicsOutput->Mode->MaxMode);
|
||||
ModeBuffer = AllocatePool (GraphicsOutput->Mode->SizeOfInfo * GraphicsOutput->Mode->MaxMode);
|
||||
if (ModeBuffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -2510,8 +2528,7 @@ Returns:
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
Mode->HorizontalResolution = Info->HorizontalResolution;
|
||||
Mode->VerticalResolution = Info->VerticalResolution;
|
||||
CopyMem (Mode, Info, SizeOfInfo);
|
||||
Mode++;
|
||||
FreePool (Info);
|
||||
}
|
||||
@ -2519,7 +2536,7 @@ Returns:
|
||||
//
|
||||
// Check intersection of display mode
|
||||
//
|
||||
ModeBuffer = AllocatePool (sizeof (TEXT_OUT_GOP_MODE) * CurrentGraphicsOutputMode->MaxMode);
|
||||
ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * CurrentGraphicsOutputMode->MaxMode);
|
||||
if (ModeBuffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -2535,7 +2552,7 @@ Returns:
|
||||
return Status;
|
||||
}
|
||||
if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&
|
||||
(Info->VerticalResolution == Mode->VerticalResolution)){
|
||||
(Info->VerticalResolution == Mode->VerticalResolution)) {
|
||||
Match = TRUE;
|
||||
FreePool (Info);
|
||||
break;
|
||||
@ -2544,9 +2561,29 @@ Returns:
|
||||
}
|
||||
|
||||
if (Match) {
|
||||
CopyMem (MatchedMode, Mode, sizeof (TEXT_OUT_GOP_MODE));
|
||||
AlreadyExist = FALSE;
|
||||
|
||||
for (Info = ModeBuffer; Info < MatchedMode; Info++) {
|
||||
if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&
|
||||
(Info->VerticalResolution == Mode->VerticalResolution)) {
|
||||
AlreadyExist = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AlreadyExist) {
|
||||
CopyMem (MatchedMode, Mode, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||
|
||||
//
|
||||
// Physical frame buffer is no longer available, change PixelFormat to PixelBltOnly
|
||||
//
|
||||
MatchedMode->Version = 0;
|
||||
MatchedMode->PixelFormat = PixelBltOnly;
|
||||
ZeroMem (&MatchedMode->PixelInformation, sizeof (EFI_PIXEL_BITMASK));
|
||||
|
||||
MatchedMode++;
|
||||
}
|
||||
}
|
||||
|
||||
Mode++;
|
||||
}
|
||||
@ -2560,7 +2597,7 @@ Returns:
|
||||
//
|
||||
// Physical frame buffer is no longer available when there are more than one physical GOP devices
|
||||
//
|
||||
CurrentGraphicsOutputMode->MaxMode = (UINT32) (((UINTN) MatchedMode - (UINTN) ModeBuffer) / sizeof (TEXT_OUT_GOP_MODE));
|
||||
CurrentGraphicsOutputMode->MaxMode = (UINT32) (((UINTN) MatchedMode - (UINTN) ModeBuffer) / sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||
CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;
|
||||
ZeroMem (&CurrentGraphicsOutputMode->Info->PixelInformation, sizeof (EFI_PIXEL_BITMASK));
|
||||
CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
@ -2584,21 +2621,19 @@ Returns:
|
||||
Index = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Current mode number may need update now, so set it to an invalide mode number
|
||||
//
|
||||
CurrentGraphicsOutputMode->Mode = 0xffff;
|
||||
} else {
|
||||
}
|
||||
if (UgaDraw != NULL) {
|
||||
//
|
||||
// For UGA device, it's inconvenient to retrieve all the supported display modes.
|
||||
// To simplify the implementation, only add one resolution(800x600, 32bit color depth) as defined in UEFI spec
|
||||
//
|
||||
CurrentGraphicsOutputMode->MaxMode = 1;
|
||||
CurrentGraphicsOutputMode->Info->Version = 0;
|
||||
CurrentGraphicsOutputMode->Info->HorizontalResolution = 800;
|
||||
CurrentGraphicsOutputMode->Info->VerticalResolution = 600;
|
||||
CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;
|
||||
CurrentGraphicsOutputMode->Info->PixelsPerScanLine = 800;
|
||||
Info = CurrentGraphicsOutputMode->Info;
|
||||
Info->Version = 0;
|
||||
Info->HorizontalResolution = 800;
|
||||
Info->VerticalResolution = 600;
|
||||
Info->PixelFormat = PixelBltOnly;
|
||||
Info->PixelsPerScanLine = 800;
|
||||
CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
|
||||
CurrentGraphicsOutputMode->FrameBufferSize = 0;
|
||||
@ -2606,26 +2641,33 @@ Returns:
|
||||
//
|
||||
// Update the private mode buffer
|
||||
//
|
||||
ModeBuffer = &Private->GraphicsOutputModeBuffer[0];
|
||||
ModeBuffer->HorizontalResolution = 800;
|
||||
ModeBuffer->VerticalResolution = 600;
|
||||
CopyMem (&Private->GraphicsOutputModeBuffer[0], Info, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
|
||||
|
||||
//
|
||||
// Current mode is unknow now, set it to an invalid mode number 0xffff
|
||||
// Only mode 0 is available to be set
|
||||
//
|
||||
CurrentGraphicsOutputMode->Mode = 0xffff;
|
||||
Index = 0;
|
||||
}
|
||||
|
||||
Done:
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
Private->CurrentNumberOfGraphicsOutput++;
|
||||
}
|
||||
if (UgaDraw != NULL) {
|
||||
Private->CurrentNumberOfUgaDraw++;
|
||||
}
|
||||
|
||||
//
|
||||
// Force GraphicsOutput mode to be set,
|
||||
// regardless whether the console is in EfiConsoleControlScreenGraphics or EfiConsoleControlScreenText mode
|
||||
//
|
||||
Private->HardwareNeedsStarting = TRUE;
|
||||
//
|
||||
// Current mode number may need update now, so set it to an invalid mode number
|
||||
//
|
||||
Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) Index);
|
||||
|
||||
Private->CurrentNumberOfGraphicsOutput++;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -2737,7 +2779,7 @@ Returns:
|
||||
//
|
||||
// The new console supports the same mode of the current console so sync up
|
||||
//
|
||||
DevNullSyncGopStdOut (Private);
|
||||
DevNullSyncStdOut (Private);
|
||||
} else {
|
||||
//
|
||||
// If ConOut, then set the mode to Mode #0 which us 80 x 25
|
||||
@ -2781,6 +2823,14 @@ Returns:
|
||||
if (TextOutList->TextOut == TextOut) {
|
||||
CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);
|
||||
CurrentNumOfConsoles--;
|
||||
if (FeaturePcdGet (PcdConOutGopSupport)) {
|
||||
if (TextOutList->UgaDraw != NULL) {
|
||||
Private->CurrentNumberOfUgaDraw--;
|
||||
}
|
||||
if (TextOutList->GraphicsOutput != NULL) {
|
||||
Private->CurrentNumberOfGraphicsOutput--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -171,11 +171,6 @@ typedef struct {
|
||||
BOOLEAN TextOutEnabled;
|
||||
} TEXT_OUT_AND_GOP_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
} TEXT_OUT_GOP_MODE;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
EFI_HANDLE VirtualHandle;
|
||||
@ -191,8 +186,9 @@ typedef struct {
|
||||
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GraphicsOutputBlt;
|
||||
TEXT_OUT_GOP_MODE *GraphicsOutputModeBuffer;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GraphicsOutputModeBuffer;
|
||||
UINTN CurrentNumberOfGraphicsOutput;
|
||||
UINTN CurrentNumberOfUgaDraw;
|
||||
BOOLEAN HardwareNeedsStarting;
|
||||
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL ConsoleControl;
|
||||
@ -1369,7 +1365,7 @@ DevNullTextOutEnableCursor (
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DevNullSyncGopStdOut (
|
||||
DevNullSyncStdOut (
|
||||
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
|
||||
)
|
||||
;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -15,7 +15,7 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
Support for ConsoleControl protocol. Support for UGA Draw spliter.
|
||||
Support for ConsoleControl protocol. Support for Graphics output spliter.
|
||||
Support for DevNull Console Out. This console uses memory buffers
|
||||
to represnt the console. It allows a console to start very early and
|
||||
when a new console is added it is synced up with the current console
|
||||
@ -39,13 +39,13 @@ ConSpliterConsoleControlGetMode (
|
||||
|
||||
Routine Description:
|
||||
Return the current video mode information. Also returns info about existence
|
||||
of UGA Draw devices in system, and if the Std In device is locked. All the
|
||||
of Graphics Output devices or UGA Draw devices in system, and if the Std In device is locked. All the
|
||||
arguments are optional and only returned if a non NULL pointer is passed in.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Mode - Are we in text of grahics mode.
|
||||
UgaExists - TRUE if UGA Spliter has found a UGA device
|
||||
GopExists - TRUE if GOP Spliter has found a GOP/UGA device
|
||||
StdInLocked - TRUE if StdIn device is keyboard locked
|
||||
|
||||
Returns:
|
||||
@ -155,7 +155,7 @@ ConSpliterConsoleControlSetMode (
|
||||
}
|
||||
}
|
||||
if (Mode == EfiConsoleControlScreenText) {
|
||||
DevNullSyncGopStdOut (Private);
|
||||
DevNullSyncStdOut (Private);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -189,7 +189,6 @@ ConSpliterGraphicsOutputQueryMode (
|
||||
--*/
|
||||
{
|
||||
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
|
||||
TEXT_OUT_GOP_MODE *Mode;
|
||||
|
||||
if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@ -212,11 +211,7 @@ ConSpliterGraphicsOutputQueryMode (
|
||||
|
||||
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
|
||||
CopyMem (*Info, Private->GraphicsOutput.Mode->Info, *SizeOfInfo);
|
||||
Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
|
||||
(*Info)->HorizontalResolution = Mode->HorizontalResolution;
|
||||
(*Info)->VerticalResolution = Mode->VerticalResolution;
|
||||
(*Info)->PixelsPerScanLine = Mode->HorizontalResolution;
|
||||
CopyMem (*Info, &Private->GraphicsOutputModeBuffer[ModeNumber], *SizeOfInfo);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -248,7 +243,7 @@ Routine Description:
|
||||
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
|
||||
UINTN Index;
|
||||
EFI_STATUS ReturnStatus;
|
||||
TEXT_OUT_GOP_MODE *Mode;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;
|
||||
UINTN Size;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
UINTN NumberIndex;
|
||||
@ -335,10 +330,7 @@ Routine Description:
|
||||
|
||||
This->Mode->Mode = ModeNumber;
|
||||
|
||||
Info = This->Mode->Info;
|
||||
Info->HorizontalResolution = Mode->HorizontalResolution;
|
||||
Info->VerticalResolution = Mode->VerticalResolution;
|
||||
Info->PixelsPerScanLine = Mode->HorizontalResolution;
|
||||
CopyMem (This->Mode->Info, &Private->GraphicsOutputModeBuffer[ModeNumber], This->Mode->SizeOfInfo);
|
||||
|
||||
//
|
||||
// Information is not enough here, so the following items remain unchanged:
|
||||
@ -1526,7 +1518,7 @@ DevNullTextOutEnableCursor (
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
DevNullSyncGopStdOut (
|
||||
DevNullSyncStdOut (
|
||||
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
|
||||
)
|
||||
/*++
|
||||
|
Reference in New Issue
Block a user