diff options
author | Kaiyi Li <kaiyili@google.com> | 2022-09-23 17:45:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-09-23 17:45:58 +0000 |
commit | 9df26e3a0bee55756456ba9c05e61abfaad64dda (patch) | |
tree | 9248fc95135a2ed8ea4702ace08d1d4c6a3d6ab2 | |
parent | 279c9465c0947efcaa3cb59d9e803173f3e800da (diff) | |
parent | a8c458dd19e7a3a8e740fbc61676b069fba798f8 (diff) | |
download | vulkan-cereal-9df26e3a0bee55756456ba9c05e61abfaad64dda.tar.gz |
Merge "FrameBuffer: add hang watchdogs for window setup and post"
-rw-r--r-- | stream-servers/FrameBuffer.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/stream-servers/FrameBuffer.cpp b/stream-servers/FrameBuffer.cpp index 8adce714..cdb85a29 100644 --- a/stream-servers/FrameBuffer.cpp +++ b/stream-servers/FrameBuffer.cpp @@ -1060,6 +1060,11 @@ FrameBuffer::sendReadbackWorkerCmd(const Readback& readback) { } WorkerProcessingResult FrameBuffer::postWorkerFunc(Post& post) { + auto annotations = std::make_unique<EventHangMetadata::HangAnnotations>(); + annotations->insert({"Post command opcode", std::to_string(static_cast<uint64_t>(post.cmd))}); + auto watchdog = WATCHDOG_BUILDER(m_healthMonitor, "PostWorker main function") + .setAnnotations(std::move(annotations)) + .build(); switch (post.cmd) { case PostCmd::Post: { // We wrap the callback like this to workaround a bug in the MS STL implementation. @@ -1344,11 +1349,24 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window, std::unique_ptr<ScopedPromise> postWorkerContinueSignal; std::future<void> postWorkerContinueSignalFuture; std::tie(postWorkerContinueSignal, postWorkerContinueSignalFuture) = ScopedPromise::create(); - blockPostWorker(std::move(postWorkerContinueSignalFuture)).wait(); + { + auto watchdog = WATCHDOG_BUILDER(m_healthMonitor, "Wait for other tasks on PostWorker") + .setTimeoutMs(6000) + .build(); + blockPostWorker(std::move(postWorkerContinueSignalFuture)).wait(); + } if (m_displayVk) { + auto watchdog = + WATCHDOG_BUILDER(m_healthMonitor, "Draining the VkQueue").setTimeoutMs(6000).build(); m_displayVk->drainQueues(); } + HealthMonitor<>::Id lockWatchdogId = + WATCHDOG_BUILDER(m_healthMonitor, "Wait for the FrameBuffer global lock") + .build() + ->release() + .value(); AutoLock mutex(m_lock); + m_healthMonitor.stopMonitoringTask(lockWatchdogId); #if SNAPSHOT_PROFILE > 1 // printf("FrameBuffer::%s(): got lock at %lld ms\n", __func__, @@ -1415,6 +1433,7 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window, } } + auto watchdog = WATCHDOG_BUILDER(m_healthMonitor, "Updating subwindow state").build(); // At this point, if the subwindow doesn't exist, it is because it either // couldn't be created // in the first place or the EGLSurface couldn't be created. @@ -1430,8 +1449,11 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window, m_windowWidth = ww; m_windowHeight = wh; - success = ::moveSubWindow(m_nativeWindow, m_subWin, m_x, m_y, - m_windowWidth, m_windowHeight); + { + auto watchdog = WATCHDOG_BUILDER(m_healthMonitor, "Moving subwindow").build(); + success = ::moveSubWindow(m_nativeWindow, m_subWin, m_x, m_y, m_windowWidth, + m_windowHeight); + } } // We are safe to unblock the PostWorker thread now, because we have completed all the // operations that could modify the state of the m_subWin. We need to unblock the PostWorker |