summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Bodnar <abodnar@google.com> 2019-10-10 17:31:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-10-10 17:31:14 +0000
commit923b82722e41d24ff86d0f42b083fc2d02911a8f (patch)
tree5216b4ca5d366a8513630c53c8d9233ab9712f40
parent24d8978defe7b749bc3bea89518dcc6600e416c5 (diff)
parent0afcca0b295d50227439af6a555fcbabc80341b0 (diff)
Merge "[libgraphicsenv] Add an API to enable profiling features"
-rw-r--r--libs/graphicsenv/GraphicsEnv.cpp7
-rw-r--r--libs/graphicsenv/include/graphicsenv/GraphicsEnv.h8
2 files changed, 15 insertions, 0 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 30f5f73c3a..28591110f0 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -307,6 +307,13 @@ void GraphicsEnv::sendGpuStatsLocked(GpuStatsInfo::Api api, bool isDriverLoaded,
}
}
+bool GraphicsEnv::setInjectLayersPrSetDumpable() {
+ if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
+ return false;
+ }
+ return true;
+}
+
void* GraphicsEnv::loadLibrary(std::string name) {
const android_dlextinfo dlextinfo = {
.flags = ANDROID_DLEXT_USE_NAMESPACE,
diff --git a/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h b/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h
index a47f468e7a..83448d4ce7 100644
--- a/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h
+++ b/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h
@@ -68,6 +68,14 @@ public:
void setDriverLoaded(GpuStatsInfo::Api api, bool isDriverLoaded, int64_t driverLoadingTime);
/*
+ * Api for Vk/GL layer injection. Presently, drivers enable certain
+ * profiling features when prctl(PR_GET_DUMPABLE) returns true.
+ * Calling this when layer injection metadata is present allows the driver
+ * to enable profiling even when in a non-debuggable app
+ */
+ bool setInjectLayersPrSetDumpable();
+
+ /*
* Apis for ANGLE
*/
// Check if the requested app should use ANGLE.