Skip to content

fix(viewer): emit 270° eglfs rotation as -90 so portrait-inverted isn't stretched#2973

Merged
vpetersson merged 1 commit into
masterfrom
fix/pi4-eglfs-rotation-270
Jun 2, 2026
Merged

fix(viewer): emit 270° eglfs rotation as -90 so portrait-inverted isn't stretched#2973
vpetersson merged 1 commit into
masterfrom
fix/pi4-eglfs-rotation-270

Conversation

@vpetersson
Copy link
Copy Markdown
Contributor

Issues Fixed

Follow-up to #2970 (and #2971): salmanfarisvp's retest confirmed 0/90/180 now rotate correctly on Pi 4, but 270° (portrait inverted) renders stretched.

Description

QT_QPA_EGLFS_ROTATION only accepts 180, 90 and -90. A literal 270 hits the default: ("Invalid rotation") branch in QEglFSScreen::geometry(): the QOpenGLCompositor still rotates the content by 270°, but the screen geometry never swaps to portrait — the window lays out 1920x1080 landscape and gets squeezed into the portrait orientation, i.e. the stretch in the report.

  • Map 270-90 when composing the webview env in _build_webview_env (identical orientation mod 360, but takes the width/height-swap path in Qt).
  • Extend the eglfs rotation test to assert the -90 spelling for 270°.

Validated on the Pi 4 testbed by probing the live webview viewport over D-Bus at screen_rotation=270:

viewport
before (QT_QPA_EGLFS_ROTATION=270) 1920x1080 (landscape layout, stretched)
after (QT_QPA_EGLFS_ROTATION=-90) 1080x1920 (portrait, correct)

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. (n/a — x86 rotates via wlr-randr, code path untouched)
  • I added a documentation for the changes I have made (when necessary). (n/a)

🤖 Generated with Claude Code

…'t stretched

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) <noreply@anthropic.com>
@vpetersson vpetersson requested a review from a team as a code owner June 2, 2026 10:35
@vpetersson vpetersson self-assigned this Jun 2, 2026
@vpetersson vpetersson requested a review from Copilot June 2, 2026 10:35
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

Copilot AI left a comment

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 Raspberry Pi 4 (eglfs) portrait-inverted (270°) rotation for web/image content by emitting QT_QPA_EGLFS_ROTATION=-90 instead of the unsupported literal 270, ensuring Qt’s eglfs path swaps screen geometry correctly and avoids stretched rendering.

Changes:

  • Map screen_rotation=270 to QT_QPA_EGLFS_ROTATION=-90 when building the viewer/webview environment on eglfs.
  • Extend the eglfs rotation unit test to assert the -90 spelling for 270°.

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 Normalizes eglfs rotation env var so 270° is expressed as -90 to trigger correct portrait geometry handling.
tests/test_viewer.py Updates eglfs rotation test cases to validate 270 → -90 env emission.

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

@vpetersson vpetersson merged commit bf6b4f0 into master Jun 2, 2026
10 checks passed
@vpetersson vpetersson mentioned this pull request Jun 2, 2026
5 tasks
vpetersson added a commit that referenced this pull request Jun 2, 2026
- 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) <noreply@anthropic.com>
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