From 513ac361b13b081a13f1f6dde1c0c34c4eb41b3a Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Wed, 26 Apr 2023 17:32:19 -0700 Subject: Got things to compile again after DRTVWR-559 & DRTVWR-539 merge. removing dead code and references to members that don't exist anymore --- indra/newview/llperfstats.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 7ff363c3c1..e37c2a4479 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -443,6 +443,7 @@ namespace LLPerfStats { // 1 - hack the water to opaque. all non opaque have a significant hit, this is a big boost for (arguably) a minor visual hit. // the other reflection options make comparatively little change and if this overshoots we'll be stepping back up later +# if 0 // TODO RenderReflectionDetail went away if(LLPipeline::RenderReflectionDetail != -2) { LLPerfStats::tunables.updateReflectionDetail(-2); @@ -450,6 +451,7 @@ namespace LLPerfStats return; } else // deliberately "else" here so we only do one of these in any given frame +#endif { // step down the DD by 10m per update auto new_dd = (LLPipeline::RenderFarClip - DD_STEP > tunables.userMinDrawDistance)?(LLPipeline::RenderFarClip - DD_STEP) : tunables.userMinDrawDistance; @@ -539,7 +541,9 @@ namespace LLPerfStats if( (tot_frame_time_raw * 1.5) < target_frame_time_raw ) { // if everything else is "max" and we have >50% headroom let's knock the water quality up a notch at a time. +# if 0 // RenderReflectionDetail went away LLPerfStats::tunables.updateReflectionDetail( std::min(LLPipeline::RenderReflectionDetail + 1, tunables.userTargetReflections) ); +#endif } } } -- cgit v1.2.3 From 10b2ec92ec74176422fa8c6013dee1036eed57c5 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Thu, 27 Apr 2023 18:02:48 -0700 Subject: More merge cleanup after DRTVWR-559 & DRTVWR-539 merge. (thanks Ansariel) --- indra/newview/llperfstats.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index e37c2a4479..c63aae2089 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -75,7 +75,6 @@ namespace LLPerfStats if( tuningFlag & UserAutoTuneEnabled ){ gSavedSettings.setBOOL("AutoTuneFPS", userAutoTuneEnabled); }; if( tuningFlag & UserAutoTuneLock ){ gSavedSettings.setBOOL("AutoTuneLock", userAutoTuneLock); }; if( tuningFlag & UserTargetFPS ){ gSavedSettings.setU32("TargetFPS", userTargetFPS); }; - if( tuningFlag & UserTargetReflections ){ gSavedSettings.setS32("UserTargetReflections", userTargetReflections); }; // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value if( tuningFlag & UserARTCutoff ){ gSavedSettings.setF32("RenderAvatarMaxART", userARTCutoffSliderValue); }; resetChanges(); @@ -122,7 +121,6 @@ namespace LLPerfStats 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.userAutoTuneLock = gSavedSettings.getBOOL("AutoTuneLock") && gSavedSettings.getU32("KeepAutoTuneLock"); -- cgit v1.2.3 From 334d71e9107ae3c4d35b181f2ed6e5c9ff1de519 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 1 May 2023 17:05:09 -0500 Subject: SL-19656 Rewrite avatar and attachment render metrics to not interfere with render pipe and be representative of actual render cost instead of driver synchronization time. * SL-19656 Rewrite avatar and attachment render metrics to not interfere with render pipe and be representative of actual render cost instead of driver synchronization time. * SL-19656 Remove now dead code (trackAttachments et al). * SL-19656 Fix for crash on GL <= 3.2 --- indra/newview/llperfstats.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index c63aae2089..b680d8761b 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -199,18 +199,7 @@ namespace LLPerfStats // LL_INFOS("scenestats") << "Scenestat: " << static_cast(statEntry) << " before=" << avg << " new=" << val << " newavg=" << statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null][static_cast(statEntry)] << LL_ENDL; } } -// Allow attachment times etc to update even when FPS limited or sleeping. - auto& statsMap = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_ATTACHMENT)]; - for(auto& stat_entry : statsMap) - { - auto val = stat_entry.second[static_cast(ST::RENDER_COMBINED)]; - if(val > SMOOTHING_PERIODS){ - auto avg = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_ATTACHMENT)][stat_entry.first][static_cast(ST::RENDER_COMBINED)]; - stat_entry.second[static_cast(ST::RENDER_COMBINED)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); - } - } - - + auto& statsMapAv = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_AVATAR)]; for(auto& stat_entry : statsMapAv) { -- cgit v1.2.3 From 8077d33ba05a46ea61914be686816be5b54bae6d Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 11 May 2023 13:20:34 -0500 Subject: SL-19656 Remove LLPerfStats thread and fold into General thread. Hook avatar GPU time into LLPerfStats. Incidental decruft. --- indra/newview/llperfstats.cpp | 67 +++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 21 deletions(-) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index b680d8761b..2281475d4a 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -39,6 +39,11 @@ extern LLControlGroup gSavedSettings; namespace LLPerfStats { + // avatar timing metrics in ms (updated once per mainloop iteration) + std::atomic sTotalAvatarTime = 0.f; + std::atomic sAverageAvatarTime = 0.f; + std::atomic sMaxAvatarTime = 0.f; + std::atomic tunedAvatars{0}; std::atomic renderAvatarMaxART_ns{(U64)(ART_UNLIMITED_NANOS)}; // highest render time we'll allow without culling features bool belowTargetFPS{false}; @@ -141,14 +146,12 @@ namespace LLPerfStats resetChanges(); } - StatsRecorder::StatsRecorder():q(1024*16),t(&StatsRecorder::run) + StatsRecorder::StatsRecorder():q(1024*16) { // create a queue - // 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(); } // static @@ -200,20 +203,6 @@ namespace LLPerfStats } } - auto& statsMapAv = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_AVATAR)]; - for(auto& stat_entry : statsMapAv) - { - for(auto& stat : avatarStatsToAvg) - { - auto val = stat_entry.second[static_cast(stat)]; - if(val > SMOOTHING_PERIODS) - { - auto avg = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_AVATAR)][stat_entry.first][static_cast(stat)]; - stat_entry.second[static_cast(stat)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); - } - } - } - // swap the buffers if(enabled()) { @@ -293,6 +282,36 @@ namespace LLPerfStats } } + // called once per main loop iteration on main thread + void updateClass() + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + + sTotalAvatarTime = LLVOAvatar::getTotalGPURenderTime(); + sAverageAvatarTime = LLVOAvatar::getAverageGPURenderTime(); + sMaxAvatarTime = LLVOAvatar::getMaxGPURenderTime(); + + auto& general = LL::WorkQueue::getInstance("General"); + + if (general) + { + general->post([] { StatsRecorder::update(); }); + } + } + + // called once per main loop iteration on General thread + void StatsRecorder::update() + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + StatsRecord upd; + auto& instance{ StatsRecorder::getInstance() }; + + while (enabled() && !LLApp::isQuitting() && instance.q.tryPop(upd)) + { + instance.processUpdate(upd); + } + } + //static int StatsRecorder::countNearbyAvatars(S32 distance) { @@ -327,6 +346,8 @@ namespace LLPerfStats // static void StatsRecorder::updateAvatarParams() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + if(tunables.autoTuneTimeout) { LLPerfStats::lastSleepedFrame = gFrameCount; @@ -380,10 +401,10 @@ namespace LLPerfStats } } - auto av_render_max_raw = LLPerfStats::StatsRecorder::getMax(ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); + auto av_render_max_raw = ms_to_raw(sMaxAvatarTime); // 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); + auto tot_avatar_time_raw = ms_to_raw(sTotalAvatarTime); // 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)); @@ -417,7 +438,7 @@ namespace LLPerfStats // if so we've got work to do // how much of the frame was spent on non avatar related work? - U64 non_avatar_time_raw = tot_frame_time_raw - tot_avatar_time_raw; + U64 non_avatar_time_raw = tot_frame_time_raw > tot_avatar_time_raw ? tot_frame_time_raw - tot_avatar_time_raw : 0; // If the target frame time < scene time (estimated as non_avatar time) U64 target_avatar_time_raw; @@ -475,7 +496,11 @@ namespace LLPerfStats { new_render_limit_ns = renderAvatarMaxART_ns; } - new_render_limit_ns -= LLPerfStats::ART_MIN_ADJUST_DOWN_NANOS; + + if (new_render_limit_ns > LLPerfStats::ART_MIN_ADJUST_DOWN_NANOS) + { + new_render_limit_ns -= LLPerfStats::ART_MIN_ADJUST_DOWN_NANOS; + } // bounce at the bottom to prevent "no limit" new_render_limit_ns = std::max((U64)new_render_limit_ns, (U64)LLPerfStats::ART_MINIMUM_NANOS); -- cgit v1.2.3 From 06bdee663433bf5b12eddcbcfcb8785546354c28 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Thu, 11 May 2023 12:18:45 -0700 Subject: Xcode build fixes for DRTVWR-559 --- indra/newview/llperfstats.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 2281475d4a..395ac0e788 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -175,11 +175,13 @@ namespace LLPerfStats // RENDER_MESHREPO, StatType_t::RENDER_IDLE }; +#if 0 static constexpr std::initializer_list avatarStatsToAvg = { StatType_t::RENDER_GEOMETRY, StatType_t::RENDER_SHADOWS, StatType_t::RENDER_COMBINED, StatType_t::RENDER_IDLE }; +#endif if( /*sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)] != 0 ||*/ sceneStats[static_cast(StatType_t::RENDER_SLEEP)] != 0 ) @@ -291,7 +293,7 @@ namespace LLPerfStats sAverageAvatarTime = LLVOAvatar::getAverageGPURenderTime(); sMaxAvatarTime = LLVOAvatar::getMaxGPURenderTime(); - auto& general = LL::WorkQueue::getInstance("General"); + auto general = LL::WorkQueue::getInstance("General"); if (general) { -- cgit v1.2.3 From e3f9244375e3ddfb96a38afac007f0a5a68d3b46 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Fri, 12 May 2023 18:09:35 -0500 Subject: SL-19710 Fix for deadlock in LLPerfStats. Move General thread initialization to earlier in session (unrelated). --- indra/newview/llperfstats.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 395ac0e788..64e66d520b 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -146,7 +146,7 @@ namespace LLPerfStats resetChanges(); } - StatsRecorder::StatsRecorder():q(1024*16) + StatsRecorder::StatsRecorder() { // create a queue tunables.initialiseFromSettings(); @@ -292,26 +292,6 @@ namespace LLPerfStats sTotalAvatarTime = LLVOAvatar::getTotalGPURenderTime(); sAverageAvatarTime = LLVOAvatar::getAverageGPURenderTime(); sMaxAvatarTime = LLVOAvatar::getMaxGPURenderTime(); - - auto general = LL::WorkQueue::getInstance("General"); - - if (general) - { - general->post([] { StatsRecorder::update(); }); - } - } - - // called once per main loop iteration on General thread - void StatsRecorder::update() - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - StatsRecord upd; - auto& instance{ StatsRecorder::getInstance() }; - - while (enabled() && !LLApp::isQuitting() && instance.q.tryPop(upd)) - { - instance.processUpdate(upd); - } } //static -- cgit v1.2.3 From 0e10127081c97cfb7931ab9c99eb0e07ad42860a Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 27 Oct 2023 23:37:33 +0300 Subject: SL-20496 FIXED Auto-adjust causes incorrect UI value of Max number of non-impostors --- indra/newview/llperfstats.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llperfstats.cpp') diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 7ff363c3c1..6ee14c1420 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -64,7 +64,7 @@ namespace LLPerfStats { assert_main_thread(); // these following variables are proxies for pipeline statics we do not need a two way update (no llviewercontrol handler) - if( tuningFlag & NonImpostors ){ gSavedSettings.setU32("IndirectMaxNonImpostors", nonImpostors); }; + if( tuningFlag & NonImpostors ){ gSavedSettings.setU32("RenderAvatarMaxNonImpostors", nonImpostors); }; if( tuningFlag & ReflectionDetail ){ gSavedSettings.setS32("RenderReflectionDetail", reflectionDetail); }; if( tuningFlag & FarClip ){ gSavedSettings.setF32("RenderFarClip", farClip); }; if( tuningFlag & UserMinDrawDistance ){ gSavedSettings.setF32("AutoTuneRenderFarClipMin", userMinDrawDistance); }; @@ -388,7 +388,7 @@ namespace LLPerfStats 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 ); + tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : 0 ); LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; } } -- cgit v1.2.3