OvmfPkg/QemuVideoDxe: VMWare SVGA device support
In addition to the QXL, Cirrus, etc. VGA adapters, Qemu also implements a basic version of VMWare's SVGA display device. Drivers for this device exist for some guest OSes which do not support Qemu's other display adapters, so supporting it in OVMF is useful in conjunction with those OSes. This change adds support for the SVGA device's framebuffer to QemuVideoDxe's graphics output protocol implementation, based on VMWare's documentation. The most basic initialisation, framebuffer layout query, and mode setting operations are implemented. The device relies on port-based 32-bit I/O, unfortunately on misaligned addresses. This limits the driver's support to the x86 family of platforms. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
committed by
Laszlo Ersek
parent
05a5379458
commit
c137d95081
@@ -13,6 +13,7 @@
|
||||
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/VmwareSvga.h>
|
||||
#include "Qemu.h"
|
||||
|
||||
STATIC
|
||||
@@ -75,6 +76,42 @@ 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;
|
||||
|
||||
FreePool (FrameBufDesc);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Graphics Output Protocol Member Functions
|
||||
@@ -124,10 +161,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;
|
||||
}
|
||||
@@ -176,6 +217,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;
|
||||
@@ -186,7 +233,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