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 | 396 | setObjectName("Deadlock Watchdog"); |
| 397 | 397 | // Give the heartbeat an initial value |
| 398 | 398 | _heartbeat = usecTimestampNow(); |
| 399 | + _paused = false; | |
| 399 | 400 | connect(qApp, &QCoreApplication::aboutToQuit, [this] { |
| 400 | 401 | _quit = true; |
| 401 | 402 | }); |
| @@ -413,11 +414,20 @@ public: · 11 unmodified lines | ||
| 413 | 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 | 426 | void run() override { |
| 417 | 427 | while (!_quit) { |
| 418 | 428 | QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); |
| 419 | 429 | // Don't do heartbeat detection under nsight |
| 420 | − if (nsightActive()) { | |
| 430 | + if (nsightActive() || _paused) { | |
| 421 | 431 | continue; |
| 422 | 432 | } |
| 423 | 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 | 487 | static std::atomic<uint64_t> _heartbeat; |
| 477 | 488 | static std::atomic<uint64_t> _maxElapsed; |
| 478 | 489 | static std::atomic<int> _maxElapsedAverage; |
| @@ -481,6 +492,7 @@ public: · 2 unmodified lines | ||
| 481 | 492 | bool _quit { false }; |
| 482 | 493 | }; |
| 483 | 494 | |
| 495 | +std::atomic<bool> DeadlockWatchdogThread::_paused; | |
| 484 | 496 | std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat; |
| 485 | 497 | std::atomic<uint64_t> DeadlockWatchdogThread::_maxElapsed; |
| 486 | 498 | std::atomic<int> DeadlockWatchdogThread::_maxElapsedAverage; |
| @@ -2269,6 +2281,11 @@ void Application::initializeGL() { · 1782 unmodified lines | ||
| 2269 | 2281 | initDisplay(); |
| 2270 | 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 | 2289 | // Set up the render engine |
| 2273 | 2290 | render::CullFunctor cullFunctor = LODManager::shouldRender; |
| 2274 | 2291 | static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; |
| @@ -2283,6 +2300,10 @@ void Application::initializeGL() { · 8 unmodified lines | ||
| 2283 | 2300 | // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. |
| 2284 | 2301 | DependencyManager::get<GeometryCache>()->initializeShapePipelines(); |
| 2285 | 2302 | |
| 2303 | +#ifdef Q_OS_OSX | |
| 2304 | + DeadlockWatchdogThread::resume(); | |
| 2305 | +#endif | |
| 2306 | + | |
| 2286 | 2307 | _offscreenContext = new OffscreenGLCanvas(); |
| 2287 | 2308 | _offscreenContext->setObjectName("MainThreadContext"); |
| 2288 | 2309 | _offscreenContext->create(_glWidget->qglContext()); |