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

Commit 8f2cd959 authored by Michael Lentine's avatar Michael Lentine Committed by Android (Google) Code Review
Browse files

Merge "Adding plumbing for passing the lib directory."

parents c34c37f7 03d8f768
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5080,6 +5080,10 @@ public final class ActivityThread {
            }
        }

        // Add the lib dir path to hardware renderer so that vulkan layers
        // can be searched for within that directory.
        ThreadedRenderer.setLibDir(data.info.getLibDir());

        // Install the Network Security Config Provider. This must happen before the application
        // code is loaded to prevent issues with instances of TLS objects being created before
        // the provider is installed.
+12 −0
Original line number Diff line number Diff line
@@ -251,6 +251,17 @@ public final class ThreadedRenderer {
        ThreadedRenderer.setupShadersDiskCache(new File(cacheDir, CACHE_PATH_SHADERS).getAbsolutePath());
    }

    /**
     * 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);
    }

    /**
     * Creates a hardware renderer using OpenGL.
     *
@@ -979,6 +990,7 @@ public final class ThreadedRenderer {
    }

    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);
+2 −0
Original line number Diff line number Diff line
@@ -184,6 +184,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 \
@@ -233,6 +234,7 @@ LOCAL_SHARED_LIBRARIES := \
    libEGL \
    libGLESv1_CM \
    libGLESv2 \
    libvulkan \
    libETC1 \
    libhardware \
    libhardware_legacy \
+15 −0
Original line number Diff line number Diff line
@@ -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/Looper.h>
#include <utils/RefBase.h>
@@ -617,6 +618,18 @@ static void android_view_ThreadedRenderer_setupShadersDiskCache(JNIEnv* env, job
    env->ReleaseStringUTFChars(diskCachePath, cacheArray);
}

// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
@@ -658,6 +671,8 @@ static const 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 },
    { "nAddRenderNode", "(JJZ)V", (void*) android_view_ThreadedRenderer_addRenderNode},
    { "nRemoveRenderNode", "(JJ)V", (void*) android_view_ThreadedRenderer_removeRenderNode},
    { "nDrawRenderNode", "(JJ)V", (void*) android_view_ThreadedRendererd_drawRenderNode},