From 8731debefd1f0750cd033ce88a83f1d1dce9df3c Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 17 Aug 2016 22:45:02 +0200 Subject: OvmfPkg/VirtioGpuDxe: implement EFI_GRAPHICS_OUTPUT_PROTOCOL In this patch we replace our "dummy" Graphics Output Protocol interface with the real one. We exploit that EFI_GRAPHICS_OUTPUT_BLT_PIXEL and VirtioGpuFormatB8G8R8X8Unorm have identical representations; this lets us forego any pixel format conversions in the guest. For messaging the VirtIo GPU device, we use the primitives introduced in the previous patch. Cc: Ard Biesheuvel Cc: Jordan Justen Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=66 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/VirtioGpuDxe/VirtioGpu.h | 64 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) (limited to 'OvmfPkg/VirtioGpuDxe/VirtioGpu.h') diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h index f883992248..078b7d44d8 100644 --- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h +++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h @@ -20,6 +20,7 @@ #include #include #include +#include #include // @@ -114,9 +115,34 @@ struct VGPU_GOP_STRUCT { // The Gop field is installed on the child handle as Graphics Output Protocol // interface. // - // For now it is just a placeholder. + EFI_GRAPHICS_OUTPUT_PROTOCOL Gop; + + // + // Referenced by Gop.Mode, GopMode provides a summary about the supported + // graphics modes, and the current mode. + // + EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE GopMode; + + // + // Referenced by GopMode.Info, GopModeInfo provides detailed information + // about the current mode. + // + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION GopModeInfo; + + // + // Identifier of the 2D host resource that is in use by this head (scanout) + // of the VirtIo GPU device. Zero until the first successful -- internal -- + // Gop.SetMode() call, never zero afterwards. + // + UINT32 ResourceId; + // - UINT8 Gop; + // A number of whole pages providing the backing store for the 2D host + // resource identified by ResourceId above. NULL until the first successful + // -- internal -- Gop.SetMode() call, never NULL afterwards. + // + UINT32 *BackingStore; + UINTN NumberOfPages; }; // @@ -264,4 +290,38 @@ VirtioGpuResourceFlush ( IN UINT32 ResourceId ); +/** + Release guest-side and host-side resources that are related to an initialized + VGPU_GOP.Gop. + + param[in,out] VgpuGop The VGPU_GOP object to release resources for. + + On input, the caller is responsible for having called + VgpuGop->Gop.SetMode() at least once successfully. + (This is equivalent to the requirement that + VgpuGop->BackingStore be non-NULL. It is also + equivalent to the requirement that VgpuGop->ResourceId + be nonzero.) + + On output, resources will be released, and + VgpuGop->BackingStore and VgpuGop->ResourceId will be + nulled. + + param[in] DisableHead Whether this head (scanout) currently references the + resource identified by VgpuGop->ResourceId. Only pass + FALSE when VgpuGop->Gop.SetMode() calls this function + while switching between modes, and set it to TRUE + every other time. +**/ +VOID +ReleaseGopResources ( + IN OUT VGPU_GOP *VgpuGop, + IN BOOLEAN DisableHead + ); + +// +// Template for initializing VGPU_GOP.Gop. +// +extern CONST EFI_GRAPHICS_OUTPUT_PROTOCOL mGopTemplate; + #endif // _VIRTIO_GPU_DXE_H_ -- cgit v1.2.3