fix(viewer): rotate Pi 4 (eglfs) display via QT_QPA_EGLFS_ROTATION - #2971
Conversation
The 2026.06.0 screen-rotation menu was a no-op on Pi 4: #2882 appended the linuxfb `:rotation=N` plugin option to QT_QPA_PLATFORM, but Pi 4 moved to eglfs (#2904) which silently ignores it. Only video rotated (via the per-item video-rotate hack); webpages and images never did. - `_build_webview_env`: set `QT_QPA_EGLFS_ROTATION` on the eglfs board and leave QT_QPA_PLATFORM bare; keep the linuxfb `:rotation=N` path for pi2/pi3 and the wlr-randr path for x86 - drop the `video-rotate` option on pi4-64 — the whole eglfs screen now rotates and the QGraphicsVideoItem inherits it, so per-item rotation would double-rotate; C++ parse kept as a defensive no-op - update tests to assert the eglfs env and that video-rotate is no longer emitted Validated on the Pi 4 testbed: 90° -> webview lays out 1080x1920, 0° -> 1920x1080, toggled through the v2 device_settings API. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
There was a problem hiding this comment.
Pull request overview
Fixes the screen rotation feature on Raspberry Pi 4 (which uses the eglfs Qt platform plugin), where the previously-applied linuxfb:rotation=N option was silently ignored. The viewer now sets QT_QPA_EGLFS_ROTATION for eglfs boards so that webpages, images, and videos rotate uniformly through QOpenGLCompositor, and removes the now-redundant per-video video-rotate D-Bus option that would otherwise double-rotate frames.
Changes:
- In
_build_webview_env, branch on the QPA plugin: setQT_QPA_EGLFS_ROTATIONfor eglfs (clearing any stale value at 0°), keep the existing:rotation=Npath for linuxfb, and leave Wayland untouched. - Stop emitting
video-rotatefrom_build_video_optionson all boards; keep the C++ parser as a defensive no-op for backward compatibility. - Update tests to assert eglfs env behavior and that
video-rotateis never sent (including at 0°).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/anthias_viewer/init.py | Adds the eglfs branch in _build_webview_env that sets/clears QT_QPA_EGLFS_ROTATION. |
| src/anthias_viewer/media_player.py | Removes video-rotate emission and explains why every backend now relies on screen-level rotation. |
| src/anthias_webview/src/videoview.cpp | Updates comment to reflect that no current board sends video-rotate; parse retained as a defensive no-op. |
| tests/test_viewer.py | Adds eglfs-rotation env tests covering set, omit-at-zero, and clear-stale-on-zero paths. |
| tests/test_media_player.py | Replaces "video-rotate emitted on Pi 4" tests with assertions that it is never emitted (including 0°). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…'t stretched (#2973) QT_QPA_EGLFS_ROTATION only accepts 180, 90 and -90. A literal 270 hits the "Invalid rotation" default branch in QEglFSScreen::geometry(): the QOpenGLCompositor still rotates the content, but the screen geometry never swaps to portrait, so the window lays out landscape and renders stretched (issue #2970 follow-up to #2971). - map 270 -> -90 in _build_webview_env (same orientation mod 360) - extend the eglfs rotation test to assert the -90 spelling Validated on the Pi 4 testbed: at 270° the webview viewport went from 1920x1080 (stretched) to 1080x1920 with the fix. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
- CalVer (YYYY.0M.MICRO); still June 2026, micro 0 -> 1 - Ships the QML VideoOutput presentation path (#2975), the pi2/pi3 GStreamer HW video pipeline (#2972), and the x86 WLR_DRM_NO_ATOMIC display-freeze fix (#2978) - Also picks up Pi 4 eglfs rotation (#2971, #2973), the armv7 viewer spawn retry (#2969), the Writeback-connector headless guard (#2968), and viewer log cleanups (#2977, #2979) Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>



Issues Fixed
Forum #6699 — "Anthias 2026.06.0 screen rotation menu doesn't work" on Raspberry Pi 4.
Description
The 2026.06.0 screen-rotation dropdown is a no-op on Pi 4. The rotation feature appends the linuxfb
:rotation=Nplugin option toQT_QPA_PLATFORM, but Pi 4 moved to eglfs (for HW video), and eglfs silently ignores that option. Only video rotated (via the per-itemvideo-rotatehack); webpages and images — i.e. most signage — never did.QT_QPA_EGLFS_ROTATIONis the right primitive: AnthiasViewer is a QWidget app, so eglfs'sQOpenGLCompositorapplies the transform to every top-level window (web, image, video) uniformly._build_webview_env: setQT_QPA_EGLFS_ROTATION=<deg>on the eglfs board and leaveQT_QPA_PLATFORMbare. linuxfb (Pi 2/3):rotation=Nand x86 wlr-randr paths unchanged.video-rotateoption onpi4-64— the whole eglfs screen now rotates and theQGraphicsVideoIteminherits it, so per-item rotation would double-rotate. C++ parse kept as a defensive no-op.video-rotateis no longer emitted.Pure Python + env change — no C++/image rebuild required.
Validated on a Pi 4 testbed through the real
v2/device_settingsAPI (probe page reportingwindow.innerWidth/Heightvia the server access log):screen_rotationeglfs+QT_QPA_EGLFS_ROTATION=90eglfs(no rotation var)Known follow-ups (out of scope here):
browser_busD-Bus proxy after the existing bounce terminates AnthiasViewer →GDBus NoReply), recovered byrestart: always. End state is correct; this is pre-existing bounce machinery, unchanged here._is_wayland_board()only treatsx86as Wayland, but Pi 5 / arm64 also run cage/wayland — their rotation is likely broken the same way (wlr-randr never invoked).Checklist
🤖 Generated with Claude Code