Repository navigation
drm/asahi: g17: size the A18 Pro tiler heap ahead of mesh shading - #2058
Merged
Merged
Conversation
On the A18 Pro, a mesh workgroup whose output is being written when the tiler heap runs out loses part of it. The firmware then either grows the heap (a grow request) or partial-renders, and in both cases the vertex output of the workgroup in flight is overwritten by a later workgroup's: its points show another workgroup's per-primitive data, or are not drawn. The mesh primitive records themselves are intact. A fresh render pair starts with a heap sized from the pass's tile count, which does not see mesh output. The first large mesh draw on it therefore runs out of heap many times, e.g. 70 grow requests for 32,768 workgroups of 128 points, and loses one workgroup's output at each. After that one pass the automatic growth sizes the heap to its normal maximum, and later passes do not run out. Add DRM_ASAHI_RENDER_MESH_OUTPUT, a render hint that the render contains mesh shading, advertised with DRM_ASAHI_FEATURE_RENDER_MESH_OUTPUT by the non-M5 command sets. The A18 Pro sizes the heap of such a render (or of an M5 render whose program table has a mesh program) to that normal maximum before the render, through the host growth that already runs on submission. aurora.g17_mesh_tvb_floor (0644, default 1) turns it off at run time for an A/B. M5 heaps are unchanged. Signed-off-by: Diljit Singh <[email protected]>
DjDeveloperr
marked this pull request as draft
November 16, 2026 06:02
DjDeveloperr
marked this pull request as ready for review
November 16, 2026 07:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On the A18 Pro (G17P), a mesh workgroup that is writing its output when the tiler heap runs out loses that output. Either recovery path causes it: the firmware's grow request or a partial render. The vertex output of the workgroup in flight is overwritten by a later workgroup's, so its points show another workgroup's per-primitive data or are not drawn. The mesh primitive records themselves stay intact.
A fresh render pair starts with a heap sized from the pass's tile count, and that estimate does not account for mesh output. So the first large mesh draw of a process runs out of heap many times and loses one workgroup at each. tgvis n_zz (32,768 workgroups × 128 points) sees 70 grow requests and about 5,400 wrong pixels on draw 0 of every cold process. Damage is linear in the number of grow events (~80-90 px each), so the heap has to be large enough before the draw starts. Growing it faster does not help.
Change
DRM_ASAHI_RENDER_MESH_OUTPUT(1U << 26), a hint that the render contains mesh shading. The non-M5 command sets advertise it withDRM_ASAHI_FEATURE_RENDER_MESH_OUTPUT(bit 38).normal_blocks) before the render runs. The same applies to an M5 render whose program table has a mesh program. This goes through the host growth that already runs on submission while the pair is idle.aurora.g17_mesh_tvb_floor(0644, default 1) turns it off at run time for A/B tests.The matching Mesa change (hk sets the flag on G17P mesh renders) is aurora-silicon/mesa#389.
Kernel / Mesa pairing (uAPI flag)
The fix needs both: kernel #2058 (6ff9a92) and Mesa aurora-silicon/mesa#389 (791eba405a). Any mixed pair behaves exactly like today, with nothing broken and the bug not fixed:
DRM_ASAHI_FEATURE_RENDER_MESH_OUTPUT, but old Mesa never sets the flag, so no pre-sizing (bug still present)Merge order does not matter. A release must pin both to get the fix.
Testing (Neo J700, same boot, kit meshflc = integration/aurora b87838e + this commit + a test-only switch)
One boot, Neo J700, kit meshflc (integration/aurora b87838e + this commit + a test-only switch value 2 that pre-sizes every render). Every tgvis process is fresh (cold heap) and checks 20 draws.
g17_mesh_tvb_floormvstress --big: 0 FAIL lines (x10 fix, x3 every-render). Kernel GPU lines: 0 in every arm.
CTS, same boot, hint Mesa, cts-vk4, plan c71 sample3x + mesh-shader (28,061) + so-mesh + mesh prim_query multiview class x3 + the one-process mesh loop, floor 0 (base) vs floor 1 (cand): counts identical except one case.
dEQP-VK.mesh_shader.ext.api.draw_indirect.draw_count_1.offset_0_stride_0.no_count_limit.no_count_offset.no_task_shaderfailed once in the cand batch and passed alone twice (triage: 0 confirmed, 0 flaky, 1 cleared). It has not failed in any earlier retained run. Targeted repro on a second boot (same kit, same Mesa), floor 1 vs 0 interleaved per process: alone 50/50 + 50/50, inside its 125-case draw_indirect group 10/10 + 10/10, with its list predecessors 10/10 + 10/10, alone beside a fresh-process mesh aggressor 40/40 (floor 1), 40/40 (floor 0) and 40/40 (system -30), and the full 28,061-case mesh part x2 per floor in its original two-worker setup: all Pass, 0 non-pass cases. The original failure was an image mismatch in a 9 ms case that ran in the first seconds of the part, while 3-4 fresh deqp processes were starting. That is the trigger of the existing two-client bug below. prim_query multiview class: 1538/1538 Pass x3 in both arms. KERNEL gpu-pattern=0 gpu-warn=0.MERGE-GATE pair gate (gate-dk.plan, kernel + Mesa pair, floor 1) vs base1: 0 regressions, KERNEL gpu-pattern=0 gpu-warn=0. The only lines are the policy-class conformance_version case and one timing-class shader_object.performance case, both outside the verdict.
Not fixed by this: a separate, pre-existing two-client bug
When two processes run large mesh draws at the same time, mesh output is lost or corrupted in a few processes. This is independent of this change. Over two boots, two-client mvstress --big (a fresh-process aggressor beside 3-iteration victims), failing processes per arm:
Compile: fedora-kcheck OK on the Neo kit config (vmlinux, Image, aurora.ko; no new warnings).
🤖 Generated with Claude Code