//! The display wire protocol — what a client says to the display service over its //! well-known `.display` endpoint. extern-struct messages with an `Operation` tag, the //! same shape as block/vfs/input protocols. The compositor owns the framebuffer and an //! ordered stack of **layers**; a client creates layers, draws into them with these //! operations, marks damage, and asks for a `present`. v1 surfaces are server-owned (a //! client draws by command); shared-memory surfaces are a later milestone (docs/display.md). pub const Operation = enum(u32) { /// info() -> { width, height, pitch, format }: the display's current mode. info = 0, /// create_layer(x, y, width, height, z) -> { layer }: a new server-owned surface. create_layer = 1, /// configure_layer(layer, x, y, z, visible): move, restack, show, or hide a layer. configure_layer = 2, /// destroy_layer(layer): release a layer. destroy_layer = 3, /// fill_rect(layer, x, y, width, height, colour): fill a rectangle of a layer. fill_rect = 4, /// blit_tile(layer, x, y, width, height, ): copy a small pixel tile in. blit_tile = 5, /// damage(layer, x, y, width, height): mark a region dirty for the next present. damage = 6, /// present(): composite the dirty layers and flush to the screen. present = 7, }; /// The fixed request header. A `blit_tile`'s pixel payload (width*height 32-bit pixels) /// follows this header inline in the same message, up to `maximum_payload`. pub const Request = extern struct { operation: u32, layer: u32 = 0, // create/configure/destroy/fill/blit/damage: the target layer x: u32 = 0, y: u32 = 0, width: u32 = 0, height: u32 = 0, z: u32 = 0, // create_layer / configure_layer: stacking order (higher = in front) colour: u32 = 0, // fill_rect: the fill colour (native pixel value) visible: u32 = 1, // configure_layer: 0 hides the layer reserved: u32 = 0, }; pub const Reply = extern struct { status: i32, // 0 on success, negative on failure reserved: u32 = 0, // info(): width: u32 = 0, height: u32 = 0, pitch: u32 = 0, format: u32 = 0, // a device-abi DisplayFormat value (0 = rgbx, 1 = bgrx) // create_layer(): layer: u32 = 0, reserved2: u32 = 0, }; /// Sized to hold a modest `blit_tile` payload (a cursor / glyph-cell tile) inline on top /// of the header, not just the fixed messages — the compositor's receive/reply buffers /// (`runtime.service.run`) are this big. pub const message_maximum: usize = 4096; pub const request_size: usize = @sizeOf(Request); pub const reply_size: usize = @sizeOf(Reply); pub const maximum_payload: usize = message_maximum - request_size;