code wiki / (root) / nx_swapchain.nx

nx_swapchain.nx

buildroot/runtime/nx_swapchain.nx

5679 B147 linesdepth 3pulls 4 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_swapchain.nx -- presentation destination abstraction. G1/G2 transitional brick of NISHI_GRAPHICS_ROADMAP.md. Replaces DXGI's swapchain role: takes a rendered framebuffer and delivers its pixels to a destination (PPM byte buffer for now; KMS direct scanout queued for G2; nishi-os direct scanout queued post nishi- silicon arc). Composes: [[NISHI_GRAPHICS_ROADMAP]] G1/G2 (this is the bridge brick) existing nx_framebuffer.nx (reads i64 cells, RGBA packed in low 32 bits) existing nx_ppm_writer.nx (ppm_write_p6 consumes *u8 RGB interleaved) [[feedback-multi-species-perceptual-substrate-not-anthropocentric]] (PPM presentation extracts the HUMAN-NORMAL view today; G2 adds per-profile views including UV-channel PPM-extension files) [[feedback-no-false-ok-substrate-honesty-audit]] (KMS stub returns NX_SWAP_ERR_NOT_IMPL deterministically; never silently no-ops) Destination sealed-enum (queued backends marked): NX_SWAP_DEST_PPM_BUFFER -- in-memory PPM P6 bytes (SHIPPED) NX_SWAP_DEST_KMS_DIRECT -- Linux KMS direct scanout (G2; STUB returns ENOTIMPL) NX_SWAP_DEST_NISHI_OS -- nishi-os direct scanout (post-silicon; STUB) NX_SWAP_DEST_DISCARD -- /dev/null equivalent; counts frame only (SHIPPED) Why this sealed enum NOW (G1 transitional): pulls the existing nx_raster + nx_ppm_writer + nx_framebuffer bricks under a single Nishi-grade API surface so downstream code (G2 demos, G3 GPU fallback, conductor multi-tier scenarios) all target the same destination interface. G2 swaps in the KMS backend without breaking any caller. G-ETG cardinal applies: when KMS lands, per-display empirical measurement of scanout latency / DRM ioctl roundtrip / vsync jitter replaces "the doc says vsync is 60Hz." genealogy_id: nishi-graphics-g1-swapchain + iso_dxgi_role_abstraction lineage_id: substrate_swapchain_v1_bits_up_integer

dependencies 3 imports · 3 importers

nx_syscalls.nx nx_framebuffer.nx nx_ppm_writer.nx nx_swapchain.nx nx_d3d11_min.nx nx_graphics_demo_test.nx nx_perceptual_render_test.nx

imports: nx_syscalls.nxnx_framebuffer.nxnx_ppm_writer.nx

imported by: nx_d3d11_min.nxnx_graphics_demo_test.nxnx_perceptual_render_test.nx

structs

none

consts

57const NX_SWAP_DEST_NONE: i64 = 0
58const NX_SWAP_DEST_PPM_BUFFER: i64 = 1
59const NX_SWAP_DEST_KMS_DIRECT: i64 = 2
60const NX_SWAP_DEST_NISHI_OS: i64 = 3
61const NX_SWAP_DEST_DISCARD: i64 = 4
62const NX_SWAP_DEST_N: i64 = 5
72const NX_SWAP_ERR_BAD_DEST: i64 = -100
73const NX_SWAP_ERR_BAD_SIZE: i64 = -101
74const NX_SWAP_ERR_SHORT_BUF: i64 = -102
75const NX_SWAP_ERR_NOT_IMPL: i64 = -103

functions

64func nx_swap_dest_is_valid(d: i64) -> i64
called by 1: nx_swap_present
85func nx_swap_extract_rgb_bytes(
called by 1: nx_swap_present
113func nx_swap_present(