Android Graphic UI with GPU Hardware Acceleration

Document created by Xianzhong Li Employee on Oct 12, 2012Last modified by ebiz_ws_prod on Dec 13, 2017
Version 9Show Document
  • View in full screen mode

Graphics are a big topic in the Android platform, containing java/jni graphic framework and 2d/3d graphic engines (skia, OpenGL-ES, renderscript).

This document describes the general Android graphic stack and UI features on Freescale devices.


1. Android Graphic Stacks

  • All Android 3D apps and games have the following graphic stack:


  • Android system UI and all Apps UI follow 2D graphic stack as below, the hardware render will accelerate Android 2D UI with GPU HW OpenGL-ES 2.0 to improve the whole UI performance.

New Picture.png

Hardware acceleration can be disabled on i.mx6 in device/fsl/imx6/soc/


Then rebuild frameworks/base/core/jni, and replace

  • Surfaceflinger is responsible of all surface layers composition, and  then generate the framebuffer pixmap for display devices. these graphic surface layers are from 2D/3D apps.

New Picture (1).png

  • Hwcomposer is the alternative module of Surfaceflinger with OpenGL-ES. Hwcomposer is used to combine the specific surface layers supported by specific vendor devices. Freescale i.MX6 devices use GPU 2D to combine most surface layers, and the system power can be reduced with GPU 2D instead of GPU 3D. The typical power saving case is video playback.


Hwcomposer with GPU 2D can offload GPU 3D task when running game and benchmarks, it is proved to improve the overall system performance about 20%.

New Picture (2).png

2. Performance measurment

  • Show FPS for Android system performance


For NFS boot you can set “debug.sf.showfps” to 1 in init.freescale.rc (“setprop debug.sf.showfps 1”) and then reboot the system. For SD or EMMC boot, you can issue command “setprop debug.sf.showfps 1” in console, then find system_server thread by top and kill it to reset the system.


New Picture (3).png

  • Graphic benchmarks for 3D capability measurement


Full test benchmark cover CPU, Memory, IO, 2D and 3D






  • Browser benchmarks


3.  Android UI features

  • Dual display with same content

This feature is supported in the default image in Android i.MX 6 release package. In this feature, LVDS panel and HDMI output can be supported simultaneously. It is only enabled when the HDMI TV has been connected with the board.

  • Overscan for TV devices

Some TVs may miss display the contents in overscan area. To avoid the contents in overscan area being lost, the common implement is by underscanning with an adjustable black border and letitng the viewer adjust the width of the black border. The downscan operation is done by surfaceflinger when it does surface composition through HW OpenGL ES. There is no performance impact since all the work is done by GPU HW. Overscan can be configured in display setting in visual mode:

New Picture (4).png

  • 32 bits color depth

32bpp UI can be supported by adding “bpp=32” in uboot as below:

setenv bootargs ‘… video=mxcdi1fb:RGB666,XGA,bpp=32 …’, also can configure it in display setting.


Enable 32bpp frame buffer and application surface buffer will be allocate to RGBA8888 format instead of default RGB565 format, that means more system memory is allocated.


After enabling 32bpp, if some applications still don't have better UI quality, check to see if  there is hard code to request RGB565 format surface (should request RGBA8888 format to get better quality).


Sample code is attached to test for 32bpp (left is on 16bpp, right is on 32bpp)


New Picture (5).png

  • Display Visual Setting

The display setting is the add-on feature in FSL Android release, it is very convenient for end-users to change display property, mostly for the following features:

Dual display enablement

Display color depth setting(16bpp, 32bpp)

Overscan adjustment in horizontal and vertical orientation

New Picture (6).png


4. Issue Diagnosis


  • Application Compatibility

Some Android applications may not run correctly on some Android releases. It may cause application compatibility, so check the application in other platforms.


For example Neocore and Asphalt 5 can run on Eclair, Froyo, and Gingerbread, but will not correctly run on Honeycomb.


  • GPU Compatibility


Some game UIs may not correctly display on our Android release. When encountering this kind of issue, the customer can check whether it is caused by the game using an OpenGL extension which our GPU does not support. They can download another data package (for example not extension data package) to have a check.


  • Others


Enlarge GPU memory if you encounter UI abnormally displaying after running an application for a while. Some applications need Wifi connections, so monitor the console log to see whether there are any error reports.

Original Attachment has been moved to: simple_draw_ics.tgz

Original Attachment has been moved to:

1 person found this helpful