Skip to content

Drop the KGSL PWR_MAX constraint patch so the GPU governor can idle - #22

Merged
xXJSONDeruloXx merged 2 commits into
mainfrom
drop-gpu-pwr-max
Nov 13, 2026
Merged

xXJSONDeruloXx merged 2 commits into
mainfrom
drop-gpu-pwr-max

Conversation

@xXJSONDeruloXx

@xXJSONDeruloXx xXJSONDeruloXx commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

perf_pwr_max.py makes every Turnip queue request the GPU's top power level, so the Adreno governor can't clock down while anything renders. This removes the patch, its series entry, the packaging check that required it, and the release-notes line.

What the patch did

  • Created each KGSL context with KGSL_CONTEXT_PWR_CONSTRAINT and set KGSL_CONSTRAINT_PWR_MAX on it right after creation.
  • Flagged every submission with KGSL_CMDBATCH_PWR_CONSTRAINT.
  • Set the Max constraint again every 1000 submissions.

Each flagged submission makes the kernel switch the constraint on at level 0 (kgsl_pwrctrl_set_constraint), so the GPU stays at its maximum regardless of load.

Evidence

On an AYN Thor (Adreno 740, rooted), a DroidDeck session with Steam's UI open:

  • A kgsl_user_pwrlevel_constraint / kgsl_constraint trace showed Pwrlevel Max requests from every GPU client in the session (steam, steamwebhelper, Xwayland, gamescope, xdg-desktop-portal), plus the app's own compositor, which loads DD-Turnip as its display driver. kgsl_constraint ... constraint_value=0 status=ON fires continuously.
  • With the constraint ioctl and the submission flag stripped (guest LD_PRELOAD shim, system driver for the display), the trace showed no constraint requests. The GPU went from 680 MHz (maximum) to 401 MHz at 4-6% load.

On an AYANEO Pocket FIT Elite (Adreno 830), the GPU sat at 832-1100 MHz at 2-3% load in Steam's UI and in Sonic Mania's menu. With the same two changes it idled at 160 MHz.

What it costs and saves

In Sonic Mania the power difference was within noise (8.34 W vs 8.43 W on the Pocket FIT Elite), because that game barely uses the GPU and its main thread dominates. The saving shows up where the GPU idles between short bursts: Steam's UI, menus, light and frame-capped games. Removing the floor also gives the governor back its thermal headroom.

The risk is frame-time latency on bursty loads, where the governor ramps up from a low level. I haven't benchmarked a GPU-heavy game with and without the patch. That's worth checking before release.

Test plan

  • python -m unittest discover -s tests (13 tests pass)
  • Kernel trace on the Thor: constraint requests present with the patch, absent without it
  • Build a bundle and confirm packaging succeeds without the PWR_MAX marker
  • A GPU-heavy game, A/B with and without the patch: fps, 1% lows, power

Also in this PR

Mesa main changed the SSBO emulation condition in tu_lower_io into a multi-line test, so linux/0001-tu-mesh-shader-emulation.patch stopped applying at tu_shader.cc:1604. The mesh ring inline UBO hunk now anchors on the unchanged ir3_const_alloc(... INLINE_UNIFORM_ADDRS ...) line. Same 14 files and 1954 added lines as before. The android and linux series both apply to Mesa main beaf3192c2.

@xXJSONDeruloXx
xXJSONDeruloXx merged commit fa26021 into main Nov 13, 2026
1 check passed
@xXJSONDeruloXx
xXJSONDeruloXx deleted the drop-gpu-pwr-max branch November 13, 2026 16:03
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.

1 participant