Skip to content

Commit

Permalink
[fuchsia] boot lockup debugging improvements (flutter#27459)
Browse files Browse the repository at this point in the history
  • Loading branch information
freiling authored Jul 22, 2021
1 parent 1402e43 commit 0f0f947
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
6 changes: 5 additions & 1 deletion shell/platform/fuchsia/flutter/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}
}
Expand Down
9 changes: 6 additions & 3 deletions shell/platform/fuchsia/flutter/vulkan_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -367,6 +369,8 @@ bool VulkanSurface::SetupSkiaSurface(sk_sp<GrDirectContext> context,
);

if (!sk_surface || sk_surface->getCanvas() == nullptr) {
FML_LOG(ERROR)
<< "VulkanSurface: SkSurface::MakeFromBackendRenderTarget failed";
return false;
}
sk_surface_ = std::move(sk_surface);
Expand Down Expand Up @@ -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_;
Expand All @@ -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());
Expand Down
26 changes: 9 additions & 17 deletions vulkan/vulkan_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,17 @@

#include <vulkan/vulkan.h>

#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);
Expand Down

0 comments on commit 0f0f947

Please sign in to comment.