devices.go RawHistoryFolder

1package ports
2
3import (
4	"errors"
5	"fmt"
6	"image"
7	"os"
8	"time"
9)
10
11// MaxCaptureInflight bounds the capture requests admitted but not yet
12// answered, across outputs. The reply channel of the production app has
13// at least this capacity, so an output never blocks on a reply.
14const MaxCaptureInflight = 32
15
16// ErrCaptureTransient marks a capture failure that may clear on its own (the
17// renderer busy, the indicator or an exclusion not shown yet): a protocol
18// frame tries again shortly instead of failing. Test with errors.Is.
19var ErrCaptureTransient = errors.New("capture: transient")
20
21// ErrCaptureBusy: every capture slot of the renderer is leased.
22var ErrCaptureBusy = fmt.Errorf("%w: no free slot", ErrCaptureTransient)
23
24// CaptureFrame is a lease on one renderer readback slot holding a GPU
25// copy of a rendered frame. Done and Read make no Vulkan call: a worker
26// goroutine waits on Done, then reads. EndCapture returns the lease.
27type CaptureFrame interface {
28	// Done is the sync file signalled when the copy finished; nil means it
29	// had finished when BeginCapture returned. The frame owns it.
30	Done() *os.File
31	// Read copies region (output pixels) as opaque sRGB8 BGRA rows into
32	// dst, stride bytes per row. Valid after Done signalled and before
33	// EndCapture.
34	Read(region image.Rectangle, dst []byte, stride int) error
35}
36
37// Renderer draws scenes for an output. One goroutine owns it. Frames go
38// to its own image until ExportTargets gives it scanout images; then each
39// Render draws into the target chosen by UseTarget (ADR 014: no CPU pass).
40type Renderer interface {
41	// SetHDR selects the HDR10 output transform (0 disables it).
42	// The DRM output calls this before ExportTargets.
43	SetHDR(sdrNits float64)
44	// Render draws the scene. done is a sync file signalled when the GPU
45	// finished the frame (nil: already finished); the caller closes it.
46	Render(Scene, map[WindowID]SurfaceContent) (done *os.File, err error)
47	// ExportTargets allocates n images of the renderer's size that the
48	// display can scan out, with one of the given XRGB8888 (SDR) or
49	// XRGB2101010 (HDR) modifiers (none: any the device exports),
50	// and returns them as dmabufs.
51	// n = 0 drops the targets.
52	ExportTargets(n int, modifiers []uint64) ([]DMABuf, error)
53	// UseTarget selects the exported image the next Render draws into.
54	UseTarget(i int)
55	// CursorBuffers allocates two linear ARGB8888 images of size×size the
56	// display can show on its cursor plane, and returns them as dmabufs.
57	CursorBuffers(size int) ([2]DMABuf, error)
58	// WriteCursor fills cursor image i with premultiplied ARGB8888 pixels
59	// (w×h, w*4 per row), cropped to the image and cleared around it.
60	WriteCursor(i int, pixels []byte, w, h int) error
61	// Pixels reads the last frame back (headless screenshots, tests). It
62	// waits for the GPU: debug only. Nil when it cannot (every capture
63	// slot leased, or the copy failed).
64	Pixels() *image.RGBA
65	// BeginCapture submits a GPU copy of the last rendered frame into a
66	// free slot and returns without waiting. ErrCaptureBusy when every
67	// slot is leased; another error when the copy cannot be tracked (no
68	// sync file): the caller fails the request.
69	BeginCapture() (CaptureFrame, error)
70	// EndCapture returns a lease. It never waits: a slot whose copy may
71	// still run is reused only once the renderer sees it finished.
72	EndCapture(CaptureFrame)
73	// Trim frees client buffer caches left undrawn for a while and what
74	// finished frames held, without rendering. Outputs call it
75	// periodically: an idle output renders no frame to free them.
76	Trim(now time.Time) error
77	Close()
78}
79
80// Seat is the device broker (libseat) input devices are opened through.
81type Seat interface {
82	OpenDevice(path string) (int, error)
83	CloseDevice(fd int)
84	SwitchVT(vt int)
85}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 25

Tags 10

↑↓ moveenter openesc close