Documentation
¶
Overview ¶
Package session is the Wayland-free presentation core: Vulkan rendering into DMA-BUF buffers, DRM syncobj timelines and buffer ownership.
Index ¶
- type Output
- type Plane
- type Retired
- type Slot
- type Target
- func (t *Target) Close() error
- func (t *Target) Draw(display []layout.Command, scale float64, out *Output) (bool, error)
- func (t *Target) EnableReadback()
- func (t *Target) Readback(id uint64) (*image.NRGBA, error)
- func (t *Target) Released(id uint64) error
- func (t *Target) Resize(width, height int32)
- func (t *Target) Size() (int32, int32)
- func (t *Target) Waiting() bool
- type TargetConfig
- type Timeline
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 Retired ¶ added in v0.5.0
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
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
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
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
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
Resize sets the physical surface size; images follow lazily at the next Draw.
func (*Target) Size ¶ added in v0.5.0
Size reports the physical size of the current image generation.
func (*Target) Waiting ¶ added in v0.5.0
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
TargetConfig selects the GPU and the compositor-acceptable formats.