Skip to content

nvn: enable async texture pool slot updates by default on Mali - #485

Merged
mamcjr merged 1 commit into
mamcjr:mainfrom
Propinbo:feat/mali-async-tex-slots
Nov 18, 2026
Merged

mamcjr merged 1 commit into
mamcjr:mainfrom
Propinbo:feat/mali-async-tex-slots

Conversation

@Propinbo

Copy link
Copy Markdown
Contributor

Summary

Enables deferred/async texture pool slot updates by default (LARECOMP_SLOT_DRAIN unset -> 0) on ARM proprietary Mali (vk_driver_is_mali()), matching the existing vk_low_ram() path instead of draining vk_async_drain() on every guest descriptor pool rewrite.

  • runtime/nvn/vulkan/{vk.h,device.c}: Adds #ifdef __ANDROID__ vk_driver_is_mali() (checks VK_DRIVER_ID_ARM_PROPRIETARY when g_driver_props is supported, or vendorID == 0x13B5 when driverID == 0) and vk_slot_async_default() (vk_low_ram() || vk_driver_is_mali()).
  • runtime/nvn/objects.c: Defaults g_slot_drain to !vk_slot_async_default() (overridable via LARECOMP_SLOT_DRAIN=0/1), ensures slot_retire_pending() retires stale slot arrays cleanly in nvnTextureFinalize (outside g_live_lock) and after vk_async_drain() in nvnTexturePoolFinalize, and frees/resets slot_old + g_slot_drain across nvn_reset (slot_old_reset()).
  • tools/test_nvn_lifetime.c: Covers default LARECOMP_SLOT_DRAIN behavior, vk_slot_async_default() + FIFO async slot queue ordering, and explicit LARECOMP_SLOT_DRAIN=1 override.

Verification

  • Host checks: test_vulkan_compat.py (16/16), test_vulkan_startup.py (33/33) PASS.
  • Physical device Bionic (SM-X730, Mali-G925 MC12 r49p1): test_nvn_lifetime PASS (0 failures); ./gradlew :app:assembleDebug PASS.
  • Physical device live gameplay telemetry (SM-X730, 60 FPS target across zora-plaza, korok-plaza, kakariko-day): slot drains 0 (0 ms) recorded across 86/86 [vk-prof] 2-second windows (0 descriptor/lifetime errors, 0 visual artifacts).
  • Zero-conflict check: Rebased cleanly on v0.4.6-beta (0897fb8); touches only objects.c, device.c, vk.h, and test_nvn_lifetime.c (zero overlap with open PRs #436, #475, #480, #481, #482, #483).

Propinbo added a commit to Propinbo/BOTWRecompAndroid that referenced this pull request Nov 17, 2026
…rebases, PR mamcjr#485 async slots, Mali perf ABBA & release rollout
@mamcjr

mamcjr commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Thanks, the lifetime hardening is good and it fixes the comment we asked about on #454. Before merging it needs the tests we asked for on #454, on a Mali: inventory open/close loops, a long session (30+ min), and the in-place reboot. Your evidence is ~3 minutes in towns. #485 and #454 edit the same lines, so only one can land: I'd take #485 (Mali, with the hardening) and then #454 becomes the one-line switch to every device, with its Adreno numbers.

vk_driver_is_mali() + vk_slot_async_default() enable queued slot_apply updates on Mali without blocking the game thread on vk_async_drain(). Also drain pending retired slot references in nvnTextureFinalize and after vk_async_drain() in nvnTexturePoolFinalize, reset slot_old storage on reboot, and extend test_nvn_lifetime.c to cover both sync and async paths.
@Propinbo
Propinbo force-pushed the feat/mali-async-tex-slots branch from 5eea75f to 8bb3c02 Compare November 17, 2026 22:44
@Propinbo

Copy link
Copy Markdown
Contributor Author

Rebased onto upstream/main (011e1da → 8bb3c02) and ran all three Mali stress tests requested on physical Mali-G925-Immortalis MC12 (SM-X730, Vulkan 1.3.278, LARECOMP_VK_PROF=1, LARECOMP_SLOT_DRAIN unset):

Test Scope [vk] 2s Windows slot drains Total Watchdog / Errors Notes
Inventory loops 65 open/tab/close cycles (266 edge inputs, frame 6,167) 103 / 103 0 (0 ms) 0 / 0 Peak 509 views/window, 30.0 fps, VmRSS 3482.3 MiB; clean UI/icons
In-place reboots (LARECOMP_REBOOT_AT=40) 5 reboots over 241.6 s (frame 6,442) 113 / 113 0 (0 ms) 0 / 0 1,156–1,227 textures & 1,002–1,025 gpipes cleanly freed per reboot; VmRSS settled at 3462.6 MiB (VmHWM 3467.0 MiB)
Long continuous session 1951.9 s (32.5 min, frame 58,334) 970 / 970 0 (0 ms) 0 / 0 VmRSS flat from t=363.3s (3948.9 MiB) through t=1941.2s (3949.9 MiB, VmHWM 3982.5 MiB)
  • Total across all three runs: 1,186 / 1,186 2s windows with slot drains 0 (0 ms).
  • Bionic unit regression on SM-X730: tools/test_nvn_lifetime.c (aarch64-linux-android30) PASS, covering default async updates, async FIFO queue draining, slot_retire_pending() refcount/retirement on overwrite & finalize, slot_old_reset() reboot cleanup, and LARECOMP_SLOT_DRAIN=1 fallback (drains == 1, g_tex_drains == 1).

Propinbo added a commit to Propinbo/BOTWRecompAndroid that referenced this pull request Nov 17, 2026
…ew fixes, Mali A/B & stress validation, and release APK update
@mamcjr

mamcjr commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Thanks, those are exactly the tests I asked for (65 inventory cycles, 5 reboots, 32 min with flat memory). Merging. If anyone with an older Mali (before r49) reports trouble, LARECOMP_SLOT_DRAIN=1 is the way back.

@mamcjr
mamcjr merged commit 43c199a into mamcjr:main Nov 18, 2026
HallanBR added a commit to HallanBR/BOTWRecompAndroid that referenced this pull request Nov 18, 2026
…sync_default true)

The queued write (mamcjr#485) was the default on low-RAM devices and Mali; it is now the default everywhere. On an
Adreno 750 (Snapdragon 8 Gen 3, Turnip, game 1.8.2) at 60 fps: 44.2 fps draining vs 53.4 fps queued (two runs each,
alternated), the GPU idle 4.9 vs 0.9 ms a frame. LARECOMP_SLOT_DRAIN=1 keeps the wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Propinbo added a commit to Propinbo/BOTWRecompAndroid that referenced this pull request Nov 20, 2026
…erged), grass triage parked, Master Plan & device scope
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