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 ¶
- Variables
- func BeginCPURead(fd int) error
- func BeginCPUWrite(fd int) error
- func EndCPURead(fd int) error
- func EndCPUWrite(fd int) error
- func ExportSyncFile(fd int, a Access) (int, error)
- func ImportSyncFile(fd, syncFile int) error
- func Wait(fd int, a Access, timeout time.Duration) error
- type Access
- type Buffer
- type Plane
Constants ¶
This section is empty.
Variables ¶
var ErrNoSyncFileExport = errors.New("dmabuf: the kernel exports no sync_file from a dmabuf")
ErrNoSyncFileExport reports a kernel without DMA_BUF_IOCTL_EXPORT_SYNC_FILE, added in Linux 6.0.
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.
var ErrWaitTimeout = errors.New("dmabuf: the fences did not signal in time")
ErrWaitTimeout reports a Wait whose fences did not signal in time.
Functions ¶
func BeginCPURead ¶
BeginCPURead starts a CPU read through a mapping of the dmabuf fd (DMA_BUF_IOCTL_SYNC): it waits for the devices still writing the buffer. EndCPURead closes the read.
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 ExportSyncFile ¶
ExportSyncFile returns a sync_file, the caller's to close, holding the fences on the dmabuf fd that a use of it for a waits for: its writers' for a Read, every reader's and writer's for a Write. One with no such fence is a sync_file already signalled.
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 Access ¶
type Access uint32
Access is what a user of a dmabuf does with it, for implicit synchronization: a reader waits for the buffer's writers, a writer for its readers and writers.
The accesses, as DMA_BUF_SYNC_READ and DMA_BUF_SYNC_WRITE.
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.