HLE: opt out of Windows 11 Efficiency Mode throttling in use_console_timers #2569

Open
github-bot wants to merge 1 commit from github-bot/gh-2569 into main AGit
Owner

@⁠Bebrik229 on GitHub · 2026-11-25 16:03 UTC · original
Bebrik229:hle/win11-efficiency-mode → main · +24 −1 · 1 files · 1 commits · open

Summary

Extends victory_hle::runtime::use_console_timers() to also opt out of Windows 11 Efficiency Mode CPU execution-speed throttling (PROCESS_POWER_THROTTLING_EXECUTION_SPEED) alongside PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION.

Why

In use_console_timers(), setting PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION with StateMask: 0 keeps 1 ms timeBeginPeriod(1) timer precision when the window is unfocused, backgrounded, or minimized, but Windows 11 can still throttle process execution speed (EcoQoS / reduced clocks and E-core scheduling). Setting PROCESS_POWER_THROTTLING_EXECUTION_SPEED in ControlMask with StateMask: 0 disables execution-speed throttling as well.

Setting VICTORY_EFFICIENCY_MODE=1 preserves the previous behavior (leaves execution-speed throttling up to the OS).

Changes

  • crates/victory-hle/src/runtime.rs:
    • Add pure helper efficiency_mode_opt_out(value: Option<&str>) -> bool.
    • Include PROCESS_POWER_THROTTLING_EXECUTION_SPEED in PROCESS_POWER_THROTTLING_STATE::ControlMask unless VICTORY_EFFICIENCY_MODE=1.
    • Add unit test covering default, "0", and "1".

Verification

  • cargo test -p victory-hle --lib runtime::tests: 5 passed, 0 failed (142 filtered out)
  • cargo xtask policy: passed (asset policy: 184 files ok)
**@⁠Bebrik229** on GitHub · 2026-11-25 16:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2569) `Bebrik229:hle/win11-efficiency-mode` → `main` · +24 −1 · 1 files · 1 commits · open ## Summary Extends `victory_hle::runtime::use_console_timers()` to also opt out of Windows 11 Efficiency Mode CPU execution-speed throttling (`PROCESS_POWER_THROTTLING_EXECUTION_SPEED`) alongside `PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION`. ## Why In `use_console_timers()`, setting `PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION` with `StateMask: 0` keeps 1 ms `timeBeginPeriod(1)` timer precision when the window is unfocused, backgrounded, or minimized, but Windows 11 can still throttle process execution speed (`EcoQoS` / reduced clocks and E-core scheduling). Setting `PROCESS_POWER_THROTTLING_EXECUTION_SPEED` in `ControlMask` with `StateMask: 0` disables execution-speed throttling as well. Setting `VICTORY_EFFICIENCY_MODE=1` preserves the previous behavior (leaves execution-speed throttling up to the OS). ## Changes - `crates/victory-hle/src/runtime.rs`: - Add pure helper `efficiency_mode_opt_out(value: Option<&str>) -> bool`. - Include `PROCESS_POWER_THROTTLING_EXECUTION_SPEED` in `PROCESS_POWER_THROTTLING_STATE::ControlMask` unless `VICTORY_EFFICIENCY_MODE=1`. - Add unit test covering default, `"0"`, and `"1"`. ## Verification - `cargo test -p victory-hle --lib runtime::tests`: **5 passed, 0 failed** (`142 filtered out`) - `cargo xtask policy`: passed (`asset policy: 184 files ok`)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:09:29 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 19:18 UTC · original

Automated triage for the maintainers.

Needs work. This adds PROCESS_POWER_THROTTLING_EXECUTION_SPEED to the ControlMask in use_console_timers (crates/victory-hle/src/runtime.rs) with StateMask 0, which opts the process out of EcoQoS. A new switch, VICTORY_EFFICIENCY_MODE=1, turns the opt-out off. The API use is correct. CI: check passing.

