backend

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT, MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package backend abstracts outputs and input devices so the compositor runs headless, nested or on DRM.

Index

Constants

View Source
const EmptyFramesPerRefresh = 2
View Source
const MaxOverlayPlanes = 3
View Source
const (
	PlaneLead = 2 * time.Millisecond
)
View Source
const SustainedFor = time.Second

Variables

View Source
var (
	ErrDeviceLost = errors.New("backend: the device is gone")
	ErrBroken     = errors.New("backend: broken invariant")
)
View Source
var ErrCursorReadback = errors.New("backend: drawing this cursor image on the plane would read it back from the GPU synchronously")
View Source
var ErrDepthUnsupported = errors.New("backend: the output cannot show frames at this bit depth")
View Source
var ErrHDRUnsupported = errors.New("backend: the output cannot carry an HDR signal")
View Source
var ErrNoCursorPlanes = errors.New("backend: this backend draws the cursor in the frame")
View Source
var Identity = Matrix{1, 0, 0, 0, 1, 0, 0, 0, 1}

Functions

func AdaptiveSyncCapable

func AdaptiveSyncCapable(o Output) bool

func Broken

func Broken(format string, args ...any) error

func Displays

func Displays(o Output) bool

func Fatal

func Fatal(err error) bool

func GPULost

func GPULost(err error) bool

func NextVblank

func NextVblank(last, now, interval time.Duration) (at time.Duration, ticks uint64)

func PlaneLatch

func PlaneLatch(last, now, interval time.Duration) time.Duration

Types

type AdaptiveSync

type AdaptiveSync interface {
	AdaptiveSyncCapable() bool
	AdaptiveSync() bool
	SetAdaptiveSync(on bool) error
}

type AxisSource

type AxisSource uint8
const (
	Wheel AxisSource = iota
	Finger
	Continuous
	WheelTilt
)

type Backend

type Backend interface {
	Start(h Handler) error
	Renderer() render.Renderer
	Close() error
}

type BitDepth

type BitDepth uint8
const (
	Depth8 BitDepth = iota
	Depth10
)

type Capability

type Capability uint8
const (
	Keyboard Capability = 1 << iota
	Pointer
	Touch
)

func (Capability) Has

func (c Capability) Has(flag Capability) bool

type ColorTransform

type ColorTransform interface {
	HasColorTransform() bool
	SetColorTransform(m Matrix) error
}

type Commits

type Commits struct {
	// contains filtered or unexported fields
}

func (*Commits) Failed

func (c *Commits) Failed(name string, now time.Duration, cause error) (stall error)

func (*Commits) Stalled

func (c *Commits) Stalled() bool

func (*Commits) Took

func (c *Commits) Took(name string, now time.Duration) (recovery error)

type ContentTyped

type ContentTyped interface {
	SetContentType(t wm.ContentType)
}

type CursorPlane

type CursorPlane interface {
	CursorSize() image.Point
	BeginCursor() (Frame, error)
	SetCursor(hotspot image.Point) error
	LoadCursor(pix []byte, stride int, size, hotspot image.Point) error
	MoveCursor(at image.Point) error
	HideCursor() error
}

type Degamma

type Degamma interface {
	DegammaSize() int
	SetDegamma(ramps []uint16) error
}

type Device

type Device interface {
	Name() string
	Capabilities() Capability
}

type Event

type Event interface {
	Timestamp() time.Duration
}

type Frame

type Frame struct {
	Renderer render.Renderer
	Target   render.Target
	Age      int
}

type FrameClock

type FrameClock struct {
	// contains filtered or unexported fields
}

func NewFrameClock

func NewFrameClock(idle func(func() error), ready func() bool, frame func() error, latch *Latch) *FrameClock

func (*FrameClock) Cancel

func (f *FrameClock) Cancel()

func (*FrameClock) Kick

func (f *FrameClock) Kick() error

func (*FrameClock) Queued

func (f *FrameClock) Queued() bool

func (*FrameClock) Request

func (f *FrameClock) Request() error

func (*FrameClock) Requested

func (f *FrameClock) Requested() bool

func (*FrameClock) Waiting

func (f *FrameClock) Waiting() bool

func (*FrameClock) Woke

func (f *FrameClock) Woke() error

type FrameFilling

type FrameFilling interface {
	FillFrame(filled bool)
}

type FrameRateCap

type FrameRateCap interface {
	CapFrameRate(hz int)
}

type FrameTearing

type FrameTearing interface {
	TearFrame(tear bool)
}

type Gamma

type Gamma interface {
	GammaSize() int
	SetGamma(ramps []uint16) error
}

type Gesture

type Gesture uint8
const (
	Swipe Gesture = iota + 1
	Pinch
	Hold
)

type GestureBegin

type GestureBegin struct {
	Time    time.Duration
	Gesture Gesture
	Fingers uint32
}

func (GestureBegin) Timestamp

