diff --git a/gapii/cc/vulkan_extras.inc b/gapii/cc/vulkan_extras.inc index 087c1e065a..457f9bb57b 100644 --- a/gapii/cc/vulkan_extras.inc +++ b/gapii/cc/vulkan_extras.inc @@ -102,10 +102,6 @@ static uint32_t EnumeratePhysicalDevicesAndCacheProperties( bool m_coherent_memory_tracking_enabled = false; -#if TARGET_OS == GAPID_OS_ANDROID -bool m_should_unset_debug_vulkan_layers = true; -#endif // TARGET_OS == GAPID_OS_ANDROID - void SpyOverride_cacheImageSparseMemoryRequirements( VkDevice device, VkImage image, uint32_t count, VkSparseImageMemoryRequirements* pSparseMemoryRequirements); diff --git a/gapii/client/adb.go b/gapii/client/adb.go index 74556ff1ab..8a49f6ece9 100644 --- a/gapii/client/adb.go +++ b/gapii/client/adb.go @@ -16,14 +16,11 @@ package client import ( "context" - "fmt" "net" "time" "github.com/google/gapid/core/app" - "github.com/google/gapid/core/app/crash" "github.com/google/gapid/core/context/keys" - "github.com/google/gapid/core/event/task" "github.com/google/gapid/core/log" "github.com/google/gapid/core/os/android" "github.com/google/gapid/core/os/android/adb" @@ -117,49 +114,11 @@ func StartOrAttach(ctx context.Context, p *android.InstalledPackage, a *android. // if we aren't debuggable regardless. var m *flock.Mutex if o.APIs&VulkanAPI != uint32(0) { - m, err := reserveVulkanDevice(ctx, d) + m, err = reserveVulkanDevice(ctx, d) if err != nil { d.RemoveForward(ctx, port) return nil, log.Err(ctx, err, "Setting up for tracing Vulkan") } - // Make a thread to listen to the signal for unsetting Vulkan implicit - // layers property. - // TODO: This mechanism will be dropped once the whole communication - // with GAPII being migrated to gRPC. - crash.Go(func() { - port, err := adb.LocalFreeTCPPort() - if err != nil { - log.Err(ctx, err, "Finding free port for listening to debug.vulkan.layers unset signal.") - return - } - if err = d.Forward(ctx, adb.TCPPort(port), adb.NamedAbstractSocket("unset-debug-vulkan-layers")); err != nil { - log.Err(ctx, err, "Setting up port forwarding for listening to debug.vulkan.layers unset signal.") - return - } - defer d.RemoveForward(ctx, port) - // Try to connect to the unset signal port, if the port is open - // and messages can be received, unset the Vulkan implicit layers - // property. - log.I(ctx, "Waiting for signal to unset %s on localhost:%d", vkImplicitLayersProp, port) - task.Retry(ctx, 0, time.Second, func(ctx context.Context) (bool, error) { - conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%d", port)) - if err != nil { - return false, err - } - conn.SetReadDeadline(time.Now().Add(500 * time.Millisecond)) - var n int - // No need to read the whole message - n, err = conn.Read(make([]byte, 1)) - if err != nil || n == 0 { - return false, err - } - log.I(ctx, "VkGraphcsSpy loaded, unset %s now.", vkImplicitLayersProp) - if err = releaseVulkanDevice(ctx, d, m); err != nil { - log.Errf(ctx, err, "Unsetting %s", vkImplicitLayersProp) - } - return true, nil - }) - }) } app.AddCleanup(ctx, func() { diff --git a/gapis/api/vulkan/templates/vk_spy_helpers.cpp.tmpl b/gapis/api/vulkan/templates/vk_spy_helpers.cpp.tmpl index e7a1f32baa..3c03aafd9c 100644 --- a/gapis/api/vulkan/templates/vk_spy_helpers.cpp.tmpl +++ b/gapis/api/vulkan/templates/vk_spy_helpers.cpp.tmpl @@ -32,10 +32,6 @@ #include "gapii/cc/vulkan_imports.h" #include "gapii/cc/vulkan_spy.h" ¶ -#if TARGET_OS == GAPID_OS_ANDROID -#include "gapii/cc/connection_stream.h" -#endif -¶ #include "core/os/device/deviceinfo/cc/query.h" ¶ extern "C" {« @@ -314,21 +310,6 @@ uint32_t VulkanSpy::SpyOverride_vkCreateInstance( {{end}} {{end}} } - // On Android once the loader finishes loadinging layers, unset the system - // property: debug.vulkan.layers, to minimize the potential possibility to - // affect other processes. -#if TARGET_OS == GAPID_OS_ANDROID - if (m_should_unset_debug_vulkan_layers) { - const char* unset_pipe = "unset-debug-vulkan-layers"; - GAPID_INFO("Waiting for connection from host on %s", unset_pipe); - auto connForUnset = ConnectionStream::listenPipe(unset_pipe, true); - const char* msg = "Drop VkGraphicsSpy"; - GAPID_INFO("Sending message: \"%s\" to host", msg); - connForUnset->write(msg, sizeof(msg)); - connForUnset->close(); - m_should_unset_debug_vulkan_layers = false; - } -#endif // TARGET_OS == GAPID_OS_ANDROID return result; }