Rootless GPU Debug
Add the ability to load GPU debug layers from the base
directory of debuggable applications.
This update concides with changes to framework/base to
control the enabling logic in GraphicsEnvironment.
This commit changes the Vulkan loader to:
* Scan an additional location for debug layers.
* Use the provided order of layers from GraphicsEnvironment,
overriding system properties.
* Use the first instance of a layer found, in the case of duplicates.
* Move layers paths and namespace to GraphicsEnv, removing vulkan_loader_data
Bug: 63708377
Test: Manual, CTS tests to follow
Change-Id: I38dc91bbc26671f5093ee1b12454fc024c0b5892
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 39b5829..f46e9f6 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -22,6 +22,7 @@
#include <log/log.h>
#include <nativeloader/dlext_namespaces.h>
+#include <nativeloader/native_loader.h>
// TODO(b/37049319) Get this from a header once one exists
extern "C" {
@@ -45,6 +46,32 @@
mDriverPath = path;
}
+void GraphicsEnv::setLayerPaths(android_namespace_t* appNamespace, const std::string layerPaths) {
+ if (mLayerPaths.empty()) {
+ mLayerPaths = layerPaths;
+ mAppNamespace = appNamespace;
+ } else {
+ ALOGV("Vulkan layer search path already set, not clobbering with '%s' for namespace %p'",
+ layerPaths.c_str(), appNamespace);
+ }
+}
+
+android_namespace_t* GraphicsEnv::getAppNamespace() {
+ return mAppNamespace;
+}
+
+const std::string GraphicsEnv::getLayerPaths(){
+ return mLayerPaths;
+}
+
+const std::string GraphicsEnv::getDebugLayers() {
+ return mDebugLayers;
+}
+
+void GraphicsEnv::setDebugLayers(const std::string layers) {
+ mDebugLayers = layers;
+}
+
android_namespace_t* GraphicsEnv::getDriverNamespace() {
static std::once_flag once;
std::call_once(once, [this]() {