From c43336d5ed211ab77f2dc12b6cb7442d7544a2f7 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 27 Jan 2023 01:33:11 +0200 Subject: SL-18930 Update Autotune panel --- indra/newview/app_settings/settings.xml | 13 +- indra/newview/llfloaterperformance.cpp | 38 ++++- indra/newview/llfloaterperformance.h | 7 + indra/newview/llfloaterpreference.cpp | 1 + indra/newview/llperfstats.cpp | 17 +- indra/newview/llstartup.cpp | 2 + indra/newview/llviewercontrol.cpp | 19 ++- .../xui/en/panel_performance_autoadjustments.xml | 175 ++++++++++++++------- 8 files changed, 203 insertions(+), 69 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b220e2a8f5..569a838176 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16775,6 +16775,17 @@ Type Boolean Value + 0 + + KeepAutoTuneLock + + Comment + When enabled the AutoTuneLock will be maintainted all following sessions. + Persist + 1 + Type + U32 + Value 1 AllowSelfImpostor @@ -16885,7 +16896,7 @@ Type U32 Value - 0 + 1 CameraOpacity diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 88319b170f..ba45648bd9 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -148,6 +148,15 @@ 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); + + 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; } @@ -195,14 +204,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(); } @@ -645,4 +650,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 6a72f3d7c5..648e5902b6 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -68,6 +68,10 @@ private: void onClickShadows(); void onClickAdvancedLighting(); + void startAutotune(); + void stopAutotune(); + void updateAutotuneCtrls(bool autotune_enabled); + void updateMaxRenderTime(); static void changeQualityLevel(const std::string& notif); @@ -82,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 531270f936..9476a0f6a3 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -825,6 +825,7 @@ void LLFloaterPreference::resetAutotuneSettings() const std::string autotune_settings[] = { "AutoTuneLock", + "KeepAutoTuneLock", "TargetFPS", "TuningFPSStrategy", "AutoTuneImpostorByDistEnabled", diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index cb5c674a32..959e0afbdf 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -123,8 +123,21 @@ namespace LLPerfStats 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(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 83ab8ee7e8..26c4f1b639 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2262,6 +2262,8 @@ bool idle_startup() { if (gAgent.isFirstLogin()) { + gSavedSettings.setBOOL("AutoTuneLock", TRUE); + gSavedSettings.setBOOL("KeepAutoTuneLock", TRUE); gSavedSettings.setBOOL("AutoTuneFPS", TRUE); } set_startup_status(1.0, "", ""); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0bade93c45..50d48987ed 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -270,6 +270,12 @@ 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; } @@ -649,13 +655,24 @@ void handleRenderAutoMuteByteLimitChanged(const LLSD& new_value); 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/skins/default/xui/en/panel_performance_autoadjustments.xml b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml index ab7b4d3ee7..24611c94d6 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml @@ -63,7 +63,7 @@ left="20" name="targetfps_desc" wrap="true" - width="140" + width="115" top_pad="20"> Desired frame rate @@ -73,8 +73,8 @@ font="SansSerifLarge" tool_tip="The viewer will attempt to achieve this by adjusting your graphics settings." layout="topleft" - follows="right|top" - left_pad="5" + follows="left|top" + left_pad="25" top_delta="0" height="25" visible="true" @@ -85,41 +85,18 @@ min_val="1" width="48" label_width="0" /> - - - + name="display_desc" + top_delta="5" + left_pad="15" + wrap="true" + width="225"> + Your display supports up to [FPS_LIMIT] fps. + + width="115"> Settings affect + width="160"> +