hle(display): fall back to no-op deferral when PowerSetRequest returns ERROR_NOT_SUPPORTED #1155

Closed
geiyiliyabumo wants to merge 1 commit from upstream-pr/1155 into main
geiyiliyabumo commented 2026-11-24 16:16:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T16:16:59Z.


Summary

Fixes #727

Full verification details and change notes are documented in #727 (commit 5c37528, based on main ffe310e).

 crates/victory-hle/src/modules/display.rs | 114 ++++++++++++++++++++++++++----
 1 file changed, 102 insertions(+), 12 deletions(-)

Verification (Windows 11 x64 MSVC)

  • rustfmt --edition 2024 --check on edited files: PASS
  • cargo xtask policy: PASS (zero game files/data)
  • cargo clippy --all-targets --locked -- -D warnings (default + --features diagnostics where applicable): PASS
  • Targeted & crate unit/GPU tests: PASS

AI-assisted; synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6586292688 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1155). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T16:16:59Z. --- ### Summary Fixes #727 Full verification details and change notes are documented in #727 (commit `5c37528`, based on `main` `ffe310e`). ```text crates/victory-hle/src/modules/display.rs | 114 ++++++++++++++++++++++++++---- 1 file changed, 102 insertions(+), 12 deletions(-) ``` ### Verification (Windows 11 x64 MSVC) - `rustfmt --edition 2024 --check` on edited files: **PASS** - `cargo xtask policy`: **PASS** (zero game files/data) - `cargo clippy --all-targets --locked -- -D warnings` (default + `--features diagnostics` where applicable): **PASS** - Targeted & crate unit/GPU tests: **PASS** *AI-assisted; synthetic tests only, no game files.*
Zipettte commented 2026-11-24 18:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T18:01:11Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 5c37528: cargo test -p victory-hle passes, 98 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140039124 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1155#issuecomment-7140039124). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T18:01:11Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 5c37528: `cargo test -p victory-hle` passes, 98 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Marvisak commented 2026-11-25 02:05:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:19:40Z.


Automated triage for the maintainers.

Merge candidate. This fixes #727. On some hosts (headless sessions, RDP, no display route), PowerSetRequest(…, PowerRequestDisplayRequired) fails with ERROR_NOT_SUPPORTED, so acquire_deferral in crates/victory-hle/src/modules/display.rs failed and sdr_and_display_deferrals failed with it.

Now finish_failed_deferral closes the request in every failure case. For ERROR_NOT_SUPPORTED only, it logs once and returns S_OK with a non-null sentinel handle. close_deferral_with skips the OS calls for that sentinel and for null. Every other error still returns HRESULT_FROM_WIN32, with GetLastError read before CloseHandle. The three new tests use closures in place of the OS calls, so they pass on any host.

This overlaps #1664. That PR hands back a null handle with S_OK, which a title may treat as a failure. The sentinel here is the safer choice, and this branch merges cleanly.

CI: not run.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149433926 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1155#issuecomment-7149433926). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:19:40Z. --- <!-- victory-triage v1 head=5c375286acb5e42f9a620a40fdf0f588a8b83d00 verdict=merge-candidate at=2026-11-25T01:19:39Z --> Automated triage for the maintainers. **Merge candidate.** This fixes #727. On some hosts (headless sessions, RDP, no display route), `PowerSetRequest(…, PowerRequestDisplayRequired)` fails with `ERROR_NOT_SUPPORTED`, so `acquire_deferral` in `crates/victory-hle/src/modules/display.rs` failed and `sdr_and_display_deferrals` failed with it. Now `finish_failed_deferral` closes the request in every failure case. For `ERROR_NOT_SUPPORTED` only, it logs once and returns `S_OK` with a non-null sentinel handle. `close_deferral_with` skips the OS calls for that sentinel and for null. Every other error still returns `HRESULT_FROM_WIN32`, with `GetLastError` read before `CloseHandle`. The three new tests use closures in place of the OS calls, so they pass on any host. This overlaps #1664. That PR hands back a null handle with `S_OK`, which a title may treat as a failure. The sentinel here is the safer choice, and this branch merges cleanly. CI: not run. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 22:02:49 +00:00
Marvisak commented 2026-11-25 22:04:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T21:59:24Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because the issue it fixes (#727, the unit test failing on hosts that refuse display power requests) was fixed in main by efe102ed, and the runtime change makes no difference to the title: its one acquire site ignores the returned HRESULT and its one close site only closes a non-null handle, so a failed acquire already ends in a skipped close. Merged with main it also leaves the NOT_SUPPORTED arm of sdr_and_display_deferrals unreachable.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175795531 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1155#issuecomment-7175795531). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T21:59:24Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because the issue it fixes (#727, the unit test failing on hosts that refuse display power requests) was fixed in `main` by efe102ed, and the runtime change makes no difference to the title: its one acquire site ignores the returned HRESULT and its one close site only closes a non-null handle, so a failed acquire already ends in a skipped close. Merged with `main` it also leaves the NOT_SUPPORTED arm of `sdr_and_display_deferrals` unreachable. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

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!1155
No description provided.