From 88df86bcc3ed96b727ce408ef79134a910f807b1 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 7 Apr 2010 11:51:41 -0600 Subject: fix for all wierd crashes happening to lltexturecache.cpp, cuased by running viewer 2.0 and viewer 1.23 at the same time. Specifically for the following jiras: EXT-6692: crash at LLTextureCache::readEntryFromHeaderImmediately [secondlife-bin lltexturecache.cpp:1145] EXT-6691: crash at LLTextureCache::writeEntryToHeaderImmediately [secondlife-bin lltexturecache.cpp:1126] possible fix for EXT-6567: crash at LLImageBase::allocateData [secondlife-bin llimage.cpp:170] --- indra/newview/llappviewer.cpp | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 11c252406a..cdd553b9b4 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3000,9 +3000,36 @@ void LLAppViewer::migrateCacheDirectory() #endif // LL_WINDOWS || LL_DARWIN } +//static +S32 LLAppViewer::getCacheVersion() +{ + static const S32 cache_version = 7; + + return cache_version ; +} + bool LLAppViewer::initCache() { mPurgeCache = false; + BOOL disable_texture_cache = FALSE ; + BOOL read_only = mSecondInstance ? TRUE : FALSE; + LLAppViewer::getTextureCache()->setReadOnly(read_only) ; + + if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getCacheVersion()) + { + if(read_only) + { + disable_texture_cache = TRUE ; //if the cache version of this viewer is different from the running one, this viewer can not use the texture cache. + } + else + { + mPurgeCache = true; // Purge cache if the version number is different. + gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getCacheVersion()); + } + } + + if(!read_only) + { // Purge cache if user requested it if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) @@ -3010,16 +3037,6 @@ bool LLAppViewer::initCache() gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); mPurgeCache = true; } - // Purge cache if it belongs to an old version - else - { - static const S32 cache_version = 6; - if (gSavedSettings.getS32("LocalCacheVersion") != cache_version) - { - mPurgeCache = true; - gSavedSettings.setS32("LocalCacheVersion", cache_version); - } - } // We have moved the location of the cache directory over time. migrateCacheDirectory(); @@ -3034,6 +3051,7 @@ bool LLAppViewer::initCache() gSavedSettings.setString("CacheLocation", new_cache_location); gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location)); } + } if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"))) { @@ -3042,7 +3060,7 @@ bool LLAppViewer::initCache() gSavedSettings.setString("CacheLocationTopFolder", ""); } - if (mPurgeCache) + if (mPurgeCache && !read_only) { LLSplashScreen::update(LLTrans::getString("StartupClearingCache")); purgeCache(); @@ -3052,13 +3070,12 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate 80% of the cache size for textures - BOOL read_only = mSecondInstance ? TRUE : FALSE; const S32 MB = 1024*1024; S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; const S64 MAX_CACHE_SIZE = 1024*MB; cache_size = llmin(cache_size, MAX_CACHE_SIZE); S64 texture_cache_size = ((cache_size * 8)/10); - S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, read_only); + S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, disable_texture_cache); texture_cache_size -= extra; LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS")); -- cgit v1.2.3 From 09d488e20bed2f8c8397ca483e83bc59687fff87 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 25 Mar 2010 17:14:27 -0600 Subject: more fix for EXT-5711: Some textures loading from cache seems jammed. and possible fix for EXT-5704: FPS drop, and this could be cause freez and crash. --- indra/newview/llappviewer.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index cdd553b9b4..3e7ef26bcd 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1107,12 +1107,15 @@ bool LLAppViewer::mainLoop() ms_sleep(500); } - + static const F64 FRAME_SLOW_THRESHOLD = 0.5; //2 frames per seconds const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms const F64 max_idle_time = run_multiple_threads ? min_idle_time : llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second idleTimer.reset(); - while(1) + bool is_slow = (frameTimer.getElapsedTimeF64() > FRAME_SLOW_THRESHOLD) ; + S32 total_work_pending = 0; + S32 total_io_pending = 0; + while(!is_slow)//do not unpause threads if the frame rates are very low. { S32 work_pending = 0; S32 io_pending = 0; @@ -1143,6 +1146,8 @@ bool LLAppViewer::mainLoop() ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up } + total_work_pending += work_pending ; + total_io_pending += io_pending ; F64 frame_time = frameTimer.getElapsedTimeF64(); F64 idle_time = idleTimer.getElapsedTimeF64(); if (frame_time >= min_frame_time && @@ -1152,25 +1157,32 @@ bool LLAppViewer::mainLoop() break; } } - if ((LLStartUp::getStartupState() >= STATE_CLEANUP) && - (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD)) - { - gFrameStalls++; - } - frameTimer.reset(); // Prevent the worker threads from running while rendering. // if (LLThread::processorCount()==1) //pause() should only be required when on a single processor client... if (run_multiple_threads == FALSE) { - LLFastTimer ftm(FTM_PAUSE_THREADS); - + //LLFastTimer ftm(FTM_PAUSE_THREADS); //not necessary. + + if(!total_work_pending) //pause texture fetching threads if nothing to process. + { LLAppViewer::getTextureCache()->pause(); LLAppViewer::getImageDecodeThread()->pause(); - // LLAppViewer::getTextureFetch()->pause(); // Don't pause the fetch (IO) thread + LLAppViewer::getTextureFetch()->pause(); + } + if(!total_io_pending) //pause file threads if nothing to process. + { + LLVFSThread::sLocal->pause(); + LLLFSThread::sLocal->pause(); + } + } + + if ((LLStartUp::getStartupState() >= STATE_CLEANUP) && + (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD)) + { + gFrameStalls++; } - //LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering. - //LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering. + frameTimer.reset(); resumeMainloopTimeout(); -- cgit v1.2.3 From d64ccab573e9455815dede58f8027a8f2337a728 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 9 Apr 2010 23:48:50 -0600 Subject: the first round of the debug code for EXT-6792: Crash on ATI 3200 --- indra/newview/llappviewer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3e7ef26bcd..f19a33301a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2577,6 +2577,8 @@ void LLAppViewer::handleViewerCrash() { llinfos << "Handle viewer crash entry." << llendl; + llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ; + //print out recorded call stacks if there are any. LLError::LLCallStacks::print(); -- cgit v1.2.3