TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtioGpu.h
Go to the documentation of this file.
1
11#ifndef _VIRTIO_GPU_DXE_H_
12#define _VIRTIO_GPU_DXE_H_
13
16#include <Library/DebugLib.h>
17#include <Library/UefiLib.h>
20
21//
22// Forward declaration of VGPU_GOP.
23//
24typedef struct VGPU_GOP_STRUCT VGPU_GOP;
25
26//
27// The abstraction that directly corresponds to a Virtio GPU device.
28//
29// This structure will be installed on the handle that has the VirtIo Device
30// Protocol interface, with GUID gEfiCallerIdGuid. A similar trick is employed
31// in TerminalDxe, and it is necessary so that we can look up VGPU_DEV just
32// from the VirtIo Device Protocol handle in the Component Name 2 Protocol
33// implementation.
34//
35typedef struct {
36 //
37 // VirtIo represents access to the Virtio GPU device. Never NULL.
38 //
40
41 //
42 // BusName carries a customized name for
43 // EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName(). It is expressed in table
44 // form because it can theoretically support several languages. Never NULL.
45 //
47
48 //
49 // VirtIo ring used for VirtIo communication.
50 //
51 VRING Ring;
52
53 //
54 // Token associated with Ring's mapping for bus master common buffer
55 // operation, from VirtioRingMap().
56 //
57 VOID *RingMap;
58
59 //
60 // Event to be signaled at ExitBootServices().
61 //
62 EFI_EVENT ExitBoot;
63
64 //
65 // Common running counter for all VirtIo GPU requests that ask for fencing.
66 //
67 UINT64 FenceId;
68
69 //
70 // The Child field references the GOP wrapper structure. If this pointer is
71 // NULL, then the hybrid driver has bound (i.e., started) the
72 // VIRTIO_DEVICE_PROTOCOL controller without producing the child GOP
73 // controller (that is, after Start() was called with RemainingDevicePath
74 // pointing to and End of Device Path node). Child can be created and
75 // destroyed, even repeatedly, independently of VGPU_DEV.
76 //
77 // In practice, this field represents the single head (scanout) that we
78 // support.
79 //
81} VGPU_DEV;
82
83//
84// The Graphics Output Protocol wrapper structure.
85//
86#define VGPU_GOP_SIG SIGNATURE_64 ('V', 'G', 'P', 'U', '_', 'G', 'O', 'P')
87
89 UINT64 Signature;
90
91 //
92 // ParentBus points to the parent VGPU_DEV object. Never NULL.
93 //
94 VGPU_DEV *ParentBus;
95
96 //
97 // GopName carries a customized name for
98 // EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName(). It is expressed in table
99 // form because it can theoretically support several languages. Never NULL.
100 //
102
103 //
104 // GopHandle is the UEFI child handle that carries the device path ending
105 // with the ACPI ADR node, and the Graphics Output Protocol. Never NULL.
106 //
107 EFI_HANDLE GopHandle;
108
109 //
110 // The GopDevicePath field is the device path installed on GopHandle,
111 // ending with an ACPI ADR node. Never NULL.
112 //
113 EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;
114
115 //
116 // The Gop field is installed on the child handle as Graphics Output Protocol
117 // interface.
118 //
120
121 //
122 // Referenced by Gop.Mode, GopMode provides a summary about the supported
123 // graphics modes, and the current mode.
124 //
126
127 //
128 // Referenced by GopMode.Info, GopModeInfo provides detailed information
129 // about the current mode.
130 //
132
133 //
134 // Identifier of the 2D host resource that is in use by this head (scanout)
135 // of the VirtIo GPU device. Zero until the first successful -- internal --
136 // Gop.SetMode() call, never zero afterwards.
137 //
138 UINT32 ResourceId;
139
140 //
141 // A number of whole pages providing the backing store for the 2D host
142 // resource identified by ResourceId above. NULL until the first successful
143 // -- internal -- Gop.SetMode() call, never NULL afterwards.
144 //
145 UINT32 *BackingStore;
146 UINTN NumberOfPages;
147
148 //
149 // Token associated with BackingStore's mapping for bus master common
150 // buffer operation. BackingStoreMap is valid if, and only if,
151 // BackingStore is non-NULL.
152 //
153 VOID *BackingStoreMap;
154
155 //
156 // native display resolution
157 //
158 UINT32 NativeXRes;
159 UINT32 NativeYRes;
160};
161
162//
163// VirtIo GPU initialization, and commands (primitives) for the GPU device.
164//
165
184 IN OUT VGPU_DEV *VgpuDev
185 );
186
196VOID
198 IN OUT VGPU_DEV *VgpuDev
199 );
200
231 IN VGPU_DEV *VgpuDev,
232 IN UINTN NumberOfPages,
233 OUT VOID **HostAddress,
234 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
235 OUT VOID **Mapping
236 );
237
260VOID
262 IN VGPU_DEV *VgpuDev,
263 IN UINTN NumberOfPages,
264 IN VOID *HostAddress,
265 IN VOID *Mapping
266 );
267
281VOID
282EFIAPI
284 IN EFI_EVENT Event,
285 IN VOID *Context
286 );
287
316 IN OUT VGPU_DEV *VgpuDev,
317 IN UINT32 ResourceId,
318 IN VIRTIO_GPU_FORMATS Format,
319 IN UINT32 Width,
320 IN UINT32 Height
321 );
322
324VirtioGpuResourceUnref (
325 IN OUT VGPU_DEV *VgpuDev,
326 IN UINT32 ResourceId
327 );
328
330VirtioGpuResourceAttachBacking (
331 IN OUT VGPU_DEV *VgpuDev,
332 IN UINT32 ResourceId,
333 IN EFI_PHYSICAL_ADDRESS BackingStoreDeviceAddress,
334 IN UINTN NumberOfPages
335 );
336
338VirtioGpuResourceDetachBacking (
339 IN OUT VGPU_DEV *VgpuDev,
340 IN UINT32 ResourceId
341 );
342
344VirtioGpuSetScanout (
345 IN OUT VGPU_DEV *VgpuDev,
346 IN UINT32 X,
347 IN UINT32 Y,
348 IN UINT32 Width,
349 IN UINT32 Height,
350 IN UINT32 ScanoutId,
351 IN UINT32 ResourceId
352 );
353
355VirtioGpuTransferToHost2d (
356 IN OUT VGPU_DEV *VgpuDev,
357 IN UINT32 X,
358 IN UINT32 Y,
359 IN UINT32 Width,
360 IN UINT32 Height,
361 IN UINT64 Offset,
362 IN UINT32 ResourceId
363 );
364
366VirtioGpuResourceFlush (
367 IN OUT VGPU_DEV *VgpuDev,
368 IN UINT32 X,
369 IN UINT32 Y,
370 IN UINT32 Width,
371 IN UINT32 Height,
372 IN UINT32 ResourceId
373 );
374
376VirtioGpuGetDisplayInfo (
377 IN OUT VGPU_DEV *VgpuDev,
378 volatile VIRTIO_GPU_RESP_DISPLAY_INFO *Response
379 );
380
404VOID
406 IN OUT VGPU_GOP *VgpuGop,
407 IN BOOLEAN DisableHead
408 );
409
410//
411// Template for initializing VGPU_GOP.Gop.
412//
413extern CONST EFI_GRAPHICS_OUTPUT_PROTOCOL mGopTemplate;
414
415#endif // _VIRTIO_GPU_DXE_H_
UINT64 UINTN
NODE Child(IN NODE LoopVar6, IN UINT8 LoopVar5)
Definition: Compress.c:265
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
VOID VirtioGpuUninit(IN OUT VGPU_DEV *VgpuDev)
Definition: Commands.c:202
VOID EFIAPI VirtioGpuExitBoot(IN EFI_EVENT Event, IN VOID *Context)
Definition: Commands.c:350
VOID VirtioGpuUnmapAndFreeBackingStore(IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, IN VOID *HostAddress, IN VOID *Mapping)
Definition: Commands.c:317
VOID ReleaseGopResources(IN OUT VGPU_GOP *VgpuGop, IN BOOLEAN DisableHead)
Definition: Gop.c:40
EFI_STATUS VirtioGpuAllocateZeroAndMapBackingStore(IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
Definition: Commands.c:244
EFI_STATUS VirtioGpuResourceCreate2d(IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN VIRTIO_GPU_FORMATS Format, IN UINT32 Width, IN UINT32 Height)
Definition: Commands.c:622
EFI_STATUS VirtioGpuInit(IN OUT VGPU_DEV *VgpuDev)
Definition: Commands.c:33