Skip to content

fix(viewer): rotate eglfs/wayland clockwise to match linuxfb + video#3202

Merged
vpetersson merged 2 commits into
masterfrom
fix/rotation-direction-clockwise
Jul 16, 2026
Merged

fix(viewer): rotate eglfs/wayland clockwise to match linuxfb + video#3202
vpetersson merged 2 commits into
masterfrom
fix/rotation-direction-clockwise

Conversation

@vpetersson

Copy link
Copy Markdown
Contributor

Problem

screen_rotation is defined clockwise — the direction the linuxfb paths (image paintEvent, injected webpage CSS) and the GStreamer videoflip path turn. But the eglfs (QT_QPA_EGLFS_ROTATION) and wayland (wlr-randr transform) mappings both turned the output anticlockwise.

Result: the same screen_rotation=90 produced opposite physical orientation across the fleet. Confirmed on real hardware with an orientation test page (red bar = top of page):

Board Stack screen_rotation=90 Direction
Pi 2 linuxfb red bar → right 90° CW
Pi 4 eglfs red bar → left 90° CCW
x86 wayland red bar → left 90° CCW

Fix

Negate the angle on the two anticlockwise stacks so every display rotates the same (clockwise) way:

  • eglfs: QT_QPA_EGLFS_ROTATION 90→-90, 270→90 (180 symmetric). Still avoids the literal-270 "Invalid rotation" stretch path in QEglFSScreen::geometry().
  • wayland: wlr-randr transform 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.py pass). Will be hardware-verified on pi4 (eglfs), x86/pi5 (wayland), pi3-64 and rockpi4 before merge.

🤖 Generated with Claude Code

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.
@vpetersson
vpetersson requested a review from a team as a code owner July 16, 2026 13:51
@vpetersson
vpetersson requested a review from Copilot July 16, 2026 13:51

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

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_rotation produces 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.

Comment thread tests/test_viewer.py
@vpetersson
vpetersson requested a review from Copilot July 16, 2026 14:17
@sonarqubecloud

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

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

@vpetersson
vpetersson merged commit 407c541 into master Jul 16, 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.

2 participants