Files
chandra/remote/chandra_fb_shm.h
nandi bfc60ee0e5
CI / test (push) Failing after 50s
Add chandra-remote: VNC and web control over Tailscale
- remote/: shared-memory framebuffer mirror served as RFB 3.8 (VNC, port 5900) and an HTTP/WebSocket PWA (port 6080), bound to the Tailscale interface and loopback by default
- Compositor: remote pointer, button, scroll, modifier, key, key-tap, text and clipboard input, routed past OLED blanking
- chandra-ctl: add status, refresh and osk commands; add input-* and clipboard-set for remote control
- Camera: debayer 10-bit CSI-2 Quad-Bayer frames for imx371 and high-quality still capture
- Camera: rotate frames by the libcamera mounting angle (CCW for 90), fix the expected test values, and restyle the UI for a dark theme
2026-11-28 17:57:55 -08:00

35 lines
1.3 KiB
C

#ifndef CHANDRA_FB_SHM_H
#define CHANDRA_FB_SHM_H
#include <stddef.h>
#include <stdint.h>
#define CHANDRA_FB_MAGIC 0x43484642u /* "CHFB" */
#define CHANDRA_FB_VERSION 1u
#define CHANDRA_FB_HDR_BYTES 4096u
/* Fits up to 3840x2160x4 (~33.2 MiB); sparse tmpfs only backs written pages. */
#define CHANDRA_FB_SLOT_BYTES (34u * 1024u * 1024u)
#define CHANDRA_FB_TOTAL_BYTES (CHANDRA_FB_HDR_BYTES + 2u * CHANDRA_FB_SLOT_BYTES)
typedef struct {
uint32_t magic;
uint32_t version;
uint32_t slot_bytes;
uint32_t active_slot; /* 0 or 1, atomic release/acquire */
uint32_t width; /* logical width of active_slot */
uint32_t height; /* logical height of active_slot */
int32_t dmg_x0; /* bounding box damaged on last publish */
int32_t dmg_y0;
int32_t dmg_x1;
int32_t dmg_y1;
uint64_t seq; /* monotonic frame counter, atomic release/acquire */
uint64_t frame_ms; /* CLOCK_MONOTONIC ms when published */
uint64_t consumer_ping_ms; /* CLOCK_MONOTONIC ms kept fresh by chandra-remote */
} ChandraFbHeader;
static inline uint8_t *chandra_fb_slot_ptr(void *base, uint32_t slot, uint32_t slot_bytes) {
return (uint8_t *)base + CHANDRA_FB_HDR_BYTES + (size_t)(slot & 1u) * (size_t)slot_bytes;
}
#endif /* CHANDRA_FB_SHM_H */