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

Open
Bebrik229 wants to merge 1 commit from upstream-pr/2569 into main
Bebrik229 commented 2026-11-25 16:03:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bebrik229 on 2026-11-25T16:03:46Z.


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)
<!-- greyfinch-sync:Marvisak/VIctory:issue:6608519960 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2569). Originally posted by [Bebrik229](https://github.com/Bebrik229) on 2026-11-25T16:03:46Z. --- ## 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`)
upstream-sync changed title from [PR #2569] HLE: opt out of Windows 11 Efficiency Mode throttling in use_console_… to [PR #2569] HLE: opt out of Windows 11 Efficiency Mode throttling in use_console_timers 2026-11-25 17:04:39 +00:00
Marvisak commented 2026-11-25 20:06:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T19:18:22Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172114055 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2569#issuecomment-7172114055). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T19:18:22Z. --- <!-- 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)_
Kajanos commented 2026-11-26 01:03:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Kajanos on 2026-11-26T00:07:26Z.


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)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7178419328 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2569#issuecomment-7178419328). Originally posted by [Kajanos](https://github.com/Kajanos) on 2026-11-26T00:07:26Z. --- **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)
cloph-dsp commented 2026-11-27 13:32:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T13:32:19Z.


Independent local verification of PR #2569 (HLE: opt out of Windows 11 Efficiency Mode throttling in use_console_timers).

  • Windows, Rust 1.100.0/MSVC, cargo test --locked, CARGO_BUILD_JOBS=2, per-worktree CARGO_TARGET_DIR=D:\Victory-Contrib\target-2569-watch.
  • Head 098bdbe59a4887f904f25de8a4e73c1572c99f0f, merge base 67e8ae1401df112248aed36d0024483181b718b7.
  • Command: cargo test --locked -p victory-hle --lib -- --exact runtime::tests::efficiency_mode_opt_out_defaults_on_and_respects_env --test-threads=1 --quiet
  • Result: 1 passed, 0 failed, 146 filtered, exit 0.
  • Negative control: git grep -F -c 'runtime::tests::efficiency_mode_opt_out_defaults_on_and_respects_env' 67e8ae14 -- crates/victory-hle/src → 0 hits (exit 1).
  • git diff --check 67e8ae14 HEAD clean (exit 0).

Only the named synthetic test was replayed; no real Windows 11 Efficiency Mode behaviour was exercised. GPU/driver: N/A for this CPU-only HLE test. AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7219607421 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2569#issuecomment-7219607421). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T13:32:19Z. --- Independent local verification of PR #2569 (HLE: opt out of Windows 11 Efficiency Mode throttling in use_console_timers). - Windows, Rust 1.100.0/MSVC, `cargo test --locked`, `CARGO_BUILD_JOBS=2`, per-worktree `CARGO_TARGET_DIR=D:\Victory-Contrib\target-2569-watch`. - Head `098bdbe59a4887f904f25de8a4e73c1572c99f0f`, merge base `67e8ae1401df112248aed36d0024483181b718b7`. - Command: `cargo test --locked -p victory-hle --lib -- --exact runtime::tests::efficiency_mode_opt_out_defaults_on_and_respects_env --test-threads=1 --quiet` - Result: 1 passed, 0 failed, 146 filtered, exit 0. - Negative control: `git grep -F -c 'runtime::tests::efficiency_mode_opt_out_defaults_on_and_respects_env' 67e8ae14 -- crates/victory-hle/src` → 0 hits (exit 1). - `git diff --check 67e8ae14 HEAD` clean (exit 0). Only the named synthetic test was replayed; no real Windows 11 Efficiency Mode behaviour was exercised. GPU/driver: N/A for this CPU-only HLE test. AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt used.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2569:upstream-pr/2569'
git switch 'upstream-pr/2569'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2569'
git switch 'upstream-pr/2569'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2569'
git switch 'upstream-pr/2569'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2569'
git switch 'main'
git merge --squash 'upstream-pr/2569'
git switch 'main'
git merge --ff-only 'upstream-pr/2569'
git switch 'main'
git merge 'upstream-pr/2569'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2567
No description provided.