nx_x11_put_image.nx
buildroot/runtime/nx_x11_put_image.nx
about
nx_x11_put_image.nx -- bits-up X11 PutImage: the framebuffer -> window blit the game platform
needs (F1105 desktop-native). The prior X11 arc drew rects/text; a game pushes a whole rendered
frame per tick, so this adds:
PutImage (opcode 72), ZPixmap format:
byte 0: 72
byte 1: format (2 = ZPixmap)
bytes 2-3: request_length in 4-byte words = (24 + data)/4
bytes 4-7: drawable
bytes 8-11: gc
bytes 12-13: width
bytes 14-15: height
bytes 16-17: dst-x (signed)
bytes 18-19: dst-y
byte 20: left-pad (0 for ZPixmap)
byte 21: depth
bytes 22-23: pad
bytes 24+: pixel rows, 32bpp for depth-24 TrueColor
A full 480x300 frame is 576000 data bytes = far past the CORE max request length (the spec
only guarantees 4096 words), so nx_x11_put_image_banded splits the frame into horizontal
bands sized from the server's ADVERTISED max_req_words (X11Conn, parsed from setup) --
never a hardcoded guess, and never a request the server is allowed to refuse.
nx_fb_to_zpixmap converts the ecosystem's packed-i64 framebuffer (R | G<<8 | B<<16, the
nx_game_raster/swgpu/wasm-games format) to little-endian depth-24 ZPixmap u32 = R<<16|G<<8|B,
i.e. bytes [B,G,R,0] -- the exact layout nx_x11_get_image documents the server handing back,
so a put->get round trip is byte-comparable.
license_tier: ORIGINAL
genealogy_id: international-research-sources/x_org/xproto_v11_r0
lineage_id: nishi_x11_put_image_q10
dependencies 3 imports · 2 importers
imports: nx_syscalls.nxnx_x11_connect.nxnx_x11_window.nx
imported by: nx_desktop_game.nxnx_x11_put_image_gate.nx
structs
| none |
consts
| 38 | const NX_X11_PUTIMG_HDR: i64 = 24 |
| 40 | const NX_X11_MIN_REQ_WORDS: i64 = 4096 |
functions
| 43 | func nx_fb_px_to_z(v: i64) -> i64 |
| 48 | func nx_fb_to_zpixmap(fbp: *i64, n: i64, out: *u8) -> i64 |
| 62 | func nx_x11_put_max_rows(w: i64, max_words: i64) -> i64 |
| 71 | func nx_x11_put_image_hdr(req: *u8, drawable: i64, gc: i64, |
| 92 | func nx_x11_put_image(conn: *X11Conn, drawable: i64, gc: i64, |
| 102 | func nx_x11_put_image_banded(conn: *X11Conn, drawable: i64, gc: i64, |
| 118 | func main() -> i64 |