Documentation
¶
Overview ¶
Package dmabuf describes Linux dma-buf frames: GPU (or udmabuf) memory handed to the compositor by file descriptor through zwp_linux_dmabuf_v1, with no copy. capture fills them with screen contents; widget.GPUArea presents them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoSyncFileImport = errors.New("dmabuf: the kernel attaches no sync_file to a dmabuf")
ErrNoSyncFileImport reports a kernel without DMA_BUF_IOCTL_IMPORT_SYNC_FILE, added in Linux 6.0.
Functions ¶
func BeginCPUWrite ¶
BeginCPUWrite starts a CPU write through a mapping of the dmabuf fd (DMA_BUF_IOCTL_SYNC): it waits for the devices still reading the buffer and, on a system whose caches do not snoop, readies the mapping. EndCPUWrite closes the write.
func EndCPUWrite ¶
EndCPUWrite ends a CPU write BeginCPUWrite started, flushing it for the device that reads the buffer next.
func ImportSyncFile ¶
ImportSyncFile attaches the fence in syncFile to the dmabuf fd as its writer's: whoever uses the dmabuf with implicit synchronization (a compositor, a display) waits for it. syncFile stays the caller's.
Types ¶
type Buffer ¶
type Buffer struct {
Width, Height int
Format fourcc.Format
Modifier fourcc.Modifier
Planes []Plane
}
Buffer describes a dmabuf. The caller allocates it (gbm, a DRM dumb buffer, udmabuf) and keeps the plane fds open for as long as the compositor-side buffer lives; importing dups nothing. The planes must be the ones Format calls for.