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:
@@ -1,4 +1,4 @@
|
||||
// Command groundstation-display renders the Ground Station kiosk canvas. It
|
||||
// Command groundstation-display renders the Ground Station kiosk layers. It
|
||||
// owns its display lifecycle independently of WFB, the transmitter and the
|
||||
// video launcher: it waits for its target to appear, redraws as needed, and
|
||||
// stops only when it receives SIGINT or SIGTERM.
|
||||
@@ -16,19 +16,31 @@ import (
|
||||
"git.piksar.eu/piotr/groundstation/internal/display"
|
||||
)
|
||||
|
||||
// buildTarget selects the target-specific opener and template. Each target
|
||||
// owns its own backend and layouts; there is no shared global template.
|
||||
// buildTarget wires one shared video presence signal into both the opener
|
||||
// (which observes the video output lifecycle) and the fallback template
|
||||
// (which shows or hides itself from it).
|
||||
func buildTarget(name string) (display.Opener, display.Template, error) {
|
||||
// buildTarget selects the target-specific layers. Each target owns its own
|
||||
// backend and layouts; there is no shared global template. The Viture target
|
||||
// builds two independent layers — the fullscreen fallback/menu canvas below
|
||||
// video and the transparent OSD overlay above it — wired to one shared video
|
||||
// presence signal: the sessions observe the video output lifecycle on the
|
||||
// display server and the templates draw or hide from it. WFB and video
|
||||
// decode never move into this process.
|
||||
func buildTarget(name string) ([]display.Layer, error) {
|
||||
switch name {
|
||||
case "x11":
|
||||
video := display.NewVideoPresence()
|
||||
return display.X11Opener{Video: video},
|
||||
display.NewFallbackTemplate(video, "Brak połączenia WFB"), nil
|
||||
return []display.Layer{
|
||||
{
|
||||
Name: "fallback-canvas",
|
||||
Opener: display.X11Opener{Video: video},
|
||||
Template: display.NewFallbackTemplate(video, "Brak połączenia WFB"),
|
||||
},
|
||||
{
|
||||
Name: "osd-overlay",
|
||||
Opener: display.X11Opener{Video: video, Role: display.RoleAbove},
|
||||
Template: display.NewOSDTemplate(video),
|
||||
},
|
||||
}, nil
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("unknown display target %q (supported: x11)", name)
|
||||
return nil, fmt.Errorf("unknown display target %q (supported: x11)", name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +48,7 @@ func main() {
|
||||
target := flag.String("target", "x11", "display target: x11 (Viture) today; mipi planned")
|
||||
flag.Parse()
|
||||
|
||||
opener, template, err := buildTarget(*target)
|
||||
layers, err := buildTarget(*target)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -44,9 +56,7 @@ func main() {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
// Temporary X11 unavailability never exits this process; display.Run
|
||||
// Temporary X11 unavailability never exits this process; every layer
|
||||
// keeps retrying internally until the context is cancelled.
|
||||
if err := display.Run(ctx, opener, template, display.Options{}); err != nil {
|
||||
log.Fatalf("display: %v", err)
|
||||
}
|
||||
display.RunLayers(ctx, layers)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user