From f58fcb0a1df34c32130dc852ae083895e2e52923 Mon Sep 17 00:00:00 2001 From: li-elvin Date: Mon, 8 Oct 2012 02:34:33 +0000 Subject: Move GOP and UGA draw from Consplitter entrypoint to start(). When there is one real physical graphics device in system, Consplitter will expose GOP/UGA protocol on the virtual handle. In addition, fix a obvious logic issue in GraphicsConsole. Signed-off-by: Li Elvin Reviewed-by: Ni Ruiyu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13787 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/Console/ConSplitterDxe/ConSplitter.c | 113 +++++++++++---------- .../Console/GraphicsConsoleDxe/GraphicsConsole.c | 3 - 2 files changed, 58 insertions(+), 58 deletions(-) (limited to 'MdeModulePkg/Universal') diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 870d429c7a..2508273398 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -418,49 +418,12 @@ ConSplitterDriverEntry( // Status = ConSplitterTextOutConstructor (&mConOut); if (!EFI_ERROR (Status)) { - if (!FeaturePcdGet (PcdConOutGopSupport)) { - // - // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed - // on the virtual handle. - // - Status = gBS->InstallMultipleProtocolInterfaces ( - &mConOut.VirtualHandle, - &gEfiSimpleTextOutProtocolGuid, - &mConOut.TextOut, - &gEfiUgaDrawProtocolGuid, - &mConOut.UgaDraw, - NULL - ); - } else if (!FeaturePcdGet (PcdConOutUgaSupport)) { - // - // If UGA Draw protocol not supported, Graphics Output Protocol is installed - // on virtual handle. - // - Status = gBS->InstallMultipleProtocolInterfaces ( - &mConOut.VirtualHandle, - &gEfiSimpleTextOutProtocolGuid, - &mConOut.TextOut, - &gEfiGraphicsOutputProtocolGuid, - &mConOut.GraphicsOutput, - NULL - ); - } else { - // - // Boot Graphics Output protocol and UGA Draw protocol are supported, - // both they will be installed on virtual handle. - // - Status = gBS->InstallMultipleProtocolInterfaces ( - &mConOut.VirtualHandle, - &gEfiSimpleTextOutProtocolGuid, - &mConOut.TextOut, - &gEfiGraphicsOutputProtocolGuid, - &mConOut.GraphicsOutput, - &gEfiUgaDrawProtocolGuid, - &mConOut.UgaDraw, - NULL - ); - } - + Status = gBS->InstallMultipleProtocolInterfaces ( + &mConOut.VirtualHandle, + &gEfiSimpleTextOutProtocolGuid, + &mConOut.TextOut, + NULL + ); if (!EFI_ERROR (Status)) { // // Update the EFI System Table with new virtual console @@ -1315,7 +1278,7 @@ ConSplitterConOutDriverBindingStart ( FreePool (Info); - } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + } else if (UgaDraw != NULL) { Status = UgaDraw->GetMode ( UgaDraw, &mConOut.UgaHorizontalResolution, @@ -2798,7 +2761,7 @@ ConSplitterAddGraphicsOutputMode ( } } } - } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + } else if (UgaDraw != NULL) { // // Graphics console driver can ensure the same mode for all GOP devices // so we can get the current mode from this video device @@ -2838,7 +2801,7 @@ Done: if (GraphicsOutput != NULL) { Private->CurrentNumberOfGraphicsOutput++; } - if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + if (UgaDraw != NULL) { Private->CurrentNumberOfUgaDraw++; } @@ -3061,13 +3024,13 @@ ConSplitterTextOutAddDevice ( ASSERT (MaxMode >= 1); DeviceStatus = EFI_DEVICE_ERROR; - if (FeaturePcdGet (PcdConOutGopSupport)) { - // - // If GOP is produced by Consplitter, this device display mode will be added into Graphics Ouput modes. - // - if ((GraphicsOutput != NULL) || (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport))) { - DeviceStatus = ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw); - } + Status = EFI_DEVICE_ERROR; + + // + // This device display mode will be added into Graphics Ouput modes. + // + if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) { + DeviceStatus = ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw); } if (FeaturePcdGet (PcdConOutUgaSupport)) { @@ -3086,7 +3049,7 @@ ConSplitterTextOutAddDevice ( FreePool (Info); - } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + } else if (UgaDraw != NULL) { Status = UgaDraw->GetMode ( UgaDraw, &UgaHorizontalResolution, @@ -3121,6 +3084,46 @@ ConSplitterTextOutAddDevice ( } } + if (((!EFI_ERROR (DeviceStatus)) || (!EFI_ERROR (Status))) && + ((Private->CurrentNumberOfGraphicsOutput + Private->CurrentNumberOfUgaDraw) == 1)) { + if (!FeaturePcdGet (PcdConOutGopSupport)) { + // + // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed + // on the virtual handle. + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &mConOut.VirtualHandle, + &gEfiUgaDrawProtocolGuid, + &mConOut.UgaDraw, + NULL + ); + } else if (!FeaturePcdGet (PcdConOutUgaSupport)) { + // + // If UGA Draw protocol not supported, Graphics Output Protocol is installed + // on virtual handle. + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &mConOut.VirtualHandle, + &gEfiGraphicsOutputProtocolGuid, + &mConOut.GraphicsOutput, + NULL + ); + } else { + // + // Boot Graphics Output protocol and UGA Draw protocol are supported, + // both they will be installed on virtual handle. + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &mConOut.VirtualHandle, + &gEfiGraphicsOutputProtocolGuid, + &mConOut.GraphicsOutput, + &gEfiUgaDrawProtocolGuid, + &mConOut.UgaDraw, + NULL + ); + } + } + // // After adding new console device, all existing console devices should be // synced to the current shared mode. @@ -3161,7 +3164,7 @@ ConSplitterTextOutDeleteDevice ( TextOutList = Private->TextOutList; while (Index >= 0) { if (TextOutList->TextOut == TextOut) { - if (TextOutList->UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + if (TextOutList->UgaDraw != NULL) { Private->CurrentNumberOfUgaDraw--; } if (TextOutList->GraphicsOutput != NULL) { diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index 7167033841..52b0ec651c 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -533,9 +533,6 @@ GraphicsConsoleControllerDriverStart ( goto Error; } } - } else { - Status = EFI_UNSUPPORTED; - goto Error; } } -- cgit v1.2.3