mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
b5b1aca92b
commit
b1aab293ea
|
@ -42,10 +42,11 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
|
||||||
TRUE
|
TRUE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ 80, 25, 0, 0, 0, 0 }, // Mode 0
|
{ 80, 25, 0, 0, 0, 0, 0 }, // Mode 0
|
||||||
{ 80, 50, 0, 0, 0, 0 }, // Mode 1
|
{ 80, 50, 0, 0, 0, 0, 0 }, // Mode 1
|
||||||
{ 100,31, 0, 0, 0, 0 }, // Mode 2
|
{ 100,31, 0, 0, 0, 0, 0 }, // Mode 2
|
||||||
{ 0, 0, 0, 0, 0, 0 } // Mode 3
|
{ 0, 0, 0, 0, 0, 0, 0 }, // Mode 3
|
||||||
|
{ 0, 0, 0, 0, 0, 0, 0 } // Mode 4
|
||||||
},
|
},
|
||||||
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL
|
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL
|
||||||
};
|
};
|
||||||
|
@ -238,11 +239,13 @@ GraphicsConsoleControllerDriverStart (
|
||||||
UINT32 VerticalResolution;
|
UINT32 VerticalResolution;
|
||||||
UINT32 ColorDepth;
|
UINT32 ColorDepth;
|
||||||
UINT32 RefreshRate;
|
UINT32 RefreshRate;
|
||||||
|
UINTN ModeIndex;
|
||||||
UINTN MaxMode;
|
UINTN MaxMode;
|
||||||
UINTN Columns;
|
UINTN Columns;
|
||||||
UINTN Rows;
|
UINTN Rows;
|
||||||
UINT32 ModeNumber;
|
UINT32 ModeNumber;
|
||||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
|
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
|
||||||
|
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
||||||
ModeNumber = 0;
|
ModeNumber = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -374,6 +377,18 @@ GraphicsConsoleControllerDriverStart (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add Mode #3 that uses the entire display for user-defined mode
|
||||||
|
//
|
||||||
|
Private->ModeData[3].Columns = HorizontalResolution / EFI_GLYPH_WIDTH;
|
||||||
|
Private->ModeData[3].Rows = VerticalResolution / EFI_GLYPH_HEIGHT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add Mode #4 that uses the PCD values
|
||||||
|
//
|
||||||
|
Private->ModeData[4].Columns = (UINTN) PcdGet32 (PcdConOutColumn);
|
||||||
|
Private->ModeData[4].Rows = (UINTN) PcdGet32 (PcdConOutRow);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compute the maximum number of text Rows and Columns that this current graphics mode can support
|
// Compute the maximum number of text Rows and Columns that this current graphics mode can support
|
||||||
//
|
//
|
||||||
|
@ -381,72 +396,45 @@ GraphicsConsoleControllerDriverStart (
|
||||||
Rows = VerticalResolution / EFI_GLYPH_HEIGHT;
|
Rows = VerticalResolution / EFI_GLYPH_HEIGHT;
|
||||||
|
|
||||||
//
|
//
|
||||||
// See if the mode is too small to support the required 80x25 text mode
|
// Here we make sure that mode 0 is valid
|
||||||
//
|
//
|
||||||
if (Columns < 80 || Rows < 25) {
|
if (Columns < Private->ModeData[0].Columns ||
|
||||||
goto Error;
|
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 #0 that must be 80x25
|
|
||||||
//
|
|
||||||
MaxMode = 0;
|
MaxMode = 0;
|
||||||
Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
|
for (ModeIndex = 0; ModeIndex < GRAPHICS_MAX_MODE; ModeIndex++) {
|
||||||
Private->ModeData[MaxMode].GopHeight = VerticalResolution;
|
ModeData = &Private->ModeData[ModeIndex];
|
||||||
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
|
ModeData->GopWidth = HorizontalResolution;
|
||||||
Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;
|
ModeData->GopHeight = VerticalResolution;
|
||||||
Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * EFI_GLYPH_HEIGHT)) >> 1;
|
ModeData->GopModeNumber = ModeNumber;
|
||||||
MaxMode++;
|
if (Columns >= ModeData->Columns &&
|
||||||
|
Rows >= ModeData->Rows) {
|
||||||
//
|
ModeData->DeltaX = (HorizontalResolution - (ModeData->Columns * EFI_GLYPH_WIDTH)) >> 1;
|
||||||
// If it is possible to support Mode #1 - 80x50, than add it as an active mode
|
ModeData->DeltaY = (VerticalResolution - (ModeData->Rows * EFI_GLYPH_HEIGHT)) >> 1;
|
||||||
//
|
MaxMode = ModeIndex + 1;
|
||||||
if (Rows >= 50) {
|
} else {
|
||||||
Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
|
ModeData->Columns = 0;
|
||||||
Private->ModeData[MaxMode].GopHeight = VerticalResolution;
|
ModeData->Rows = 0;
|
||||||
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
|
ModeData->DeltaX = 0;
|
||||||
Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * EFI_GLYPH_WIDTH)) >> 1;
|
ModeData->DeltaY = 0;
|
||||||
Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * EFI_GLYPH_HEIGHT)) >> 1;
|
}
|
||||||
MaxMode++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If it is not to support Mode #1 - 80x50, then skip it
|
// See if the resolution was too small to support any text modes
|
||||||
//
|
//
|
||||||
if (MaxMode < 2) {
|
if (MaxMode == 0) {
|
||||||
Private->ModeData[MaxMode].Columns = 0;
|
goto Error;
|
||||||
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++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add Mode #3 that uses the entire display for user-defined mode
|
|
||||||
//
|
|
||||||
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++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -69,7 +69,7 @@ typedef struct {
|
||||||
UINT32 GopModeNumber;
|
UINT32 GopModeNumber;
|
||||||
} GRAPHICS_CONSOLE_MODE_DATA;
|
} GRAPHICS_CONSOLE_MODE_DATA;
|
||||||
|
|
||||||
#define GRAPHICS_MAX_MODE 4
|
#define GRAPHICS_MAX_MODE 5
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
DebugLib
|
DebugLib
|
||||||
HiiLib
|
HiiLib
|
||||||
|
PcdLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiDevicePathProtocolGuid ## CONSUMES
|
gEfiDevicePathProtocolGuid ## CONSUMES
|
||||||
|
@ -62,3 +63,8 @@
|
||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue