[Updated] Mir – An outpost envisioned as a new home

Some time ago, Canonical started internal discussions about our convergence strategy, clearly spelling out the distant target of shaping and developing a single computing platform and operating system that is able to power the cloud, classic desktop machines, laptops, TV sets, phones and tablets (fridges anyone?). More to this, we stated that we want a single mobile device, a bundle of portable computing power together with the respective operating system, that seamlessly adapts to different form-factors and use-cases. Or to put it a little more catchy:

Your phone is your TV, is your desktop, is your … you name it.

And yes, we were aiming for the moon. We worked hard to draft a system that would allow us to reach the moon, while at the same time catering towards our other central goal of providing a beautiful and lean user experience. It became apparent in conversations and discussions that one of the cornerstones of the future system we were designing will be the graphics stack, including the Unity shell. After much discussions about existing solutions (X & Weston), and how we could leverage them, we took a step back and distilled down our (technical) requirements for a future graphics stack:

  • Tailored towards an EGL/GL(ES) world.
  • Minimal assumptions regarding the underlying driver model.
  • Ability to leverage existing drivers implementing the Android driver model.
  • Ability to leverage existing hardware compositors.
  • Efficient, in terms of memory-, CPU- and GPU-consumption/usage.
  • Tightly integrated with the Unity shell, fulfilling the shell’s requirements while at the same time not dictating any sort of semantics up the stack.
  • An efficient and secure input subsystem supporting demanding mobile use-cases.
  • Fully tested from the ground up.
  • Adaptable to future requirements.

With these priorities in mind, we revisited and carefully evaluated existing solutions again and found that neither of them satisfies our requirements. In particular, X and its driver model is way too complicated and feature-laden, resulting in a less efficient system and a driver model that is unlikely to be widely supported on mobile platforms. In the case of Weston, the lack of a clearly defined driver model as well as the lack of a rigorous development process in terms of testing driven by a set of well-defined requirements gave us doubts whether it would help us to reach the “moon”. We looked further and found Google’s SurfaceFlinger, a standalone compositor that fulfilled some but not all of our requirements. It benefits from its consistent driver model that is widely adopted and supported within the industry and it fulfills a clear set of requirements. It’s rock-solid and stable, but we did not think that it would empower us to fulfill our mission of a tightly integrated user experience that scales across form-factors. However, SurfaceFlinger was chosen as our initial solution for getting started with the overall Ubuntu Touch project, planning to replace SurfaceFlinger with Mir as soon as possible.

In summary, our evaluation of existing solutions led us to the conclusion that neither of them fits our requirements and that adjusting/adapting them would require substantial efforts, too. For this, we decided to go for our own solution, catering directly towards our goals and our vision, effectively saying: Yes, we are going to do our own display server.

The project was born and we decided to name it Mir (as in the space station), as it would be our outpost that finally enables us to reach our goal of arriving at the moon, providing a seamless and beautiful user experience spanning multiple form-factors. The team set off to work on Mir while large parts of Canonical started working on the Ubuntu Touch project (relying on SurfaceFlinger). A lot of knowledge and experience was and is transferred from the Ubuntu Touch project to the Mir team, with the work on the phone and tablet revealing more and more technical requirements and subtleties that heavily influenced the Mir architecture and implementation. Thus, one of the earliest technical decisions that has been taken by the team concerned the protocol that applications rely upon to communicate to Mir. We evaluated Wayland and compared it to the SurfaceFlinger approach, realizing that neither of them fits our needs. Wayland is a very promising and sensible attempt at standardizing the way that applications talk to a display server, however, it exposes privileged sections like the shell integration that we planned to handle differently, both for security reasons and as we wanted to decouple the way the shell works on top of the display server from the application-facing protocol. In the end, we decided to implement Mir’s core in a protocol-agnostic way, considering the communication protocol a very important part of the overall story, but not the driving one. We have chosen Google’s protocol buffers as our data and interface description language (DDL & IDL) and implemented a lean RPC layer that abstract away transport-specific details (relying on an ordinary socket by default). It is well tested and the protobuf IDL and DDL provide us with forward- as well as backward-versioning capabilities. However, the communication component of the overall system is adaptable and can be adjusted to account for future requirements and developments.

