perf(host): the fullscreen window keeps its caption's style bits, so AMD's Windows driver no longer halves the GPU clock in fullscreen #2897
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2897
Loading…
Reference in a new issue
No description provided.
Delete branch "klimovich008/Longshot:perf/framed-fullscreen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
In borderless fullscreen on Windows, AMD's driver ran an RX 9070 XT at about half its clock in play: ~1,600 MHz, against ~3,060 MHz for the same game in a window. At 5120x1440 that cost a fifth of the frame rate. The cause is the window's style. A fullscreen window with no frame style bits gets the low clock. One that keeps its caption's style bits does not, whether Windows composites it or not. Composited fullscreen (a topmost window, one pixel short of the monitor, an invisible overlay) kept the low clock and added ~12 ms of display latency, so that is not the fix.
This PR keeps the caption's style bits (
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) on the fullscreen window and answersWM_NCCALCSIZEso the frame has no area. The client area is the whole monitor: same picture, same swapchain size, and the same flips (PresentMon: "Hardware: Independent Flip", tearing allowed). It is on by default on Windows;HOS_FULLSCREEN_FRAMED=0gives the plain window back. Linux/SDL is untouched.What else changed with it:
Longshot.FramedFullscreen) and the row reads it. Without that, a run savedfullscreen=0and the next start was windowed.Read first:
host/fullscreen_style.h(the rule),host/display.c(fullscreen_framed,set_fullscreen,wndproc'sWM_NCCALCSIZEandWM_SYSCOMMAND),gpu/vk/vk_menu.cppfullscreen_tick.Testing
Tested: Windows 11, RX 9070 XT, Adrenalin 26.11.2, 5120x1440 borderless fullscreen, Castle Town Market (child). The game runs fullscreen with the framed window. PresentMon 2.6.0 shows Independent Flip with tearing allowed in both arms. Repeated starts of the branch's head came up fullscreen from the saved setting (
display: fullscreen, swapchain 5120x1440, 104.8 and 102.9 fps at ~3,060 MHz, against 78.8 fps at 1,585 MHz with=0). That was before the last commit, which only flips the default.tests/test_fullscreen_monitor_platform.pyruns the style rule throughset_fullscreen: entry, a failed entry, a failed leave, a refused mark, and the default being on. Negative control: the plain style in place of the rule fails the framed checks; reading the switch as off by default fails the default check.host/display.ccompiled whole with the build's own flags (llvm-mingw), no errors.mise run lintpasses.tests/test_screensaver.pyandtests/test_switch_table.pyfail here and onmain28cb22b9ealike (the screensaver fixture lacksWM_NCDESTROYand four of the window procedure's newer calls;LONGSHOT_LAUNCHER_STARTUPhas no row inswitches.def).Still to test:
HOS_FULLSCREEN_FRAMED=0against the default, expecting no loss anywhere and a gain where the driver rests the clock (@Beanstalk)=0(by hand)=0(by hand)Measurements
Verdict: +27 % fps with the upscaler off and +22 % with FSR 4 on an RX 9070 XT at 5120x1440, from the GPU clock staying up. 3 of 3 pairs each, no frame over 100 ms in any run.
Setup: Windows 11, RX 9070 XT, Adrenalin 26.11.2, 5120x1440 borderless fullscreen, Castle Town Market child, uncapped (
HOS_FPS_MAX=240), 20 s window, 3 alternating pairs, game clock 0.998-1.002. Built onmain28cb22b9ewith six other open PRs merged (#2240, #2864, #2768, #2831, #2843, #2360), not onmainalone; the switch unset against=1in the same build. This PR's own numbers onmaincome from the Test Farm.HOS_FULLSCREEN_FRAMEDoffHow the cause was found (single runs, PresentMon): a small topmost window over fullscreen 83.6 fps @ 1,671 MHz, composed; an invisible full-screen window 86.9 @ 1,847, composed; borderless one pixel past or short of the monitor 84.5 / 83.0, composed;
WS_EX_LAYERED80.9 @ 1,614, Independent Flip; a 1280x720 window 97.4 @ 3,083; the framed fullscreen window 104.6 @ 3,074, Independent Flip. Composited arms added ~12 ms MsUntilDisplayed.VK_EXT_full_screen_exclusiveon or off and FIFO made no difference.Risks
HOS_FULLSCREEN_FRAMED=0(inconfig/longshot_env.txtor the environment) gives the old window; a revert is enough.HOS_FULLSCREEN_FRAMED=0restores both.longshot_options.inior the shader caches (no stamped file is touched).Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RX 9070 XT, Adrenalin 26.11.2, 5120x1440 borderless fullscreen, Castle Town Market child, uncapped: the framed fullscreen window starts fullscreen from the saved setting, presents as Hardware: Independent Flip with tearing allowed (PresentMon 2.6.0), and keeps the GPU at ~3,060 MHz (104.1 fps) where the plain window rested it at ~1,630 MHz (81.8 fps); 3 alternating pairs, upscaler off and FSR 4.
@Beanstalk Fullscreen, uncapped: does the framed fullscreen window (this PR's default) change fps or the GPU clock against the plain one, per vendor? On an RX 9070 XT with AMD's Windows driver the plain window rested the GPU at ~1,600 MHz and the framed one kept ~3,060 MHz (+27 % fps at 5120x1440). Every cell fullscreen (
fullscreen = 1),frame_rate_cap = 6(Uncapped),vsync = 2(Off),frame_generation = 0, the upscaler off, at the machine's native resolution. JudgeHOS_FULLSCREEN_FRAMED=0against the default (unset) in this PR's build with[[pass.compare]]onfps_meanandframetime_p99_ms, alongside the usual comparison with main. Hyrule Field fromkokiri-start, a 10 s warm-up, then 30 s measured, 3 runs a side.run_hitch_countandrun_frametime_max_msreport-only. A report-onlylog_match: expecteddisplay: framed fullscreenin the default arm anddisplay: fullscreenin both. Report the GPU clock or temperature history where the run records it. Targets: NVIDIA on Windows, Intel on Windows, AMD on Windows (AMD's driver), as many as are free; Linux is untouched by this PR. The question is which Windows drivers gain, and that none loses.Beanstalk test farm · 🔄 testing (2 of 3 reports so far)
Commit
5cdd195· approved by klimovich008 (reviewed) · dashboard⚠️ Note: Two runs per side are used instead of three because the two switch arms with three runs would exceed the farm's 60-minute limit.
⚠️ Note: GPU clock and temperature history are not available through the plan's probes; GPU pass time is recorded instead, but cannot establish the clock change.
⚠️ Note: The framed-fullscreen log line is expected only in the default PR arm, so the log probe is report-only; HDR, overlays, VRR and window-management interactions are not exercised.
Done (started 2026-11-30 13:25 UTC, last report 2026-11-30 21:17 UTC). Comment
@Beanstalkto run it again.windows+nvidia+windowwindows+amd+windowwindows+intel+windowfullscreen-field· frame time p99 (ms)HOS_FULLSCREEN_FRAMED=(reference)HOS_FULLSCREEN_FRAMED=0windows+nvidia+windowwindows+amd+windowwindows+intel+windowCouldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
windows+nvidia+window, report 1:Insufficient frame-time evidence for 4 required comparison(s). See rule results.What was tested
What will be tested · AI plan (
gpt-6.1-terra)On Windows NVIDIA, AMD and Intel systems, the plan compares the PR's default framed fullscreen window with its plain-window switch and with main in Hyrule Field. Each arm uses native output resolution, uncapped fullscreen, a 10-second warm-up and a 30-second measurement, with two runs per side. The PR fails for a crash or a frame-rate or p99 regression beyond 15%, including when the plain window outperforms the framed default by that margin. Hitch counts, worst frames and fullscreen log matches are reported without pass thresholds.
0(PR only).kokiri-start(settings dlss=6, vsync=2, fullscreen=1, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0; switchesRX_VK_AUTO_TUNE=0; in a hidden window (the present path runs)), then teleport to Hyrule Field, measure field for 30 s (after 10 s warm-up); 2 runs on each side for each of 2 cells (2 game starts a run).Measurements on `windows+nvidia+window`, for the PR description
Verdict: could not be judged on windows+nvidia+window (1 report): required frame-time comparison inconclusive (fewer than two usable starts per side).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce GTX 1070, 582.78.0AMD Ryzen 7 9800X3D 8-Core Processor, 64 GB RAMScene: fullscreen-field, from the repository's save kokiri-start (dlss=6, vsync=2, fullscreen=1, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); fullscreen-field: 2 game starts a side, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
HOS_FULLSCREEN_FRAMED0As Markdown for the PR description:
Measurements on `windows+amd+window`, for the PR description
Verdict: pass on windows+amd+window (1 report): no rule failed and no PR run crashed.
Hardware: 1: windows+amd+amd-proprietary+dgpu
AMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAMScene: fullscreen-field, from the repository's save kokiri-start (dlss=6, vsync=2, fullscreen=1, resolution=1, frame_rate_cap=6, quality_preset=0, frame_generation=0, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); fullscreen-field: 2 game starts a side, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)28cb22b5cdd195HOS_FULLSCREEN_FRAMED= (PR only)· field · frame rateHOS_FULLSCREEN_FRAMED= (PR only)· field · frame time (p99) (ms)HOS_FULLSCREEN_FRAMED=0 (PR only)· field · frame rateHOS_FULLSCREEN_FRAMED=0 (PR only)· field · frame time (p99) (ms)Flags and settings
HOS_FULLSCREEN_FRAMED0As Markdown for the PR description:
The testers' hardware
windows+nvidia+windowNVIDIA GeForce GTX 1070, 582.78.0AMD Ryzen 7 9800X3D 8-Core Processor, 64 GB RAMwindows+amd+windowAMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM@review
Recommendation: Approve. The code is ready: only testing is left. The reported RX 9070 XT gain is promising, but the comparison against the PR’s base and coverage of other Windows drivers are still outstanding. Recommend approval; not approved on the forge.
The change keeps caption style bits on the Windows fullscreen window to avoid a low GPU clock observed on an RX 9070 XT. It adds a fallback switch and updates the menu’s fullscreen detection, at the cost of compatibility with utilities that detect fullscreen from window styles.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
host/display.c:218: The new default affects every Windows fullscreen player, while its presentation and performance have only been reported on one AMD configuration. (more on the line) Do: Complete the requested Windows vendor comparisons and the listed HDR, VRR, overlay, monitor and fullscreen-transition checks against the plain window.Questions (2) (not confirmed from the code; they don't hold the recommendation)
host/fullscreen_style.h:26: Can you provide the relevant detection code or test results for those versions of Windhawk Auto Refresh Rate and WinXCorners?tests/test_fullscreen_monitor_platform.py:241: What current incorrect window-procedure behavior do these checks miss?Checks: Failing on this head, which is behind its base, where they pass:
CI / Third-party parts and guide screenshots (pull_request),CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request),CI / Website build and checks (pull_request),CI / Game-free checks (run_all.py, part 1/2) (pull_request),CI / Game-free checks (run_all.py, part 2/2) (pull_request).@rebase(or@fix) brings it up to date and runs them again; not held against it.More: does it help, other systems, switches, what was read
Does it help: Unproven against the PR base. The author reports three alternating pairs on an RX 9070 XT: 81.8 to 104.1 fps without upscaling and 69.4 to 84.6 fps with FSR 4, with p99 frame time improving in both cases. Those runs used a build containing six other open PRs and compared switch settings within that build; the requested base-versus-head Test Farm results are pending.
Other systems: The Windows window style can affect driver presentation, HDR, VRR, overlays, capture and fullscreen-detecting utilities. The author reports Independent Flip on the tested AMD setup, but the listed NVIDIA, Intel, HDR, VRR, overlay and window-transition runs remain outstanding. Linux uses the existing SDL fullscreen path; the shared menu helper retains its previous caption-based result there.
Switches: HOS_FULLSCREEN_FRAMED is added, default on for Windows; 0 restores the plain borderless window. It is in switches.def, but the default breaks known fullscreen-detecting utilities and has not yet been measured across the Windows drivers it affects.
Reviewed:
5cdd195fccagainst28cb22b9ed: Read AGENTS.md, CONTRIBUTING.md, the PR template and standards; the diff and commit messages; host/display.c, host/fullscreen_style.h, tests/screensaver_test.c and tests/test_fullscreen_monitor_platform.py; and the changed menu function and surrounding fullscreen callers. Skimmed the remainder of vk_menu.cpp, the switch table and switch documentation. docs/review-checklist.md is absent. No recorded runs or generated files changed.; nothing run (a code review).Checked and fine:
Testing: No code, tests or project scripts were run for this review. The author reports an in-game Windows AMD run and identifies two checks that also fail on the base; the supplied CI results have no head-only failures.
Overlaps and merge order: No overlap information was supplied; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -212,0 +215,4 @@static int framed_fullscreen;/* HOS_FULLSCREEN_FRAMED (fullscreen_style.h): read once, said once when it asks for anything */static int fullscreen_framed(void) {static int mode = -1;L2 (should fix): The new default affects every Windows fullscreen player, while its presentation and performance have only been reported on one AMD configuration.
When: NVIDIA and other AMD Windows drivers, as well as HDR, VRR and overlay configurations, can select presentation behavior from the changed window style; their behavior is not covered by the reported run.
Do: Complete the requested Windows vendor comparisons and the listed HDR, VRR, overlay, monitor and fullscreen-transition checks against the plain window.
WIP: perf(host): the fullscreen window keeps its caption's style bits, so AMD's Windows driver no longer halves the GPU clock in fullscreento perf(host): the fullscreen window keeps its caption's style bits, so AMD's Windows driver no longer halves the GPU clock in fullscreen