func (e GestureBegin) Timestamp() time.Duration

type GestureEnd

type GestureEnd struct {
	Time      time.Duration
	Gesture   Gesture
	Cancelled bool
}

func (GestureEnd) Timestamp

func (e GestureEnd) Timestamp() time.Duration

type HDRDisplay

type HDRDisplay interface {
	HDRCapabilities() (edid.HDR, error)
}

type HDRMetadata

type HDRMetadata struct {
	Active                  bool
	Red, Green, Blue, White edid.Chromaticity
	MaxLuminance            float64
	MinLuminance            float64
	MaxCLL                  float64
	MaxFALL                 float64
}

type Handler

type Handler interface {
	OutputAdded(o Output) error
	OutputRemoved(o Output) error
	OutputChanged(o Output) error
	OutputDamaged(o Output) error
	Frame(o Output) error
	Presented(o Output, p Presentation) error
	DeviceAdded(d Device) error
	DeviceRemoved(d Device) error
	Input(d Device, e Event) error
}

type Inheriting

type Inheriting interface {
	Inherited() bool
}

type Key

type Key struct {
	Time    time.Duration
	Code    uint32
	Pressed bool
}

func (Key) Timestamp

func (e Key) Timestamp() time.Duration

type KeyboardLEDs

type KeyboardLEDs interface {
	SetLEDs(l xkb.Locks)
}

type Latch

type Latch struct {
	Wait func() time.Duration
	Wake func(after time.Duration) error
}

type Matrix

type Matrix [9]float64

type Mode

type Mode struct {
	Size       image.Point
	RefreshMHz int32
	Preferred  bool
}

func (Mode) Interval

func (m Mode) Interval() time.Duration

func (Mode) PacedInterval

func (m Mode) PacedInterval(capHz int, variable bool) time.Duration

func (Mode) Valid

func (m Mode) Valid() error

type Orientation

type Orientation uint8
const (
	Vertical Orientation = iota
	Horizontal
)

type Output

type Output interface {
	Name() string
	Description() string
	Identity() edid.Info
	PhysicalSize() image.Point
	Modes() []Mode
	State() OutputState
	Commit(s OutputState) error
	ScheduleFrame() error
	BeginFrame() (Frame, error)
	AbortFrame()
	Present(damage render.Region) error
	CursorPlane() (CursorPlane, error)
}

type OutputState

type OutputState struct {
	Power Power
	Mode  Mode
	Depth BitDepth
	HDR   HDRMetadata
}

func (OutputState) Enabled

func (s OutputState) Enabled() bool

func (OutputState) Lit

func (s OutputState) Lit() bool

type Overlay

type Overlay struct {
	Key     ScanoutKey
	Buffer  gpu.DMABUF
	At      Placement
	Release func() error
}

type OverlayFlip

type OverlayFlip uint8
const (
	OverlaysNotFlipped OverlayFlip = iota
	OverlaysFlipped
	OverlaysRefused
)

type OverlayPlanes

type OverlayPlanes interface {
	OverlayPlanes() int
	OverlayTarget() gpu.ScanoutTarget
	TestOverlays(layers []Overlay) uint
	SetOverlays(layers []Overlay) error
	FlipOverlays() (OverlayFlip, error)
}

type Pacing

type Pacing struct {
	Vblank   time.Duration
	Shown    time.Duration
	Refresh  time.Duration
	Paced    time.Duration
	Variable bool
}

func (Pacing) Aim

func (p Pacing) Aim(now time.Duration) time.Duration

func (Pacing) Anchored

func (p Pacing) Anchored(now time.Duration) bool

type PinchUpdate

type PinchUpdate struct {
	Time     time.Duration
	DX, DY   float64
	Scale    float64
	Rotation float64
}

func (*PinchUpdate) Timestamp

func (e *PinchUpdate) Timestamp() time.Duration

type Placement

type Placement struct {
	Src render.FRect
	Dst image.Rectangle
}

func Whole

func Whole(size image.Point) Placement

func (Placement) Valid

func (p Placement) Valid(buffer, output image.Point) bool

type PointerAxis

type PointerAxis struct {
	Time        time.Duration
	Orientation Orientation
	Source      AxisSource
	Value       float64
	Value120    int32
}

func (PointerAxis) Timestamp

func (e PointerAxis) Timestamp() time.Duration

type PointerButton

type PointerButton struct {
	Time    time.Duration
	Button  uint32
	Pressed bool
}

func (PointerButton) Timestamp

func (e PointerButton) Timestamp() time.Duration

type PointerFrame

type PointerFrame struct {
	Time time.Duration
}

func (*PointerFrame) Timestamp

func (e *PointerFrame) Timestamp() time.Duration

type PointerMotion

type PointerMotion struct {
	Time                 time.Duration
	DX, DY               float64
	UnaccelDX, UnaccelDY float64
}

