SL-18991 FIXED Autotune starts too early after login-in

master
Maxim Nikolenko 2023-01-19 15:55:44 +02:00
parent cf2e153b7a
commit 6cbe17305c
4 changed files with 32 additions and 18 deletions

View File

@ -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*/

View File

@ -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;

View File

@ -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;

View File

@ -2351,6 +2351,8 @@ bool idle_startup()
LLUIUsage::instance().clear();
LLPerfStats::StatsRecorder::setAutotuneInit();
return TRUE;
}