diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-02-13 17:28:05 -0500 | 
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-02-13 17:28:05 -0500 | 
| commit | 72dfb2abce5d5635e7f81436d65c8689d161eb37 (patch) | |
| tree | 61172e83b68ab88726d0882ec0f01b8e4b6ebd65 | |
| parent | 7fba28471a39e9ffaf866ca6cf379c6b684c0d18 (diff) | |
SH-3812 WIP, SH-3852 WIP - some metrics cleanup, added rebake when needed and sb system is unavailable, to avoid stale appearance problems
| -rwxr-xr-x[-rw-r--r--] | indra/llprimitive/llprimitive.cpp | 1 | ||||
| -rwxr-xr-x | indra/newview/llagent.cpp | 16 | ||||
| -rwxr-xr-x | indra/newview/llagentwearables.cpp | 1 | ||||
| -rwxr-xr-x | indra/newview/llvoavatar.cpp | 61 | ||||
| -rwxr-xr-x | indra/newview/llvoavatar.h | 20 | ||||
| -rwxr-xr-x | indra/newview/llvoavatarself.cpp | 81 | ||||
| -rwxr-xr-x | indra/newview/llvoavatarself.h | 5 | 
7 files changed, 114 insertions, 71 deletions
| diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 4e36723eec..faf98883d9 100644..100755 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -1246,6 +1246,7 @@ S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name  	if (tec.size == 0)  	{ +		tec.face_count = 0;  		return retval;  	} diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index d10f76ea55..e15c1a5104 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -812,6 +812,8 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id)  {  	llinfos << "called" << llendl; + +	// Old-style appearance entering a server-bake region.  	if (isAgentAvatarValid() &&  		!gAgentAvatarp->isUsingServerBakes() &&  		(mRegionp->getCentralBakeVersion()>0)) @@ -819,6 +821,14 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id)  		llinfos << "update requested due to region transition" << llendl;  		LLAppearanceMgr::instance().requestServerAppearanceUpdate();  	} +	// new-style appearance entering a non-bake region, +	// need to check for existence of the baking service. +	else if (isAgentAvatarValid() && +			 gAgentAvatarp->isUsingServerBakes() && +			 mRegionp->getCentralBakeVersion()==0) +	{ +		gAgentAvatarp->checkForUnsupportedServerBakeAppearance(); +	}  }  //----------------------------------------------------------------------------- @@ -4335,12 +4345,6 @@ void LLAgent::sendAgentSetAppearance()  		return;  	} -	if (!gAgentWearables.changeInProgress()) -	{ -		// Change is fully resolved, can close some open phases. -		gAgentAvatarp->stopPhase("process_initial_wearables_update"); -	} -  	if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return;  	// At this point we have a complete appearance to send and are in a non-baking region. diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 0c79ac0ba3..ba04991a02 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -796,7 +796,6 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs  	if (isAgentAvatarValid())  	{ -		//gAgentAvatarp->clearPhases(); // reset phase timers for outfit loading.  		gAgentAvatarp->startPhase("process_initial_wearables_update");  		gAgentAvatarp->outputRezTiming("Received initial wearables update");  	} diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 20d598d35b..5b4d57986b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4456,6 +4456,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te)  const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid)  { +	llassert(isIndexBakedTexture(ETextureIndex(te)));  	std::string url = "";  	if (isUsingServerBakes())  	{ @@ -5872,43 +5873,15 @@ BOOL LLVOAvatar::getIsCloud() const  void LLVOAvatar::updateRezzedStatusTimers()  { -	// State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. -	// Purpose is to collect time data for each period of cloud or cloud+gray. +	// State machine for rezzed status. Statuses are -1 on startup, 0 +	// = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. +	// Purpose is to collect time data for each it takes avatar to reach +	// various loading landmarks: gray, textured (partial), textured fully.  	S32 rez_status = getRezzedStatus();  	if (rez_status != mLastRezzedStatus)  	{  		LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; -#if 0 -		bool is_cloud_or_gray = (rez_status==0 || rez_status==1); -		bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); -		bool is_cloud = (rez_status==0); -		bool was_cloud = (mLastRezzedStatus==0); - -		// Non-cloud to cloud -		if (is_cloud && !was_cloud) -		{ -			// start cloud timer. -			startPhase("cloud"); -		} -		else if (was_cloud && !is_cloud) -		{ -			// stop cloud timer, which will capture stats. -			stopPhase("cloud"); -		} - -		// Non-cloud-or-gray to cloud-or-gray -		if (is_cloud_or_gray && !was_cloud_or_gray) -		{ -			// start cloud-or-gray timer. -			startPhase("cloud-or-gray"); -		} -		else if (was_cloud_or_gray && !is_cloud_or_gray) -		{ -			// stop cloud-or-gray timer, which will capture stats. -			stopPhase("cloud-or-gray"); -		} -#endif  		if (mLastRezzedStatus == -1 && rez_status != -1)  		{ @@ -5937,7 +5910,8 @@ void LLVOAvatar::updateRezzedStatusTimers()  			{  				// "fully loaded", mark any pending appearance change complete.  				selfStopPhase("update_appearance_from_cof"); -				selfStopPhase("wear_inventory_category"); +				selfStopPhase("wear_inventory_category", false); +				selfStopPhase("process_initial_wearables_update", false);  			}  		} @@ -5958,7 +5932,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name)  	{  		if (!completed)  		{ -			LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; +			LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl;  			return;  		}  	} @@ -5966,7 +5940,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name)  	getPhases().startPhase(phase_name);  } -void LLVOAvatar::stopPhase(const std::string& phase_name) +void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check)  {  	F32 elapsed;  	bool completed; @@ -5974,19 +5948,25 @@ void LLVOAvatar::stopPhase(const std::string& phase_name)  	{  		if (!completed)  		{ -			LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl;  			getPhases().stopPhase(phase_name);  			completed = true;  			logMetricsTimerRecord(phase_name, elapsed, completed); +			LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl;  		}  		else  		{ -			LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; +			if (err_check) +			{ +				LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << llendl; +			}  		}  	}  	else  	{ -		LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; +		if (err_check) +		{ +			LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << llendl; +		}  	}  } @@ -6043,9 +6023,11 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse  	record["is_self"] = isSelf(); +#if 0 // verbose logging  	std::ostringstream ostr;  	ostr << LLSDNotationStreamer(record);  	LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; +#endif  	if (isAgentAvatarValid())  	{ @@ -6264,7 +6246,8 @@ void LLVOAvatar::updateMeshTextures()  #ifndef LL_RELEASE_FOR_DOWNLOAD  			LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID);  #endif -			const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); +			ETextureIndex te = ETextureIndex(mBakedTextureDatas[i].mTextureIndex); +			const std::string url = getImageURL(te, mBakedTextureDatas[i].mLastTextureID);  			if (!url.empty())  			{  				baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c8915383ca..c989673cdf 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -294,7 +294,7 @@ public:  	void 			startPhase(const std::string& phase_name); -	void 			stopPhase(const std::string& phase_name); +	void 			stopPhase(const std::string& phase_name, bool err_check = true);  	void			clearPhases();  	void 			logPendingPhases();  	static void 	logPendingPhasesAllAvatars(); @@ -316,24 +316,6 @@ private:  	LLFrameTimer	mFullyLoadedTimer;  	LLFrameTimer	mRuthTimer; -public: -	class ScopedPhaseSetter -	{ -	public: -		ScopedPhaseSetter(LLVOAvatar *avatarp, std::string phase_name): -			mAvatar(avatarp), mPhaseName(phase_name) -		{ -			if (mAvatar) { mAvatar->getPhases().startPhase(mPhaseName); } -		} -		~ScopedPhaseSetter() -		{ -			if (mAvatar) { mAvatar->getPhases().stopPhase(mPhaseName); } -		} -	private: -		std::string mPhaseName; -		LLVOAvatar* mAvatar; -	}; -  private:  	LLViewerStats::PhaseMap mPhases; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e30d62869f..2775c9442a 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -86,11 +86,11 @@ void selfStartPhase(const std::string& phase_name)  	}  } -void selfStopPhase(const std::string& phase_name) +void selfStopPhase(const std::string& phase_name, bool err_check)  {  	if (isAgentAvatarValid())  	{ -		gAgentAvatarp->stopPhase(phase_name); +		gAgentAvatarp->stopPhase(phase_name, err_check);  	}  } @@ -179,6 +179,24 @@ bool output_self_av_texture_diagnostics()  	return false;  } +bool update_avatar_rez_metrics() +{ +	if (!isAgentAvatarValid()) +		return true; +	 +	gAgentAvatarp->updateAvatarRezMetrics(false); +	return false; +} + +bool check_for_unsupported_baked_appearance() +{ +	if (!isAgentAvatarValid()) +		return true; + +	gAgentAvatarp->checkForUnsupportedServerBakeAppearance(); +	return false; +} +  void LLVOAvatarSelf::initInstance()  {  	BOOL status = TRUE; @@ -214,7 +232,8 @@ void LLVOAvatarSelf::initInstance()  	}  	//doPeriodically(output_self_av_texture_diagnostics, 30.0); -	doPeriodically(boost::bind(&LLVOAvatarSelf::updateAvatarRezMetrics, this, false), 5.0); +	doPeriodically(update_avatar_rez_metrics, 5.0); +	doPeriodically(check_for_unsupported_baked_appearance, 120.0);  }  // virtual @@ -2371,6 +2390,62 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics()  	}  } +class CheckAgentAppearanceServiceResponder: public LLHTTPClient::Responder +{ +public: +	CheckAgentAppearanceServiceResponder() +	{ +	} +	 +	virtual ~CheckAgentAppearanceServiceResponder() +	{ +	} + +	/* virtual */ void result(const LLSD& content) +	{ +		LL_DEBUGS("Avatar") << "status OK" << llendl; +	} + +	// Error +	/*virtual*/ void error(U32 status, const std::string& reason) +	{ +		if (isAgentAvatarValid()) +		{ +			LL_DEBUGS("Avatar") << "failed, will rebake" << llendl; +			forceAppearanceUpdate(); +		} +	}	 + +	static void forceAppearanceUpdate() +	{ +		// Trying to rebake immediately after crossing region boundary +		// seems to be failure prone; adding a delay factor. Yes, this +		// fix is ad-hoc and not guaranteed to work in all cases. +		doAfterInterval(boost::bind(&LLVOAvatarSelf::forceBakeAllTextures, +									gAgentAvatarp.get(), true), 5.0); +	} +}; + +void LLVOAvatarSelf::checkForUnsupportedServerBakeAppearance() +{ +	// Need to check only if we have a server baked appearance and are +	// in a non-baking region. +	if (!gAgentAvatarp->isUsingServerBakes()) +		return; +	if (!gAgent.getRegion() || gAgent.getRegion()->getCentralBakeVersion()!=0) +		return; + +	// if baked image service is unknown, need to refresh. +	if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) +	{ +		CheckAgentAppearanceServiceResponder::forceAppearanceUpdate(); +	} +	// query baked image service to check status. +	std::string image_url = gAgentAvatarp->getImageURL(TEX_HEAD_BAKED, +													   getTE(TEX_HEAD_BAKED)->getID()); +	LLHTTPClient::head(image_url, new CheckAgentAppearanceServiceResponder); +} +  const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) const  {  	if (canGrabBakedTexture(baked_index)) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 04b0fb760c..78728cff20 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -402,6 +402,7 @@ public:  	const std::string		debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer  	const std::string		debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD  	void					sendViewerAppearanceChangeMetrics(); // send data associated with completing a change. +	void 					checkForUnsupportedServerBakeAppearance();  private:  	LLFrameTimer    		mDebugSelfLoadTimer;  	F32						mDebugTimeWearablesLoaded; @@ -421,9 +422,7 @@ extern LLPointer<LLVOAvatarSelf> gAgentAvatarp;  BOOL isAgentAvatarValid();  void selfStartPhase(const std::string& phase_name); -void selfStopPhase(const std::string& phase_name); +void selfStopPhase(const std::string& phase_name, bool err_check = true);  void selfClearPhases(); -void update_avatar_rez_metrics(bool force_send); -  #endif // LL_VO_AVATARSELF_H | 
