diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index fd4c6271d2..f56f9713ab 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -272,6 +272,7 @@ elseif(LINUX) libfreetype.so.6.6.2 libfreetype.so.6 libhunspell-1.3.so.0.0.0 + libopenjp2.so libuuid.so.16 libuuid.so.16.0.22 libfontconfig.so.1.10.1 @@ -347,6 +348,6 @@ if(DARWIN) # that end up in any of the above SHARED_LIB_STAGING_DIR_MUMBLE # directories. add_custom_command( TARGET stage_third_party_libs POST_BUILD - COMMAND cmake -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources + COMMAND ${CMAKE_COMMAND} -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources ) endif() diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake index 496916ac4c..c4aab2e9e5 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -6,5 +6,6 @@ add_library( ll::openjpeg INTERFACE IMPORTED ) use_system_binary(openjpeg) use_prebuilt_binary(openjpeg) + target_link_libraries(ll::openjpeg INTERFACE openjp2 ) target_include_directories( ll::openjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/openjpeg) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6f14df51ab..431a1337ae 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -22032,6 +22032,17 @@ Change of this parameter will affect the layout of buttons in notification toast Type Boolean Value + 0 + + KeepAutoTuneLock + + Comment + When enabled the AutoTuneLock will be maintainted all following sessions. + Persist + 1 + Type + U32 + Value 1 AllowSelfImpostor @@ -22142,7 +22153,7 @@ Change of this parameter will affect the layout of buttons in notification toast Type U32 Value - 0 + 1 CameraOpacity diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 85b5b68f7a..2d820e226d 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -69,6 +69,7 @@ // We don't use the mini location panel in Firestorm // #include "llpaneltopinfobar.h" #include "llparcel.h" +#include "llperfstats.h" #include "llrendersphere.h" #include "llscriptruntimeperms.h" #include "llsdutil.h" @@ -4886,7 +4887,7 @@ void LLAgent::handleTeleportFinished() mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::onCapabilitiesReceivedAfterTeleport)); } } - + LLPerfStats::tunables.autoTuneTimeout = true; } void LLAgent::handleTeleportFailed() @@ -4919,6 +4920,7 @@ void LLAgent::handleTeleportFailed() mTPNeedsNeabyChatSeparator = false; + LLPerfStats::tunables.autoTuneTimeout = true; } /*static*/ diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 36912971d9..5eb58b9482 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -127,6 +127,7 @@ BOOL LLFloaterPerformance::postBuild() mObjectList->setIconClickedCallback(boost::bind(&LLFloaterPerformance::detachItem, this, _1)); mSettingsPanel->getChild("advanced_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickAdvanced, this)); + mSettingsPanel->getChild("defaults_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickDefaults, this)); mSettingsPanel->getChild("graphics_quality")->setCommitCallback(boost::bind(&LLFloaterPerformance::onChangeQuality, this, _2)); mSettingsPanel->getChild("advanced_lighting_model")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickAdvancedLighting, this)); mSettingsPanel->getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickShadows, this)); @@ -147,6 +148,16 @@ BOOL LLFloaterPerformance::postBuild() gSavedSettings.setF32("AutoTuneRenderFarClipTarget", LLPipeline::RenderFarClip); } + LLStringExplicit fps_limit(llformat("%d", gViewerWindow->getWindow()->getRefreshRate())); + mAutoadjustmentsPanel->getChild("vsync_desc_limit")->setTextArg("[FPS_LIMIT]", fps_limit); + mAutoadjustmentsPanel->getChild("display_desc")->setTextArg("[FPS_LIMIT]", fps_limit); + mAutoadjustmentsPanel->getChild("defaults_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickDefaults, this)); + + mStartAutotuneBtn = mAutoadjustmentsPanel->getChild("start_autotune"); + mStopAutotuneBtn = mAutoadjustmentsPanel->getChild("stop_autotune"); + mStartAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::startAutotune, this)); + mStopAutotuneBtn->setCommitCallback(boost::bind(&LLFloaterPerformance::stopAutotune, this)); + return TRUE; } @@ -194,14 +205,10 @@ void LLFloaterPerformance::draw() populateObjectList(); } - auto button = getChild("AutoTuneFPS"); - if((bool)button->getToggleState() != LLPerfStats::tunables.userAutoTuneEnabled) - { - button->toggleState(); - } - mUpdateTimer->setTimerExpirySec(REFRESH_INTERVAL); } + updateAutotuneCtrls(LLPerfStats::tunables.userAutoTuneEnabled); + LLFloater::draw(); } @@ -477,6 +484,15 @@ void LLFloaterPerformance::onClickAdvanced() LLFloaterReg::showInstance("prefs_graphics_advanced"); } +void LLFloaterPerformance::onClickDefaults() +{ + LLFloaterPreference* instance = LLFloaterReg::getTypedInstance("preferences"); + if (instance) + { + instance->setRecommendedSettings(); + } +} + void LLFloaterPerformance::onChangeQuality(const LLSD& data) { LLFloaterPreference* instance = LLFloaterReg::getTypedInstance("preferences"); @@ -635,4 +651,25 @@ void LLFloaterPerformance::onClickShadows() } } + +void LLFloaterPerformance::startAutotune() +{ + LLPerfStats::tunables.userAutoTuneEnabled = true; +} + +void LLFloaterPerformance::stopAutotune() +{ + LLPerfStats::tunables.userAutoTuneEnabled = false; +} + +void LLFloaterPerformance::updateAutotuneCtrls(bool autotune_enabled) +{ + static LLCachedControl auto_tune_locked(gSavedSettings, "AutoTuneLock"); + mStartAutotuneBtn->setEnabled(!autotune_enabled && !auto_tune_locked); + mStopAutotuneBtn->setEnabled(autotune_enabled && !auto_tune_locked); + getChild("AutoTuneContinuous")->setEnabled(!autotune_enabled || (autotune_enabled && auto_tune_locked)); + + getChild("wip_desc")->setVisible(autotune_enabled && !auto_tune_locked); + getChild("display_desc")->setVisible(LLPerfStats::tunables.vsyncEnabled); +} // EOF diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 09bcd18bb5..648e5902b6 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -61,12 +61,17 @@ private: void setFPSText(); void onClickAdvanced(); + void onClickDefaults(); void onChangeQuality(const LLSD& data); void onClickHideAvatars(); void onClickExceptions(); void onClickShadows(); void onClickAdvancedLighting(); + void startAutotune(); + void stopAutotune(); + void updateAutotuneCtrls(bool autotune_enabled); + void updateMaxRenderTime(); static void changeQualityLevel(const std::string& notif); @@ -81,6 +86,9 @@ private: LLNameListCtrl* mObjectList; LLNameListCtrl* mNearbyList; + LLButton* mStartAutotuneBtn; + LLButton* mStopAutotuneBtn; + LLListContextMenu* mContextMenu; LLTimer* mUpdateTimer; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 2d9d5e6a59..c6b1a1740d 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1378,6 +1378,13 @@ void LLFloaterPreference::setHardwareDefaults() // saveSettings(); // save here to be able to return to the previous preset by Cancel //} // + setRecommendedSettings(); +} + +void LLFloaterPreference::setRecommendedSettings() +{ + resetAutotuneSettings(); + gSavedSettings.getControl("RenderVSyncEnable")->resetToDefault(true); LLFeatureManager::getInstance()->applyRecommendedSettings(); @@ -1402,6 +1409,28 @@ void LLFloaterPreference::setHardwareDefaults() } } +void LLFloaterPreference::resetAutotuneSettings() +{ + gSavedSettings.setBOOL("AutoTuneFPS", FALSE); + + const std::string autotune_settings[] = { + "AutoTuneLock", + "KeepAutoTuneLock", + "TargetFPS", + "TuningFPSStrategy", + "AutoTuneImpostorByDistEnabled", + "AutoTuneImpostorFarAwayDistance" , + "AutoTuneRenderFarClipMin", + "AutoTuneRenderFarClipTarget", + "RenderAvatarMaxART" + }; + + for (auto it : autotune_settings) + { + gSavedSettings.getControl(it)->resetToDefault(true); + } +} + void LLFloaterPreference::getControlNames(std::vector& names) { LLView* view = findChild("display"); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 96cea97367..5f3a3792c5 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -297,6 +297,9 @@ public: // Support preferences search SLURLs void onCopySearch(); + void setRecommendedSettings(); + void resetAutotuneSettings(); + private: void onDeleteTranscripts(); diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index e59ec12529..64580b8490 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -34,6 +34,8 @@ #include "llbutton.h" #include "lltabcontainer.h" #include "llfloater.h" +//#include "llfloaterperformance.h" +#include "fsfloaterperformance.h" #include "llfloaterreg.h" #include "llpresetsmanager.h" #include "llsliderctrl.h" @@ -48,6 +50,7 @@ LLPanelPresetsPulldown::LLPanelPresetsPulldown() { mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2)); + mCommitCallbackRegistrar.add("Presets.GoAutofpsPrefs", boost::bind(&LLPanelPresetsPulldown::onAutofpsButtonClick, this, _2)); mCommitCallbackRegistrar.add("Presets.RowClick", boost::bind(&LLPanelPresetsPulldown::onRowClick, this, _2)); buildFromFile( "panel_presets_pulldown.xml"); @@ -155,3 +158,15 @@ void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data) } } } + +void LLPanelPresetsPulldown::onAutofpsButtonClick(const LLSD& user_data) +{ + setVisible(FALSE); + //LLFloaterPerformance* performance_floater = LLFloaterReg::showTypedInstance("performance"); + FSFloaterPerformance* performance_floater = LLFloaterReg::showTypedInstance("performance"); + if (performance_floater) + { + //performance_floater->showAutoadjustmentsPanel(); + performance_floater->showMainPanel(); + } +} diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h index c0d32b9b21..79bd6886b1 100644 --- a/indra/newview/llpanelpresetspulldown.h +++ b/indra/newview/llpanelpresetspulldown.h @@ -41,6 +41,7 @@ class LLPanelPresetsPulldown : public LLPanelPulldown private: void onGraphicsButtonClick(const LLSD& user_data); + void onAutofpsButtonClick(const LLSD& user_data); void onRowClick(const LLSD& user_data); std::list mPresetNames; diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index fe544c6168..fa27266d3b 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -29,7 +29,9 @@ #include "llcontrol.h" #include "pipeline.h" #include "llagentcamera.h" +#include "llviewerwindow.h" #include "llvoavatar.h" +#include "llwindow.h" #include "llworld.h" #include @@ -51,15 +53,19 @@ namespace LLPerfStats std::atomic renderAvatarMaxART_ns{(U64)(ART_UNLIMITED_NANOS)}; // highest render time we'll allow without culling features bool belowTargetFPS{false}; U32 lastGlobalPrefChange{0}; + U32 lastSleepedFrame{0}; + U64 meanFrameTime{0}; std::mutex bufferToggleLock{}; F64 cpu_hertz{0.0}; + U32 vsync_max_fps{60}; Tunables tunables; std::atomic StatsRecorder::writeBuffer{0}; bool StatsRecorder::collectionEnabled{true}; LLUUID StatsRecorder::focusAv{LLUUID::null}; + bool StatsRecorder::autotuneInit{false}; std::array StatsRecorder::statsDoubleBuffer{ {} }; std::array StatsRecorder::max{ {} }; std::array StatsRecorder::sum{ {} }; @@ -125,9 +131,23 @@ namespace LLPerfStats LLPerfStats::tunables.userImpostorDistanceTuningEnabled = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled"); LLPerfStats::tunables.userFPSTuningStrategy = gSavedSettings.getU32("TuningFPSStrategy"); LLPerfStats::tunables.userTargetFPS = gSavedSettings.getU32("TargetFPS"); + LLPerfStats::tunables.vsyncEnabled = gSavedSettings.getBOOL("RenderVSyncEnable"); LLPerfStats::tunables.userTargetReflections = gSavedSettings.getS32("UserTargetReflections"); - LLPerfStats::tunables.userAutoTuneEnabled = gSavedSettings.getBOOL("AutoTuneFPS"); - LLPerfStats::tunables.userAutoTuneLock = gSavedSettings.getBOOL("AutoTuneLock"); + + LLPerfStats::tunables.userAutoTuneLock = gSavedSettings.getBOOL("AutoTuneLock") && gSavedSettings.getU32("KeepAutoTuneLock"); + + if(gSavedSettings.getBOOL("AutoTuneLock") && !gSavedSettings.getU32("KeepAutoTuneLock")) + { + gSavedSettings.setBOOL("AutoTuneLock", FALSE); + } + + LLPerfStats::tunables.userAutoTuneEnabled = LLPerfStats::tunables.userAutoTuneLock; + + if (LLPerfStats::tunables.userAutoTuneEnabled && !gSavedSettings.getBOOL("AutoTuneFPS")) + { + gSavedSettings.setBOOL("AutoTuneFPS", TRUE); + } + // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value updateRenderCostLimitFromSettings(); resetChanges(); @@ -139,7 +159,7 @@ namespace LLPerfStats // create a thread to consume from the queue tunables.initialiseFromSettings(); LLPerfStats::cpu_hertz = (F64)LLTrace::BlockTimer::countsPerSecond(); - + LLPerfStats::vsync_max_fps = gViewerWindow->getWindow()->getRefreshRate(); t.detach(); } @@ -245,7 +265,7 @@ namespace LLPerfStats } // and now adjust the proxy vars so that the main thread can adjust the visuals. - if(tunables.userAutoTuneEnabled) + if(autotuneInit && tunables.userAutoTuneEnabled) { updateAvatarParams(); } @@ -309,9 +329,69 @@ namespace LLPerfStats return positions.size(); } + const U32 NUM_PERIODS = 50; + void StatsRecorder::updateMeanFrameTime(U64 cur_frame_time_raw) + { + static std::deque frame_time_deque; + frame_time_deque.push_front(cur_frame_time_raw); + if (frame_time_deque.size() > NUM_PERIODS) + { + frame_time_deque.pop_back(); + } + + std::vector buf(frame_time_deque.begin(), frame_time_deque.end()); + std::sort(buf.begin(), buf.end()); + + LLPerfStats::meanFrameTime = (buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]; + } + U64 StatsRecorder::getMeanTotalFrameTime() + { + return LLPerfStats::meanFrameTime; + } + // static void StatsRecorder::updateAvatarParams() { + if(tunables.autoTuneTimeout) + { + LLPerfStats::lastSleepedFrame = gFrameCount; + tunables.autoTuneTimeout = false; + return; + } + // sleep time is basically forced sleep when window out of focus + auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP); + // similar to sleep time, induced by FPS limit + auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT);// restore FPSLimit reporting + + + // the time spent this frame on the "doFrame" call. Treated as "tot time for frame" + auto tot_frame_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FRAME); + + if( tot_sleep_time_raw != 0 ) + { + // Note: we do not average sleep + // if at some point we need to, the averaging will need to take this into account or + // we forever think we're in the background due to residuals. + LL_DEBUGS() << "No tuning when not in focus" << LL_ENDL; + LLPerfStats::lastSleepedFrame = gFrameCount; + return; + } + + U32 target_fps = tunables.vsyncEnabled ? std::min(LLPerfStats::vsync_max_fps, tunables.userTargetFPS) : tunables.userTargetFPS; + + if(LLPerfStats::lastSleepedFrame != 0) + { + // wait a short time after viewer regains focus + if((gFrameCount - LLPerfStats::lastSleepedFrame) > target_fps * 5) + { + LLPerfStats::lastSleepedFrame = 0; + } + else + { + return; + } + } + updateMeanFrameTime(tot_frame_time_raw); if(tunables.userImpostorDistanceTuningEnabled) { @@ -329,37 +409,30 @@ namespace LLPerfStats // Is our target frame time lower than current? If so we need to take action to reduce draw overheads. // cumulative avatar time (includes idle processing, attachments and base av) auto tot_avatar_time_raw = LLPerfStats::StatsRecorder::getSum(ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); - // sleep time is basically forced sleep when window out of focus - auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP); - // similar to sleep time, induced by FPS limit - auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT);// restore FPSLimit reporting - - - // the time spent this frame on the "doFrame" call. Treated as "tot time for frame" - auto tot_frame_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FRAME); - - if( tot_sleep_time_raw != 0 ) - { - // Note: we do not average sleep - // if at some point we need to, the averaging will need to take this into account or - // we forever think we're in the background due to residuals. - LL_DEBUGS() << "No tuning when not in focus" << LL_ENDL; - return; - } // The frametime budget we have based on the target FPS selected - auto target_frame_time_raw = (U64)llround(LLPerfStats::cpu_hertz/(tunables.userTargetFPS==0?1:tunables.userTargetFPS)); + auto target_frame_time_raw = (U64)llround(LLPerfStats::cpu_hertz / (target_fps == 0 ? 1 : target_fps)); // LL_INFOS() << "Effective FPS(raw):" << tot_frame_time_raw << " Target:" << target_frame_time_raw << LL_ENDL; auto inferredFPS{1000/(U32)std::max(raw_to_ms(tot_frame_time_raw),1.0)}; - U32 settingsChangeFrequency{inferredFPS > 25?inferredFPS:25}; + U32 settingsChangeFrequency{inferredFPS > 50?inferredFPS:50}; if( tot_limit_time_raw != 0)// restore FPSLimit reporting { // This could be problematic. tot_frame_time_raw -= tot_limit_time_raw; }// restore FPSLimit reporting + + F64 time_buf = target_frame_time_raw * 0.1; + // 1) Is the target frame time lower than current? - if( target_frame_time_raw <= tot_frame_time_raw ) + if ((target_frame_time_raw + time_buf) <= tot_frame_time_raw) { + if (target_frame_time_raw - time_buf >= getMeanTotalFrameTime()) + { + belowTargetFPS = false; + LLPerfStats::lastGlobalPrefChange = gFrameCount; + return; + } + if(belowTargetFPS == false) { // this is the first frame under. hold fire to add a little hysteresis @@ -440,7 +513,8 @@ namespace LLPerfStats } // LL_DEBUGS() << "AUTO_TUNE: Target frame time:"<< LLPerfStats::raw_to_us(target_frame_time_raw) << "usecs (non_avatar is " << LLPerfStats::raw_to_us(non_avatar_time_raw) << "usecs) Max cost limited=" << renderAvatarMaxART_ns << LL_ENDL; } - else if( LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns) ) + else if(( LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns) ) || + (tunables.vsyncEnabled && (target_fps == LLPerfStats::vsync_max_fps) && (target_frame_time_raw > getMeanTotalFrameTime()))) { if(belowTargetFPS == true) { @@ -458,10 +532,11 @@ namespace LLPerfStats // turn off if we are not locked. tunables.updateUserAutoTuneEnabled(false); } - if( LLPerfStats::tunedAvatars > 0 ) + if(renderAvatarMaxART_ns != 0 && LLPerfStats::tunedAvatars > 0 ) { // if we have more time to spare let's shift up little in the hope we'll restore an avatar. - renderAvatarMaxART_ns += LLPerfStats::ART_MIN_ADJUST_UP_NANOS; + U64 up_step = LLPerfStats::tunedAvatars > 2 ? LLPerfStats::ART_MIN_ADJUST_UP_NANOS : LLPerfStats::ART_MIN_ADJUST_UP_NANOS * 2; + renderAvatarMaxART_ns += up_step; tunables.updateSettingsFromRenderCostLimit(); return; } diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index d89ea2e1a0..e66a51af45 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -67,7 +67,7 @@ namespace LLPerfStats // Note if changing these, they should correspond with the log range of the correpsonding sliders static constexpr U64 ART_UNLIMITED_NANOS{50000000}; static constexpr U64 ART_MINIMUM_NANOS{100000}; - static constexpr U64 ART_MIN_ADJUST_UP_NANOS{10000}; + static constexpr U64 ART_MIN_ADJUST_UP_NANOS{5000}; static constexpr U64 ART_MIN_ADJUST_DOWN_NANOS{10000}; static constexpr F32 PREFERRED_DD{180}; @@ -84,6 +84,8 @@ namespace LLPerfStats extern std::atomic renderAvatarMaxART_ns; extern bool belowTargetFPS; extern U32 lastGlobalPrefChange; + extern U32 lastSleepedFrame; + extern U64 meanFrameTime; extern std::mutex bufferToggleLock; enum class ObjType_t{ @@ -156,6 +158,8 @@ namespace LLPerfStats U32 userTargetFPS{0}; F32 userARTCutoffSliderValue{0}; S32 userTargetReflections{0}; + bool autoTuneTimeout{true}; + bool vsyncEnabled{true}; void updateNonImposters(U32 nv){nonImpostors=nv; tuningFlag |= NonImpostors;}; void updateReflectionDetail(S32 nv){reflectionDetail=nv; tuningFlag |= ReflectionDetail;}; @@ -194,6 +198,7 @@ namespace LLPerfStats } static inline void setFocusAv(const LLUUID& avID){focusAv = avID;}; static inline const LLUUID& getFocusAv(){return focusAv;}; + static inline void setAutotuneInit(){autotuneInit = true;}; // We do not want to use lock based queues // static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.pushFront(std::move(upd));}; // static void endFrame(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; @@ -231,6 +236,8 @@ namespace LLPerfStats StatsRecorder(); static int countNearbyAvatars(S32 distance); + static U64 getMeanTotalFrameTime(); + static void updateMeanFrameTime(U64 tot_frame_time_raw); // StatsArray is a uint64_t for each possible statistic type. using StatsArray = std::array(LLPerfStats::StatType_t::STATS_COUNT)>; using StatsMap = std::unordered_map; // @@ -239,6 +246,7 @@ namespace LLPerfStats static std::atomic writeBuffer; static LLUUID focusAv; + static bool autotuneInit; static std::array statsDoubleBuffer; static std::array max; static std::array sum; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 98e1bf62c6..1b2045cfae 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3090,7 +3090,9 @@ bool idle_startup() // Disable this in favor of FS performance floater customization //if (gAgent.isFirstLogin()) //{ - // gSavedSettings.setBOOL("AutoFPS", TRUE); + // gSavedSettings.setBOOL("AutoTuneLock", TRUE); + // gSavedSettings.setBOOL("KeepAutoTuneLock", TRUE); + // gSavedSettings.setBOOL("AutoTuneFPS", TRUE); //} // set_startup_status(1.0, "", ""); @@ -3220,6 +3222,8 @@ bool idle_startup() LLUIUsage::instance().clear(); + LLPerfStats::StatsRecorder::setAutotuneInit(); + // FIRE-6643 Display MOTD when login screens are disabled if (gSavedSettings.getBOOL("FSDisableLoginScreens")) { diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 7f17a7a4f5..85203f2503 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -359,8 +359,15 @@ static bool handleAnisotropicChanged(const LLSD& newvalue) static bool handleVSyncChanged(const LLSD& newvalue) { + LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean(); gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean()); + if(newvalue.asBoolean() == true) + { + U32 current_target = gSavedSettings.getU32("TargetFPS"); + gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target)); + } + return true; } @@ -1083,13 +1090,24 @@ void handleDiskCacheSizeChanged(const LLSD& newValue) void handleTargetFPSChanged(const LLSD& newValue) { const auto targetFPS = gSavedSettings.getU32("TargetFPS"); - LLPerfStats::tunables.userTargetFPS = targetFPS; + + U32 frame_rate_limit = gViewerWindow->getWindow()->getRefreshRate(); + if(LLPerfStats::tunables.vsyncEnabled && (targetFPS > frame_rate_limit)) + { + gSavedSettings.setU32("TargetFPS", std::min(frame_rate_limit, targetFPS)); + } + else + { + LLPerfStats::tunables.userTargetFPS = targetFPS; + } } void handleAutoTuneLockChanged(const LLSD& newValue) { const auto newval = gSavedSettings.getBOOL("AutoTuneLock"); LLPerfStats::tunables.userAutoTuneLock = newval; + + gSavedSettings.setBOOL("AutoTuneFPS", newval); } void handleAutoTuneFPSChanged(const LLSD& newValue) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6dc24c26d0..ba40b35ba6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -891,12 +891,16 @@ LLVOAvatar::~LLVOAvatar() debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); } - // only call logPendingPhases if we're still alive. Otherwise this can lead to shutdown crashes + if(mTuned) + { + LLPerfStats::tunedAvatars--; + mTuned = false; + } + // only call logPendingPhases if we're still alive. Otherwise this can lead to shutdown crashes // logPendingPhases(); if (isAgentAvatarValid()) logPendingPhases(); - // LL_DEBUGS("Avatar") << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -9361,9 +9365,15 @@ void LLVOAvatar::updateTooSlow() mTooSlow = false; mTooSlowWithoutShadows = false; } - if(mTooSlow) + if(mTooSlow && !mTuned) { LLPerfStats::tunedAvatars++; // increment the number of avatars that have been tweaked. + mTuned = true; + } + else if(!mTooSlow && mTuned) + { + LLPerfStats::tunedAvatars--; + mTuned = false; } // better state change flagging if( changed_slow_state ) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index cdce55bc40..a699b87ff7 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -432,6 +432,8 @@ private: bool mTooSlow{false}; bool mTooSlowWithoutShadows{false}; + bool mTuned{false}; + private: LLViewerStats::PhaseMap mPhases; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index e4b1b4932f..3d025fb10e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -11217,11 +11217,9 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) << " is " << ( too_complex ? "" : "not ") << "too complex" << LL_ENDL; - bool too_slow = avatar->isTooSlowWithoutShadows();// only if we really have to do we imposter. - pushRenderTypeMask(); - if ( !too_slow && ( visually_muted || too_complex ) ) + if (visually_muted || too_complex) { // only show jelly doll geometry andRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, diff --git a/indra/newview/skins/default/xui/de/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/de/panel_presets_pulldown.xml index ad68087ecb..270f6f0676 100644 --- a/indra/newview/skins/default/xui/de/panel_presets_pulldown.xml +++ b/indra/newview/skins/default/xui/de/panel_presets_pulldown.xml @@ -3,5 +3,6 @@ Grafikvoreinstellungen - +