summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chia-I Wu <olv@google.com> 2016-06-28 08:39:33 +0800
committer Chia-I Wu <olv@google.com> 2016-06-29 07:09:21 +0800
commit15e74c9614888d5b6acabc620e42d4e9e09cd5b1 (patch)
tree791e762d3f08edf98d2acc57494832efc8104669
parent11858f170acb1a89905047bbf0039e0582a5b4d2 (diff)
Use the first Vulkan layer path
The loader will scan the current layer path once when the first valid Vulkan command call is made. To avoid confusions and data races, never set the layer path more than once. This assumes the first layer path to be the app's library search path, which should be the case. Bug: 29780602 Change-Id: Ibb9e4de95902ee89413d213d237ea4f62ea35b38
-rw-r--r--core/jni/android_app_ApplicationLoaders.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/jni/android_app_ApplicationLoaders.cpp b/core/jni/android_app_ApplicationLoaders.cpp
index 24ee9591fc2f..3e7c039e2129 100644
--- a/core/jni/android_app_ApplicationLoaders.cpp
+++ b/core/jni/android_app_ApplicationLoaders.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "ApplicationLoaders"
+
#include <nativehelper/ScopedUtfChars.h>
#include <nativeloader/native_loader.h>
#include <vulkan/vulkan_loader_data.h>
@@ -22,10 +24,17 @@
static void setupVulkanLayerPath_native(JNIEnv* env, jobject clazz,
jobject classLoader, jstring librarySearchPath) {
+ android_namespace_t* ns = android::FindNamespaceByClassLoader(env, classLoader);
ScopedUtfChars layerPathChars(env, librarySearchPath);
+
vulkan::LoaderData& loader_data = vulkan::LoaderData::GetInstance();
- loader_data.layer_path = layerPathChars.c_str();
- loader_data.app_namespace = android::FindNamespaceByClassLoader(env, classLoader);
+ if (loader_data.layer_path.empty()) {
+ loader_data.layer_path = layerPathChars.c_str();
+ loader_data.app_namespace = ns;
+ } else {
+ ALOGD("ignored Vulkan layer search path %s for namespace %p",
+ layerPathChars.c_str(), ns);
+ }
}
static const JNINativeMethod g_methods[] = {