diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-01-19 15:55:44 +0200 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-01-19 15:55:44 +0200 |
commit | 6cbe17305c08646d571c90d7df6fc174db6f9aeb (patch) | |
tree | a4de1ee0bc74778b4bffaa8a29b51e0499752108 | |
parent | cf2e153b7add9faefb3066051dbd971ab8f8dddb (diff) |
SL-18991 FIXED Autotune starts too early after login-in
-rw-r--r-- | indra/newview/llagent.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llperfstats.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llperfstats.h | 3 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 2 |
4 files changed, 32 insertions, 18 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e5b3557a72..8cc9be7244 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -63,6 +63,7 @@ #include "llnotificationsutil.h" #include "llpaneltopinfobar.h" #include "llparcel.h" +#include "llperfstats.h" #include "llrendersphere.h" #include "llscriptruntimeperms.h" #include "llsdutil.h" @@ -4102,7 +4103,7 @@ void LLAgent::handleTeleportFinished() mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::onCapabilitiesReceivedAfterTeleport)); } } - + LLPerfStats::tunables.autoTuneTimeout = true; } void LLAgent::handleTeleportFailed() @@ -4135,6 +4136,7 @@ void LLAgent::handleTeleportFailed() mTPNeedsNeabyChatSeparator = false; + LLPerfStats::tunables.autoTuneTimeout = true; } /*static*/ diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 234379a199..8d2f4e68ae 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -55,6 +55,7 @@ namespace LLPerfStats std::atomic<int> StatsRecorder::writeBuffer{0}; bool StatsRecorder::collectionEnabled{true}; LLUUID StatsRecorder::focusAv{LLUUID::null}; + bool StatsRecorder::autotuneInit{false}; std::array<StatsRecorder::StatsTypeMatrix,2> StatsRecorder::statsDoubleBuffer{ {} }; std::array<StatsRecorder::StatsSummaryArray,2> StatsRecorder::max{ {} }; std::array<StatsRecorder::StatsSummaryArray,2> StatsRecorder::sum{ {} }; @@ -239,7 +240,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(); } @@ -326,24 +327,13 @@ namespace LLPerfStats // static void StatsRecorder::updateAvatarParams() { - - if(tunables.userImpostorDistanceTuningEnabled) + if(tunables.autoTuneTimeout) { - // if we have less than the user's "max Non-Impostors" avatars within the desired range then adjust the limit. - // also adjusts back up again for nearby crowds. - auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); - if( count != tunables.nonImpostors ) - { - tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER ); - LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; - } + LLPerfStats::lastSleepedFrame = gFrameCount; + tunables.autoTuneTimeout = false; + return; } - - auto av_render_max_raw = LLPerfStats::StatsRecorder::getMax(ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); - // 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 + // 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); @@ -378,6 +368,23 @@ namespace LLPerfStats } updateMeanFrameTime(tot_frame_time_raw); + if(tunables.userImpostorDistanceTuningEnabled) + { + // if we have less than the user's "max Non-Impostors" avatars within the desired range then adjust the limit. + // also adjusts back up again for nearby crowds. + auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); + if( count != tunables.nonImpostors ) + { + tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER ); + LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; + } + } + + auto av_render_max_raw = LLPerfStats::StatsRecorder::getMax(ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); + // 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); + // The frametime budget we have based on the target FPS selected 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; diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index 17d936483f..200ff1f248 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -135,6 +135,7 @@ 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;}; @@ -171,6 +172,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;}; 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});}; static void clearStats(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; @@ -214,6 +216,7 @@ namespace LLPerfStats static std::atomic<int> writeBuffer; static LLUUID focusAv; + static bool autotuneInit; static std::array<StatsTypeMatrix,2> statsDoubleBuffer; static std::array<StatsSummaryArray,2> max; static std::array<StatsSummaryArray,2> sum; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index eaa1a0574b..83ab8ee7e8 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2351,6 +2351,8 @@ bool idle_startup() LLUIUsage::instance().clear(); + LLPerfStats::StatsRecorder::setAutotuneInit(); + return TRUE; } |