WIP: fix(host): the Output resolution none chose fits the window it is shown in #2542
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2542
Loading…
Reference in a new issue
No description provided.
Delete branch "dazemc/Longshot:fix/output-window-default"
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
A new install's Output resolution was worked out from the screen alone: the game's 2560x1440, or the screen's size where
that is smaller. A windowed start drew that whole picture into a much smaller window and let the present scale it down, so
a 1080p screen in a 1280x720 window drew 1920x1080: 2.25x the pixels for no more detail, all of them drawn.
This fits the size nobody chose to the window's client area instead: its shape kept, each side a whole multiple of 8 and at
least the game's 640x360. A size the player asked for is untouched — an
output_res=line,HOS_OUTPUT_RES, or a rowpicked in the menu still draws larger than the window when it says so, and the Window scaling filter scales it down as
before. A picture the Aspect ratio widens keeps the boot's size. The Insert menu's first start now saves the size the run
actually drew (
MkwVkHost.output_size, API version 49) instead of working the default out again, so the row and the runcannot part.
This is a policy change, not a defect:
gpu/vk/auto_settings.h:37-39says the Auto preset deliberately never picks theoutput resolution, and
host/hos_wide_size.h:18-30fitted to the screen, not the window. The trade is real — a smallerpicture than the screen is a quality choice someone may not want, especially on a high-DPI display where the old default
could look sharper in an enlarged window. The change applies only when nobody asked: a chosen size, a chosen row, and every
existing install (whose first start already saved
output_res=) are left exactly as they are. If the maintainers wouldrather keep the old default, that is a legitimate rejection, and a revert of this one commit is enough.
To see the old behaviour on
main: on a 1080p or larger screen, start windowed with a profile that has nooutput_res=line. The log says
oe: output resolution 1920x1080 (none chosen: the screen's, smaller than the game's 2560x1440)(or2560x1440 on a larger screen) and the present scales that picture into the window.
Read first:
host/hos_wide_size.h(hos_output_default),host/nn_applet.c(output_mode),host/display.candhost/posix/display_sdl.c(hos_display_client_size),gpu/vk/vk_menu.cpp(menu_init).Rebase status (2026-11-25, current):
9f5d17771→ca9df7502ontomain @ 8f7300756701b7c9a278e576bb075ac20e622a32. Stable patch-id747aefab4230ee24ce3778bbf50459335cbf000bis unchanged and main's old-base→new-main file intersection with this PR is empty. The evidence already named below (suite, platform, in-game and measurement, as applicable) therefore still stands at the historical heads that produced it. Earlier rebase notes are history; where they say "this head", they mean the evidence commit named beside that run, notca9df7502. The suite re-run already started at9f5d17771; because the diff and intersection meet the rule above, its result will carry toca9df7502, but it is not claimed until it finishes.Testing
Tested: Linux, NVIDIA RTX 4070 Ti, Vulkan 1.4, driver 620.73.04; windowed start from
assets/saves/kokiri-start,KokiriForest_Child,HOS_WINDOW_SIZE=1280x720,HOS_AUDIO=0,RX_VK_PASS_TIMING=1, and a profile with nooutput_res=line at launch. The default drew 1920x1080 (oe: output resolution 1920x1080 (none chosen: the window's, or the screen's where smaller), log sha25633e6d9a1d31bd23fb6687dab421f38e0be08f0b4931c8a3bc08f0e906d192622) at 60.0 fps,vk: 5.66 ms a frame in all. The same build, window and save withHOS_OUTPUT_RES=2560x1440— main's answer on this3840x2160 screen — drew 2560x1440 (
oe: output resolution 2560x1440, log sha256dcfe3eafe9a42db20ffed78b37150ed317c1fde90e971cf0610ec749672793ec) at 60.0 fps,vk: 6.87 ms a frame in all. Both runsare at
1084d099c, the branch before its rebase. The rebased head01881ab6ehas a byte-identical change diff(
sha256 797b6ed03343f5780e23e96a9e7dd7952e17ffccd0f62ccd060d33c8ba76f14b), and the one base commit between them(
7eb53d1a0) changes only.forgejo/,builder/crates/anddocs/user/common-issues.md, none of the files this changetouches, so the run describes this change's code.
The PR's own test fails on
mainwith the reason in the checklist below and passes at this head; that is the game-freecheck, not a substitute for the runs above.
The suite at
01881ab6ran:832 passed, 3 failed, 8 skipped in 504 s. Two failures aremain's —bc_claimundeclared in the display-startup cut (
host/hos_main.c:978, fixed by#2539, not here) andtest_title_card_strips.py'soot_patchesimport. The third was this change's fixture:tests/test_screensaver.pycutsonly
wndprocout ofhost/display.c, and the newpublish_client_sizecall inWM_SIZEhad no declaration in thefixture, so it failed to compile under
-Werror. The fixture now mocks it with the production signature —WM_SIZEisnever sent, and the production call stays in the cut procedure — at
9f5d17771, where the fixture passes. A suite re-run at9f5d17771is in progress; its result carries toca9df7502under the empty-intersection rule above.Still to test:
mise run test: the run at01881ab6had twomainfailures and the fixture defect above, now fixed; the re-run at9f5d17771is in progress and carries toca9df7502under the empty-intersection rule (by hand, suite owner)mainbuild (by hand)Measurements
Verdict: On this PC the new default drew 1920x1080 where the old default drew 2560x1440 in the same window, and
vk: a frame in allfell 6.87 → 5.66 ms (−1.21 ms, −17.6 %) with 60.0 fps on both sides (this PC is game-pacedhere, so the saving is not visible as fps). On a GTX 1650 the same choice measured 34.6 → 44.6 fps in an adjacent pair
at 720p against 1080p of output and an identical 3D size; that pair is an earlier measurement on the existing whole-pack
build, not this branch on that box.
Setup: Linux, NVIDIA RTX 4070 Ti, Vulkan 1.4, driver 620.73.04;
assets/saves/kokiri-start,KokiriForest_Child,HOS_WINDOW_SIZE=1280x720,HOS_AUDIO=0, Auto (this PC) preset, nooutput_res=line at launch,RX_VK_PASS_TIMING=1.vk: a frame in allis the log's own mean of the timed command buffers in play.7eb53d1a0vk: a frame in all, msBaseline: the Before column is this branch's build with
HOS_OUTPUT_RES=2560x1440, which draws exactly main's default onthis 3840x2160 screen (main's
hos_output_defaultpicks the game's 2560x1440);mainwas not rebuilt for the pair. TheAfter commit is the head that ran; the rebased head
01881ab6ehas the byte-identical diff named under Testing.Risks
fewer pixels. This is the whole point of the change and the reason to reject it if the maintainers disagree. It applies
only when nobody asked.
output_res=line,HOS_OUTPUT_RES, or a picked row is drawn exactly as before, larger than the windowwhen it says so (the Window scaling filter still scales it down). Existing installs have such a line, saved on their
first start, so only a new install (no line) takes the new default.
or wide screens therefore behave as before.
HOS_HEADLESS=1) answers 0 at once and keeps the screen's size; a window that is late iswaited for up to 2 s, once. If that wait expires the screen's answer stands and the log says
(none chosen: the screen's, the window not made yet).output_res=line (or a revert) is the way back. No save, cache orlongshot_options.inikey is renamed; a first start still saves its Output resolution, just the fitted one.Checklist
Ready for review
main; the title is a Conventional Commit. — Rebased headca9df7502is directly onmain @ 8f7300756701b7c9a278e576bb075ac20e622a32; the preserved diff is the single topic described in Summary.mise run testpasses (any failure that also fails onmainis named). — the suite at01881ab6ran (832 passed, 3 failed, 8 skipped): two failures aremain's, the third was the screensaver fixture, fixed in9f5d17771; the re-run at9f5d17771is in progress and carries toca9df7502only when it finishes.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. —tests/test_output_resolution.pyonmain7eb53d1a0failshost/hos_wide_size.h: the Output resolution none chose is worked out without the window it is shown in: a 720-high window on a 1080p screen draws 1920x1080 and scales it down(exit 1); it passes at01881ab6e.tests/that reads changed source is updated, not weakened.MKWVK_API_VERSIONbumped (MkwVkHostorMkwVkRendereringpu/vk/vk_api.hchanged). — 48 → 49 forMkwVkHost.output_size.mainand here, for a change that shows on screen. — the shots on disk are this build at 2560x1440 and at the fitted 1920x1080, not amainbuild; amain-vs-here pair is owed.docs/user/graphics-and-controls.mdlines 39 and 86, and the "size you pick is kept" sentence at line 43.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold. — Awaiting CI on the current head; this update does not claim a CI run.Tested in game: Linux (Arch), NVIDIA RTX 4070 Ti, Vulkan 1.4, driver 620.73.04: windowed start from kokiri-start in KokiriForest_Child with a profile carrying no output_res= line drew 1920x1080 in the window at 60.0 fps, 'vk: 5.66 ms a frame in all', against 6.87 ms with HOS_OUTPUT_RES=2560x1440 at the same window and scene (log sha256 33e6d9a1d31bd23fb6687dab421f38e0be08f0b4931c8a3bc08f0e906d192622 and dcfe3eafe9a42db20ffed78b37150ed317c1fde90e971cf0610ec749672793ec).
Possibly related, for context:
Suite at
01881ab6e76baba30c02779a00f925c0f4e83f7f: 832 passed, 3 failed, 8 skipped in 504 s (linux, 5 at once), exit 1; logprrefresh-logs/suite-2542-01881ab6.log, sha256ec0dcf0108af81ac2d117b65f4884e588ca094780782376d8fa36e288cb17e67,.head= that sha.FAIL under Amendment 2 — one failing id is not a base failure:
publish_client_sizeis added by this branch (host/display.c:48,host/posix/display_sdl.c:75; no hit anywhere atbe663a08a), and the screensaver fixture does not declare it, so the fixture does not build at this head. Base check in a cleanbe663a08aworktree:1 passed, 0 failed, 0 skipped(prrefresh-logs/base-be663a08a-screensaver.log, sha256ff1e4d265dfe5d03c2b97ecb5113593cab4bd4ce45a7440b8746674fd3e8585e). So this id passes at the base and fails at the head — the change's defect, notmain's.The other two are the known base pair and exempt:
tests/test_display_startup_failure.py(bc_claim; the generated line shifted 82→83 because this branch inserts a line into the cut source, same class) andtests/test_title_card_strips.py(oot_patches).Stays WIP until the fixture declaration is fixed; suite to be re-run at the new head.
9f5d177710ca9df75026Rebased
9f5d17771toca9df7502on main8f7300756; patch-id unchanged and intersection empty. Existing evidence stands; suite at old head still running, Windows and screenshot boxes remain unticked. Removed distro branding.@rebase
I rebased this pull request onto
main(404c7ed3e9): the new head is3677731c05.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
ca9df750263677731c05@review
Recommendation: Request changes. The new host-to-menu handoff can save the wrong resolution or persist a temporary environment override. The window-size publication also permits inconsistent dimensions across threads.
The change fits an unchosen output resolution to the initial window, reducing pixels rendered for a new windowed install. It adds cross-thread startup coordination and changes what the menu saves, with correctness problems in those paths.
Blocking (2): must change before merging.
gpu/vk/vk_menu.cpp:4367: The host callback returns the game's base dimensions for the reduced output mode, not the output resolution the menu must save. (more on the line) Do: Expose the selected output resolution separately from the base dimensions used by the game's scaling patch, and save 2048x1152 for the reduced mode. Exercise the actual menu initialization for this case.gpu/vk/vk_menu.cpp:4367: The initial saved menu value now incorporates HOS_OUTPUT_RES before the environment override is applied. (more on the line) Do: Initialize the saved choice from the unoverridden default, and apply HOS_OUTPUT_RES only through env_override. Add a first-start test that removes the override on the next launch.Should fix (2): not blocking, but worth doing before merging.
host/posix/display_sdl.c:88: Width and height are published independently, and the reader treats them as one window size. (more on the line) Do: Publish and read the dimensions as one atomic snapshot or protect the pair with a lock, including the fullscreen publication on both platforms.host/nn_applet.c:220: output_px is read outside the lock while another thread can write it; volatile does not make that access atomic or synchronize it. (more on the line) Do: Return the requested dimension while holding output_lock, or use a properly synchronized atomic snapshot and keep the mode and dimensions in the same snapshot.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1, L2, L3 and L4.Checks: Still running:
PR description / Title and description (pull_request_target).More: does it help, other systems, switches, what was read
Does it help: Unproven. The reported Linux run reduced mean Vulkan command-buffer time from 6.87 to 5.66 ms at 60 fps, but used one run per setting in the PR build rather than repeated interleaved runs against the base. The GTX 1650 result was not measured on this branch.
Other systems: The host change affects Windows and Linux startup, fullscreen and windowed modes, the menu's saved settings, and render-target sizing. The supplied game run covers Linux on NVIDIA; Windows, AMD and Steam Deck coverage and a base-versus-PR image comparison remain outstanding.
Switches: No switches added, changed or removed. HOS_OUTPUT_RES remains a temporary override, but its value can now be saved on a first start.
Reviewed:
3677731c05against404c7ed3e9: Read the repository rules, PR template, standards, commit log and diff; inspected the changed resolution logic, menu initialization, display publication and their startup callers. Skimmed the remaining changed fixtures and documentation. The full contents of every changed code file and all dependent readers were not read.; nothing run (a code review).Checked and fine:
Testing: No commands that build, test or run project code were executed. The reported Linux game run and historical suite results were considered as evidence; the current suite and Windows run remain outstanding.
Overlaps and merge order: Not checked; network access is unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.
@ -4366,0 +4364,4 @@// Aspect ratio widens keeps the boot's size, which the host alone knows. Saved from now on, so the two never part.// HOS_OUTPUT_RES, below, is over it, as over a chosen one. Where the host cannot say, the screen's answer, as it took it)uint32_t w = 0, h = 0;if (!(host && host->output_size && host->output_size(&w, &h) && w && h)) {L1 (blocking): The host callback returns the game's base dimensions for the reduced output mode, not the output resolution the menu must save.
When: On a first start where the default is 2048x1152, output_mode clears output_w and output_h to select the game's 0.8 graphics scale. hos_output_size then returns 2560x1440, so the menu saves 2560x1440 even though this run draws 2048x1152; the next launch changes resolution.
Do: Expose the selected output resolution separately from the base dimensions used by the game's scaling patch, and save 2048x1152 for the reduced mode. Exercise the actual menu initialization for this case.
L2 (blocking): The initial saved menu value now incorporates HOS_OUTPUT_RES before the environment override is applied.
When: With no output_res line and HOS_OUTPUT_RES=1920x1080, host_output_size returns that override as the initial opts.output_res. The later env_override therefore retains 1920x1080 as the underlying saved value, so a temporary override becomes the persistent choice on subsequent launches.
Do: Initialize the saved choice from the unoverridden default, and apply HOS_OUTPUT_RES only through env_override. Add a first-start test that removes the override on the next launch.
@ -188,3 +218,3 @@uint32_t hos_output_size(int height) {if (!output_mode()) return height ? 1440 : 2560;return height ? output_h : output_w;const uint64_t px = output_px; /* (one read: a size, never two halves) */L4 (should fix): output_px is read outside the lock while another thread can write it; volatile does not make that access atomic or synchronize it.
When: When the window has not arrived, or a widescreen picture keeps output_settled false, concurrent game and menu calls can enter output_mode in succession and write output_px while another caller reads it after releasing the lock. This is a data race and can return an inconsistent output size.
Do: Return the requested dimension while holding output_lock, or use a properly synchronized atomic snapshot and keep the mode and dimensions in the same snapshot.
@ -76,0 +85,4 @@int w = 0, h = 0;if (client_fullscreen_pending) return;hos_pointer_size(&pointer, &w, &h);if (w > 0 && h > 0) __atomic_store_n(&client_w, w, __ATOMIC_RELAXED), __atomic_store_n(&client_h, h, __ATOMIC_RELAXED);L3 (should fix): Width and height are published independently, and the reader treats them as one window size. The Windows implementation has the same issue.
When: If a resize publishes a new width while output_mode reads before the new height is published, it can settle and save a combination of the new width and old height. That can choose an output larger or smaller than the actual window for the entire run and later launches.
Do: Publish and read the dimensions as one atomic snapshot or protect the pair with a lock, including the fullscreen publication on both platforms.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.