summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b66a6958fe..1a71780a88 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -113,6 +113,8 @@
#include "llrendersphere.h"
#include "llskinningutil.h"
+#include "llperfstats.h"
+
#include <boost/lexical_cast.hpp>
extern F32 SPEED_ADJUST_MAX;
@@ -2544,6 +2546,9 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL;
return;
}
+ // record time and refresh "tooSlow" status
+ LLPerfStats::RecordAvatarTime T(getID(), LLPerfStats::StatType_t::RENDER_IDLE); // per avatar "idle" time.
+ updateTooSlow();
static LLCachedControl<bool> disable_all_render_types(gSavedSettings, "DisableAllRenderTypes");
if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR))
@@ -8268,6 +8273,94 @@ bool LLVOAvatar::isTooComplex() const
return too_complex;
}
+// use Avatar Render Time as complexity metric
+// markARTStale - Mark stale and set the frameupdate to now so that we can wait at least one frame to get a revised number.
+void LLVOAvatar::markARTStale()
+{
+ mARTStale=true;
+ mLastARTUpdateFrame = LLFrameTimer::getFrameCount();
+}
+
+// Udpate Avatar state based on render time
+void LLVOAvatar::updateTooSlow()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+ static LLCachedControl<bool> alwaysRenderFriends(gSavedSettings, "AlwaysRenderFriends");
+ static LLCachedControl<bool> allowSelfImpostor(gSavedSettings, "AllowSelfImpostor");
+ const auto id = getID();
+
+ // mTooSlow - Is the avatar flagged as being slow (includes shadow time)
+ // mTooSlowWithoutShadows - Is the avatar flagged as being slow even with shadows removed.
+ // mARTStale - the rendertime we have is stale because of an update. We need to force a re-render to re-assess slowness
+
+ if( mARTStale )
+ {
+ if ( LLFrameTimer::getFrameCount() - mLastARTUpdateFrame < 5 )
+ {
+ // LL_INFOS() << this->getFullname() << " marked stale " << LL_ENDL;
+ // we've not had a chance to update yet (allow a few to be certain a full frame has passed)
+ return;
+ }
+
+ mARTStale = false;
+ mTooSlow = false;
+ mTooSlowWithoutShadows = false;
+ // LL_INFOS() << this->getFullname() << " refreshed ART combined = " << mRenderTime << " @ " << mLastARTUpdateFrame << LL_ENDL;
+ }
+
+ // Either we're not stale or we've updated.
+
+ U64 render_time_raw;
+ U64 render_geom_time_raw;
+
+ if( !mTooSlow )
+ {
+ // we are fully rendered, so we use the live values
+ std::lock_guard<std::mutex> lock{LLPerfStats::bufferToggleLock};
+ render_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_COMBINED);
+ render_geom_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_GEOMETRY);
+ }
+ else
+ {
+ // use the cached values.
+ render_time_raw = mRenderTime;
+ render_geom_time_raw = mGeomTime;
+ }
+ if( (LLPerfStats::renderAvatarMaxART_ns > 0) &&
+ (LLPerfStats::raw_to_ns(render_time_raw) >= LLPerfStats::renderAvatarMaxART_ns) )
+ {
+ if( !mTooSlow ) // if we were previously not slow (with or without shadows.)
+ {
+ // if we weren't capped, we are now
+ mLastARTUpdateFrame = LLFrameTimer::getFrameCount();
+ mRenderTime = render_time_raw;
+ mGeomTime = render_geom_time_raw;
+ mARTStale = false;
+ mTooSlow = true;
+ }
+ if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap
+ {
+ bool render_friend_or_exception = ( alwaysRenderFriends && LLAvatarTracker::instance().isBuddy( id ) ) ||
+ ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER );
+ if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception )
+ {
+ // Note: slow rendering Friends still get their shadows zapped.
+ mTooSlowWithoutShadows = (LLPerfStats::raw_to_ns(render_geom_time_raw) >= LLPerfStats::renderAvatarMaxART_ns);
+ }
+ }
+ }
+ else
+ {
+ // LL_INFOS() << this->getFullname() << " ("<< (combined?"combined":"geometry") << ") good render time = " << LLPerfStats::raw_to_ns(render_time_raw) << " vs ("<< LLVOAvatar::sRenderTimeCap_ns << " set @ " << mLastARTUpdateFrame << LL_ENDL;
+ mTooSlow = false;
+ mTooSlowWithoutShadows = false;
+ }
+ if(mTooSlow)
+ {
+ LLPerfStats::tunedAvatars++; // increment the number of avatars that have been tweaked.
+ }
+}
+
//-----------------------------------------------------------------------------
// findMotion()
//-----------------------------------------------------------------------------