Fix display DPMS power-down and schedutil rate limit

Enable the X11 DPMS extension and force the DRM connector off/on on blank
and wake, including the lid-close and lockscreen paths that write backlight
sysfs directly (driven by a backlight change udev rule and a small sync
helper). DPMS timeouts stay at zero so unlocked auto-blanking remains off.

Re-apply schedutil rate_limit_us=40000 after every powersave to schedutil
governor switch, which recreates the kobject with the 6.44 s default, and
drop the writes to nonexistent up_rate_limit_us / down_rate_limit_us files.

Remove the dead iw power-save call: NetworkManager wifi.powersave=3 and the
wcn36xx WIPHY_FLAG_PS_ON_BY_DEFAULT patch already report "Power save: on".
This commit is contained in:
Luxferre committed 2026-11-05 21:04:06 +02:00
1 parent 691a989838
commit 7b6c6b25d4
9 files changed
+68 -14

No files matched your search

+10
View File
@@ -9,6 +9,16 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
--- ---
## Unreleased — display power and cpufreq fixes
### Display power management and CPU frequency tuning
- Enabled the X11 DPMS extension in `10-bananarchy-msm8909.conf`, `bananarchy-x11-session.sh`, and `sxmo_dwminit.sh`, and added explicit `xset dpms force off/on` to `sxmo_wm.sh display off/on`. Before the fix the DRM connector stayed `On` while blanked; it now reports `Off` on blank and `On` on wake for both the `sxmo_wm.sh` path and the direct-sysfs paths used by `dwm` and `locker.so`. DPMS timeouts stay at `0 0 0`, so unlocked auto-blanking remains disabled by design.
- Added `bananarchy-display-power-sync` and `86-bananarchy-display-power.rules` to drive DPMS from backlight `change` uevents, covering the lid-close and lockscreen blank paths that write sysfs directly. The helper also re-applies the schedutil rate limit after every wake.
- Fixed `rate_limit_us` silently falling back to the 6.44 s default: `10-power-save.start` no longer writes the nonexistent `up_rate_limit_us` / `down_rate_limit_us` files, and the 40 ms value is re-applied after each `powersave` to `schedutil` governor switch. Measured idle average CPU frequency dropped from 582 MHz to 440 MHz (-24%) with 40 ms instead of 6.44 s.
- Removed the dead `iw dev wlan0 set power_save on` block from `10-power-save.start`: `iw` is not shipped, and NetworkManager `wifi.powersave=3` plus the wcn36xx `WIPHY_FLAG_PS_ON_BY_DEFAULT` patch already report `Power save: on` on the connected link.
---
## Build `a1105` — codename `vendetta` (2026-11-05) ## Build `a1105` — codename `vendetta` (2026-11-05)
### Full-length SMS conversation view and Unicode-aware composer ### Full-length SMS conversation view and Unicode-aware composer
@@ -6,12 +6,12 @@ Section "ServerFlags"
Option "StandbyTime" "0" Option "StandbyTime" "0"
Option "SuspendTime" "0" Option "SuspendTime" "0"
Option "OffTime" "0" Option "OffTime" "0"
Option "DPMS" "false" Option "DPMS" "true"
EndSection EndSection
Section "Monitor" Section "Monitor"
Identifier "DefaultMonitor" Identifier "DefaultMonitor"
Option "DPMS" "false" Option "DPMS" "true"
EndSection EndSection
Section "Device" Section "Device"
+2
View File
@@ -49,6 +49,8 @@ permit nopass :wheel as root cmd /usr/bin/bananarchy-bt-obex
permit nopass :wheel as root cmd bananarchy-bt-obex permit nopass :wheel as root cmd bananarchy-bt-obex
permit nopass :wheel as root cmd /usr/bin/bananarchy-privacy-ctl permit nopass :wheel as root cmd /usr/bin/bananarchy-privacy-ctl
permit nopass :wheel as root cmd bananarchy-privacy-ctl permit nopass :wheel as root cmd bananarchy-privacy-ctl
permit nopass :wheel as root cmd /usr/bin/bananarchy-display-power-sync
permit nopass :wheel as root cmd bananarchy-display-power-sync
permit nopass :wheel as root cmd /usr/bin/plymouth args quit permit nopass :wheel as root cmd /usr/bin/plymouth args quit
permit nopass :wheel as root cmd plymouth args quit permit nopass :wheel as root cmd plymouth args quit
permit nopass :wheel as root cmd rc-service args hexagonrpcd-adsp-sensorspd stop permit nopass :wheel as root cmd rc-service args hexagonrpcd-adsp-sensorspd stop
@@ -31,14 +31,14 @@ for pm_dev in /sys/devices/platform/soc@0/1c00000.gpu /sys/devices/platform/soc@
fi fi
done done
# Tune CPUFreq schedutil governor to avoid 22 Hz frequency/RPM voltage thrashing at idle # Keep schedutil rate_limit_us at 40 ms instead of the 6.44 s default that
# while keeping interactive ramp-up responsive. Allow video group (dwm/xlocker) to switch # qcom-cpufreq derives from its UINT_MAX transition latency. Only rate_limit_us
# scaling_governor to powersave (200 MHz) while the screen is off. # exists on this kernel: up_rate_limit_us and down_rate_limit_us do not.
# Switching scaling_governor away from schedutil and back destroys/recreates
# this kobject, so bananarchy-display-power-sync re-applies the value on wake.
for gov_dir in /sys/devices/system/cpu/cpufreq/schedutil /sys/devices/system/cpu/cpufreq/policy*/schedutil /sys/devices/system/cpu/cpu*/cpufreq/schedutil; do for gov_dir in /sys/devices/system/cpu/cpufreq/schedutil /sys/devices/system/cpu/cpufreq/policy*/schedutil /sys/devices/system/cpu/cpu*/cpufreq/schedutil; do
if [ -d "$gov_dir" ]; then if [ -d "$gov_dir" ]; then
{ echo 40000 > "$gov_dir/rate_limit_us"; } 2>/dev/null || true { echo 40000 > "$gov_dir/rate_limit_us"; } 2>/dev/null || true
{ echo 40000 > "$gov_dir/up_rate_limit_us"; } 2>/dev/null || true
{ echo 10000 > "$gov_dir/down_rate_limit_us"; } 2>/dev/null || true
fi fi
done done
for gov_file in /sys/devices/system/cpu/cpufreq/policy*/scaling_governor /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do for gov_file in /sys/devices/system/cpu/cpufreq/policy*/scaling_governor /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
@@ -59,10 +59,10 @@ if [ -r /sys/class/power_supply/pm8916-lbc-chgr/constant_charge_current ]; then
fi fi
fi fi
# Enable IEEE 802.11 power save on WCN3620 wlan0 # Wi-Fi power save is enabled by NetworkManager (wifi.powersave=3) and by the
if command -v iw >/dev/null 2>&1; then # wcn36xx WIPHY_FLAG_PS_ON_BY_DEFAULT / dynamic_ps_timeout=200 kernel patch.
iw dev wlan0 set power_save on 2>/dev/null || true # Verified on-device: "iw dev wlan0 get power_save" reports "Power save: on".
fi # No iw binary is shipped, so no userspace iw call belongs here.
# Restore any persistent Engineering Menu Wi-Fi/BT MAC and IMEI override state # Restore any persistent Engineering Menu Wi-Fi/BT MAC and IMEI override state
if [ -x /usr/bin/bananarchy-engmenu-ctl ]; then if [ -x /usr/bin/bananarchy-engmenu-ctl ]; then
@@ -0,0 +1 @@
SUBSYSTEM=="backlight", ACTION=="change", RUN+="/bin/sh -c 'DISPLAY=:0 /usr/bin/bananarchy-display-power-sync >/dev/null 2>&1 &'"
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
# Keep DRM DPMS and the schedutil rate limit in sync with the backlight state.
# Invoked by the backlight udev rule (as root) and by sxmo_wm.sh display on
# (via doas). Every blank path writes brightness=0; every wake path restores it.
BR_PATH=/sys/class/backlight/backlight/brightness
RL_PATH=/sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
DPMS_PATH=
for _dpms in /sys/class/drm/card*-*/dpms; do
[ -r "$_dpms" ] && DPMS_PATH="$_dpms" && break
done
br=1
[ -r "$BR_PATH" ] && { read -r br < "$BR_PATH" 2>/dev/null || br=1; }
case "$br" in ''|*[!0-9]*) br=1 ;; esac
cur=On
[ -r "$DPMS_PATH" ] && { read -r cur < "$DPMS_PATH" 2>/dev/null || cur=On; }
if [ "$br" -eq 0 ]; then
[ "$cur" = "Off" ] || DISPLAY=:0 xset dpms force off >/dev/null 2>&1 || true
else
[ "$cur" = "On" ] || DISPLAY=:0 xset dpms force on >/dev/null 2>&1 || true
fi
# Switching scaling_governor away from schedutil and back recreates this
# kobject with the 6.44 s default, so re-apply the 40 ms value on every wake.
if [ "$br" -ne 0 ] && [ -w "$RL_PATH" ]; then
printf '40000\n' > "$RL_PATH" 2>/dev/null || true
fi
exit 0
@@ -102,9 +102,9 @@ fi
if ! pidof -s Xorg >/dev/null 2>&1; then if ! pidof -s Xorg >/dev/null 2>&1; then
if [ -f /tmp/bananarchy_ext_logging ]; then if [ -f /tmp/bananarchy_ext_logging ]; then
"$XORG_BIN" :0 -s 0 -dpms -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /tmp/Xorg.0.log >/dev/null 2>&1 </dev/null & "$XORG_BIN" :0 -s 0 -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /tmp/Xorg.0.log >/dev/null 2>&1 </dev/null &
else else
"$XORG_BIN" :0 -s 0 -dpms -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /dev/null -logverbose 0 >/dev/null 2>&1 </dev/null & "$XORG_BIN" :0 -s 0 -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /dev/null -logverbose 0 >/dev/null 2>&1 </dev/null &
fi fi
i=0 i=0
while [ "$i" -lt 40 ]; do while [ "$i" -lt 40 ]; do
@@ -114,8 +114,12 @@ if ! pidof -s Xorg >/dev/null 2>&1; then
sleep 0.05 sleep 0.05
i=$((i + 1)) i=$((i + 1))
done done
xset +dpms >/dev/null 2>&1 || true
xset dpms 0 0 0 >/dev/null 2>&1 || true
else else
xset s off s noblank s 0 0 >/dev/null 2>&1 || true xset s off s noblank s 0 0 >/dev/null 2>&1 || true
xset +dpms >/dev/null 2>&1 || true
xset dpms 0 0 0 >/dev/null 2>&1 || true
fi fi
SESSION_PID_FILE="/tmp/bananarchy-x11-session.pid" SESSION_PID_FILE="/tmp/bananarchy-x11-session.pid"
+2 -1
View File
@@ -20,7 +20,8 @@ envvars() {
defaults() { defaults() {
xsetroot -solid '#1c1c1c' xsetroot -solid '#1c1c1c'
xset s off s noblank s 0 0 -dpms xset s off s noblank s 0 0 +dpms
xset dpms 0 0 0
[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources [ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
if command -v feh >/dev/null 2>&1; then if command -v feh >/dev/null 2>&1; then
WP_FILE="/usr/share/wallpapers/bananarchy.png" WP_FILE="/usr/share/wallpapers/bananarchy.png"
+3
View File
@@ -53,12 +53,14 @@ xorgdisplay() {
printf 'powersave\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true printf 'powersave\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
fi fi
xset s off s noblank >/dev/null 2>&1 || true xset s off s noblank >/dev/null 2>&1 || true
xset dpms force off >/dev/null 2>&1 || true
;; ;;
on) on)
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
printf 'schedutil\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true printf 'schedutil\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
fi fi
xset s off s noblank >/dev/null 2>&1 || true xset s off s noblank >/dev/null 2>&1 || true
xset dpms force on >/dev/null 2>&1 || true
if [ -w /sys/class/backlight/backlight/bl_power ]; then if [ -w /sys/class/backlight/backlight/bl_power ]; then
printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
fi fi
@@ -88,6 +90,7 @@ xorgdisplay() {
fi fi
printf '%s\n' "${_restore_kbd:-255}" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true printf '%s\n' "${_restore_kbd:-255}" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
fi fi
doas -n /usr/bin/bananarchy-display-power-sync >/dev/null 2>&1 || true
;; ;;
"") "")
_cur_bl=14 _cur_bl=14