Vulkan API support on the Hikey960 running Android O Preview
Introduction
Vulkan is the next big thing in Graphics APIs. Wikipedia cites it as: “Vulkan is a low-overhead, cross-platform 3D graphics and compute API. Vulkan targets high-performance realtime 3D graphics applications such as video games and interactive media across all platforms. Compared with OpenGL and Direct3D 11 and like Direct3D 12 and Mantle, Vulkan can offer higher performance and more balanced CPU/GPU usage…“
In other words Vulkan not only aims to improve performance on the GPU side by enabling low level control, it also aims to improve support for multi-core cpu allowing developers to easily distribute compute load over multiple cores to improve performance. And with commercially available ARM CPUs easily having up to 10 cores, Vulkan will soon be the preferred API over opengl.
Google added native support for the Vulkan API and Libraries in AOSP starting with Android 7.0 Nougat. And since the HiKey960 runs Android O, It can support Vulkan on the software side, on the hardware side the Hikey960 has a Mali G71 MP8 for its GPU which definitely has support for the Vulkan API enabled by ARM.
How to get Vulkan API on the Hikey960?
As of now an official patch request has been made by me on android-review that enables support for the vulkan API on the hikey960. https://android-review.googlesource.com/#/c/433019/
Prefered Method (Not-available Yet): Download prebuilt AODP images from: http://builds.96boards.org/snapshots/hikey960/linaro/aosp-master/latest/
Alternate Method 1: Compile From Source As of now you will need to compile AOSP on you own to get vulkan working on your device. Once you have set up the build environment for hikey960 as directed here: https://source.android.com/source/devices
Make sure that vendor/linaro/hikey960/arm/device-partial.mk has the following lines:
PRODUCT_COPY_FILES := \
vendor/linaro/hikey960/arm/proprietary/lib64/libGLES_mali.so:system/lib64/egl/libGLES_mali.so:linaro \
vendor/linaro/hikey960/arm/proprietary/libGLES_mali.so:system/lib/egl/libGLES_mali.so:linaro \
vendor/linaro/hikey960/arm/proprietary/libGLES_mali.so:system/vendor/lib/hw/vulkan.hikey960.so:linaro \
vendor/linaro/hikey960/arm/proprietary/lib64/libGLES_mali.so:system/vendor/lib64/hw/vulkan.hikey960.so:linaro
Continue to build aosp as instructed.
Alternate Method 2: Modify existing android build that do not have vulkan support Make sure you have the Hikey960 connected to a host machine using adb.
$ adb root
$ adb remount
$ adb shell cp system/lib64/egl/libGLES_mali.so system/vendor/lib64/hw/vulkan.hikey960.so
$ adb shell cp system/lib/egl/libGLES_mali.so system/vendor/lib/hw/vulkan.hikey960.so
$ adb shell
$ cat system/etc/permissions/android.hardware.vulkan.level.xml
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<feature name="android.hardware.vulkan.level" version="0" />
</permissions>
#ctrl+c to save and exit
$ cat system/etc/permissions/android.hardware.vulkan.version.xml
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<feature name="android.hardware.vulkan.version" version="4194307" />
</permissions>
#ctrl+c to save and exit
$ exit
$ adb reboot
Demos
Vulkan Demos By Sascha Willems: https://github.com/SaschaWillems/Vulkan