Skip to content

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

Description

@vpetersson

Summary

Screen rotation (Settings → portrait/landscape) is a complete no-op on the Raspberry Pi 5. The display stays in its default orientation regardless of the rotation chosen in the web UI (and manual config.txt edits don't help either).

Reported on the forum: https://forums.screenly.io/t/6701 (related: https://forums.screenly.io/t/6557).

Root cause

Pi 5 runs the viewer under cage + Wayland. docker/Dockerfile.viewer.j2 sets QT_QPA_PLATFORM=wayland for board in ('x86', 'arm64', 'pi5'), and on those boards the compositor owns the transform, applied via wlr-randr in _apply_wlr_transform().

However, _is_wayland_board() in src/anthias_viewer/__init__.py only treats x86 as a Wayland board:

def _is_wayland_board() -> bool:
    """The x86 viewer runs under cage + wayland; everything else uses
    linuxfb. Mirrors the docker/Dockerfile.viewer.j2 split."""
    return os.environ.get('DEVICE_TYPE') == 'x86'

On Pi 5 (DEVICE_TYPE=pi5, QT_QPA_PLATFORM=wayland) this misfires twice:

  1. _build_webview_env() does not take the Wayland early-return. It falls through, and because the QPA isn't eglfs, it appends wayland:rotation=N to QT_QPA_PLATFORM. The Qt wayland plugin doesn't understand the :rotation= option (that's a linuxfb-only option), so it is silently ignored.
  2. _apply_wlr_transform() — the wlr-randr path that actually rotates on cage/wlroots — is gated behind _is_wayland_board(), so it is never called on Pi 5.

Net result: neither rotation path runs on Pi 5, so the rotation menu does nothing.

The codebase already hints at this gap. _wayland_socket_path() notes that WAYLAND_DISPLAY is set "on x86, arm64 AND pi5 alike, whereas _is_wayland_board() is x86-only".

Suggested fix

Make _is_wayland_board() recognize all cage/Wayland boards, not just x86 — for example detect QT_QPA_PLATFORM starting with wayland, or DEVICE_TYPE in {'x86', 'arm64', 'pi5'}, or the presence of WAYLAND_DISPLAY. That routes Pi 5 (and arm64) through _apply_wlr_transform(), the same wlr-randr path x86 already uses successfully. The generic arm64 cage build is very likely affected the same way and should be confirmed in the same change.

Affected / not affected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions