The new display servers

Mir is Near

In 2010, Ubuntu founder Mark Shuttleworth announced in a blog post that the distribution would be moving to Wayland [15] in the long term. However, in the Spring of 2013, Ubuntu parent company Canonical surprisingly announced that it was developing a separate display server called Mir. The company said the existing solutions simply did not meet their needs [16]. In particular, Canonical was looking for a display server that would run efficiently on cellphones and also work with proprietary Android drivers. After looking at the Wayland protocol, Canonical realized that the specification did not meet these requirements. The Ubuntu wiki also reports that Canonical had issues with Wayland's inflexible event handling.

The Mir documentation available on the Internet is extremely terse. It is limited to a handful of pages on the Ubuntu wiki [17], a Launchpad page with the source code [18], and a few blog posts by Mir developers. Despite the lack of documentation, all devices that run Ubuntu should support Mir, including desktop and mobile devices, embedded systems, and kiosk systems.

Many users report that Mir works efficiently, supports conservative use of CPU capacity and memory, and provides a stable API. The developers place great emphasis on security, as Canonical system architect Thomas Voß assured Linux Magazine: "Real and virtual input streams are designed to reach only the focused application. If the input stream needs to be filtered/processed by a further component, either the system or the user needs to trust this component."

The Mir architecture outlined in the Ubuntu wiki is similar to Wayland and uses some Wayland concepts. For example, Mir uses EGL and provides X-Mir, an X server to run legacy X11 programs. Conversely, Mir can launch under the X Window System. Mir originally managed the input devices via the Android input stack. Then Canonical employees modified it so that it would compile without the Android source code.

At the end of 2015, Mir v0.18 changed to the Libinput library, which, ironically, comes from the Wayland project [19].

Fresh Mussels

Mir also includes a compositor. The compositor composes a complete representation of all the windows and then draws the results on the screen. Mir refers to the individual windows as surfaces. The compositor also has a renderer that applies effects on the individual surfaces. The compositor is synchronized with the refresh rate of the screen (Vblank), so as to avoid tearing effects and unnecessary (render) cycles.

The Mir concept supports trusted sessions. Trusted components send queries to the user, and the queries are then rendered in the window (surface) of the application. If an application wants to access positioning or location data, the associated service asks for the user's permission. Mir then displays the prompt on the surface.

In Mir, an additional component known as the shell handles window management. The shell also provides several convenience functions, such as an application launcher and an ALT-tab switcher. In Ubuntu, Unity 8 serves as the shell; other shells did not exist when this issue went to press.

The Mir developers currently provide two libraries on Launchpad: libmirserver and libmirclient. libmirserver encapsulates the Mir server components and thus supports the development of a compositor. Mir clients use the libmirclient library to communicate with the Mir server. Alternatively, the applications can use the SDL, GTK+ 3, and Qt 5 toolkits, which Mir supports natively. Qt and QML form the basis for the Ubuntu SDK, which lets developers write Ubuntu applications [20].

Test Drive

Mir currently only runs on smartphones with Ubuntu Touch, but in the long run, Mir will replace the X Window System in Ubuntu. Many official Ubuntu derivatives do not want to make the change: The Kubuntu and Ubuntu Gnome developers have already announced that they will detour to Wayland in the future [21].

Users of Ubuntu 16.10 can test Mir and Unity 8 for the first time. However, the Mir/Unity duo leaves a very unfinished impression. For example, the pre-installed applications adapted for Mir are restricted to a simple browser and a terminal. X11 applications failed to launch, at least on the test system in our editorial office. The plans envisage Ubuntu completely changing from X11 to Unity 8 and Mir in the spring of 2018. Smartphones running Ubuntu Touch are already smooth and stable. Mir is also available in the new Snap package format for Ubuntu Core as of version 16.04 [22].

Just like Wayland, Mir relies on Generic Buffer Management (GBM) from Mesa 3D and DRM and KMS in the Linux kernel. Mir is thus – at least at the moment – also dependent on the free graphic stack. According to system architect Thomas Voß, the Mir team is collaborating with NVidia on a new alpha version of the proprietary NVidia driver adapted for Mir (see the "Proprietary Drivers" box). Mir already runs with the Intel driver. In addition, the developers are preparing Mir for various back ends. In particular, Mir will use the OpenGL successor Vulkan. Developers are also thinking of IoT devices, where rendering will need to occur in the software.

Proprietary Drivers

The existing Wayland compositor types use a kernel mode setting to define the resolution of the graphics card. OpenGL interfaces are provided by the Mesa 3D graphics library, which uses the kernel's Direct Rendering Manager (DRM) (Figure 3). Initially, Wayland only ran with free graphics cards drivers.

Support for the proprietary NVidia driver was introduced in version 364.12 of Wayland. The support required modifications to Weston, although NVidia at least provided the appropriate patches. The Wayland and Weston developers resisted the idea of modifying Weston to accommodate proprietary drivers. Also KDE developer Martin Gräßlin ruled out adapting KWin – at least until the patches had become part of Weston [9].

At the XDC 2016 conference, the NVidia developers asked for help to design a solution that would allow their drivers to work with Wayland, which, according to Pekka Paalanen, boosted their popularity at the conference. The result of this cooperation is a new API named the UNIX Device Memory Allocator, which is still in its infancy ([10], [11]).

Meanwhile, the Gnome developers have modified their compositor so that it supports the proprietary NVidia drivers [12]. Users can evaluate the results in Fedora 25 Workstation. But the developers want to revert the changes to the compositor in favor of the emerging API. Also the reference compositor Weston has now integrated selected NVidia patches.

Mir is released under the GPLv3, but if you want to submit improvements, you first need to sign the Canonical Contributor License Agreement (CLA). CoreOS developer Matthew Garrett has criticized the CLA, which, according to Garrett, lets Canonical commercially distribute the code written by volunteers to manufacturers of smartphones [23].

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Wayland

    The X11 graphics protocol is showing some serious signs of age, but Wayland is poised to come to the rescue.

  • Wayland 1.4 Challenges X11

    X marks the target for the next-generation windowing system.

  • Hawaii Desktop

    The Hawaii desktop relies on Qt Quick, supports Wayland, and comes with its own compositor. Thanks to the Maui Linux system, you can test Hawaii on a Live CD or on a VMware virtual machine.

  • Tech Tools
    • New Intel Xeon Phi
    • Intel-HP HPC Center
    • Oracle Supports Azure Cloud
    • Wayland 1.2 Released
    • Java Enterprise Edition 7 Released
  • New Nvidia Driver Offers Wayland Support

    Graphics vendor embraces new reality in Linux graphics

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95