Mir and Android FAQ

There’s been some murmurs and uncertainty about Mir and Ubuntu Touch support, so here’s a quick FAQ.

Does mir support android drivers?

Yes! We put great care into our platform abstraction so that when you run on mesa desktop drivers, you use our mesa/gbm platform, but when you run mir inside of an Ubuntu Touch phone/tablet, you use the android platform to get full OpenGLES acceleration.

What sort of acceleration do you provide with android drivers?

Full acceleration! More specifically, this means that entire path, from client render to framebuffer post, is OpenGLES accelerated and there is no-copy of the color buffers. This gives mir clients and Unity Next the performance it needs to succeed.

Android uses java. Does this mean mir uses java?

Heavens no. Mir has no java inside. We are proudly a C++11 project (and we actually use the great new stl additions that come in C++11, like lambdas, smart pointers, and the like)

Do I need android tools (eg, the android SDK or NDK) to develop mir on Ubuntu Touch?

Nope! All of our dependencies and build tools come from debian packages wtihin Ubuntu. We use the gcc arm toolchains (and cross toolchains) available in the ubuntu repositories. The adb tool (from package android-tools-adb) is useful for development, but not necessary.

What devices do you run on?

We are focusing on the nexus line at first, but we should be able to enable all devices, regardless of gpu vendor. (we’re aiming for ICS drivers and newer).  We keep a list of the devices we are focusing on here.

How does Mir support android drivers?

We use the binaries available directly from the android gpu vendors as they are. Android driver developers have invested [b,m]illions of dollars to make sure that android drivers run well on android, and mir does not throw this effort away by trying to reinvent the wheel. Android drivers use 1) the android kernel, 2) the bionic libc and 3) the userspace driver libraries. We use this exact combination in mir so that Mir can be just as solid as the Android display system.

Does this mean mir uses bionic libc?

In short, no. The mesa/GBM platform goes nowhere near bionic libc. On the android platform, we carefully and cleverly tinker with the linker so that the Android drivers use bionic, but the mir code and libraries use the normal gnu libc. Mir code uses gnu libc that we all know and love, but we let the android drivers use libc they know and love (bionic).

Did you consider using some of the android components (eg surfaceflinger) instead of writing Mir?

Yes we did. We found that:

  1. Surfaceflinger is very tied to the android system and would take a large amount of porting work to run inside of Ubuntu Touch.
  2. Surfaceflinger is currently focused on a simplistic z-order based compositing, we needed something that can support the full Unity experience you expect on a desktop. The complex “launchers” you use in android are not part of surfaceflinger.
  3. Finally, adapting surfaceflinger to use mesa/gbm drivers is a ton of work (and probably not possible). We love the free stack drivers and need to support them for the desktop.

Do Mir clients care what platform (Android or mesa/GBM) they are running on?

Nope! A mir client will be able to run on a mesa/gbm platform or an android platform. We took great care to make sure that the clients are agnostic to the underlying OpenGLES driver model. There is no recompilation and no platform detection needed.

How can I find out more?

Easiest way is to pop on #ubuntu-mir (freenode) and ask me (kdub) a question. Mir is entirely open source so reading through the documentation and code there is also an option.

This entry was posted in Coding, mir, Open Source, Ubuntu. Bookmark the permalink.

7 Responses to Mir and Android FAQ

  1. Daniel Zimmermann says:

    I admit: Oracle is not one of the greatest companies, mankind has to offer.
    I like Unity and I hope that Ubuntu Touch will be successful and I’d love to see it fully operational on my Galaxy Nexus.
    But why the frack the absolute Anti-Java sentences? I don’t understand all that ranting about the language…
    I really hope to see JavaFX running on ARM well, so that I could use it to create apps for the Ubuntu phone as well, as I currently do it for Android!
    As a (formerly) free system, I really hope to (still) have the freedom to do so on NextGen Ubuntu!

  2. Keep up the great work man! We all are proud of the effort that you people are putting in to make the whole Linux experience better. Godspeed.

  3. It’s not *quite* true that clients don’t care what platform they’re running on. If they really want to they can poke the client library directly, and that returns different results on different platforms.

    That said, I can’t think of a reason outside the foundational stuff – EGL and XMir, specifically – why a client would want to do that.

    Unless a client specifically *wants* to care about what platform it’s running on it doesn’t care :)

  4. rock says:

    Thanks for this article :)

  5. happosai says:

    “we carefully and cleverly tinker with the linker so that the Android drivers use bionic, but the mir code and libraries use the normal gnu libc.”

    I think it might be polite to tell who actually did the hard work of making that possible…