diff --git a/Changelog.md b/Changelog.md index fbe0169fddaa49ff68d040e9a2fa758dfe23abac..28e355463dc8af247402a515a3fe35b2f5d8196a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ OpenCore Changelog - Enforced the use of builtin picker when external fails - Fixed warnings for empty NVRAM variables (e.g. rtc-blacklist) - Added `ApplePanic` to store panic logs on ESP root +- Fixed `ReconnectOnResChange` reconnecting even without res change #### v0.5.8 - Fixed invalid CPU object reference in SSDT-PLUG diff --git a/Library/OcConsoleLib/OcConsoleLib.c b/Library/OcConsoleLib/OcConsoleLib.c index 74c3e982fe033650a96e2cd844275eabf7bdcf6e..fb4dd31c04cc56e762293f0155cf113dc6655722 100644 --- a/Library/OcConsoleLib/OcConsoleLib.c +++ b/Library/OcConsoleLib/OcConsoleLib.c @@ -120,7 +120,7 @@ OcSetConsoleResolutionForProtocol ( if (ModeNumber == GraphicsOutput->Mode->Mode) { DEBUG ((DEBUG_INFO, "OCC: Current mode matches desired mode %u\n", (UINT32) ModeNumber)); - return EFI_SUCCESS; + return EFI_ALREADY_STARTED; } // @@ -275,15 +275,16 @@ OcSetConsoleResolution ( IN UINT32 Bpp OPTIONAL ) { - EFI_STATUS Status; + EFI_STATUS Result; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; #ifdef OC_CONSOLE_CHANGE_ALL_RESOLUTIONS + EFI_STATUS Status; UINTN HandleCount; EFI_HANDLE *HandleBuffer; UINTN Index; - Status = gBS->LocateHandleBuffer ( + Result = gBS->LocateHandleBuffer ( ByProtocol, &gEfiGraphicsOutputProtocolGuid, NULL, @@ -291,7 +292,9 @@ OcSetConsoleResolution ( &HandleBuffer ); - if (!EFI_ERROR (Status)) { + if (!EFI_ERROR (Result)) { + Result = EFI_NOT_FOUND; + DEBUG ((DEBUG_INFO, "OCC: Found %u handles with GOP\n", (UINT32) HandleCount)); for (Index = 0; Index < HandleCount; ++Index) { @@ -308,29 +311,29 @@ OcSetConsoleResolution ( continue; } - Status = OcSetConsoleResolutionForProtocol (GraphicsOutput, Width, Height, Bpp); + Result = OcSetConsoleResolutionForProtocol (GraphicsOutput, Width, Height, Bpp); } FreePool (HandleBuffer); } else { - DEBUG ((DEBUG_INFO, "OCC: Failed to find handles with GOP\n")); + DEBUG ((DEBUG_INFO, "OCC: Failed to find handles with GOP - %r\n", Result)); } #else - Status = gBS->HandleProtocol ( + Result = gBS->HandleProtocol ( gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "OCC: Missing GOP on ConOut - %r\n", Status)); - return Status; + if (EFI_ERROR (Result)) { + DEBUG ((DEBUG_WARN, "OCC: Missing GOP on ConOut - %r\n", Result)); + return Result; } - Status = OcSetConsoleResolutionForProtocol (GraphicsOutput, Width, Height, Bpp); + Result = OcSetConsoleResolutionForProtocol (GraphicsOutput, Width, Height, Bpp); #endif - return Status; + return Result; } EFI_STATUS diff --git a/Platform/OpenCore/OpenCoreUefiInOut.c b/Platform/OpenCore/OpenCoreUefiInOut.c index f407b30f70eb68e483a3283cdb335c0307cd28fa..28996010830958bab857f260818b8d1a7a20286c 100644 --- a/Platform/OpenCore/OpenCoreUefiInOut.c +++ b/Platform/OpenCore/OpenCoreUefiInOut.c @@ -227,7 +227,7 @@ OcLoadUefiOutputSupport ( Bpp ); DEBUG (( - EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO, + EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED ? DEBUG_WARN : DEBUG_INFO, "OC: Changed resolution to %ux%u@%u (max: %d) from %a - %r\n", Width, Height, @@ -236,6 +236,8 @@ OcLoadUefiOutputSupport ( OC_BLOB_GET (&Config->Uefi.Output.Resolution), Status )); + } else { + Status = EFI_UNSUPPORTED; } if (Config->Uefi.Output.DirectGopRendering) { @@ -255,7 +257,7 @@ OcLoadUefiOutputSupport ( } } - if (Config->Uefi.Output.ReconnectOnResChange) { + if (Config->Uefi.Output.ReconnectOnResChange && !EFI_ERROR (Status)) { OcReconnectConsole (); }