Repository navigation
hyprland: hold the last frame across a rotation, then turn it in as Android does - #446
angelrenefm wants to merge 2 commits into
Conversation
|
One item off the "not checked" list: turning to the other landscape side (transform 3, and back to 0) was watched on the Pixel 7 too, and turns in correctly, the same as transform 1. The half turn (2) is still unchecked; autorotate on the phone doesn't use it. I used AI help (Claude) to work on this. |
|
Thank you, @angelrenefm, this is lovely work. Stretched frames on every turn were one of the things that made rotation feel broken, and reading AOSP for the timings, then dropping the fade-in when it looked worse on the phone, is the right kind of judgement. I applied your patch with the other four to the 0.57.0 source at The thing I can't get past right now: our Hyprland package is the Pixel 7 Pro's compositor too, and this changes every rotation there, at 120 Hz, with a different shell layout. Nobody has run it on a 7 Pro, and I can't test that phone at the moment. The way we handle shared code is that it leaves the 7 Pro as it is until it has run there. So could you put the hold and the turn behind a switch that the Pixel 7 turns on? For example, an environment variable read once at startup ( Two package details: the build needs a new release number, A few things I noticed reading the patch, none blocking:
Thanks for listing what you didn't test so plainly; it made this much easier to review. |
A monitor transform change lays the layer surfaces out again at once, but each client draws at its new size only when it gets to it. Until then Hyprland drew their old buffers stretched over the turned output: stripes, half-empty pages, the home screen's icons in a column, for 200 ms to a second on a Pixel 7 running the phone shell. 0002-render-hold-the-last-frame-across-a-rotation.patch (Renderer.cpp and OpenGL.cpp): - After a transform change, nothing is rendered until every mapped layer surface on the monitor has drawn at its new size, or 500 ms have passed, so the panel keeps its last frame. "Drawn" means the surface's size and its buffer match the new geometry, and a layer that had to redraw has sent a second buffer at that size, or its first has stood for 50 ms. Each check comes from what showed on the phone: Qt resizes the viewport before it commits the new buffer, and its first frame at a new size can still be laid out for the old one. Layers and the active workspaces get their frame callbacks once per refresh while holding, or Qt clients never draw. - Then the new frame turns in from where the old one sat on the glass over 283 ms on a (0.2, 0, 0, 1) curve, while the old frame (copied from the output's buffer before the hold) turns with it and fades out over 116 ms: AOSP's screen rotation values. The new frame is opaque from the start; Android's fade in over black read as a dip to black. Tested on a Pixel 7 (panther, 90 Hz) only, with Hyprland cross-built from this patch against the phone's own libraries and swapped in for /usr/bin/Hyprland, not built with makepkg. Turns between transform 0 and 1, on the home screen: holds of 106 to 228 ms, all ended by the layers, none by the deadline; watched on the phone, no stretched frames or black bar, and a smooth turn. Not checked: transform 3 and 2 (the other landscape side and a half turn), app windows (only layer surfaces are waited for), a 120 Hz panel, and a monitor without layer shell clients. screencopy can't show the turn: it copies the frame before end()'s final copy. I used AI help (Claude) to work on this.
The hold and the turn now run only with OMAMOBILE_ROTATION_HOLD=1 in Hyprland's environment, read once at startup; without it nothing is copied, held or animated, and Hyprland rotates as before. The Pixel 7 Pro keeps that until the hold has run on it. omamobile-device-panther turns it on with /usr/lib/environment.d/40-omamobile-rotation.conf (environment.d values reach Hyprland under uwsm, as the shell package's do). pkgrel 3.2, since 3.1 is published, and the pkgdesc names the rotation hold too. I used AI help (Claude) to work on this.
|
Thanks, @derekross. The hold is behind a switch now, and the branch is rebased onto today's The switch. The package. On the Pixel 7. Hyprland built from that tree, the conf file in place, then a reboot:
Lock screen and screen off. Here Not done yet (your non-blocking points): arming the timer for the rest of the 50 ms, and dropping a monitor's state when it goes away. I'd rather do them as a follow-up once this has run on the 7 Pro. Not checked: the switch off on a phone (Hyprland's own rotation, as on the 7 Pro), a I used AI help (Claude) to work on this. |
10db93f to
82d5502
Compare
|
Thank you, @angelrenefm. The switch is just what I had in mind. I read the patch again with it off: Deferring the 50 ms timer and the per-monitor cleanup until it has run on the 7 Pro is fine with me. I'll set device-panther's version when I merge, since the branch still reads 0.1.10, which main already ships, and a few Pixel 7 PRs are landing today. I'll write the squash message with the Hyprland and device-panther versions in it. Thanks again, this makes rotation on the Pixel 7 feel much more finished. |
…s a rotation on the Pixel 7 (#446) (#487) A rotation on the Pixel 7 used to show stretched frames while the shell redrew. Hyprland now holds the last frame across the turn and hands it over AOSP-style once the layer surfaces have redrawn, with a 500 ms deadline. It runs only when OMAMOBILE_ROTATION_HOLD=1, which device-panther sets in an environment.d drop-in; with the switch off (every other phone, the Pixel 7 Pro included) the hold returns at once and Hyprland draws as before. The patch applies to the 0.57.0 tarball at --fuzz=0, and it was cross-built and booted on the contributor's Pixel 7. Co-Authored-By: Ángel René <17342133+angelrenefm@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged through #487 as hyprland 0.57.0-3.2 and device-panther 0.1.12, with you credited as co-author. Thank you, @angelrenefm! The nightly builds Hyprland for development tonight. |
…s a rotation on the Pixel 7 (derekross#446) (derekross#487) A rotation on the Pixel 7 used to show stretched frames while the shell redrew. Hyprland now holds the last frame across the turn and hands it over AOSP-style once the layer surfaces have redrawn, with a 500 ms deadline. It runs only when OMAMOBILE_ROTATION_HOLD=1, which device-panther sets in an environment.d drop-in; with the switch off (every other phone, the Pixel 7 Pro included) the hold returns at once and Hyprland draws as before. The patch applies to the 0.57.0 tarball at --fuzz=0, and it was cross-built and booted on the contributor's Pixel 7. Co-Authored-By: Ángel René <17342133+angelrenefm@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the phone turns, Hyprland lays the layer surfaces out again at once, but each client draws at its new size only when it gets to it. Until then Hyprland draws their old buffers stretched over the turned output. On a Pixel 7 with the phone shell that showed for 200 ms to a second on every turn: stripes, half-empty pages, the home screen's icons squeezed into a column. Nothing here is panther-specific, so I'd expect the 7 Pro to show it too.
This adds
0002-render-hold-the-last-frame-across-a-rotation.patchtopackages/hyprland(src/render/Renderer.cpp,src/render/OpenGL.cpp).The hold. After a transform change nothing is rendered until every mapped layer surface on the monitor has drawn at its new size, or 500 ms have passed, so the panel keeps its last frame. "Drawn" is three checks, each added after the phone showed why the one before wasn't enough:
While holding, layers and the active workspaces get their frame callbacks once per refresh. Without them Qt clients never drew, and every hold ran to the deadline.
The turn. Before the hold, the output's last buffer is copied into a framebuffer of the panel's size, because the swapchain reuses it within a few frames. When the hold ends, the final copy to the output in
CHyprOpenGLImpl::end()draws, over black:The values are AOSP's (
core/res/res/anim/screen_rotate_*_enter/exit.xml,config_screen_rotation_*,interpolator/screen_rotation.xml). One difference: the new frame is opaque from the start. Android fades it in over black, and on the phone that read as a dip to black.Tested on a Pixel 7 (panther, 90 Hz) only, on the home screen, turning between transform 0 and 1:
For the test I cross-built Hyprland 0.57.0 from this patch (and the four already in the package) against the phone's own libraries and swapped it in for
/usr/bin/Hyprland.Not checked:
makepkg/tools/build-packageswith this PKGBUILD. The patch applies with--fuzz=0after the other four, and reproduces the source I built.end()'s final copy. Only the screen shows it.Version and pkgrel are yours to set.
I used AI help (Claude) to work on this.