From 665bd6825fd43eb1933a1e5ebb952b3246ff09ca Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 7 Feb 2018 12:27:56 +1300 Subject: [PATCH 1/8] Fix the spectator camera --- interface/src/scripting/WindowScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index fc45555bf9..471a8b1523 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -396,11 +396,11 @@ QString WindowScriptingInterface::protocolSignature() { } int WindowScriptingInterface::getInnerWidth() { - return qApp->getDeviceSize().x; + return qApp->getWindow()->geometry().width(); } int WindowScriptingInterface::getInnerHeight() { - return qApp->getDeviceSize().y; + return qApp->getWindow()->geometry().height() - qApp->getPrimaryMenu()->geometry().height(); } glm::vec2 WindowScriptingInterface::getDeviceSize() const { From 3ed633ebeadb75aacb4af13c483e8b2dcc9d8b14 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 6 Feb 2018 15:52:32 -0800 Subject: [PATCH 2/8] FIxing the get***LODIncreaseFPS functions evaluation of the threshold FPS for starting increasing LOD again --- interface/src/LODManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/LODManager.cpp b/interface/src/LODManager.cpp index 73547cdb5e..73408377c0 100644 --- a/interface/src/LODManager.cpp +++ b/interface/src/LODManager.cpp @@ -168,7 +168,7 @@ float LODManager::getDesktopLODDecreaseFPS() const { } float LODManager::getDesktopLODIncreaseFPS() const { - return glm::max(((float)MSECS_PER_SECOND / _desktopMaxRenderTime) + INCREASE_LOD_GAP_FPS, MAX_LIKELY_DESKTOP_FPS); + return glm::min(((float)MSECS_PER_SECOND / _desktopMaxRenderTime) + INCREASE_LOD_GAP_FPS, MAX_LIKELY_DESKTOP_FPS); } void LODManager::setHMDLODDecreaseFPS(float fps) { @@ -184,7 +184,7 @@ float LODManager::getHMDLODDecreaseFPS() const { } float LODManager::getHMDLODIncreaseFPS() const { - return glm::max(((float)MSECS_PER_SECOND / _hmdMaxRenderTime) + INCREASE_LOD_GAP_FPS, MAX_LIKELY_HMD_FPS); + return glm::min(((float)MSECS_PER_SECOND / _hmdMaxRenderTime) + INCREASE_LOD_GAP_FPS, MAX_LIKELY_HMD_FPS); } QString LODManager::getLODFeedbackText() { From 72749e139abe807bd30a7138a2409a95b3a0c503 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 6 Feb 2018 16:00:49 -0800 Subject: [PATCH 3/8] changing the Increase LOD gap to 10 to start upping earlier --- interface/src/LODManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/LODManager.h b/interface/src/LODManager.h index 7b10579077..a12f809efe 100644 --- a/interface/src/LODManager.h +++ b/interface/src/LODManager.h @@ -25,7 +25,7 @@ const float DEFAULT_DESKTOP_MAX_RENDER_TIME = (float)MSECS_PER_SECOND / DEFAULT_ const float DEFAULT_HMD_MAX_RENDER_TIME = (float)MSECS_PER_SECOND / DEFAULT_HMD_LOD_DOWN_FPS; // msec const float MAX_LIKELY_DESKTOP_FPS = 59.0f; // this is essentially, V-synch - 1 fps const float MAX_LIKELY_HMD_FPS = 74.0f; // this is essentially, V-synch - 1 fps -const float INCREASE_LOD_GAP_FPS = 15.0f; // fps +const float INCREASE_LOD_GAP_FPS = 10.0f; // fps // The default value DEFAULT_OCTREE_SIZE_SCALE means you can be 400 meters away from a 1 meter object in order to see it (which is ~20:20 vision). const float ADJUST_LOD_MAX_SIZE_SCALE = DEFAULT_OCTREE_SIZE_SCALE; From 6c0ca1b7b821c97a06d8e8df625c2692cd43931c Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Tue, 6 Feb 2018 14:51:51 -0800 Subject: [PATCH 4/8] Use version IDs in scribe tool downloads --- android/build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index c7eefd051b..bd036b98f4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -129,12 +129,15 @@ def scribeLocalFile='scribe' + EXEC_SUFFIX def scribeFile='scribe_linux_x86_64' def scribeChecksum='c98678d9726bd8bbf1bab792acf3ff6c' +def scribeVersion='onfeBkJWcJiTwiGOyZPVBjlyhoYQ4Axn' if (Os.isFamily(Os.FAMILY_MAC)) { scribeFile = 'scribe_osx_x86_64' scribeChecksum='a137ad62c1bf7cca739da219544a9a16' + scribeVersion='kU.Aq512HVe65uRnkFEWQEqeQfaYF2c0' } else if (Os.isFamily(Os.FAMILY_WINDOWS)) { scribeFile = 'scribe_win32_x86_64.exe' scribeChecksum='75c2ce9ed45d17de375e3988bfaba816' + scribeVersion='24TfWFh1FBY.t6i_LdzAXZYeQOtmQNZp' } def options = [ @@ -385,7 +388,7 @@ task copyDependencies(dependsOn: [ extractDependencies ]) { } task downloadScribe(type: Download) { - src baseUrl + scribeFile + src baseUrl + scribeFile + '?versionId=' + scribeVersion dest new File(baseFolder, scribeLocalFile) onlyIfNewer true } From 84f44539907b8846c803a14dfd02e51c2708428f Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 7 Feb 2018 13:32:30 -0800 Subject: [PATCH 5/8] undo part of #12312 --- interface/src/ui/overlays/Web3DOverlay.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 5fb4d58340..4f96e70aa9 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -80,7 +80,6 @@ Web3DOverlay::Web3DOverlay() { _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED _webSurface->getSurfaceContext()->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get().data()); - } Web3DOverlay::Web3DOverlay(const Web3DOverlay* Web3DOverlay) : @@ -201,6 +200,11 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("offscreenFlags", flags); _webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get().data()); + + _webSurface->getSurfaceContext()->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED + _webSurface->getSurfaceContext()->setContextProperty("AccountServices", AccountServicesScriptingInterface::getInstance()); + // in Qt 5.10.0 there is already an "Audio" object in the QML context // though I failed to find it (from QtMultimedia??). So.. let it be "AudioScriptingInterface" _webSurface->getSurfaceContext()->setContextProperty("AudioScriptingInterface", DependencyManager::get().data()); From 2c514b5d1b3c0daec0b3970ed49d182c54f4409e Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Wed, 7 Feb 2018 15:27:34 -0800 Subject: [PATCH 6/8] Don't trigger a backtrace exception on quitting while in HMD --- interface/src/Application_render.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application_render.cpp b/interface/src/Application_render.cpp index e1f198eed2..5cc072df37 100644 --- a/interface/src/Application_render.cpp +++ b/interface/src/Application_render.cpp @@ -55,7 +55,7 @@ void Application::paintGL() { // If a display plugin loses it's underlying support, it // needs to be able to signal us to not use it if (!displayPlugin->beginFrameRender(_renderFrameCount)) { - updateDisplayMode(); + QMetaObject::invokeMethod(this, "updateDisplayMode"); return; } } From 77741c28514c7197d8880288b5a61be0aa327853 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Wed, 7 Feb 2018 16:43:15 -0800 Subject: [PATCH 7/8] Fix for deadlock triggering while loading QML engine --- interface/src/Application.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3e7dd3e223..c22a370b1f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2404,7 +2404,9 @@ void Application::initializeUi() { tabletScriptingInterface->getTablet(SYSTEM_TABLET); } auto offscreenUi = DependencyManager::get(); + DeadlockWatchdogThread::pause(); offscreenUi->create(); + DeadlockWatchdogThread::resume(); auto surfaceContext = offscreenUi->getSurfaceContext(); From 8748e98b5ea049450c6b344b6be1da247103890d Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Thu, 8 Feb 2018 10:23:25 -0800 Subject: [PATCH 8/8] Prevent deadlock crashes when building shaders at startup --- interface/src/Application.cpp | 45 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3e7dd3e223..eb04f58b6b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -318,7 +318,7 @@ static QTimer pingTimer; static bool DISABLE_WATCHDOG = true; #else static const QString DISABLE_WATCHDOG_FLAG{ "HIFI_DISABLE_WATCHDOG" }; -static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); +static bool DISABLE_WATCHDOG = nsightActive() || QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); #endif #if defined(USE_GLES) @@ -415,20 +415,26 @@ public: *crashTrigger = 0xDEAD10CC; } + static void withPause(const std::function& lambda) { + pause(); + lambda(); + resume(); + } static void pause() { _paused = true; } static void resume() { - _paused = false; + // Update the heartbeat BEFORE resuming the checks updateHeartbeat(); + _paused = false; } void run() override { while (!_quit) { QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); // Don't do heartbeat detection under nsight - if (nsightActive() || _paused) { + if (_paused) { continue; } uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us @@ -2283,29 +2289,22 @@ void Application::initializeGL() { initDisplay(); qCDebug(interfaceapp, "Initialized Display."); -#ifdef Q_OS_OSX - // FIXME: on mac os the shaders take up to 1 minute to compile, so we pause the deadlock watchdog thread. - DeadlockWatchdogThread::pause(); -#endif - - // Set up the render engine - render::CullFunctor cullFunctor = LODManager::shouldRender; - static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; - _renderEngine->addJob("UpdateScene"); + // FIXME: on low end systems os the shaders take up to 1 minute to compile, so we pause the deadlock watchdog thread. + DeadlockWatchdogThread::withPause([&] { + // Set up the render engine + render::CullFunctor cullFunctor = LODManager::shouldRender; + static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; + _renderEngine->addJob("UpdateScene"); #ifndef Q_OS_ANDROID - _renderEngine->addJob("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED); + _renderEngine->addJob("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED); #endif - _renderEngine->addJob("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::TAG_BITS_0, render::ItemKey::TAG_BITS_0); + _renderEngine->addJob("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::TAG_BITS_0, render::ItemKey::TAG_BITS_0); + _renderEngine->load(); + _renderEngine->registerScene(_main3DScene); - _renderEngine->load(); - _renderEngine->registerScene(_main3DScene); - - // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. - DependencyManager::get()->initializeShapePipelines(); - -#ifdef Q_OS_OSX - DeadlockWatchdogThread::resume(); -#endif + // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. + DependencyManager::get()->initializeShapePipelines(); + }); _offscreenContext = new OffscreenGLCanvas(); _offscreenContext->setObjectName("MainThreadContext");