Skip to content

vulkan: allow in-place render-target feedback reads setting on Mali - #507

Merged
mamcjr merged 1 commit into
mamcjr:mainfrom
Propinbo:feat/mali-inplace-feedback
Nov 22, 2026
Merged

mamcjr merged 1 commit into
mamcjr:mainfrom
Propinbo:feat/mali-inplace-feedback

Conversation

@Propinbo

@Propinbo Propinbo commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Scoped per maintainer feedback so Automatic stays copies on all ARM Mali GPUs, while allowing Mali users to explicitly opt into in-place render-target feedback reads via Settings (Video -> Draw-target reads in place = On) or LARECOMP_FEEDBACK_INPLACE=1 without switching to the Adreno-only fast path. No GPU driver detection changes (vk.h / device.c are untouched).

(Changing Mali Automatic default can be evaluated separately later if desired.)

Key Changes

  1. Manual Opt-In Policy & Override Precedence (runtime/nvn/vulkan/exec.c):
    • Keeps Automatic (g_settings.inplace_reads < 0) as copies on ARM Mali ([vk] targets a draw writes, sampled by it: copies (automatic)).
    • Enables in-place feedback reads on Mali when g_settings.inplace_reads > 0 ("On" in Settings) or LARECOMP_FEEDBACK_INPLACE=1, logging [vk] targets a draw writes, sampled by it: in place (settings) / (LARECOMP_FEEDBACK_INPLACE), while keeping "Off" (= 0) and LARECOMP_FEEDBACK_COPY=1 (AB("copy") == 1) taking precedence over explicit Settings "On".
    • Evaluates atoi(fi) before LARECOMP_FEEDBACK_COPY, guards LARECOMP_FEEDBACK_INPLACE="", and keeps Android-only symbols inside #ifdef __ANDROID__ (preserving clean -U__ANDROID__ builds).
  2. Prelaunch Launcher UI & i18n (runtime/settings.h, runtime/ui/launcher.mm, 11 runtime/ui/i18n_*.inc locales):
    • Updates the "Draw-target reads in place" picker note across launcher.mm and all 11 localization files (de, es, fr, it, ja, ko, nl, pt, ru, zh_hans, zh_hant) to state that "Automatic" enables it for Adreno 8xx and "On" can be tested on Mali (Automatic option wording remains unchanged).
  3. Tests (tools/test_rt_load_upload.c):
    • Extends Section 6b verifying Mali (0x13B5) Automatic == copies, explicit inplace_reads = 1 -> in place (settings), inplace_reads = 0 -> copies (settings), LARECOMP_FEEDBACK_INPLACE (""/"0"/"1"), LARECOMP_FEEDBACK_COPY & AB("copy") == 1, pass breaks (stat_inplace_breaks), and non-Turnip/non-Mali (0x5143) negative control.

Rollback / Zero-Overhead Guarantee

  • Automatic (default out-of-the-box config) performs copies identically to upstream on Mali, Qualcomm stock, < r49 Mali, and desktop. Switching Draw-target reads in place from On back to Automatic or Off (or LARECOMP_FEEDBACK_COPY=1) restores copy snapshots immediately.

Isolated On-Device Verification (Exact v0.4.8-beta Commit fe2f659)

Environment: Galaxy Tab S11 (SM-X730), Android 16, Mali-G925-Immortalis MC12 (vendor 0x13b5, device 0xd8300010, driver-id 9, v1.r49p1-03bet0.f8a98b506b89b21c80a508d70abfcb3f), BOTW 1.9.0, upstream base 2b71a10 (v0.4.8-beta), commit fe2f659 (debug APK 9ad15026af0d), USB-powered (plugged: 2, no off-charger power claims made).

Verbatim runtime log proof (Automatic vs Settings On):

  • inplace_reads = auto: [vk] targets a draw writes, sampled by it: copies (automatic)
  • inplace_reads = 1: [vk] targets a draw writes, sampled by it: in place (settings)

1. Official 30 FPS benchmark.c A/B (warmup_s=8, calm_s=3, window_s=10, 301 frames/scene)

