March 29, 2017
Android uses the HWC API to communicate with graphics hardware. This API is not supported on the mainline Linux graphics stack, but by using drm_hwcomposer as a shim it now is.
The HWC (Hardware Composer) API is used by SurfaceFlinger for compositing layers to the screen. The HWC abstracts objects such as overlays and 2D blitters and helps offload some work that would normally be done with OpenGL. SurfaceFlinger on the other hand accepts buffers from multiple sources, composites them, and sends them to the display.
|Figure 1. The traditional Android graphics stack.|
This is where drm_hwcomposer comes into play. Since the mainline kernel graphics stack doesn't offer the HWC API, drm_hwcomposer is introduced to interface with the mainline graphics stack through mesa and libdrm. Before this work drm_hwcomposer only offered the HWC1 API. Since Android 7.0 version 2 of the HWC API is used by SurfaceFlinger. HWC2 differs in a few ways from the previous version, for example the semantics of fence support were changed and the GPU can now be used as a fallback when compositing layers. Up until recently the mainline kernel lacked the fence primitive offered by Android used in HWC1 and HWC2.
But after my fellow Collaboran Gustavo Padovan's work on adding fence support to the mainline kernel was upstreamed in v4.10, the mainline kernel now has fence support equivalent to that of Android. The new fence support enabled work on drm_hwcomposer to add HWC2 support. And with it we are now able to boot Android on the db410c running the freedreno driver. But in theory it should work on any mainline kernel graphics stack enabled GPU. Currently the work is being upstreamed to the ChromiumOS repo which is the official upstream for drm_hwcomposer. A number of projects have seen contributions in order to enable this work:
This drm_hwcomposer work is part of long-standing collaboration between Google's ChromeOS team and Collabora.
With the release of virglrenderer 0.8.0, getting accelerated OpenGL within a virtual machine (VM) made a big leap forward. Since virglrenderer-0.7.0,…
Ongoing work on the reverse-engineered Panfrost OpenGL ES driver for Arm Mali GPUs has turned the RK3399 SoC into a very attractive platform…
As part of its unwavering commitment to open source and open standards, Collabora is proud to be part of bringing the recently-released…
There's been quite a few updates to Zink, an OpenGL implementation on top of Vulkan, since I last wrote about it. Here's an overview of…
A little over a month and a half ago, Collaborans including Aaron Boxer, George Kiagiadakis, Guillaume Desmottes, Stéphane Cerveau and myself…
In my last Panfrost blog post, I announced my internship goal: improve Panfrost to run GNOME3. GNOME is a popular Linux desktop making heavy…