Skip eglCreateContext telemetry for HWUI contexts
We want eglCreateContext telemetry to give us insights into how
developers use EGL. Including HWUI telemetry in this pollutes this
telemetry. Skip recording of the creation of this context using the new Egl extension. Currently this only disables the passing of GpuStatsInfo::Stats::CREATED_GLES_CONTEXT to the gpu stats.
Test: Checked the code path executed correctly with the flag enabled/disabled using logging
Bug: 347911216
Flag: com.android.graphics.hwui.flags.skip_eglmanager_telemetry
Change-Id: Ifcadd5af263f26388026bcd70ec8dc9c2914cd0a
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index d71f3b6..23cd3ce 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -143,6 +143,7 @@
"aconfig_text_flags_c_lib",
"server_configurable_flags",
"libaconfig_storage_read_api_cc",
+ "libgraphicsenv",
],
static_libs: [
"libEGL_blobCache",
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp
index 1217b47..b6476c9 100644
--- a/libs/hwui/Properties.cpp
+++ b/libs/hwui/Properties.cpp
@@ -42,6 +42,11 @@
constexpr bool initialize_gl_always() {
return false;
}
+
+constexpr bool skip_eglmanager_telemetry() {
+ return false;
+}
+
constexpr bool resample_gainmap_regions() {
return false;
}
@@ -103,6 +108,7 @@
bool Properties::clipSurfaceViews = false;
bool Properties::hdr10bitPlus = false;
+bool Properties::skipTelemetry = false;
bool Properties::resampleGainmapRegions = false;
int Properties::timeoutMultiplier = 1;
@@ -183,6 +189,8 @@
hwui_flags::resample_gainmap_regions());
timeoutMultiplier = android::base::GetIntProperty("ro.hw_timeout_multiplier", 1);
+ skipTelemetry = base::GetBoolProperty(PROPERTY_SKIP_EGLMANAGER_TELEMETRY,
+ hwui_flags::skip_eglmanager_telemetry());
return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
}
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 73e80ce..db47152 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -234,6 +234,8 @@
*/
#define PROPERTY_INITIALIZE_GL_ALWAYS "debug.hwui.initialize_gl_always"
+#define PROPERTY_SKIP_EGLMANAGER_TELEMETRY "debug.hwui.skip_eglmanager_telemetry"
+
///////////////////////////////////////////////////////////////////////////////
// Misc
///////////////////////////////////////////////////////////////////////////////
@@ -342,6 +344,7 @@
static bool clipSurfaceViews;
static bool hdr10bitPlus;
+ static bool skipTelemetry;
static bool resampleGainmapRegions;
static int timeoutMultiplier;
diff --git a/libs/hwui/aconfig/hwui_flags.aconfig b/libs/hwui/aconfig/hwui_flags.aconfig
index 13c0b00..a1f5168 100644
--- a/libs/hwui/aconfig/hwui_flags.aconfig
+++ b/libs/hwui/aconfig/hwui_flags.aconfig
@@ -99,6 +99,13 @@
}
flag {
+ name: "skip_eglmanager_telemetry"
+ namespace: "core_graphics"
+ description: "Skip telemetry in EglManager's calls to eglCreateContext to avoid polluting telemetry"
+ bug: "347911216"
+}
+
+flag {
name: "resample_gainmap_regions"
namespace: "core_graphics"
description: "Resample gainmaps when decoding regions, to improve visual quality"
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 708b011..6010445 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -19,6 +19,7 @@
#include <EGL/eglext.h>
#include <GLES/gl.h>
#include <cutils/properties.h>
+#include <graphicsenv/GpuStatsInfo.h>
#include <log/log.h>
#include <sync/sync.h>
#include <utils/Trace.h>
@@ -366,6 +367,10 @@
contextAttributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
contextAttributes.push_back(Properties::contextPriority);
}
+ if (Properties::skipTelemetry) {
+ contextAttributes.push_back(EGL_TELEMETRY_HINT_ANDROID);
+ contextAttributes.push_back(android::GpuStatsInfo::SKIP_TELEMETRY);
+ }
contextAttributes.push_back(EGL_NONE);
mEglContext = eglCreateContext(
mEglDisplay, EglExtensions.noConfigContext ? ((EGLConfig) nullptr) : mEglConfig,