Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module gpu

Module gpu 

Source
Expand description

GPU MMIO: GP0, GP1, GPUREAD, GPUSTAT.

Thin wrappers over crate::read_u32 / crate::write_u32 that use the register addresses from psx-hw. Each helper commits exactly one MMIO access; higher-level SDK code composes them into commands.

Structs§

ActiveRecording
The open recording start_recording_raw returned. end closes it and hands back the recorded nodes; dropping it closes it too, discarding the result.
CommandRecording
A command stream recorded by start_recording_raw: DMA linked-list nodes that end the list until link_to chains them onward.
RecordingOverflow
The recording ran out of buffer, so it was discarded: a command cut short would make the GPU take the words after it as its parameters.
RecordingPause
An open recording paused by pause_recording; it resumes where it left off when this is dropped, provided that recording is still open.

Constants§

READY_SPINS
Spin budget for one GPUSTAT ready-wait. Long enough for the slowest legitimate primitive, short enough that a stuck GPU hands control back well inside a frame.
RECORDING_NODE_WORDS
Payload words per recorded linked-list node. Silicon (hardware-tests v1.24) loses words from DMA nodes longer than 16 while drawing.

Functions§

arm_direct_access_guard
Arm the guard: the GPU may be busy with work the CPU handed off, so the next direct access must wait for it first.
command_reset_count
How many times a ready-wait has timed out and reset the GPU’s command buffer since boot: a count of GPU hangs the SDK recovered from.
gpustatDeprecated
Renamed to status.
is_recording
True while a recording is open and not paused by pause_recording.
pause_recording
Pause any open recording until the returned guard is dropped, so command writes in between go to the port (behind the direct-access guard) instead of into the buffer. For VRAM uploads, which a recording cannot carry: a texture first drawn by a recorded HUD is uploaded at once, before the recording is walked, which is all a draw of it needs.
read_data
Read the GPU’s response latch: VRAM-to-CPU transfer data or a GP1(10h) info reply.
run_direct_access_guard
Run and disarm the guard if it is armed. Direct-access paths outside the port writes (GPU DMA setup) call it first.
set_direct_access_guard
Register the function that makes direct GPU access safe while a queued frame may be walking (psx_rt::present registers its wait_idle). It runs once, on the first direct command or display-control write or GPU DMA address store after arm_direct_access_guard, and is then disarmed.
start_recording_raw⚠
Record every super::write_command into buffer instead of the port, until the returned ActiveRecording is ended or dropped. The ready-waits return at once while recording.
status
Read the GPU status register.
try_wait_command_ready
Poll command readiness without resetting the GPU on timeout. Reads once, then retries at most spin_limit times.
try_wait_dma_ready
Poll DMA receive readiness without resetting the GPU on timeout.
wait_cmd_readyDeprecated
Renamed to wait_command_ready.
wait_command_ready
Spin until the GPU is ready to accept a new command word.
wait_dma_ready
Spin until the GPU can start a DMA block transfer.
write_command
Push a drawing or VRAM command word, or one of its parameters, to the GPU’s command port (GP0). Pairs with the word builders in psx_hw::gpu::gp0: write_command(gp0::draw_mode(...)).
write_command_unguarded
write_command straight to the port: never recorded, never behind the direct-access guard. For code that has already made the port safe, such as the present queue’s stall recovery, which the guard itself runs. Without the present-queue feature it is the same store as write_command.
write_display_control
Write a display-control command (reset, display mode, display area, DMA direction) to the GPU’s control port (GP1).
write_display_control_unguarded
write_display_control straight to the port, past the direct-access guard; see write_command_unguarded.
write_gp0Deprecated
Renamed to write_command.
write_gp1Deprecated
Renamed to write_display_control.