Docs The system
Architecture
BifrOSt on the PC is a set of separate processes. The desktop shell draws the menu bar, dock and windows, apps run as their own programs, and small system services own the speaker, the network and updates. This chapter describes how those pieces fit together and what each one is responsible for.
Overview
The PC desktop has four layers. Each layer owns one job, and the layers talk through sockets and shared memory rather than through one shared address space.
- Session. The session supervisor starts labwc, a Wayland compositor, under seatd, which gives the session access to the display and input devices. labwc is the compositor for now. The native compositor is planned but not yet available.
- Shell. The
springboardshell connects to the compositor as a Wayland client. It draws the desktop background, the menu bar, the dock and the built-in apps. It also runs the existing system operations, such as installing packages and changing settings. - Apps. Each app is a separate process. An SDK app draws into shared memory and talks to the shell over a
SOCK_SEQPACKETsocket. A native Linux app is an ordinary Wayland client that the compositor treats like any other window. - Services.
bifrostdstarts and restarts the background servicesaudiod,netdandupdated. Each service listens on its own socket. Apps and the shell are clients of these services.
+-------------------------------------------------------------+
| labwc (Wayland compositor, seatd for DRM and input) |
| +-------------------+ +----------------------------------+|
| | springboard shell | | SDK apps (sandboxed processes) ||
| | desktop, bar, dock|<-| native Linux apps (Wayland) ||
| | built-in apps | +----------------------------------+|
| +--------+----------+ |
+------------|-------------------------------------------------+
| unix sockets (one per service)
+---------+----------+----------+------------+
| audiod | netd | updated | supervised by bifrostd
+--------------------+----------+------------+
The shell and the apps never share an address space. A shared memory buffer carries pixels, and a socket carries everything else. You can restart an app or a service without restarting the shell.
The desktop shell still runs as root, so it can perform existing system operations. Apps do not. Each installed app runs as the local, non-root account. See Isolation below and the system services chapter.
GPU presenter and scanout
The shell composes its own surfaces on the GPU when it can. This path is the presenter. It uses EGL on a GBM device, and it exchanges buffers with the compositor as dma-bufs, so the desktop does not copy pixels to the compositor on each frame. The code is vendor neutral and targets Mesa today. It does not depend on a single GPU vendor.
| Layer | How it works |
|---|---|
| Device | EGL on the GBM platform of the render node, with a GLES 3.0 context. |
| Drawables | GBM buffer objects, imported as EGL images that serve as render targets. Linear by default. Set BIFROST_GPU_TILED=1 to use driver tiling with a modifier. |
| Presentation | The same dma-bufs are wrapped in wl_buffers through zwp_linux_dmabuf_v1. The format and modifier are checked before use. |
| Layers | The CPU raster is the content layer. It is uploaded only where it changed. The GPU draws the wallpaper, the glass and the content. |
| Materials | A dual-Kawase blur pyramid of the wallpaper is computed once for each wallpaper change. Glass shapes sample it through a rounded-rectangle distance field. |
| Synchronization | Mesa uses implicit dma-buf fencing after glFlush. Other drivers wait on an EGL fence. BIFROST_GPU_WAIT=1 forces the wait. |
The presenter's API follows Metal: a device, drawables, and one render pass for each present. A Vulkan backend can replace the GLES code behind the same interface.
If the presenter cannot start, because GBM, dma-buf import or the format is unavailable, the shell logs the reason and falls back to the shared-memory path. BIFROST_GPU=0 selects that path directly.
- Presenter::set_wallpaper
- Recomputes the blur pyramid. Call it only when the wallpaper changes.
- bifrost_render::glass::push
- Adds a glass shape. The presenter draws the blur under the shape. The caller draws only the tint.
- glass::set_clarity(f32)
- Scales glass tints. 0 is clear and 1 is tinted.
Zero-copy scanout
Scanout renders the frame straight into the buffers that the display reads. It removes the final copy from the shell's raster to the display buffer. It is implemented, but it is off by default. Enable it in Settings > Developer > Zero-Copy GPU Output, which sets the preference gpu_scanout to 1. The change takes effect after a restart. If a page flip fails, or the GPU is lost, the shell falls back to the copy path.
Default-on scanout is not yet available. It needs a day of flips without failures, a measured gain of at least 3 ms on large frames, and clean suspend and resume.
Wayland desktop and native apps
The desktop is a background layer surface. The menu bar is on the top layer with an exclusive zone, and dropdown menus are overlay surfaces. Each built-in app is an xdg-shell toplevel with its own title bar and its own shared memory buffers. Windows that a Wayland client creates are in the same stack and receive focus in the same way.
- Window buffers. A window starts with one buffer. It grows to two only when a damaged frame arrives before the compositor releases the first. Each buffer is reused only when its width and height match.
- Lock. The lock screen uses
ext-session-lock-v1. External apps get no input while the session is locked. If the lock client exits, the session stays locked. - Capture. Screenshot tools use compositor capture, so windows from native apps are included.
- XWayland. The compositor runs XWayland for X11 clients.
- Native apps. An installed native package receives its compositor socket, read-only session and hardware discovery data, and the GPU devices. It does not receive the system bus. Applications is the last dock button. Super+Space opens the installed
.desktopmenu.
Appearance for native apps
The shell writes the current Light or Dark choice and the accent colour to $XDG_RUNTIME_DIR/bifrost-appearance. The bifrost-portal program serves that file as org.freedesktop.portal.Settings, in the namespace org.freedesktop.appearance. GTK, Qt, Firefox and winit or egui apps read the choice from there. The key color-scheme is 1 for dark, 2 for light and 0 for no preference. The portal checks the file every 500 ms and emits SettingChanged when it changes.
The portal is the supported way for a native app to read the appearance. Do not depend on any other desktop service.
System services
bifrostd is a small supervisor. The boot script starts it before the shell, and it keeps running when the shell restarts. It scans the installed packages every 500 ms for those with kind = "service", so an install, update or removal takes effect without a restart. It starts each service with BIFROST_SERVICE_SOCK, BIFROST_DATA and BIFROST_SHELL_DIR set. If a service exits, bifrostd restarts it after 1, 2, 4 and up to 30 seconds. A run of 60 seconds resets the delay.
| Service | Socket id | What it owns |
|---|---|---|
audiod | is.olibuijr.audio | The speaker and the microphone. It holds one queue. The last PlayQueue wins. It starts muted and makes no sound without a command. |
netd | is.olibuijr.net | The Wi-Fi supplicant, DHCP and routes. It sends a status event on every change. |
updated | is.olibuijr.update | The update check, store updates, silent system package installs, and the OS download. It does not restart the shell. |
Services use their own socket protocol, not the app protocol. The frame is a u32 length, then a u32 tag and the fields. A frame may be at most 256 KiB. Every service answers Ping with Pong, which carries its id and version. Clients reconnect and subscribe again after a service restarts.
- audio: Subscribe, PlayQueue, Play, Pause, Toggle, Next, Prev, JumpTo, SeekMs, SetShuffle, SetRepeat, SetVolume, SetMuted, Stop, RecordStart, RecordStop
- Commands. The service sends
Stateon each change and about once a second during playback, andRecordandRecordDoneduring a recording. - net: Subscribe, Scan, Join, Select, Forget, SetAutoJoin, Move, Enable
- Commands. The service sends
Statuson subscribe and on each change. - update: Configure, Conditions, Check, Download
- Commands.
Configuremust be sent before any check. The service sendsStateandSystemInstalled.
The microphone opens only when an app sends RecordStart. The service writes the WAV file to a path inside the app's data folder.
Not yet available: the shell still joins hidden and enterprise Wi-Fi networks itself, and the shell's Wi-Fi recovery still runs there too. These move to netd in a later change.
App isolation
The shell starts every installed SDK app and native package through a single launch path. The app runs as the installed non-root account, inside bubblewrap. The namespaces are filesystem, PID, IPC, UTS and user. The process starts with NoNewPrivileges, and all capabilities are dropped. If the identity check, the permission check or the sandbox setup fails, the launch fails. There is no fallback to an unrestricted launch.
- Visible to the app. Its read-only package, its own writable data folder, the system runtime files, and the resources it declares. Fonts come from the read-only package. Each app gets a private
/tmp,/procand/dev. - Hidden from the app. Other apps' data, the home folder, the system bus and the session bus. Unrelated file descriptors are closed on
exec. The app keeps only its SDK channel. - No nested namespaces. An SDK app cannot create its own user namespaces. The built-in Browser can, because it uses its own nested sandbox.
| Capability | What the app can reach |
|---|---|
none (default) | Its private writable data folder. The network namespace is isolated. |
network | The host network namespace. |
storage | The local account's full home folder. This is for Files compatibility only. Per-file grants are not yet available. |
audio | The sound devices and the audio service socket, when present. |
remote-desktop | One fixed sharing request to the Remote broker. Requires network and storage. |
A package that asks for a capability not in this table fails to launch. See Manifest for the field.
Do not describe this as universal isolation. Unpackaged Linux applications started from the application launcher run outside the installed-package policy. Filtering of privileged Wayland protocols and a document-picker portal are not yet available.
App protocol
An SDK app talks to the shell over one SOCK_SEQPACKET socket. Each message is one packet. The packet starts with a little-endian u32 tag, and the fields follow. A packet is at most 16 KiB. Receivers skip unknown tags, so an older app and a newer shell can run together. The SDK implements the protocol for you. Read this section only if you write a client without the SDK.
The shell passes the socket to the app as a file descriptor number in BIFROST_SOCK. It also sets BIFROST_APP_ID and BIFROST_DATA, the app's data folder. sdk_version is 1. It changes only for breaking changes.
- Hello. The app sends
Hello { sdk_version, app_id }. The app id must match theidin the manifest. - Configure. The shell sends
Configurebefore the first frame and again after each resize or change of scale. It has the fieldsw,h,scale,safe_top,safe_bottom,dark,text_scaleandreduce_motion. - Buffers. The app creates two shared memory buffers with
memfd_create, or with/dev/ashmemwherememfd_createis refused. Each buffer isw × h × 4bytes. The app sendsBuffers { w, h }with both file descriptors in oneSCM_RIGHTSmessage. It sends the message again after each resize. - Frame. The app draws into the buffer the shell is not holding, and sends
Frame { buf, damage }. The pixels are 32-bit and premultiplied, with a stride equal to the width. The damage list gives the changed rectangles. The first frame after a size change is always full. - Release. The shell returns the buffer with
Release { buf }. The app must not write to the buffer until it receives this message.
| Direction | Messages |
|---|---|
Shell to app (ToApp) | Configure, Touch, Key, Release, Resume, Suspend, Quit, Command, Activate, Context, ContextAction, Open, Clipboard, Appearance, KeyboardConfig, DocGranted, DocError, MenuAction, KeychainReply, DocBatch, AxSet, and the text input, notification, share and drag messages |
App to shell (ToShell) | Hello, Buffers, Frame, WantsKeyboard, Haptic, OpenUrl, Notify, Log, SetClipboard, Commands, Controls, RemoteSharing, ContextMenu, SetBadge, KeyboardOut, DocOpen, DocSave, DocCommit, Materials, AppMenus, Keychain, ControlsTree, Share, and the document, notification and drag requests |
Messages for documents, text input and accessibility are part of the same protocol. The byte-level encoding is in springboard/proto/src/lib.rs. It is shared by the shell and the SDK, and has round-trip tests. The chapter on the UI kit describes what the SDK does with these messages for you.
Performance
The figures below were measured on an Intel HD 530 at 2560 × 1440, unless noted. Treat them as the baseline for the current release. The shell logs a gpu present line every ten seconds, and tools/bench.py reads it on a device. Results are recorded in docs/perf-history.jsonl.
| Path | Desktop frame present | Area damaged each frame |
|---|---|---|
| Shared memory copy | 1.9 ms, plus the compositor upload | 100 % |
| GPU presenter, first version | 15 ms, full upload and a synchronous fence | 100 % |
| GPU presenter, current | 0.40 ms (0.25 ms upload, 0.15 ms render) | About 15 % |
- CPU draw. The shell clears and redraws only the changed regions. CPU draw time is 1.4 ms with an external app open, and 9.2 ms with Settings open. Settings draws inside the shell.
- Zero-copy scanout (host bench, 1920 × 1200). A full frame takes 0.72 ms on one thread and 0.45 ms on four. Copy time scales with the damaged area, so scanout helps most on large frames. On the device, frames with large damage take 9 to 12 ms. Those frames are limited by the uncached write to the display buffer.
- Measure it yourself. Run the device bench in
tools/bench.pyon the target machine, or the host benches in the same file. Compare the result with the table before you claim a gain.
A desktop with nothing to do should barely wake the processor. The services and the shell block on their sockets and descriptors instead of polling, status checks sleep until a client asks for them, and the shell draws no frame when nothing changed. Idle CPU, wakeups and memory are measured on the device against budgets, and the release acceptance run fails when one is exceeded, so a regression is caught before it ships. The first round of this work removed the largest periodic wakeup, the boot service's 50 per second loop.
Not yet available: GPU blur for the window materials, text and icon atlases on the GPU, explicit synchronization for NVIDIA, and a Vulkan backend.