Documentation
¶
Overview ¶
Package pixelpool is the buffers of one window that a CPU renderer draws into: the part of the Wayland and X11 backends that hands a buffer out only when the display server no longer reads it, and says how old its content is (SPEC §9.6; steps 32.1 and 32.2).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer interface {
// Pixels is the memory of the buffer.
Pixels() []byte
// Free gives the buffer back; it is safe to call twice.
Free()
}
Buffer is the memory of one buffer of a pool: a wl_shm buffer on Wayland, a shared-memory image on X11.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is the buffers of one window that a CPU renderer draws into (SPEC §9.6): one is never handed out while the server reads it, and each remembers which frame it holds, so that the renderer can redraw only what changed since (buffer age). Only the UI thread uses it.
func (*Pool) Acquire ¶
Acquire returns a buffer of the size that the server does not read, and its age: 0 for one that holds no frame, n for the frame of n presentations ago. Of the idle buffers it takes the one that was written last, which has the smallest age. When every buffer is busy a new one is made, up to maxBuffers; it fails with ShmPoolExhausted after that, and with the error of make when the memory cannot be made.
type Slot ¶
type Slot struct {
// Buf is the buffer.
Buf Buffer
// Width and Height are its size in pixels.
Width, Height int
// contains filtered or unexported fields
}
Slot is a buffer of a Pool and what is known of it.
func (*Slot) Released ¶
func (s *Slot) Released()
Released is the server's word that it no longer reads the buffer (wl_buffer.release, the completion event of MIT-SHM). An idle buffer of a size that is no longer asked for, or that is more than the pool keeps, is freed; the pool being closed frees all.