fix(linux): a start from the Steam Deck's Game Mode no longer compiles every pipeline the preparation built #900
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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!900
Loading…
Reference in a new issue
No description provided.
Delete branch "zeldaootr/Longshot:radv-vrs-key-switch"
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?
Type: fix · Risk: low · Tested on: Steam Deck OLED (SteamOS 3.9.5, RADV, Mesa 26.2.0-devel); Linux game-free checks · Needs: none
Why
On a Steam Deck, every start from Game Mode compiled again all 32,438 pipelines the preparation had built: about 25-30 minutes at "Loading pipelines" before the title, where a start from the desktop loaded them in about 20 seconds. Game Mode sets
RADV_FORCE_VRS_CONFIG_FILE(Steam's Half Rate Shading switch) for everything it starts, and while that file exists RADV gives every graphics pipeline another key, so neither our pipeline cache nor the driver's finds what the preparation made.The cause was measured on the Deck before the fix:
1x1(as Game Mode's does) or empty: the start compiles, about 20 pipelines a second.No issue on the tracker covers it (searched: VRS, RADV_FORCE_VRS, half rate shading, Game Mode, shader cache).
How to reproduce
Seen on: SteamOS 3.9.5 (Steam Deck OLED), RADV VANGOGH, Mesa 26.2.0-devel
Settings and switches: defaults
Steps: prepare outside Game Mode (the Builder, or a start from the desktop), then start from Steam in Game Mode. From a shell the same shows with
printf 1x1 > <scratch>/vrs-1x1.txtand a start withRADV_FORCE_VRS_CONFIG_FILE=<scratch>/vrs-1x1.txt.Expected: the precompile loads its pipelines in seconds.
Actual:
vk: noted pipelines: 6374 of 38345 pipelines in 10 s...8932 of 38345 pipelines in 130 s, about 20 a second.What changed
The game drops Game Mode's
RADV_FORCE_VRS_CONFIG_FILEbefore Vulkan loads, by default, and says so in its log.RX_VK_HALF_RATE_SHADING=1keeps it for a player who wants Steam's Half Rate Shading and accepts the compile.host/hos_main.cdriver_env_choose(), in the Linuxmainafterlongshot_env.txtis read (so the switch works from there) and before the window or anything else can load Vulkan:LONGSHOT_DRIVER_ENV_SET. That variable is for the renderer's driver cache line in the sibling PR "fix(vk): the start names the driver's shader cache ..."; with this PR alone nothing reads it.driver_env_log()ingame_main).RADV_FORCE_VRS, a rate someone set by hand, is never touched. Game Mode doesn't set it.docs/development.md's row forRX_VK_HALF_RATE_SHADING, anddocs/tested/2026-11-15-gamemode-vrs-zeldaootr-deck01.mdfor the Deck run.tests/test_driver_env_choose.pycutsdriver_env_chooseout ofhos_main.c, compiles it and runs it against a1x1file, an empty file,=0,=1, a name with no file, an empty value, no variable, andRADV_FORCE_VRSset; it also checks the call's place inmainand the log line ingame_main. The stand-in intests/display_startup_failure_test.cppfollows.Beyond the Deck:
/tmpRADV sees.hos_relaunch.c) starts again from the first environment, and that start drops it again. Processes the game starts inherit the dropped state.Measurements
Verdict: fixed. With Game Mode's variable set, the start no longer compiles: the precompile took 12.5-18.9 s and the title came in 45-51 s, against about 20 pipelines a second (25-30 minutes) before; the same as the starts without the variable.
Baseline: the Before column is an earlier Deck build of main @
aa95d35fwith other open PRs (the same caches and scene), from the session that found the cause; main itself was not run in the After session. The After column is the local integrationvrs-verify(bfc69759): main @aa95d35fwith this PR and its two siblings. Their changes don't move these numbers: one adds log lines, the other writes the cache only after a precompile of 30 s or more, and none of these starts took that long. Rebased since onto main @f637b42d: main's changes tohost/hos_main.cin between (a comment, the saves move) don't touch the driver's environment, so the numbers hold.Hardware: Steam Deck OLED, AMD Custom GPU 0932 (RADV VANGOGH), Mesa 26.2.0-devel (git-5c65d4fc31), SteamOS 3.9.5 (20261023.100), 16 GB
Scene: the start-up, up to the title; scratch game folders, each start with a fresh copy of the same warm caches; headless, defaults, the precompile at its default
Method: the start's
vk: precompile: ... in N msandvk: noted pipelines: N of M pipelines in T slines, and the time to the title. After: 4 starts interleaved a, b, b, a; with 2 runs each the median is their mean. Before: one start per arm, stopped at 150 s while compiling.How to reproduce:
printf 1x1 > <scratch>/vrs/vrs-1x1.txt; arm b setsRADV_FORCE_VRS_CONFIG_FILEto it, arm a doesn'taa95d35f(with other open PRs)d3680c96(invrs-verifybfc69759)1x1file, precompileFlags and settings
One new switch; by default the variable is dropped.
RX_VK_HALF_RATE_SHADING=1RADV_FORCE_VRS_CONFIG_FILE=11, Steam's Half Rate Shading reaches the game, and a start in Game Mode compiles its own pipelines=1checked game-free onlyLONGSHOT_DRIVER_ENV_SETRADV_FORCE_VRS_CONFIG_FILEwhen droppedTesting
Tested:
tests/test_driver_env_choose.py: fails at the test commit (08711eba,host/hos_main.c has no driver_env_choose) and passes at the fix.host/hos_main.csyntax-checked with gcc for Linux and llvm-mingw clang for Windows (stand-ins for the two generated headers it includes): no errors, as main, and no warnings in the new code with-Wall -Wextra. The Linux game build itself ran on the Deck.tests/run_all.pyon Linux: 529 passed, 18 failed, 79 skipped (tools this PC lacks), 8 at once, on this PR merged with its two siblings onto main @f637b42d. The 18 fail the same way on main @f637b42drun alone:test_appimage_player_build,test_bake_portability,test_crash_dialog,test_crt_options,test_env_on,test_lift_cache,test_lift_cleanup_error,test_linux_preflight,test_linux_update,test_make_game_cache,test_missing_nup,test_mods_size_table,test_options_budget_once,test_pipeline_tour,test_readback_late,test_vk_occlusion_queries,test_vk_pgo,test_walk_key. The checks that read this PR's files pass, among themtest_driver_env_choose,test_driver_cache_env,test_precompile_save,test_pipeline_cache_save,test_prepare_stall,test_display_startup_failureandtest_tested_configurations.Not tested:
RX_VK_HALF_RATE_SHADING=1in the game (the start then compiles, as before this PR; the game-free check covers that the variable is kept and the log says so); a start through Steam in Game Mode itself, rather than the variable set by hand (Game Mode's session sets the same variable to a file holding1x1, which is what arm b set).Must be tested: None.
Risks
What could break: Steam's Half Rate Shading no longer reaches Longshot unless
RX_VK_HALF_RATE_SHADING=1. A player whose caches were last written by a start in Game Mode may have them under the VRS keys only, and then compiles the noted pipelines once more after updating.Turning it off:
RX_VK_HALF_RATE_SHADING=1inlongshot_env.txtor the environment.Compatibility: the pipeline keys in Game Mode become those of every other start, so the caches the preparation made are found. Nothing is translated again; saves,
longshot_options.iniand the vk ABI are unchanged.Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.tests/that reads changed source updated in this PR, not weakened.@magicbean could you add the
testing wantedlabel? What this still needs is a start from Steam's Game Mode itself on a Steam Deck (LCD or OLED): our runs setRADV_FORCE_VRS_CONFIG_FILEby hand over SSH. Pass: the title in about a minute with no long "Preparing shaders", and the log lineRADV_FORCE_VRS_CONFIG_FILE=... dropped.@Beanstalk steamdeck, a start from Steam's Game Mode: start a prepared build from Game Mode (not Desktop Mode, not SSH) and time it to the title. Expecting about a minute with no long "Preparing shaders", and the log line
RADV_FORCE_VRS_CONFIG_FILE=... dropped; main takes 20-25 minutes there. A plain Linux AMD start is also welcome, expecting no change from main.(This replaces my ask above for the
testing wantedlabel, now that the Test Farm has taken over from test requests.)@zeldaootr only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it.Read the whole diff (host/hos_main.c, the new check, the stand-in, the docs row and the tested record) against main @
e41de662, plus the three comments. Nothing was built or run here.What it does for a player: on a Steam Deck, a start from Game Mode loads the pipelines the preparation built (about a minute to the title) instead of compiling all of them again for 25-30 minutes, because Game Mode's
RADV_FORCE_VRS_CONFIG_FILEis dropped before Vulkan loads.The code looks right:
driver_env_choose()runs in the Linuxmainafterload_longshot_env()(soRX_VK_HALF_RATE_SHADING=1works fromlongshot_env.txt), beforehos_display_init()and before the game's thread and Discord start, so no other thread is reading the environment whenunsetenvruns.--prepare-shadersgoes through the same path, so a preparation started from Game Mode gets the same keys as a play start.hos_relaunch.cexecs with/proc/self/environ(the environment the process started with), and the new start drops the variable again.driver_env_saidanddriver_env_log()compile to a no-op.stat,setenvandunsetenvare all inside the Linux block, after<sys/stat.h>.RADV_FORCE_VRSset by hand is left alone. The switch is documented.1x1file, an empty file,=0,=1, a name with no file, an empty value, no variable,RADV_FORCE_VRS), and it pins the call's position and the log line. The stand-in indisplay_startup_failure_test.cppfollows.No conflict with main. I rebased a copy onto main @
e41de662(not pushed), and every text anchor the check uses is still unique there.Overlaps: none duplicate this. #902 is its diagnostics sibling: it reads
LONGSHOT_DRIVER_ENV_SET, and nothing reads that variable without it. Either merge order is safe, but this one first lets #902's line say "Longshot's". #903 is independent. #737 also editshost/hos_main.c(game_main's arguments and main's argument skip), but in other hunks. #416, #225 and #345 don't touch this.Why this is a comment, not an approval: the Deck run is good evidence for the mechanism (arm b sets the same variable to a
1x1file). Your own comment, though, says the PR still needs a start from Steam's Game Mode itself. That Test Farm request is waiting for a BigBean's approval. Once that run is posted (the drop line, the title in about a minute), this can be approved as it is. Please also put that run under Must be tested rather than "None", so the description matches.Two optional suggestions are in the inline comments: drop a set variable even when no file exists yet, and use
tests/srccut.pyfor the cut once the branch is rebased.@ -2125,0 +2144,4 @@static void driver_env_choose(void) {const char *file = getenv("RADV_FORCE_VRS_CONFIG_FILE");struct stat st;if (!file || !*file || stat(file, &st) != 0) return;Optional: when the variable is set but its file isn't there yet, it is kept. If Steam wrote the file between this
statand RADV's device creation (or RADV re-checked later), the start would pick up the VRS keys again. Since RADV reads nothing without the file, unsetting it whenever it is set (and saying so only when the file existed) seems no worse and closes that window. Your call. The measured behaviour (a name with no file doesn't compile) means this is unlikely in practice, because Game Mode writes the file at session start.@ -0,0 +45,4 @@"""def function(source, signature):Nit, for after a rebase: main now has
tests/srccut.py(30cedbc5), and AGENTS.md asks new checks to cut withblock()from it instead of a brace counter of their own.block(src, "static void driver_env_choose(void) {")andblock(src, "static int game_main(int argc, char **argv) {")would replacefunction(), and a renamed function then fails with one clear message. This branch predates srccut, so I didn't rebase your commit just for this.