summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-01-09 05:55:46 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-01-09 05:55:46 +0000
commitaec072adb2af2bd1cc0677a25d4a099c8779c10d (patch)
tree10cbf2e652d48319825c3b0b029eb4c86fcdb37b /MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
parentff44fe7118b1987e3e682d3293a508802a6cf1f8 (diff)
downloadedk2-platforms-aec072adb2af2bd1cc0677a25d4a099c8779c10d.tar.xz
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
Diffstat (limited to 'MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c')
-rw-r--r--MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c128
1 files changed, 89 insertions, 39 deletions
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index babf3c6cd1..8e49c48097 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -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,8 +2561,28 @@ Returns:
}
if (Match) {
- CopyMem (MatchedMode, Mode, sizeof (TEXT_OUT_GOP_MODE));
- MatchedMode++;
+ 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;
}