Skip to content

drm/asahi: m3: default to render batches of two - #2090

Open
freber wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
freber:t8122-render-batch-2
Open

freber wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
freber:t8122-render-batch-2

Conversation

@freber

@freber freber commented Nov 16, 2026

Copy link
Copy Markdown

Claude Code wrote this up from my tests.

asahi.m3_render_batch_size goes from 1 to 2, so the M3 runtime publishes up to two render passes per batch by default. The sysfs override m3_render_batch_override still wins when it's set.

Only the M3 Airs are affected. The parameter exists only with CONFIG_DRM_ASAHI_M3_T8122 and its one reader is next_batch() in m3_runtime.rs. That runtime starts on the J613 and J615 and nowhere else. M3 Pro and Max (T6030, T6031) go to the G15 backend or get refused and never read it.

The first render draw is still published alone for InitBM. The T8122 pipeline depth of 2 and the 4000 µs batch budget cap every batch as before.

Why

On my J615 (15-inch M3 MacBook Air) Chromium drops frames when it scrolls an image-heavy page at batch 1. I measured it on 14 November with the stock aurora16 module and changed only m3_render_batch_override at runtime. The page is about 21000 px tall with 101 images and a synthetic scroll runs down and back up for 20 s. Each row is the median of three runs.

Render batch Dropped frames p99 frame interval p50 frame latency
1 (today's default) 2.2 % (26 of 1190) 33.3 ms 83.5 ms
2 0 % 16.7 ms 67.4 ms
4 0.1 % 16.7 ms 67.4 ms

Two control runs at batch 1 in the same session dropped 2.6 and 2.4 percent. At batch 2 the worst of the three runs dropped a single frame. Frame latency (from vsync until the frame is on screen) fell by one refresh. Batch 4 gave the same frame pacing in Chromium, so I went with the smaller step.

To check that batching happened, I ran a burst of eight small draws. At batch 2 the runtime retired 1.6 render commands per retirement against 1.0 at batch 1. The burst's median fell from 4.53 to 4.00 ms and GPU mailbox interrupts per run dropped from 320 to 200.

Throughput in gpubench held (220.4 fps before, 222.4 after) and idle power didn't rise (7.6 W against 8.3 to 9.1 W in the batch 1 runs, one sample each). The kernel log had no GPU errors during these runs.

Daily use

Batch 2 has been my everyday setting since 14 November at 16:28, through a tmpfiles.d entry that writes the override at boot. That's seven boots so far. The first two ran the stock aurora16 kernel (7.2.11-16-1-ARCH). The other five ran my J615 test kernel (7.2.11-16-1-j615-ARCH), which is aurora16 plus my J615 power and display patches with the same next_batch().

The kernel logged no GPU faults or timeouts in any of those boots. hyprland-preview-share-picker failed once, on the test kernel on 16 November, with these two lines before it crashed in libvulkan_asahi.

asahi 292400000.gpu: M3: cannot allocate 4096 KiB of GPU memory
asahi: GPU work of a client failed (ENOMEM, reported at m3/m3_submit.rs:101); the client sees a lost device

The same two lines and the same crash showed up twice on 13 November on the stock kernel at batch 1, before I had changed anything. So I don't think batching causes it.

What I haven't tested

Only my J615 has run this. The J613 (13-inch M3 Air) runs the same runtime and gets the same default, but I don't have one to try it on.

My command line also has asahi.t8122_pstate_cap=5, so batch 2 at the default cap of 2 is untested.

All my measurements used the runtime override. This branch on integration/aurora is host-tested only.

  • python3 -I tools/asahi/run-host-tests.py --only m3 passes 6 of 6 (m3-batching-tests 12, m3-runtime-tests 81, m3-firmware-tests 21 plus the three m3 Python tests). None of them read M3_RENDER_BATCH_SIZE, so they only show that nothing else moved.
  • I haven't built a kernel with it. The change is one integer literal in a static initialiser, so I'm leaving the build to CI.

How to test

On a J613 or J615 you can try it today without this patch.

echo 2 | sudo tee /sys/module/asahi/parameters/m3_render_batch_override

Then scroll a long page full of images in Chromium. With the patch nothing needs setting. Writing 1 to the override or booting with asahi.m3_render_batch_size=1 goes back to batch 1.

I asked about the default on omacom/linux-aurora#385 and didn't hear back, so I'm proposing it here. If anyone has a J613, a run with the override set to 2 would cover the one board I can't test.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ

The M3 runtime publishes one render pass at a time unless
asahi.m3_render_batch_size or the writable m3_render_batch_override
asks for more. On a J615 (15-inch M3 MacBook Air) that costs frames
while Chromium scrolls an image-heavy page. Make the boot default 2.

Measured on a J615 with the stock 7.2.11 aurora16 module, whose
next_batch() and render_batch_size() match this tree's, booted with
asahi.t8122_pstate_cap=5 and setting m3_render_batch_override at
runtime. Chromium images scene, median of three runs:

  batch   dropped frames   p99 frame interval
  1       2.2 %            33.3 ms
  2       0 %              16.7 ms
  4       0.1 %            16.7 ms

Two same-session control runs at batch 1 dropped 2.6 % and 2.4 %. With
2, a burst of eight glprobe draws retired 1.6 render commands per
retirement instead of 1.0, its median fell from 4.53 ms to 4.00 ms and
GPU mailbox interrupts per run fell from 320 to 200. gpubench
throughput and idle power stayed within noise. The kernel log had no
GPU errors.

Only T8122 is affected. This parameter exists only with
CONFIG_DRM_ASAHI_M3_T8122, its only reader is the runtime's
next_batch(), the runtime's only SoC table is T8122 and it starts only
on the J613 and J615. T6030 and T6031 keep the G15 backend or the
probe refusal. The first render draw is still published alone for
InitBM, and the T8122 pipeline depth of 2 and the 4000 us batch budget
still bound every batch. m3_render_batch_override=1 restores the old
behaviour at runtime, asahi.m3_render_batch_size=1 at boot.

The J613 runs the same runtime and gets the same default but was not
tested, and neither was the default asahi.t8122_pstate_cap of 2.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
@freber

freber commented Nov 18, 2026

Copy link
Copy Markdown
Author

Claude Code wrote this up from my tests.

I repeated the A/B with 7.3 on my J615 (15-inch M3 Air). The kernel is integration/aurora 59b02d5ef with this PR, #1985, #2145 to #2157 and a port of omacom/linux-aurora#410, #491 and #500 on top of #2147. Same images scene as in the description, Chromium 156.0.8078.79 full screen on the built-in panel. I switched m3_render_batch_override at runtime in the order 1, 2, 1, 2, with four 20 s runs per leg.

The gain depends on the CPU governor. Under schedutil, which the balanced and power-saver profiles use, batch 2 cuts dropped frames by about a quarter. Under the performance governor neither size drops any.

Batch 1 Batch 2 Batch 1 Batch 2
schedutil, dropped frames 8.4 % 6.7 % 9.9 % 6.8 %
schedutil, latency p95 117 ms 101 ms 117 ms 100 ms
performance, dropped frames 0 % 0 % 0 % 0 %
performance, latency p50 42 ms 42 ms 34 ms 34 ms

The schedutil runs were on a kernel without #2199, where every profile ends up on schedutil. The performance runs had #2199 added. The first performance pair ran a few minutes after boot and both sizes sat at 42 ms there.

In an earlier boot where the memory floor from #1985 had stopped, the schedutil A/B gave 23.7, 17.3, 23.2 and 17.0 % dropped frames. gpubench throughput didn't move (batch 1 320 fps against batch 2 312 fps in the same hour), as on 7.2.

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