diff --git a/packages/hyprland/0002-render-hold-the-last-frame-across-a-rotation.patch b/packages/hyprland/0002-render-hold-the-last-frame-across-a-rotation.patch new file mode 100644 index 000000000..de000da58 --- /dev/null +++ b/packages/hyprland/0002-render-hold-the-last-frame-across-a-rotation.patch @@ -0,0 +1,365 @@ +Subject: [PATCH] render: hold the last frame across a rotation, then turn it in as Android does + +Against Hyprland v0.57.0 (src/render/Renderer.cpp, src/render/OpenGL.cpp). + +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 the +old buffers were drawn stretched and misplaced over the turned output: +stripes, half-empty pages, a home screen's icons in a column, for 200 ms +to a second on a phone (Pixel 7, Omarchy's quickshell). + +The hold. After a transform change, renderMonitor() renders nothing until +every mapped layer surface on the monitor has drawn at its new size, or +500 ms have passed: the output keeps scanning out the last frame of the +old orientation, and the first frame of the new one is complete. While +holding, the layer surfaces and the active workspaces get their frame +callbacks once per refresh, since clients draw on them and a skipped +frame would not send them. "Drawn at its new size" is three checks, each +from what was seen on a Pixel 7: the surface's size matches its new +geometry; its buffer does too (Qt resizes the viewport first, with the +old buffer stretched into it, and commits the new buffer after); and a +layer that had to redraw has sent a second buffer at the new size, or its +first has stood for 50 ms (Qt's first frame at a new size can still be +laid out for the old one, which showed as a black bar, and a layer with +nothing more to draw sends no second one). + +The turn. Before the hold, the output's last buffer is copied into a +framebuffer of the panel's size (the swapchain reuses that buffer within +a few frames). When the hold ends, the final copy to the output (in +CHyprOpenGLImpl::end()) draws, over black, the new frame turning in from +where the old one sat on the glass to upright over 283 ms on Android's +(0.2, 0, 0, 1) curve, and the old frame, pre-rotated for the new +transform so it starts where it was, turning with it and fading out over +116 ms (Android's screen_rotate_*_enter/exit and config_screen_rotation_* +values). Unlike Android, the new frame is opaque from the start: its fade +in over black read as a dip to black on the phone. + +Off unless OMAMOBILE_ROTATION_HOLD=1 is in Hyprland's environment, read +once at startup: a device package turns it on (device-panther's +environment.d), and every other phone keeps Hyprland's own rotation until +the hold has run there. Off, nothing is copied, held or animated. + +diff --git i/src/render/OpenGL.cpp w/src/render/OpenGL.cpp +index 5d23d8e..3a175c4 100644 +--- i/src/render/OpenGL.cpp ++++ w/src/render/OpenGL.cpp +@@ -797,6 +797,8 @@ bool CHyprOpenGLImpl::begin(CRenderContext& ctx, PHLMONITOR pMonitor, const CReg + return true; + } + ++bool omamobileRotationAnim(PHLMONITOR monitor, float& enterRot, float& enterA, SP& exitTex, float& exitRot, float& exitA); ++ + void CHyprOpenGLImpl::end(CRenderContext& ctx) { + static auto PZOOMDISABLEAA = CConfigValue("cursor:zoom_disable_aa"); + auto& m_renderData = ctx.m_data; +@@ -909,7 +911,23 @@ void CHyprOpenGLImpl::end(CRenderContext& ctx) { + g_pHyprRenderer->setProjectionType(ctx, RPT_OUTPUT); + ctx.m_data.transformDamage = true; + +- if (NEEDS_CM && !finalCMComplete) ++ float enterRot = 0.F, enterA = 1.F, exitRot = 0.F, exitA = 0.F; ++ SP exitTex; ++ if (omamobileRotationAnim(PMONITOR.lock(), enterRot, enterA, exitTex, exitRot, exitA)) { ++ // the turn: black behind, the new frame turning in, the old one turning out ++ glClearColor(0.F, 0.F, 0.F, 1.F); ++ glClear(GL_COLOR_BUFFER_BIT); ++ blend(true); ++ CBox enterBox = finalBox; ++ enterBox.rot = enterRot; ++ if (enterA > 0.F) ++ renderTexture(ctx, finalTexture, enterBox, {.a = enterA, .finalMonitorCM = NEEDS_CM && !finalCMComplete}); ++ if (exitTex && exitA > 0.F) { ++ CBox exitBox = {0, 0, PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y}; ++ exitBox.rot = exitRot; ++ renderTexture(ctx, exitTex, exitBox, {.a = exitA}); ++ } ++ } else if (NEEDS_CM && !finalCMComplete) + renderTexture(ctx, finalTexture, finalBox, {.finalMonitorCM = true}); + else + renderTexturePrimitive(ctx, finalTexture, finalBox); +diff --git i/src/render/Renderer.cpp w/src/render/Renderer.cpp +index 4bbb606..925c136 100644 +--- i/src/render/Renderer.cpp ++++ w/src/render/Renderer.cpp +@@ -1,4 +1,6 @@ + #include "Renderer.hpp" ++#include "../managers/eventLoop/EventLoopManager.hpp" ++#include + #include "../Compositor.hpp" + #include "../helpers/math/Math.hpp" + #include +@@ -322,6 +324,216 @@ bool IHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow) { + return false; + } + ++// Omarchy Mobile: hold the last frame across a rotation. A transform change ++// re-lays the layer surfaces out at once, but each client draws at its new ++// size only when it gets to it; meanwhile the old buffers drew stretched and ++// misplaced across the turned output (stripes, half-empty pages) for 200 ms ++// to a second on a phone. Until every mapped layer surface on the monitor ++// has committed at its new size, or ROTATION_HOLD has passed, nothing is ++// rendered: the panel keeps scanning out the last frame of the old ++// orientation, and the first frame of the new one is complete. ++namespace { ++ // Off unless OMAMOBILE_ROTATION_HOLD=1, read once at startup: a device package turns it ++ // on (device-panther's environment.d), and every other phone keeps Hyprland's own ++ // rotation until the hold has run there. ++ const bool ROTATION_HOLD_ON = [] { ++ const char* env = getenv("OMAMOBILE_ROTATION_HOLD"); ++ return env && std::string_view{env} == "1"; ++ }(); ++ ++ constexpr auto ROTATION_HOLD = std::chrono::milliseconds(500); ++ // Android's screen rotation (frameworks/base core/res: screen_rotate_*_enter/exit, ++ // config_screen_rotation_*): the new frame turns in over 283 ms on a (0.2, 0, 0, 1) ++ // curve; the old one turns with it and fades out over 116 ms. ++ constexpr auto ROTATION_ANIM = std::chrono::milliseconds(283); ++ constexpr float FADE_OUT_MS = 116.F; ++ ++ // cubic-bezier(x1, 0, x2, 1)-style ease: y for x, by bisection on the curve's x ++ float bezier(float x, float x1, float y1, float x2, float y2) { ++ auto bx = [&](float t) { return 3 * (1 - t) * (1 - t) * t * x1 + 3 * (1 - t) * t * t * x2 + t * t * t; }; ++ auto by = [&](float t) { return 3 * (1 - t) * (1 - t) * t * y1 + 3 * (1 - t) * t * t * y2 + t * t * t; }; ++ float lo = 0, hi = 1; ++ for (int i = 0; i < 24; ++i) { ++ const float mid = (lo + hi) / 2; ++ (bx(mid) < x ? lo : hi) = mid; ++ } ++ return by((lo + hi) / 2); ++ } ++ ++ ++ struct SRotationHold { ++ std::optional renderedTransform; ++ bool active = false; ++ Time::steady_tp since; ++ Time::steady_tp lastFrameEvents; ++ SP timer; ++ // per layer that had to redraw: the last buffer it committed at its new size, and how many ++ struct SLayerProgress { ++ void* lastBuffer = nullptr; ++ int newSizeCommits = 0; ++ Time::steady_tp firstAtNewSize; ++ }; ++ std::unordered_map layers; ++ // the old orientation's last frame, as the panel showed it, faded out over the new one ++ SP snapshot; ++ Time::steady_tp fadeSince; ++ int quarterTurns = 0; // new transform less the old one, 0..3 ++ }; ++ ++ std::unordered_map rotationHolds; ++ ++ // A client's first frame at its new size can still be laid out for the old one (Qt: ++ // half an empty page, a wallpaper not decoded again yet), so a layer that had to redraw ++ // counts as done from its second buffer at the new size, or once its first one has stood ++ // for SETTLE (a layer with nothing more to draw sends no second one). ++ constexpr int NEW_SIZE_COMMITS = 2; ++ constexpr auto SETTLE = std::chrono::milliseconds(50); ++ ++ // the first mapped layer surface on the monitor that hasn't drawn at its new size yet ++ PHLLS layerBehindRotation(PHLMONITOR monitor, SRotationHold& hold) { ++ for (auto const& level : monitor->m_layerSurfaceLayers) { ++ for (auto const& ref : level) { ++ const auto LS = ref.lock(); ++ if (!LS || !LS->mapped() || !LS->m_layerSurface) ++ continue; ++ const auto SURFACE = LS->m_layerSurface->m_surface.lock(); ++ if (!SURFACE) ++ continue; ++ const auto HAVE = SURFACE->m_current.size; ++ const auto WANT = LS->m_geometry.size(); ++ auto& progress = hold.layers[LS.get()]; ++ if (std::abs(HAVE.x - WANT.x) > 1 || std::abs(HAVE.y - WANT.y) > 1) { ++ progress = {.lastBuffer = nullptr, .newSizeCommits = -NEW_SIZE_COMMITS}; ++ return LS; ++ } ++ // Qt resizes a window's viewport first, with the old buffer stretched into ++ // it, and commits the new buffer after: the buffer has to fit as well. ++ const auto BUFFER = SURFACE->m_current.bufferSize; ++ const auto PIXELS = SURFACE->m_current.transform % 2 == 1 ? Vector2D{BUFFER.y, BUFFER.x} : BUFFER; ++ const auto WANTPX = WANT * monitor->m_scale; ++ const auto SLACK = std::max(2.0, monitor->m_scale * 2.0); ++ if (PIXELS.x > 0 && (std::abs(PIXELS.x - WANTPX.x) > SLACK || std::abs(PIXELS.y - WANTPX.y) > SLACK)) { ++ progress = {.lastBuffer = nullptr, .newSizeCommits = -NEW_SIZE_COMMITS}; ++ return LS; ++ } ++ // a layer that never had to redraw has newSizeCommits 0 and is done ++ if (progress.newSizeCommits < 0) { ++ if (const auto BUF = SURFACE->m_current.buffer.m_buffer.get(); BUF && BUF != progress.lastBuffer) { ++ if (!progress.lastBuffer) ++ progress.firstAtNewSize = Time::steadyNow(); ++ progress.lastBuffer = BUF; ++ progress.newSizeCommits++; ++ } ++ if (progress.newSizeCommits < 0 && !(progress.lastBuffer && Time::steadyNow() - progress.firstAtNewSize >= SETTLE)) ++ return LS; ++ } ++ } ++ } ++ return nullptr; ++ } ++ ++ // true while this frame should not be rendered ++ bool holdFrameForRotation(PHLMONITOR monitor) { ++ if (!ROTATION_HOLD_ON) ++ return false; ++ ++ auto& hold = rotationHolds[monitor->m_id]; ++ ++ if (!hold.active) { ++ if (!hold.renderedTransform.has_value() || *hold.renderedTransform == monitor->m_transform) { ++ hold.renderedTransform = monitor->m_transform; ++ return false; ++ } ++ ++ hold.active = true; ++ hold.since = Time::steadyNow(); ++ hold.quarterTurns = ((sc(monitor->m_transform) & 3) - (sc(*hold.renderedTransform) & 3) + 4) % 4; ++ hold.layers.clear(); ++ if (!hold.timer) { ++ hold.timer = makeShared( ++ std::nullopt, ++ [ref = PHLMONITORREF{monitor}](SP self, void* data) { ++ // the deadline: render whatever there is ++ if (const auto MON = ref.lock()) { ++ MON->m_damage.damageEntire(); ++ MON->scheduleFrame(); ++ } ++ }, ++ nullptr); ++ g_pEventLoopManager->addTimer(hold.timer); ++ } ++ hold.timer->updateTimeout(ROTATION_HOLD); ++ LOG(Log::DEBUG, "Rotation of {}: holding the last frame until the layers have drawn", monitor->m_name); ++ } ++ ++ const auto BEHIND = layerBehindRotation(monitor, hold); ++ const auto WAITED = Time::steadyNow() - hold.since; ++ if (BEHIND && WAITED < ROTATION_HOLD) { ++ // Clients draw on frame callbacks, which a rendered frame would send; without ++ // them the shell (Qt) never draws its new size and every hold runs to the ++ // deadline. Send them once per refresh while holding. ++ const auto NOW = Time::steadyNow(); ++ if (NOW - hold.lastFrameEvents >= std::chrono::microseconds(sc(1000000 / std::max(1.F, monitor->m_refreshRate)))) { ++ hold.lastFrameEvents = NOW; ++ for (auto const& level : monitor->m_layerSurfaceLayers) { ++ for (auto const& ref : level) { ++ if (const auto LS = ref.lock(); LS && LS->mapped() && LS->m_layerSurface) ++ if (const auto SURFACE = LS->m_layerSurface->m_surface.lock()) ++ SURFACE->frame(NOW); ++ } ++ } ++ if (monitor->m_activeWorkspace) ++ g_pHyprRenderer->sendFrameEventsToWorkspace(monitor, monitor->m_activeWorkspace, NOW); ++ if (monitor->m_activeSpecialWorkspace) ++ g_pHyprRenderer->sendFrameEventsToWorkspace(monitor, monitor->m_activeSpecialWorkspace, NOW); ++ } ++ monitor->m_output->needsFrame = false; ++ return true; ++ } ++ ++ if (BEHIND) ++ LOG(Log::WARN, "Rotation of {}: layer {} still not drawn at {}x{} after {}ms", monitor->m_name, BEHIND->m_namespace, BEHIND->m_geometry.w, BEHIND->m_geometry.h, ++ std::chrono::duration_cast(WAITED).count()); ++ else ++ LOG(Log::DEBUG, "Rotation of {}: layers drawn after {}ms", monitor->m_name, std::chrono::duration_cast(WAITED).count()); ++ ++ hold.active = false; ++ hold.fadeSince = Time::steadyNow(); ++ hold.renderedTransform = monitor->m_transform; ++ hold.timer->updateTimeout(std::nullopt); ++ monitor->m_damage.damageEntire(); ++ return false; ++ } ++} ++ ++// For CHyprOpenGLImpl::end(): the rotation animation's state for this frame, if one runs. ++// enterRot/enterA turn and fade the new frame; the old one (exitTex, drawn pre-rotated for the ++// new transform so it sits where it was on the glass) turns by exitRot and fades to exitA. ++bool omamobileRotationAnim(PHLMONITOR monitor, float& enterRot, float& enterA, SP& exitTex, float& exitRot, float& exitA) { ++ const auto IT = rotationHolds.find(monitor->m_id); ++ if (IT == rotationHolds.end() || !IT->second.snapshot || IT->second.active) ++ return false; ++ const auto& hold = IT->second; ++ const float MS = std::chrono::duration(Time::steadyNow() - hold.fadeSince).count(); ++ const float TOTAL = sc(ROTATION_ANIM.count()); ++ if (MS >= TOTAL) ++ return false; ++ ++ // where the old frame sits in the new orientation: a quarter turn back, or a half ++ const float START = hold.quarterTurns == 2 ? sc(M_PI) : (hold.quarterTurns == 1 ? 1.F : hold.quarterTurns == 3 ? -1.F : 0.F) * sc(M_PI_2); ++ const float E = bezier(std::clamp(MS / TOTAL, 0.F, 1.F), 0.2F, 0.F, 0.F, 1.F); ++ ++ enterRot = START * (1.F - E); ++ // Android fades the new frame in over black; on the phone that read as a dip to black, ++ // so the new frame is opaque from the start and only the old one fades ++ enterA = 1.F; ++ exitTex = hold.snapshot->getTexture(); ++ exitTex->m_transform = Math::wlTransformToHyprutils(monitor->m_transform); ++ exitRot = -START * E; ++ exitA = 1.F - std::clamp(MS / FADE_OUT_MS, 0.F, 1.F); ++ return true; ++} ++ + bool IHyprRenderer::shouldRenderMonitor(PHLMONITOR monitor) { + static auto PDAMAGETRACKINGMODE = CConfigValue("debug:damage_tracking"); + bool hasChanged = monitor->m_output->needsFrame || monitor->m_damage.hasChanged(); +@@ -2307,6 +2519,38 @@ void IHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) { + if (!pMonitor->m_output->needsFrame && pMonitor->m_forceFullFrames == 0 && !pMonitor->m_damage.hasChanged()) + return; + ++ // Before the hold starts, copy the frame on the panel: the output's last buffer, which ++ // the swapchain reuses within a few frames, into a framebuffer of the panel's own size. ++ if (auto& hold = rotationHolds[pMonitor->m_id]; ++ ROTATION_HOLD_ON && !hold.active && hold.renderedTransform.has_value() && *hold.renderedTransform != pMonitor->m_transform) { ++ hold.snapshot.reset(); ++ const auto BUFFER = pMonitor->m_output->state->state().buffer; ++ const auto SIZE = pMonitor->m_pixelSize; ++ const auto TEX = BUFFER ? createTexture(BUFFER) : nullptr; ++ const auto FB = TEX ? createFB("rotation snapshot") : nullptr; ++ CRegion whole{0, 0, sc(SIZE.x), sc(SIZE.y)}; ++ if (FB && FB->alloc(SIZE.x, SIZE.y, DRM_FORMAT_ARGB8888)) { ++ FB->setImageDescription(pMonitor->workBufferImageDescription()); ++ if (beginFullFakeRender(pMonitor, whole, FB)) { ++ setProjectionType(m_context, Render::RPT_EXPORT); ++ m_context.m_data.fbSize = SIZE; ++ m_context.m_data.transformDamage = false; ++ m_context.m_data.noSimplify = true; ++ setViewport(0, 0, SIZE.x, SIZE.y); ++ const auto OLDMODIF = m_context.m_data.renderModif.enabled; ++ m_context.m_data.renderModif.enabled = false; ++ startRenderPass(m_context); ++ draw(m_context, CTexPassElement::SRenderData{.tex = TEX, .box = {0, 0, SIZE.x, SIZE.y}}, whole); ++ m_context.m_data.renderModif.enabled = OLDMODIF; ++ endRender(); ++ hold.snapshot = FB; ++ } ++ } ++ } ++ ++ if (holdFrameForRotation(pMonitor)) ++ return; ++ + if (!pMonitor->m_commitCoordinator->canBeginFrame()) { + pMonitor->m_pendingFrame = true; + return; +@@ -2456,6 +2700,18 @@ void IHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) { + Pointer::mgr()->renderSoftwareCursorsFor(ctx, pMonitor->m_self.lock(), NOW, ctx.m_data.damage); + } + ++ // keep frames coming while the rotation animation runs (OpenGL's end() draws it) ++ if (auto& hold = rotationHolds[pMonitor->m_id]; hold.snapshot && !hold.active) { ++ float enterRot, enterA, exitRot, exitA; ++ SP exitTex; ++ if (!omamobileRotationAnim(pMonitor, enterRot, enterA, exitTex, exitRot, exitA)) ++ hold.snapshot.reset(); ++ else { ++ pMonitor->m_damage.damageEntire(); ++ pMonitor->scheduleFrame(); ++ } ++ } ++ + if (pMonitor->m_dpmsBlackOpacity->value() != 0.F) { + // render the DPMS black if we are animating + CRectPassElement::SRectData data; diff --git a/packages/hyprland/PKGBUILD b/packages/hyprland/PKGBUILD index f64023dcc..bab594249 100644 --- a/packages/hyprland/PKGBUILD +++ b/packages/hyprland/PKGBUILD @@ -11,10 +11,18 @@ # refused DPMS commit once, so DPMS off was lost whenever a client kept # a page flip in flight (device/cheetah/DISPLAY-PLAN.md, D3b-1). Drop it # once upstream retries. -# - pkgrel 3.1: the higher of Omarchy's (0.57.0-2) and Arch Linux ARM's -# (0.57.0-3) release plus .1, so it sorts above both; [omamobile] comes -# before [omarchy] and [extra] in pacman.conf, so pacman takes this build -# either way. +# - 0002-render-hold-the-last-frame-across-a-rotation.patch: after a +# rotation, Hyprland drew the clients' old buffers stretched over the +# turned output until each redrew (stripes, half-empty pages, for 200 ms +# to a second on a Pixel 7). The output now keeps its last frame until +# every layer surface has drawn at its new size, then turns the new +# frame in as Android does (283 ms, the old frame fading out over it). +# Only with OMAMOBILE_ROTATION_HOLD=1 in Hyprland's environment, which +# device-panther sets; other phones rotate as before. +# - pkgrel 3.2: the higher of Omarchy's (0.57.0-2) and Arch Linux ARM's +# (0.57.0-3) release plus .1, so it sorts above both, and .2 for the +# rotation hold (3.1 is published); [omamobile] comes before [omarchy] and +# [extra] in pacman.conf, so pacman takes this build either way. # - arch=(aarch64) only. # - build() runs the two cmake steps of `make release` itself, with # CMAKE_SKIP_RPATH (Arch's Makefile sed) and the job count from MAKEFLAGS @@ -25,8 +33,8 @@ pkgname=(hyprland hyprpm) pkgver=0.57.0 -pkgrel=3.1 -pkgdesc='a highly customizable dynamic tiling Wayland compositor (Omarchy Mobile: DPMS retry)' +pkgrel=3.2 +pkgdesc='a highly customizable dynamic tiling Wayland compositor (Omarchy Mobile: DPMS retry, rotation hold)' arch=(aarch64) url="https://github.com/hyprwm/Hyprland" license=(BSD-3-Clause) @@ -92,12 +100,14 @@ source=("$_archive.tar.gz::$url/releases/download/v$pkgver/source-v$pkgver.tar.g nvidia-egl-teardown.patch wl-output-global-grace.patch monitor-rule-vrr.patch - 0001-dpms-keep-retrying-a-refused-dpms-commit.patch) + 0001-dpms-keep-retrying-a-refused-dpms-commit.patch + 0002-render-hold-the-last-frame-across-a-rotation.patch) sha256sums=('82d006ba9264fe67266c7d583c16f1a6c64d51424dbdc472c3e9c9d5ddfcd559' '26d62139b8ae55e286bcdff1838a6bc01a021d8f1039b40b8fa523df83f61610' '8fa0f57dc1b3246ab4e30ae81419150f4af7767fb31e739e36c824c6d99fab73' 'c14fb0ec02d97100bcfa4e5c8daaf524972fa5c665e04960619744ba01c73c39' - 'a5670d9a6cdee3f3990a81cdecfd5e1f95771ebd1d7b1e2622ac7187684b8836') + 'a5670d9a6cdee3f3990a81cdecfd5e1f95771ebd1d7b1e2622ac7187684b8836' + '0f3ff13540c40d993943064916332d79ebd34b6d61e41481c86f92bb6413e91b') prepare() { ln -sf hyprland-source "$_archive" @@ -110,6 +120,8 @@ prepare() { patch -Np1 --fuzz=0 -i "$srcdir/monitor-rule-vrr.patch" # Omarchy Mobile: retry a refused DPMS commit for up to a second patch -Np1 --fuzz=0 -i "$srcdir/0001-dpms-keep-retrying-a-refused-dpms-commit.patch" + # Omarchy Mobile: hold the last frame across a rotation until the layers have drawn, then turn it in as Android does + patch -Np1 --fuzz=0 -i "$srcdir/0002-render-hold-the-last-frame-across-a-rotation.patch" sed -i -e '/find_package.glaze/s/7...<8 //' {.,hyprpm,start}/CMakeLists.txt } diff --git a/packages/hyprland/README.md b/packages/hyprland/README.md index f951638dc..837fc5125 100644 --- a/packages/hyprland/README.md +++ b/packages/hyprland/README.md @@ -2,7 +2,7 @@ # hyprland (Omarchy Mobile build) This is Omarchy's Hyprland 0.57.0-2 recipe (`hyprland` and `hyprpm`), built -for aarch64 with one change. Hyprland gave up on a refused DPMS commit after +for aarch64 with two changes. Hyprland gave up on a refused DPMS commit after a single retry, and aquamarine refuses commits while a page flip is in flight. So when a client kept rendering, DPMS off was lost: Hyprland reported the screen off, but the CRTC never turned off. See @@ -13,14 +13,28 @@ reported the screen off, but the CRTC never turned off. See | `PKGBUILD` | Omarchy's `pkgbuilds/hyprland/PKGBUILD` at `347f3d791489` (omacom-io/omarchy-pkgs), changes in its header | | `nvidia-egl-teardown.patch`, `wl-output-global-grace.patch`, `monitor-rule-vrr.patch` | Omarchy's patches from the same commit, unchanged (what they fix: their comments in `prepare()`) | | `0001-dpms-keep-retrying-a-refused-dpms-commit.patch` | The Omarchy Mobile change to `src/output/Monitor.cpp` | +| `0002-render-hold-the-last-frame-across-a-rotation.patch` | The Omarchy Mobile change to `src/render/Renderer.cpp` and `src/render/OpenGL.cpp` (the rotation hold, below) | ## What differs from Omarchy's `hyprland` 0.57.0-2 - The DPMS patch. A refused DPMS commit is retried every two frames for up to a second instead of once. -- `pkgrel=3.1`: the higher of Omarchy's (0.57.0-2) and Arch Linux ARM's +- The rotation hold (0002). After a transform change the output keeps its + last frame until every mapped layer surface has drawn at its new size + (its buffer too, and a second buffer or 50 ms more), or 500 ms; layers + and the active workspaces get their frame callbacks once per refresh + meanwhile. Then the new frame turns in over 283 ms on Android's + (0.2, 0, 0, 1) curve, and the old one, kept where it was on the glass, + turns with it and fades out over 116 ms. On a Pixel 7 the holds took + 106 to 228 ms; without the patch the old buffers showed stretched for + 200 ms to a second. It is off unless `OMAMOBILE_ROTATION_HOLD=1` is in + Hyprland's environment (read once at startup): `omamobile-device-panther` + sets it in `environment.d`, and the other phones rotate as before until + it has run on them. +- `pkgrel=3.2`: the higher of Omarchy's (0.57.0-2) and Arch Linux ARM's (`extra/hyprland` 0.57.0-3, a rebuild for aquamarine 0.16.0 and - hyprgraphics 0.6.0) release, plus `.1`, so it sorts above both. + hyprgraphics 0.6.0) release, plus `.1`, so it sorts above both; `.2` for + the rotation hold, since 3.1 is published. - `arch=(aarch64)` only. - `build()` runs the two cmake steps of `make release` itself: - with Arch's `-DCMAKE_SKIP_RPATH=ON` (Arch's PKGBUILD seds it into the diff --git a/packages/omamobile-device-panther/README.md b/packages/omamobile-device-panther/README.md index 59291f7c2..9098abcb8 100644 --- a/packages/omamobile-device-panther/README.md +++ b/packages/omamobile-device-panther/README.md @@ -4,6 +4,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe | Path | Installs to | What it does | | --- | --- | --- | +| `vendor/environment.d/40-omamobile-rotation.conf` | `/usr/lib/environment.d` | `OMAMOBILE_ROTATION_HOLD=1`: Hyprland (packages/hyprland, 0002) holds the last frame across a rotation and turns the new one in as Android does. Off in the shared build until it has run on the other phones | | `vendor/udev/rules.d/10-omamobile-storage.rules` | `/usr/lib/udev/rules.d` | Hides `sda` and every Android partition except `userdata` from desktop tools. Same rule as the Pixel 7 Pro. The initramfs stops its guard loop before `switch_root`; the kernel's read-only flags are what remain | | `vendor/udev/rules.d/20-omamobile-gpu-always-on.rules` | `/usr/lib/udev/rules.d` | Keeps the Mali-G710 powered while Panthor drives it: powering its domain back up needs a secure call our kernel doesn't make yet. Same rule as the Pixel 7 Pro | | `vendor/udev/rules.d/72-omamobile-feedbackd.rules` | `/usr/lib/udev/rules.d` | Lets feedbackd drive the CS40L26 haptics (`cs40l26_vibra`). Same rule as the Pixel 7 Pro; the driver needs the phone's own `cs40l26.wmfw` (`tools/extract-vendor-firmware -d panther`) | diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index ed3167754..ec64824b9 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -34,6 +34,8 @@ for rules in 20-omamobile-gpu-always-on.rules 72-omamobile-feedbackd.rules \ done install -Dm644 vendor/systemd/network/20-usb-gadget.network \ "$destination/usr/lib/systemd/network/20-usb-gadget.network" +install -Dm644 vendor/environment.d/40-omamobile-rotation.conf \ + "$destination/usr/lib/environment.d/40-omamobile-rotation.conf" install -Dm644 vendor/systemd/logind.conf.d/10-omamobile-power-key.conf \ "$destination/usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf" install -Dm644 vendor/systemd/sleep.conf.d/10-omamobile.conf \ diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index 66fec6208..fe457c3a2 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -95,6 +95,7 @@ for f in usr/bin/reboot-to \ usr/lib/udev/rules.d/72-omamobile-feedbackd.rules \ usr/lib/udev/rules.d/70-omamobile-dma-heap.rules \ usr/lib/systemd/network/20-usb-gadget.network \ + usr/lib/environment.d/40-omamobile-rotation.conf \ usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf \ usr/lib/systemd/sleep.conf.d/10-omamobile.conf \ usr/lib/modprobe.d/omamobile-display.conf \ @@ -125,6 +126,8 @@ grep -q 'ATTRS{name}=="cs40l26_vibra"' "$tmp/root/usr/lib/udev/rules.d/72-omamob || fail "feedbackd gets the CS40L26 haptics" grep -q 'Address=172.16.42.1/24' "$tmp/root/usr/lib/systemd/network/20-usb-gadget.network" \ || fail "usb0 keeps the initramfs address" +grep -qx 'OMAMOBILE_ROTATION_HOLD=1' "$tmp/root/usr/lib/environment.d/40-omamobile-rotation.conf" \ + || fail "the Pixel 7 turns on Hyprland's rotation hold" power="$tmp/root/usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf" grep -qx '\[Login\]' "$power" \ || fail "the power-key drop-in needs a [Login] header" diff --git a/packages/omamobile-device-panther/vendor/environment.d/40-omamobile-rotation.conf b/packages/omamobile-device-panther/vendor/environment.d/40-omamobile-rotation.conf new file mode 100644 index 000000000..a56f4cb05 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/environment.d/40-omamobile-rotation.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile: Hyprland holds the last frame across a rotation and turns +# the new one in as Android does (packages/hyprland, 0002). Off by default +# in the shared Hyprland build; the Pixel 7 turns it on, where it has run. +# Read once, when Hyprland starts. +OMAMOBILE_ROTATION_HOLD=1