From 782fbccac35ebf11d26d8b4f775b1afd2bb184f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Wed, 4 Nov 2026 19:36:12 +0100 Subject: [PATCH 1/2] device-panther: give Hyprland CAP_SYS_NICE for a high-priority GPU context With a client keeping the GPU busy, a Pixel 7 at 90 Hz stopped at about 63 frames a second. Hyprland asks panthor for a high-priority context, which panthor only grants with CAP_SYS_NICE (or to its own DRM master; Hyprland is master of gs-decon). Hyprland's log said "Failed to get a high priority context". A pacman hook now runs setcap cap_sys_nice+ep on /usr/bin/Hyprland after every transaction that installs or upgrades hyprland (which replaces the binary and drops the capability) or this package. setcap comes from libcap, now a dependency. Only this device package carries it; other phones are unchanged. On a Pixel 7 (mpv testsrc2 at 1080x2400@90, 10 s, gs-decon's flips, each case after a reboot, twice): 62-63 flips a second without the capability, 89-90 with it, 63-63 with it removed again, 90-90 back; the log then says "Got a high priority context". Hyprland also runs SCHED_RR priority 1 with SCHED_RESET_ON_FORK. The capability was set by hand; the hook itself has run only in test/all, not on the phone. I used AI help (Claude) to work on this. --- device/panther/NOTES.md | 15 ++++++++++++++ packages/omamobile-device-panther/PKGBUILD | 2 +- packages/omamobile-device-panther/README.md | 1 + packages/omamobile-device-panther/install | 2 ++ packages/omamobile-device-panther/test/all | 17 ++++++++++++++++ .../hooks/90-omamobile-hyprland-nice.hook | 20 +++++++++++++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook diff --git a/device/panther/NOTES.md b/device/panther/NOTES.md index c40fb6ee2..e8d9744d1 100644 --- a/device/panther/NOTES.md +++ b/device/panther/NOTES.md @@ -5,6 +5,21 @@ Findings from real hardware, newest first. [BRINGUP-M1.md](BRINGUP-M1.md) is the The board file (`gs201-panther.dts`) was merged as [linux-omarchy-mobile#108](https://github.com/derekross/linux-omarchy-mobile/pull/108), and the FT3658 driver as [#109](https://github.com/derekross/linux-omarchy-mobile/pull/109); the test kernels below add one local commit each on top. +## 2026-11-04: Hyprland needs CAP_SYS_NICE for 90 frames a second + +With a client keeping the GPU busy, the screen stopped at about 63 frames a second at 90 Hz. Hyprland asks panthor for a high-priority context, and panthor only grants it with `CAP_SYS_NICE` (or to the DRM master of panthor itself; Hyprland is master of gs-decon): its log said "Failed to get a high priority context", so its groups ran at the client's priority and its frames could wait a scheduler tick. + +Measured on kernel `7.3.0-rc6-omamobile-push1-g44048a9aa795` (local branch with the 90 Hz mode, not on `omamobile`), mpv playing `testsrc2` at 1080x2400@90 for 10 s, counting gs-decon's flips, each case after a reboot, twice: + +| Hyprland | flips a second | +| --- | --- | +| as installed | 62, 63 | +| `setcap cap_sys_nice+ep /usr/bin/Hyprland` | 89, 90 | +| capability removed again (control) | 63, 63 | +| capability back | 90, 90 | + +With it the log says "Got a high priority context". Hyprland also switches itself to SCHED_RR, priority 1, with SCHED_RESET_ON_FORK. No flip timeouts or late flips in any run; the panel ran at 90 Hz throughout. The package's pacman hook re-applies the capability after each Hyprland upgrade (an upgrade replaces the binary and drops it). Not checked: power use, 60 Hz, and the Pixel 7 Pro. + ## 2026-11-02: AVB footers on boot and init_boot A second Pixel 7 (issue #342), with stock CP3A.261005.002.A1 sideloaded as a full OTA on both slots, never started slot B. The screen stayed black, no USB gadget appeared, and after about 72 s it was back in stock recovery on slot A. This was the case with the published kernel too. It's the Pixel 7 Pro's issue #11 (device/cheetah/NOTES.md, 2026-10-28): diff --git a/packages/omamobile-device-panther/PKGBUILD b/packages/omamobile-device-panther/PKGBUILD index ed30bf0c6..bb5b5b23b 100644 --- a/packages/omamobile-device-panther/PKGBUILD +++ b/packages/omamobile-device-panther/PKGBUILD @@ -7,7 +7,7 @@ pkgdesc="Omarchy Mobile support for the Google Pixel 7 (panther): storage guard, arch=(aarch64) url="https://github.com/derekross/omarchy-mobile" license=(MIT) -depends=(bash systemd omamobile-keyring i2c-tools) +depends=(bash systemd omamobile-keyring i2c-tools libcap) provides=(omamobile-device) conflicts=(omamobile-device) backup=(etc/pacman.d/omamobile-mirrorlist) diff --git a/packages/omamobile-device-panther/README.md b/packages/omamobile-device-panther/README.md index e375aeaa0..4d88240ff 100644 --- a/packages/omamobile-device-panther/README.md +++ b/packages/omamobile-device-panther/README.md @@ -7,6 +7,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe | `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`) | +| `vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook` | `/usr/share/libalpm/hooks` | After every install or upgrade of Hyprland (or of this package), gives `/usr/bin/Hyprland` `cap_sys_nice+ep`, so panthor grants its high-priority GPU context and the compositor's frames don't wait behind a busy client (62-63 to 89-90 frames a second at 90 Hz, [NOTES.md](../../device/panther/NOTES.md)). Hyprland then also runs SCHED_RR priority 1 with SCHED_RESET_ON_FORK. Uses `setcap` (`libcap`). Removing this package leaves the capability until Hyprland's next upgrade | | `vendor/systemd/network/20-usb-gadget.network` | `/usr/lib/systemd/network` | Sets usb0 to 172.16.42.1/24 after handover | | `bin/omamobile-usb-rescue`, `vendor/systemd/system/omamobile-usb-rescue.service` | `/usr/bin`, `/usr/lib/systemd/system` (enabled for `multi-user.target`) | Brings USB back after a replug: the MAX77759 opens its USB2 data switch on unplug, and with no Type-C driver nothing closes it. While VBUS is valid, puts the switch back to 0x09 on the chip's I2C bus (USI13, which the board file enables). Reads two registers and writes that one; stands aside once a Type-C driver owns the chip. Same script and unit as the Pixel 7 Pro; needs `i2c-tools` | | `vendor/systemd/logind.conf.d/10-omamobile-power-key.conf` | `/usr/lib/systemd/logind.conf.d` | A short power press does not power the phone off. Same drop-in as the Pixel 7 Pro. The long press stays the PMIC reset | diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index e8b009dc2..d15ebc266 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -28,6 +28,8 @@ install -Dm644 vendor/systemd/sleep.conf.d/10-omamobile.conf \ "$destination/usr/lib/systemd/sleep.conf.d/10-omamobile.conf" install -Dm644 vendor/modprobe.d/omamobile-display.conf \ "$destination/usr/lib/modprobe.d/omamobile-display.conf" +install -Dm644 vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook \ + "$destination/usr/share/libalpm/hooks/90-omamobile-hyprland-nice.hook" install -Dm644 vendor/NetworkManager/conf.d/10-omamobile-usb.conf \ "$destination/usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf" install -Dm644 device.conf \ diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index 338880eb3..cae62f0c5 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -82,6 +82,7 @@ for f in usr/bin/reboot-to \ usr/lib/systemd/sleep.conf.d/10-omamobile.conf \ usr/lib/modprobe.d/omamobile-display.conf \ usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf \ + usr/share/libalpm/hooks/90-omamobile-hyprland-nice.hook \ usr/share/omamobile/device.conf \ usr/share/omamobile/device-panther/version \ usr/share/licenses/omamobile-device-panther/LICENSE \ @@ -126,6 +127,22 @@ for absent in usr/bin/omamobile-boot-success usr/bin/omamobile-bootctl \ [[ ! -e $tmp/root/$absent ]] || fail "install includes $absent" done pass "install stages the udev rules, the USB link and its rescue, and the mirrorlist, and nothing that marks a slot or starts hardware" +# Hyprland's CAP_SYS_NICE (a high-priority panthor context): re-applied by a +# pacman hook after every Hyprland install or upgrade, and after this package's. +hook=$tmp/root/usr/share/libalpm/hooks/90-omamobile-hyprland-nice.hook +grep -qx 'Type = Package' "$hook" && grep -qx 'Target = hyprland' "$hook" && grep -qx 'Target = omamobile-device-panther' "$hook" \ + && grep -qx 'Operation = Upgrade' "$hook" && grep -qx 'When = PostTransaction' "$hook" || fail "the hook runs after Hyprland's and this package's installs and upgrades" +exec_line=$(sed -n 's/^Exec = //p' "$hook") +[[ $exec_line == *"/usr/bin/setcap cap_sys_nice+ep /usr/bin/Hyprland"* ]] || fail "the hook gives Hyprland cap_sys_nice and nothing more" +grep -q 'libcap' PKGBUILD || fail "the hook needs setcap (libcap)" +# the Exec line itself: no Hyprland, nothing done; with one, setcap runs on it +mkdir -p "$tmp/hk/usr/bin"; printf '#!/bin/sh\necho "$*" >> "%s"\n' "$tmp/hk/setcap.log" > "$tmp/hk/usr/bin/setcap"; chmod +x "$tmp/hk/usr/bin/setcap" +sh -c "$(eval "printf %s ${exec_line#/bin/sh -c }" | sed "s#/usr/bin/#$tmp/hk/usr/bin/#g")" || fail "the hook passes without Hyprland" +[[ ! -e $tmp/hk/setcap.log ]] || fail "no setcap without Hyprland" +: > "$tmp/hk/usr/bin/Hyprland" +sh -c "$(eval "printf %s ${exec_line#/bin/sh -c }" | sed "s#/usr/bin/#$tmp/hk/usr/bin/#g")" || fail "the hook runs setcap" +[[ $(cat "$tmp/hk/setcap.log") == "cap_sys_nice+ep $tmp/hk/usr/bin/Hyprland" ]] || fail "setcap gets cap_sys_nice+ep on Hyprland" +pass "a pacman hook gives Hyprland CAP_SYS_NICE after its installs and upgrades, and this package's" # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network diff --git a/packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook b/packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook new file mode 100644 index 000000000..af4e6e7c8 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: MIT +# Give Hyprland CAP_SYS_NICE after every transaction that installs or +# upgrades it (an upgrade replaces the binary and drops the capability) or +# this package. Without it panthor refuses Hyprland's high-priority GPU +# context ("Failed to get a high priority context"), and with a client +# keeping the GPU busy at the same priority the compositor's frames wait a +# scheduler tick: 62-63 frames a second at 90 Hz instead of 89-90 +# (device/panther/NOTES.md). Hyprland then also runs SCHED_RR, priority 1, +# with SCHED_RESET_ON_FORK, so its children start as normal tasks. +[Trigger] +Operation = Install +Operation = Upgrade +Type = Package +Target = hyprland +Target = omamobile-device-panther + +[Action] +Description = Giving Hyprland CAP_SYS_NICE for a high-priority GPU context... +When = PostTransaction +Exec = /bin/sh -c '[ ! -e /usr/bin/Hyprland ] || /usr/bin/setcap cap_sys_nice+ep /usr/bin/Hyprland' From 2cb5f6832d981052427ce3f3c3a4c295eb0f231d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Ren=C3=A9?= <17342133+angelrenefm@users.noreply.github.com> Date: Fri, 6 Nov 2026 01:31:24 +0100 Subject: [PATCH 2/2] device-panther: take Hyprland's CAP_SYS_NICE off again when the package goes A second hook, 90-omamobile-hyprland-nice-remove.hook, runs `setcap -r /usr/bin/Hyprland` before omamobile-device-panther is removed, so the capability the install hook gave doesn't outlive the package until Hyprland's next upgrade. It does nothing without Hyprland and never fails the removal. test/all checks its trigger (remove, this package only, before the transaction) and runs its Exec line against a stand-in setcap, with and without Hyprland; the new check fails when the Exec line changes. Not run with pacman -R on the phone (removing the device package would take the storage guard with it); the install hook was run for real, below in the pull request. I used AI help (Claude) to work on this. --- packages/omamobile-device-panther/install | 2 ++ packages/omamobile-device-panther/test/all | 15 ++++++++++++++- .../hooks/90-omamobile-hyprland-nice-remove.hook | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index d15ebc266..2350e72e6 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -30,6 +30,8 @@ install -Dm644 vendor/modprobe.d/omamobile-display.conf \ "$destination/usr/lib/modprobe.d/omamobile-display.conf" install -Dm644 vendor/libalpm/hooks/90-omamobile-hyprland-nice.hook \ "$destination/usr/share/libalpm/hooks/90-omamobile-hyprland-nice.hook" +install -Dm644 vendor/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook \ + "$destination/usr/share/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook" install -Dm644 vendor/NetworkManager/conf.d/10-omamobile-usb.conf \ "$destination/usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf" install -Dm644 device.conf \ diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index cae62f0c5..25a152dfd 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -83,6 +83,7 @@ for f in usr/bin/reboot-to \ usr/lib/modprobe.d/omamobile-display.conf \ usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf \ usr/share/libalpm/hooks/90-omamobile-hyprland-nice.hook \ + usr/share/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook \ usr/share/omamobile/device.conf \ usr/share/omamobile/device-panther/version \ usr/share/licenses/omamobile-device-panther/LICENSE \ @@ -142,7 +143,19 @@ sh -c "$(eval "printf %s ${exec_line#/bin/sh -c }" | sed "s#/usr/bin/#$tmp/hk/us : > "$tmp/hk/usr/bin/Hyprland" sh -c "$(eval "printf %s ${exec_line#/bin/sh -c }" | sed "s#/usr/bin/#$tmp/hk/usr/bin/#g")" || fail "the hook runs setcap" [[ $(cat "$tmp/hk/setcap.log") == "cap_sys_nice+ep $tmp/hk/usr/bin/Hyprland" ]] || fail "setcap gets cap_sys_nice+ep on Hyprland" -pass "a pacman hook gives Hyprland CAP_SYS_NICE after its installs and upgrades, and this package's" +# and the remove hook takes it off again before this package goes +rhook=$tmp/root/usr/share/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook +grep -qx 'Operation = Remove' "$rhook" && grep -qx 'Target = omamobile-device-panther' "$rhook" && grep -qx 'When = PreTransaction' "$rhook" \ + || fail "the remove hook runs before this package is removed" +grep -c '^Target' "$rhook" | grep -qx 1 || fail "the remove hook runs only for this package" +rexec=$(sed -n 's/^Exec = //p' "$rhook") +: > "$tmp/hk/setcap.log" +sh -c "$(eval "printf %s ${rexec#/bin/sh -c }" | sed "s#/usr/bin/#$tmp/hk/usr/bin/#g")" || fail "the remove hook runs setcap -r" +[[ $(cat "$tmp/hk/setcap.log") == "-r $tmp/hk/usr/bin/Hyprland" ]] || fail "the remove hook drops Hyprland's capabilities" +rm -f "$tmp/hk/usr/bin/Hyprland" "$tmp/hk/setcap.log" +sh -c "$(eval "printf %s ${rexec#/bin/sh -c }" | sed "s#/usr/bin/#$tmp/hk/usr/bin/#g")" || fail "the remove hook passes without Hyprland" +[[ ! -e $tmp/hk/setcap.log ]] || fail "no setcap -r without Hyprland" +pass "a pacman hook gives Hyprland CAP_SYS_NICE after its installs and upgrades, and this package's; removing the package takes it off" # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network diff --git a/packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook b/packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook new file mode 100644 index 000000000..572164a49 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/libalpm/hooks/90-omamobile-hyprland-nice-remove.hook @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: MIT +# Take CAP_SYS_NICE off Hyprland again when this package is removed: the +# install hook (90-omamobile-hyprland-nice.hook) gave it, and nothing else +# would drop it before Hyprland's next upgrade replaced the binary. Runs +# before the removal, while this hook is still installed. +[Trigger] +Operation = Remove +Type = Package +Target = omamobile-device-panther + +[Action] +Description = Taking CAP_SYS_NICE off Hyprland... +When = PreTransaction +Exec = /bin/sh -c '[ ! -e /usr/bin/Hyprland ] || /usr/bin/setcap -r /usr/bin/Hyprland 2>/dev/null || true'