Loading libs/graphicsenv/GraphicsEnv.cpp +27 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <log/log.h> #include <log/log.h> #include <nativeloader/dlext_namespaces.h> #include <nativeloader/dlext_namespaces.h> #include <nativeloader/native_loader.h> // TODO(b/37049319) Get this from a header once one exists // TODO(b/37049319) Get this from a header once one exists extern "C" { extern "C" { Loading @@ -45,6 +46,32 @@ void GraphicsEnv::setDriverPath(const std::string path) { mDriverPath = path; 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() { android_namespace_t* GraphicsEnv::getDriverNamespace() { static std::once_flag once; static std::once_flag once; std::call_once(once, [this]() { std::call_once(once, [this]() { Loading libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -35,10 +35,20 @@ public: void setDriverPath(const std::string path); void setDriverPath(const std::string path); android_namespace_t* getDriverNamespace(); android_namespace_t* getDriverNamespace(); void setLayerPaths(android_namespace_t* appNamespace, const std::string layerPaths); android_namespace_t* getAppNamespace(); const std::string getLayerPaths(); void setDebugLayers(const std::string layers); const std::string getDebugLayers(); private: private: GraphicsEnv() = default; GraphicsEnv() = default; std::string mDriverPath; std::string mDriverPath; std::string mDebugLayers; std::string mLayerPaths; android_namespace_t* mDriverNamespace = nullptr; android_namespace_t* mDriverNamespace = nullptr; android_namespace_t* mAppNamespace = nullptr; }; }; } // namespace android } // namespace android Loading vulkan/include/vulkan/vulkan_loader_data.hdeleted 100644 → 0 +0 −33 Original line number Original line Diff line number Diff line /* * Copyright 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef VULKAN_VULKAN_LOADER_DATA_H #define VULKAN_VULKAN_LOADER_DATA_H #include <string> struct android_namespace_t; namespace vulkan { struct LoaderData { std::string layer_path; android_namespace_t* app_namespace; __attribute__((visibility("default"))) static LoaderData& GetInstance(); }; } #endif vulkan/libvulkan/Android.bp +0 −1 Original line number Original line Diff line number Diff line Loading @@ -61,7 +61,6 @@ cc_library_shared { "layers_extensions.cpp", "layers_extensions.cpp", "stubhal.cpp", "stubhal.cpp", "swapchain.cpp", "swapchain.cpp", "vulkan_loader_data.cpp", ], ], export_header_lib_headers: ["vulkan_headers"], export_header_lib_headers: ["vulkan_headers"], Loading vulkan/libvulkan/api.cpp +29 −8 Original line number Original line Diff line number Diff line Loading @@ -29,14 +29,17 @@ #include <new> #include <new> #include <utility> #include <utility> #include <android-base/strings.h> #include <cutils/properties.h> #include <cutils/properties.h> #include <log/log.h> #include <log/log.h> #include <vulkan/vk_layer_interface.h> #include <vulkan/vk_layer_interface.h> #include <graphicsenv/GraphicsEnv.h> #include "api.h" #include "api.h" #include "driver.h" #include "driver.h" #include "layers_extensions.h" #include "layers_extensions.h" namespace vulkan { namespace vulkan { namespace api { namespace api { Loading Loading @@ -121,6 +124,10 @@ class OverrideLayerNames { if (!is_instance_ || !driver::Debuggable()) if (!is_instance_ || !driver::Debuggable()) return; return; GetLayersFromSettings(); // If no layers specified via Settings, check legacy properties if (implicit_layers_.count <= 0) { ParseDebugVulkanLayers(); ParseDebugVulkanLayers(); property_list(ParseDebugVulkanLayer, this); property_list(ParseDebugVulkanLayer, this); Loading @@ -131,6 +138,20 @@ class OverrideLayerNames { return (a.priority < b.priority); return (a.priority < b.priority); }); }); } } } void GetLayersFromSettings() { // These will only be available if conditions are met in GraphicsEnvironemnt // gpu_debug_layers = layer1:layer2:layerN const std::string layers = android::GraphicsEnv::getInstance().getDebugLayers(); if (!layers.empty()) { ALOGV("Debug layer list: %s", layers.c_str()); std::vector<std::string> paths = android::base::Split(layers, ":"); for (uint32_t i = 0; i < paths.size(); i++) { AddImplicitLayer(int(i), paths[i].c_str(), paths[i].length()); } } } void ParseDebugVulkanLayers() { void ParseDebugVulkanLayers() { // debug.vulkan.layers specifies colon-separated layer names // debug.vulkan.layers specifies colon-separated layer names Loading Loading
libs/graphicsenv/GraphicsEnv.cpp +27 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <log/log.h> #include <log/log.h> #include <nativeloader/dlext_namespaces.h> #include <nativeloader/dlext_namespaces.h> #include <nativeloader/native_loader.h> // TODO(b/37049319) Get this from a header once one exists // TODO(b/37049319) Get this from a header once one exists extern "C" { extern "C" { Loading @@ -45,6 +46,32 @@ void GraphicsEnv::setDriverPath(const std::string path) { mDriverPath = path; 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() { android_namespace_t* GraphicsEnv::getDriverNamespace() { static std::once_flag once; static std::once_flag once; std::call_once(once, [this]() { std::call_once(once, [this]() { Loading
libs/graphicsenv/include/graphicsenv/GraphicsEnv.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -35,10 +35,20 @@ public: void setDriverPath(const std::string path); void setDriverPath(const std::string path); android_namespace_t* getDriverNamespace(); android_namespace_t* getDriverNamespace(); void setLayerPaths(android_namespace_t* appNamespace, const std::string layerPaths); android_namespace_t* getAppNamespace(); const std::string getLayerPaths(); void setDebugLayers(const std::string layers); const std::string getDebugLayers(); private: private: GraphicsEnv() = default; GraphicsEnv() = default; std::string mDriverPath; std::string mDriverPath; std::string mDebugLayers; std::string mLayerPaths; android_namespace_t* mDriverNamespace = nullptr; android_namespace_t* mDriverNamespace = nullptr; android_namespace_t* mAppNamespace = nullptr; }; }; } // namespace android } // namespace android Loading
vulkan/include/vulkan/vulkan_loader_data.hdeleted 100644 → 0 +0 −33 Original line number Original line Diff line number Diff line /* * Copyright 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef VULKAN_VULKAN_LOADER_DATA_H #define VULKAN_VULKAN_LOADER_DATA_H #include <string> struct android_namespace_t; namespace vulkan { struct LoaderData { std::string layer_path; android_namespace_t* app_namespace; __attribute__((visibility("default"))) static LoaderData& GetInstance(); }; } #endif
vulkan/libvulkan/Android.bp +0 −1 Original line number Original line Diff line number Diff line Loading @@ -61,7 +61,6 @@ cc_library_shared { "layers_extensions.cpp", "layers_extensions.cpp", "stubhal.cpp", "stubhal.cpp", "swapchain.cpp", "swapchain.cpp", "vulkan_loader_data.cpp", ], ], export_header_lib_headers: ["vulkan_headers"], export_header_lib_headers: ["vulkan_headers"], Loading
vulkan/libvulkan/api.cpp +29 −8 Original line number Original line Diff line number Diff line Loading @@ -29,14 +29,17 @@ #include <new> #include <new> #include <utility> #include <utility> #include <android-base/strings.h> #include <cutils/properties.h> #include <cutils/properties.h> #include <log/log.h> #include <log/log.h> #include <vulkan/vk_layer_interface.h> #include <vulkan/vk_layer_interface.h> #include <graphicsenv/GraphicsEnv.h> #include "api.h" #include "api.h" #include "driver.h" #include "driver.h" #include "layers_extensions.h" #include "layers_extensions.h" namespace vulkan { namespace vulkan { namespace api { namespace api { Loading Loading @@ -121,6 +124,10 @@ class OverrideLayerNames { if (!is_instance_ || !driver::Debuggable()) if (!is_instance_ || !driver::Debuggable()) return; return; GetLayersFromSettings(); // If no layers specified via Settings, check legacy properties if (implicit_layers_.count <= 0) { ParseDebugVulkanLayers(); ParseDebugVulkanLayers(); property_list(ParseDebugVulkanLayer, this); property_list(ParseDebugVulkanLayer, this); Loading @@ -131,6 +138,20 @@ class OverrideLayerNames { return (a.priority < b.priority); return (a.priority < b.priority); }); }); } } } void GetLayersFromSettings() { // These will only be available if conditions are met in GraphicsEnvironemnt // gpu_debug_layers = layer1:layer2:layerN const std::string layers = android::GraphicsEnv::getInstance().getDebugLayers(); if (!layers.empty()) { ALOGV("Debug layer list: %s", layers.c_str()); std::vector<std::string> paths = android::base::Split(layers, ":"); for (uint32_t i = 0; i < paths.size(); i++) { AddImplicitLayer(int(i), paths[i].c_str(), paths[i].length()); } } } void ParseDebugVulkanLayers() { void ParseDebugVulkanLayers() { // debug.vulkan.layers specifies colon-separated layer names // debug.vulkan.layers specifies colon-separated layer names Loading