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

Commit 0fa1d220 authored by Cody Northrop's avatar Cody Northrop
Browse files

Add GLES specific setting for layers

This allows loading layers for GLES and Vulkan at the
same time by adding a GLES specific setting:

  GPU_DEBUG_LAYERS_GLES

which mirrors the existing setting:

  GPU_DEBUG_LAYERS

The Vulkan and GLES loaders now scan distinct layer
lists, correcting an issue that would prevent Vulkan
from loading when it failed to find GLES layers.

Bug: 110883880
Test: Load a GLES layer when running ANGLE with Vulkan backend
Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Change-Id: I370be4ce6fdde9e95989eb1f274add8b5790263e
parent f5744e35
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -170,10 +170,18 @@ public class GraphicsEnvironment {

                    String layers = coreSettings.getString(Settings.Global.GPU_DEBUG_LAYERS);

                    Log.i(TAG, "Debug layer list: " + layers);
                    Log.i(TAG, "Vulkan debug layer list: " + layers);
                    if (layers != null && !layers.isEmpty()) {
                        setDebugLayers(layers);
                    }

                    String layersGLES =
                            coreSettings.getString(Settings.Global.GPU_DEBUG_LAYERS_GLES);

                    Log.i(TAG, "GLES debug layer list: " + layersGLES);
                    if (layersGLES != null && !layersGLES.isEmpty()) {
                        setDebugLayersGLES(layersGLES);
                    }
                }
            }
        }
@@ -424,6 +432,7 @@ public class GraphicsEnvironment {
    private static native int getCanLoadSystemLibraries();
    private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
    private static native void setDebugLayers(String layers);
    private static native void setDebugLayersGLES(String layers);
    private static native void setDriverPath(String path);
    private static native void setAngleInfo(String path, String appPackage, String appPref,
                                            boolean devOptIn, FileDescriptor rulesFd,
+8 −1
Original line number Diff line number Diff line
@@ -11692,12 +11692,19 @@ public final class Settings {
        public static final String ANGLE_ENABLED_APP = "angle_enabled_app";
        /**
         * Ordered GPU debug layer list
         * Ordered GPU debug layer list for Vulkan
         * i.e. <layer1>:<layer2>:...:<layerN>
         * @hide
         */
        public static final String GPU_DEBUG_LAYERS = "gpu_debug_layers";
        /**
         * Ordered GPU debug layer list for GLES
         * i.e. <layer1>:<layer2>:...:<layerN>
         * @hide
         */
        public static final String GPU_DEBUG_LAYERS_GLES = "gpu_debug_layers_gles";
        /**
         * Addition app for GPU layer discovery
         * @hide
+8 −0
Original line number Diff line number Diff line
@@ -58,12 +58,20 @@ void setDebugLayers_native(JNIEnv* env, jobject clazz, jstring layers) {
    }
}

void setDebugLayersGLES_native(JNIEnv* env, jobject clazz, jstring layers) {
    if (layers != nullptr) {
        ScopedUtfChars layersChars(env, layers);
        android::GraphicsEnv::getInstance().setDebugLayersGLES(layersChars.c_str());
    }
}

const JNINativeMethod g_methods[] = {
    { "getCanLoadSystemLibraries", "()I", reinterpret_cast<void*>(getCanLoadSystemLibraries_native) },
    { "setDriverPath", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPath) },
    { "setAngleInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/io/FileDescriptor;JJ)V", reinterpret_cast<void*>(setAngleInfo_native) },
    { "setLayerPaths", "(Ljava/lang/ClassLoader;Ljava/lang/String;)V", reinterpret_cast<void*>(setLayerPaths_native) },
    { "setDebugLayers", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDebugLayers_native) },
    { "setDebugLayersGLES", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDebugLayersGLES_native) },
};

const char* const kGraphicsEnvironmentName = "android/os/GraphicsEnvironment";
+4 −1
Original line number Diff line number Diff line
@@ -394,13 +394,16 @@ message GlobalSettingsProto {

        // App allowed to load GPU debug layers.
        optional SettingProto debug_app = 1;
        // Ordered GPU debug layer list
        // Ordered GPU debug layer list for Vulkan
        // i.e. <layer1>:<layer2>:...:<layerN>
        optional SettingProto debug_layers = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
        // App will load ANGLE instead of native GLES drivers.
        optional SettingProto angle_enabled_app = 3;
        // App that can provide layer libraries.
        optional SettingProto debug_layer_app = 4;
        // Ordered GPU debug layer list for GLES
        // i.e. <layer1>:<layer2>:...:<layerN>
        optional SettingProto debug_layers_gles = 5;
    }
    optional Gpu gpu = 59;

+1 −0
Original line number Diff line number Diff line
@@ -451,6 +451,7 @@ public class SettingsBackupTest {
                    Settings.Global.ENABLE_GPU_DEBUG_LAYERS,
                    Settings.Global.GPU_DEBUG_APP,
                    Settings.Global.GPU_DEBUG_LAYERS,
                    Settings.Global.GPU_DEBUG_LAYERS_GLES,
                    Settings.Global.ANGLE_ENABLED_APP,
                    Settings.Global.GPU_DEBUG_LAYER_APP,
                    Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
Loading