func (*PointerMotion) Timestamp

func (e *PointerMotion) Timestamp() time.Duration

type PointerMotionAbsolute

type PointerMotionAbsolute struct {
	Time   time.Duration
	Output Output
	X, Y   float64
}

func (PointerMotionAbsolute) Timestamp

func (e PointerMotionAbsolute) Timestamp() time.Duration

type Power

type Power uint8
const (
	Disabled Power = iota
	PoweredOn
	PoweredOff
)

type Presentation

type Presentation struct {
	Time     time.Duration
	Refresh  time.Duration
	Seq      uint64
	Torn     bool
	Idle     bool
	Hardware bool
	Variable bool
}

type RenderBudget

type RenderBudget struct {
	// contains filtered or unexported fields
}

func (*RenderBudget) Budget

func (b *RenderBudget) Budget(interval time.Duration) time.Duration

func (*RenderBudget) Deadline

func (b *RenderBudget) Deadline(p Pacing, now time.Duration) time.Duration

func (*RenderBudget) Expect

func (b *RenderBudget) Expect(pixels int)

func (*RenderBudget) Latch

func (b *RenderBudget) Latch(p Pacing, now time.Duration) time.Duration

func (*RenderBudget) Missed

func (b *RenderBudget) Missed(interval time.Duration)

func (*RenderBudget) Overruns

func (b *RenderBudget) Overruns(interval time.Duration) bool

func (*RenderBudget) Painted

func (b *RenderBudget) Painted(pixels int)

func (*RenderBudget) Sample

func (b *RenderBudget) Sample(took time.Duration)

func (*RenderBudget) Started

func (b *RenderBudget) Started()

type Scanner

type Scanner interface {
	Scanout(key ScanoutKey, d gpu.DMABUF, at Placement, release func() error, tear bool) (bool, error)
	ForgetScanout(key ScanoutKey) error
	ScanoutFormats() gpu.ScanoutTarget
}

type ScanoutKey

type ScanoutKey interface {
	DMABUF() gpu.DMABUF
}

type Stalling

type Stalling interface {
	Stalled() bool
}

type SwipeUpdate

type SwipeUpdate struct {
	Time                 time.Duration
	DX, DY               float64
	UnaccelDX, UnaccelDY float64
}

func (*SwipeUpdate) Timestamp

func (e *SwipeUpdate) Timestamp() time.Duration

type Switch

type Switch struct {
	Time time.Duration
	Kind SwitchKind
	On   bool
}

func (Switch) Timestamp

func (e Switch) Timestamp() time.Duration

type SwitchKind

type SwitchKind uint8
const (
	SwitchLid SwitchKind = iota + 1
	SwitchTabletMode
)

type TouchCancel

type TouchCancel struct {
	Time time.Duration
	ID   int32
}

func (TouchCancel) Timestamp

func (e TouchCancel) Timestamp() time.Duration

type TouchDown

type TouchDown struct {
	Time   time.Duration
	ID     int32
	Output Output
	X, Y   float64
}

func (TouchDown) Timestamp

func (e TouchDown) Timestamp() time.Duration

type TouchFrame

type TouchFrame struct {
	Time time.Duration
}

func (TouchFrame) Timestamp

func (e TouchFrame) Timestamp() time.Duration

type TouchMotion

type TouchMotion struct {
	Time time.Duration
	ID   int32
	X, Y float64
}

func (TouchMotion) Timestamp

func (e TouchMotion) Timestamp() time.Duration

type TouchUp

type TouchUp struct {
	Time time.Duration
	ID   int32
}

func (TouchUp) Timestamp

func (e TouchUp) Timestamp() time.Duration

type WorkHinter

type WorkHinter interface {
	ExpectFrameWork(pixels int)
}

Directories

Path Synopsis
Package drm is the native backend: one DRM device driven with atomic KMS, scanning out buffers the Vulkan renderer exports or GBM allocates for GLES.
Package drm is the native backend: one DRM device driven with atomic KMS, scanning out buffers the Vulkan renderer exports or GBM allocates for GLES.
Package headless is a backend with virtual outputs rendered in software and synthetic input devices, for tests and the compositor-in-the-loop harness.
Package headless is a backend with virtual outputs rendered in software and synthetic input devices, for tests and the compositor-in-the-loop harness.
Package nested runs lys-wm as a client of a host Wayland compositor: each output is a host window and the host seat is lys-wm's input.
Package nested runs lys-wm as a client of a host Wayland compositor: each output is a host window and the host seat is lys-wm's input.
Package virtual is an output that exists only in memory: whatever backend runs the session, it renders offscreen with the session's renderer, paced by its own frame clock at its mode's refresh rate, and never presents.
Package virtual is an output that exists only in memory: whatever backend runs the session, it renders offscreen with the session's renderer, paced by its own frame clock at its mode's refresh rate, and never presents.

Jump to

Keyboard shortcuts

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