Each submission context (struct rogue_fwif_fwcommoncontext for GEOM, FRAG, or CDM) has its own variable-size circular command ring called the cCCB (Client Command Control Buffer), where the Linux driver (pvr_cccb.c) writes synchronization sequences (UFOs / Sync Checkpoints) and hardware kick commands.
struct rogue_fwif_cccb_ctl, 32 bytes) ([P])| Field | Written By | Role |
|---|---|---|
write_offset (Woff) |
Host (and/or updated via KCCB_CMD_KICK) |
Next free byte for host writes |
read_offset (Roff) |
Firmware | Start of the command currently executing or awaiting retirement |
dep_offset (Doff) |
Firmware | Advances past dependency commands (fences/UFO checks) already evaluated |
wrap_mask |
Host (fixed) | cccb_size - 1 (power-of-2 alignment) |
read_offset2..4 |
Firmware | Auxiliary tracking/prefetch pointers |
cmd_size that is a multiple of 8 bytes.ROGUE_FWIF_CCB_CMD_TYPE_PADDING command filling to the end of the buffer for a clean wrap back to offset 0.struct rogue_fwif_ccb_cmd_header) — 40 bytes ([P])Verified by pvr_rogue_fwif_client_check.h:
| Offset | Type | Field | Description |
|---|---|---|---|
0x00 |
u32 |
cmd_type |
Command type (ROGUE_FWIF_CCB_CMD_TYPE_*, with marker 0x2ABC0000 in bits [31:16]) |
0x04 |
u32 |
cmd_size |
Payload size (in bytes, excluding the 40 B header) |
0x08 |
u32 |
ext_job_ref |
External job reference (used in HWR and HWPerf) |
0x0C |
u32 |
int_job_ref |
Driver internal sequential job reference |
0x10..0x27 |
struct | work_est_kick_data |
struct rogue_fwif_workest_kick_data (return_data_index, cycles_prediction, deadline — total header size: 40 bytes) |
cmd_header_addr + 40 (+0x28).(current_offset + 40 + cmd_header.cmd_size) & wrap_mask.[P])The values match pvr_rogue_fwif.h exactly (with ROGUE_CMD_MAGIC_DWORD_SHIFTED = 0x2ABC0000 and ROGUE_CCB_TYPE_TASK = BIT(15) = 0x8000). Commands are divided into GPU task commands (TASK, bit 15 set) — which occupy a physical Data Master — and generic / control commands — executed directly by the MIPS core without occupying a DM:
0x2ABC8000 | id)Public Type (ROGUE_FWIF_CCB_CMD_TYPE_*) |
Value | DM | Description |
|---|---|---|---|
GEOM |
0x2ABC80C9 (201) |
DM2 (GEOM/TA) | Geometry / Tiling kick (struct rogue_fwif_cmd_geom) |
TQ_3D |
0x2ABC80CA (202) |
DM3 (3D-TQ) | Transfer via 3D pipeline (struct rogue_fwif_cmd_transfer) |
FRAG |
0x2ABC80CB (203) |
DM3 (FRAG/3D) | 3D fragment rendering kick (struct rogue_fwif_cmd_frag) |
FRAG_PR |
0x2ABC80CC (204) |
DM3 (PR) | Partial Render (SPM) associated with HWRTData |
CDM |
0x2ABC80CD (205) |
DM4 (CDM) | Compute kick (struct rogue_fwif_cmd_compute) |
FBSC_INVALIDATE |
0x2ABC80CF (207) |
— | FBSC cache invalidation (when applicable) |
PRE_TIMESTAMP |
0x2ABC80D1 (209) |
Any DM | Records pre-task timestamp |
NULL |
0x2ABC80D2 (210) |
Any DM | KickSync Null: does not trigger hardware; immediately advances to retirement and executes UFO/Sync updates (used for pure barriers) |
ABORT |
0x2ABC80D3 (211) |
Any DM | Aborts pending sequence |
K3 Note:
TQ_TDM(206) andTQ_2D(208) do not exist on silicon36.56.104.183.
0x2ABC0000 | id — Synchronization and Control)Public Type (ROGUE_FWIF_CCB_CMD_TYPE_*) |
Value | Purpose | Firmware Action |
|---|---|---|---|
FENCE |
0x2ABC00D4 (212) |
List of struct rogue_fwif_ufo (addr, value) |
Blocks the context while any *(u32 *)ufo.addr != ufo.value |
UPDATE |
0x2ABC00D5 (213) |
List of struct rogue_fwif_ufo |
Writes *(u32 *)ufo.addr = ufo.value for each entry and signals host IRQ |
RMW_UPDATE |
0x2ABC00D6 (214) |
Read-Modify-Write update | Atomically modifies a UFO word |
FENCE_PR |
0x2ABC00D7 (215) |
List of UFOs (partial fence) | Used before PR commands / geometry dependency |
PRIORITY |
0x2ABC00D8 (216) |
u32 priority |
Updates dynamic priority of the common context |
POST_TIMESTAMP |
0x2ABC00D9 (217) |
Post-task timestamp | Records timestamp after completion |
UNFENCED_UPDATE |
0x2ABC00DA (218) |
List of struct rogue_fwif_ufo |
Same as UPDATE, emitted after completion without an extra barrier |
UNFENCED_RMW_UPDATE |
0x2ABC00DB (219) |
Unfenced RMW | Non-blocking RMW update |
PADDING |
0x2ABC00DD (221) |
Wrap-around padding | Ignored immediately; advances Roff to 0 |
[P][D])The mainline drm/imagination driver (pvr_sync.c) implements dma_fence on top of two mechanisms that the firmware handles uniformly via fw_addr addresses:
struct rogue_fwif_ufo):
[D]): all reads and writes to ufo.addr (FENCE, FENCE_PR, UPDATE, UNFENCED_UPDATE, RMW_UPDATE, UNFENCED_RMW_UPDATE) must be 32-bit (u32). Truncating accesses to 16 bits corrupts the upper half of synchronization counters/states and causes hangs in multi-stage pipelines.FENCE, 0x2ABC00D4): condition satisfied when *(volatile u32 *)addr == value.FENCE_PR, 0x2ABC00D7): uses a wrap-around-safe signed comparison ((int32_t)(*(volatile u32 *)addr - value) >= 0), allowing the fence to pass when the counter has already advanced past the expected value.UPDATE / UNFENCED_UPDATE): writes *(volatile u32 *)addr = value.[D]): a fence/update command supports at most 64 UFOs (cnt <= 0x40); commands exceeding this limit must be rejected/logged as an error.[P][D]):
PVR_SYNC_CHECKPOINT_ACTIVE = 0x00000AC1 (pending — blocks fences waiting for signaling)PVR_SYNC_CHECKPOINT_SIGNALLED = 0x00000519 (completed normally)PVR_SYNC_CHECKPOINT_ERRORED = 0x00000EFF (completed with error — e.g., after HWR)ufo.addr & 1 != 0, the address points to a Sync Checkpoint structure whose aligned base is base = ufo.addr & 0xC1FFFFFC (within the FW Heap):
*(volatile u32 *)(base + 0x00): state word (0xAC1 / 0x519 / 0xEFF).*(volatile u32 *)(base + 0x04): reference/signal counter (fw_ref_count), incremented on UPDATE when signaling the checkpoint and, when enabled, on FENCE when consuming the checkpoint.0x519 is also unblocked if the checkpoint transitions to 0xEFF (error), preventing cascading deadlocks after an HWR; it is up to the firmware to propagate or allow controlled draining of dependent commands according to the reset policy.[D]):
FENCE, the firmware may record (addr, expected) in fwcommoncontext.last_failed_ufo and re-test only that entry upon wake-up, clearing it as soon as it is satisfied (avoiding rescanning the entire UFO array on every interrupt).UPDATE (cmd_size == 0, 0 UFOs): must still advance Roff by the header size, mark update activity, and advance Doff if Doff == Roff.FENCE, re-enqueue the corresponding DM (mapping internal geometry/TA type 6 to DM2/GEOM) and signal CR[0x0B00] (MTS_SCHEDULE).[D])For a typical GPU job (for example, a 3D render or Compute dispatch), the host writes the following sequence into the cCCB:
[ FENCE (check inputs) ] → [ TASK (GEOM / FRAG / CDM / TQ_3D) ] → [ UPDATE (signal outputs) ]
The firmware processes this sequence in two phases:
HW0):
PADDING and PRIORITY immediately (advancing Roff and Doff).FENCE / FENCE_PR:
waiting_list) without advancing Roff; it will be re-evaluated whenever any other DM executes an UPDATE or a new kick arrives.Roff and Doff to the next command.TASK command:
CCB_CMD_TYPE_NULL: retires it immediately and proceeds to the following UPDATEs.GEOM, FRAG, CDM, or TQ_3D: if the corresponding DM is idle, activates MemCtx in the BIF, programs the DM registers, and triggers the hardware. Roff remains pointing to the TASK command while it is executing (to allow CSW or HWR diagnostics).HW1 → BG reschedule):
TA_FINISHED, PIXELBE_END_RENDER, COMPUTE_FINISHED) and it was not a CSW pause:UPDATE/retirement), increments cleanup_ctl.executed_commands of referenced objects (HWRTData, Context), and advances Roff past the TASK command.UPDATE / UNFENCED_UPDATE / PADDING commands up to the next FENCE or TASK (or until Roff == Woff).0xBFC01800 = 1, ehb, sync) and triggers a host IRQ (hwirq 75).ROGUE_CR_MTS_SCHEDULE (CR[0x0B00] = 0) to wake BG and re-evaluate contexts that were waiting on the newly signaled UFOs.