Home | History | Annotate | Download | only in devices
      1 page.title=Performance tuning
      2 @jd:body
      3 
      4 <!--
      5     Copyright 2010 The Android Open Source Project
      6 
      7     Licensed under the Apache License, Version 2.0 (the "License");
      8     you may not use this file except in compliance with the License.
      9     You may obtain a copy of the License at
     10 
     11         http://www.apache.org/licenses/LICENSE-2.0
     12 
     13     Unless required by applicable law or agreed to in writing, software
     14     distributed under the License is distributed on an "AS IS" BASIS,
     15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16     See the License for the specific language governing permissions and
     17     limitations under the License.
     18 -->
     19 <p>This document describes performance tuning that you can do to get the most out of your
     20   hardware.</p>
     21 
     22 <h2>OpenGLRenderer (libhwui) Properties</h2>
     23 <p>This document lists all the properties that you can use to control
     24 Androids 2D hardware accelerated rendering pipeline. Set these properties
     25 in the <code>device.mk</code> as <code>PRODUCT_PROPERTY_OVERRIDES</code>.
     26 </p>
     27 
     28 <table>
     29 <tr>
     30   <th>Property</th>
     31   <th>Type</th>
     32   <th>Default Value</th>
     33   <th>Description</th>
     34 </tr>
     35 
     36 <tr>
     37   <td><code>ro.hwui.disable_scissor_opt</code></td>
     38   <td><code>boolean</code></td>
     39   <td><code>false</code></td>
     40   <td><p>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.</p>
     41   <p>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.</p>
     42   </td>
     43 </tr>
     44 
     45 <tr>
     46 
     47   <td><code>ro.hwui.texture_cache_size</code></td>
     48   <td><code>float</code></td>
     49   <td><code>24</code></td>
     50   <td>Defines the size, in megabytes, of the per process texture cache. We
     51   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.)</td>
     52 </tr>
     53 
     54 <tr>
     55   <td><code>ro.hwui.layer_cache_size</code></td>
     56   <td><code>float</code></td>
     57   <td><code>16</code></td>
     58   <td>Defines the size, in megabytes, of the per process layers cache. We recommend
     59   using a cache large enough to hold 4 times the screen in 32 bits. For instance,
     60   on a 1280x800 display, a full screen buffer uses about 4 MB, so the cache should be at least 16 MB.</td>
     61 </tr>
     62 <tr>
     63   <td><code>ro.hwui.gradient_cache_size</code></td>
     64   <td><code>0.5</code></td>
     65   <td><code>float</code></td>
     66   <td>Defines the size, in megabytes, of the per process gradients cache. A single
     67   gradient generally occupies between 1 and 4 KB of memory. It is recommended to use a
     68   cache large enough to hold at least twelve gradients.</td>
     69 </tr>
     70 
     71 <tr>
     72   <td><code>ro.hwui.path_cache_size</code></td>
     73   <td><code>float</code></td>
     74   <td><code>4</code></td>
     75   <td>Defines the size, in megabytes, of the per process paths cache. We recommended using a
     76   cache large enough to hold at least one screen worth of 32-bit textures. For instance,
     77   on a 1280x800 display, a full screen buffer uses about 4 MB, so the cache should be at least 4 MB.</td>
     78 </tr>
     79 <tr>
     80   <td><code>ro.hwui.shape_cache_size</code></td>
     81   <td><code>float</code></td>
     82   <td><code>1</code></td>
     83   <td>Defines the size, in megabytes, of the per process shapes caches. This value is used by
     84   several caches such as circles and rounded rectangles. We recommend using a cache
     85   large enough to hold at least one 8-bit screen. For instance, on a 1280x800 display,
     86   a full screen buffer uses about 1 MB, so the cache should be at least 1 MB.</td>
     87 </tr>
     88 <tr>
     89   <td><code>ro.hwui.drop_shadow_cache_size</code></td>
     90   <td><code>float</code></td>
     91   <td><code>2</code></td>
     92   <td>Defines the size, in megabytes, of the per process text drop shadows cache. We recommend
     93   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.</td>
     94 </tr>
     95 <tr>
     96   <td><code>ro.hwui.fbo_cache_size</code></td>
     97   <td><code>integer</code></td>
     98   <td><code>16</code></td>
     99   <td>Defines the number of FBO names the renderer can hold in the cache at any given time.
    100   We recommend keeping this number low.</td>
    101 </tr>
    102 <tr>
    103   <td><code>ro.hwui.r_buffer_cache_size</code></td>
    104   <td><code>float</code></td>
    105   <td><code>2</code></td>
    106   <td>Defines 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.</td>
    107 </tr>
    108 <tr>
    109   <td><code>ro.hwui.texture_cache_flush_rate</code></td>
    110   <td><code>float</code></td>
    111   <td><code>0.6</code></td>
    112   <td>Defines 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.</td>
    113 </tr>
    114 <tr>
    115   <td><code>ro.hwui.text_small_cache_width</code></td>
    116   <td><code>integer</code></td>
    117   <td><code>1024</code></td>
    118   <td>Defines the width in pixels of the default font cache. The upper bound depends on how fast the GPU can upload textures.
    119   We recommend using at least 1024 pixels but at most 2048 pixels. You should also use a power of two value.</td>
    120 </tr>
    121 <tr>
    122   <td><code>ro.hwui.text_small_cache_height</code></td>
    123   <td><code>integer</code></td>
    124   <td><code>256</code></td>
    125   <td>Defines the height in pixels of the default font cache. The upper bound depends on how fast the GPU can upload textures.
    126   We recommend using at least 256 pixels but at most 1024 pixels. </td>
    127 </tr>
    128 <tr>
    129   <td><code>ro.hwui.text_large_cache_width</code></td>
    130   <td><code>integer</code></td>
    131   <td><code>2048</code></td>
    132   <td>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 recommended using at least 2048 pixels but at most 4096 pixels. You should also use a power of two value.</td>
    133 </tr>
    134 
    135 <tr>
    136   <td><code>ro.hwui.text_large_cache_height</code></td>
    137   <td><code>integer</code></td>
    138   <td><code>512</code></td>
    139   <td>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. 
    140   We recommend using at least 512 pixels but at most 2048 pixels. You should also use a power of two value.</td>
    141 </tr>
    142 
    143 <tr>
    144   <td><code>hwui.text_gamma_correction</code></td>
    145   <td><code>string</code></td>
    146   <td><code>lookup</code></td>
    147   <td>Selects the text gamma correction technique. There are four possible choices:
    148   <ul>
    149    <li><code>lookup3</code>: A correction based on lookup tables. Gamma correction is different for black
    150   and white text (see thresholds below).</li>
    151 
    152    <li><code>lookup</code>: A correction based on a single lookup table.</li>
    153 
    154     <li><code>shader3</code>: A correction applied by a GLSL shader. Gamma correction is different
    155     for black and white text (see thresholds below).</li>
    156 
    157     <li><code>shader</code>: A correction applied by a GLSL shader.</li>
    158   </ul>
    159   Lookup gamma corrections function best on GPUs with limited shader math. Shader gamma corrections are best to save memory. We recommend using the default <code>lookup</code> technique, which offers a good compromise in terms of quality, speed, and memory usage.
    160 </td>
    161 </tr>
    162 
    163 <tr>
    164   <td><code>hwui.text_gamma</code></td>
    165   <td><code>float</code></td>
    166   <td><code>1.4</code></td>
    167   <td>Defines the gamma value used for text gamma correction.
    168   This value can be adjusted based on the display that is used by the device.</td>
    169 </tr>
    170 <tr>
    171   <td><code>hwui.text_gamma.black_threshold</code></td>
    172   <td><code>integer</code></td>
    173   <td><code>64</code></td>
    174   <td>Defines the luminance threshold below which black gamma correction is applied.
    175   The value must be defined in the range 0..255.</td>
    176 </tr>
    177 <tr>
    178   <td><code>hwui.text_gamma.white_threshold</code></td>
    179   <td><code>integer</code></td>
    180   <td><code>192</code></td>
    181   <td>Defines the luminance threshold above which white gamma correction is applied.
    182   The value must be defined in the range 0..255.</td>
    183 </tr>
    184 <tr>
    185   <td><code>hwui.use_gpu_pixel_buffers</code></td>
    186   <td><code>boolean</code></td>
    187   <td><code>true</code></td>
    188   <td>Used 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.</td>
    189 </tr>
    190 </table>
    191