AMD/RADV: Resolution Auto colour noise, one-frame sunlight flicker, huge pages, per-tap gathers #487
Closed
chuppatricky wants to merge 4 commits from
amd-flicker-noise-fixes into main
pull from: amd-flicker-noise-fixes
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!487
Loading…
Reference in a new issue
No description provided.
Delete branch "amd-flicker-noise-fixes"
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?
AMD/RADV fixes for Ocarina of Time: the colour noise with Resolution Auto, a one-frame sunlight flicker, slower submits from
MADV_NOHUGEPAGE, and per-tap gathers with runtime offsets.Tested on an RX 7900 GRE (RADV, Mesa 26.2.6, kernel 7.3 CachyOS, THP
always), in Kokiri Forest from a save. Most measurements are from headless runs with the same scripted input (HOS_HEADLESS,HOS_INPUT_SCRIPT). The fixes were developed and measured on184564dand rebased ontoef2e1c4. Onef2e1c4the renderer builds (0 failures), loads with no unresolved symbols, andhost/hos_main.cpasses a syntax check. The rebased build has not been run in game.Colour noise with Resolution Auto (issues #361, #312)
When Auto drops below about 75%, the game switches to one of five smaller upscaler networks (
0775215f8da720e6,19346f9c9299279e,72ba090c70fe2614,f10782f9e58b6a7c,6676619641320ba7). These are left out on AMD and replaced byupscale_stub.The stub's input is the scene in RGB9E5. Because textures share images by bytes per texel, that scene sits in an image created as R11G11B10.
vkCmdBlitImagedecodes the image's own format, so the stub stretched RGB9E5 bits read as R11G11B10 over the whole 3D picture. That's the psychedelic noise.The fix: when the texture's format and its image's format differ and both are 4 bytes per texel, the stub copies the texels unchanged into an image of the texture's own format, then blits from that.
0775215fwas stood in for.One-frame sunlight flicker (most visible at load-in)
The faked occlusion count (16 per draw since the reset) goes up and down from frame to frame, and the game's sun visibility follows it. For about one frame in 70, the direct sunlight leaves the ground and the haze brightens across the whole picture.
The fix: every samples-passed report now reads 4096 (everything visible).
RX_VK_OCC_FIXED=<n>sets the value;-1restores the count.A/B results, one-frame brightness spikes per gameplay run (same script, run in both orders, about 2,600–2,900 gameplay frames each):
No visible change otherwise: lighting, shadows and Navi's glow look the same.
Transparent huge pages (
40c3f851, issue #312)MADV_NOHUGEPAGEmade RADV slower here, not faster. Each submission makes amdgpu check every page of the imported (userptr) memory. In a minimal test this cost about 0.5 ms per GB even when the memory is untouched, and with 4 KB pages the check took three times as long:MADV_NOHUGEPAGEThese numbers are from before batched submits (
aa1a4ce). Batching cuts the number of submissions, so the gap should be smaller now, but each remaining submission still pays the per-page check.The guest window now keeps the system's huge-page setting.
HOS_THP=0turns huge pages off as before.Per-tap gathers with runtime offsets
textureGatherOffsetswith offsets computed at run time lost those offsets: Vulkan only accepts the four offsets asConstOffsets, soImageOperandsdropped them ("Not all arguments in PTP are immediate, ignoring").They now become four gathers, each with one runtime
Offset(shaderImageGatherExtended), keeping texel i0j0 (component w) from each, which is how Mesa lowers it. Constant offsets keep the singleConstOffsetsgather. Ported from Lichii (1a8f736f,64293e7c).Not included
aa1a4ce) address the same per-submission cost, so I left it out.🤖 Generated with Claude Code
Feedback from a Steam Deck (RADV VANGOGH), in case the default is not what you want everywhere.
With the 4096 default (everything visible) the sun flicker is indeed gone, but the occlusion culling goes with it: in the starting room, geometry from outside the room flashes through the walls — glowing bits of objects that should be culled, every frame. That is very visible on a small screen.
RX_VK_OCC_FIXED=-1restores the per-draw count and the culling (and the flashing stops), but then the one-frame sunlight flicker is back. On this GPU the two are tied: the count is what the game's sun visibility follows.No action needed if 4096 is the intended default for desktop GPUs — just flagging that on the Deck it trades a subtle one-frame flicker for visible geometry bleeding through walls, and there is no middle value in the switch as it stands.
Closing to keep the queue clear — please rebase on current main and reopen; thanks! (The per-tap gathers and samples-passed parts are on main as
e16b6f7and5257559; the Resolution Auto colour noise, sunlight flicker and huge-page parts are still new.)