Skip to content

drm/asahi: g18: grow the parameter buffer when the firmware asks (10 s GPU stalls on the M6 Mac mini) - #2242

Merged
RyanTheTide merged 5 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/g18-pb-grow
Nov 22, 2026
Merged

RyanTheTide merged 5 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/g18-pb-grow

Conversation

@sithglan

@sithglan sithglan commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #2241, whose fixed 30-block parameter buffer was not enough for Google Maps.

On the J873 (M6 Mac mini), zooming into Google Maps in Firefox or Chromium stalled the GPU for 10 s, and the browser's submit then failed with EIO:

G18_EVENT role=0 ordinal=3517032 type=6 payload=[3, 0, 0, 0, 0]
G18_APP_WAIT frame=3517033 ms=1000 ... (repeats until 10000)
G18_JOB_WATCHDOG application completion ms=10000: requesting recovery
G18_APP_JOB_FAILED error=Error(5) recovery epoch=1 host=true ...

Event type 6 is the firmware's TVB grow request. Its record has the M5 TvbGrowEventRecord layout: VM slot, buffer slot, counter, subpipe, and the halt count, which is the recovery epoch. The G18 parameter buffer had 8 blocks (4 MiB) and nothing answered the request.

This PR answers it the way the M5 driver handles a firmware-requested growth (Manager::commit_growth without a descriptor):

  • Back 16 more blocks as one object, homed in the PB's storage VM like the initial blocks and aliased into the running client's VM.
  • Write their first page numbers into the block table at the ring slots after total, then advance total and committed.
  • Reply with a TvbGrowReply (device-control opcode 8, grew = 1) and the 0x84/0x11 control doorbell. The firmware builds the page-list entries itself.

The PB grows up to the ring the firmware is given, PB_CAPACITY (1650) slots less the one kept empty: 1648 blocks, 824 MiB (second commit). Before, growth stopped at 254 blocks (127 MiB), because the block table in front of the shared header held 256 entries; a scene needing more (about 1.1M triangles) stalled 10 s and failed with EIO. The table stays at the start of the PM graph with room for every ring slot, and the shared header, counter and scene records move up behind it. Placing the table behind the scene records instead faulted the first frame. Telling the firmware a lower maximum (state +0x7c) did not help: the firmware does not render partially when a grow is refused. To hold the blocks, the graphics-pb window grows from 16 MiB to 832 MiB. Its biased half stays inside the COMPACT_BIAS + [32 MiB, 2 GiB) range that Mesa leaves to the kernel. The PB is retained with the session, so a scene that grows it to N blocks keeps N × 512 KiB allocated.

Two per-frame checks assumed the PB never changes:

  • The PB row's page count, which the firmware raises, may now grow up to the backed blocks.
  • The outer-ring publication now expects the primary control ring past the grow replies published since boot.

A grew = 0 reply alone leaves the tiler stalled, so it is only sent when growth fails or the PB is at its limit.

