TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtioGpu.h File Reference

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
 

Detailed Description

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.

Macro Definition Documentation

◆ VGPU_GOP_SIG

#define VGPU_GOP_SIG   SIGNATURE_64 ('V', 'G', 'P', 'U', '_', 'G', 'O', 'P')

Definition at line 86 of file VirtioGpu.h.

Typedef Documentation

◆ VGPU_GOP

typedef struct VGPU_GOP_STRUCT VGPU_GOP

Definition at line 24 of file VirtioGpu.h.

Function Documentation

◆ ReleaseGopResources()

VOID ReleaseGopResources ( IN OUT VGPU_GOP VgpuGop,
IN BOOLEAN  DisableHead 
)

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.

Definition at line 40 of file Gop.c.

◆ VirtioGpuAllocateZeroAndMapBackingStore()

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.

Parameters
[in]VgpuDevThe VGPU_DEV object that represents the VirtIo GPU device.
[in]NumberOfPagesThe number of whole pages to allocate and map.
[out]HostAddressThe system memory address of the allocated area.
[out]DeviceAddressThe 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]MappingA resulting token to pass to VirtioGpuUnmapAndFreeBackingStore().
Return values
EFI_SUCCESSThe requested number of pages has been allocated, zeroed and mapped.
Returns
Status codes propagated from VgpuDev->VirtIo->AllocateSharedPages() and VirtioMapAllBytesInSharedBuffer().

Definition at line 244 of file Commands.c.

◆ VirtioGpuExitBoot()

VOID EFIAPI VirtioGpuExitBoot ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

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.

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextPointer to the associated VGPU_DEV object.

Definition at line 350 of file Commands.c.

◆ VirtioGpuGetDisplayInfo()

EFI_STATUS VirtioGpuGetDisplayInfo ( IN OUT VGPU_DEV VgpuDev,
volatile VIRTIO_GPU_RESP_DISPLAY_INFO Response 
)

Definition at line 833 of file Commands.c.

◆ VirtioGpuInit()

EFI_STATUS VirtioGpuInit ( IN OUT VGPU_DEV VgpuDev)

Configure the VirtIo GPU device that underlies VgpuDev.

Parameters
[in,out]VgpuDevThe 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.
Return values
EFI_SUCCESSVirtIo GPU configuration successful.
EFI_UNSUPPORTEDThe host-side configuration of the VirtIo GPU is not supported by this driver.
Errorcodes from underlying functions.

Definition at line 33 of file Commands.c.

◆ VirtioGpuResourceAttachBacking()

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.

◆ VirtioGpuResourceCreate2d()

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:

Parameters
[in,out]VgpuDevThe 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.
Return values
EFI_INVALID_PARAMETERInvalid command-specific parameters were detected by this driver.
EFI_SUCCESSOperation successful.
EFI_DEVICE_ERRORThe host rejected the request. The host error code has been logged on the DEBUG_ERROR level.
Returns
Codes for unexpected errors in VirtIo messaging.

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.

◆ VirtioGpuResourceDetachBacking()

EFI_STATUS VirtioGpuResourceDetachBacking ( IN OUT VGPU_DEV VgpuDev,
IN UINT32  ResourceId 
)

Definition at line 704 of file Commands.c.

◆ VirtioGpuResourceFlush()

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.

◆ VirtioGpuResourceUnref()

EFI_STATUS VirtioGpuResourceUnref ( IN OUT VGPU_DEV VgpuDev,
IN UINT32  ResourceId 
)

Definition at line 651 of file Commands.c.

◆ VirtioGpuSetScanout()

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.

◆ VirtioGpuTransferToHost2d()

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.

◆ VirtioGpuUninit()

VOID VirtioGpuUninit ( IN OUT VGPU_DEV VgpuDev)

De-configure the VirtIo GPU device that underlies VgpuDev.

Parameters
[in,out]VgpuDevThe 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.

◆ VirtioGpuUnmapAndFreeBackingStore()

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.

Parameters
[in]VgpuDevThe VGPU_DEV object that represents the VirtIo GPU device.
[in]NumberOfPagesThe NumberOfPages parameter originally passed to VirtioGpuAllocateZeroAndMapBackingStore().
[in]HostAddressThe HostAddress value originally output by VirtioGpuAllocateZeroAndMapBackingStore().
[in]MappingThe token that was originally output by VirtioGpuAllocateZeroAndMapBackingStore().

Definition at line 317 of file Commands.c.

Variable Documentation

◆ mGopTemplate

CONST EFI_GRAPHICS_OUTPUT_PROTOCOL mGopTemplate
extern

Definition at line 770 of file Gop.c.