使用软件渲染在嵌入式平台上移植 Android

Porting Android on embedded platforms with software rendering

我正在做一个需要在嵌入式平台上移植 Android-7.0 的项目。我知道移植的关键:实现特定的 HW 驱动程序和相应的 HAL。在处理mali-400 GPU时,我应该移植GPU驱动程序、OpenGL ES库和UMP(Unified memory provider),但为了简单起见,我只想使用不需要真正GPU的软件渲染。

我在 init.rc 中设置了一些属性,迫使 Android 加载 libGLES_android.so:

setprop ro.kernel.qemu 1

setprop ro.kernel.qemu.gles 0

有效!但系统未能选择合适的 EGLconfig,并重新启动 surfaceflinger。日志如下:

I/SurfaceFlinger( 1056): SurfaceFlinger is starting
I/SurfaceFlinger( 1056): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...
D/libEGL  ( 1056): Emulator without GPU support detected. Fallback to software renderer.
D/libEGL  ( 1056): loaded /system/lib64/egl/libGLES_android.so
W/gralloc ( 1056): page flipping not supported (yres_virtual=1080, requested=2160)
I/gralloc ( 1056): using (fd=11)
I/gralloc ( 1056): id           = simple
I/gralloc ( 1056): xres         = 1920 px
I/gralloc ( 1056): yres         = 1080 px
I/gralloc ( 1056): xres_virtual = 1920 px
I/gralloc ( 1056): yres_virtual = 1080 px
I/gralloc ( 1056): bpp          = 32
I/gralloc ( 1056): r            = 16:8
I/gralloc ( 1056): g            =  8:8
I/gralloc ( 1056): b            =  0:8
I/gralloc ( 1056): width        = 305 mm (159.568100 dpi)
I/gralloc ( 1056): height       = 171 mm (159.895081 dpi)
I/gralloc ( 1056): refresh rate = 60.00 Hz
W/hwcomposer( 1056): hwcomposer module not found
W/SurfaceFlinger( 1056): no suitable EGLConfig found, trying a simpler query
E/SurfaceFlinger( 1056): no suitable EGLConfig found,giving up

Hwcomposer模块好像不是必须的。我的问题是:

  1. The method to use software rendering is right?
  2. Why can't a suitable EGLConfig be found? It seems that I cannot control the procedure of choosing one.
  3. What can I do, to turn on hardware rendering based on a real GPU?

Android 不再支持纯软件渲染;真正的 GPU 和 OpenGL ES 实现是一项硬性要求。