Expand description
This module implements the virtio wayland used by the guest to access the host’s wayland server.
The virtio wayland protocol is done over two queues: in and out. The in queue is used for
sending commands to the guest that are generated by the host, usually messages from the wayland
server. The out queue is for commands from the guest, usually requests to allocate shared
memory, open a wayland server connection, or send data over an existing connection.
Each WlVfd represents one virtual file descriptor created by either the guest or the host.
Virtual file descriptors contain actual file descriptors, either a shared memory file descriptor
or a unix domain socket to the wayland server. In the shared memory case, there is also an
associated slot that indicates which hypervisor memory slot the memory is installed into, as
well as a page frame number that the guest can access the memory from.
The types starting with Ctrl are structures representing the virtio wayland protocol “on the
wire.” They are decoded and executed in the execute function and encoded as some variant of
WlResp for responses.
There is one WlState instance that contains every known vfd and the current state of in
queue. The in queue requires extra state to buffer messages to the guest in case the in
queue is already full. The WlState also has a control socket necessary to fulfill certain
requests, such as those registering guest memory.
The Worker is responsible for the poll loop over all possible events, encoding/decoding from
the virtio queue, and routing messages in and out of WlState. Possible events include the kill
event, available descriptors on the in or out queue, and incoming data on any vfd’s socket.
Structs§
- Ctrl
Header 🔒 - CtrlVfd 🔒
- Ctrl
VfdDmabuf 🔒Sync - Ctrl
VfdNew 🔒 - Ctrl
VfdNew 🔒CtxNamed - Ctrl
VfdNew 🔒Dmabuf - Ctrl
VfdRecv 🔒 - Ctrl
VfdSend 🔒 - Ctrl
VfdSend 🔒Vfd - Ctrl
VfdSend 🔒VfdV2 - Descriptors
Exhausted - GpuMemory
Desc 🔒 - GpuMemory
Plane 🔒Desc - VmRequester 🔒
- VmRequester
State 🔒 - Wl
- WlState
- WlVfd 🔒
- Worker 🔒
- dma_
buf_ 🔒sync - sync_
file_ 🔒info
Enums§
Constants§
- DMA_
BUF_ 🔒IOCTL_ BASE - DMA_
BUF_ IOCTL_ SYNC - Constant ioctl request number.
- DMA_
BUF_ 🔒SYNC_ END - DMA_
BUF_ 🔒SYNC_ WRITE - IN_
BUFFER_ 🔒LEN - NEXT_
VFD_ 🔒ID_ BASE - QUEUE_
SIZE 🔒 - QUEUE_
SIZES 🔒 - SYNC_
IOC_ FILE_ INFO - Constant ioctl request number.
- VFD_
ID_ 🔒HOST_ MASK - VIRTIO_
WL_ 🔒CMD_ VFD_ CLOSE - VIRTIO_
WL_ 🔒CMD_ VFD_ DMABUF_ SYNC - VIRTIO_
WL_ 🔒CMD_ VFD_ HUP - VIRTIO_
WL_ 🔒CMD_ VFD_ NEW - VIRTIO_
WL_ 🔒CMD_ VFD_ NEW_ CTX - VIRTIO_
WL_ 🔒CMD_ VFD_ NEW_ CTX_ NAMED - VIRTIO_
WL_ 🔒CMD_ VFD_ NEW_ DMABUF - VIRTIO_
WL_ 🔒CMD_ VFD_ NEW_ PIPE - VIRTIO_
WL_ 🔒CMD_ VFD_ RECV - VIRTIO_
WL_ 🔒CMD_ VFD_ SEND - VIRTIO_
WL_ 🔒CMD_ VFD_ SEND_ FOREIGN_ ID - VIRTIO_
WL_ 🔒CTRL_ VFD_ SEND_ KIND_ LOCAL - VIRTIO_
WL_ 🔒CTRL_ VFD_ SEND_ KIND_ VIRTGPU - VIRTIO_
WL_ 🔒CTRL_ VFD_ SEND_ KIND_ VIRTGPU_ FENCE - VIRTIO_
WL_ 🔒CTRL_ VFD_ SEND_ KIND_ VIRTGPU_ SIGNALED_ FENCE - VIRTIO_
WL_ 🔒PFN_ SHIFT - VIRTIO_
WL_ 🔒RESP_ ERR - VIRTIO_
WL_ 🔒RESP_ INVALID_ CMD - VIRTIO_
WL_ 🔒RESP_ INVALID_ FLAGS - VIRTIO_
WL_ 🔒RESP_ INVALID_ ID - VIRTIO_
WL_ 🔒RESP_ INVALID_ TYPE - VIRTIO_
WL_ 🔒RESP_ OK - VIRTIO_
WL_ 🔒RESP_ OUT_ OF_ MEMORY - VIRTIO_
WL_ 🔒RESP_ VFD_ NEW - VIRTIO_
WL_ 🔒RESP_ VFD_ NEW_ DMABUF - VIRTIO_
WL_ 🔒VFD_ CONTROL - VIRTIO_
WL_ 🔒VFD_ DMABUF_ SYNC_ VALID_ FLAG_ MASK - VIRTIO_
WL_ 🔒VFD_ FENCE - VIRTIO_
WL_ 🔒VFD_ MAP - VIRTIO_
WL_ 🔒VFD_ READ - VIRTIO_
WL_ 🔒VFD_ WRITE - VIRTWL_
SEND_ 🔒MAX_ ALLOCS - WL_
SHMEM_ ID - WL_
SHMEM_ SIZE
Functions§
- encode_
resp 🔒 - encode_
vfd_ 🔒hup - encode_
vfd_ 🔒new - encode_
vfd_ 🔒new_ dmabuf - encode_
vfd_ 🔒recv - flush_
shared_ 🔒memory - is_
fence 🔒 - process_
in_ queue - Handle incoming events and forward them to the VM over the input queue.
- process_
out_ queue - Handle messages from the output queue and forward them to the display sever, if necessary.
- to_
safe_ 🔒descriptor
Type Aliases§
- WlResult 🔒