A final word on timelines: At the time of this writing, we are preparing to deploy the next version of the Unity shell tightly integrated with Mir in the not-too-distant future on the phone and the tablet. However, regarding the desktop use-case: We have integrated X, leveraging the prior XWayland work, to run on top of Mir (XMir) and started initial porting efforts for toolkits with a focus on Qt5. With our X-integration in place, you can run Mir on your desktop machine if your system runs a GPU that supports the free driver stack. For the closed-source desktop drivers: We are in active conversations with GPU vendors to enable Mir on those drivers/GPUs, too. [Updated] More to this, we are working together with NVIDIA towards a more unified driver model sitting on top of EGL.

As we are moving along with the development of Mir, we will work on integrating existing toolkits with the new display stack to allow application developers a seamless transition between different form-factors and prevent them from the burden of supporting multiple different display servers. As noted before, Qt5 is our first target here, with GTK3 and XUL being in the pipeline. To support legacy X applications that cannot be adjusted to work against Mir, we will provide a translation-layer that leverages the existing XMir implementation and allows legacy X apps to use Mir transparently.

And that’s pretty much it. Thanks for reading. I hope I could give you some insight into the history of Mir, its motivation and its trajectory. If you want to dive even further into the Mir world, head over to wiki.ubuntu.com/MirSpec. A lot of work has already been done, but more of it lies ahead of us. So if you are curious, have questions, want to help us or simply want to get to know the team, join the Mir sessions at the upcoming virtual UDS. You might also want to read Olli’s description of the bigger picture, including our overall convergence strategy for Unity.

To the moon,

Thomas

11 thoughts on “[Updated] Mir – An outpost envisioned as a new home

  1. Frank Kaufmann (@FrankKaufmann76)

    “[Updated] More to this, we are working together with NVIDIA towards a more unified driver model sitting on top of EGL. ”

    So how does this “working together” look like? Canonical is asking NVIDIA to support Mir and they are evaluating the idea? Or is there something real going one? Something other people could see so they are convinced that within a year you can run Ubuntu on Mir with closed NVIDIA drivers on your PC?

    Reply
    1. ThomasVo5 Post author

      Canonical and NVIDIA are looking into extending EGL such that topics like multiple GPU and output devices (i.e., monitors) are included within the specification. So yes, the collaboration is investigative at this point but nevertheless very real with the goal to enable Mir on all NVIDIA GPUs.

      Reply
      1. shmerl

        Still no answer? The drivers question is a really critical one, and should not be ignored.

  2. Christian

    Any plans to make Mir distribution independent, that means, that one might also be able to install and use Mir on Fedora, SuSE, Gentoo, etc?

    This would be needed (obviousely) for the KWin (KDE) window manager to accept Mir and support it also (which I’d really like).

    Many thanks for Mir,
    Christian.

    Reply
    1. ThomasVo5 Post author

      Mir is distribution-independent at this point, we package it for Ubuntu by default, however, it could be packaged for other distributions, too. Its source code is available from launchpad.net/mir right now.

      Reply
      1. Christian

        Hey Thomas, great to hear, however, I think it would invite other developers more if a non-ubuntu centric development platform would be used, such as Github or alike.

        I’ve also taken a look into the spec wiki page, and it looks like a motivation-page rather than a real spec file. That said, are there any plans to add any technical documentation / architectural overview pages ?

      2. ThomasVo5 Post author

        Thanks for the feedback, it’s an interesting point. However, we do rely on launchpad and the well-known and well-established processes common in the Ubuntu project to manage code, plan work and welcome contributions on many different levels, including architecture, source code, tests, documentation etc. for now. One major benefit when using launchpad is the ability to rely on sophisticated testing infrastructure that runs a set of CI jobs for every merge proposal across a wide variety of configurations/devices/form factors, autoland changes to trunk and make this infrastructure available to external contributors, too.

        For the wiki pages and more in-depth technical information: We are preparing a landing page for Mir right now, but please refer to the existing diagrams and documentation within the source tree (sub-dirs design/ and doc/). Another good source of reference for the time being is our extensive test-suite. Please let me know if you have any specific questions, or find me on #ubuntu-mir on irc.freenode.net (nick: tvoss).

  3. Felica

    Hello there! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me.
    Anyhow, I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!

    Reply

Leave a comment