Skip to content

drm/asahi: g17: size the A18 Pro tiler heap ahead of mesh shading - #2058

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/g17-mesh-tvb-floor
Nov 16, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/g17-mesh-tvb-floor

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

  • New render flag DRM_ASAHI_RENDER_MESH_OUTPUT (1U << 26), a hint that the render contains mesh shading. The non-M5 command sets advertise it with DRM_ASAHI_FEATURE_RENDER_MESH_OUTPUT (bit 38).
  • The A18 Pro sizes the tiler heap of a flagged render to its normal maximum (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.
  • M5 heaps are unchanged.

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:

Kernel Mesa Result
new (#2058) new (#389) fixed: G17P mesh renders carry the flag, and the kernel pre-sizes their tiler heap
new old as today: the kernel advertises DRM_ASAHI_FEATURE_RENDER_MESH_OUTPUT, but old Mesa never sets the flag, so no pre-sizing (bug still present)
old new as today: no feature bit, so Mesa does not set the flag. An old kernel would reject the unknown flag bit with EINVAL, which is why Mesa sets it only when the feature is advertised
old old as today

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.

Arm Mesa g17_mesh_tvb_floor tgvis PASS firmware grow requests
control system -30 (no flag) 0 0 / 2 140
no flag system -30 1 0 / 2 140
every render (test value) system -30 2 7 / 7 (n_zz x5, n_t1 x2) 0
fix aurora-wip + hk flag (791eba405a) 1 20 / 20 (n_zz x15, n_t1 x5) 0
control aurora-wip + hk flag 0 0 / 3 210
fix again aurora-wip + hk flag 1 5 / 5 0
narrow set (21 cells) aurora-wip + hk flag 1 21 / 21 0

mvstress --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_shader failed 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:

Arm Failing processes Firmware grow requests in the arm
fix on (floor 1, hint Mesa) 14 / 214 (6.5%) 0
fix off (floor 0, same Mesa) 7 / 256 (2.7%) 10,752
shipped system Mesa -30 14 / 169 (8.3%) 10,816
fix on, single client (no concurrency) 0 / 60 0
  • The fix-off and system-Mesa arms take the same kernel path and still differ by 3x, so the fix-on rate is within that spread.
  • With the heap growing mid-draw, the failure shows as whole 32-px workgroup blocks missing.
  • With a heap that never runs out, three of the 14 fix-on failures took a second shape instead: a missing block in layer 1, plus layer-0 pixels with view 1's colour (the shape of the prim_query multiview intermittent). The earlier diagnostic kit that pre-sized the heap at creation showed the same shape without this change. In that same kit, serializing renders device-wide removed both shapes.
  • This is tracked as its own fix: a cross-client render-concurrency problem, not a heap-sizing one.

Compile: fedora-kcheck OK on the Neo kit config (vmlinux, Image, aurora.ko; no new warnings).

🤖 Generated with Claude Code

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
DjDeveloperr marked this pull request as draft November 16, 2026 06:02
@DjDeveloperr
DjDeveloperr marked this pull request as ready for review November 16, 2026 07:21
@DjDeveloperr
DjDeveloperr merged commit 0b84dd9 into integration/aurora Nov 16, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the djdev/g17-mesh-tvb-floor branch November 17, 2026 23:52
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.

1 participant