From 6ad8eb6ec73a5ece69ca9913d0e57db9552b902a Mon Sep 17 00:00:00 2001 From: freiling Date: Thu, 22 Jul 2021 13:06:01 -0700 Subject: [PATCH] [fuchsia] boot lockup debugging improvements (flutter/engine#27459) --- .../shell/platform/fuchsia/flutter/engine.cc | 6 ++++- .../fuchsia/flutter/vulkan_surface.cc | 9 ++++--- engine/src/flutter/vulkan/vulkan_interface.h | 26 +++++++------------ 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc index 1589f4cb86..350e0e4091 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc @@ -607,6 +607,10 @@ void Engine::WarmupSkps( surface_producer.ProduceOffscreenSurface(size).release(); if (!skp_warmup_surface) { FML_LOG(ERROR) << "Failed to create offscreen warmup surface"; + // Tell client that zero shaders were warmed up because warmup failed. + if (completion_callback.has_value() && completion_callback.value()) { + completion_callback.value()(0); + } return; } @@ -680,7 +684,7 @@ void Engine::WarmupSkps( // we want to unblock the dart animation code as soon as the raster // thread is free to enque work, rather than waiting for the GPU work // itself to finish. - if (completion_callback) { + if (completion_callback.has_value() && completion_callback.value()) { completion_callback.value()(count); } } diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc index a50c190a02..3a4cbc0b93 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc @@ -231,6 +231,8 @@ bool VulkanSurface::AllocateDeviceMemory( const SkISize& size, uint32_t buffer_id) { if (size.isEmpty()) { + FML_LOG(ERROR) + << "VulkanSurface: Failed to allocate surface, size is empty"; return false; } @@ -367,6 +369,8 @@ bool VulkanSurface::SetupSkiaSurface(sk_sp context, ); if (!sk_surface || sk_surface->getCanvas() == nullptr) { + FML_LOG(ERROR) + << "VulkanSurface: SkSurface::MakeFromBackendRenderTarget failed"; return false; } sk_surface_ = std::move(sk_surface); @@ -431,8 +435,7 @@ void VulkanSurface::Reset() { if (acquire_event_.signal(ZX_EVENT_SIGNALED, 0u) != ZX_OK || release_event_.signal(ZX_EVENT_SIGNALED, 0u) != ZX_OK) { valid_ = false; - FML_DLOG(ERROR) - << "Could not reset fences. The surface is no longer valid."; + FML_LOG(ERROR) << "Could not reset fences. The surface is no longer valid."; } VkFence fence = command_buffer_fence_; @@ -451,7 +454,7 @@ void VulkanSurface::Reset() { acquire_semaphore_.Reset(); acquire_semaphore_ = SemaphoreFromEvent(acquire_event_); if (!acquire_semaphore_) { - FML_DLOG(ERROR) << "failed to create acquire semaphore"; + FML_LOG(ERROR) << "failed to create acquire semaphore"; } wait_.Begin(async_get_default_dispatcher()); diff --git a/engine/src/flutter/vulkan/vulkan_interface.h b/engine/src/flutter/vulkan/vulkan_interface.h index 29561b149a..e973b5ffaf 100644 --- a/engine/src/flutter/vulkan/vulkan_interface.h +++ b/engine/src/flutter/vulkan/vulkan_interface.h @@ -31,25 +31,17 @@ #include -#ifndef NDEBUG - -#define VK_CALL_LOG_ERROR(expression) \ - ({ \ - __typeof__(expression) _rc = (expression); \ - if (_rc != VK_SUCCESS) { \ - FML_DLOG(INFO) << "Vulkan call '" << #expression \ - << "' failed with error " \ - << vulkan::VulkanResultToString(_rc); \ - } \ - _rc; \ +#define VK_CALL_LOG_ERROR(expression) \ + ({ \ + __typeof__(expression) _rc = (expression); \ + if (_rc != VK_SUCCESS) { \ + FML_LOG(INFO) << "Vulkan call '" << #expression \ + << "' failed with error " \ + << vulkan::VulkanResultToString(_rc); \ + } \ + _rc; \ }) -#else // NDEBUG - -#define VK_CALL_LOG_ERROR(expression) (expression) - -#endif // NDEBUG - namespace vulkan { std::string VulkanResultToString(VkResult result);