summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c67
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c16
2 files changed, 53 insertions, 30 deletions
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index 181a234804..12deda7bb7 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -2630,6 +2630,7 @@ ConSplitterAddGraphicsOutputMode (
Index = 0;
CurrentIndex = 0;
+ Status = EFI_SUCCESS;
if (Private->CurrentNumberOfUgaDraw != 0) {
//
@@ -2834,21 +2835,48 @@ Done:
// 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
- //
- CurrentGraphicsOutputMode->Mode = 0xffff;
- //
- // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.
- //
- Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);
- if (EFI_ERROR(Status)) {
+
+ Mode = &Private->GraphicsOutputModeBuffer[CurrentIndex];
+ if ((GraphicsOutput != NULL) &&
+ (Mode->HorizontalResolution == CurrentGraphicsOutputMode->Info->HorizontalResolution) &&
+ (Mode->VerticalResolution == CurrentGraphicsOutputMode->Info->VerticalResolution)) {
+ CurrentGraphicsOutputMode->Mode = (UINT32) CurrentIndex;
+ if ((Mode->HorizontalResolution != GraphicsOutput->Mode->Info->HorizontalResolution) ||
+ (Mode->VerticalResolution != GraphicsOutput->Mode->Info->VerticalResolution)) {
+ //
+ // If all existing video device has been set to common mode, only set new GOP device to
+ // the common mode
+ //
+ for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {
+ Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {
+ FreePool (Info);
+ break;
+ }
+ FreePool (Info);
+ }
+ Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);
+ }
+ } else {
+ //
+ // Current mode number may need update now, so set it to an invalid mode number
//
- // If user defined mode is not valid for display device, set to the default mode 800x600.
+ CurrentGraphicsOutputMode->Mode = 0xffff;
//
- (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;
- (Private->GraphicsOutputModeBuffer[0]).VerticalResolution = 600;
- Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);
+ // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.
+ //
+ Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);
+ if (EFI_ERROR(Status)) {
+ //
+ // If user defined mode is not valid for display device, set to the default mode 800x600.
+ //
+ (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;
+ (Private->GraphicsOutputModeBuffer[0]).VerticalResolution = 600;
+ Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);
+ }
}
return Status;
@@ -3068,11 +3096,6 @@ ConSplitterTextOutAddDevice (
}
//
- // If ConOut, then set the mode to Mode #0 which us 80 x 25
- //
- Private->TextOut.SetMode (&Private->TextOut, 0);
-
- //
// After adding new console device, all existing console devices should be
// synced to the current shared mode.
//
@@ -4387,14 +4410,6 @@ ConSplitterTextOutSetMode (
Private->TextOutList[Index].TextOut,
TextOutModeMap[Index]
);
- //
- // If this console device is based on a GOP or UGA device, then sync up the bitmap from
- // the GOP/UGA splitter and reclear the text portion of the display in the new mode.
- //
- if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
- Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);
- }
-
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
}
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index 8e612c899c..1ff37facc5 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -1,7 +1,7 @@
/** @file
This is the main routine for initializing the Graphics Console support routines.
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
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
@@ -640,10 +640,18 @@ CheckModeSupported (
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution == HorizontalResolution) &&
(Info->VerticalResolution == VerticalResolution)) {
- Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
- if (!EFI_ERROR (Status)) {
- FreePool (Info);
+ if ((GraphicsOutput->Mode->Info->HorizontalResolution == HorizontalResolution) &&
+ (GraphicsOutput->Mode->Info->VerticalResolution == VerticalResolution)) {
+ //
+ // If video device has been set to this mode, we do not need to SetMode again
+ //
break;
+ } else {
+ Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
+ if (!EFI_ERROR (Status)) {
+ FreePool (Info);
+ break;
+ }
}
}
FreePool (Info);