OpenGLRenderer configuration

This document describes performance tuning to optimize hardware performance.

OpenGLRenderer (libhwui) properties

This document describes properties for controlling Android's 2D hardware-accelerated rendering pipeline. Set these properties in the device.mk as PRODUCT_PROPERTY_OVERRIDES.

Properties for all Android versions

Property Type Default Value Description
ro.zygote.disable_gl_preload boolean false Enables or disables preloading of EGL/GL drivers in Zygote at boot time. When this property is false, Zygote preloads the GL drivers by invoking eglGetDisplay(EGL_DEFAULT_DISPLAY). This loads the dynamic library code in Zygote to share it with all other processes. If a driver does not support sharing, set this property to true.

Properties for Android 8.0 and lower

Property Type Default Value Description
ro.hwui.disable_scissor_opt boolean false

Enables or disables scissor optimization. Accepted values are true and false. When scissor optimization is enabled, OpenGLRenderer attempts to minimize scissoring by selectively enabling and disabling the GL scissor test.

When disabled, OpenGLRenderer keeps the GL scissor test enabled and changes the scissor rect as needed. Some GPUs (for example, the SGX 540) perform better when changing the scissor rect more often than enabling or disabling the scissor test frequently.

ro.hwui.texture_cache_size float 24 Defines the size, in megabytes, of the per-process texture cache. We recommend using a cache large enough to hold several screens of 32-bit textures. For example, on a 1280x800 display, a full screen buffer uses about 4 MB, so the cache should be at least 20 MB.
ro.hwui.layer_cache_size float 16 Defines the size, in megabytes, of the per-process layers cache. We recommend using a cache large enough to hold four times the screen in 32 bits. For example, on a 1280x800 display, a full screen buffer uses about 4 MB, so the cache should be at least 16 MB.
ro.hwui.gradient_cache_size float 0.5 Defines the size, in megabytes, of the per-process gradients cache. A single gradient generally occupies between 1 KB and 4 KB of memory. We recommend using a cache large enough to hold at least 12 gradients.
ro.hwui.patch_cache_size integer 128 Defines the size, in kilobytes, of the 9-patches cache per process. This cache holds only vertex data, so you can keep it small. Each vertex consists of 4 floats, or 16 bytes.
ro.hwui.path_cache_size float 4 Defines the size, in megabytes, of the per-process paths cache. We recommend using a cache large enough to hold at least one screen of 32-bit textures. For example, on a 1280x800 display, a full screen buffer uses about 4 MB, so the cache should be at least 4 MB.
ro.hwui.shape_cache_size float 1 Defines the size, in megabytes, of the per-process shapes cache. This value is used by several caches, such as circles and rounded rectangles. We recommend using a cache large enough to hold at least one 8-bit screen. For example, on a 1280x800 display, a full screen buffer uses about 1 MB, so the cache should be at least 1 MB.
ro.hwui.drop_shadow_cache_size float 2 Defines the size, in megabytes, of the per-process text drop shadows cache. We recommend using a cache large enough to hold two screens of 8-bit textures. For example, on a 1280x800 display, a full screen buffer uses about 1 MB, so the cache should be at least 2 MB.
ro.hwui.r_buffer_cache_size float 2 Defines the size, in megabytes, of the per-process render buffers cache. We recommend using a cache large enough to hold twice the screen in 8 bits. For example, on a 1280x800 display, a full screen buffer uses about 1 MB, so the cache should be at least 2 MB. The cache can be smaller if the device supports 4-bit or 1-bit stencil buffers.
ro.hwui.texture_cache_flush_rate float 0.6 Defines the percentage of the texture cache to retain after a memory flush. The system triggers memory flushes when it needs to reclaim memory across all applications. We recommend releasing about 50% of the cache in such situations.
ro.hwui.text_small_cache_width integer 1024 Defines the width, in pixels, of the default font cache. The upper bound depends on how fast the GPU can upload textures. We recommend using at least 1024 pixels but at most 2048 pixels. Also, use a power-of-two value.
ro.hwui.text_small_cache_height integer 256 Defines the height, in pixels, of the default font cache. The upper bound depends on how fast the GPU can upload textures. We recommend using at least 256 pixels but at most 1024 pixels.
ro.hwui.text_large_cache_width integer 2048 Defines the width, in pixels, of the large font cache. This cache is used for glyphs too large to fit in the default font cache. The upper bound depends on how fast the GPU can upload textures. We recommend using at least 2048 pixels but at most 4096 pixels. Also, use a power-of-two value.
ro.hwui.text_large_cache_height integer 512 Defines the height, in pixels, of the large font cache. The large font cache is used for glyphs too large to fit in the default font cache. The upper bound depends on how fast the GPU can upload textures. We recommend using at least 512 pixels but at most 2048 pixels. Also, use a power-of-two value.
hwui.text_gamma_correction string lookup Selects the text gamma correction technique. There are four possible choices:
  • lookup3: A correction based on lookup tables. Gamma correction differs for black and white text (see thresholds as follows).
  • lookup: A correction based on a single lookup table.
  • shader3: A correction applied by a GLSL shader. Gamma correction differs for black and white text (see thresholds as follows).
  • shader: A correction applied by a GLSL shader.
Lookup gamma corrections function best on GPUs with limited shader math. Shader gamma corrections are best for saving memory. We recommend using the default lookup technique, which offers a good compromise in terms of quality, speed, and memory usage.
hwui.text_gamma float 1.4 Defines the gamma value used for text gamma correction. You can adjust this value based on the device's display.
hwui.text_gamma.black_threshold integer 64 Defines the luminance threshold below which black gamma correction is applied. The value must be in the range 0-255.
hwui.text_gamma.white_threshold integer 192 Defines the luminance threshold above which white gamma correction is applied. The value must be in the range 0-255.
hwui.use_gpu_pixel_buffers boolean true Enables or disables the use of PBOs on OpenGL ES 3.0 hardware. The renderer uses PBOs to perform asynchronous texture uploads, especially for the font cache. This property should always remain enabled, but you can disable it during bringup or development if PBOs cause corruptions or poor performance. This is why the property is not read-only.