diff options
author | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-03-23 02:11:14 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-03-23 02:11:14 +0000 |
commit | b1aab293ea13a4be62da9d6c1e3d69c084240341 (patch) | |
tree | e5f1892b573d6d2eee7e44cb5943ac3d8b874c94 /MdeModulePkg | |
parent | b5b1aca92b2793175d3662071fd288d84c6f18c8 (diff) | |
download | edk2-platforms-b1aab293ea13a4be62da9d6c1e3d69c084240341.tar.xz |
MdeModulePkg GraphicsConsole: Add text mode for PcdConOutColumn/Row
Add a new text mode with a resolution of PcdConOutColumn x PcdConOutRow.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11415 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
3 files changed, 57 insertions, 63 deletions
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index e6f732db8b..bed16ac4fa 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -42,10 +42,11 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = { TRUE
},
{
- { 80, 25, 0, 0, 0, 0 }, // Mode 0
- { 80, 50, 0, 0, 0, 0 }, // Mode 1
- { 100,31, 0, 0, 0, 0 }, // Mode 2
- { 0, 0, 0, 0, 0, 0 } // Mode 3
+ { 80, 25, 0, 0, 0, 0, 0 }, // Mode 0
+ { 80, 50, 0, 0, 0, 0, 0 }, // Mode 1
+ { 100,31, 0, 0, 0, 0, 0 }, // Mode 2
+ { 0, 0, 0, 0, 0, 0, 0 }, // Mode 3
+ { 0, 0, 0, 0, 0, 0, 0 } // Mode 4
},
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL
};
@@ -238,11 +239,13 @@ GraphicsConsoleControllerDriverStart ( UINT32 VerticalResolution;
UINT32 ColorDepth;
UINT32 RefreshRate;
+ UINTN ModeIndex;
UINTN MaxMode;
UINTN Columns;
UINTN Rows;
UINT32 ModeNumber;
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
+ GRAPHICS_CONSOLE_MODE_DATA *ModeData;
ModeNumber = 0;
//
@@ -375,78 +378,63 @@ GraphicsConsoleControllerDriverStart ( }
//
- // Compute the maximum number of text Rows and Columns that this current graphics mode can support
+ // Add Mode #3 that uses the entire display for user-defined mode
//
- Columns = HorizontalResolution / EFI_GLYPH_WIDTH;
- Rows = VerticalResolution / EFI_GLYPH_HEIGHT;
+ Private->ModeData[3].Columns = HorizontalResolution / EFI_GLYPH_WIDTH;
+ Private->ModeData[3].Rows = VerticalResolution / EFI_GLYPH_HEIGHT;
//
- // See if the mode is too small to support the required 80x25 text mode
+ // Add Mode #4 that uses the PCD values
//
- if (Columns < 80 || Rows < 25) {
- goto Error;
- }
+ Private->ModeData[4].Columns = (UINTN) PcdGet32 (PcdConOutColumn);
+ Private->ModeData[4].Rows = (UINTN) PcdGet32 (PcdConOutRow);
+
//
- // Add Mode #0 that must be 80x25
+ // Compute the maximum number of text Rows and Columns that this current graphics mode can support
//
- MaxMode = 0;
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * EFI_GLYPH_HEIGHT)) >> 1;
- MaxMode++;
-
- //
- // If it is possible to support Mode #1 - 80x50, than add it as an active mode
- //
- if (Rows >= 50) {
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;
- MaxMode++;
- }
+ Columns = HorizontalResolution / EFI_GLYPH_WIDTH;
+ Rows = VerticalResolution / EFI_GLYPH_HEIGHT;
//
- // If it is not to support Mode #1 - 80x50, then skip it
+ // Here we make sure that mode 0 is valid
//
- if (MaxMode < 2) {
- Private->ModeData[MaxMode].Columns = 0;
- Private->ModeData[MaxMode].Rows = 0;
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = 0;
- Private->ModeData[MaxMode].DeltaY = 0;
- MaxMode++;
+ if (Columns < Private->ModeData[0].Columns ||
+ Rows < Private->ModeData[0].Rows) {
+ //
+ // 80x25 cannot be supported.
+ //
+ // Fallback to using the PcdConOutColumn and PcdConOutRow
+ // for mode 0. If the PCDs are also to large, then mode 0
+ // will be shrunk to fit as needed.
+ //
+ Private->ModeData[0].Columns = MIN (Private->ModeData[4].Columns, Columns);
+ Private->ModeData[0].Rows = MIN (Private->ModeData[4].Rows, Rows);
}
- //
- // Add Mode #2 that must be 100x31 (graphic mode >= 800x600)
- //
- if (Columns >= 100 && Rows >= 31) {
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (100 * EFI_GLYPH_WIDTH)) >> 1;
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (31 * EFI_GLYPH_HEIGHT)) >> 1;
- MaxMode++;
+ MaxMode = 0;
+ for (ModeIndex = 0; ModeIndex < GRAPHICS_MAX_MODE; ModeIndex++) {
+ ModeData = &Private->ModeData[ModeIndex];
+ ModeData->GopWidth = HorizontalResolution;
+ ModeData->GopHeight = VerticalResolution;
+ ModeData->GopModeNumber = ModeNumber;
+ if (Columns >= ModeData->Columns &&
+ Rows >= ModeData->Rows) {
+ ModeData->DeltaX = (HorizontalResolution - (ModeData->Columns * EFI_GLYPH_WIDTH)) >> 1;
+ ModeData->DeltaY = (VerticalResolution - (ModeData->Rows * EFI_GLYPH_HEIGHT)) >> 1;
+ MaxMode = ModeIndex + 1;
+ } else {
+ ModeData->Columns = 0;
+ ModeData->Rows = 0;
+ ModeData->DeltaX = 0;
+ ModeData->DeltaY = 0;
+ }
}
//
- // Add Mode #3 that uses the entire display for user-defined mode
+ // See if the resolution was too small to support any text modes
//
- if (HorizontalResolution > 800 && VerticalResolution > 600) {
- Private->ModeData[MaxMode].Columns = HorizontalResolution/EFI_GLYPH_WIDTH;
- Private->ModeData[MaxMode].Rows = VerticalResolution/EFI_GLYPH_HEIGHT;
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution % EFI_GLYPH_WIDTH) >> 1;
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution % EFI_GLYPH_HEIGHT) >> 1;
- MaxMode++;
+ if (MaxMode == 0) {
+ goto Error;
}
//
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h index 4d909a443f..24285a9adb 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h @@ -69,7 +69,7 @@ typedef struct { UINT32 GopModeNumber;
} GRAPHICS_CONSOLE_MODE_DATA;
-#define GRAPHICS_MAX_MODE 4
+#define GRAPHICS_MAX_MODE 5
typedef struct {
UINTN Signature;
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf index 59c8f2d634..169e15a46f 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf @@ -51,6 +51,7 @@ UefiDriverEntryPoint
DebugLib
HiiLib
+ PcdLib
[Protocols]
gEfiDevicePathProtocolGuid ## CONSUMES
@@ -61,4 +62,9 @@ gEfiHiiDatabaseProtocolGuid ## TO_START
[FeaturePcd]
- gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
\ No newline at end of file + gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
+
|