session

package
v0.1.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: 20 Imported by: 0

Documentation

Overview

Package session coordinates Wayland ownership, Vulkan submissions, DRM release points and the application frame loop behind nefergui.Run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppHooks

type AppHooks struct {
	Wake      <-chan struct{}
	Input     func([]wayland.Input) error
	Event     func(wayland.Event) error
	Draw      func() (render.Frame, bool, error)
	Committed func(uint64) error
}

AppHooks runs entirely on the session owner loop. Draw returns dirty=false when there is no new display list; the session retries a dirty frame until committed without waiting for GPU completion on the loop.

type Session

type Session struct {
	Window       *wayland.Window
	Device       *vkdevice.Device
	Node         *syncobj.Node
	Pool         *buffers.Pool
	Pipeline     *vkdevice.Pipeline
	ListPipeline *vkdevice.Pipeline
	Preparer     *render.Preparer

	Slots map[uint64]*Slot

	Acquire         uint32
	AcquireTimeline *drmsyncobj.WpLinuxDrmSyncobjTimeline
	Width, Height   int32
	Transparent     bool
	// contains filtered or unexported fields
}

func Open

func Open(name string, width, height int32, transparent bool) (_ *Session, err error)

func (*Session) Close

func (s *Session) Close() (err error)

Close detaches and destroys the explicit-sync surface, traces release points for at most 200 ms, waits for our GPU, then frees every client allocation. Compositor imports keep independent DMA-BUF kernel references. It returns errors from writing requested debug artifacts; allocations are freed regardless.

func (*Session) Run

func (s *Session) Run(ctx context.Context, frames int, draw func(int) vkdevice.Rect) (int, error)

func (*Session) RunApp

func (s *Session) RunApp(ctx context.Context, app AppHooks) error

RunApp drives a UI until close or cancellation. Wayland input is batched after Apply, and wake tokens, repeat deadlines and release points share one select.

func (*Session) RunListWithCommit

func (s *Session) RunListWithCommit(ctx context.Context, frames int, draw func(int) []vkdevice.Instance, committed func(int) error) (int, error)

RunListWithCommit drives the list renderer using the existing frame loop.

func (*Session) RunPreparedListWithCommit

func (s *Session) RunPreparedListWithCommit(ctx context.Context, frames int, draw func(int) (render.Frame, error), committed func(int) error) (int, error)

RunPreparedListWithCommit prepares uploads on every attempt. Preparer keeps them owed until a submission, so a skipped attempt is resent by the next one.

func (*Session) RunWithCommit

func (s *Session) RunWithCommit(ctx context.Context, frames int, draw func(int) vkdevice.Rect, committed func(int) error) (int, error)

RunWithCommit calls committed after each successfully committed frame. The optional hook is for the example's capture request; it never gates reuse.

func (*Session) Tick

func (s *Session) Tick(rect vkdevice.Rect) (bool, error)

Tick presents at most one frame. The caller drives the Wayland dispatch loop; a frame callback only schedules Tick, never makes an image reusable.

func (*Session) TickList

func (s *Session) TickList(instances []vkdevice.Instance, uploads []text.Upload) (bool, error)

TickList presents ordered instanced quads with the same ownership gates as Tick.

type Slot

type Slot struct {
	Buffer          *buffers.Buffer
	Image           *vkdevice.Image
	Frame           *vkdevice.Frame
	First           bool
	Wait            *vkdevice.BinaryFence
	PendingWait     *vkdevice.BinaryFence
	WaitInFlight    bool
	ReadbackFrame   uint64
	ReadbackPending bool
	ReleaseHandle   uint32
	ReleaseTimeline *drmsyncobj.WpLinuxDrmSyncobjTimeline
}

Jump to

Keyboard shortcuts

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