This document describes the per-Data Master (DM) context scheduling model, hardware overlap rules, and the cooperative preemption (CSW — Context Switch) protocol on the SpacemiT K3 (36.56.104.183).
[P][D])The scheduler manages an independent set of queues for each active DM on the K3:
| DM | Public Name | Controlled Hardware | Managed Queues |
|---|---|---|---|
0 |
PVR_FWIF_DM_GP |
General control / KCCB | KCCB + synchronization tasks |
2 |
PVR_FWIF_DM_GEOM |
VDM + TE + PPP + PM (ctx 0) | waiting_list, run_list, active_ctx |
3 |
PVR_FWIF_DM_FRAG |
ISP (6 pipes) + PBE + ZLS + PM (ctx 1) | waiting_list, run_list, active_ctx (shared among FRAG 3D, FRAG_PR, and TQ_3D) |
4 |
PVR_FWIF_DM_CDM |
CDM + PDS + USC | waiting_list, run_list, active_ctx |
Absent DMs on K3: DM1 (
TDM) and DM5 (RAY) do not exist on this silicon.
[D])For each active DM (GEOM, FRAG, CDM), the scheduler maintains:
waiting_list: contexts with submitted work (Roff != Woff) sorted by descending priority (priority, FIFO within the same priority).run_list: contexts whose FENCE commands at the head of the cCCB have been satisfied and are ready to occupy the hardware.active_ctx: the single context currently executing on that DM’s hardware (or NULL if idle).BG / HW0)waiting_list → run_list):
waiting_list, advances past PADDING / PRIORITY and evaluates FENCE / FENCE_PR.!= expected and != 0xEFF), it remains on waiting_list.CCB_CMD_TYPE_NULL, retires it immediately, executes the following UPDATEs, and re-evaluates.TASK, moves the context to run_list (preserving priority order).run_list → hardware):
active_ctx == NULL) and not blocked by HWR/SPM/APM (FORCED_IDLE/POW_OFF):
run_list.FRAG, HWRTData not in conflict; if there is a pending SPM Partial Render, it has absolute priority over any normal 3D render on DM3!).MemCtx in the BIF (see data-masters.md).active_ctx != NULL) and there is a context in run_list with strictly higher priority (or a switch requirement when CSW is enabled in fw_sys_config_flags):
[P][D])The BXM-4-64 silicon (36.56.104.183) has COMPUTE_OVERLAP = 1 and a decoupled tile-based pipeline. Overlap is not decided by the host: the firmware admits or serializes it at kick time based on configuration flags, the state of each DM, and context priorities (§5 and §6).
| Simultaneous Combination | Allowed on K3? | Restrictions |
|---|---|---|
| GEOM (DM2) + FRAG (DM3) | Yes | Distinct hardware (VDM/TE/PPP vs ISP/PBE/ZLS) and distinct PM contexts (ctx 0 vs ctx 1). On the same HWRTData, normal FRAG is only dispatched after TA publishes TA_FINISHED (LASTKICK); serialization comes from the HWRTData state, not a bus lock. During Partial Render, TA is paused and FRAG_PR runs alone |
| GEOM (DM2) + CDM (DM4) | Yes | Default (COMPUTE_OVERLAP), subject to the Compute command’s exclusivity flags (§6) |
| FRAG (DM3) + CDM (DM4) | Yes | Default, overridable by FRAG: ROGUE_FRAG_FLAGS_PREVENT_CDM_OVERLAP (bit 26 of the command’s flags field, in cmd_frag.flags) causes the firmware to hold back CDM while FRAG is active |
| FRAG (DM3) + FRAG (DM3), including TQ_3D | No | TQ_3D is a kick type (ROGUE_FWIF_CCB_CMD_TYPE_TQ_3D), not a DM: it uses the same DM3 and the same queue, so it executes strictly serialized |
| GEOM (DM2) + GEOM2 (DM6) | Irrelevant on K3 | The scheduler has a path for PVR_FWIF_DM_GEOM2, but the K3 driver never submits to this DM |
Correction (2026-11-28): earlier versions of this page listed
TQ_3Das a “DM sharing the pipeline”. Verification against the binary shows the scheduler uses indices2= GEOM,3= FRAG,4= CDM, and6= GEOM2;TQ_3Darrives as a DM3 command.
0 and 3D occupies context 1 (see kick-geometry-ta.md §2).vce_cat_base, te_cat_base, alist_cat_base) are per context, so two different HWRTData instances do not contend for the same catalog registers.HWRTData state (ROGUE_FWIF_RTDATA_STATE_*), evaluated by the scheduler before moving the context from waiting_list to run_list.[P][O][D])Context preemption on Rogue GPUs is hardware-cooperative: the firmware requests the unit to save its state to memory at the next safe boundary (primitive/tile/workgroup boundary) and waits for the normal DM completion interrupt. It has been validated on K3 hardware under simultaneous contention between 2 processes (3D + Compute/3D).
[D])sysdata.config_flags (ROGUE_FWIF_INICFG_CTXSWITCH_TA_EN, CTXSWITCH_3D_EN, CTXSWITCH_CDM_EN).active_ctx.(CR[0x0F08] & 3) != 3.[D])| DM | Register Setup Before Trigger | Hardware Trigger | Verification on Completion (HW1) |
|---|---|---|---|
| DM2 (GEOM / TA) | Programs context CSW state addresses: 0x0428 (VDM state base), 0x0CC0 (TA state base), 0x0438, 0x0440, 0x0448, 0x0450 (ORed with command task_size), 0x0458, 0x0460 |
CR[0x0468] = 1 |
Upon TA_FINISHED (0x20): polls ROGUE_CR_VDM_CONTEXT_STORE_STATUS (0x0430) bit 0 == 1 with a short timeout in CR_TIMER ticks (fallback on expiration: pulses CR[0x0100] = 0x804000 → 0, restoring 0x0420 and 0x0418). If bit 1 of 0x0430 == 1, TA was stored (preempted) before finishing: saves CR[0x0418] (call stack pointer) into the context CSW state, internally marks HWRTData as TA-preempted, and does not retire the cCCB command |
| DM3 (FRAG / 3D) | No extra setup (resume/tile state managed by ISP/PM) | BCAST[0x1000] = 1 |
Upon PIXELBE_END_RENDER (0x08): checks ROGUE_CR_ISP_STATUS (0x1038) bit 0 == 0 (render stopped before completion). If preempted: saves CR[0x1008] (ISP state) into context_state, polls CR[0x03F8] mask 0xC2 == 0xC2, saves CR[0x0360] and CR[0x0370] into context_state, marks context as preempted, and does not retire the cCCB command |
| DM4 (CDM) | cdm_context_state_base_addr was already loaded into 0x0498/0x049C at kick time |
BCAST[0x0488] = 1 |
Upon COMPUTE_FINISHED (0x04): polls ROGUE_CR_CDM_CONTEXT_STORE_STATUS (0x04A0) bit 0 == 1. If bit 1 of 0x04A0 == 1, CDM was stored: records the stored-cores bitmask in the context and does not retire the cCCB command |
[D])When the preempted context is scheduled again later:
Roff still points to the same TASK command.geom_reg_vdm_context_state_resume_addr instead of the initial stream and restores the saved pointer into CR[0x0418/0x041C] (see kick-geometry-ta.md).CR[0x0298], CR[0x01C8], and CR[0x1020], and sets bit 0x10 in ROGUE_CR_ISP_RENDER (0x0F08) (see kick-compute-and-3d.md).BCAST[0x04D8/0x04DC/0x04E0] and pulses BCAST[0x0490] = 1, polling 0x0490 bit 0 == 0 before triggering BCAST[0x0478] = 1 (see kick-compute-and-3d.md).[D])Before programming the DM, the firmware runs an admission test that answers “can this kick run now, or must it wait?”. The test is per DM and evaluates, in this order:
A gate precedes all rules below: while hardware recovery (HWR or a restart request) is in progress and the SPM controller is idle, no new kick is admitted, preventing the GPU from receiving new work during recovery.
ROGUE_FWIF_INICFG_DISABLE_DM_OVERLAPThe host sets this bit (BIT(19) of sysdata.config_flags) when the SLC is smaller than 4 KiB (ROGUE_FWIF_SLC_MIN_SIZE_FOR_DM_OVERLAP_KB in pvr_fw.c). When set, the firmware serializes the DMs:
if any other DM has an active context:
admit ONLY if that DM is "held" by OOM/SPM
(DM's bit set in the pending-OOM DM mask)
else: block
DMs held by OOM do not block the others — this is what allows SPM to make progress (a TA in OOM does not block the 3D that will free pages).
Without DISABLE_DM_OVERLAP, the test is:
SINGLE_CORE (ROGUE_COMPUTE_FLAG_SINGLE_CORE, bit 5 of cmd_compute.flags) → mask 1;(1 << num_cores) - 1 (all cores), with num_cores = ROGUE_CR_MULTICORE_SYSTEM (0xF308).
If the requested mask does not intersect the already-occupied cores, the kick passes.candidate.i32Priority < active.i32Priority (strict comparison). Ties do not block. The field is i32Priority of struct rogue_fwif_fwcommoncontext.ROGUE_FRAG_FLAGS_PREVENT_CDM_OVERLAP (bit 26) blocks CDM.hwrt_data_flags (bits 8–9), except when the HWRTData is in HWRTDATA_GEOM_NEEDS_RESUME (bit 10), in which case resumption is always admitted.When two contexts use the same global freelist, the firmware does not block the kick because of it: the freelist is referenced by the HWRTData (apsFreeLists[]) and consumption is accounted in the PM itself. Contention surfaces as PM_OUT_OF_MEMORY (bit 7 of EVENT_STATUS), handled by SPM (partial-render-spm.md):
HWRTData — which necessarily waits for the previous 3D (§3).