Scene Mode FPS 1% low Frame p50 / p99 GPU p50 / p95 RT p50 / p95 Headroom p50
zora-plaza Automatic (copies) 30.00 29.41 33.33 / 33.90 ms 27.34 / 33.49 ms 18.74 / 21.27 ms 5.99 ms
zora-plaza On (in place (settings)) 30.00 29.49 33.34 / 33.88 ms 27.15 / 32.87 ms 17.78 / 20.58 ms 6.19 ms
plateau Automatic (copies) 30.00 29.46 33.32 / 33.92 ms 26.82 / 33.43 ms 17.60 / 20.23 ms 6.51 ms
plateau On (in place (settings)) 30.00 29.17 33.34 / 33.92 ms 27.05 / 33.17 ms 17.96 / 20.88 ms 6.28 ms

2. Uncapped 60 FPS Steady-Camera [vk] A/B (LARECOMP_FPS=60, 2s [vk] intervals with 0 skipped, compile 0 during S_WARMUP)

(Note: upstream benchmark.c:810 exits non-30 FPS targets at S_WINDOW, so these metrics come from steady [vk] 2s intervals before S_WINDOW exit.)

Scene Mode Samples Median / Mean FPS Worst max ms Mean fbcopy / 2s Delta
zora-plaza Automatic (copies) 7 43.20 / 43.33 28 ms 2697.0 baseline
zora-plaza On (in place) 7 46.30 / 46.31 30 ms 0.0 +3.10 fps (+7.2%), fbcopy -100%
plateau Automatic (copies) 6 46.50 / 46.57 29 ms 936.7 baseline
plateau On (in place) 6 47.70 / 47.58 46 ms 0.0 +1.20 fps (+2.6%), fbcopy -100%

Verbatim [vk] sample (zora-plaza):

  • Automatic (copies): [vk] t=29.1 frame 972 44.3 fps max 27ms level - (318573 draws, 0 skipped, 17054 passes, 5326 dispatches (2346 chained), 742 flushes, wait 27ms, compile 0 (waited 0ms), fbcopy 2759 (read 18690, breaks 0), ...)
  • On (in place): [vk] t=28.8 frame 992 47.0 fps max 27ms level - (337253 draws, 0 skipped, 17743 passes, 5531 dispatches (2497 chained), 768 flushes, wait 17ms, compile 0 (waited 0ms), fbcopy 0 (read 68244, breaks 752), ...)

