Skip to content

drm/asahi: g14_v27_2: admit and encode DRM_ASAHI_RENDER_VERTEX_SCRATCH - #3455

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/g13-g14-v27-2-vertex-scratch
Nov 28, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/g13-g14-v27-2-vertex-scratch

Conversation

@sithglan

Copy link
Copy Markdown
Contributor

What:
Admit DRM_ASAHI_RENDER_VERTEX_SCRATCH (1 << 0) in m3_submit.rs:validate_render() when samplers_and_helpers is set (G13/G14 firmware 27.2 queues; M3 queues remain unchanged), and write uses_scratch at offset 0x578 (+8 bytes past sync_grow at 0x570, verified with a compile-time offset_of! assertion against RunVertexG14V13_5) in g14_v27_2_render.rs:encode_vertex().

Commit 7521672bcdc3 admitted vertex_helper on G13/G14 firmware 27.2, but validate_render() still rejected DRM_ASAHI_RENDER_VERTEX_SCRATCH with ENOTSUPP, causing VK_ERROR_DEVICE_LOST on any Vulkan render pass whose vertex/tessellation/geometry shader spills to scratch memory.

Tested:
Tested on MacBook Air M1 (J313 / T8103, G13G B1, macOS 27.2.1 firmware, Borealis Mesa git-2743969512f) with the exact m3_submit.rs and g14_v27_2_render.rs code of 57d2e880e2d6 (both files are identical to origin/main plus this 5-line patch):

  • Before: All 6 vertex-scratch crash cases in a 1/50 Vulkan CTS sweep (64,447 cases) failed with M3 render rejected ENOTSUPP: flags=0x3 -> VK_ERROR_DEVICE_LOST.
  • After:
    • All 6 previously crashing cases: 6/6 PASS, zero aurora errors in dmesg.
    • Full targeted suites (dEQP-VK.subgroups.ballot_broadcast.framebuffer.* + dEQP-VK.pipeline.fast_linked_library.vertex_input.max_attributes.*): 534/534 PASS (201 Skip, 0 Fail, 0 Crash) in 6 s, zero aurora errors.

Risk: two-way door · G13 (M1) and G14 (M2) firmware 27.2 render queues only (samplers_and_helpers = true); M3 queues keep samplers_and_helpers = false and reject DRM_ASAHI_RENDER_VERTEX_SCRATCH as before.

Not yet:

  • Not yet tested on G14 (M2 / T8112) firmware 27.2 hardware, which shares g14_v27_2_render.rs and m3_submit.rs:new_g14_v27_2().

Commit 7521672 ("drm/asahi: admit sampler heaps and helper programs
on G14 firmware 27.2") admitted vertex and fragment helper programs on
G13/G14 firmware 27.2 queues (samplers_and_helpers = true) and wired
vertex_helper.{binary,cfg,data} into encode_vertex() and TilingParameters.

However, Mesa/Borealis also sets DRM_ASAHI_RENDER_VERTEX_SCRATCH (bit 0)
whenever a vertex/geometry/tessellation shader spills to scratch memory
(hk_queue.c). validate_render() in m3_submit.rs still rejected bit 0 with
ENOTSUPP, causing VK_ERROR_DEVICE_LOST on any render pass using vertex
scratch (e.g. Vulkan CTS subgroups.ballot_broadcast, max vertex attributes,
and geometry descriptor-buffer tests).

Admit DRM_ASAHI_RENDER_VERTEX_SCRATCH in validate_render() when
samplers_and_helpers is set (leaving M3 queues unchanged), and write
uses_scratch at offset 0x578 (+8 bytes past sync_grow at 0x570, matching
the 13.5 RunVertex layout in the +0x10 band before meta at 0x580) in
encode_vertex().

Fixes: 7521672 ("drm/asahi: admit sampler heaps and helper programs on G14 firmware 27.2")
Signed-off-by: Thomas Glanzmann <[email protected]>
@sithglan
sithglan requested review from a team and DjDeveloperr as code owners November 27, 2026 23:51

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 57d2e880e2d6 (drm/asahi: g14_v27_2: admit and encode DRM_ASAHI_RENDER_VERTEX_SCRATCH):

  • Code audit: Clean, minimal 2-file fix. m3_submit.rs:validate_render() gates DRM_ASAHI_RENDER_VERTEX_SCRATCH (1 << 0) strictly on samplers_and_helpers (G13/G14 fw 27.2 queues only; M3 queues keep rejecting it), and g14_v27_2_render.rs:encode_vertex() writes uses_scratch at 0x578 with a compile-time offset_of!(Rv, uses_scratch) - offset_of!(Rv, sync_grow) == 8 assertion.
  • scripts/checkpatch.pl --strict --no-signoff: 0 errors, 1 minor 109-column line-length warning on m3_submit.rs:493.
  • Scope note: Code-review + checkpatch only (no G13/G14 fw 27.2 hardware on this bench; J313 hardware verification is covered in the PR description).

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m2 Macs affected, from Merge risk (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at 57d2e880: ready to merge

Check Detail
CI at head ok 19 checks passed
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok in the PR body at 57d2e880
Conflicts ok none
PR text ok Risk: two-way · G13 (M1) and G14 (M2) firmware 27.2 render queues only (samplersandhelpers = true); M3 queues keep samplersandhelpers = false and reject DRMASAHIRENDERVERTEXSCRATCH as before.

Areas: area:gpu
Merge: gh pr merge 3455 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot added the ready-to-merge Meets the merge policy: merge it (bot) label Nov 28, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Tested 57d2e880 on J473 (M2 mini, T8112 / G14G B0, firmware 27.2, exact-head guarded one-shot 7.3.0-aurora-pr3455+ on default fleet89 cmdline): PASS — aurora 206400000.gpu: G14 firmware 27.2 running; DRM device registered; Borealis gpubench-vk (render.light + compute.light d1/d4) and gpubench-gl (render.light d1/d4) ok; vertex-scratch Vulkan CTS 143 PASS / 0 FAIL (dEQP-VK.api.smoke.* 8/8, dEQP-VK.subgroups.ballot_broadcast.graphics.* 132/180 [48 NS], dEQP-VK.pipeline.monolithic.vertex_input.max_attributes.* 3/15 [12 NS]); 0 GPU fw crashes/faults/ENOTSUPP, Enforcing, 0 AVC, 0 failed units; cleanly restored to saved 7.3.0-aurora-fleet89.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 57d2e880. satchlj approved at this head (non-author review) and all hosted checks are green. Rows at this head: J313 M1 Air (G13G, fw 27.2) and J473 M2 mini (G14G, fw 27.2, guarded one-shot: Borealis VK+GL smoke, vertex-scratch CTS 143 pass / 0 fail). That covers both firmware 27.2 queue families this changes; M3 queues are untouched. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 0285ae5 into main Nov 28, 2026
21 checks passed
@RyanTheTide
RyanTheTide deleted the fix/g13-g14-v27-2-vertex-scratch branch November 28, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m2 Macs affected, from Merge risk (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants