driver.video.doublebuffer¶
Double-buffered rendering using SSE-accelerated memory copy.
Overview¶
This unit implements double-buffered rendering for the video subsystem. It allocates a back buffer in kernel memory, redirects drawing operations to the back buffer, and provides a Flush procedure that copies the completed back buffer to the front (visible) framebuffer using SSE 128-bit memory copy instructions for maximum throughput.
Dependencies¶
driver.videodriver.video.typescore.memorycore.ssesyslog
Constants¶
COPY_WIDTH¶
Value: 128. The SSE copy granularity in bits (16 bytes per operation), used by the __SSE_128_memcpy routine.
Functions and Procedures¶
allocateBackBuffer¶
Allocates a physically contiguous back buffer ofsize bytes using klalloc (large kernel allocation). Returns the base address, or nil on failure.
initBackBuffer¶
Allocates a back buffer matching the front buffer's dimensions and BPP, fills inVideoInterface^.BackBuffer, and sets VideoInterface^.DefaultBuffer to point at the back buffer.
Flush¶
Copies the entire back buffer to the front buffer using__SSE_128_memcpy in 128-bit (16-byte) chunks. The buffer size must be a multiple of 16 bytes; the framebuffer dimensions are chosen to satisfy this requirement.
enable¶
CallsinitBackBuffer, then replaces VideoInterface^.DrawRoutines.Flush with @Flush. Registered as the 'BASIC_DOUBLE_BUFFER' driver in driver.video.
Notes¶
klallocis used rather than the standard kernel allocator because the back buffer may be several megabytes; this requires a large contiguous allocation that the slab allocator cannot satisfy.- The SSE copy path requires the source and destination addresses to be 16-byte aligned;
klallocreturns suitably aligned memory.