2010-07-23 00:28:00 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2010-10-27 18:57:51 -07:00
|
|
|
#ifndef ANDROID_HWUI_PROPERTIES_H
|
|
|
|
#define ANDROID_HWUI_PROPERTIES_H
|
2010-07-23 00:28:00 -07:00
|
|
|
|
2010-08-23 21:05:08 -07:00
|
|
|
#include <cutils/properties.h>
|
|
|
|
|
2010-07-23 00:28:00 -07:00
|
|
|
/**
|
2016-07-06 16:10:09 -07:00
|
|
|
* This file contains the list of system properties used to configure libhwui.
|
2010-07-23 00:28:00 -07:00
|
|
|
*/
|
|
|
|
|
2015-05-04 14:36:49 -07:00
|
|
|
namespace android {
|
|
|
|
namespace uirenderer {
|
|
|
|
|
2013-04-08 19:40:31 -07:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Compile-time properties
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-08-22 14:01:34 -07:00
|
|
|
// Textures used by layers must have dimensions multiples of this number
|
|
|
|
#define LAYER_SIZE 64
|
|
|
|
|
2013-02-12 16:08:55 -08:00
|
|
|
// Defines the size in bits of the stencil buffer for the framebuffer
|
2012-02-02 17:31:16 -08:00
|
|
|
// Note: Only 1 bit is required for clipping but more bits are required
|
2013-02-12 16:08:55 -08:00
|
|
|
// to properly implement overdraw debugging
|
2012-09-21 19:15:00 -07:00
|
|
|
#define STENCIL_BUFFER_SIZE 8
|
2012-01-25 18:56:29 -08:00
|
|
|
|
2013-04-08 19:40:31 -07:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Debug properties
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-11-10 19:01:29 -08:00
|
|
|
/**
|
2012-08-06 14:51:10 -07:00
|
|
|
* Debug level for app developers. The value is a numeric value defined
|
|
|
|
* by the DebugLevel enum below.
|
2010-11-10 19:01:29 -08:00
|
|
|
*/
|
2012-08-06 14:51:10 -07:00
|
|
|
#define PROPERTY_DEBUG "debug.hwui.level"
|
2010-11-10 19:01:29 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Debug levels. Debug levels are used as flags.
|
|
|
|
*/
|
|
|
|
enum DebugLevel {
|
|
|
|
kDebugDisabled = 0,
|
|
|
|
kDebugMemory = 1,
|
2010-12-10 12:33:05 -08:00
|
|
|
kDebugCaches = 2,
|
2011-07-13 09:49:43 -07:00
|
|
|
kDebugMoreCaches = kDebugMemory | kDebugCaches
|
2010-11-10 19:01:29 -08:00
|
|
|
};
|
|
|
|
|
2012-08-06 14:51:10 -07:00
|
|
|
/**
|
2012-09-21 19:15:00 -07:00
|
|
|
* Used to enable/disable layers update debugging. The accepted values are
|
2012-08-06 14:51:10 -07:00
|
|
|
* "true" and "false". The default value is "false".
|
|
|
|
*/
|
|
|
|
#define PROPERTY_DEBUG_LAYERS_UPDATES "debug.hwui.show_layers_updates"
|
|
|
|
|
2012-09-21 19:15:00 -07:00
|
|
|
/**
|
2013-08-21 11:53:18 -07:00
|
|
|
* Used to enable/disable overdraw debugging.
|
|
|
|
*
|
|
|
|
* The accepted values are
|
|
|
|
* "show", to show overdraw
|
|
|
|
* "show_deuteranomaly", to show overdraw if you suffer from Deuteranomaly
|
|
|
|
* "count", to show an overdraw counter
|
|
|
|
* "false", to disable overdraw debugging
|
|
|
|
*
|
|
|
|
* The default value is "false".
|
2012-09-21 19:15:00 -07:00
|
|
|
*/
|
2013-05-03 14:24:16 -07:00
|
|
|
#define PROPERTY_DEBUG_OVERDRAW "debug.hwui.overdraw"
|
2012-09-21 19:15:00 -07:00
|
|
|
|
2014-05-23 17:42:28 -07:00
|
|
|
/**
|
|
|
|
* System property used to enable or disable hardware rendering profiling.
|
|
|
|
* The default value of this property is assumed to be false.
|
|
|
|
*
|
|
|
|
* When profiling is enabled, the adb shell dumpsys gfxinfo command will
|
|
|
|
* output extra information about the time taken to execute by the last
|
|
|
|
* frames.
|
|
|
|
*
|
|
|
|
* Possible values:
|
|
|
|
* "true", to enable profiling
|
|
|
|
* "visual_bars", to enable profiling and visualize the results on screen
|
|
|
|
* "false", to disable profiling
|
|
|
|
*/
|
|
|
|
#define PROPERTY_PROFILE "debug.hwui.profile"
|
|
|
|
#define PROPERTY_PROFILE_VISUALIZE_BARS "visual_bars"
|
|
|
|
|
2013-02-25 14:15:37 -08:00
|
|
|
/**
|
|
|
|
* Used to enable/disable non-rectangular clipping debugging.
|
|
|
|
*
|
|
|
|
* The accepted values are:
|
|
|
|
* "highlight", drawing commands clipped by the stencil will
|
|
|
|
* be colored differently
|
|
|
|
* "region", renders the clipping region on screen whenever
|
|
|
|
* the stencil is set
|
|
|
|
* "hide", don't show the clip
|
|
|
|
*
|
|
|
|
* The default value is "hide".
|
|
|
|
*/
|
2013-02-25 16:21:30 -08:00
|
|
|
#define PROPERTY_DEBUG_STENCIL_CLIP "debug.hwui.show_non_rect_clip"
|
2013-02-25 14:15:37 -08:00
|
|
|
|
2014-10-27 12:38:48 -07:00
|
|
|
/**
|
|
|
|
* Turn on to draw dirty regions every other frame.
|
|
|
|
*
|
|
|
|
* Possible values:
|
|
|
|
* "true", to enable dirty regions debugging
|
|
|
|
* "false", to disable dirty regions debugging
|
|
|
|
*/
|
|
|
|
#define PROPERTY_DEBUG_SHOW_DIRTY_REGIONS "debug.hwui.show_dirty_regions"
|
|
|
|
|
2013-04-08 19:40:31 -07:00
|
|
|
/**
|
|
|
|
* Disables draw operation deferral if set to "true", forcing draw
|
|
|
|
* commands to be issued to OpenGL in order, and processed in sequence
|
|
|
|
* with state-manipulation canvas commands.
|
|
|
|
*/
|
|
|
|
#define PROPERTY_DISABLE_DRAW_DEFER "debug.hwui.disable_draw_defer"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to disable draw operation reordering when deferring draw operations
|
|
|
|
* Has no effect if PROPERTY_DISABLE_DRAW_DEFER is set to "true"
|
|
|
|
*/
|
|
|
|
#define PROPERTY_DISABLE_DRAW_REORDER "debug.hwui.disable_draw_reorder"
|
|
|
|
|
2015-05-08 10:04:36 -07:00
|
|
|
/**
|
|
|
|
* Setting this property will enable or disable the dropping of frames with
|
|
|
|
* empty damage. Default is "true".
|
|
|
|
*/
|
|
|
|
#define PROPERTY_SKIP_EMPTY_DAMAGE "debug.hwui.skip_empty_damage"
|
|
|
|
|
2015-08-10 09:52:29 -07:00
|
|
|
/**
|
|
|
|
* Controls whether or not HWUI will use the EGL_EXT_buffer_age extension
|
|
|
|
* to do partial invalidates. Setting this to "false" will fall back to
|
|
|
|
* using BUFFER_PRESERVED instead
|
|
|
|
* Default is "true"
|
|
|
|
*/
|
|
|
|
#define PROPERTY_USE_BUFFER_AGE "debug.hwui.use_buffer_age"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting this to "false" will force HWUI to always do full-redraws of the surface.
|
|
|
|
* This will disable the use of EGL_EXT_buffer_age and BUFFER_PRESERVED.
|
|
|
|
* Default is "true"
|
|
|
|
*/
|
2016-09-26 15:57:38 -04:00
|
|
|
#define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.use_partial_updates"
|
2015-08-10 09:52:29 -07:00
|
|
|
|
2016-03-28 10:38:19 -07:00
|
|
|
#define PROPERTY_FILTER_TEST_OVERHEAD "debug.hwui.filter_test_overhead"
|
|
|
|
|
2016-07-07 12:35:54 -04:00
|
|
|
/**
|
|
|
|
* Allows to set rendering pipeline mode to OpenGL (default), Skia OpenGL
|
|
|
|
* or Vulkan.
|
|
|
|
*/
|
2017-02-14 11:38:06 -05:00
|
|
|
#define PROPERTY_RENDERER "debug.hwui.renderer"
|
2016-07-07 12:35:54 -04:00
|
|
|
|
2013-04-08 19:40:31 -07:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Runtime configuration properties
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-09-24 11:37:12 -07:00
|
|
|
/**
|
|
|
|
* Used to enable/disable scissor optimization. The accepted values are
|
|
|
|
* "true" and "false". The default value is "false".
|
|
|
|
*
|
2016-07-06 16:10:09 -07:00
|
|
|
* When scissor optimization is enabled, libhwui will attempt to
|
2012-09-24 11:37:12 -07:00
|
|
|
* minimize the use of scissor by selectively enabling and disabling the
|
|
|
|
* GL scissor test.
|
|
|
|
* When the optimization is disabled, OpenGLRenderer will keep the GL
|
|
|
|
* scissor test enabled and change the scissor rect as needed.
|
|
|
|
* Some GPUs (for instance the SGX 540) perform better when changing
|
|
|
|
* the scissor rect often than when enabling/disabling the scissor test
|
|
|
|
* often.
|
|
|
|
*/
|
|
|
|
#define PROPERTY_DISABLE_SCISSOR_OPTIMIZATION "ro.hwui.disable_scissor_opt"
|
|
|
|
|
2013-02-04 16:16:33 -08:00
|
|
|
/**
|
2013-04-08 19:40:31 -07:00
|
|
|
* Indicates whether PBOs can be used to back pixel buffers.
|
2013-05-09 11:50:12 -07:00
|
|
|
* Accepted values are "true" and "false". Default is true.
|
2013-02-04 16:16:33 -08:00
|
|
|
*/
|
2013-05-09 11:50:12 -07:00
|
|
|
#define PROPERTY_ENABLE_GPU_PIXEL_BUFFERS "ro.hwui.use_gpu_pixel_buffers"
|
2013-02-04 16:16:33 -08:00
|
|
|
|
2010-07-23 00:28:00 -07:00
|
|
|
// These properties are defined in mega-bytes
|
|
|
|
#define PROPERTY_TEXTURE_CACHE_SIZE "ro.hwui.texture_cache_size"
|
|
|
|
#define PROPERTY_LAYER_CACHE_SIZE "ro.hwui.layer_cache_size"
|
2013-02-12 16:08:55 -08:00
|
|
|
#define PROPERTY_RENDER_BUFFER_CACHE_SIZE "ro.hwui.r_buffer_cache_size"
|
2010-07-23 00:28:00 -07:00
|
|
|
#define PROPERTY_GRADIENT_CACHE_SIZE "ro.hwui.gradient_cache_size"
|
2010-08-04 15:40:07 -07:00
|
|
|
#define PROPERTY_PATH_CACHE_SIZE "ro.hwui.path_cache_size"
|
2014-06-02 16:27:04 -07:00
|
|
|
#define PROPERTY_VERTEX_CACHE_SIZE "ro.hwui.vertex_cache_size"
|
Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-04-17 18:54:38 -07:00
|
|
|
#define PROPERTY_PATCH_CACHE_SIZE "ro.hwui.patch_cache_size"
|
2010-08-13 19:39:53 -07:00
|
|
|
#define PROPERTY_DROP_SHADOW_CACHE_SIZE "ro.hwui.drop_shadow_cache_size"
|
2010-09-24 18:39:22 -07:00
|
|
|
#define PROPERTY_FBO_CACHE_SIZE "ro.hwui.fbo_cache_size"
|
2010-07-23 00:28:00 -07:00
|
|
|
|
2011-11-04 15:12:29 -07:00
|
|
|
// These properties are defined in percentage (range 0..1)
|
2013-03-19 11:32:41 -07:00
|
|
|
#define PROPERTY_TEXTURE_CACHE_FLUSH_RATE "ro.hwui.texture_cache_flushrate"
|
2011-11-04 15:12:29 -07:00
|
|
|
|
2010-07-23 00:28:00 -07:00
|
|
|
// These properties are defined in pixels
|
2012-08-31 13:54:03 -07:00
|
|
|
#define PROPERTY_TEXT_SMALL_CACHE_WIDTH "ro.hwui.text_small_cache_width"
|
|
|
|
#define PROPERTY_TEXT_SMALL_CACHE_HEIGHT "ro.hwui.text_small_cache_height"
|
|
|
|
#define PROPERTY_TEXT_LARGE_CACHE_WIDTH "ro.hwui.text_large_cache_width"
|
|
|
|
#define PROPERTY_TEXT_LARGE_CACHE_HEIGHT "ro.hwui.text_large_cache_height"
|
2010-07-23 00:28:00 -07:00
|
|
|
|
Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
feature is still a work in progress
Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.
The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:
- Using hardware conversions when sampling from OpenGL textures
or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
colors to and from sRGB
- Using Skia's color spaces
Any type of processing on colors must roughly ollow these steps:
[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]
For the sRGB color space, the conversion functions are defined as
follows:
OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055
EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)
The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:
- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)
The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().
Here is a fairly exhaustive list of modifications implemented
in this CL:
- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
to disable linear blending. This is only for GLES 2.0 GPUs
with no hardware sRGB support. This flag is currently assumed
to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
of the source pixel. The asumption is that a bright pixel will be
blended on a dark background and the other way around. The source
alpha is gamma corrected to thicken dark on bright and thin
bright on dark to match the intended design of fonts. This also
matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
could not be sampled in sRGB without a yet-to-be-defined GL
extension
- The last column of color matrices is converted to linear space
because its value are added to linear colors
Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures
Test: Manual testing while work in progress
Bug: 29940137
Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-09-28 17:34:42 -07:00
|
|
|
// Gamma (>= 1.0, <= 3.0)
|
2012-07-18 15:50:29 -07:00
|
|
|
#define PROPERTY_TEXT_GAMMA "hwui.text_gamma"
|
2010-08-26 20:35:23 -07:00
|
|
|
|
2013-04-08 19:40:31 -07:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Default property values
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2010-08-23 21:05:08 -07:00
|
|
|
|
2011-02-02 20:28:09 -08:00
|
|
|
#define DEFAULT_TEXTURE_CACHE_SIZE 24.0f
|
2011-07-27 18:51:50 -07:00
|
|
|
#define DEFAULT_LAYER_CACHE_SIZE 16.0f
|
2013-02-12 16:08:55 -08:00
|
|
|
#define DEFAULT_RENDER_BUFFER_CACHE_SIZE 2.0f
|
2015-05-11 19:18:11 -07:00
|
|
|
#define DEFAULT_PATH_CACHE_SIZE 4.0f
|
2014-06-02 16:27:04 -07:00
|
|
|
#define DEFAULT_VERTEX_CACHE_SIZE 1.0f
|
2015-09-22 11:50:13 -07:00
|
|
|
#define DEFAULT_PATCH_CACHE_SIZE 128.0f // in kB
|
2010-08-23 21:05:08 -07:00
|
|
|
#define DEFAULT_GRADIENT_CACHE_SIZE 0.5f
|
|
|
|
#define DEFAULT_DROP_SHADOW_CACHE_SIZE 2.0f
|
2014-09-17 14:09:26 -07:00
|
|
|
#define DEFAULT_FBO_CACHE_SIZE 0
|
2010-08-23 21:05:08 -07:00
|
|
|
|
2011-11-04 15:12:29 -07:00
|
|
|
#define DEFAULT_TEXTURE_CACHE_FLUSH_RATE 0.6f
|
|
|
|
|
Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
feature is still a work in progress
Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.
The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:
- Using hardware conversions when sampling from OpenGL textures
or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
colors to and from sRGB
- Using Skia's color spaces
Any type of processing on colors must roughly ollow these steps:
[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]
For the sRGB color space, the conversion functions are defined as
follows:
OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055
EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)
The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:
- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)
The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().
Here is a fairly exhaustive list of modifications implemented
in this CL:
- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
to disable linear blending. This is only for GLES 2.0 GPUs
with no hardware sRGB support. This flag is currently assumed
to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
of the source pixel. The asumption is that a bright pixel will be
blended on a dark background and the other way around. The source
alpha is gamma corrected to thicken dark on bright and thin
bright on dark to match the intended design of fonts. This also
matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
could not be sampled in sRGB without a yet-to-be-defined GL
extension
- The last column of color matrices is converted to linear space
because its value are added to linear colors
Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures
Test: Manual testing while work in progress
Bug: 29940137
Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-09-28 17:34:42 -07:00
|
|
|
#define DEFAULT_TEXT_GAMMA 1.45f // Match design tools
|
2010-08-26 20:35:23 -07:00
|
|
|
|
2016-06-24 13:37:46 +08:00
|
|
|
// cap to 256 to limite paths in the path cache
|
|
|
|
#define DEFAULT_PATH_TEXTURE_CAP 256
|
|
|
|
|
2013-04-08 19:40:31 -07:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Misc
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Converts a number of mega-bytes into bytes
|
2016-05-19 15:25:50 -07:00
|
|
|
#define MB(s) ((s) * 1024 * 1024)
|
Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-04-17 18:54:38 -07:00
|
|
|
// Converts a number of kilo-bytes into bytes
|
2016-05-19 15:25:50 -07:00
|
|
|
#define KB(s) ((s) * 1024)
|
2013-04-08 19:40:31 -07:00
|
|
|
|
2015-05-04 14:36:49 -07:00
|
|
|
enum class ProfileType {
|
|
|
|
None,
|
|
|
|
Console,
|
|
|
|
Bars
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class OverdrawColorSet {
|
|
|
|
Default = 0,
|
|
|
|
Deuteranomaly
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class StencilClipDebug {
|
|
|
|
Hide,
|
|
|
|
ShowHighlight,
|
|
|
|
ShowRegion
|
|
|
|
};
|
|
|
|
|
2016-07-07 12:35:54 -04:00
|
|
|
enum class RenderPipelineType {
|
|
|
|
OpenGL = 0,
|
|
|
|
SkiaGL,
|
2016-07-08 09:57:49 -04:00
|
|
|
SkiaVulkan,
|
2016-07-07 12:35:54 -04:00
|
|
|
NotInitialized = 128
|
|
|
|
};
|
|
|
|
|
2015-05-04 14:36:49 -07:00
|
|
|
/**
|
|
|
|
* Renderthread-only singleton which manages several static rendering properties. Most of these
|
|
|
|
* are driven by system properties which are queried once at initialization, and again if init()
|
|
|
|
* is called.
|
|
|
|
*/
|
|
|
|
class Properties {
|
|
|
|
public:
|
|
|
|
static bool load();
|
|
|
|
|
|
|
|
static bool drawDeferDisabled;
|
|
|
|
static bool drawReorderDisabled;
|
|
|
|
static bool debugLayersUpdates;
|
|
|
|
static bool debugOverdraw;
|
|
|
|
static bool showDirtyRegions;
|
2015-05-08 10:04:36 -07:00
|
|
|
// TODO: Remove after stabilization period
|
|
|
|
static bool skipEmptyFrames;
|
2015-08-10 09:52:29 -07:00
|
|
|
static bool useBufferAge;
|
|
|
|
static bool enablePartialUpdates;
|
2015-05-04 14:36:49 -07:00
|
|
|
|
2015-09-22 14:22:29 -07:00
|
|
|
static float textGamma;
|
|
|
|
|
2016-02-05 15:59:29 -08:00
|
|
|
static int fboCacheSize;
|
|
|
|
static int gradientCacheSize;
|
2015-11-11 16:42:34 -08:00
|
|
|
static int layerPoolSize;
|
2016-02-05 15:59:29 -08:00
|
|
|
static int patchCacheSize;
|
|
|
|
static int pathCacheSize;
|
|
|
|
static int renderBufferCacheSize;
|
|
|
|
static int tessellationCacheSize;
|
|
|
|
static int textDropShadowCacheSize;
|
|
|
|
static int textureCacheSize;
|
|
|
|
static float textureCacheFlushRate;
|
2015-11-11 16:42:34 -08:00
|
|
|
|
2015-05-04 14:36:49 -07:00
|
|
|
static DebugLevel debugLevel;
|
|
|
|
static OverdrawColorSet overdrawColorSet;
|
|
|
|
static StencilClipDebug debugStencilClip;
|
|
|
|
|
|
|
|
// Override the value for a subset of properties in this class
|
|
|
|
static void overrideProperty(const char* name, const char* value);
|
|
|
|
|
|
|
|
static float overrideLightRadius;
|
|
|
|
static float overrideLightPosY;
|
|
|
|
static float overrideLightPosZ;
|
|
|
|
static float overrideAmbientRatio;
|
|
|
|
static int overrideAmbientShadowStrength;
|
|
|
|
static int overrideSpotShadowStrength;
|
|
|
|
|
|
|
|
static ProfileType getProfileType();
|
2016-07-07 12:35:54 -04:00
|
|
|
static RenderPipelineType getRenderPipelineType();
|
2016-09-27 16:04:42 -04:00
|
|
|
static bool isSkiaEnabled();
|
2015-05-04 14:36:49 -07:00
|
|
|
|
2015-10-30 10:37:35 -07:00
|
|
|
// Should be used only by test apps
|
|
|
|
static bool waitForGpuCompletion;
|
2016-07-03 18:28:25 -07:00
|
|
|
static bool forceDrawFrame;
|
2015-10-30 10:37:35 -07:00
|
|
|
|
2016-03-28 10:38:19 -07:00
|
|
|
// Should only be set by automated tests to try and filter out
|
|
|
|
// any overhead they add
|
|
|
|
static bool filterOutTestOverhead;
|
|
|
|
|
2017-01-04 14:45:56 -05:00
|
|
|
// Used for testing only to change the render pipeline.
|
|
|
|
#ifdef HWUI_GLES_WRAP_ENABLED
|
|
|
|
static void overrideRenderPipelineType(RenderPipelineType);
|
|
|
|
#endif
|
|
|
|
|
2015-05-04 14:36:49 -07:00
|
|
|
private:
|
|
|
|
static ProfileType sProfileType;
|
|
|
|
static bool sDisableProfileBars;
|
2016-07-07 12:35:54 -04:00
|
|
|
static RenderPipelineType sRenderPipelineType;
|
2015-05-04 14:36:49 -07:00
|
|
|
}; // class Caches
|
|
|
|
|
|
|
|
}; // namespace uirenderer
|
|
|
|
}; // namespace android
|
2010-11-10 19:01:29 -08:00
|
|
|
|
2010-10-27 18:57:51 -07:00
|
|
|
#endif // ANDROID_HWUI_PROPERTIES_H
|