Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07320bc9 authored by Chia-I Wu's avatar Chia-I Wu Committed by Android (Google) Code Review
Browse files

Merge "vulkan: remove patches for other projects" into nyc-dev

parents e72aa1b1 045ef419
Loading
Loading
Loading
Loading

vulkan/patches/README

deleted100644 → 0
+0 −26
Original line number Diff line number Diff line
frameworks/native/vulkan/patches
================================
Each subdirectory corresponds to a sequence of patches. These are
"virtual branches": we only have one shared branch, so these let us
share experimental or auxiliary changes without disturbing the main
branch.

To apply:
$ cd <somewhere in target git repo>
$ git am $VULKAN_PATCHES/$PATCH_DIR/*


frameworks_base-apk_library_dir
-------------------------------
This branch is for $TOP/frameworks/base. It modifies the framework to
inform the Vulkan loader, during activity startup, where the
activity's native library directory. The loader will search this
directory for layer libraries. Without this change, layers will only
be loaded from a global location under /data.


build-install_libvulkan
-----------------------
This branch is for $TOP/build. It adds libvulkan.so to the base
PRODUCT_PACKAGES variable, so it will be built and installed on the system
partition by default.
+0 −25
Original line number Diff line number Diff line
From a0aa01fb36a2769b7113316c86e902def62001d9 Mon Sep 17 00:00:00 2001
From: Jesse Hall <jessehall@google.com>
Date: Wed, 14 Oct 2015 15:20:34 -0700
Subject: [PATCH] Add libvulkan to base PRODUCT_PACKAGES

Change-Id: I6c3ad4732148888a88fe980bf8e2bedf26ee74c8
---
 target/product/base.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/product/base.mk b/target/product/base.mk
index 1699156..4b9ce92 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -94,6 +94,7 @@ PRODUCT_PACKAGES += \
     libvisualizer \
     libvorbisidec \
     libmediandk \
+    libvulkan \
     libwifi-service \
     media \
     media_cmd \
-- 
2.6.0.rc2.230.g3dd15c0
+0 −133
Original line number Diff line number Diff line
From 5c7e465f1d11bccecdc5cacce87d1fd7deeb5adb Mon Sep 17 00:00:00 2001
From: Michael Lentine <mlentine@google.com>
Date: Mon, 14 Sep 2015 13:28:25 -0500
Subject: [PATCH] Adding plumbing for passing the lib directory.

Added call in handleBindApplication which will pass the library path into
HardwareRender which then passes it to libvulkan through ThreadedRenderer's
jni interface.

Change-Id: Ie5709ac46f47c4af5c020d604a479e78745d7777
---
 core/java/android/app/ActivityThread.java    |  7 +++++--
 core/java/android/view/HardwareRenderer.java | 11 +++++++++++
 core/java/android/view/ThreadedRenderer.java |  1 +
 core/jni/Android.mk                          |  2 ++
 core/jni/android_view_ThreadedRenderer.cpp   | 15 +++++++++++++++
 5 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index da21eaf..76608c6 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4520,8 +4520,11 @@ public final class ActivityThread {
             } else {
                 Log.e(TAG, "Unable to setupGraphicsSupport due to missing code-cache directory");
             }
-        }
-
+        } 
+        
+        // Add the lib dir path to hardware renderer so that vulkan layers
+        // can be searched for within that directory.
+        HardwareRenderer.setLibDir(data.info.getLibDir());
 
         final boolean is24Hr = "24".equals(mCoreSettings.getString(Settings.System.TIME_12_24));
         DateFormat.set24HourTimePref(is24Hr);
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 5e58250..ed99115 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -301,6 +301,17 @@ public abstract class HardwareRenderer {
     }
 
     /**
+     * Sets the library directory to use as a search path for vulkan layers.
+     *
+     * @param libDir A directory that contains vulkan layers
+     *
+     * @hide
+     */
+    public static void setLibDir(String libDir) {
+        ThreadedRenderer.setupVulkanLayerPath(libDir);
+    }
+
+    /**
      * Indicates that the specified hardware layer needs to be updated
      * as soon as possible.
      *
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index f6119e2..d3e5175 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -492,6 +492,7 @@ public class ThreadedRenderer extends HardwareRenderer {
     }
 
     static native void setupShadersDiskCache(String cacheFile);
+    static native void setupVulkanLayerPath(String layerPath);
 
     private static native void nSetAtlas(long nativeProxy, GraphicBuffer buffer, long[] map);
     private static native void nSetProcessStatsBuffer(long nativeProxy, int fd);
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 6b07a47..438e95b 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -177,6 +177,7 @@ LOCAL_C_INCLUDES += \
     $(LOCAL_PATH)/android/graphics \
     $(LOCAL_PATH)/../../libs/hwui \
     $(LOCAL_PATH)/../../../native/opengl/libs \
+    $(LOCAL_PATH)/../../../native/vulkan/include \
     $(call include-path-for, bluedroid) \
     $(call include-path-for, libhardware)/hardware \
     $(call include-path-for, libhardware_legacy)/hardware_legacy \
@@ -225,6 +226,7 @@ LOCAL_SHARED_LIBRARIES := \
     libEGL \
     libGLESv1_CM \
     libGLESv2 \
+    libvulkan \
     libETC1 \
     libhardware \
     libhardware_legacy \
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 47132f4..69e8ca6 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -27,6 +27,7 @@
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 #include <EGL/egl_cache.h>
+#include <vulkan/vulkan_loader_data.h>
 
 #include <utils/StrongPointer.h>
 #include <android_runtime/android_view_Surface.h>
@@ -448,6 +449,18 @@ static void android_view_ThreadedRenderer_setupShadersDiskCache(JNIEnv* env, job
 }
 
 // ----------------------------------------------------------------------------
+// Layers
+// ----------------------------------------------------------------------------
+
+static void android_view_ThreadedRenderer_setupVulkanLayerPath(JNIEnv* env, jobject clazz,
+        jstring layerPath) {
+
+    const char* layerArray = env->GetStringUTFChars(layerPath, NULL);
+    vulkan::LoaderData::GetInstance().layer_path = layerArray;
+    env->ReleaseStringUTFChars(layerPath, layerArray);
+}
+
+// ----------------------------------------------------------------------------
 // JNI Glue
 // ----------------------------------------------------------------------------
 
@@ -487,6 +500,8 @@ static JNINativeMethod gMethods[] = {
     { "nDumpProfileData", "([BLjava/io/FileDescriptor;)V", (void*) android_view_ThreadedRenderer_dumpProfileData },
     { "setupShadersDiskCache", "(Ljava/lang/String;)V",
                 (void*) android_view_ThreadedRenderer_setupShadersDiskCache },
+    { "setupVulkanLayerPath", "(Ljava/lang/String;)V",
+                (void*) android_view_ThreadedRenderer_setupVulkanLayerPath },
 };
 
 int register_android_view_ThreadedRenderer(JNIEnv* env) {
-- 
2.6.0.rc2.230.g3dd15c0