TianoCore EDK2 master
|
#include <IndustryStandard/VirtioGpu.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiLib.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/VirtioDevice.h>
Go to the source code of this file.
Data Structures | |
struct | VGPU_DEV |
struct | VGPU_GOP_STRUCT |
Macros | |
#define | VGPU_GOP_SIG SIGNATURE_64 ('V', 'G', 'P', 'U', '_', 'G', 'O', 'P') |
Typedefs | |
typedef struct VGPU_GOP_STRUCT | VGPU_GOP |
Functions | |
EFI_STATUS | VirtioGpuInit (IN OUT VGPU_DEV *VgpuDev) |
VOID | VirtioGpuUninit (IN OUT VGPU_DEV *VgpuDev) |
EFI_STATUS | VirtioGpuAllocateZeroAndMapBackingStore (IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping) |
VOID | VirtioGpuUnmapAndFreeBackingStore (IN VGPU_DEV *VgpuDev, IN UINTN NumberOfPages, IN VOID *HostAddress, IN VOID *Mapping) |
VOID EFIAPI | VirtioGpuExitBoot (IN EFI_EVENT Event, IN VOID *Context) |
EFI_STATUS | VirtioGpuResourceCreate2d (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN VIRTIO_GPU_FORMATS Format, IN UINT32 Width, IN UINT32 Height) |
EFI_STATUS | VirtioGpuResourceUnref (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuResourceAttachBacking (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId, IN EFI_PHYSICAL_ADDRESS BackingStoreDeviceAddress, IN UINTN NumberOfPages) |
EFI_STATUS | VirtioGpuResourceDetachBacking (IN OUT VGPU_DEV *VgpuDev, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuSetScanout (IN OUT VGPU_DEV *VgpuDev, IN UINT32 X, IN UINT32 Y, IN UINT32 Width, IN UINT32 Height, IN UINT32 ScanoutId, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuTransferToHost2d (IN OUT VGPU_DEV *VgpuDev, IN UINT32 X, IN UINT32 Y, IN UINT32 Width, IN UINT32 Height, IN UINT64 Offset, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuResourceFlush (IN OUT VGPU_DEV *VgpuDev, IN UINT32 X, IN UINT32 Y, IN UINT32 Width, IN UINT32 Height, IN UINT32 ResourceId) |
EFI_STATUS | VirtioGpuGetDisplayInfo (IN OUT VGPU_DEV *VgpuDev, volatile VIRTIO_GPU_RESP_DISPLAY_INFO *Response) |
VOID | ReleaseGopResources (IN OUT VGPU_GOP *VgpuGop, IN BOOLEAN DisableHead) |
Variables | |
CONST EFI_GRAPHICS_OUTPUT_PROTOCOL | mGopTemplate |
Internal type and macro definitions for the Virtio GPU hybrid driver.
Copyright (C) 2016, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file VirtioGpu.h.
#define VGPU_GOP_SIG SIGNATURE_64 ('V', 'G', 'P', 'U', '_', 'G', 'O', 'P') |
Definition at line 86 of file VirtioGpu.h.
typedef struct VGPU_GOP_STRUCT VGPU_GOP |
Definition at line 24 of file VirtioGpu.h.
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.
EFI_STATUS VirtioGpuAllocateZeroAndMapBackingStore | ( | IN VGPU_DEV * | VgpuDev, |
IN UINTN | NumberOfPages, | ||
OUT VOID ** | HostAddress, | ||
OUT EFI_PHYSICAL_ADDRESS * | DeviceAddress, | ||
OUT VOID ** | Mapping | ||
) |
Allocate, zero and map memory, for bus master common buffer operation, to be attached as backing store to a host-side VirtIo GPU resource.
[in] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. |
[in] | NumberOfPages | The number of whole pages to allocate and map. |
[out] | HostAddress | The system memory address of the allocated area. |
[out] | DeviceAddress | The bus master device address of the allocated area. The VirtIo GPU device may be programmed to access the allocated area through DeviceAddress; DeviceAddress is to be passed to the VirtioGpuResourceAttachBacking() function, as the BackingStoreDeviceAddress parameter. |
[out] | Mapping | A resulting token to pass to VirtioGpuUnmapAndFreeBackingStore(). |
EFI_SUCCESS | The requested number of pages has been allocated, zeroed and mapped. |
Definition at line 244 of file Commands.c.
EFI_EVENT_NOTIFY function for the VGPU_DEV.ExitBoot event. It resets the VirtIo device, causing it to release its resources and to forget its configuration.
This function may only be called (that is, VGPU_DEV.ExitBoot may only be signaled) after VirtioGpuInit() returns and before VirtioGpuUninit() is called.
[in] | Event | Event whose notification function is being invoked. |
[in] | Context | Pointer to the associated VGPU_DEV object. |
Definition at line 350 of file Commands.c.
EFI_STATUS VirtioGpuGetDisplayInfo | ( | IN OUT VGPU_DEV * | VgpuDev, |
volatile VIRTIO_GPU_RESP_DISPLAY_INFO * | Response | ||
) |
Definition at line 833 of file Commands.c.
EFI_STATUS VirtioGpuInit | ( | IN OUT VGPU_DEV * | VgpuDev | ) |
Configure the VirtIo GPU device that underlies VgpuDev.
[in,out] | VgpuDev | The VGPU_DEV object to set up VirtIo messaging for. On input, the caller is responsible for having initialized VgpuDev->VirtIo. On output, VgpuDev->Ring has been initialized, and synchronous VirtIo GPU commands (primitives) can be submitted to the device. |
EFI_SUCCESS | VirtIo GPU configuration successful. |
EFI_UNSUPPORTED | The host-side configuration of the VirtIo GPU is not supported by this driver. |
Error | codes from underlying functions. |
Definition at line 33 of file Commands.c.
EFI_STATUS VirtioGpuResourceAttachBacking | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId, | ||
IN EFI_PHYSICAL_ADDRESS | BackingStoreDeviceAddress, | ||
IN UINTN | NumberOfPages | ||
) |
Definition at line 675 of file Commands.c.
EFI_STATUS VirtioGpuResourceCreate2d | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId, | ||
IN VIRTIO_GPU_FORMATS | Format, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height | ||
) |
The following functions send requests to the VirtIo GPU device model, await the answer from the host, and return a status. They share the following interface details:
[in,out] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. The caller is responsible to have successfully invoked VirtioGpuInit() on VgpuDev previously, while VirtioGpuUninit() must not have been called on VgpuDev. |
EFI_INVALID_PARAMETER | Invalid command-specific parameters were detected by this driver. |
EFI_SUCCESS | Operation successful. |
EFI_DEVICE_ERROR | The host rejected the request. The host error code has been logged on the DEBUG_ERROR level. |
For the command-specific parameters, please consult the GPU Device section of the VirtIo 1.0 specification (see references in "OvmfPkg/Include/IndustryStandard/VirtioGpu.h").
Definition at line 622 of file Commands.c.
EFI_STATUS VirtioGpuResourceDetachBacking | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId | ||
) |
Definition at line 704 of file Commands.c.
EFI_STATUS VirtioGpuResourceFlush | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | X, | ||
IN UINT32 | Y, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height, | ||
IN UINT32 | ResourceId | ||
) |
Definition at line 801 of file Commands.c.
EFI_STATUS VirtioGpuResourceUnref | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | ResourceId | ||
) |
Definition at line 651 of file Commands.c.
EFI_STATUS VirtioGpuSetScanout | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | X, | ||
IN UINT32 | Y, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height, | ||
IN UINT32 | ScanoutId, | ||
IN UINT32 | ResourceId | ||
) |
Definition at line 734 of file Commands.c.
EFI_STATUS VirtioGpuTransferToHost2d | ( | IN OUT VGPU_DEV * | VgpuDev, |
IN UINT32 | X, | ||
IN UINT32 | Y, | ||
IN UINT32 | Width, | ||
IN UINT32 | Height, | ||
IN UINT64 | Offset, | ||
IN UINT32 | ResourceId | ||
) |
Definition at line 767 of file Commands.c.
De-configure the VirtIo GPU device that underlies VgpuDev.
[in,out] | VgpuDev | The VGPU_DEV object to tear down VirtIo messaging for. On input, the caller is responsible for having called VirtioGpuInit(). On output, VgpuDev->Ring has been uninitialized; VirtIo GPU commands (primitives) can no longer be submitted to the device. |
Definition at line 202 of file Commands.c.
VOID VirtioGpuUnmapAndFreeBackingStore | ( | IN VGPU_DEV * | VgpuDev, |
IN UINTN | NumberOfPages, | ||
IN VOID * | HostAddress, | ||
IN VOID * | Mapping | ||
) |
Unmap and free memory originally allocated and mapped with VirtioGpuAllocateZeroAndMapBackingStore().
If the memory allocated and mapped with VirtioGpuAllocateZeroAndMapBackingStore() was attached to a host-side VirtIo GPU resource with VirtioGpuResourceAttachBacking(), then the caller is responsible for detaching the backing store from the same resource, with VirtioGpuResourceDetachBacking(), before calling this function.
[in] | VgpuDev | The VGPU_DEV object that represents the VirtIo GPU device. |
[in] | NumberOfPages | The NumberOfPages parameter originally passed to VirtioGpuAllocateZeroAndMapBackingStore(). |
[in] | HostAddress | The HostAddress value originally output by VirtioGpuAllocateZeroAndMapBackingStore(). |
[in] | Mapping | The token that was originally output by VirtioGpuAllocateZeroAndMapBackingStore(). |
Definition at line 317 of file Commands.c.
|
extern |