Changes needed:

  • The new helper efficiency_mode_opt_out sits between use_console_timers and its doc comment. The comment now documents the helper, and use_console_timers gets a second, overlapping doc. Please keep the doc on use_console_timers and extend it.
  • The let execution = if efficiency_mode_opt_out(std::env::var(...)... line is wider than rustfmt allows.
  • Either drop the new environment switch or say why it is needed. It is not documented anywhere.
  • Please show that the opt-out helps, for example audio or frame cadence measured with and without it while the window is in the background.

Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 19:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2569#issuecomment-7172114055) <!-- victory-triage v1 head=098bdbe59a4887f904f25de8a4e73c1572c99f0f verdict=needs-work at=2026-11-25T19:22:30Z --> Automated triage for the maintainers. **Needs work.** This adds `PROCESS_POWER_THROTTLING_EXECUTION_SPEED` to the `ControlMask` in `use_console_timers` (`crates/victory-hle/src/runtime.rs`) with `StateMask` 0, which opts the process out of EcoQoS. A new switch, `VICTORY_EFFICIENCY_MODE=1`, turns the opt-out off. The API use is correct. CI: `check` passing. Changes needed: - The new helper `efficiency_mode_opt_out` sits between `use_console_timers` and its doc comment. The comment now documents the helper, and `use_console_timers` gets a second, overlapping doc. Please keep the doc on `use_console_timers` and extend it. - The `let execution = if efficiency_mode_opt_out(std::env::var(...)...` line is wider than rustfmt allows. - Either drop the new environment switch or say why it is needed. It is not documented anywhere. - Please show that the opt-out helps, for example audio or frame cadence measured with and without it while the window is in the background. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Kajanos on GitHub · 2026-11-26 00:07 UTC · original

Windows 11 / NVIDIA test run, head 098bdbe59a merged onto main 63bcca43c6.

Setup: Windows 11 Home build 26300, RTX 5080, NVIDIA 621.40, rustc 1.98.1 MSVC, VS 2022 Build Tools, Windows SDK 10.0.26100 (dxil.dll from the SDK).

  • cargo test --locked -p victory-hle: 152 passed, 1 failed.
  • The one failure is lifecycle::tests::showing_a_title_window_shows_its_stand_in, and it also fails on main in this run. The tests ran over SSH, i.e. in session 0 with no interactive desktop, so the window can't be shown. On the desktop session the same test passes on main (12/12 lifecycle). This PR doesn't touch lifecycle.

Not run: the retail title, clippy, and other crates.

AI-assisted (Claude Code)

**@⁠Kajanos** on GitHub · 2026-11-26 00:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2569#issuecomment-7178419328) **Windows 11 / NVIDIA test run**, head `098bdbe59a` merged onto `main` `63bcca43c6`. Setup: Windows 11 Home build 26300, RTX 5080, NVIDIA 621.40, rustc 1.98.1 MSVC, VS 2022 Build Tools, Windows SDK 10.0.26100 (`dxil.dll` from the SDK). - `cargo test --locked -p victory-hle`: 152 passed, 1 failed. - The one failure is `lifecycle::tests::showing_a_title_window_shows_its_stand_in`, and it also fails on `main` in this run. The tests ran over SSH, i.e. in session 0 with no interactive desktop, so the window can't be shown. On the desktop session the same test passes on `main` (12/12 `lifecycle`). This PR doesn't touch lifecycle. Not run: the retail title, clippy, and other crates. AI-assisted (Claude Code)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2569/head:github-bot/gh-2569'
git switch 'github-bot/gh-2569'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2569'
git switch 'github-bot/gh-2569'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2569'
git switch 'github-bot/gh-2569'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2569'
git switch 'main'
git merge --squash 'github-bot/gh-2569'
git switch 'main'
git merge --ff-only 'github-bot/gh-2569'
git switch 'main'
git merge 'github-bot/gh-2569'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2569
No description provided.