Repository navigation
feat(viewer): mirror the picture to every display on Wayland boards - #3527
vpetersson-bot wants to merge 3 commits into
Conversation
Pi 5, x86 and generic arm64 run the viewer under cage with `-m last`, so only one HDMI output is ever lit; a second screen on the other port stays dark. Add an opt-in "Mirror to all displays" setting for these boards. With it on, start_viewer launches cage with `-m extend` so every output is enabled, and the viewer stacks all outputs at the layout origin with one atomic wlr-randr call. When the screens share a resolution (or offer a common mode) they are switched to the largest common one for a pixel-exact mirror; otherwise each keeps its mode and is scaled to the smallest logical width. Rotation keeps working on all outputs. Cage only picks its output mode at startup, so toggling the setting makes the viewer exit and the container restart cage. The setting is exposed in Settings (only on cage boards) and as `display_mirroring` in the v2 device settings API. Off by default, so existing installs keep today's behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
Saving a changed "Mirror to all displays" restarts the viewer so cage comes back in the other output mode. Ask first, the same way Reboot and Shutdown do: Save opens a dialog only when the toggle changed, Cancel saves nothing, and "Save and restart display" submits the form. Saves that leave the toggle alone never prompt. The hint now also says a screen plugged in after boot needs a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
|



What
Adds an opt-in Mirror to all displays setting for the boards whose viewer runs under the cage Wayland compositor (Pi 5, x86, generic arm64). With it on, every connected display shows the same content, for example both micro-HDMI ports on a Pi 5.
Requested on the forum: Twin HDMI Outputs. This covers mirroring only. Separate playlists per output and spanning one canvas across screens are out of scope.
Why it doesn't work today
bin/lib/viewer/platform_wayland.shlaunches cage with-m last, which enables a single output on purpose so that a display on the "wrong" port isn't left black. As a result, a second display never lights up.How
platform_wayland.sh): readsdisplay_mirroringfromanthias.confwithconfigparser(samegetbooleansemantics as the viewer), launches cage with-m extendwhen it is on, and exportsANTHIAS_CAGE_MIRRORINGso the viewer knows which mode this cage runs in.anthias_viewer/display_mirroring.py): readswlr-randr --jsonand stacks every enabled output at the layout origin in one atomicwlr-randrcall. Cage sizes its fullscreen view to the layout bounding box, so every screen shows the whole canvas.PATCH) are not prompted.-m last/-m extendat startup. Onreload, when the setting differs from the running cage's mode, the viewer exits from the main thread andrestart: alwaysrelaunches the container in the new mode. Unrelated reloads and rotation changes never restart._apply_wlr_transformalready iterates over every output.display_mirroringis added to settings defaults (off), the Settings page (toggle shown only whenDEVICE_TYPEis a cage board, viaanthias_common.board.supports_display_mirroring), and the v2 device settings GET/PATCH as an additive optional field. No existing API field changes.Testing
tests/test_display_mirroring.pycovers:wlr-randr --json, including disabled heads and garbage input;apply_mirrorsuccess and failure paths;pytest -m "not integration"), along withruff check,ruff format --checkandmypy.HDMI-A-2is enabled andHDMI-A-1is disabled (dark).cage -m last).display_mirroring: true: the viewer restarts once, cage runs-m extend, and both outputs sit at0,0on the common 1024x768 mode. Both vc4 CRTCs are active, andgrimcaptures of the two outputs are byte-identical.display_mirroring: false: one restart back to the single-output layout, with no restart loop.display_mirroringfalse.display_mirroring: truethrough the API does nothing to the viewer: no restart, same webview process, and DRM state identical to the stock-image baseline.Not covered
🤖 Generated with Claude Code