From 0afcca0b295d50227439af6a555fcbabc80341b0 Mon Sep 17 00:00:00 2001 From: Adam Bodnar Date: Tue, 17 Sep 2019 13:23:17 -0700 Subject: [libgraphicsenv] Add an API to enable profiling features Set PR_SET_DUMPABLE for process that wishes to inject Vk/GL layers via metadata. This signals the graphics driver to enable profiling features. Bug: 138204026 Test: Add to the xml in the manifest of a GL/Vk app. Call prctl(PR_GET_DUMPABLE) in a native app to verify. Change-Id: Ife7d18f77775499629d830376a76c4599afd9c15 --- libs/graphicsenv/GraphicsEnv.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libs/graphicsenv/GraphicsEnv.cpp') 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, -- cgit v1.2.3-59-g8ed1b