summaryrefslogtreecommitdiff
path: root/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-08-17 22:45:02 +0200
committerLaszlo Ersek <lersek@redhat.com>2016-09-01 22:55:53 +0200
commit8731debefd1f0750cd033ce88a83f1d1dce9df3c (patch)
treed3feb02e5c715345842da9e426ed7f001499e1c4 /OvmfPkg/VirtioGpuDxe/VirtioGpu.h
parenta66ea3b5578ccebf22c2d1d673273f0dffc84ffa (diff)
downloadedk2-platforms-8731debefd1f0750cd033ce88a83f1d1dce9df3c.tar.xz
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 <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=66 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/VirtioGpuDxe/VirtioGpu.h')
-rw-r--r--OvmfPkg/VirtioGpuDxe/VirtioGpu.h64
1 files changed, 62 insertions, 2 deletions
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 <IndustryStandard/VirtioGpu.h>
#include <Library/DebugLib.h>
#include <Library/UefiLib.h>
+#include <Protocol/GraphicsOutput.h>
#include <Protocol/VirtioDevice.h>
//
@@ -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_