Running desktop applications on UBports (X11, Wayland, Mir and toolkits)
After another discussion around this topic I felt it time to write up something for the forum. However, I have to declare an interest: my "day job" is developing Mir. You have to decide if that means I know what I'm talking about, or if I'm promoting my own goals.
When the Unity8 project started Canonical needed a rich enough "language" for applications and server to "talk" to each other to support convergence. They chose to develop this in the form of an API: Mir. The idea was that Mir would provide a way for various shells (Unity8 and other shells) and applications to co-operate.
It may sound ambitions to expect that every existing application should stop talking X11 and start "talking Mir", but really there were reasons to move away from X11 and applications largely use one of a few "toolkits" instead of using X11 directly. Get support into those toolkits and the job is mostly done. For other applications they built Xmir - which is an X11 server that translates for applications that only talk X11. Xmir could never be perfect for the converged scenario, but applications would be able to run.
At least that was the theory. In practice things didn't work out that way: toolkit support was variable and, in general, was never good enough for convergence. While Qt got pretty close and SDL2 is usable, there were still serious problems with gtk3 and Xmir.
UBports has not given up on the idea of convergence and of running desktop applications on Unity8. But if those applications do not support "talking Mir" then there are currently no good options. The least bad option is to use Xmir, but the result isn't great.
Canonical is no longer developing Unity8, but it has continued with Mir because of the "other shells" mentioned above. That is good for UBPorts, as Mir is a substantial part of the functionality Unity8 needs. However, there is a problem both for Canonical and for UBPorts: applications are not going to "talk Mir".
The approach Canonical is taking is to support applications that talk Wayland in Mir. Wayland is another X11 replacement that is being taken up by toolkits. While the approach taken is different (there is a limited "core" protocol that all Wayland servers must support and an extension mechanism for servers that need something richer) there are enough parallels for this to work. There's even an Xmir replacement: Xwayland, plays the same role of interpreter.
UBports cannot rely on seeing improvements to the Mir support in toolkits nor improvements to Xmir. The way forward for UBports is to leverage the continuing work Canonical is doing on Mir to support Wayland clients.
That requires one, non-trivial, thing: Moving to the current, supported, version of Mir.
There are several reasons why that is non-trivial:
- Mir is not supported on Vivid
- Mir has dropped support for "android" graphics drivers
- Code changes are needed to reflect changes to the Mir API
- Some further changes are needed to support Wayland applications
Now for the good news:
- Mir is supported on Xenial, and that is the next target for UBports
- The code for using "android graphics" drivers is not lost, it is alive and well thanks to UBports developers
- The code changes have been made before (Canonical made these changes for unity8-desktop-session on Zesty)
- The bad news: while unity8-desktop-session on Zesty works with the latest Mir, Wayland applications are not rendered on the display.
Updating UBports to the latest version of Mir will take time and effort, but it is the most feasible way of getting desktop applications working.
Popescu Sorin has uploaded a video of Unity8 desktop running on Mir 0.29.
thanks for the writeup, that is a great explanation, especially for our non-technical users.
I can confirm that the switch to xenial is on the horizon. After the release of OTA-3 (which still uses vivid), it's full steam ahead with xenial work. To quote what Marius' famous words: "We want to walk up the stairs, not jump up the stairs," so i don't know what mir version the initial stable release of ubuntu touch on xenial will use, but i've seen the Wayland tests already working on some phones, so who knows... In the long run, Ubuntu Touch will ideally just use the latest stable version of Mir, we should not allow for another big backlock like the current one to accumulate. I'll restrain myself from using the stairs quote again.
It's great to see support from Canonical(-employees) here, thanks a lot Alan! I hope it will be a fruitful collaboration, without your continued work on Mir our already big task would be a lot more difficult. I'm sure you will also profit from us as an active downstream project that uses Mir.