- C 57.6%
- C++ 39%
- Python 1.9%
- Makefile 1%
- Shell 0.2%
- Other 0.3%
This changes the AIDL HWC2 compat callback handling so display disconnect hotplug events are delivered from a worker thread instead of directly from the vendor HWC callback stack. On tegu, the Pixel HWC can emit a hotplug disconnect while holding internal DRM/hotplug state. The libhybris/Mir disconnect path may then re-enter HWC immediately, for example while tearing down display state or disabling vsync, which can deadlock the vendor composer service. Deferring disconnect delivery breaks that synchronous re-entry path. Connected hotplug events are still delivered synchronously. This is intentional: libhybris/Mir expects the initial primary display to be available before registerCallback() returns. Making connected events async caused startup races like primary display disconnected. - Adds a hotplug worker queue to AidlIComposerCallbackWrapper. - Queues only DISCONNECTED hotplug events for async delivery. - Keeps CONNECTED hotplug events synchronous for startup and reconnect correctness. - Adds debug logging around hotplug queueing/delivery and callback wrapper lifecycle. Reviewed-on: #2 |
||
|---|---|---|
| compat | ||
| hybris | ||
| utils | ||
| .gitignore | ||
| .gitmodules | ||
| .travis.yml | ||
| LICENSE.Apache2 | ||
| LICENSE.BSD-2 | ||
| LICENSE.BSD-3 | ||
| LICENSE.BSD-4 | ||
| LICENSE.GPL3 | ||
| LICENSE.ISC | ||
| LICENSE.LGPLv21 | ||
| LICENSE.MIT | ||
| README.md | ||
What is libhybris
libhybris is a way to load drivers compiled for Android from "regular linux processes". In other words it allows you to load drivers that link against the bionic c library inside processes whose native c library is e.g. glibc, musl, ...
This allows us to load graphics drivers, or any other driver that's sitting inside an Android "so" file and utilize them in a non-Android-based Linux distribution.
How to use libhybris
In general Android is patched to remove TLS accesses in bionic c library which usually cause problems with glibc TLS slots. Android is also patched to remove zygote, surfaceflinger, bootanim and other processes, that are not needed when running a regular Linux distribution or would cause problems, from Android init. The resulting stripped down Android system is then launched as a systemd service or container by the Linux distributions init in order to provide hardware adaptation services that are mandatory to be able to use Android drivers.
For reference:
For building libhybris you need android-headers to compile against the Android version you are targeting.
See also
- https://github.com/libhybris/libhybris/blob/master/utils/extract-headers.sh
- https://github.com/mer-hybris/droid-hal-device/blob/master/helpers/extract-headers.sh
There are projects which make this process easier documented here:
- SailfishOS Hardware Adaptation Development Kit: https://docs.sailfishos.org/Develop/HADK which documents how to port the Linux distribution SailfishOS on top of Android.
- Halium: https://github.com/Halium which provides a standardized & containerized abstraction between the Android system and the used Linux distribution, which is used by Droidian, FuriPhone, Ubuntu Touch and others.
Since Android uses hardware composer for graphics this needs to be accounted for by using for example a plugin to the Qt compositor if Qt is being used: https://github.com/mer-hybris/qt5-qpa-hwcomposer-plugin
Similarly for other drivers, e.g. audio, wrappers need to be developed that bridge the Android functionality into the corresponding Linux distribution, e.g.: https://github.com/mer-hybris/pulseaudio-modules-droid
Additional notes
Since Android 8, many of the drivers, except those which require the highest possible performance like graphic drivers have been implemented via binder-IPC.
For these kinds of drivers it's sometimes easier to use binder-IPC directly from a native context. For these purposes there exists a glib based binder implementation here: https://github.com/mer-hybris/libgbinder and some example how to use it can be found here: https://github.com/mer-hybris/bluebinder