Chapters

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.

  1. 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.
  2. Shell. The springboard shell 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.
  3. Apps. Each app is a separate process. An SDK app draws into shared memory and talks to the shell over a SOCK_SEQPACKET socket. A native Linux app is an ordinary Wayland client that the compositor treats like any other window.
  4. Services. bifrostd starts and restarts the background services audiod, netd and updated. 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.

Note

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.

LayerHow it works
DeviceEGL on the GBM platform of the render node, with a GLES 3.0 context.
DrawablesGBM 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.
PresentationThe same dma-bufs are wrapped in wl_buffers through zwp_linux_dmabuf_v1. The format and modifier are checked before use.
LayersThe CPU raster is the content layer. It is uploaded only where it changed. The GPU draws the wallpaper, the glass and the content.
MaterialsA dual-Kawase blur pyramid of the wallpaper is computed once for each wallpaper change. Glass shapes sample it through a rounded-rectangle distance field.
SynchronizationMesa 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.

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.

Important

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.

ServiceSocket idWhat it owns
audiodis.olibuijr.audioThe speaker and the microphone. It holds one queue. The last PlayQueue wins. It starts muted and makes no sound without a command.
netdis.olibuijr.netThe Wi-Fi supplicant, DHCP and routes. It sends a status event on every change.
updatedis.olibuijr.updateThe 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 State on each change and about once a second during playback, and Record and RecordDone during a recording.
net: Subscribe, Scan, Join, Select, Forget, SetAutoJoin, Move, Enable
Commands. The service sends Status on subscribe and on each change.
update: Configure, Conditions, Check, Download
Commands. Configure must be sent before any check. The service sends State and SystemInstalled.
Note

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.

CapabilityWhat the app can reach
none (default)Its private writable data folder. The network namespace is isolated.
networkThe host network namespace.
storageThe local account's full home folder. This is for Files compatibility only. Per-file grants are not yet available.
audioThe sound devices and the audio service socket, when present.
remote-desktopOne 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.

Important

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.

  1. Hello. The app sends Hello { sdk_version, app_id }. The app id must match the id in the manifest.
  2. Configure. The shell sends Configure before the first frame and again after each resize or change of scale. It has the fields w, h, scale, safe_top, safe_bottom, dark, text_scale and reduce_motion.
  3. Buffers. The app creates two shared memory buffers with memfd_create, or with /dev/ashmem where memfd_create is refused. Each buffer is w × h × 4 bytes. The app sends Buffers { w, h } with both file descriptors in one SCM_RIGHTS message. It sends the message again after each resize.
  4. 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.
  5. Release. The shell returns the buffer with Release { buf }. The app must not write to the buffer until it receives this message.
DirectionMessages
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.

PathDesktop frame presentArea damaged each frame
Shared memory copy1.9 ms, plus the compositor upload100 %
GPU presenter, first version15 ms, full upload and a synchronous fence100 %
GPU presenter, current0.40 ms (0.25 ms upload, 0.15 ms render)About 15 %
Idle means idle.

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.