Showing the changes to interface/src/Application.cpp (1 of 16 files). Show all
Unified · Split
| @@ -396,6 +396,7 @@ public: · 395 unmodified lines | |||
| 396 | setObjectName("Deadlock Watchdog"); | 396 | setObjectName("Deadlock Watchdog"); |
| 397 | // Give the heartbeat an initial value | 397 | // Give the heartbeat an initial value |
| 398 | _heartbeat = usecTimestampNow(); | 398 | _heartbeat = usecTimestampNow(); |
| 399 | _paused = false; | ||
| 399 | connect(qApp, &QCoreApplication::aboutToQuit, [this] { | 400 | connect(qApp, &QCoreApplication::aboutToQuit, [this] { |
| 400 | _quit = true; | 401 | _quit = true; |
| 401 | }); | 402 | }); |
| @@ -413,11 +414,20 @@ public: · 11 unmodified lines | |||
| 413 | *crashTrigger = 0xDEAD10CC; | 414 | *crashTrigger = 0xDEAD10CC; |
| 414 | } | 415 | } |
| 415 | 416 | ||
| 417 | static void pause() { | ||
| 418 | _paused = true; | ||
| 419 | } | ||
| 420 | |||
| 421 | static void resume() { | ||
| 422 | _paused = false; | ||
| 423 | updateHeartbeat(); | ||
| 424 | } | ||
| 425 | |||
| 416 | void run() override { | 426 | void run() override { |
| 417 | while (!_quit) { | 427 | while (!_quit) { |
| 418 | QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); | 428 | QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); |
| 419 | // Don't do heartbeat detection under nsight | 429 | // Don't do heartbeat detection under nsight |
| 420 | if (nsightActive()) { | 430 | if (nsightActive() || _paused) { |
| 421 | continue; | 431 | continue; |
| 422 | } | 432 | } |
| 423 | uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us | 433 | uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us |
| @@ -473,6 +483,7 @@ public: · 49 unmodified lines | |||
| 473 | } | 483 | } |
| 474 | } | 484 | } |
| 475 | 485 | ||
| 486 | static std::atomic<bool> _paused; | ||
| 476 | static std::atomic<uint64_t> _heartbeat; | 487 | static std::atomic<uint64_t> _heartbeat; |
| 477 | static std::atomic<uint64_t> _maxElapsed; | 488 | static std::atomic<uint64_t> _maxElapsed; |
| 478 | static std::atomic<int> _maxElapsedAverage; | 489 | static std::atomic<int> _maxElapsedAverage; |
| @@ -481,6 +492,7 @@ public: · 2 unmodified lines | |||
| 481 | bool _quit { false }; | 492 | bool _quit { false }; |
| 482 | }; | 493 | }; |
| 483 | 494 | ||
| 495 | std::atomic<bool> DeadlockWatchdogThread::_paused; | ||
| 484 | std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat; | 496 | std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat; |
| 485 | std::atomic<uint64_t> DeadlockWatchdogThread::_maxElapsed; | 497 | std::atomic<uint64_t> DeadlockWatchdogThread::_maxElapsed; |
| 486 | std::atomic<int> DeadlockWatchdogThread::_maxElapsedAverage; | 498 | std::atomic<int> DeadlockWatchdogThread::_maxElapsedAverage; |
| @@ -2269,6 +2281,11 @@ void Application::initializeGL() { · 1782 unmodified lines | |||
| 2269 | initDisplay(); | 2281 | initDisplay(); |
| 2270 | qCDebug(interfaceapp, "Initialized Display."); | 2282 | qCDebug(interfaceapp, "Initialized Display."); |
| 2271 | 2283 | ||
| 2284 | #ifdef Q_OS_OSX | ||
| 2285 | // FIXME: on mac os the shaders take up to 1 minute to compile, so we pause the deadlock watchdog thread. | ||
| 2286 | +DeadlockWatchdogThread::pause(); | ||
| 2287 | #endif | ||
| 2288 | |||
| 2272 | // Set up the render engine | 2289 | // Set up the render engine |
| 2273 | render::CullFunctor cullFunctor = LODManager::shouldRender; | 2290 | render::CullFunctor cullFunctor = LODManager::shouldRender; |
| 2274 | static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; | 2291 | static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; |
| @@ -2283,6 +2300,10 @@ void Application::initializeGL() { · 8 unmodified lines | |||
| 2283 | // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. | 2300 | // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. |
| 2284 | DependencyManager::get<GeometryCache>()->initializeShapePipelines(); | 2301 | DependencyManager::get<GeometryCache>()->initializeShapePipelines(); |
| 2285 | 2302 | ||
| 2303 | #ifdef Q_OS_OSX | ||
| 2304 | DeadlockWatchdogThread::resume(); | ||
| 2305 | #endif | ||
| 2306 | |||
| 2286 | _offscreenContext = new OffscreenGLCanvas(); | 2307 | _offscreenContext = new OffscreenGLCanvas(); |
| 2287 | _offscreenContext->setObjectName("MainThreadContext"); | 2308 | _offscreenContext->setObjectName("MainThreadContext"); |
| 2288 | _offscreenContext->create(_glWidget->qglContext()); | 2309 | _offscreenContext->create(_glWidget->qglContext()); |