uwerat / vnc-eglfs

VNC server for Qt/Quick on EGLFS
BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link
eglfs qt qtquick vnc-server

VNC for Qt/Quick on EGLFS

This project implements a VNC server for Qt/Quick windows.

The basic idea of this server is to grab each frame from the GPU and to forward it to the RFB protocol.
This implementation is not affected by limitions of the software renderer and allows having native OpenGL code in application code ( custom scene graph nodes ).

As the Qt/Quick technology is for "fluid and dynamic user interfaces" the VNC server has to be able to forward full updates ( f.e. fade in/out ) with an acceptable rate to the viewer, what makes image compression more or less mandatory. Fortunately modern GPUs usually offer encoding for JPEG and H.264. Encoding on the GPU also avoids the expensive calls of glReadPixels for each frame.

Obvious limitations:

The code might work with all Qt versions >= 5.6.

Project Status

The current status of the implementation was tested with remote connections to an application running on EGLFS and XCB.

Numbers depend on the capabilities of the devices and the size/content of the window, but on my test system ( Intel i7-8559U ) I was able to display a window with 800x800 pixels with >= 20fps remotely, when JPEG compression is enabled. The number was found by running xtigervncviewer -Log '*:stderr:100' as viewer.

These features are implemented:

The following important parts are missing:

How to use

There are 2 way how to enable VNC support for an applation:

Both solutions are affected by the following environment variables:

Application code

The most simple way to enable VNC support is to add the following line somewhere:

#include <VncNamespace.h>

VNC::setup();

If you want to get rid of the local windows you have several options:

VNC platform integration proxy

If you do not want ( or can't ) touch application code you can load the VNC platform plugin proxy by using one of these: keys. The proxy simply does the initialization above before loading the real plugin following the "vnc" prefix.

Assuming library and plugin are installed in "/usr/local/vnceglfs":

# export QT_DEBUG_PLUGINS=1
export QT_QPA_PLATFORM_PLUGIN_PATH="/usr/local/vnceglfs/plugins/platforms"
export LD_LIBRARY_PATH="/usr/local/vnceglfs/lib"

export QT_QPA_PLATFORM=vnceglfs # vncxcb, vncwayland, vncoffscreen, vncgbm