Documentation
¶
Overview ¶
Package session coordinates Wayland ownership, Vulkan submissions, DRM release points and the application frame loop behind nefergui.Run.
Index ¶
- type AppHooks
- type Pump
- type Session
- func (s *Session) Close() (err error)
- func (s *Session) NewPump(ctx context.Context, wake chan<- struct{}, ...) (*Pump, error)
- func (s *Session) Run(ctx context.Context, frames int, draw func(int) vkdevice.Rect) (int, error)
- func (s *Session) RunApp(ctx context.Context, app AppHooks) error
- func (s *Session) RunListWithCommit(ctx context.Context, frames int, draw func(int) []vkdevice.Instance, ...) (int, error)
- func (s *Session) RunPreparedListWithCommit(ctx context.Context, frames int, draw func(int) (render.Frame, error), ...) (int, error)
- func (s *Session) RunWithCommit(ctx context.Context, frames int, draw func(int) vkdevice.Rect, ...) (int, error)
- func (s *Session) Tick(rect vkdevice.Rect) (bool, error)
- func (s *Session) TickList(instances []vkdevice.Instance, uploads []text.Upload) (bool, error)
- type Slot
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 Pump ¶ added in v0.3.0
type Pump struct {
// contains filtered or unexported fields
}
Pump drives one Session from an owner loop that multiplexes several sessions on a shared Connection. It never reads Wayland events itself: the owner applies them and forwards BufferRelease. All methods run on the owner loop.
func (*Pump) BufferReleased ¶ added in v0.3.0
BufferReleased returns a compositor-released wl_buffer to the pool.
func (*Pump) Close ¶ added in v0.3.0
func (p *Pump) Close()
Close stops release waiters. Call before Session.Close.
func (*Pump) Invalidate ¶ added in v0.3.0
func (p *Pump) Invalidate()
Invalidate requests a fresh draw at the next Step.
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 OpenWindow ¶ added in v0.3.0
OpenWindow builds the Vulkan/DMA-BUF/explicit-sync path for a window that is already configured and has completed dmabuf feedback (a Connection sibling). On error the window is closed. The session owns w from here on.
func OpenWithOptions ¶ added in v0.2.0
func OpenWithOptions(ctx context.Context, name string, width, height int32, transparent bool, opts wayland.SurfaceOptions) (_ *Session, err error)
OpenWithOptions opens a session whose surface role and initial input region are selected by opts; the zero value is identical to Open. Wayland startup is abandoned when ctx is cancelled; ctx is not retained after it returns.
func (*Session) Close ¶
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) NewPump ¶ added in v0.3.0
func (s *Session) NewPump(ctx context.Context, wake chan<- struct{}, draw func() (render.Frame, bool, error)) (*Pump, error)
NewPump prepares s for a shared owner loop. wake is pinged (never blocked on) when a GPU release point is ready; the owner then calls Step. draw follows the AppHooks.Draw contract.
func (*Session) RunApp ¶
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.
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
}