X-Windows System is a 30+ year old technology developed by MIT, Digital Equipment Corporation (DEC) and IBM so that cheap thin clients could access applications residing on a remote server over a fast network. The X server controls the display and is responsible for drawing graphics on the screen. Typical applications are X clients which exchange messages with the X server via the X Windows protocol. Application are typically written through high level tool kits such as GTK, QT, Tcl/TK, etc. This client-server approach is still used on Linux desktop even though client and server reside on the same machine. Design aspect that makes X-Windows complex and slow are:

  • Client and server have to format commands and responses, A.K.A X11 protocol.
  • Synchronous and round-trip requests are inefficient.
  • Frequent context switching between application and X server degrade performance.
  • Graphics rendering can only start after X server starts running.
  •  X-server implementation is not multi-threaded.

Since in most use cases, the application needs to draw graphics on the clients machine, it makes sense to implement graphics processing as a driver. MicroXwin implements core graphics functions as a kernel module which provides a character driver interface. A modified user-space X11 library communicates directly with the kernel driver. The advantages of this design are:

  • Low latency and no penalty for round trip requests.
  • No buffering and formatting of requests and responses. There is no network protocol.
  •  No context switch overhead.
  • Direct rendering of all graphics by the client.
  • No changes required for existing Xlib applications.
  • 2X faster than standard X-Windows.

MicroXwin is used as the graphics framework in  VOLKSPC OS which can run both Android and Debian XFCE desktop applications simultaneously.

Compatibility

MicroXwin provides a binary compatible set of Xlib and XCB libraries which means that most tool kits and applications work without changes. This includes popular applications such as Firefox, Thunderbird, LibreOffice, etc. Popular Linux tool kits such as GTK+2.0, GTK+3.0, QT3 and QT4 work well with MicroXwin. The QT5 tool kit does not work with MicroXwin at this time due to its use of XCB instead of Xlib. The current XCB support in MicroXwin is not complete.

Performance

The latest version of MicroXwin is available as a part of the VOLKSPC distribution for the popular ODROID-C2 board made by Hardkernel (http://www.hardkernel.com) which is based on an Amlogic S905, quad core Cortex-A53 running at 1.5Ghz. This board is slightly faster than Raspberry Pi 3. The VOLKSPC distribution is based on Debian Jessie ARMHF. Gtkperf is used to compare graphics performance between VOLKSPC OS and Ubuntu running on the ODROID-C2.

Based on gtkperf, MicroXwin is about 176% faster than X11 running on Ubuntu Mate desktop. Also client-server X11 runs on two cores during the benchmark while in the case of MicroXwin, gtkperf is rendering directly on one core.

This is a clip of MicroXwin running on Cubieboard2.

With 2 instances of gtkperf running we can see that MicroXwin is about 2X faster than X-Windows.

It is important to understand that X11 performs reasonably well when commands are streamed from X11 client to X11 server as is mostly the case in gtkperf or x11perf benchmarks. Unfortunately X11 architecture becomes an issue when you try to get information or events from the server. To demonstrate the problem we will use x11perf -prop command to get property from the X11 server. On the same ODROID-C2 system Ubuntu x11perf -prop yields 20,900 iterations/sec while with MicroXwin we get 658,000 iterations/sec a whopping 30X speed up. This is not surprising since in the case of MicroXwin information is available directly from the driver.