feat: add bitmap surface protocol and renderer - #133
Conversation
|
Needs rebasing 😇 |
484cab7 to
69c3589
Compare
|
Rebased onto the latest main. |
|
Thoughts on this? @gold-silver-copper |
|
Slightly redundant since we already support kitty, but the direct gpu access for a terminal protocol is pretty interesting, and since ratty is already experimental I think it's fine. Nitpicks: No limits on decompressd images. There is a 64mb limit on compressed ones, but none for decompressed, and no limits on image dimensions. A malicious actor could compress a 10 gigabyte image in less than 10 megabytes, effectively zip bombing ratty. Suggested fix: pass explicit image::Limits with max_image_width/max_image_height before decoding, add a configurable total-bytes budget across bitmaps evicting or rejecting past it, and cap concurrent pending transfers. |
Thanks, fixed! PNG decoding now includes clear limits on image dimensions and memory allocation, along with configurable budgets for total bitmap memory, pending bytes, and concurrent transfers. I also added targeted tests for oversized images, budget exhaustion, and recovery after deletion or transfer completion. |
Summary
This introduces a Ratty-native bitmap surface protocol and renderer, initially motivated by RChat's inline image previews.
ratty;iAPC protocol for registering, placing, updating, and deleting bitmap surfacesMotivation
Ratty already supports Kitty graphics, but applications such as RChat also need reusable GPU-backed surfaces with explicit identifiers and lifecycle management.
This is deliberately a separate Ratty protocol rather than a replacement for Kitty graphics or RGP. It gives Ratty-native applications a stable path for image registration, repeated placement, and efficient live-frame updates.
This follows our earlier discussion about supporting a first version of RChat in Ratty.
Review guide
The commits are organized as a review path:
The production changes are localized around the new bitmap surface state, protocol parser, renderer integration, and terminal capability handling. There are no new dependencies or unrelated configuration changes.
Safety and lifecycle
xterm-kittyCompatibility
ratty;inamespaceVerification
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo nextest run— 90 tests passedcargo buildDemo
Draft status
Opening this as a draft so we can confirm the protocol shape and renderer boundaries before requesting final review.