1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
/*
* 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.
*/
#ifndef ANDROID_HWUI_PROPERTIES_H
#define ANDROID_HWUI_PROPERTIES_H
#include <cutils/properties.h>
/**
* This file contains the list of system properties used to configure libhwui.
*/
namespace android {
namespace uirenderer {
///////////////////////////////////////////////////////////////////////////////
// Compile-time properties
///////////////////////////////////////////////////////////////////////////////
// Textures used by layers must have dimensions multiples of this number
#define LAYER_SIZE 64
// Defines the size in bits of the stencil buffer for the framebuffer
// Note: Only 1 bit is required for clipping but more bits are required
// to properly implement overdraw debugging
#define STENCIL_BUFFER_SIZE 8
///////////////////////////////////////////////////////////////////////////////
// Debug properties
///////////////////////////////////////////////////////////////////////////////
/**
* Debug level for app developers. The value is a numeric value defined
* by the DebugLevel enum below.
*/
#define PROPERTY_DEBUG "debug.hwui.level"
/**
* Debug levels. Debug levels are used as flags.
*/
enum DebugLevel {
kDebugDisabled = 0,
kDebugMemory = 1,
kDebugCaches = 2,
kDebugMoreCaches = kDebugMemory | kDebugCaches
};
/**
* Used to enable/disable layers update debugging. The accepted values are
* "true" and "false". The default value is "false".
*/
#define PROPERTY_DEBUG_LAYERS_UPDATES "debug.hwui.show_layers_updates"
/**
* 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".
*/
#define PROPERTY_DEBUG_OVERDRAW "debug.hwui.overdraw"
/**
* 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"
/**
* 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".
*/
#define PROPERTY_DEBUG_STENCIL_CLIP "debug.hwui.show_non_rect_clip"
/**
* 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"
/**
* 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"
/**
* 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"
/**
* 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"
*/
#define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.use_partial_updates"
#define PROPERTY_FILTER_TEST_OVERHEAD "debug.hwui.filter_test_overhead"
/**
* Indicates whether PBOs can be used to back pixel buffers.
* Accepted values are "true" and "false". Default is true.
*/
#define PROPERTY_ENABLE_GPU_PIXEL_BUFFERS "debug.hwui.use_gpu_pixel_buffers"
/**
* Allows to set rendering pipeline mode to OpenGL (default), Skia OpenGL
* or Vulkan.
*/
#define PROPERTY_RENDERER "debug.hwui.renderer"
///////////////////////////////////////////////////////////////////////////////
// Misc
///////////////////////////////////////////////////////////////////////////////
// Converts a number of mega-bytes into bytes
#define MB(s) ((s) * 1024 * 1024)
// Converts a number of kilo-bytes into bytes
#define KB(s) ((s) * 1024)
enum class ProfileType {
None,
Console,
Bars
};
enum class OverdrawColorSet {
Default = 0,
Deuteranomaly
};
enum class StencilClipDebug {
Hide,
ShowHighlight,
ShowRegion
};
enum class RenderPipelineType {
OpenGL = 0,
SkiaGL,
SkiaVulkan,
NotInitialized = 128
};
/**
* 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;
// TODO: Remove after stabilization period
static bool skipEmptyFrames;
static bool useBufferAge;
static bool enablePartialUpdates;
// TODO: Move somewhere else?
static constexpr float textGamma = 1.45f;
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();
static RenderPipelineType getRenderPipelineType();
static bool isSkiaEnabled();
// Should be used only by test apps
static bool waitForGpuCompletion;
static bool forceDrawFrame;
// Should only be set by automated tests to try and filter out
// any overhead they add
static bool filterOutTestOverhead;
// Workaround a device lockup in edge cases by switching to async mode
// instead of the default vsync (b/38372997). Only system_server should hit this.
// Any existing RenderProxy & Surface combination will be unaffected, only things
// created after changing this.
static bool disableVsync;
// Used for testing only to change the render pipeline.
#ifdef HWUI_GLES_WRAP_ENABLED
static void overrideRenderPipelineType(RenderPipelineType);
#endif
private:
static ProfileType sProfileType;
static bool sDisableProfileBars;
static RenderPipelineType sRenderPipelineType;
}; // class Caches
}; // namespace uirenderer
}; // namespace android
#endif // ANDROID_HWUI_PROPERTIES_H
|