feat: split kiosk into fallback canvas and OSD overlay layers (#8)
Build Ground Station / build (push) Successful in 37s
Build Ground Station / build (push) Successful in 37s
Drive two independent visual layers per display target from one shared video presence signal: the fullscreen fallback/menu canvas below video and a transparent, input-transparent OSD overlay above video, reserved as the future flight OSD rendering surface. WFB and video decode stay out of the UI process; pilot video keeps rendering priority.
This commit was merged in pull request #12.
This commit is contained in:
+47
-10
@@ -1,17 +1,21 @@
|
||||
// Package display owns the Ground Station kiosk canvas lifecycle. The kiosk
|
||||
// runs independently of WFB, the transmitter and the RC video knob: it waits
|
||||
// for its rendering target to appear, keeps a fullscreen black canvas alive
|
||||
// and stops only when told to. While decoded pilot video is absent the
|
||||
// canvas shows the fallback; when video output is presented the video window
|
||||
// takes rendering priority and the fallback disappears, returning when video
|
||||
// ends. Presence is observed from the video output itself on the display
|
||||
// server, never from WFB or launcher processes. Each target (X11/Viture
|
||||
// today, MIPI/touch later) provides its own opener and templates instead of
|
||||
// one global layout.
|
||||
// Package display owns the Ground Station kiosk layers. The kiosk runs
|
||||
// independently of WFB, the transmitter and the RC video knob: it waits for
|
||||
// its rendering target to appear, keeps its windows alive and stops only
|
||||
// when told to. Each target drives two independent visual layers: a
|
||||
// fullscreen fallback/menu canvas below video, visible while decoded pilot
|
||||
// video is absent, and a transparent, input-transparent OSD overlay above
|
||||
// video, reserved as the future flight OSD rendering surface. When video
|
||||
// output is presented the video window takes rendering priority and the
|
||||
// fallback disappears, returning when video ends. Presence is observed from
|
||||
// the video output itself on the display server, never from WFB or launcher
|
||||
// processes, and the video pipeline is never moved into, coupled to or
|
||||
// touched by this package. Each target (X11/Viture today, MIPI/touch later)
|
||||
// provides its own openers and templates instead of one global layout.
|
||||
package display
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -108,6 +112,39 @@ func Run(ctx context.Context, opener Opener, template Template, options Options)
|
||||
}
|
||||
}
|
||||
|
||||
// Layer is one independent visual layer of a display target: its own
|
||||
// connection, window role and template. A lost or degraded layer never
|
||||
// affects the others, so a missing overlay cannot disturb the fallback
|
||||
// canvas and neither can disturb pilot video.
|
||||
type Layer struct {
|
||||
// Name identifies the layer in diagnostics.
|
||||
Name string
|
||||
// Opener connects to the layer's own window on the target.
|
||||
Opener Opener
|
||||
// Template renders the layer's target-specific layout.
|
||||
Template Template
|
||||
// Options tune the layer's lifecycle loop. Zero values select the
|
||||
// defaults.
|
||||
Options Options
|
||||
}
|
||||
|
||||
// RunLayers drives every layer of a display target until ctx is cancelled,
|
||||
// each on its own connection with its own reconnect backoff. A layer whose
|
||||
// target keeps failing keeps retrying and never stops the other layers, so
|
||||
// the Ground Station supervisor stays up. RunLayers returns only after every
|
||||
// layer has stopped.
|
||||
func RunLayers(ctx context.Context, layers []Layer) {
|
||||
var wg sync.WaitGroup
|
||||
for _, layer := range layers {
|
||||
wg.Add(1)
|
||||
go func(layer Layer) {
|
||||
defer wg.Done()
|
||||
_ = Run(ctx, layer.Opener, layer.Template, layer.Options)
|
||||
}(layer)
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func nextDelay(delay, max time.Duration) time.Duration {
|
||||
delay *= 2
|
||||
if delay > max {
|
||||
|
||||
Reference in New Issue
Block a user