]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/IndustryStandard/VirtioGpu.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / VirtioGpu.h
index 9c3516e71ee38a60f55e184ccc8bc8bfea90bb69..13f719d4c0f2da4bcda316b75e115750a85f61f0 100644 (file)
 \r
   Copyright (C) 2016, Red Hat, Inc.\r
 \r
-  This program and the accompanying materials are licensed and made available\r
-  under the terms and conditions of the BSD License which accompanies this\r
-  distribution. The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
-  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -32,7 +26,7 @@
 //\r
 // Queue number for sending control commands.\r
 //\r
-#define VIRTIO_GPU_CONTROL_QUEUE 0\r
+#define VIRTIO_GPU_CONTROL_QUEUE  0\r
 \r
 //\r
 // Command and response types.\r
@@ -43,8 +37,9 @@ typedef enum {
   //\r
   // - create/release a host-side 2D resource,\r
   //\r
-  VirtioGpuCmdResourceCreate2d      = 0x0101,\r
-  VirtioGpuCmdResourceUnref         = 0x0102,\r
+  VirtioGpuCmdGetDisplayInfo   = 0x0100,\r
+  VirtioGpuCmdResourceCreate2d = 0x0101,\r
+  VirtioGpuCmdResourceUnref    = 0x0102,\r
   //\r
   // - attach/detach guest RAM to/from a host-side 2D resource,\r
   //\r
@@ -53,7 +48,7 @@ typedef enum {
   //\r
   // - assign/unassign a host-side 2D resource to/from a scanout ("head").\r
   //\r
-  VirtioGpuCmdSetScanout            = 0x0103,\r
+  VirtioGpuCmdSetScanout = 0x0103,\r
 \r
   //\r
   // Commands related to drawing:\r
@@ -61,22 +56,23 @@ typedef enum {
   // - transfer a guest RAM update to the host-side 2D resource (does not imply\r
   //   host display refresh),\r
   //\r
-  VirtioGpuCmdTransferToHost2d      = 0x0105,\r
+  VirtioGpuCmdTransferToHost2d = 0x0105,\r
   //\r
   // - trigger a host display refresh from the 2D resource.\r
   //\r
-  VirtioGpuCmdResourceFlush         = 0x0104,\r
+  VirtioGpuCmdResourceFlush = 0x0104,\r
 \r
   //\r
   // Success code for all of the above commands.\r
   //\r
-  VirtioGpuRespOkNodata             = 0x1100,\r
+  VirtioGpuRespOkNodata      = 0x1100,\r
+  VirtioGpuRespOkDisplayInfo = 0x1101,\r
 } VIRTIO_GPU_CONTROL_TYPE;\r
 \r
 //\r
 // Common request/response header.\r
 //\r
-#define VIRTIO_GPU_FLAG_FENCE BIT0\r
+#define VIRTIO_GPU_FLAG_FENCE  BIT0\r
 \r
 #pragma pack (1)\r
 typedef struct {\r
@@ -84,20 +80,20 @@ typedef struct {
   // The guest sets Type to VirtioGpuCmd* in the requests. The host sets Type\r
   // to VirtioGpuResp* in the responses.\r
   //\r
-  UINT32 Type;\r
+  UINT32    Type;\r
 \r
   //\r
   // Fencing forces the host to complete the command before producing a\r
   // response.\r
   //\r
-  UINT32 Flags;\r
-  UINT64 FenceId;\r
+  UINT32    Flags;\r
+  UINT64    FenceId;\r
 \r
   //\r
   // Unused.\r
   //\r
-  UINT32 CtxId;\r
-  UINT32 Padding;\r
+  UINT32    CtxId;\r
+  UINT32    Padding;\r
 } VIRTIO_GPU_CONTROL_HEADER;\r
 #pragma pack ()\r
 \r
@@ -106,10 +102,10 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  UINT32 X;\r
-  UINT32 Y;\r
-  UINT32 Width;\r
-  UINT32 Height;\r
+  UINT32    X;\r
+  UINT32    Y;\r
+  UINT32    Width;\r
+  UINT32    Height;\r
 } VIRTIO_GPU_RECTANGLE;\r
 #pragma pack ()\r
 \r
@@ -125,11 +121,11 @@ typedef enum {
 \r
 #pragma pack (1)\r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  UINT32                    ResourceId; // note: 0 is invalid\r
-  UINT32                    Format;     // from VIRTIO_GPU_FORMATS\r
-  UINT32                    Width;\r
-  UINT32                    Height;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  UINT32                       ResourceId; // note: 0 is invalid\r
+  UINT32                       Format;     // from VIRTIO_GPU_FORMATS\r
+  UINT32                       Width;\r
+  UINT32                       Height;\r
 } VIRTIO_GPU_RESOURCE_CREATE_2D;\r
 #pragma pack ()\r
 \r
@@ -138,9 +134,9 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  UINT32                    ResourceId;\r
-  UINT32                    Padding;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  UINT32                       ResourceId;\r
+  UINT32                       Padding;\r
 } VIRTIO_GPU_RESOURCE_UNREF;\r
 #pragma pack ()\r
 \r
@@ -152,16 +148,16 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  UINT64 Addr;\r
-  UINT32 Length;\r
-  UINT32 Padding;\r
+  UINT64    Addr;\r
+  UINT32    Length;\r
+  UINT32    Padding;\r
 } VIRTIO_GPU_MEM_ENTRY;\r
 \r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  UINT32                    ResourceId;\r
