include/pm.h — Parameter-manager declarations

Parameter Manager (PM): free-list and list loads of the two PM contexts, which HWRTData each context holds, and the out-of-memory handling (SPM). Also the public HWRTData offsets and accessors for host memory.

See docsClean kick-geometry-ta.md phase B and partial-render-spm.md; E035, E037.

enum [anonymous]

The two PM contexts.

enumerator PM_CTX_GEOM = 0

PM context 0, used by the geometry (TA allocation).

enumerator PM_CTX_FRAG = 1

PM context 1, used by the fragment (3D deallocation).

enum [anonymous]

The free lists of an HWRTData (freelists[] index).

enumerator PM_FL_LOCAL = 0

The local free list.

enumerator PM_FL_GLOBAL = 1

The global free list.

struct pm_freelist

A free list (the public rogue_fwif_freelist layout).

uint64_t freelist_dev_addr

Device address of the page array.

uint64_t current_dev_addr

Device address of the first page in use (the array fills from its end).

uint32_t current_stack_top

Stack top.

uint32_t max_pages

Size of the page array.

uint32_t grow_pages

Pages the host adds per grow.

uint32_t current_pages

Pages currently in the list.

uint32_t allocated_page_count

Pages allocated by the PM.

uint32_t allocated_mmu_page_count

MMU pages allocated by the PM.

uint32_t freelist_id

The host’s identifier, used in grow and reconstruction messages.

uint32_t grow_pending

A grow request is outstanding.

uint32_t ready_pages

Pages the host added but holds back for the next out-of-memory event.

uint32_t freelist_flags

Free-list flags.

uint32_t pm_global_pb

Global PB (not used by the firmware).

uint32_t padding

Padding.

HWRT_FLAGS_PRIOR_PR

hwrtdata.flags: a partial render ran in this frame (Q31 answer).

enum [anonymous]

HWRTData states (rogue_fwif_rtdata_state), written to HWRT_STATE.

static inline uint32_t hw_rd32(const void *p, uint32_t off)

Read a 32-bit word of host memory (volatile).

Parameters:
  • p – Base address.

  • off – Byte offset.

Returns:

The word.

static inline uint64_t hw_rd64(const void *p, uint32_t off)

Read a 64-bit word of host memory (volatile).

Parameters:
  • p – Base address.

  • off – Byte offset.

Returns:

The word.

static inline void hw_wr32(const void *p, uint32_t off, uint32_t v)

Write a 32-bit word of host memory (volatile).

Parameters:
  • p – Base address.

  • off – Byte offset.

  • v – The value.

static inline void hw_wr64(const void *p, uint32_t off, uint64_t v)

Write a 64-bit word of host memory (volatile).

Parameters:
  • p – Base address.

  • off – Byte offset.

  • v – The value.

static inline struct pm_freelist *hwrt_freelist(const void *hwrt, uint32_t which)

Get one of an HWRTData’s free lists.

Parameters:
  • hwrt – The HWRTData, or NULL.

  • which – PM_FL_LOCAL or PM_FL_GLOBAL.

Returns:

The free list, or NULL.

struct pm_slot

Which HWRTData and free lists a PM context holds.

fwaddr_t hwrt

Firmware address of the HWRTData.

fwaddr_t fl[2]

Its local and global free lists: what the context’s registers hold.

bool valid

The context’s registers were loaded from this HWRTData.

bool dirty

…and its live free-list state is newer than the structures.

uint32_t seq

Order of the context’s last free-list load (0: none). Of two contexts that hold the same list and are idle, the one loaded later ran later, so its registers hold the newest copy (E050).

enum spm_state

SPM states.

enumerator SPM_NONE

No out-of-memory handling in progress.

enumerator SPM_WAIT_GROW

The TA is stopped until the host grows a free list.

enumerator SPM_WAIT_HW

A partial render is armed and waits for the fragment data master.

enumerator SPM_PR_RUNNING

The partial render runs.

enumerator SPM_WAIT_BACKING

A partial render waits for the host to back its on-demand ZS/MSAA buffers.