#284

Adreno: rewrites off for the 720, inlining for the 735 (#263 #169)

Openyyan160wants to merge intofrom

Shared code: this changes the Vulkan engine's Adreno policy (dm/gfx/vulkan/engine/xbg_adreno_policy.h), which Android and HarmonyOS both build. Only the Adreno 720 (rewrites off) and the Adreno 735 (inlining on) behave differently, so HarmonyOS (Kirin / Maleoon) devices are unaffected. Tested on Android only.

For #263 (Adreno 720) and #169 (Adreno 735).

Cause

The Adreno defaults key on the model number. The quad-derivative and warp32 rewrites are off for 740–799, because those GPUs fault on them (#141), and inlining is on for 750–799, because their compiler crashes on helper subgroups (#123/#153/#166). But the model number misses part of that chip family. Device IDs from logs:

GPUDevice ID
720 (Snapdragon 7 Gen 3, #263)0x43020000
735 (8s Gen 3, #169)0x43030b00
750 (#123)0x43051401
730 (our Redmi)0x07030002
830 (our OnePlus)0x44050001
  • Adreno 720 (#263): the log shows warp32 running (NVN warp32 shader=098a126f92bf533a ... rewrites=26), then Game presentation failed: -4 (VK_ERROR_DEVICE_LOST) on the main menu's first frame. That's the 740's symptom in #141.
  • Adreno 735 (#169): the reporter needed the 750's inlining (they changed the check to model>=735).

Change

  • xbg_adreno_rewrites_fault: the Adreno 720 also defaults both rewrites off, like the 740–799 models. The marker files gfx-quad-derivatives / gfx-warp32 still win.
    • Not the whole 0x43 generation: the 735 ran fine with both rewrites on once its helpers were inlined (#169).
    • Turning them off there would lose their fixes: warp32 keeps the grass, clutter and fluid appends correct, and the quad rewrite prevents black squares.
    • (The first commit of this PR did use the device-ID rule. The second narrows it to the 720.)
  • xbg_adreno_compiler_needs_inline: also the 735. The marker gfx-inline still wins.
  • The start-up line names the device ID: NVN Adreno 720 / 740-799 (device "..." id=0x...).

Tests

  • dm/gfx/vulkan/engine/tests/adreno_policy_test.cpp passes with the new cases: the 720 has the rewrites off; the 725, 732 and 735 keep them; other vendors are not matched; the 735 is inlined and the 720 is not.
  • Redmi K50 Ultra (Adreno 730), debug APK from this branch's first commit: quad derivatives and warp32 on, inlining off, no family line, camp run clean. The second commit only narrows the rule for other models, and the 730's path is the same in both.
  • Full build of the final commit: debug APK in docker (NDK 29), no warnings.

Merge note: #282 adds test lines at the same spot in adreno_policy_test.cpp, so whichever of the two lands second has a trivial conflict there (the code itself merges cleanly). I'll rebase it.

Tester results (Adreno 735)

  • @hrachkov1004-lab (735): inlining on, rewrites kept, 098a loads, 60 fps.
  • #286, @xfl1996 (vivo V2352A, 735, system driver 0x802fa012). Without inlining, 098a126f92bf533a and then 6a7a308d61928982 crashed hard in libllvm-qgl.so, twice each, so both went onto gfx-pipe-skip. With them skipped, the player's light was missing in HD mode (dungeons black, torches fine). With gfx-inline=1 and the old list moved aside, both load with inlined=1, nothing is skipped, there are no crashes on two boots, and the player light is back. So this PR plus #287 (which retries those old entries once) fixes #286.

Not covered

No 720 or 735 here. @Tobi1991-hub @geyah20-star (720) and @hrachkov1004-lab (735), could you try this branch?

  • Build both the APK and the import pack from this branch (the app accepts only a pack made from the same code), copy the new android folder to the phone, and let the app import it again.
  • A self-built APK is signed differently, so installing it means uninstalling the official app, which deletes your saves. Back them up first.
  • If it still fails, attach adb logcat -d -s dm from that start. On a 720 the line NVN Adreno 720 / 740-799 should be there.

🤖 Generated with Claude Code

Activity

2
hrachkov1004-lab10d ago

@yyan160 d2r-735-log.txt

Adreno 735 (device id 0x43030b00) — confirmed working. Built from the branch at HEAD, tested on a 735 device, pack produced by dm/tools/d2rm_android.py from the same commit.

Key lines from adb logcat -d -s dm:

  • NVN caps device="Adreno (TM) 735" vendor=0x5143 id=0x43030b00 — detection correct.
  • NVN shaders with subgroup helpers are inlined at load=1 (marker gfx-inline) — inlining on.
  • NVN shader 098a126f92bf533a ... inlined=1 — the shader that crashed the 750 now loads cleanly. No NVN Adreno 720 / 740-799 rewrites-fault line anywhere in the log.
  • NVN compatibility format_feature_flags2=1 depth16_as_d24=0 depth24_as_d32=0 — 1/0, i.e. same depth path as the Adreno 8xx family, not the 730's 0/1. Worth noting as a data point.
  • Reaches MainMenuPanel, steady 60 fps (samples: 59.83 / 59.77 / 58.62) at 2000x900 output, 3D scale 0.85.
  • No [dm] FATAL, no 【红】NVN 未实现被调用, no aborts.

First frame is ~15 s (shader compilation: 40 pipelines + 37 shader libs, 700 ms; first texture upload 229 textures / 161 MB) — normal warm-up, not a stall.

Only unknown remaining is the Adreno 720 tester; I don't have that device. From the 735 evidence I'd say the branch is ready to merge for 735 and looks likely to cover 720 too, but I can't confirm 720 from my side.

Tobi1991-hub10d ago

Sorry, i dont know, how to Test it. Maybe the other one with the 720 can do that. 😔