OSDN Git Service

GPU Debug Layers: Allow multiple layer apps
authorCody Northrop <cnorthrop@google.com>
Mon, 8 Apr 2019 15:50:23 +0000 (09:50 -0600)
committerCody Northrop <cnorthrop@google.com>
Wed, 10 Apr 2019 17:02:28 +0000 (11:02 -0600)
This allows applications to specify both a GLES layer app and a
Vulkan layer app, so both APIs can be debugged at the same time.

To specify multiple debug layer apps, colon separate them just
like the layers:

  adb shell settings put global gpu_debug_layer_app app1:app2:appN

Bug: 110883880
Test: atest CtsGpuToolsHostTestCases
Change-Id: I5f721b7d9de59577adb6cc03e909ff99ca79d75e

core/java/android/os/GraphicsEnvironment.java

index 53503f4..e56b6e0 100644 (file)
@@ -188,11 +188,16 @@ public class GraphicsEnvironment {
 
                     if (gpuDebugLayerApp != null && !gpuDebugLayerApp.isEmpty()) {
                         Log.i(TAG, "GPU debug layer app: " + gpuDebugLayerApp);
-                        final String paths = getDebugLayerAppPaths(pm, gpuDebugLayerApp);
-                        if (paths != null) {
-                            // Append the path so files placed in the app's base directory will
-                            // override the external path
-                            layerPaths += paths + ":";
+                        // If a colon is present, treat this as multiple apps, so Vulkan and GLES
+                        // layer apps can be provided at the same time.
+                        String[] layerApps = gpuDebugLayerApp.split(":");
+                        for (int i = 0; i < layerApps.length; i++) {
+                            String paths = getDebugLayerAppPaths(pm, layerApps[i]);
+                            if (paths != null) {
+                                // Append the path so files placed in the app's base directory will
+                                // override the external path
+                                layerPaths += paths + ":";
+                            }
                         }
                     }