Tests on the M6 (J873 #10 stack). The port to the integration tip compiles; integration has no layouts field, so the control ring offset comes from G18G_26A428_CONTROL_RING_BUNDLE_OFFSETS.

The integration tip cannot run the G18 GPU on this M6: its macOS 27.2 (26B123) firmware needs #1652, and without it the probe stops at stage 10 ("needs /chosen aurora,g18g-gpu-firmware-profile"). So the hardware rows, including the admission rows in the comments, ran on the port of these three commits onto the J873 desktop tree.

  • Headless GLES test, N triangles of about 200 px into 2560x1440:

    N before with this PR
    60000 10 s stall, EIO grows on the first frame
    150000 – grows on the first frame, then 10 ms per frame
    600000 – grows on the first frame, then 44 ms per frame
    1000000 – 51 ms per frame
    1500000 – 101 ms per frame
    2000000 – 135 ms per frame
    3000000 – 205 ms per frame
    5000000 – 345 ms per frame, PB grown to 1144 blocks
  • The frame that grows, including three grows within one frame, matches llvmpipe except for single edge pixels. Small scenes show the same.

  • Two clients alternating 600000-triangle frames render all 40 frames.

  • Tiny frames of two alternating clients take as long with a 254-block PB as with 8 blocks: 2.66-2.88 s against 2.71-2.77 s for 2x2000 frames. That needed one object per grow step; per-block aliases cost about 0.3 ms per client switch.

  • Zooming into Google Maps in Firefox grows the PB to 40 blocks (20 MiB) and no longer stalls.

Follow-up (separate change, from the limit row): a refused growth fails only the requesting client's render, but not until the 10 s job watchdog fires, and each such stall holds the GPU for every client (the other client averaged 65 fps instead of ~490 during the limit row). A client at its limit should have its render failed as soon as the growth is refused. Done in #2758, which is stacked on this PR.

Not part of this PR: Maps still draws wrong colours on G18G, with the original module too. Mesa refuses translucent 4x MSAA draws ("draw exceeds the native triangle profile: multisampled"), which aurora-silicon/mesa#407 works around.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

sithglan commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Pushed a second commit, c125bce9049d, that lifts the 254-block limit. The PB now grows to the ring the firmware is told about (1650 slots), so scenes past ~1.1M triangles no longer stall 10 s and fail with EIO.

Why this shape, from runs on the J873g:

  • With pm_15c (state +0x7c) at the host's 254-block limit, the firmware still asked again after the refused grow and waited for the watchdog. It doesn't fall back to a partial render, so the limit has to be real capacity.
  • With the block table moved behind the scene records (+0x8000 of a 0xc000 graph), the first frame faulted.
  • With the table kept at the start of the graph and the shared header, counter and scene records moved up to 0x3400, 0x3500 and 0x4000, everything works.

J873g rows (asyncbench, headless, run on the M6 tree with the same constants; this branch compiles with them):

triangles before now
1.5M 10 s stall, EIO 101 ms per frame
2M 10 s stall, EIO 135 ms
3M – 205 ms
5M – 345 ms, PB at 1144 blocks (572 MiB)
  • No watchdog and no refused grow across all of them.
  • The checksum pixel matches llvmpipe at 1.5M and 5M.
  • 20000 triangles a frame is unchanged within run-to-run noise: 563–696 fps fresh and 606–791 after the PB grew, against 587–662 on the module without the change, five runs each.

The cost is memory: the PB stays with the session, so after the 5M scene 572 MiB stay allocated until reboot (the same holds for the 127 MiB before). If that's too much, a lower cap would mean lowering the ring the firmware is given (capacity, state +0x38) with it. I haven't tested that; lowering pm_15c alone didn't help.

cc @DjDeveloperr @RyanTheTide @Acelogic @LiamRay10

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 1.

I checked the grow path end to end. The event 6 fields are read in initdata/mod.rs and answered after the drain. grow() checks total == committed and that the ring has room, writes the table slots, then advances total and committed behind fences. The reply echoes every request field, and control_retired() follows the extra primary-ring records. The PB row check now accepts the grown page count up to the backed blocks. The table move is covered by the const _ assert in queue/graphics.rs. I found no ordering or cursor bug.

  1. queue/graphics_application.rs:136: every growth is a new_wc_at() → gem::new_kernel_object_wc() object, i.e. a memacct::Charge::kernel that only records the bytes (memacct.rs:302). Nothing checks the device or per-client limit before allocating, and nothing gives the blocks back: the PB lives with the session and is shared by later clients. One page that draws a large scene (any client, e.g. a browser tab) can pin up to 1648 x 512 KiB = 824 MiB of kernel memory until reboot, and that memory is never counted against the client that caused it. Before taking a growth, check it against memacct::LEDGER.limit and the requesting client's limit, as g17's busy_growth_admitted() does. When the check fails, reply grew = 0. That client's frame then fails, as it does today at the block limit, but the device and other clients keep their memory. Also return the grown blocks once the session is idle (g17 Manager::shrink), or state in the commit message why the firmware cannot take a smaller ring after growing.
  2. Nit, uapi/render_policy.rs:10-14: the comment says one ring slot stays empty, but PB_MAX_BLOCKS = PB_CAPACITY - 2 leaves two. Either give the reason for the second slot or use - 1; grow() already refuses retained + added >= capacity.

If an LLM helped with the series, the PR body's last line should be Assisted-by: LLM (<vendor>:<model>).

HW row: J873, this head on the integration tip. Run the 5M-triangle headless scene, then a 20000-triangle row, and record memacct kernel_resident before and after. Run Google Maps zoom in Firefox. Run two clients alternating. Pass criteria: no watchdog or recovery, plus 0 AVC, 0 failed units and 0 new kernel errors. Also check that a growth past the memory limit is refused with grew = 0 and fails only that client's job.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of f8b3b9e: No blockers.

Earlier points:

  • Growth not admitted against the memory limits: resolved. drivers/gpu/drm/asahi/g18/queue/graphics_application.rs:143-147 admits each growth through memacct::LEDGER.admit() against the requesting client's limit and the device limit (kernel_resident included) before allocating, and an ENOMEM reaches answer_tvb_grow() as "not grown" (g18/boot/mod.rs:1105-1118). The client is the right one: grow_parameter_buffer() takes job.vm(), which G18ExecutionContext::rebind() (mmu/t8152.rs:471) has set to the file VM created with_memory_client() (file.rs:713). All failures between the admit and the publish drop the Commit, so the bytes are given back, and charges.reserve() happens before the table is written (:164).
  • Grown blocks never given back: resolved by the commit message, which explains that the firmware's ring only grows and that lowering total would take slots the firmware may still hold. The blocks stay charged to the client that grew them, so the device limit bounds them.
  • PB_MAX_BLOCKS comment: resolved. g18/uapi/render_policy.rs:15 is now PB_CAPACITY - 1, which matches the retained + added >= capacity refusal at graphics_application.rs:138.
  • Assisted-by line: resolved.
  1. Nit, g18/queue/graphics_application.rs:143-151: if client is None, the growth still goes through new_wc_at() as an unadmitted kernel object, which is the old unbounded path. With the rebind above this can't happen for a running render. Returning ENOMEM there would fail closed and would let the new_wc_at() branch go.

HW row: J873, this head on the integration tip, default command line: the 5M-triangle headless scene and two clients alternating 600000-triangle frames, with memacct user_committed/kernel_resident read before and after. The grown bytes should show up as the growing client's committed bytes, not as kernel memory. Then lower the client limit below the PB needed for the 5M scene: only that render fails with "not grown: ENOMEM", the other client keeps rendering, and there is no firmware recovery. Plus 0 AVC, 0 failed units and 0 new kernel errors. The test table in the PR body predates this commit.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide rows on the J873g, plus one fix they turned up. Head 400ec544c904.

Fix found by the refusal row: the limits were never set on G18. memacct's configure() ran only in the probe of the other generations. The G18 driver (aurora-g18) goes straight to probe_g18(), so on the J873 gpu_memory read limit 0 client_limit 0, meaning "none", and nothing could be refused. The G18 probe now calls LEDGER.configure() too. With it the J873 logs GPU memory limits: device 10346 MiB, per client 463 MiB at a 3 % client limit, and 50 % by default.

Setup:

Boot 1 (admission, limits at their default, before the probe fix):

step user_committed kernel_resident result
after boot 160,727,040 43,991,040
5M-triangle scene, 10 frames 756,318,208 (+595,591,168 = 1136 blocks × 512 KiB) 43,991,040 (unchanged) 300 ms/frame, PB 8 → 1144 blocks
20k triangles, 300 frames unchanged unchanged 463.8 fps
5M again, PB already grown unchanged unchanged 301 ms/frame, no growth
5M and 20k at once, 3 rounds unchanged unchanged 2.8 fps and 68 fps, err=0
Google Maps in Firefox, dragged by hand by the owner +14 MB (Firefox's buffers) unchanged no PB growth, no stall
  • The growth is now the requesting client's held memory, not kernel memory. It stays charged after that client exits, because the PB keeps it.
  • GPU job failures 0, AVC 0, failed units 0. The 3 kernel error lines are the existing btcentauri probe errors.

Boot 2 (client_mem_limit_pct=3, 463 MiB; device limit 10346 MiB):

  • A 20k client ran for the whole test. A 5M scene ran next to it.
  • The 5M client's growth was refused: 7 times G18_TVB_GROW ... vm_slot: 3 ... not grown: Error(12), gpu_memory refused 9. Its own GEM_CREATE calls were also refused with ENOMEM at the limit.
  • Each refused frame stalled until the 10 s watchdog, then failed: G18 job failed: submission 1235 pid 1121 (asyncbench): Error(5). All 7 failures are that pid.
  • The other client kept working: 6000 frames, err=0. It averaged 73 fps over the 82 s because the GPU waits during each stall. After the test, 20k ran at 492 fps.
  • AVC 0, failed units 0. The kernel error lines are the 7 watchdogs and recoveries of that client, and btcentauri.

So a refused growth costs every client the stall, about 10 s per refused frame, which is how it already behaved at the block limit. Only the client that asked loses work.

Shrinking: still not done. The commit message says why: grown blocks are not given back, because there is no known message that makes the firmware drop them.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 400ec54: No blockers.

Since f8b3b9e the third commit gained one change: drivers/gpu/drm/asahi/g18/probe.rs:69 now calls memacct::LEDGER.configure() before probe_g18(), as driver.rs:349 does for the other generations. That is the fix the admission needed. Without it both limits read 0 ("none") on G18, so admit() at graphics_application.rs:144-145 could never refuse anything. configure() (memacct.rs:158) only reads si_meminfo() and stores the two limits, so calling it from either probe is harmless. The rest of the commit is unchanged from what I reviewed.

Earlier points:

  • Nit, None-client branch fails open: not resolved. g18/queue/graphics_application.rs:146 and :151 still allocate an unadmitted kernel object when client is None. The previous note still applies: return ENOMEM there and drop the new_wc_at() branch.
  • Test table predates the commit: resolved by the J873 rows in the PR comment (Boot 1: the growth shows up as user_committed +1136 blocks and kernel_resident stays flat; Boot 2: at a 463 MiB client limit only the growing pid fails and the other client renders 6000 frames with err=0). The commit message should also say that configuring the limits on G18 applies them to every G18 GEM allocation, not only to PB growth: Boot 2 shows GEM_CREATE refused with ENOMEM at the limit.

HW row: J873, this exact head on the integration tip rather than the port onto the desktop tree, default command line: the 5M-triangle scene plus a 20000-triangle client, with user_committed/kernel_resident read before and after. Pass: the growth is charged to the user client, there are no watchdogs, and there are 0 AVC, 0 failed units and 0 new kernel errors. If the J873 can only boot the desktop tree, say so in the PR body and keep the port rows.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide thanks. Head e8f44812c803, amending the third commit:

  • None client: fixed. grow() now refuses a growth with no client to charge (client.ok_or(ENOMEM)?), so the new_wc_at() branch is gone. Every grown block is admitted and held as the client's charge. drivers/gpu/drm/asahi/ builds with no new warnings.
  • Commit message: now says that configuring the limits on G18 applies them to every G18 GEM allocation, not only to PB growth: at the limit, GEM_CREATE fails with ENOMEM, as Boot 2 showed. It also mentions the no-client refusal.
  • HW row: the integration tip can't run the G18 GPU on this M6. Its macOS 27.2 (26B123) firmware needs drm/asahi: g18: J873 G18G on the macOS 27.2 (26B123) firmware #1652, and without it the probe stops at stage 10 ("needs /chosen aurora,g18g-gpu-firmware-profile"). The PR body now says the rows ran on the port onto the J873 desktop tree, and they stay as posted. I'll redo Boot 2 (5M-triangle scene plus a 20000-triangle client, user_committed/kernel_resident before and after) on this head's port when the M6 is free, and post it here.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide here are the two rows I promised, run on the port of head e8f44812c803. As before, the port goes onto the J873 desktop tree: integration/aurora + #2623, #2242, #2652, #2679 (opt-in) and #2680, plus the local gpu_memory sysfs registration. Kernel 7.3.0-aurora-j873-avd-usb4-perf+.

Default limits (device 10346 MiB, per client 7721 MiB):

step user_committed kernel_resident result
after boot 142,819,328 37,388,288
5M-triangle scene, 10 frames 730,021,888 (+587,202,560 = 1120 blocks × 512 KiB) 37,404,672 296 ms/frame, PB grown in 70 steps to 1144 blocks
20k triangles, 300 frames unchanged unchanged 493 fps
5M again, PB already grown unchanged unchanged 296 ms/frame, no growth
5M and 20k at once, 3 rounds unchanged unchanged 2.9 fps and 121 fps, err=0
  • The growth is charged to the requesting client: user_committed grew by exactly the grown blocks. kernel_resident changed by 16 KiB.
  • refused 0, 0 watchdogs, 0 GPU job failures, AVC 0, failed units 0.
  • Other kernel error lines in this boot came from the btcentauri probe and from a local display-driver test module. Neither is part of this PR.

client_mem_limit_pct=3 (per client 463 MiB). A 20k client ran for the whole test, and a 5M scene ran next to it:

  • The 5M client was refused, gpu_memory refused 14. Its GEM_CREATE calls also failed with ENOMEM at the limit.
  • 8 jobs failed after the 10 s watchdog, all from that client (submission 1254 pid 1176 (asyncbench): Error(5)).
  • The other client kept working: 6000 frames, err=0. Over the 92 s it averaged 65 fps, because each stall holds the GPU. Afterwards, 20k ran at 494 fps.
  • After the test, user_committed was 229,769,216 and kernel_resident 37,355,520.

This matches the rows on 400ec544c904. The refused client and its stalls behave the same, and nothing is charged to the kernel.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed at e8f4481: both points are fixed. grow() refuses with no client (client.ok_or(ENOMEM)?) before anything is allocated, so every grown block is admitted, and the commit message now says the limits apply to every G18 GEM allocation. The rows on the desktop-tree port are accepted for the reason given (the tip can't run the G18 firmware without #1652).

One follow-up from your own limit row, not blocking this PR: a refused growth "fails only that render", but the render only fails when the 10 s watchdog fires, and each of those stalls holds the GPU, so the other client averaged 65 fps instead of ~490 over the test. A client at its limit should have its render failed as soon as the growth is refused rather than left for the watchdog. Worth a separate change; please note it in the PR body so it isn't lost.

Nit: the new Rust in graphics_application.rs isn't rustfmt-formatted (several statements per line); rustfmt on the file would make the next review easier.

Approve.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide thanks.

  • rustfmt: the new head 4c7d852edcbe adds one formatting-only commit. It runs rustfmt with the tree's .rustfmt.toml over all of graphics_application.rs, since the existing code there had several statements per line too. rustfmt --check passes, and drivers/gpu/drm/asahi/ builds with the same warnings as before (all of them are in other files).
  • Fail fast at the limit: noted in the PR body as a follow-up. I'll do it as a separate change, so that a refused growth fails the render right away instead of after the watchdog.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide the fail-fast follow-up is #2758, stacked on this PR. A refused growth now ends its render within milliseconds: the 20k client next to the refused scene ran at 494 fps instead of 65, with 0 watchdogs. The default-limit row is unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

The G18 render path backs the tiler's parameter buffer with 8 blocks
(4 MiB) and never grows it. When a scene needs more, the firmware posts
event type 6, a TVB grow request in the M5 TvbGrowEventRecord layout,
and the tiler waits for the host. Nothing answered, so the frame stalled
until the 10 s job watchdog requested a recovery, and the client's
submit failed with EIO. Zooming into Google Maps in Firefox or Chromium
on the J873 (M6 Mac mini) hits this.

Answer the request as the M5 driver does for a firmware-requested
growth (Manager::commit_growth without a descriptor): back 16 more
blocks as one object, write their first page numbers into the block
table at the ring slots after the total cursor, advance total and
committed, and reply with a TvbGrowReply (device-control opcode 8,
grew = 1) plus the 0x84/0x11 control doorbell. The firmware builds the
page-list entries itself. A "not grown" reply leaves the tiler stalled,
so it is only sent when growth fails or the buffer is at its limit.

The PB grows to at most 254 blocks (127 MiB): the block table before
the shared header holds 256 ring slots. The graphics-pb VA window grows
from 16 to 128 MiB for that; its biased half stays inside the
COMPACT_BIAS + [32 MiB, 2 GiB) that Mesa leaves to the kernel. The new
blocks are homed in the PB's storage VM like the initial ones and are
aliased into the running client's VM; a later client maps every block.

Two per-frame checks assumed the PB and the control ring never change:
the PB row's page count may now grow up to the backed blocks, and the
outer-ring publication expects the primary control ring past the grow
replies published since boot.

A headless GLES test drawing N triangles of about 200 px into 2560x1440
stalled at 60000 triangles before. Now 150000 and 600000 triangles grow
the PB on their first frame and render in 10 and 44 ms afterwards; the
images match llvmpipe apart from single edge pixels, as small scenes do.
One million triangles reach the limit and still stall. Two clients
alternating 600000-triangle frames render all frames. Tiny frames of two
alternating clients take the same time with an 8-block and a 254-block
PB (2.66-2.88 s vs 2.71-2.77 s for 2x2000 frames). Zooming into Google
Maps in Firefox now grows the PB to 40 blocks (20 MiB) without a stall.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…e is given

The PB's ring is described to the firmware with PB_CAPACITY (1650) slots,
but growth stopped at 254 blocks, because the block table in front of the
shared header held 256 entries. A scene that needs more than 127 MiB of
PB, about 1.1M triangles of the headless test, made the firmware ask again
after a refused grow and then wait until the job watchdog: a 10 s stall
and EIO, as before the growth support. Telling the firmware a lower
maximum (state +0x7c) changed nothing; it does not render partially there.

Make room for the whole ring instead. The block table stays at the start
of the PM graph and holds PB_CAPACITY entries; the shared header, the
counter and the scene records move up behind it (0x3400, 0x3500, 0x4000).
Placing the table behind the scene records, at +0x8000 of a larger graph,
faulted the first frame. PB_MAX_BLOCKS follows PB_CAPACITY, and the
graphics-pb window grows to 832 MiB to hold that many blocks, still inside
the COMPACT_BIAS + [32 MiB, 2 GiB) range Mesa leaves to the kernel. The
job's ring capacity now comes from PB_CAPACITY rather than a second 1650.

The PB is retained with the session, as before: a scene that grows it to
N blocks keeps N * 512 KiB allocated.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A PB growth was a kernel object: the device and per-client memory limits
never applied to it, and its bytes were counted as nobody's. The PB lives
with the session and is shared by later clients, so one client drawing a
large scene could pin up to 1649 blocks (about 824 MiB) until reboot.

Admit each growth against the requesting client's limit and the device
limit first, as g17 admits its pools, and keep the blocks as that client's
held memory (a user charge on a kernel object). A refused admission fails
the growth with ENOMEM: the firmware gets "not grown", and only the render
that asked fails, as at the block limit. A growth with no client to charge
is refused the same way, so nothing grows unadmitted.

The G18 driver's probe never configured the limits (memacct's configure()
ran only in the other generations' probe), so on the J873 both read 0,
"none", and nothing could be refused. Configure them there too. That
applies the limits to every G18 GEM allocation, not only to PB growth: at
the limit, GEM_CREATE fails with ENOMEM as it does on the other generations.

Grown blocks are not given back. The firmware's ring is only ever
extended: it asks with event 6, and the host answers by writing the new
table slots and advancing total and committed. No message is known that
makes the firmware drop blocks it was given. Lowering total behind its
back would take away slots it may still hold, so until such a message is
found the grown blocks stay with the session, held by the client that
grew them. The limits bound how much that can be.

The ring keeps one slot empty to tell a full ring from an empty one, so
PB_MAX_BLOCKS is PB_CAPACITY - 1.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The parameter buffer growth code added to this file in the previous
commits kept several statements per line, like the rest of the file.
Format the whole file with rustfmt (the tree's .rustfmt.toml), so the
next change to it can be read and reviewed line by line. No functional
change; rustfmt --check passes and the driver builds with the same
warnings as before.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-checked at c48d68d (rebased onto 24dc422): range-diff equal for three commits; the first only picks up the layouts field that landed in the struct initializer upstream. Approval stands at this head.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora 24dc422773c9, because the branch conflicted after #1652 landed. The new head is c48d68d78dff; the old one was 4c7d852edcbe.

  • One conflict, in g18/initdata/mod.rs. drm/asahi: g18: J873 G18G on the macOS 27.2 (26B123) firmware #1652 added a layouts field to G18FirmwareMemory, next to this PR's tvb_grow and control_published. The constructor now sets all three. Nothing else changed.
  • Range-diff:
    • commits 2-4 are identical;
    • commit 1 differs only in that constructor line.
  • Build: every commit builds drivers/gpu/drm/asahi/ (arm64, LLVM 22). No warnings come from a file this PR touches.

The review was at e8f44812; nothing in the PR's own diff changed since.

Assisted-by: LLM (Claude:Opus 5.5)

…rol ring

reply_tvb_grow() placed the TvbGrowReply at the 26A428 control ring
offset, a fixed constant. The shared-memory layout is per firmware build
since the InitData profiles, and the IdlePowerOff record next to it
already takes the ring from self.layouts. With 26B123, which the J873g
loads today, the reply went to the wrong place: the tiler waited for it
and every render that needed a second parameter buffer block stalled
until the watchdog.

Take the ring from the admitted profile, as IdlePowerOff does.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide @DjDeveloperr a new commit on this head, now 83ccd92e789b: "drm/asahi: g18: write the grow reply into the firmware profile's control ring". reply_tvb_grow() wrote the TvbGrowReply at the fixed 26A428 control-ring offset. Since #1652 the shared layout follows the admitted firmware profile, so with 26B123 (the J873g default) every render that needed a second block stalled until the watchdog. It now takes self.layouts.shared.control_ring[0], as IdlePowerOff does. Ryan's smoke on the merged tip found it: integration + #1797 + #2758 on the J873g. The before and after rows are on #2758: #2758

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 83ccd92. The four earlier commits are unchanged from c48d68d. The new commit replaces the last fixed 26A428 offset on this path: reply_tvb_grow() now takes self.layouts.shared.control_ring[0] from the admitted profile, as IdlePowerOff already does. The 26A428 names left under g18/ sit only inside the per-profile selectors in g18/fw/initdata.rs, so I found no other use of a profile-blind offset. The fault (every second-block render stalled until the watchdog on 26B123) fits the old code exactly. Re-approving at this head. Please link the J873g before/after rows at 83ccd92 here once they are up.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide the J873g before/after rows at 83ccd92e (in #2758 at 61f7b3d3) are here: #2758 (comment)

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide merged commit 83ccd92 into aurora-silicon:integration/aurora Nov 22, 2026
1 check passed
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.

2 participants