diff options
| -rw-r--r-- | libs/graphicsenv/GraphicsEnv.cpp | 7 | ||||
| -rw-r--r-- | libs/graphicsenv/include/graphicsenv/GraphicsEnv.h | 8 |
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. |