Low-latency wayland compositor in OCaml
This is an idea proposed in 2024 as a Cambridge Computer Science Part II project, and is currently being worked on by
When building situated displays and hybrid streaming
systems, we need fine-grained composition over what to show on the displays.
Wayland is a communications protocol for next-generation display servers used
in Unix-like systems.
It has been adopted as the default display server by Linux distributions
including Fedora with KDE, and Ubuntu and Debian with GNOME. It aims to
replace the venerable X display server with a modern alternative. X leaves
logic such as window management to application software, which has allowed the
proliferation of different approaches. Wayland, however, centralizes all this
logic in the 'compositor', which assumes both display server and window manager
roles.
Libraries such as wlroots, libweston, and 'small Wayland compositor', exist to
provide a basis on which to build a Wayland compositor. Much of the Wayland
ecosystem is written in C, but modern memory-safe, type-safe, composable
systems programming languages like OCaml offer tempting alternatives. This
project proposes writing a Wayland compositor in OCaml, which opens up interesting
opportunities for writing custom window management logic similar to how xmonad
does for X https://github.com/swaywm/sway/blob/master/sway/sway-ipc.7.scd
This project is suitable for an ambitious student with a keen interest in
graphics, communication protocols, and operating systems. Starting points
include completing OCaml wlroots bindings https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/tinywl/tinywl.c
If you want to read a really fun historical paper that inspires this work, then the teleporting displays paper should give you some entertaining background.