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 <elvin.li@intel.com> Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13787 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -418,49 +418,12 @@ ConSplitterDriverEntry(
|
|||||||
//
|
//
|
||||||
Status = ConSplitterTextOutConstructor (&mConOut);
|
Status = ConSplitterTextOutConstructor (&mConOut);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
if (!FeaturePcdGet (PcdConOutGopSupport)) {
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
//
|
&mConOut.VirtualHandle,
|
||||||
// If Graphics Outpurt protocol not supported, UGA Draw protocol is installed
|
&gEfiSimpleTextOutProtocolGuid,
|
||||||
// on the virtual handle.
|
&mConOut.TextOut,
|
||||||
//
|
NULL
|
||||||
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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// Update the EFI System Table with new virtual console
|
// Update the EFI System Table with new virtual console
|
||||||
@ -1315,7 +1278,7 @@ ConSplitterConOutDriverBindingStart (
|
|||||||
|
|
||||||
FreePool (Info);
|
FreePool (Info);
|
||||||
|
|
||||||
} else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
} else if (UgaDraw != NULL) {
|
||||||
Status = UgaDraw->GetMode (
|
Status = UgaDraw->GetMode (
|
||||||
UgaDraw,
|
UgaDraw,
|
||||||
&mConOut.UgaHorizontalResolution,
|
&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
|
// Graphics console driver can ensure the same mode for all GOP devices
|
||||||
// so we can get the current mode from this video device
|
// so we can get the current mode from this video device
|
||||||
@ -2838,7 +2801,7 @@ Done:
|
|||||||
if (GraphicsOutput != NULL) {
|
if (GraphicsOutput != NULL) {
|
||||||
Private->CurrentNumberOfGraphicsOutput++;
|
Private->CurrentNumberOfGraphicsOutput++;
|
||||||
}
|
}
|
||||||
if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
if (UgaDraw != NULL) {
|
||||||
Private->CurrentNumberOfUgaDraw++;
|
Private->CurrentNumberOfUgaDraw++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3061,13 +3024,13 @@ ConSplitterTextOutAddDevice (
|
|||||||
ASSERT (MaxMode >= 1);
|
ASSERT (MaxMode >= 1);
|
||||||
|
|
||||||
DeviceStatus = EFI_DEVICE_ERROR;
|
DeviceStatus = EFI_DEVICE_ERROR;
|
||||||
if (FeaturePcdGet (PcdConOutGopSupport)) {
|
Status = EFI_DEVICE_ERROR;
|
||||||
//
|
|
||||||
// If GOP is produced by Consplitter, this device display mode will be added into Graphics Ouput modes.
|
//
|
||||||
//
|
// This device display mode will be added into Graphics Ouput modes.
|
||||||
if ((GraphicsOutput != NULL) || (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport))) {
|
//
|
||||||
DeviceStatus = ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);
|
if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {
|
||||||
}
|
DeviceStatus = ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FeaturePcdGet (PcdConOutUgaSupport)) {
|
if (FeaturePcdGet (PcdConOutUgaSupport)) {
|
||||||
@ -3086,7 +3049,7 @@ ConSplitterTextOutAddDevice (
|
|||||||
|
|
||||||
FreePool (Info);
|
FreePool (Info);
|
||||||
|
|
||||||
} else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
} else if (UgaDraw != NULL) {
|
||||||
Status = UgaDraw->GetMode (
|
Status = UgaDraw->GetMode (
|
||||||
UgaDraw,
|
UgaDraw,
|
||||||
&UgaHorizontalResolution,
|
&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
|
// After adding new console device, all existing console devices should be
|
||||||
// synced to the current shared mode.
|
// synced to the current shared mode.
|
||||||
@ -3161,7 +3164,7 @@ ConSplitterTextOutDeleteDevice (
|
|||||||
TextOutList = Private->TextOutList;
|
TextOutList = Private->TextOutList;
|
||||||
while (Index >= 0) {
|
while (Index >= 0) {
|
||||||
if (TextOutList->TextOut == TextOut) {
|
if (TextOutList->TextOut == TextOut) {
|
||||||
if (TextOutList->UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
if (TextOutList->UgaDraw != NULL) {
|
||||||
Private->CurrentNumberOfUgaDraw--;
|
Private->CurrentNumberOfUgaDraw--;
|
||||||
}
|
}
|
||||||
if (TextOutList->GraphicsOutput != NULL) {
|
if (TextOutList->GraphicsOutput != NULL) {
|
||||||
|
@ -533,9 +533,6 @@ GraphicsConsoleControllerDriverStart (
|
|||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Status = EFI_UNSUPPORTED;
|
|
||||||
goto Error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user