Visual Verification (SM-X730, Exact Commit fe2f659: Title Blurred Backdrop, Great Plateau Decals & Grass, Zora's Domain Wet Reflections)

Scene Automatic (copies) On (in place (settings))
Title Screen (Blurred Backdrop) title copy title inplace
Great Plateau (Decals & Terrain) plateau copy plateau inplace
Zora's Domain (Wet Reflections & Rain) zora copy zora inplace

Additional Unit & Build Verification (fe2f659)

  • Host Python suites (NDK 30): test_vulkan_compat.py (16 PASS), test_vulkan_startup.py (33 PASS), test_shader_cache.py (17 PASS), test_soft_linear.py (23 + 3 + 203 PASS).
  • Android Bionic (SM-X730, tools/test_android_runtime.ps1): 7/7 PASS.
  • i18n & Portability: Key parity verified across launcher.mm and all 11 runtime/ui/i18n_*.inc files (0 missing keys vs 2b71a10); :app:assembleDebug --no-daemon -> BUILD SUCCESSFUL (14s).

Tested vs Untested GPU Matrix

Target Status Notes
ARM Mali-G925 (SM-X730, r49p1) Tested on hardware Exact v0.4.8-beta commit fe2f659: Automatic (copies) vs On (in place) 30 FPS + 60 FPS A/B + Title/Plateau/Zora paired screenshots + Bionic 7/7
ARM Mali < r49 Untested on physical hardware Remains Automatic = copies; explicit "On" opt-in covered by unit test
Adreno 8xx Turnip / Qualcomm stock / Desktop Untested on physical hardware Unchanged automatic policy; guarded by test_rt_load_upload.c & #ifdef __ANDROID__

@Propinbo
Propinbo force-pushed the feat/mali-inplace-feedback branch from a3f8763 to 0769b0e Compare November 20, 2026 11:01
@mamcjr

mamcjr commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thanks! I'd rather not change the default on Mali yet: in-place feedback reads are undefined in Vulkan without the feedback-loop extension, they striped terrain on an Adreno 750 before (#129), and Mali's tile memory and AFBC are exactly where that goes wrong; the evidence is a mock test. Could you split it: the part that lets the "On" setting work on Mali (fine to merge), and the default change once someone runs it in-game on a Mali (Plateau terrain decals, the title background, fps on vs off)?

@Propinbo Propinbo changed the title vulkan: enable automatic in-place render-target feedback reads on Mali vulkan: enable automatic in-place render-target feedback reads on Mali r49+ Nov 20, 2026
@Propinbo
Propinbo force-pushed the feat/mali-inplace-feedback branch from 0769b0e to fe2f659 Compare November 20, 2026 14:18
Propinbo added a commit to Propinbo/BOTWRecompAndroid that referenced this pull request Nov 20, 2026
@Propinbo Propinbo changed the title vulkan: enable automatic in-place render-target feedback reads on Mali r49+ vulkan: allow in-place render-target feedback reads setting on Mali Nov 20, 2026
@Propinbo

Copy link
Copy Markdown
Contributor Author

Split per your feedback in fe2f659 (v0.4.8-beta 2b71a10) and renamed to "vulkan: allow in-place render-target feedback reads setting on Mali":

  1. Strict opt-in scope: Automatic remains copies on all ARM Mali GPUs ([vk] targets a draw writes, sampled by it: copies (automatic)), and vk.h / device.c are reverted (15 files). In-place reads on Mali are enabled only when explicitly set to "On" in Settings (in place (settings)) or via LARECOMP_FEEDBACK_INPLACE=1.
  2. Paired SM-X730 (Mali-G925 r49p1, 1.9.0, exact commit fe2f659, plugged: 2) visuals & A/B metrics:
    • Visual checks (6 paired screenshots linked in PR body): Title blurred cliff backdrop, Great Plateau decals/grass, and Zora's Domain wet reflections all render cleanly in "On" vs Automatic (copies).
    • 30 FPS benchmark.c: Both modes hold 30.00 fps; Zora RT p50 drops 18.74 -> 17.78 ms (-0.96 ms).
    • Uncapped 60 FPS steady [vk]: Zora median 43.20 -> 46.30 fps (+7.2%), Plateau median 46.50 -> 47.70 fps (+2.6%), fbcopy 2697 / 936.7 -> 0 (-100%).

Propinbo added a commit to Propinbo/BOTWRecompAndroid that referenced this pull request Nov 20, 2026
@mamcjr

mamcjr commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thanks, that's the split I hoped for. On the POCO (Adreno 830, Turnip) nothing changes: Automatic still reads in place, and the Plateau benchmark is the same as 0.4.8 (GPU p50 22.6 ms, p99 33.5 ms). One small thing before I merge: the Driver compatibility tab now hides "These options are for Turnip" on Mali, but GPU memory and LRZ there still do nothing on Mali. Could the note stay on Mali and say that only the draw-target reads apply there? Also, once #506 is in, this one conflicts with it in tools/test_rt_load_upload.c.

@Propinbo
Propinbo force-pushed the feat/mali-inplace-feedback branch from fe2f659 to 2e36682 Compare November 21, 2026 07:11
@Propinbo

Copy link
Copy Markdown
Contributor Author

Updated in 2e36682 (rebased onto v0.4.9-beta 7f5afab):

  1. Driver compatibility note on Mali (runtime/ui/launcher.mm + all 11 runtime/ui/i18n_*.inc locales): Kept the Turnip note visible on Mali with "These options are for Turnip: on Mali only draw-target reads in place apply." (Turnip still hides it; other non-Turnip/non-Mali drivers still show "These options are for Turnip: the driver in use takes the safer paths anyway.").
  2. Rebase onto 7f5afab / PR vulkan: add submission-scoped cbwin snapshot cache and Mali copy-mode support #506: Resolved the conflict in tools/test_rt_load_upload.c while preserving #506's mock_mali_calls short-circuit negative control and Section 9 alongside Section 6b; exec.c has zero functional change vs fe2f659.
  3. Verified on 2e36682: :app:assembleDebug (0 warnings in launcher.mm / 0 new warnings in exec.c), 11/11 locale key checks, test_android_runtime.ps1 (8/8 PASS on SM-X730), and host Python suites (test_vulkan_compat.py, test_vulkan_startup.py, test_shader_cache.py, test_soft_linear.py) all pass.

Propinbo added a commit to Propinbo/BOTWRecompAndroid that referenced this pull request Nov 21, 2026
@mamcjr
mamcjr merged commit 75bfc64 into mamcjr:main Nov 22, 2026
@mamcjr

mamcjr commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Thanks! Tested on the POCO (Turnip): Automatic still reads in place there, GPU time unchanged, no stalls. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants