Skip to content

drm/asahi: keep the render wait of fragment barriers on G13 and G14 - #3100

Merged
DjDeveloperr merged 1 commit into
mainfrom
fix/asahi-legacy-fragment-barrier-waits
Nov 25, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
fix/asahi-legacy-fragment-barrier-waits

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

What: Keep the render dependency when a command asks to wait only in its fragment half on G13, G14 and G14X. This prevents a post-processing pass from sampling the previous pass before it finishes and gives userspace a feature bit for the corrected behavior.

Tested: Fedora aarch64 compile and link at a28f61ac88117858ee2a9502e0c7447b70743f44 passed, including Image, vmlinux and aurora.ko.

Risk: One-way UAPI addition for G13, G14, G14X and G17. The queue change affects G13, G14 and G14X.

Not yet: render.postfx hardware confirmation on J316s and J413, plus a regression run on J773g.

Details

Kernel commit 24a7cfa37871 exposed fragment barriers on the legacy backend. For a flagged render it omitted the explicit wait on prior render work. Attach the wait to the fragment job so the vertex half can overlap the previous render. Advertise DRM_ASAHI_FEATURE_ORDERED_FRAGMENT_BARRIERS on this backend and on G17, where the firmware already carries the dependency.

Thanks to Ryan and the PEER-ROWS testers for isolating the failure on J316s and J413.

Evidence
  • Mesa #979 records the hardware bisect from 83150137f7fe (pass) to 3fc1b773a416 (fail). The failing runs have varying CRCs and pass with ASAHI_MESA_DEBUG=sync.
  • Fedora arm64 build with the fleet config returned exit 0 and linked 1,992 modules, including aurora.ko.
  • Hardware confirmation command with the Mesa candidate active: EGL_PLATFORM=surfaceless gpubench-gl --test render.postfx --param res=1080p --param msaa=1 --depths 1 --warmup-ms 20 --runs 2 --run-ms 100 --timed-runs 1 --verify. Run three times and record valid, CRC and GPU faults.

