fix(viewer): rotate eglfs/wayland clockwise to match linuxfb + video#3202
Merged
Conversation
screen_rotation is defined clockwise — the direction the linuxfb (paintEvent / injected CSS) and GStreamer videoflip paths turn. But the eglfs QT_QPA_EGLFS_ROTATION mapping and the wayland wlr-randr transform both turned the output ANTICLOCKWISE, so the same screen_rotation=90 came out 90° clockwise on a Pi 2 but 90° anticlockwise on a Pi 4 / Pi 5 / x86 — opposite physical orientation across the fleet (confirmed on real hardware: pi2 red-bar-right vs pi4/x86 red-bar-left). Negate the angle on both stacks so every display rotates the same way: - eglfs: QT_QPA_EGLFS_ROTATION 90→-90, 270→90 (180 is symmetric; still avoids the literal-270 "Invalid rotation" stretch bug, #2970). - wayland: wlr transform 90→'270', 270→'90' (180 unchanged). Pre-existing since the eglfs/wayland rotation paths were added; surfaced by the fleet-wide rotation QA. linuxfb and the pi3-64 vc4 overlay plane (rotate-180 only, symmetric) are unchanged. Tests updated for the new clockwise mapping.
There was a problem hiding this comment.
Pull request overview
This PR fixes an inconsistency in how screen_rotation is interpreted across display stacks by making eglfs (QT_QPA_EGLFS_ROTATION) and Wayland/wlroots (wlr-randr --transform) match the project’s clockwise screen_rotation convention (already used by linuxfb + videoflip).
Changes:
- Negate/map eglfs rotation values so
screen_rotationproduces the same physical (clockwise) orientation as linuxfb. - Remap wlroots transform values so Wayland rotations align with the same clockwise convention.
- Update viewer unit tests and inline documentation to reflect the corrected mappings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/anthias_viewer/__init__.py |
Corrects eglfs and wlroots rotation mappings to enforce clockwise screen_rotation semantics. |
tests/test_viewer.py |
Updates tests/comments to match the new eglfs/wlroots rotation mapping behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
screen_rotationis defined clockwise — the direction the linuxfb paths (imagepaintEvent, injected webpage CSS) and the GStreamervideoflippath turn. But the eglfs (QT_QPA_EGLFS_ROTATION) and wayland (wlr-randrtransform) mappings both turned the output anticlockwise.Result: the same
screen_rotation=90produced opposite physical orientation across the fleet. Confirmed on real hardware with an orientation test page (red bar = top of page):screen_rotation=90Fix
Negate the angle on the two anticlockwise stacks so every display rotates the same (clockwise) way:
QT_QPA_EGLFS_ROTATION90→-90, 270→90(180 symmetric). Still avoids the literal-270"Invalid rotation" stretch path inQEglFSScreen::geometry().wlr-randrtransform 90→270, 270→90(180 unchanged).linuxfb and the pi3-64 vc4 overlay plane (rotate-180 only, symmetric) are untouched.
Scope
Pre-existing since the eglfs/wayland rotation paths were added — surfaced by the fleet-wide rotation QA for the 2026.07.3 release. Unit tests updated for the clockwise mapping (160
test_viewer.pypass). Will be hardware-verified on pi4 (eglfs), x86/pi5 (wayland), pi3-64 and rockpi4 before merge.🤖 Generated with Claude Code