OpenGLRenderer Configuration

本文档介绍了通过调整OpenGLRenderer配置来提高硬件性能的方法。详细列举了用于控制Android 2D硬件加速渲染管线的属性,包括纹理缓存大小、图层缓存大小等,并提供了推荐值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

OpenGLRenderer Configuration

This document describes performance tuning that you can do to get the most out of your hardware.

OpenGLRenderer (libhwui) Properties


This document lists all the properties that you can use to control Android’s 2D hardware accelerated rendering pipeline. Set these properties in the device.mk as PRODUCT_PROPERTY_OVERRIDES.

PropertyTypeDefault ValueDescription
ro.hwui.disable_scissor_optbooleanfalse

Used to enable or disable scissor optimization. The accepted values are true and false. When scissor optimization is enabled, OpenGLRenderer attempts to minimize the use of scissoring by selectively enabling and disabling the GL scissor test.

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

ro.hwui.texture_cache_sizefloat24Defines the size, in megabytes, of the per process texture cache. We recommend using a cache large enough to hold several screens worth of 32-bit textures (for instance, 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_sizefloat16Defines the size, in megabytes, of the per process layers cache. We recommend using a cache large enough to hold 4 times the screen in 32 bits. For instance, 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_size0.5floatDefines the size, in megabytes, of the per process gradients cache. A single gradient generally occupies between 1 and 4 KB of memory. It is recommended to use a cache large enough to hold at least twelve gradients.
ro.hwui.patch_cache_sizeinteger128Defines the size, in kilobytes, of the 9-patches cache, per process. This cache holds only vertex data and can therefore be kept small. Each vertex is made of 4 floats, or 16 bytes.
ro.hwui.path_cache_sizefloat4Defines the size, in megabytes, of the per process paths cache. We recommended using a cache large enough to hold at least one screen worth of 32-bit textures. For instance, 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_sizefloat1Defines the size, in megabytes, of the per process shapes caches. 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 instance, 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_sizefloat2Defines the size, in megabytes, of the per process text drop shadows cache. We recommend using a cache large enough to hold two screens worth of 8-bit textures. For instance, 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_sizefloat2Defines the size, in megabytes, of the render buffers cache per process. It is recommended to use a cache large enough to hold twice the screen in 8 bits. For instance, 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 bits or 1 bit stencil buffers.
ro.hwui.texture_cache_flush_ratefloat0.6Defines the percentage of the texture cache to keep after a memory flush. Memory flushes are triggered when the system needs to reclaim memory across all applications. We recommend releasing about 50% of the cache in such situations.
ro.hwui.text_small_cache_widthinteger1024Defines 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. You should also use a power of two value.
ro.hwui.text_small_cache_heightinteger256Defines 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_widthinteger2048Defines 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 recommended using at least 2048 pixels but at most 4096 pixels. You should also use a power of two value.
ro.hwui.text_large_cache_heightinteger512Defines 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. You should also use a power of two value.
ro.zygote.disable_gl_preloadbooleanfalseUsed to enable/disable preloading of EGL/GL drivers in Zygote at boot time. When this property is set to false, Zygote will preload the GL drivers by invoking eglGetDisplay(EGL_DEFAULT_DISPLAY). The goal is to load the dynamic libraries code in Zygote to share it with all the other processes. If a driver does not support being shared, set this property to true.
hwui.text_gamma_correctionstringlookupSelects the text gamma correction technique. There are four possible choices:
  • lookup3: A correction based on lookup tables. Gamma correction is different for black and white text (see thresholds below).
  • lookup: A correction based on a single lookup table.
  • shader3: A correction applied by a GLSL shader. Gamma correction is different for black and white text (see thresholds below).
  • shader: A correction applied by a GLSL shader.
Lookup gamma corrections function best on GPUs with limited shader math. Shader gamma corrections are best to save memory. We recommend using the default lookup technique, which offers a good compromise in terms of quality, speed, and memory usage.
hwui.text_gammafloat1.4Defines the gamma value used for text gamma correction. This value can be adjusted based on the display that is used by the device.
hwui.text_gamma.black_thresholdinteger64Defines the luminance threshold below which black gamma correction is applied. The value must be defined in the range 0..255.
hwui.text_gamma.white_thresholdinteger192Defines the luminance threshold above which white gamma correction is applied. The value must be defined in the range 0..255.
hwui.use_gpu_pixel_buffersbooleantrueUsed to enable or disable the use of PBOs on OpenGL ES 3.0 hardware. PBOs are used by the renderer to perform asynchronous texture uploads, especially for the font cache. This property should always remain enabled but can be disabled during bringup or development if the use of PBOs causes corruptions or terrible performance. This is why the property is not read-only.
Process pipe failed 2025-06-05 21:00:33.745 22340-22371 ConfigStore com.example.diaryapp I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 2025-06-05 21:00:33.745 22340-22371 ConfigStore com.example.diaryapp I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 2025-06-05 21:00:33.745 22340-22371 OpenGLRenderer com.example.diaryapp I Initialized EGL, version 1.4 2025-06-05 21:00:33.745 22340-22371 OpenGLRenderer com.example.diaryapp D Swap behavior 1 2025-06-05 21:00:33.746 22340-22371 EGL_adreno com.example.diaryapp E CreateContext rcMajorVersion:3, minorVersion:2 2025-06-05 21:00:33.754 22340-22371 EGL_adreno com.example.diaryapp D eglCreateContext: 0x7f2e2da30120: maj 3 min 2 rcv 3 2025-06-05 21:00:33.754 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:33.754 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:33.781 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:33.781 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:33.782 22340-22371 vndksupport com.example.diaryapp D Loading /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace. 2025-06-05 21:00:33.782 22340-22371 vndksupport com.example.diaryapp D Loading /vendor/lib64/hw/gralloc.gmin.so from current namespace instead of sphal namespace. 2025-06-05 21:00:33.786 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:33.786 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2da27e00, error=EGL_BAD_MATCH 2025-06-05 21:00:34.214 22340-22340 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (light greylist, reflection) 2025-06-05 21:00:34.214 22340-22340 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (light greylist, reflection) 2025-06-05 21:00:34.214 22340-22340 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection) 2025-06-05 21:00:39.439 22340-22401 ProfileInstaller com.example.diaryapp D Installing profile for com.example.diaryapp 2025-06-05 21:00:40.016 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:40.016 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:40.023 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:40.023 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db3cb80, error=EGL_BAD_MATCH 2025-06-05 21:00:40.026 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@b266666 2025-06-05 21:00:40.267 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:40.267 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:40.283 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:40.283 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db3cc80, error=EGL_BAD_MATCH 2025-06-05 21:00:40.292 22340-22340 Glide com.example.diaryapp W Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored 2025-06-05 21:00:42.727 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@7575cb3 2025-06-05 21:00:42.763 22340-22345 xample.diaryap com.example.diaryapp I Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int) 2025-06-05 21:00:42.780 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:42.780 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:42.794 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:42.794 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2dbdb280, error=EGL_BAD_MATCH 2025-06-05 21:00:50.659 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:50.659 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:50.673 22340-22340 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/view/View;->mAccessibilityDelegate:Landroid/view/View$AccessibilityDelegate; (light greylist, reflection) 2025-06-05 21:00:50.675 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:50.675 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2dbdb300, error=EGL_BAD_MATCH 2025-06-05 21:00:52.086 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@d5d171c 2025-06-05 21:00:52.186 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:52.186 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:52.204 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:52.204 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d0afd00, error=EGL_BAD_MATCH 2025-06-05 21:00:53.766 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:53.766 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:53.776 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:53.776 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d337180, error=EGL_BAD_MATCH 2025-06-05 21:00:58.199 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:00:58.199 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:00:58.220 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:00:58.220 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2dbdb300, error=EGL_BAD_MATCH 2025-06-05 21:01:01.788 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@bf7a046 2025-06-05 21:01:01.863 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:01.863 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:01.880 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:01.880 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d222f00, error=EGL_BAD_MATCH 2025-06-05 21:01:04.247 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:04.247 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:04.268 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:04.268 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2dbdb300, error=EGL_BAD_MATCH 2025-06-05 21:01:06.508 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@58e8cd8 2025-06-05 21:01:06.613 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:06.613 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:06.633 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:06.633 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d222f00, error=EGL_BAD_MATCH 2025-06-05 21:01:07.985 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:07.985 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:07.993 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:07.993 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db3c000, error=EGL_BAD_MATCH 2025-06-05 21:01:07.996 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@d24a3e0 2025-06-05 21:01:08.020 22340-22349 System com.example.diaryapp W A resource failed to call close. 2025-06-05 21:01:08.021 22340-22349 chatty com.example.diaryapp I uid=10062(com.example.diaryapp) FinalizerDaemon identical 2 lines 2025-06-05 21:01:08.021 22340-22349 System com.example.diaryapp W A resource failed to call close. 2025-06-05 21:01:08.038 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:08.038 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:08.057 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:08.057 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2c09d580, error=EGL_BAD_MATCH 2025-06-05 21:01:09.873 22340-22340 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@4e83cf6 2025-06-05 21:01:09.914 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:09.914 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:09.934 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:09.934 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d9c8580, error=EGL_BAD_MATCH 2025-06-05 21:01:11.614 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:11.614 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:11.629 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:11.629 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d95f280, error=EGL_BAD_MATCH 2025-06-05 21:01:13.193 22340-22371 OpenGLRenderer com.example.diaryapp D endAllActiveAnimators on 0x7f2e1d16d900 (RippleDrawable) with handle 0x7f2e2db44560 2025-06-05 21:01:13.213 22340-22371 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 21:01:13.213 22340-22371 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 21:01:13.231 22340-22371 EGL_adreno com.example.diaryapp E tid 22371: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 21:01:13.231 22340-22371 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db3c680, error=EGL_BAD_MATCH
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值