Since commit 24a7cfa ("drm/asahi: accept FRAGMENT_BARRIERS on G13,
G14 and G14X"), a render command that sets
DRM_ASAHI_RENDER_FRAGMENT_BARRIERS gets no wait at all for the earlier
renders its barriers name. The legacy queue relies on the fragment
workqueue running that work first, but queue order alone does not make
it finish first. Mesa's Gallium driver started setting the flag on
render passes that sample the previous pass's output, and on M1 Pro and
M2 Air gpubench-gl render.postfx then reads that output before it is
complete: the image is wrong and changes from run to run.

The UAPI says the dependencies of such a render are attached to its
fragment half instead of its vertex half. Do that: add the explicit
barrier to the fragment job, which already waits for its own vertex job
the same way. The vertex half still runs beside the earlier fragment
work, which is the point of the flag.

Kernels with 24a7cfa report DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS but
drop the wait, so userspace cannot tell them apart by that bit. Add
DRM_ASAHI_FEATURE_ORDERED_FRAGMENT_BARRIERS (bit 44), which says the
fragment half does wait, and report it on this backend and on G17,
whose firmware fragment barriers already carry the render dependencies.

Fixes: 24a7cfa ("drm/asahi: accept FRAGMENT_BARRIERS on G13, G14 and G14X")
Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>

Copy link
Copy Markdown
Contributor Author

J773g (T8132, Apple M4, G16G B0): correctness PASS, depth-1 postfx performance regression. The geometry throughput gain did not reproduce.

  • Linux PR head a28f61ac88117858ee2a9502e0c7447b70743f44, built as 2b1ef4c6bfb0fbd1ea7d5f2fe2bf46bcbb9b3229 with main 38ffa67c1ec0 for the J773g Wi-Fi DART fix. The original and merged PR diffs have the same stable patch ID 5dbc2c44625593cff1595b3160f4ec328c710863.
  • Mesa PR head f4112f137449c5f57281948286ae5fdd3c8b0e2d, GL reported git-f4112f1374. Same-kernel control 3432e675337d, GL reported git-3432e67533. GET_PARAMS on 7.3.0-ARCH-m4pr3100 returned 0x0000010000001c02 with bits 14 and 44 clear, as expected for G16G.
  • Native GL, gpubench-gl ae90a40, surfaceless, shader cache disabled. Control/candidate/candidate/control on the same boot. Values are medians with window ranges in brackets. Postfx used 1080p, two 100 ms windows per invocation and --verify. Geometry used three 1 s windows per invocation.
Test Reverted Mesa Mesa #989 Change
Postfx d1 MSAA 1 (fps) 250 [240–270] 190 [160–200] −24.00%
Postfx d1 MSAA 4 (fps) 230 [220–260] 155 [130–160] −32.61%
Postfx d2 MSAA 1 (fps) 275 [270–300] 300 [290–300] +9.09%
Postfx d2 MSAA 4 (fps) 225 [220–240] 225 [210–230] 0.00%
Light d1 (µs/submit) 426.60 [409.84–446.43] 426.60 [414.94–448.43] 0.00%
Heavy geom d4 (Mtri/s) 378.80 [375.65–379.06] 378.01 [376.44–380.11] −0.21%

The earlier same-kernel ABBA also showed d1 regressions of 33.33% and 27.91% and overlapping geometry ranges. The d2 MSAA 1 result changed direction between runs. The separate installed-stack baseline (7.3.0-ARCH-m4prod25d, git-d4ad4a4dce) gave 540 and 285 fps for d1 MSAA 1 and 4, and 608.17 Mtri/s for geometry d4.

Final run: 12/12 verified commands per arm, and 3/3 on the installed stack. Both private Mesa builds gave matching postfx CRCs 2133faaa (MSAA 1) and 9d7ff6f3 (MSAA 4). Zero GPU faults, timeouts, recoveries, hang kills, or failed units. Display manager active and /lib -> usr/lib. Restored 7.3.0-ARCH-m4prod25d with aura-383-r3-stage2.bin and removed the private kits and candidate modules.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Paired REQ fbb9ee3a (mesa#989 f4112f137449 + linux#3100 a28f61ac8811) PASS on J316s (M1 Pro, G13S C0) and J413 (M2 Air, G14G B0) (MESA_SHADER_CACHE_DISABLE=1, EGL_PLATFORM=surfaceless, gpubench-gl --test render.postfx --param res=1080p --param msaa=1 --depths 1 --warmup-ms 20 --runs 2 --run-ms 100 --timed-runs 1 --verify):

  • Step 1 — mesa#989 (f4112f137449) on existing saved 7.3.0-aurora-fleet89 (features=0x10000004001, bit 40 FRAGMENT_BARRIERS=1, bit 44 ORDERED_FRAGMENT_BARRIERS=0, fallback path):
    • J316s: 3/3 PASS valid=true crc=b52e3012 (380 / 355 / 345 fps), dEQP-GLES3 abs 48/48, dEQP-VK api.smoke 8/8, 0 GPU faults, 0 AVC, 0 failed units, Enforcing.
    • J413: 3/3 PASS valid=true crc=b52e3012 (430 / 400 / 365 fps), dEQP-GLES3 abs 48/48, dEQP-VK api.smoke 8/8, 0 GPU faults, 0 AVC, 0 failed units, Enforcing.
  • Step 2 — mesa#989 (f4112f137449) on exact linux#3100 (a28f61ac8811, guarded one-shot 7.3.0-aurora-pr3100+, default cmdline, features=0x110000004001, bit 40=1, bit 44=1):
    • J316s: 3/3 PASS valid=true crc=b52e3012 (410 / 410 / 400 fps), msaa=4 valid=true crc=db8e2768 (350 fps), render.light GL+VK + compute.light VK ok, dEQP-GLES3 abs 48/48, dEQP-VK api.smoke 8/8, 0 GPU faults, 0 AVC, 0 failed units, Enforcing; restored saved 7.3.0-aurora-fleet89.
    • J413: 3/3 PASS valid=true crc=b52e3012 (470 / 510 / 565 fps), msaa=4 valid=true crc=db8e2768 (415 fps), render.light GL+VK + compute.light VK ok, dEQP-GLES3 abs 48/48, dEQP-VK api.smoke 8/8, 0 GPU faults, 0 AVC, 0 failed units, Enforcing; restored saved 7.3.0-aurora-fleet89.

@DjDeveloperr
DjDeveloperr marked this pull request as ready for review November 25, 2026 01:46
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 25, 2026 01:46
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) door:one-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at a28f61ac: not ready yet

Check Detail
CI at head ok 3 checks passed
Review no approved by satchlj, but GitHub does not count it yet (code owner from Core or Omarchy Mac needed, or approval went stale)
Requested changes ok none
Hardware row at head ok comment at a28f61ac
Conflicts ok none
PR text ok Risk: one-way · UAPI addition for G13, G14, G14X and G17. The queue change affects G13, G14 and G14X.

Areas: area:gpu

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

@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.

Gemini 4 Neon on @satchlj's behalf

Verdict at a28f61ac8811

Approve. Re-attaching render_wait to the fragment job fixes the missing dependency on G13/G14/G14X without blocking vertex overlap, and adding DRM_ASAHI_FEATURE_ORDERED_FRAGMENT_BARRIERS cleanly separates fixed kernels from 24a7cfa37871 for userspace.

Blockers

None.

Checked

  • 4 changed files (include/uapi/drm/asahi_drm.h, drivers/gpu/drm/asahi/gpu.rs, drivers/gpu/drm/asahi/g17/mod.rs, drivers/gpu/drm/asahi/queue/mod.rs) audited in full.
  • UAPI & backend coverage: DRM_ASAHI_FEATURE_ORDERED_FRAGMENT_BARRIERS (1ULL << 44) is advertised on the exact two backends that advertise DRM_ASAHI_FEATURE_FRAGMENT_BARRIERS (gpu.rs for G13/G14/G14X and g17/mod.rs for G17; verified g15, g16, g18 do not advertise FRAGMENT_BARRIERS).
  • Queue ordering fix: queue/mod.rs moves the explicit render_wait barrier to job.get_frag()? when DRM_ASAHI_RENDER_FRAGMENT_BARRIERS is set (keeping job.get_vtx()? otherwise) instead of dropping it, preserving vertex overlap while ensuring fragment execution waits on earlier render barriers.
  • CI & trailers: host-tests, readiness / readiness, and pr-text / pr-text all SUCCESS; commit carries Fixes: 24a7cfa37871 and clean Signed-off-by: with no AI trailers; exact-head a28f61ac8811 paired hardware verification is posted for J316s (G13S C0), J413 (G14G B0), and J773g (G16G B0).
  • Untested scope: Static code audit only (userspace-only review environment; no kernel build or boot performed here).
Evidence
  • Checked drivers/gpu/drm/asahi/{gpu.rs,g15/mod.rs,g16/mod.rs,g17/mod.rs,g18/mod.rs,queue/mod.rs} and include/uapi/drm/asahi_drm.h at a28f61ac8811.
  • CI at head a28f61ac8811: host-tests SUCCESS, readiness / readiness SUCCESS, pr-text / pr-text SUCCESS.

@DjDeveloperr
DjDeveloperr merged commit 2943fff into main Nov 25, 2026
6 checks passed
@RyanTheTide
RyanTheTide deleted the fix/asahi-legacy-fragment-barrier-waits branch November 27, 2026 13:21
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) door:one-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants