session

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package session is the Wayland-free presentation core: Vulkan rendering into DMA-BUF buffers, DRM syncobj timelines and buffer ownership.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Output added in v0.5.0

type Output struct {
	Buffer       uint64
	NewBuffer    bool // import Planes as a new wl_buffer
	Retired      []Retired
	Width        int32
	Height       int32
	FourCC       uint32
	Modifier     uint64
	Planes       [4]Plane
	PlaneCount   int
	Acquire      Timeline // ID 0; FD always valid (persistent)
	Release      Timeline // ID is the buffer; FD valid only with NewTimelines
	NewTimelines bool
	AcquirePoint uint64
	ReleasePoint uint64
	ReleaseFD    int // eventfd readable when ReleasePoint signals; stable per buffer
}

Output describes one presented frame in physical pixels. Slices are reused; they are valid until the next Draw.

type Plane added in v0.5.0

type Plane struct {
	FD     int
	Offset uint32
	Stride uint32
}

Plane is one DMA-BUF plane. FD stays owned by the Target.

type Retired added in v0.5.0

type Retired struct {
	Buffer    uint64
	ReleaseFD int
}

Retired names a buffer the transport must stop watching and destroy before the next Draw. ReleaseFD closes at that Draw.

type Slot

type Slot struct {
	Buffer       *buffers.Buffer
	Image        *vkdevice.Image
	Frame        *vkdevice.Frame
	First        bool
	Wait         *vkdevice.BinaryFence
	PendingWait  *vkdevice.BinaryFence
	WaitInFlight bool

	ReleaseHandle uint32
	ReleaseFD     int  // eventfd armed on each commit's release point
	ReleaseExport int  // exported syncobj fd of the release timeline
	Presented     bool // the caller has been told to import this buffer
	// contains filtered or unexported fields
}

Slot is the GPU side of one pool buffer. Descriptors are -1 when unset.

type Target added in v0.5.0

type Target struct {
	Device   *vkdevice.Device
	Node     *syncobj.Node
	Pool     *buffers.Pool
	Preparer *render.Preparer
	Slots    map[uint64]*Slot
	// contains filtered or unexported fields
}

Target is the Wayland-free presentation core: it renders prepared frames into DMA-BUF images, tracks buffer ownership with explicit-sync timelines and reports release through per-buffer eventfds. It starts no goroutines and is used from one owner goroutine.

func NewTarget added in v0.5.0

func NewTarget(cfg TargetConfig) (_ *Target, err error)

NewTarget opens the GPU and the render node. It allocates no images.

func (*Target) Close added in v0.5.0

func (t *Target) Close() error

Close waits for the GPU, then frees every descriptor and image, always completing the teardown. The compositor's imports keep their own kernel references. It returns the joined errors of the steps that failed and any Vulkan validation errors recorded during the Target's life.

func (*Target) Draw added in v0.5.0

func (t *Target) Draw(display []layout.Command, scale float64, out *Output) (bool, error)

Draw prepares and presents one frame. It returns false, touching no GPU state, when no image is ready; the caller retries after Released, or after a short delay while Waiting reports GPU progress is needed.

func (*Target) EnableReadback added in v0.5.0

func (t *Target) EnableReadback()

EnableReadback makes later images capture their output for Readback. Tests only.

func (*Target) Readback added in v0.5.0

func (t *Target) Readback(id uint64) (*image.NRGBA, error)

Readback returns the last drawn pixels of a buffer in RGBA order. Tests only; call EnableReadback before the first Draw.

func (*Target) Released added in v0.5.0

func (t *Target) Released(id uint64) error

Released handles a readable release eventfd of the buffer: the compositor signaled its latest release point, so the image may be reused once the GPU wait is installed.

func (*Target) Resize added in v0.5.0

func (t *Target) Resize(width, height int32)

Resize sets the physical surface size; images follow lazily at the next Draw.

func (*Target) Size added in v0.5.0

func (t *Target) Size() (int32, int32)

Size reports the physical size of the current image generation.

func (*Target) Waiting added in v0.5.0

func (t *Target) Waiting() bool

Waiting reports that the last Draw found a frame blocked only on GPU progress (an image still being drawn, or a release wait not yet installed), which no event announces: the caller should retry after a short delay. It is false when every image is owned by the compositor; Released unblocks that.

type TargetConfig added in v0.5.0

type TargetConfig struct {
	MainDevice  uint64
	Formats     []vkdevice.Format
	Transparent bool
}

TargetConfig selects the GPU and the compositor-acceptable formats.

type Timeline added in v0.5.0

type Timeline struct {
	ID uint64
	FD int
}

Timeline is a DRM syncobj timeline the transport must import. FD stays owned by the Target and is valid only when the Output says the timeline is new.

Jump to

Keyboard shortcuts

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