-  UINT32                    NrEntries;  // number of entries: constant 1\r
-  VIRTIO_GPU_MEM_ENTRY      Entry;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  UINT32                       ResourceId;\r
+  UINT32                       NrEntries; // number of entries: constant 1\r
+  VIRTIO_GPU_MEM_ENTRY         Entry;\r
 } VIRTIO_GPU_RESOURCE_ATTACH_BACKING;\r
 #pragma pack ()\r
 \r
@@ -170,9 +166,9 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  UINT32                    ResourceId;\r
-  UINT32                    Padding;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  UINT32                       ResourceId;\r
+  UINT32                       Padding;\r
 } VIRTIO_GPU_RESOURCE_DETACH_BACKING;\r
 #pragma pack ()\r
 \r
@@ -181,10 +177,10 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  VIRTIO_GPU_RECTANGLE      Rectangle;\r
-  UINT32                    ScanoutId;\r
-  UINT32                    ResourceId;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  VIRTIO_GPU_RECTANGLE         Rectangle;\r
+  UINT32                       ScanoutId;\r
+  UINT32                       ResourceId;\r
 } VIRTIO_GPU_SET_SCANOUT;\r
 #pragma pack ()\r
 \r
@@ -193,11 +189,11 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  VIRTIO_GPU_RECTANGLE      Rectangle;\r
-  UINT64                    Offset;\r
-  UINT32                    ResourceId;\r
-  UINT32                    Padding;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  VIRTIO_GPU_RECTANGLE         Rectangle;\r
+  UINT64                       Offset;\r
+  UINT32                       ResourceId;\r
+  UINT32                       Padding;\r
 }  VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D;\r
 #pragma pack ()\r
 \r
@@ -206,11 +202,26 @@ typedef struct {
 //\r
 #pragma pack (1)\r
 typedef struct {\r
-  VIRTIO_GPU_CONTROL_HEADER Header;\r
-  VIRTIO_GPU_RECTANGLE      Rectangle;\r
-  UINT32                    ResourceId;\r
-  UINT32                    Padding;\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  VIRTIO_GPU_RECTANGLE         Rectangle;\r
+  UINT32                       ResourceId;\r
+  UINT32                       Padding;\r
 } VIRTIO_GPU_RESOURCE_FLUSH;\r
 #pragma pack ()\r
 \r
+//\r
+// Response structure for VirtioGpuCmdGetDisplayInfo\r
+//\r
+#define VIRTIO_GPU_MAX_SCANOUTS  16\r
+#pragma pack (1)\r
+typedef struct {\r
+  VIRTIO_GPU_CONTROL_HEADER    Header;\r
+  struct {\r
+    VIRTIO_GPU_RECTANGLE    Rectangle;\r
+    UINT32                  Enabled;\r
+    UINT32                  Flags;\r
+  } Pmodes[VIRTIO_GPU_MAX_SCANOUTS];\r
+} VIRTIO_GPU_RESP_DISPLAY_INFO;\r
+#pragma pack ()\r
+\r
 #endif // _VIRTIO_GPU_H_\r