summaryrefslogtreecommitdiff
path: root/libs/hwui/Properties.h
diff options
context:
space:
mode:
author Brett Chabot <brettchabot@google.com> 2021-05-21 08:41:58 -0700
committer Brett Chabot <brettchabot@google.com> 2021-07-13 20:01:47 +0000
commit856db9e3169a237febc80a42b02265ca1fdbd640 (patch)
tree247206a5804786f296c889acd547ac0545205d3a /libs/hwui/Properties.h
parentdbf0f2f36dc12a5f70bb0a7e686726bc5d648767 (diff)
Add ability to disable GL draws.
This feature is intended for use in headless test environments, where disabling drawing has minimal compatibility impact and can save significant resource usage when running UI tests. This feature is controlled via a new system property 'debug.hwui.drawing_enabled', and a HardwareRenderer public API that can override the property value on a per-process basis. Bug: 188559292 Test: boot emulator, atest CtsGraphicsTestCases Change-Id: I93c21e680382e03342f235dbf58bd7a5c8a6f767
Diffstat (limited to 'libs/hwui/Properties.h')
-rw-r--r--libs/hwui/Properties.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 7df6e2c92247..73fccb67800b 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -187,6 +187,12 @@ enum DebugLevel {
*/
#define PROPERTY_WEBVIEW_OVERLAYS_ENABLED "debug.hwui.webview_overlays_enabled"
+/**
+ * Property for globally GL drawing state. Can be overridden per process with
+ * setDrawingEnabled.
+ */
+#define PROPERTY_DRAWING_ENABLED "debug.hwui.drawing_enabled"
+
///////////////////////////////////////////////////////////////////////////////
// Misc
///////////////////////////////////////////////////////////////////////////////
@@ -208,6 +214,8 @@ enum class StretchEffectBehavior {
UniformScale // Uniform scale stretch everywhere
};
+enum class OverrideDrawingEnabled { Default, On, Off };
+
/**
* 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()
@@ -301,6 +309,12 @@ public:
stretchEffectBehavior = behavior;
}
+ // Represents if GL drawing is enabled. Should only be false in headless testing environments
+ static bool drawingEnabled;
+ static OverrideDrawingEnabled overrideDrawingEnabled;
+ static bool isDrawingEnabled();
+ static void setDrawingEnabled(bool enable);
+
private:
static StretchEffectBehavior stretchEffectBehavior;
static ProfileType sProfileType;