Weston, VNC Server

In March last year I gave a talk about our work on the Wayland compositor Weston at the Embedded Recipes conference, and demonstrated using multiple backends simultaneously. A single Weston instance provided content to a range of different outputs, e.g.:

  • with the DRM backend to a local monitor (actually, in the live demonstration this was replaced with a Wayland backend window),
  • with the new VNC backend via the Remote Framebuffer Protocol to a computer running a VNC-client.
  • with the new PipeWire backend to a separate PipeWire application, allowing to encode the output for video streaming or store it into a file.

Current Mainline Status

While the necessary building blocks for multi-backend support and output via PipeWire - apart from already merged preparatory work (!577, !1067, !1078) - are still under review or being worked on (!578, !879, !1071, multi-backend-pipewire), the VNC backend has been merged into the main branch (!880, !1022, !1021, !1070).

This allows running a Weston compositor without a local display, which listens e.g. on port 5900 for connections from a VNC client. Thanks to the Neat VNC server library, which the VNC backend is based on, TLS encryption and authentication using the local user account are supported:

weston --backend vnc --width 1024 --height 768 --vnc-tls-cert tls.crt --vnc-tls-key tls.key

The necessary TLS key and certificate can be prepared just like for the already included RDP backend, which allows to transmit an output to a Windows PC via the Remote Desktop Protocol. Here is an extract from "man weston-vnc":

openssl genrsa -out tls.key 2048
openssl req -new -key tls-key -out tls.csr
openssl x509 -req -days 365 -signkey tls.key -in tls.csr -out tls.crt

Outlook

Apart from multi-backend support, further changes to the VNC backend are in flight, to reduce latency by letting the VNC client draw the cursor locally (#67, !984), to allow using the OpenGL-renderer with the VNC backend (!881), or to improve configuration of the framebuffer size (!1072).

We're still working on making the pending changes easier to review, and to get them merged piece by piece, to finally have a main branch with a Weston compositor capable of both displaying to a local monitor and being remotely controlled via VNC:

weston --backend drm,vnc --vnc-tls-cert tls.crt --vnc-tls-key tls.key

In the slightly more distant future lie possible improvements making use of hardware acceleration. For example, the Weston VNC backend could directly pass OpenGL renderbuffers into Neat VNC, which could implement hardware accelerated JPEG or h.264 compression.


Further Readings

What's new in Weston 13?

Last Tuesday, Weston 13.0 has been released. The release contains several new features that have been developed and mainlined for our embedded systems' use cases. In this blog post, we would like to explain the new features relevant for us — multi-backend, OpenGL renderer for the PipeWire and VNC backends and overlapping outputs — and outline why those are important for embedded usecases.