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

queue_display_control_at_vblank

Function queue_display_control_at_vblank 

Source
pub fn queue_display_control_at_vblank(word: u32)
Expand description

Queue one GP1 word for the VBlank handler to apply at a blank edge (deferred tear-free display flip). Overwrites any unapplied word.

The handler applies the word at the first VBlank edge on which GPUSTAT bit 24 (the GPU’s IRQ1 flag) is set, so the frame must signal its own end:

  1. acknowledge the flag with GP1(02h) before kicking the frame’s work (psx_gpu::arm_draw_done), after the previous flip has landed;
  2. end that work with GP0(1Fh): as the last node of the DMA chain (psx_gpu::OrderingTable::end_with_draw_done, or a one-word packet in an ordered stream) or, after drawing through the ports, psx_gpu::signal_draw_done;
  3. queue the display-start word here.

The flag stays set until the next acknowledge, so a word queued while the GPU is idle after such a frame (a display enable, say) applies at the next edge. A game that never sends GP0(1Fh) never flips: before this handler tested bit 24 it tested GPUSTAT bit 28, which on silicon rises about one large primitive before the drawing ends (hardware-tests v1.24 cases 219-226), so a flip could expose a frame one primitive short. Keep interrupt source 1 (GPU) masked in I_MASK: this handler owns VBlank only, so a GPU interrupt it finds is acknowledged as a stray and counted (stray_interrupt_count), which costs a handler entry per frame.