OcConsoleLib: Fixed handling 24-bit screen resolutions

This commit is contained in:
vit9696 2020-04-26 06:28:30 +03:00
parent 580c71ea02
commit 525b6a6ada
3 changed files with 29 additions and 7 deletions

View File

@ -20,6 +20,7 @@ OpenCore Changelog
- Added experimental `BootProtect` `Security` option
- Fixed kext injection in 10.8 installer
- Added timeout support to OpenCanopy user interface
- Fixed handling 24-bit screen resolutions
#### v0.5.7
- Added TimeMachine detection to picker

View File

@ -89,10 +89,16 @@ OcSetConsoleResolutionForProtocol (
//
// Custom resolution is requested.
//
if (Info->HorizontalResolution == Width && Info->VerticalResolution == Height
if (Info->HorizontalResolution == Width
&& Info->VerticalResolution == Height
&& (Bpp == 0 || Bpp == 24 || Bpp == 32)
&& (Info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor
|| Info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor)
&& (Bpp == 0 || Bpp == 24 || Bpp == 32)) {
|| Info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor
|| (Info->PixelFormat == PixelBitMask
&& (Info->PixelInformation.RedMask == 0xFF000000U
|| Info->PixelInformation.RedMask == 0xFF0000U
|| Info->PixelInformation.RedMask == 0xFF00U
|| Info->PixelInformation.RedMask == 0xFFU)))) {
ModeNumber = ModeIndex;
FreePool (Info);
break;

View File

@ -363,12 +363,27 @@ RenderResync (
Info = mGraphicsOutput->Mode->Info;
if (Info->HorizontalResolution < TGT_CHAR_WIDTH * 3
|| Info->VerticalResolution < TGT_CHAR_HEIGHT * 3
|| (Info->PixelFormat != PixelRedGreenBlueReserved8BitPerColor
&& Info->PixelFormat != PixelBlueGreenRedReserved8BitPerColor)) {
|| Info->VerticalResolution < TGT_CHAR_HEIGHT * 3) {
return EFI_DEVICE_ERROR;
}
if (Info->PixelFormat != PixelRedGreenBlueReserved8BitPerColor
&& Info->PixelFormat != PixelBlueGreenRedReserved8BitPerColor) {
//
// DuetPkg may report bit mask image output.
//
if (Info->PixelFormat != PixelBitMask) {
return EFI_DEVICE_ERROR;
}
if (Info->PixelInformation.RedMask != 0xFF000000U
&& Info->PixelInformation.RedMask != 0xFF0000U
&& Info->PixelInformation.RedMask != 0xFF00U
&& Info->PixelInformation.RedMask != 0xFFU) {
return EFI_DEVICE_ERROR;
}
}
if (mCharacterBuffer != NULL) {
FreePool (mCharacterBuffer);
}
@ -933,7 +948,7 @@ OcUseBuiltinTextOutput (
Status = AsciiTextReset (&mAsciiTextOutputProtocol, TRUE);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "OCC: Cannot setup ASCII output\n"));
DEBUG ((DEBUG_INFO, "OCC: Cannot setup ASCII output - %r\n", Status));
return;
}