Skip to main content

Crate tilo_render_protocol

Crate tilo_render_protocol 

Source
Expand description

How a Tilo app hands its frames to the render service of its room, and how the service makes sure a frame is safe to draw.

An app does not rasterize. Its toolkit builds the widget tree, lays it out and records the frame as vello’s encoding, as before, then writes that encoding into shared memory instead of onto a GPU. The room’s render service — the only toolkit-app process that opens the GPU — validates it, rasterizes it on its warm device into dma-bufs and hands those back; the app attaches them to its own wl_surface, so the compositor imports them like any client buffer (zero copies, direct scanout kept).

This crate is the contract both sides compile:

  • scene: a vello Encoding as bytes, with fonts, images and external surfaces referenced by id instead of by pointer.
  • frame: one frame of one surface: its size, damage, scroll copies, the layers it changes and the backdrops it blurs. Records are type-length-value sections, so later steps (scene annotations, service-run motion) add sections without breaking older peers.
  • validate: the CPU pass every scene passes before a GPU sees it, and the per-app Limits it enforces. A scene is hostile until it passes.
  • control: the messages on the control channel (“frame N is in the ring”, “frame N is in buffer B”, “frame N was presented”), and on Unix channel carries them with descriptors over a packet socket pair, and shm the shared memory: the ring frames are written to, and the images an app uploads once.
  • patch: beside scenes, the component patches a tilolang app sends the room’s UI host instead of pixels, the events, bindings, focus and composition that come back, and the check every batch passes.

Re-exports§

pub use limits::Limits;

Modules§

broker
How an app gets its channel to its workspace’s render service.
channel
The control channel: one Unix socket per app connection, one message per packet, descriptors as SCM_RIGHTS.
control
Messages on the control channel between an app and its render service.
frame
One frame of one surface, as it sits in the ring.
limits
What one app may ask of its workspace’s render service.
patch
Component patches: how a tilolang app’s window reaches the room’s UI host, and what the person did comes back.
scene
A vello Encoding as bytes, with fonts and images by id.
shm
Shared memory between an app and the processes it draws through: the ring an app writes its frames into, and the images, fonts and large patch batches it hands over once.
validate
The CPU pass every scene passes before the GPU sees it.

Structs§

FontId
A font an app registered, by the number it chose.
ImageId
An image an app uploaded once, by the number it chose.
LayerId
One layer of a surface’s scene. Layer 0 is the surface’s content; others are parts of it the app updates on their own (scrolling regions, popovers) and, from step 2 on, parts the service animates.
SurfaceId
A surface (a window, a popup) the app renders through the service.

Enums§

WireError
Why bytes could not be read as a record, or a record was refused.

Constants§

PROTOCOL_VERSION
The version both peers name in their hello. A peer that speaks a newer version must still accept this one’s sections; a section it does not know is skipped only when its sender marked it optional.