diff options
| -rwxr-xr-x | indra/newview/app_settings/settings.xml | 11 | ||||
| -rw-r--r-- | indra/newview/llfloatertexturefetchdebugger.cpp | 91 | ||||
| -rw-r--r-- | indra/newview/llfloatertexturefetchdebugger.h | 2 | ||||
| -rwxr-xr-x | indra/newview/lltexturefetch.cpp | 180 | ||||
| -rw-r--r-- | indra/newview/lltexturefetch.h | 40 | ||||
| -rw-r--r-- | indra/newview/llviewertexture.cpp | 16 | ||||
| -rw-r--r-- | indra/newview/llviewertexture.h | 3 | ||||
| -rw-r--r-- | indra/newview/llviewertexturelist.cpp | 26 | ||||
| -rw-r--r-- | indra/newview/llviewertexturelist.h | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_texture_fetch_debugger.xml | 109 | 
10 files changed, 442 insertions, 37 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bd14580205..4a0006c357 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10719,6 +10719,17 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>TextureFetchSource</key> +    <map> +      <key>Comment</key> +      <string>Debug use: Source to fetch textures</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>S32</string> +      <key>Value</key> +      <integer>0</integer> +    </map>      <key>TextureLoadFullRes</key>      <map>        <key>Comment</key> diff --git a/indra/newview/llfloatertexturefetchdebugger.cpp b/indra/newview/llfloatertexturefetchdebugger.cpp index 2b34b72055..b6210423d1 100644 --- a/indra/newview/llfloatertexturefetchdebugger.cpp +++ b/indra/newview/llfloatertexturefetchdebugger.cpp @@ -59,6 +59,8 @@ LLFloaterTextureFetchDebugger::LLFloaterTextureFetchDebugger(const LLSD& key)  	mCommitCallbackRegistrar.add("TexFetchDebugger.RefetchVisCache",	boost::bind(&LLFloaterTextureFetchDebugger::onClickRefetchVisCache, this));  	mCommitCallbackRegistrar.add("TexFetchDebugger.RefetchVisHTTP",	boost::bind(&LLFloaterTextureFetchDebugger::onClickRefetchVisHTTP, this)); +	mCommitCallbackRegistrar.add("TexFetchDebugger.RefetchAllCache",	boost::bind(&LLFloaterTextureFetchDebugger::onClickRefetchAllCache, this)); +	mCommitCallbackRegistrar.add("TexFetchDebugger.RefetchAllHTTP",	boost::bind(&LLFloaterTextureFetchDebugger::onClickRefetchAllHTTP, this));  }  //---------------------------------------------- @@ -76,8 +78,10 @@ BOOL LLFloaterTextureFetchDebugger::postBuild(void)  	mButtonStateMap["decode_btn"] = false;  	mButtonStateMap["gl_btn"] = false; -	mButtonStateMap["refetchviscache_btn"] = true; -	mButtonStateMap["refetchvishttp_btn"] = true; +	mButtonStateMap["refetchviscache_btn"] = false; +	mButtonStateMap["refetchvishttp_btn"] = false; +	mButtonStateMap["refetchallcache_btn"] = false; +	mButtonStateMap["refetchallhttp_btn"] = false;  	updateButtons(); @@ -118,6 +122,8 @@ void LLFloaterTextureFetchDebugger::disableButtons()  	childDisable("gl_btn");  	childDisable("refetchviscache_btn");  	childDisable("refetchvishttp_btn"); +	childDisable("refetchallcache_btn"); +	childDisable("refetchallhttp_btn");  }  void LLFloaterTextureFetchDebugger::idle() @@ -130,8 +136,7 @@ void LLFloaterTextureFetchDebugger::idle()  		{  		case LLTextureFetchDebugger::IDLE:  			break; -		case LLTextureFetchDebugger::READ_CACHE: -			mButtonStateMap["cachewrite_btn"] = true; +		case LLTextureFetchDebugger::READ_CACHE:			  			mButtonStateMap["decode_btn"] = true;  			updateButtons();  			break; @@ -156,6 +161,11 @@ void LLFloaterTextureFetchDebugger::idle()  		case LLTextureFetchDebugger::REFETCH_VIS_HTTP:  			updateButtons();  			break; +		case LLTextureFetchDebugger::REFETCH_ALL_CACHE: +			updateButtons(); +		case LLTextureFetchDebugger::REFETCH_ALL_HTTP: +			updateButtons(); +			break;  		default:  			break;  		} @@ -175,8 +185,27 @@ void LLFloaterTextureFetchDebugger::onClickStart()  	mDebugger->startDebug();  	mButtonStateMap["start_btn"] = false; -	mButtonStateMap["cacheread_btn"] = true; -	mButtonStateMap["http_btn"] = true; + +	if(LLAppViewer::getTextureFetch()->canLoadFromCache()) +	{ +		mButtonStateMap["cacheread_btn"] = true; +		mButtonStateMap["http_btn"] = false; +		mButtonStateMap["refetchviscache_btn"] = true; +		mButtonStateMap["refetchvishttp_btn"] = false; +		mButtonStateMap["refetchallcache_btn"] = true; +		mButtonStateMap["refetchallhttp_btn"] = false; +		mButtonStateMap["cachewrite_btn"] = false; +	} +	else +	{ +		mButtonStateMap["cacheread_btn"] = true; +		mButtonStateMap["http_btn"] = true; +		mButtonStateMap["refetchviscache_btn"] = true; +		mButtonStateMap["refetchvishttp_btn"] = true; +		mButtonStateMap["refetchallcache_btn"] = true; +		mButtonStateMap["refetchallhttp_btn"] = true; +	} +  	updateButtons();  } @@ -256,6 +285,20 @@ void LLFloaterTextureFetchDebugger::onClickRefetchVisHTTP()  	mDebugger->debugRefetchVisibleFromHTTP();  } +void LLFloaterTextureFetchDebugger::onClickRefetchAllCache() +{ +	disableButtons(); + +	mDebugger->debugRefetchAllFromCache(); +} + +void LLFloaterTextureFetchDebugger::onClickRefetchAllHTTP() +{ +	disableButtons(); + +	mDebugger->debugRefetchAllFromHTTP(); +} +  void LLFloaterTextureFetchDebugger::draw()  {  	//total number of fetched textures @@ -368,8 +411,22 @@ void LLFloaterTextureFetchDebugger::draw()  	else  	{  		getChild<LLUICtrl>("total_time_refetch_vis_cache_label")->setTextArg("[TIME]", llformat("%.3f", mDebugger->getRefetchVisCacheTime())); -		getChild<LLUICtrl>("total_time_refetch_vis_cache_label")->setTextArg("[SIZE]", llformat("%d", mDebugger->getRefetchedData() >> 10)); -		getChild<LLUICtrl>("total_time_refetch_vis_cache_label")->setTextArg("[PIXEL]", llformat("%.3f", mDebugger->getRefetchedPixels() / 1000000.f)); +		getChild<LLUICtrl>("total_time_refetch_vis_cache_label")->setTextArg("[SIZE]", llformat("%d", mDebugger->getRefetchedVisData() >> 10)); +		getChild<LLUICtrl>("total_time_refetch_vis_cache_label")->setTextArg("[PIXEL]", llformat("%.3f", mDebugger->getRefetchedVisPixels() / 1000000.f)); +	} + +	//total time on refetching all textures from cache +	if(mDebugger->getRefetchAllCacheTime() < 0.f) +	{ +		getChild<LLUICtrl>("total_time_refetch_all_cache_label")->setTextArg("[TIME]", std::string("----")); +		getChild<LLUICtrl>("total_time_refetch_all_cache_label")->setTextArg("[SIZE]", std::string("----")); +		getChild<LLUICtrl>("total_time_refetch_all_cache_label")->setTextArg("[PIXEL]", std::string("----")); +	} +	else +	{ +		getChild<LLUICtrl>("total_time_refetch_all_cache_label")->setTextArg("[TIME]", llformat("%.3f", mDebugger->getRefetchAllCacheTime())); +		getChild<LLUICtrl>("total_time_refetch_all_cache_label")->setTextArg("[SIZE]", llformat("%d", mDebugger->getRefetchedAllData() >> 10)); +		getChild<LLUICtrl>("total_time_refetch_all_cache_label")->setTextArg("[PIXEL]", llformat("%.3f", mDebugger->getRefetchedAllPixels() / 1000000.f));  	}  	//total time on refetching visible textures from http @@ -382,8 +439,22 @@ void LLFloaterTextureFetchDebugger::draw()  	else  	{  		getChild<LLUICtrl>("total_time_refetch_vis_http_label")->setTextArg("[TIME]", llformat("%.3f", mDebugger->getRefetchVisHTTPTime())); -		getChild<LLUICtrl>("total_time_refetch_vis_http_label")->setTextArg("[SIZE]", llformat("%d", mDebugger->getRefetchedData() >> 10)); -		getChild<LLUICtrl>("total_time_refetch_vis_http_label")->setTextArg("[PIXEL]", llformat("%.3f", mDebugger->getRefetchedPixels() / 1000000.f)); +		getChild<LLUICtrl>("total_time_refetch_vis_http_label")->setTextArg("[SIZE]", llformat("%d", mDebugger->getRefetchedVisData() >> 10)); +		getChild<LLUICtrl>("total_time_refetch_vis_http_label")->setTextArg("[PIXEL]", llformat("%.3f", mDebugger->getRefetchedVisPixels() / 1000000.f)); +	} + +	//total time on refetching all textures from http +	if(mDebugger->getRefetchAllHTTPTime() < 0.f) +	{ +		getChild<LLUICtrl>("total_time_refetch_all_http_label")->setTextArg("[TIME]", std::string("----")); +		getChild<LLUICtrl>("total_time_refetch_all_http_label")->setTextArg("[SIZE]", std::string("----")); +		getChild<LLUICtrl>("total_time_refetch_all_http_label")->setTextArg("[PIXEL]", std::string("----")); +	} +	else +	{ +		getChild<LLUICtrl>("total_time_refetch_all_http_label")->setTextArg("[TIME]", llformat("%.3f", mDebugger->getRefetchAllHTTPTime())); +		getChild<LLUICtrl>("total_time_refetch_all_http_label")->setTextArg("[SIZE]", llformat("%d", mDebugger->getRefetchedAllData() >> 10)); +		getChild<LLUICtrl>("total_time_refetch_all_http_label")->setTextArg("[PIXEL]", llformat("%.3f", mDebugger->getRefetchedAllPixels() / 1000000.f));  	}  	LLFloater::draw(); diff --git a/indra/newview/llfloatertexturefetchdebugger.h b/indra/newview/llfloatertexturefetchdebugger.h index 33012c6a3d..da1bff19d5 100644 --- a/indra/newview/llfloatertexturefetchdebugger.h +++ b/indra/newview/llfloatertexturefetchdebugger.h @@ -53,6 +53,8 @@ public:  	void onClickRefetchVisCache();  	void onClickRefetchVisHTTP(); +	void onClickRefetchAllCache(); +	void onClickRefetchAllHTTP();  public:  	void idle() ; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index efb6ed6079..5e2141caf6 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -944,7 +944,7 @@ bool LLTextureFetchWorker::doWork(S32 param)  																		  offset, size, responder);  				mCacheReadTimer.reset();  			} -			else if (mUrl.empty()) +			else if (mUrl.empty() && mFetcher->canLoadFromCache())  			{  				setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it @@ -953,7 +953,7 @@ bool LLTextureFetchWorker::doWork(S32 param)  																		  offset, size, responder);  				mCacheReadTimer.reset();  			} -			else if(mCanUseHTTP) +			else if(!mUrl.empty() && mCanUseHTTP && mFetcher->canLoadFromNetwork())  			{  				if (!(mUrl.compare(0, 7, "http://") == 0))  				{ @@ -963,11 +963,15 @@ bool LLTextureFetchWorker::doWork(S32 param)  				setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority);  				mState = SEND_HTTP_REQ;  			} -			else +			else if(mFetcher->canLoadFromNetwork())  			{  				setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority);  				mState = LOAD_FROM_NETWORK;  			} +			else +			{ +				return true; //failed +			}  		}  		if (mLoaded) @@ -1015,11 +1019,15 @@ bool LLTextureFetchWorker::doWork(S32 param)  				return true;  			}  			// need more data -			else +			else if(mFetcher->canLoadFromNetwork())  			{  				LL_DEBUGS("Texture") << mID << ": Not in Cache" << LL_ENDL;  				mState = LOAD_FROM_NETWORK;  			} +			else +			{ +				return true; //failed +			}  			// fall through  			LLTextureFetch::sCacheHitRate.addValue(0.f);  		} @@ -1060,7 +1068,7 @@ bool LLTextureFetchWorker::doWork(S32 param)  		}  		if (mCanUseHTTP && !mUrl.empty())  		{ -			mState = LLTextureFetchWorker::SEND_HTTP_REQ; +			mState = SEND_HTTP_REQ;  			setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority);  			if(mWriteToCacheState != NOT_WRITE)  			{ @@ -1860,7 +1868,9 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image  	  mTotalHTTPRequests(0),  	  mCurlGetRequest(NULL),  	  mQAMode(qa_mode), -	  mFetchDebugger(NULL) +	  mFetchDebugger(NULL), +	  mFetchSource(LLTextureFetch::FROM_ALL), +	  mOriginFetchSource(LLTextureFetch::FROM_ALL)  {  	mCurlPOSTRequestCount = 0;  	mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); @@ -1870,6 +1880,13 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image  	if(LLTextureFetchDebugger::isEnabled())  	{  		mFetchDebugger = new LLTextureFetchDebugger(this, cache, imagedecodethread) ; +		mFetchSource = (e_tex_source)gSavedSettings.getS32("TextureFetchSource"); +		if(mFetchSource < 0 && mFetchSource >= INVALID_SOURCE) +		{ +			mFetchSource = LLTextureFetch::FROM_ALL; +			gSavedSettings.setS32("TextureFetchSource", 0); +		} +		mOriginFetchSource = mFetchSource;  	}  } @@ -3190,6 +3207,8 @@ void LLTextureFetchDebugger::init()  	mTotalFetchingTime = 0.f;  	mRefetchVisCacheTime = -1.f;  	mRefetchVisHTTPTime = -1.f; +	mRefetchAllCacheTime = -1.f; +	mRefetchAllHTTPTime = -1.f;  	mNumFetchedTextures = 0;  	mNumCacheHits = 0; @@ -3203,8 +3222,10 @@ void LLTextureFetchDebugger::init()  	mRenderedDecodedData = 0;  	mFetchedPixels = 0;  	mRenderedPixels = 0; -	mRefetchedData = 0; -	mRefetchedPixels = 0; +	mRefetchedVisData = 0; +	mRefetchedVisPixels = 0; +	mRefetchedAllData = 0; +	mRefetchedAllPixels = 0;  	mFreezeHistory = FALSE;  } @@ -3313,8 +3334,10 @@ void LLTextureFetchDebugger::stopDebug()  	//unlock the fetcher  	mFetcher->lockFetcher(false); +	mFetcher->resetLoadSource();  	mFreezeHistory = FALSE;  	mTotalFetchingTime = gDebugTimers[0].getElapsedTimeF32(); //reset +	mRefetchList.clear();  }  //called in the main thread and when the fetching queue is empty @@ -3328,8 +3351,25 @@ void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker)  {  	if(mFreezeHistory)  	{ -		mRefetchedPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); -		mRefetchedData += worker->mFormattedImage->getDataSize(); +		if(mState == REFETCH_VIS_CACHE || mState == REFETCH_VIS_HTTP) +		{ +			mRefetchedVisPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); +			mRefetchedVisData += worker->mFormattedImage->getDataSize(); +		} +		else +		{ +			mRefetchedAllPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); +			mRefetchedAllData += worker->mFormattedImage->getDataSize(); + +			LLViewerFetchedTexture* tex = LLViewerTextureManager::findFetchedTexture(worker->mID); +			if(tex && mRefetchList[tex].begin() != mRefetchList[tex].end()) +			{ +				if(worker->mDecodedDiscard == mFetchingHistory[mRefetchList[tex][0]].mDecodedLevel) +				{ +					mRefetchList[tex].erase(mRefetchList[tex].begin()); +				} +			} +		}  		return;  	} @@ -3341,9 +3381,8 @@ void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker)  	mDecodedData += worker->mRawImage->getDataSize();  	mFetchedPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); -	mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mDecodedDiscard, worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize())); -	//mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mHaveAllData ? 0 : worker->mLoadedDiscard, worker->mFormattedImage->getComponents(), -		//worker->mDecodedDiscard, worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize())); +	mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mDecodedDiscard,  +		worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize()));  }  void LLTextureFetchDebugger::lockCache() @@ -3360,6 +3399,7 @@ void LLTextureFetchDebugger::debugCacheRead()  	llassert_always(mState == IDLE);  	mTimer.reset();  	mState = READ_CACHE; +	mCacheReadTime = -1.f;  	S32 size = mFetchingHistory.size();  	for(S32 i = 0 ; i < size ; i++) @@ -3395,6 +3435,7 @@ void LLTextureFetchDebugger::debugCacheWrite()  	llassert_always(mState == IDLE);  	mTimer.reset();  	mState = WRITE_CACHE; +	mCacheWriteTime = -1.f;  	S32 size = mFetchingHistory.size();  	for(S32 i = 0 ; i < size ; i++) @@ -3423,6 +3464,7 @@ void LLTextureFetchDebugger::debugDecoder()  	llassert_always(mState == IDLE);  	mTimer.reset();  	mState = DECODING; +	mDecodingTime = -1.f;  	S32 size = mFetchingHistory.size();  	for(S32 i = 0 ; i < size ; i++) @@ -3458,6 +3500,7 @@ void LLTextureFetchDebugger::debugHTTP()  	mTimer.reset();  	mState = HTTP_FETCHING; +	mHTTPTime = -1.f;  	S32 size = mFetchingHistory.size();  	for (S32 i = 0 ; i < size ; i++) @@ -3529,6 +3572,8 @@ void LLTextureFetchDebugger::debugGLTextureCreation()  	}  	mTimer.reset(); +	mGLCreationTime = -1.f; +  	S32 j = 0 ;  	S32 size1 = tex_list.size();  	for(S32 i = 0 ; i < size && j < size1; i++) @@ -3561,15 +3606,54 @@ void LLTextureFetchDebugger::clearTextures()  	}  } +void LLTextureFetchDebugger::makeRefetchList() +{ +	mRefetchList.clear(); +	S32 size = mFetchingHistory.size(); +	for(S32 i = 0 ; i < size; i++) +	{		 +		LLViewerFetchedTexture* tex = LLViewerTextureManager::getFetchedTexture(mFetchingHistory[i].mID); +		if(tex && tex->isJustBound()) //visible +		{ +			continue; //the texture fetch pipeline will take care of visible textures. +		} + +		mRefetchList[tex].push_back(i); 		 +	} +} + +void LLTextureFetchDebugger::scanRefetchList() +{ +	for(std::map< LLPointer<LLViewerFetchedTexture>, std::vector<S32> >::iterator iter = mRefetchList.begin(); +		iter != mRefetchList.end(); ) +	{ +		if(iter->second.empty()) +		{ +			gTextureList.setDebugFetching(iter->first, -1); +			iter = mRefetchList.erase(iter); +		} +		else +		{ +			gTextureList.setDebugFetching(iter->first, mFetchingHistory[iter->second[0]].mDecodedLevel); +			++iter; +		} +	} +} +  void LLTextureFetchDebugger::debugRefetchVisibleFromCache()  {  	llassert_always(mState == IDLE);  	mState = REFETCH_VIS_CACHE;  	clearTextures(); +	mFetcher->setLoadSource(LLTextureFetch::FROM_CACHE_ONLY);  	mTimer.reset();  	mFetcher->lockFetcher(false); +	mRefetchVisCacheTime = -1.f; +	mRefetchedVisData = 0; +	mRefetchedVisPixels = 0; +	mRefetchStartTime = gDebugTimers[0].getElapsedTimeF32();  }  void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP() @@ -3579,9 +3663,49 @@ void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP()  	clearCache();  	clearTextures(); +	mFetcher->setLoadSource(LLTextureFetch::FROM_NETWORK_ONLY); + +	mTimer.reset(); +	mFetcher->lockFetcher(false); +	mRefetchVisHTTPTime = -1.f; +	mRefetchedVisData = 0; +	mRefetchedVisPixels = 0; +	mRefetchStartTime = gDebugTimers[0].getElapsedTimeF32(); +} + +void LLTextureFetchDebugger::debugRefetchAllFromCache() +{ +	llassert_always(mState == IDLE); +	mState = REFETCH_ALL_CACHE; + +	clearTextures(); +	makeRefetchList(); +	mFetcher->setLoadSource(LLTextureFetch::FROM_CACHE_ONLY); + +	mTimer.reset(); +	mFetcher->lockFetcher(false); +	mRefetchAllCacheTime = -1.f; +	mRefetchedAllData = 0; +	mRefetchedAllPixels = 0; +	mRefetchStartTime = gDebugTimers[0].getElapsedTimeF32(); +} + +void LLTextureFetchDebugger::debugRefetchAllFromHTTP() +{ +	llassert_always(mState == IDLE); +	mState = REFETCH_ALL_HTTP; + +	clearCache(); +	clearTextures(); +	makeRefetchList(); +	mFetcher->setLoadSource(LLTextureFetch::FROM_NETWORK_ONLY);  	mTimer.reset();  	mFetcher->lockFetcher(false); +	mRefetchAllHTTPTime = -1.f; +	mRefetchedAllData = 0; +	mRefetchedAllPixels = 0; +	mRefetchStartTime = gDebugTimers[0].getElapsedTimeF32();  }  bool LLTextureFetchDebugger::update() @@ -3627,17 +3751,41 @@ bool LLTextureFetchDebugger::update()  	case REFETCH_VIS_CACHE:  		if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)  		{ -			mRefetchVisCacheTime = gDebugTimers[0].getElapsedTimeF32() - mTotalFetchingTime; +			mRefetchVisCacheTime = gDebugTimers[0].getElapsedTimeF32() - mRefetchStartTime;  			mState = IDLE;  			mFetcher->lockFetcher(true); +			mFetcher->resetLoadSource();  		}  		break;  	case REFETCH_VIS_HTTP:  		if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)  		{ -			mRefetchVisHTTPTime = gDebugTimers[0].getElapsedTimeF32() - mTotalFetchingTime; +			mRefetchVisHTTPTime = gDebugTimers[0].getElapsedTimeF32() - mRefetchStartTime; +			mState = IDLE; +			mFetcher->lockFetcher(true); +			mFetcher->resetLoadSource(); +		} +		break; +	case REFETCH_ALL_CACHE: +		scanRefetchList(); +		if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) +		{ +			mRefetchAllCacheTime = gDebugTimers[0].getElapsedTimeF32() - mRefetchStartTime; +			mState = IDLE; +			mFetcher->lockFetcher(true); +			mFetcher->resetLoadSource(); +			mRefetchList.clear(); +		} +		break; +	case REFETCH_ALL_HTTP: +		scanRefetchList(); +		if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) +		{ +			mRefetchAllHTTPTime = gDebugTimers[0].getElapsedTimeF32() - mRefetchStartTime;  			mState = IDLE;  			mFetcher->lockFetcher(true); +			mFetcher->resetLoadSource(); +			mRefetchList.clear();  		}  		break;  	default: @@ -3692,7 +3840,7 @@ void LLTextureFetchDebugger::callbackHTTP(S32 id, const LLChannelDescriptors& ch  			U8* d_buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size);  			buffer->readAfter(channels.in(), NULL, d_buffer, data_size); -			llassert_always(mFetchingHistory[id].mFormattedImage.isNull()); +			mFetchingHistory[id].mFormattedImage = NULL;  			{  				// For now, create formatted image based on extension  				std::string texture_url = mHTTPUrl + "/?texture_id=" + mFetchingHistory[id].mID.asString().c_str(); diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 107e1623b0..ff78d34eda 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -216,18 +216,36 @@ public:  	// reporting due to either startup or a problem POSTing data.  	static volatile bool svMetricsDataBreak; +public: +	//debug use +	enum e_tex_source +	{ +		FROM_ALL = 0, +		FROM_CACHE_ONLY, +		FROM_NETWORK_ONLY, +		INVALID_SOURCE +	};  private:  	//debug use  	LLTextureFetchDebugger* mFetchDebugger;  	bool mFetcherLocked; +	 +	e_tex_source mFetchSource; +	e_tex_source mOriginFetchSource;  public:  	//debug use  	LLTextureFetchDebugger* getFetchDebugger() { return mFetchDebugger;}  	void lockFetcher(bool lock) { mFetcherLocked = lock;} + +	void setLoadSource(e_tex_source source) {mFetchSource = source;} +	void resetLoadSource() {mFetchSource = mOriginFetchSource;} +	bool canLoadFromCache() { return mFetchSource != FROM_NETWORK_ONLY;} +	bool canLoadFromNetwork() { return mFetchSource != FROM_CACHE_ONLY;}  };  //debug use +class LLViewerFetchedTexture;  class LLTextureFetchDebugger  {  	friend class LLTextureFetch; @@ -301,6 +319,8 @@ private:  	F32 mTotalFetchingTime;  	F32 mRefetchVisCacheTime;  	F32 mRefetchVisHTTPTime; +	F32 mRefetchAllCacheTime; +	F32 mRefetchAllHTTPTime;  	LLTimer mTimer; @@ -321,8 +341,10 @@ private:  	U32 mRenderedDecodedData;  	U32 mFetchedPixels;  	U32 mRenderedPixels; -	U32 mRefetchedData; -	U32 mRefetchedPixels; +	U32 mRefetchedVisData; +	U32 mRefetchedVisPixels; +	U32 mRefetchedAllData; +	U32 mRefetchedAllPixels;  	BOOL mFreezeHistory; @@ -330,6 +352,8 @@ private:  	S32 mNbCurlRequests;  	S32 mNbCurlCompleted; +	std::map< LLPointer<LLViewerFetchedTexture>, std::vector<S32> > mRefetchList; +	F32 mRefetchStartTime;  public:  	bool update(); //called in the main thread once per frame @@ -348,6 +372,8 @@ public:  	void debugGLTextureCreation();  	void debugRefetchVisibleFromCache();  	void debugRefetchVisibleFromHTTP(); +	void debugRefetchAllFromCache(); +	void debugRefetchAllFromHTTP();  	void callbackCacheRead(S32 id, bool success, LLImageFormatted* image,  						   S32 imagesize, BOOL islocal); @@ -372,8 +398,10 @@ public:  	U32  getRenderedDecodedData()        {return mRenderedDecodedData;}  	U32  getFetchedPixels()              {return mFetchedPixels;}  	U32  getRenderedPixels()             {return mRenderedPixels;} -	U32  getRefetchedData()              {return mRefetchedData;} -	U32  getRefetchedPixels()            {return mRefetchedPixels;} +	U32  getRefetchedVisData()              {return mRefetchedVisData;} +	U32  getRefetchedVisPixels()            {return mRefetchedVisPixels;} +	U32  getRefetchedAllData()              {return mRefetchedAllData;} +	U32  getRefetchedAllPixels()            {return mRefetchedAllPixels;}  	F32  getCacheReadTime()     {return mCacheReadTime;}  	F32  getCacheWriteTime()    {return mCacheWriteTime;} @@ -383,11 +411,15 @@ public:  	F32  getTotalFetchingTime() {return mTotalFetchingTime;}  	F32  getRefetchVisCacheTime() {return mRefetchVisCacheTime;}  	F32  getRefetchVisHTTPTime()  {return mRefetchVisHTTPTime;} +	F32  getRefetchAllCacheTime() {return mRefetchAllCacheTime;} +	F32  getRefetchAllHTTPTime()  {return mRefetchAllHTTPTime;}  private:  	void init();  	void clearTextures();//clear fetching results of all textures.  	void clearCache(); +	void makeRefetchList(); +	void scanRefetchList();  	void lockFetcher();  	void unlockFetcher(); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index ea329f6aac..684d1afa4f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1266,6 +1266,8 @@ void LLViewerFetchedTexture::init(bool firstinit)  	mLastReferencedSavedRawImageTime = 0.0f ;  	mKeptSavedRawImageTime = 0.f ;  	mLastCallBackActiveTime = 0.f; + +	mInDebug = FALSE;  }  LLViewerFetchedTexture::~LLViewerFetchedTexture() @@ -1898,6 +1900,20 @@ S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching()  	return current_discard ;  } +bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level) +{ +	if(debug_level < 0) +	{ +		mInDebug = FALSE; +		return false; +	} +	mInDebug = TRUE; + +	mDesiredDiscardLevel = debug_level;	 + +	return true; +} +  bool LLViewerFetchedTexture::updateFetch()  {  	static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled"); diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 41bf625225..c1ebbd9ebe 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -433,6 +433,8 @@ public:  	void setMinDiscardLevel(S32 discard) 	{ mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); }  	bool updateFetch(); +	bool setDebugFetching(S32 debug_level); +	bool isInDebug() {return mInDebug;}  	void clearFetchedResults(); //clear all fetched results, for debug use. @@ -513,6 +515,7 @@ private:  private:  	BOOL  mFullyLoaded; +	BOOL  mInDebug;  protected:		  	std::string mLocalFileName; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 2008a884db..e3b633dc0e 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -701,6 +701,11 @@ void LLViewerTextureList::updateImagesDecodePriorities()  			LLPointer<LLViewerFetchedTexture> imagep = iter->second;  			++iter; // safe to incrament now +			if(imagep->isInDebug()) +			{ +				continue; //is in debug, ignore. +			} +  			//  			// Flush formatted images using a lazy flush  			// @@ -773,6 +778,27 @@ void LLViewerTextureList::updateImagesDecodePriorities()  	}  } +void LLViewerTextureList::setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level) +{ +	if(!tex->setDebugFetching(debug_level)) +	{ +		return; +	} + +	const F32 DEBUG_PRIORITY = 100000.f; +	F32 old_priority_test = llmax(tex->getDecodePriority(), 0.0f); +	F32 decode_priority_test = DEBUG_PRIORITY; +	 +	// Ignore < 20% difference +	if ((decode_priority_test < old_priority_test * .8f) || +		(decode_priority_test > old_priority_test * 1.25f)) +	{ +		removeImageFromList(tex); +		tex->setDecodePriority(decode_priority_test); +		addImageToList(tex); +	} +} +  /*   static U8 get_image_type(LLViewerFetchedTexture* imagep, LLHost target_host)   { diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 7038ea24ce..86429fa899 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -110,6 +110,7 @@ public:  	void doPrefetchImages();  	void clearFetchingRequests(); +	void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level);  	static S32 getMinVideoRamSetting();  	static S32 getMaxVideoRamSetting(bool get_recommended = false); diff --git a/indra/newview/skins/default/xui/en/floater_texture_fetch_debugger.xml b/indra/newview/skins/default/xui/en/floater_texture_fetch_debugger.xml index 44b6a63bca..ca2f9bfd94 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_fetch_debugger.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_fetch_debugger.xml @@ -2,7 +2,7 @@  <floater
   legacy_header_height="18"
   can_minimize="false"
 - height="550"
 + height="600"
   layout="topleft"
   name="TexFetchDebugger"
   help_topic="texfetchdebugger"
 @@ -195,10 +195,34 @@    height="25"
    layout="topleft"
    left_delta="0"
 +  name="total_time_refetch_all_cache_label"
 +  top_delta="25"
 +  width="540">
 +    16, Refetching all textures from cache, Time: [TIME] seconds, Fetched: [SIZE]KB, [PIXEL]MPixels
 +  </text>
 +  <text
 +  type="string"
 +  length="1"
 +  follows="left|top"
 +  height="25"
 +  layout="topleft"
 +  left_delta="0"
    name="total_time_refetch_vis_http_label"
    top_delta="25"
    width="540">
 -    16, Refetching visibles from HTTP, Time: [TIME] seconds, Fetched: [SIZE]KB, [PIXEL]MPixels
 +    17, Refetching visibles from HTTP, Time: [TIME] seconds, Fetched: [SIZE]KB, [PIXEL]MPixels
 +  </text>
 +  <text
 +  type="string"
 +  length="1"
 +  follows="left|top"
 +  height="25"
 +  layout="topleft"
 +  left_delta="0"
 +  name="total_time_refetch_all_http_label"
 +  top_delta="25"
 +  width="540">
 +    18, Refetching all textures from HTTP, Time: [TIME] seconds, Fetched: [SIZE]KB, [PIXEL]MPixels
    </text>
    <spinner
       decimal_digits="2"
 @@ -206,7 +230,7 @@       height="20"
       increment="0.01"
       initial_value="1.0"
 -     label="17, Ratio of Texel/Pixel:"
 +     label="19, Ratio of Texel/Pixel:"
       label_width="130"
       layout="topleft"
       left_delta="0"
 @@ -218,14 +242,61 @@      <spinner.commit_callback
  		function="TexFetchDebugger.ChangeTexelPixelRatio" />
    </spinner>
 +  <text
 +  type="string"
 +  length="1"
 +  follows="left|top"
 +  height="25"
 +  layout="topleft"
 +  left_delta="0"
 +  name="texture_source_label"
 +  top_delta="30"
 +  width="110">
 +    20, Texture Source:
 +  </text>
 +  <radio_group
 +     control_name="TextureFetchSource"
 +     follows="top|left"
 +     draw_border="false"
 +     height="25"
 +     layout="topleft"
 +     left_pad="0"
 +     name="texture_source"
 +     top_delta="0"
 +     width="264">
 +    <radio_item
 +     height="16"
 +     label="Cache + Network"
 +     layout="topleft"
 +     left="3"
 +     name="0"
 +     top="0"
 +     width="100" />
 +    <radio_item
 +     height="16"
 +     label="Cache Only"
 +     layout="topleft"
 +     left_delta="120"
 +     name="1"
 +     top_delta="0"
 +     width="200" />
 +    <radio_item
 +     height="16"
 +     label="Network Only"
 +     layout="topleft"
 +     left_delta="100"
 +     name="2"
 +     top_delta="0"
 +     width="200" />
 +  </radio_group>
    <button
     follows="left|top"
     height="20"
     label="Start"
     layout="topleft"
 -   left_delta="0"
 +   left="10"
     name="start_btn"
 -   top_delta="30"
 +   top_delta="20"
     width="70">
      <button.commit_callback
  		function="TexFetchDebugger.Start" />
 @@ -261,7 +332,7 @@     layout="topleft"
     left="10"
     name="cacheread_btn"
 -   top_delta="30"
 +   top_delta="20"
     width="80">
      <button.commit_callback
  		function="TexFetchDebugger.CacheRead" />
 @@ -321,7 +392,7 @@     layout="topleft"
     left="10"
     name="refetchviscache_btn"
 -   top_delta="30"
 +   top_delta="20"
     width="120">
      <button.commit_callback
  		function="TexFetchDebugger.RefetchVisCache" />
 @@ -329,6 +400,18 @@    <button
     follows="left|top"
     height="20"
 +   label="Refetch All Cache"
 +   layout="topleft"
 +   left_pad="7"
 +   name="refetchallcache_btn"
 +   top_delta="0"
 +   width="120">
 +    <button.commit_callback
 +		function="TexFetchDebugger.RefetchAllCache" />
 +  </button>
 +  <button
 +   follows="left|top"
 +   height="20"
     label="Refetch Vis HTTP"
     layout="topleft"
     left_pad="7"
 @@ -338,4 +421,16 @@      <button.commit_callback
  		function="TexFetchDebugger.RefetchVisHTTP" />
    </button>
 +  <button
 +   follows="left|top"
 +   height="20"
 +   label="Refetch All HTTP"
 +   layout="topleft"
 +   left_pad="7"
 +   name="refetchallhttp_btn"
 +   top_delta="0"
 +   width="120">
 +    <button.commit_callback
 +		function="TexFetchDebugger.RefetchAllHTTP" />
 +  </button>
  </floater>
 | 
