Parameter Manager (PM), freelists and SPM
Geometry (TA) dynamically allocates Parameter Buffer (PB) pages from two
freelists (rogue_fwif_freelist) managed by the Parameter Manager
(PM) hardware, and Fragment (3D) frees those pages back when rendering
completes (docsClean/BXE-2-32/kick-geometry-ta, docsClean/BXE-2-32/partial-render-spm). When a freelist
runs out mid-geometry, the PM raises PM_OUT_OF_MEMORY and the SPM
subsystem either consumes reserved ready pages, asks the host to grow the
freelist, or runs a partial render (FRAG_PR).
Two PM hardware contexts
PM context 0 (“HW context 0”,
PMDM0): serves Geometry (TA).PM context 1 (“HW context 1”,
PMDM1): serves Fragment (3D).
Observed lifecycle across a geometry → fragment render pair
([spec] + E035–E038):
Before the first geometry kick of an HWRTData: load the HWRTData’s local (
N-FL) and global (U-FL) freelists into PM context 0, load zero ALIST/MLIST stack pointers, and bind the HWRTData to HW context 0.Non-first geometry kicks (
First kick:0on the same HWRTData): do not reload freelists or reset PM context 0 — the PM continues from its live stack pointers and catalogues (E039,[spec]Q16m).Before the fragment kick of that HWRTData: store the freelists from PM context 0 (capturing the stack tops and allocated page counts left by TA), load them into PM context 1 together with the geometry’s live ALIST/MLIST stack pointers and
PM_CAT_BASE_*catalogues.After fragment completion: the PM automatically returns the render’s pages to both freelists and signals
EVENT_STATUS.PM_3D_MEM_FREE(bit 8).On HWRTData cleanup: store freelists back from both PM contexts.
Local and global freelist registers
Local freelist (N-FL)
PM ctx 0 (TA) |
PM ctx 1 (3D) |
Role |
|---|---|---|
|
|
Local freelist base GPU VA (64-bit, |
|
|
Stack top to load ( |
|
|
Allocated PB / MMU page counts to load (staging, not live; E035, E036) |
|
|
Local freelist load command: write |
|
|
Live local stack pointer (read-only; counts down on TA alloc, up on 3D free; E031, E035, E036) |
|
|
Live local allocated PB ( |
Global freelist (U-FL) — two banks (stride 0x40)
Bank 0x20B8 belongs to PM context 0 (geometry) and bank 0x2078
belongs to PM context 1 (fragment) ([spec] Q16e/Q16g, E035):
Offset |
PM ctx 0 (TA) |
PM ctx 1 (3D) |
Role |
|---|---|---|---|
|
|
|
Global freelist base GPU VA (64-bit; moves down by 4 bytes per page added on grow) |
|
|
|
Stack pointer to load (staging) |
|
|
|
Live stack pointer (read-only; |
|
|
|
PB ( |
|
|
|
Live allocated PB / MMU pages (read-only) |
Load cmd |
|
|
Global freelist load command: write |
Page-conservation invariant (verified across all snapshots, [spec] Q16e):
live_SP + live_allocated_PB_pages + live_allocated_MMU_pages + 1 == total_pages
ALIST, MLIST, VHeap and PM catalogue registers
Register(s) |
Role |
|---|---|
|
|
|
|
|
MLIST base ← |
|
ALIST stack pointers: live ctx 0 / load-staging (64-bit, writable) /
live ctx 1 (E037, |
|
MLIST stack pointers: live ctx 0 / load-staging (writable) / live
ctx 1 (E037, |
|
ALIST / MLIST SP load commands: write |
|
|
|
Per-load context flags: geometry sets |
|
|
|
PM handshakes: must run after PM register writes — writing PM
registers while |
|
Set to |
|
|
Automatic page freeing and PM_3D_MEM_FREE
At the end of a 3D render with 0x0388 = 1 and valid live context-1
ALIST/MLIST stack pointers (0x0280/0x02D0), the PM hardware returns
all render pages to both freelists autonomously ([spec] Q16k/Q16l,
E037, E038):
PIXELBE_END_RENDER(EVENT_STATUSbit 3) asserts while0x0350and0x2088still reflect the allocated state.Both live stack pointers climb back to
total - 1over ~7 µs (small render) to 0.4–2.5 ms (large PB).PM_3D_MEM_FREE(EVENT_STATUSbit 8) asserts once freeing is complete (noEVENT_ENABLEbit is needed).The firmware must clear bit 8 before bit 3 and before loading the next geometry kick on the same PM context. Care must be taken that the HW2 IRQ task does not clear bit 8 before the fragment completion path sees it (E038).
If 0x0288/0x0190 were not pulsed to make 0x0280/0x02D0 live,
0x0350 stays stuck after the render and subsequent draws fault
(E036, E037).
Out-of-memory and partial render (SPM) [spec]
When geometry exhausts PB pages, the PM asserts
EVENT_STATUS.PM_OUT_OF_MEMORY (bit 7). The SPM subsystem
(docsClean/BXE-2-32/partial-render-spm) follows a three-tier decision tree:
Consume reserved ready pages (no host round trip):
If
freelist.ready_pages > 0, pause TA allocation (PM_PAGE_MANAGEOP = 1, wait0x02A8), addready_pagesto the freelist total, lower the freelist base GPU VA by 4 bytes per added page (the page stack grows downward), reload the global bank (0x20B8/0x20C0+ load command), unpause (0x02A0 = 0), and resume TA without a newKick TA.
Grow the freelist (host round trip):
Enter SPM state
wait for grow(traceSPM_34), setfreelist.grow_pendingandos_runtime_flags.fl_grow_pending, and send FWCCBROGUE_FWIF_FWCCB_CMD_FREELIST_GROW(103).The host allocates more pages and replies with KCCB
ROGUE_FWIF_KCCB_CMD_FREELIST_GROW_UPDATE(110, carryingnew_pagesandready_pages).The firmware holds back
ready_pagesfor the next OOM (settingcurrent_total = new_pages - ready_pages), updates the PM underPM_PAGE_MANAGEOP, setsSPM State = PR avoided, and resumes TA.
Partial render (
FRAG_PR) (when the global freelist is atmax_pages):Check
partial_render_geom_frag_fence(traceSPM_66).If on-demand ZS/MSAA buffers are needed, request them via FWCCB
ZSBUFFER_BACKING(101) ↔ KCCBZSBUFFER_BACKING_UPDATE(108).Transition
PR blocked→wait for HWuntil DM 3 is idle.Load PM context 1 with geometry’s current
PM_CAT_BASE_*0catalogues, MLIST base (0x02E0) and live ALIST/MLIST stack pointers, setROGUE_CR_PM_PARTIAL_RENDER_ENABLE(0x0338 = 1) and0x0388 = 1, and kick the context’sFRAG_PRcommand (SPM State = PR running).On
PIXELBE_END_RENDER(andZLS_FINISHED), live stack pointers climb back to full. Clear0x0338 = 0, reload PM context 0 with zero ALIST/MLIST SPs (PM_CAT_BASE_VCE0gets new pages and non-zeroINIT_PAGEhigh word), transitionPR executed→none, and restart TA without a newKick TA.
SPM states (trace group SPM): 32 = none, 33 = PR blocked,
34 = wait for grow, 35 = wait for HW, 36 = PR running,
38 = PR executed.
Freelist reconstruction after HWR
If HWR corrupts active freelists, the firmware sends FWCCB
FREELISTS_RECONSTRUCTION (104) and blocks until the host confirms via
KCCB FREELISTS_RECONSTRUCTION_UPDATE (112). Our firmware holds the
geometry and 3D DMs meanwhile (Holding Scheduling on DM …); compute and
transfers keep running (E054).
PM 3D timeout sequence [spec]
Primary-core registers (no public names, docsClean/BXE-2-32/observed-sequences):
disable: s = CR[0x03E0] ; CR[0x03E0] = 0
CR[0x0388] = 1 ; CR[0x0298] = 0 ; CR[0x01C8] = 0
EVENT_CLEAR = 0x100 ; CR[0x0380] = 1
restore: poll EVENT_STATUS bit 8 (PM_3D_MEM_FREE) with timeout
if ok: EVENT_CLEAR = 0x100
CR[0x03E0] = s