buffers

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package buffers models Wayland/Vulkan buffer ownership without GPU dependencies. The caller serializes events from the renderer, the Wayland dispatch loop, and DRM.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBuffer = errors.New("no available buffer")
View Source
var ErrTransition = errors.New("invalid buffer transition")

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	ID, Generation             uint64
	State                      State
	AcquirePoint, ReleasePoint uint64
	WlReleased, PointSignaled  bool
}

Buffer is an immutable identity and mutable ownership record. On an explicit sync surface wl_buffer.release is optional; only the latest release point of this buffer's own timeline authorizes reuse.

type Pool

type Pool struct {
	Generation uint64
	NextPoint  uint64
	Buffers    []*Buffer
}

func New

func New(count int) (*Pool, error)

func (*Pool) Acquire

func (p *Pool) Acquire(b *Buffer) (uint64, error)

func (*Pool) Begin

func (p *Pool) Begin() (*Buffer, error)

Begin skips rendering when every buffer is busy. Retired generations are never selected, even if their release events complete later.

func (*Pool) Commit

func (p *Pool) Commit(b *Buffer) (uint64, error)

func (*Pool) Own

func (p *Pool) Own(b *Buffer) error

func (*Pool) Release

func (p *Pool) Release(b *Buffer) error

Release records an optional wl_buffer.release event. It never authorizes reuse, and a late event from a prior commit must not modify the new commit.

func (*Pool) Remove

func (p *Pool) Remove(b *Buffer) error

func (*Pool) Resize

func (p *Pool) Resize(count int) error

Resize installs an entirely new generation. Old images remain tracked until their latest release point signals; even Available old images are retired.

func (*Pool) Retirable

func (p *Pool) Retirable(b *Buffer) bool

Retirable reports when the compositor and GPU no longer own a retired image. An abandoned Rendering or Acquired image still needs the caller to finish or wait for its Vulkan submission before destroying the GPU allocation.

func (*Pool) Reuse

func (p *Pool) Reuse(b *Buffer, gpuWaitInstalled bool) error

Reuse requires the caller to have arranged a GPU wait on the exported release-point sync_file before submitting new writes to this image.

func (*Pool) Signal

func (p *Pool) Signal(b *Buffer, point uint64) error

type State

type State string
const (
	Available       State = "available"
	Rendering       State = "rendering"
	Acquired        State = "acquire_exported"
	Committed       State = "committed"
	CompositorOwned State = "compositor_owned"
	Released        State = "release_point_signaled"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL