]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioGpuDxe/VirtioGpu.h
OvmfPkg/VirtioGpuDxe: provide functions for sending VirtIo GPU commands
[mirror_edk2.git] / OvmfPkg / VirtioGpuDxe / VirtioGpu.h
index 97767dba709f9e9eef43221207ef7d72921deba2..f8839922487ca07d44572abae27ba30271afc821 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef _VIRTIO_GPU_DXE_H_\r
 #define _VIRTIO_GPU_DXE_H_\r
 \r
+#include <IndustryStandard/VirtioGpu.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Protocol/VirtioDevice.h>\r
@@ -58,6 +59,11 @@ typedef struct {
   //\r
   EFI_EVENT                ExitBoot;\r
 \r
+  //\r
+  // Common running counter for all VirtIo GPU requests that ask for fencing.\r
+  //\r
+  UINT64                   FenceId;\r
+\r
   //\r
   // The Child field references the GOP wrapper structure. If this pointer is\r
   // NULL, then the hybrid driver has bound (i.e., started) the\r
@@ -171,4 +177,91 @@ VirtioGpuExitBoot (
   IN VOID      *Context\r
   );\r
 \r
+/**\r
+  The following functions send requests to the VirtIo GPU device model, await\r
+  the answer from the host, and return a status. They share the following\r
+  interface details:\r
+\r
+  @param[in,out] VgpuDev  The VGPU_DEV object that represents the VirtIo GPU\r
+                          device. The caller is responsible to have\r
+                          successfully invoked VirtioGpuInit() on VgpuDev\r
+                          previously, while VirtioGpuUninit() must not have\r
+                          been called on VgpuDev.\r
+\r
+  @retval EFI_INVALID_PARAMETER  Invalid command-specific parameters were\r
+                                 detected by this driver.\r
+\r
+  @retval EFI_SUCCESS            Operation successful.\r
+\r
+  @retval EFI_DEVICE_ERROR       The host rejected the request. The host error\r
+                                 code has been logged on the EFI_D_ERROR level.\r
+\r
+  @return                        Codes for unexpected errors in VirtIo\r
+                                 messaging.\r
+\r
+  For the command-specific parameters, please consult the GPU Device section of\r
+  the VirtIo 1.0 specification (see references in\r
+  "OvmfPkg/Include/IndustryStandard/VirtioGpu.h").\r
+**/\r
+EFI_STATUS\r
+VirtioGpuResourceCreate2d (\r
+  IN OUT VGPU_DEV           *VgpuDev,\r
+  IN     UINT32             ResourceId,\r
+  IN     VIRTIO_GPU_FORMATS Format,\r
+  IN     UINT32             Width,\r
+  IN     UINT32             Height\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioGpuResourceUnref (\r
+  IN OUT VGPU_DEV *VgpuDev,\r
+  IN     UINT32   ResourceId\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioGpuResourceAttachBacking (\r
+  IN OUT VGPU_DEV *VgpuDev,\r
+  IN     UINT32   ResourceId,\r
+  IN     VOID     *FirstBackingPage,\r
+  IN     UINTN    NumberOfPages\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioGpuResourceDetachBacking (\r
+  IN OUT VGPU_DEV *VgpuDev,\r
+  IN     UINT32   ResourceId\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioGpuSetScanout (\r
+  IN OUT VGPU_DEV *VgpuDev,\r
+  IN     UINT32   X,\r
+  IN     UINT32   Y,\r
+  IN     UINT32   Width,\r
+  IN     UINT32   Height,\r
+  IN     UINT32   ScanoutId,\r
+  IN     UINT32   ResourceId\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioGpuTransferToHost2d (\r
+  IN OUT VGPU_DEV *VgpuDev,\r
+  IN     UINT32   X,\r
+  IN     UINT32   Y,\r
+  IN     UINT32   Width,\r
+  IN     UINT32   Height,\r
+  IN     UINT64   Offset,\r
+  IN     UINT32   ResourceId\r
+  );\r
+\r
+EFI_STATUS\r
+VirtioGpuResourceFlush (\r
+  IN OUT VGPU_DEV *VgpuDev,\r
+  IN     UINT32   X,\r
+  IN     UINT32   Y,\r
+  IN     UINT32   Width,\r
+  IN     UINT32   Height,\r
+  IN     UINT32   ResourceId\r
+  );\r
+\r
 #endif // _VIRTIO_GPU_DXE_H_\r