Added Kitty Graphics Protocol support for eterm module, still a WIP but working.

This commit is contained in:
Martín Lucas Golini
2026-09-03 17:19:27 -03:00
parent 53553b7861
commit 57754feb31
22 changed files with 3543 additions and 119 deletions
+43
View File
@@ -0,0 +1,43 @@
# eTerm Kitty graphics protocol
eTerm implements the terminal-receiver side of the Kitty graphics protocol. Protocol parsing,
decoding, image storage, placement state, animation, and terminal lifecycle integration run on the
terminal worker. The UI thread consumes immutable placement metadata and an ordered pixel-update
stream, and exclusively owns the OpenGL texture cache.
## Supported features
- direct RGB and RGBA transmission, including chunking and zlib compression;
- PNG transmission;
- image IDs, image numbers, placement IDs, source cropping, cell geometry, and pixel offsets;
- root-image rectangle updates, animation frames, frame composition, and animation control;
- deletion selectors, quiet modes, capability queries, storage quotas, usage hints, and eviction;
- primary/alternate-screen state, reset, clear, scrolling, margins, scrollback, and resize;
- Unicode placeholder placements (U+10EEEE and Kitty's combining-diacritic encoding);
- relative placements, including parent validation, cycle detection, and descendant movement;
- terminal pixel-size queries and SGR pixel mouse coordinates.
Local file, temporary-file, and shared-memory transfer media are intentionally not enabled. Direct
transmission is the portable path and works through SSH without giving terminal applications access
to the terminal host's filesystem or shared-memory namespace.
## Resource and threading behavior
Decoded root images are stored as premultiplied-independent RGBA8 CPU buffers on the worker. GPU
textures exist only on the UI/GL thread. Incremental updates carry monotonically increasing sequence
numbers; a bounded queue gap triggers a complete graphics resynchronization. Image count, placement
count, APC size, decoded transfer size, and total image storage are bounded. Unreferenced images are
evicted oldest-first when storage is needed.
Graphics follow the same presentation cadence and DEC synchronized-update boundary as text. A
placement anchored in normal-screen history moves with terminal scrolling and is projected into the
current scrollback viewport. Margin scrolling clips or removes only placements wholly participating
in the scrolled region. Resize preserves screen-coordinate placements and reflows Unicode placeholder
metadata with its text cells.
## Compatibility testing
The eTerm unit suite covers fragmented APC input, malformed/fuzzed commands, raw/zlib/PNG transfer,
independent image namespaces, replacement, partial updates, placement geometry, scrolling and
scrollback, screen lifecycle, animation, Unicode placeholders, relative placement graphs, ordered
worker/UI delivery, queue overflow, and resynchronization.