Reapply "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
This reverts commit98856a724c
, reapplyingc137d95081
. Note that the commit now being reverted is technically correct; the only reason we're reverting it is because it should not have been pushed past the Soft Feature Freeze for the edk2-stable201811 tag. Cc: Anthony Perard <anthony.perard@citrix.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Julien Grall <julien.grall@linaro.org> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: yuchenlin <yuchenlin@synology.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1319 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: yuchenlin <yuchenlin@synology.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/VmwareSvga.h>
|
||||
#include "Qemu.h"
|
||||
|
||||
STATIC
|
||||
@@ -78,6 +79,46 @@ QemuVideoCompleteModeData (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
QemuVideoVmwareSvgaCompleteModeData (
|
||||
IN QEMU_VIDEO_PRIVATE_DATA *Private,
|
||||
OUT EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *FrameBufDesc;
|
||||
UINT32 BytesPerLine, FbOffset, BytesPerPixel;
|
||||
|
||||
Info = Mode->Info;
|
||||
CopyMem (Info, &Private->VmwareSvgaModeInfo[Mode->Mode], sizeof (*Info));
|
||||
BytesPerPixel = Private->ModeData[Mode->Mode].ColorDepth / 8;
|
||||
BytesPerLine = Info->PixelsPerScanLine * BytesPerPixel;
|
||||
|
||||
FbOffset = VmwareSvgaRead (Private, VmwareSvgaRegFbOffset);
|
||||
|
||||
Status = Private->PciIo->GetBarAttributes (
|
||||
Private->PciIo,
|
||||
PCI_BAR_IDX1,
|
||||
NULL,
|
||||
(VOID**) &FrameBufDesc
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin + FbOffset;
|
||||
Mode->FrameBufferSize = BytesPerLine * Info->VerticalResolution;
|
||||
Mode->FrameBufferSize = EFI_PAGES_TO_SIZE (
|
||||
EFI_SIZE_TO_PAGES (Mode->FrameBufferSize)
|
||||
);
|
||||
|
||||
FreePool (FrameBufDesc);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Graphics Output Protocol Member Functions
|
||||
//
|
||||
@@ -126,10 +167,14 @@ Routine Description:
|
||||
|
||||
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
|
||||
ModeData = &Private->ModeData[ModeNumber];
|
||||
(*Info)->HorizontalResolution = ModeData->HorizontalResolution;
|
||||
(*Info)->VerticalResolution = ModeData->VerticalResolution;
|
||||
QemuVideoCompleteModeInfo (ModeData, *Info);
|
||||
if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
|
||||
CopyMem (*Info, &Private->VmwareSvgaModeInfo[ModeNumber], sizeof (**Info));
|
||||
} else {
|
||||
ModeData = &Private->ModeData[ModeNumber];
|
||||
(*Info)->HorizontalResolution = ModeData->HorizontalResolution;
|
||||
(*Info)->VerticalResolution = ModeData->VerticalResolution;
|
||||
QemuVideoCompleteModeInfo (ModeData, *Info);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -179,6 +224,12 @@ Routine Description:
|
||||
case QEMU_VIDEO_BOCHS:
|
||||
InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
|
||||
break;
|
||||
case QEMU_VIDEO_VMWARE_SVGA:
|
||||
InitializeVmwareSvgaGraphicsMode (
|
||||
Private,
|
||||
&QemuVideoBochsModes[ModeData->InternalModeIndex]
|
||||
);
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
return EFI_DEVICE_ERROR;
|
||||
@@ -189,7 +240,11 @@ Routine Description:
|
||||
This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
|
||||
This->Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
|
||||
|
||||
QemuVideoCompleteModeData (Private, This->Mode);
|
||||
if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
|
||||
QemuVideoVmwareSvgaCompleteModeData (Private, This->Mode);
|
||||
} else {
|
||||
QemuVideoCompleteModeData (Private, This->Mode);
|
||||
}
|
||||
|
||||
//
|
||||
// Re-initialize the frame buffer configure when mode changes.
|
||||
|
Reference in New Issue
Block a user