Skip to content

fix(viewer): recognize all cage/Wayland boards for screen rotation#3047

Merged
vpetersson merged 1 commit into
masterfrom
fix/pi5-rotation-wayland-board
Jun 9, 2026
Merged

fix(viewer): recognize all cage/Wayland boards for screen rotation#3047
vpetersson merged 1 commit into
masterfrom
fix/pi5-rotation-wayland-board

Conversation

@vpetersson

Copy link
Copy Markdown
Contributor

Issues Fixed

Fixes #3044 — screen rotation is a complete no-op on the Raspberry Pi 5 (and likely generic arm64 cage boards).

Description

_is_wayland_board() only treated x86 as a Wayland board, so on Pi 5 (DEVICE_TYPE=pi5, QT_QPA_PLATFORM=wayland) rotation misfired twice: _build_webview_env() appended a linuxfb-only :rotation=N option the Qt wayland plugin ignores, and _apply_wlr_transform() (the wlr-randr path that actually rotates on cage/wlroots) was never called. Net result: the rotation menu did nothing.

This keys _is_wayland_board() off QT_QPA_PLATFORM starting with wayland — the same signal docker/Dockerfile.viewer.j2 sets for x86/arm64/pi5 — so all cage boards route through the wlr-randr path x86 already used successfully, with no per-board allowlist to maintain.

  • Tests updated to pair DEVICE_TYPE with QT_QPA_PLATFORM as in production; linuxfb-intent tests moved off the (now Wayland) pi5 onto a genuine linuxfb board.
  • New regression tests cover the board matrix and the Pi 5 wlr-randr rotation path.

Validated end-to-end on a real Raspberry Pi 5 (cage + Wayland, 4K Dell on HDMI-A-2):

  • Boot-time apply: screen_rotation=90 → log Applied wlroots transform 90 to output HDMI-A-2, compositor Transform: 90.
  • Live Settings reload: 90 → 270 → log Screen rotation changed: 90 -> 270 / Applied wlroots transform 270, compositor Transform: 270.
  • With shipped code, _is_wayland_board() returned False on the same board (reproduced the bug first).

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices. (x86 already worked via the cage/wlr-randr path; this change keeps x86 on the identical path — QT_QPA_PLATFORM=wayland — and is covered by unit tests, but was not re-run on x86 hardware.)
  • I added a documentation for the changes I have made (when necessary).

🤖 Generated with Claude Code

Screen rotation was a no-op on Raspberry Pi 5 (and likely generic
arm64 cage boards): `_is_wayland_board()` only treated x86 as a
Wayland board, so neither the linuxfb `:rotation=` option nor the
wlr-randr path ran.

- Key `_is_wayland_board()` off `QT_QPA_PLATFORM` starting with
  `wayland`, mirroring the docker/Dockerfile.viewer.j2 split
  (x86/arm64/pi5) instead of an x86-only DEVICE_TYPE check.
- Update tests to pair DEVICE_TYPE with QT_QPA_PLATFORM as in
  production; switch linuxfb-intent tests off the (now wayland) pi5.
- Add regression tests covering the board matrix and the Pi 5
  wlr-randr rotation path.

Validated end-to-end on a real Pi 5: both the boot-time apply and the
live Settings reload now push the wlroots transform (90/270) to the
connected display.

Fixes #3044

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vpetersson vpetersson requested a review from a team as a code owner June 9, 2026 15:30
@vpetersson vpetersson self-assigned this Jun 9, 2026
@vpetersson vpetersson requested a review from Copilot June 9, 2026 15:30
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes screen rotation on Raspberry Pi 5 (and other cage/wlroots Wayland-based viewer targets) by correctly classifying Wayland boards and routing rotation through the wlroots (wlr-randr) path instead of Qt’s linuxfb-only :rotation= option.

Changes:

  • Update _is_wayland_board() to detect Wayland via QT_QPA_PLATFORM starting with wayland, matching the viewer image/Docker configuration across x86/arm64/pi5.
  • Add/adjust unit tests to cover the board/QPA matrix and specifically regress the Pi 5 Wayland rotation behavior (env composition + wlr-randr invocation).
  • Move linuxfb-intent tests off pi5 to a linuxfb board type to reflect production behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/anthias_viewer/__init__.py Change Wayland-board detection to use QT_QPA_PLATFORM so Wayland targets take the wlr-randr rotation path.
tests/test_viewer.py Expand/realign rotation tests to cover Wayland vs eglfs vs linuxfb behavior and add Pi 5 regression coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vpetersson vpetersson merged commit 3b8cf7a into master Jun 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screen rotation is a no-op on Raspberry Pi 5: _is_wayland_board() is x86-only

2 participants