Imagination_BXE-2-32

Client CCB and command dispatch

The Client CCB (cCCB) is the per-context work ring: the host queues the context’s render/compute commands here (geometry, fragment, transfer, compute), plus auxiliary commands (fences, updates, timestamps). The firmware consumes this ring, resolves dependencies and dispatches the work to the data masters.

Control block rogue_fwif_cccb_ctl

{ write_offset, read_offset, dep_offset, wrap_mask, read_offset2, read_offset3, read_offset4 }

Exact layout: public header (pvr_rogue_fwif.h).

Command header and command types

Every command starts with a header rogue_fwif_ccb_cmd_header (0x28 B): cmd_type, cmd_size (payload size), ext_job_ref, int_job_ref, work_est_kick_data. The payload follows the header. cmd_type is the first word of the header and has the form id | (ROGUE_CMD_MAGIC_DWORD << 16); bit 15 (ROGUE_CCB_TYPE_TASK, 0x8000) marks a task, which the firmware dispatches to a data master. The others are auxiliary commands consumed during fence/update processing.

id ROGUE_FWIF_CCB_CMD_TYPE_* Class Handling
201 GEOM task geometry kick (TA)
202 TQ_3D task transfer kick (via 3D)
203 FRAG task fragment kick (3D)
204 FRAG_PR task started by SPM, not by dispatch
205 CDM task compute kick
206 TQ_TDM task transfer (TDM)
207 FBSC_INVALIDATE task FBSC invalidate
208 TQ_2D task 2D transfer
209 PRE_TIMESTAMP task write the GPU time to the address in the command
210 NULL task null kick; restarts periodic sampling
211 ABORT task log only
212 FENCE auxiliary wait on UFO(s)
213 UPDATE auxiliary signal UFO(s)
214 RMW_UPDATE auxiliary increment a UFO
215 FENCE_PR auxiliary partial-render fence
216 PRIORITY auxiliary change priority
217 POST_TIMESTAMP auxiliary write the host time
218/219 UNFENCED_(RMW_)UPDATE auxiliary update without fence
221 PADDING auxiliary wrap padding

So a geometry task has cmd_type = 0x2ABC80C9 and a compute task 0x2ABC80CD.

A type outside this table is an invalid command. The firmware logs it (public trace: group MAIN ids 171/172, Unknown Client CCB Command …) and treats it as a context failure.

Fences and UFOs

A UFO (Updated Fence Object, rogue_fwif_ufo) is a pair { addr, value }:

At most ROGUE_FWIF_CCB_CMD_MAX_UFOS (64) UFOs per command. The UFO that failed is stored in fwcommoncontext.last_failed_ufo so it can be re-evaluated cheaply on the next BG task.

Paired geometry + fragment jobs (answers Q22)

How the mainline host expresses “the fragment must wait for its geometry” (P, pvr_queue.c, pvr_cccb.c):

Confirmed (D): the firmware does not hold the fragment kick on hwrtdata.state while the geometry of the same HWRTData is running; ordering between geometry and fragment is enforced solely by the FENCE_PR / FENCE cCCB UFO fences. The only hwrtdata.state check at fragment kick time is hwrtdata.state == HWR (9), which discards the orphaned fragment command after an HWR (see hardware-recovery).

The KCCB FORCE_UPDATE command forces checkpoints still PVR_SYNC_CHECKPOINT_ACTIVE (0xAC1) in a blocked fence to errored (0xEFF), unblocking it.

FRAG_PR when no partial render is needed (answers Q16m item 2, O)

Public trace of a single draw on the open v1.1 image. The fragment context’s cCCB holds:

  1. at offset 0, the FENCE_PR check on the geometry-fragment fence;
  2. the FRAG_PR command;
  3. the regular fence/FRAG commands after them.

When the geometry finished without running out of memory:

So a FRAG_PR that is not needed is consumed without running:

It runs (Kick 3D … Partial render:1) only from the out-of-memory path of partial-render-spm.

cCCB processing flow

When a context is considered for running (on KICK or when re-evaluating the wait list):

  1. Process fences: advance dep_offset over consecutive FENCE/FENCE_PR/PRIORITY commands.
    • For each FENCE, evaluate the UFOs. If any is not satisfied, stop: the context is blocked (wait list) and the failed UFO is stored.
    • PRIORITY adjusts the context’s priority.
  2. If a task (bit 15) is reached, the context is ready: it enters the DM’s run list (ordered by priority) and the DM is marked as pending for scheduling.
  3. The scheduler (scheduler) picks the context and dispatches it.

Dispatching a task

Commands that complete immediately (timestamp, null, abort) are retired at once. A hardware kick stays at read_offset until the data master finishes, and only then is it retired.

Retirement and updates

When the work finishes (completion interrupt, see scheduler and data-masters):

  1. Retire the command: advance read_offset past the completed task.
  2. Process updates: consume the following UPDATE/RMW_UPDATE/POST_TIMESTAMP.
    • UPDATE writes the values into the UFOs or signals checkpoints (SIGNALED).
    • RMW_UPDATE increments a UFO.
    • POST_TIMESTAMP writes the host time.
  3. Raise an IRQ to the host (after the write barrier), to release the frame and wake dependent work.

Consuming the auxiliary commands advances read_offset. The context’s next dispatch starts from the resulting read_offset, which points to the next task.