From dbb353d3b0e5cf3aa9d4d8062c527bb52171ef15 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 21 Oct 2011 11:53:29 -0600 Subject: fix for SH-2516: Full Bright Geometry Rendering Increases Rapidly, Destroying Frame Rate. --- indra/newview/llappviewer.cpp | 2 ++ indra/newview/llviewertexture.cpp | 47 +++++++++++++++++++++++++++++++++++ indra/newview/llviewertexture.h | 1 + indra/newview/llviewertexturelist.cpp | 7 ++++++ 4 files changed, 57 insertions(+) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4e1ef59765..152ee34bbc 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3160,6 +3160,8 @@ void LLAppViewer::handleViewerCrash() llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ; + LLMemory::logMemoryInfo(true) ; + //print out recorded call stacks if there are any. LLError::LLCallStacks::print(); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 280337be0f..786e2b73b1 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -417,6 +417,48 @@ const S32 min_non_tex_system_mem = (128<<20); // 128 MB F32 texmem_lower_bound_scale = 0.85f; F32 texmem_middle_bound_scale = 0.925f; +//static +bool LLViewerTexture::isMemoryForTextureLow() +{ + const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB + const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB + + bool low_mem = false ; + if (gGLManager.mHasATIMemInfo) + { + S32 meminfo[4]; + glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo); + + if(meminfo[0] / 1024 < MIN_FREE_TEXTURE_MEMORY) + { + low_mem = true ; + } + } +#if 0 //ignore nVidia cards + else if (gGLManager.mHasNVXMemInfo) + { + S32 free_memory; + glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &free_memory); + + if(free_memory / 1024 < MIN_FREE_TEXTURE_MEMORY) + { + low_mem = true ; + } + } +#endif + + if(!low_mem) //check main memory, only works for windows. + { + LLMemory::updateMemoryInfo() ; + if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) + { + low_mem = true ; + } + } + + return low_mem ; +} + //static void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity) { @@ -449,6 +491,11 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity sEvaluationTimer.reset(); } } + else if(sEvaluationTimer.getElapsedTimeF32() > discard_delta_time && isMemoryForTextureLow()) + { + sDesiredDiscardBias += discard_bias_delta; + sEvaluationTimer.reset(); + } else if (sDesiredDiscardBias > 0.0f && BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < sMaxBoundTextureMemInMegaBytes * texmem_lower_bound_scale && BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < sMaxTotalTextureMemInMegaBytes * texmem_lower_bound_scale) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index a4a5ae0a5b..b96441127d 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -267,6 +267,7 @@ private: /*virtual*/ LLImageGL* getGLTexture() const ; virtual void switchToCachedImage(); + static bool isMemoryForTextureLow() ; protected: LLUUID mID; S32 mBoostLevel; // enum describing priority level diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 30ef8b8a29..92d2762ef3 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1053,6 +1053,13 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) // Treat any card with < 32 MB (shudder) as having 32 MB // - it's going to be swapping constantly regardless S32 max_vram = gGLManager.mVRAM; + + if(gGLManager.mIsATI) + { + //shrink the availabe vram for ATI cards because some of them do not handel texture swapping well. + max_vram *= 0.75f; + } + max_vram = llmax(max_vram, getMinVideoRamSetting()); max_texmem = max_vram; if (!get_recommended) -- cgit v1.2.3 From 0cc30aec0f11ff22025a554782904aa0b5fa9363 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 24 Oct 2011 22:28:57 -0600 Subject: some debug code for SH-2391: [crashhunters] pre-login crash at LLViewerWindow::LLViewerWindow --- indra/llwindow/llwindowwin32.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 1239e2d40b..5f3ffd06a2 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1031,6 +1031,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhInstance, NULL); + LL_INFOS("Window") << "window is created." << llendl ; + //----------------------------------------------------------------------- // Create GL drawing context //----------------------------------------------------------------------- @@ -1120,6 +1122,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } + LL_INFOS("Window") << "Drawing context is created." << llendl ; + gGLManager.initWGL(); if (wglChoosePixelFormatARB) @@ -1256,7 +1260,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL; } - + LL_INFOS("Window") << "pixel formats done." << llendl ; S32 swap_method = 0; S32 cur_format = num_formats-1; @@ -1306,6 +1310,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhInstance, NULL); + LL_INFOS("Window") << "recreate window done." << llendl ; + if (!(mhDC = GetDC(mWindowHandle))) { close(); -- cgit v1.2.3 From 67c77496248c13a9770df6823e49d6fba522df7e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 25 Oct 2011 17:48:37 -0600 Subject: debug code for SH-2623: crash at LLViewerTextureList::removeImageFromList() --- indra/newview/llviewertexturelist.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 92d2762ef3..01eb384872 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -530,9 +530,11 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) } llerrs << "LLViewerTextureList::removeImageFromList - Image not in list" << llendl; } - if(mImageList.erase(image) != 1) + + S32 count = mImageList.erase(image) ; + if(count != 1) { - llerrs << "Error happens when remove image from mImageList!" << llendl ; + llerrs << "Error happens when remove image from mImageList: " << count << llendl ; } image->setInImageList(FALSE) ; -- cgit v1.2.3 From 0637fe27bc9f07208a1703349a304b27fc08a535 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 25 Oct 2011 22:53:40 -0600 Subject: fix for SH-2624: crash at LLPrivateMemoryPoolManager::freeMem: ASSERT (!addr) --- indra/llcommon/llmemory.cpp | 22 ++++++++++++++-------- indra/llcommon/llmemory.h | 8 ++++---- indra/newview/llappviewer.cpp | 5 +++-- 3 files changed, 21 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 7d340483b7..7167d705af 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1773,6 +1773,7 @@ void LLPrivateMemoryPool::LLChunkHashElement::remove(LLPrivateMemoryPool::LLMemo //class LLPrivateMemoryPoolManager //-------------------------------------------------------------------- LLPrivateMemoryPoolManager* LLPrivateMemoryPoolManager::sInstance = NULL ; +BOOL LLPrivateMemoryPoolManager::sPrivatePoolEnabled = FALSE ; std::vector LLPrivateMemoryPoolManager::sDanglingPoolList ; LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled) @@ -1784,7 +1785,7 @@ LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled) mPoolList[i] = NULL ; } - mPrivatePoolEnabled = enabled ; + sPrivatePoolEnabled = enabled ; } LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() @@ -1866,7 +1867,7 @@ void LLPrivateMemoryPoolManager::destroyClass() LLPrivateMemoryPool* LLPrivateMemoryPoolManager::newPool(S32 type) { - if(!mPrivatePoolEnabled) + if(!sPrivatePoolEnabled) { return NULL ; } @@ -1964,7 +1965,11 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr } else { - if(!sInstance) //the private memory manager is destroyed, try the dangling list + if(!sPrivatePoolEnabled) + { + free(addr) ; //private pool is disabled. + } + else if(!sInstance) //the private memory manager is destroyed, try the dangling list { for(S32 i = 0 ; i < sDanglingPoolList.size(); i++) { @@ -1985,12 +1990,13 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr addr = NULL ; break ; } - } + } + llassert_always(!addr) ; //addr should be release before hitting here! + } + else + { + llerrs << "private pool is used before initialized.!" << llendl ; } - - llassert_always(!addr) ; //addr should be release before hitting here! - - free(addr) ; } } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 25e6c68e88..7646bcfc25 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -394,11 +394,11 @@ public: LLPrivateMemoryPool* newPool(S32 type) ; void deletePool(LLPrivateMemoryPool* pool) ; -private: - static LLPrivateMemoryPoolManager* sInstance ; - std::vector mPoolList ; - BOOL mPrivatePoolEnabled; +private: + std::vector mPoolList ; + static LLPrivateMemoryPoolManager* sInstance ; + static BOOL sPrivatePoolEnabled; static std::vector sDanglingPoolList ; public: //debug and statistics info. diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 152ee34bbc..97a7afb354 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2003,6 +2003,8 @@ bool LLAppViewer::initThreads() static const bool enable_threads = true; #endif + LLImage::initClass(); + LLVFSThread::initClass(enable_threads && false); LLLFSThread::initClass(enable_threads && false); @@ -2012,8 +2014,7 @@ bool LLAppViewer::initThreads() LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), sImageDecodeThread, enable_threads && true, - app_metrics_qa_mode); - LLImage::initClass(); + app_metrics_qa_mode); if (LLFastTimer::sLog || LLFastTimer::sMetricLog) { -- cgit v1.2.3 From fa04683aba24c1a5dc9dabd77b8c5fabef492974 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 26 Oct 2011 11:10:18 -0600 Subject: fix for SH-2573: Flaw in Purging Texture Cache when it Exceeds Limit --- indra/newview/lltexturecache.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 87b6304f9d..d9da9eb476 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1633,8 +1633,8 @@ void LLTextureCache::purgeTextures(bool validate) { purge_count++; LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL; - removeEntry(idx, entries[idx], filename) ; cache_size -= entries[idx].mBodySize; + removeEntry(idx, entries[idx], filename) ; } } @@ -1871,13 +1871,12 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) file_maybe_exists = false; } } + mTexturesSizeTotal -= entry.mBodySize; entry.mImageSize = -1; entry.mBodySize = 0; mHeaderIDMap.erase(entry.mID); - mTexturesSizeMap.erase(entry.mID); - - mTexturesSizeTotal -= entry.mBodySize; + mTexturesSizeMap.erase(entry.mID); mFreeList.insert(idx); } -- cgit v1.2.3 From db363104dc4055b7ed15d695b23df99bb33eb1c8 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 26 Oct 2011 14:35:58 -0600 Subject: fix for SH-2586: Texture Memory (MB) preference refuses to set above 128mb (when --noprobe switch is used) --- indra/newview/llappviewerwin32.cpp | 4 +--- indra/newview/llviewertexturelist.cpp | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index f94c843ad9..647ace7ee3 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -403,11 +403,9 @@ bool LLAppViewerWin32::initHardwareTest() // if (FALSE == gSavedSettings.getBOOL("NoHardwareProbe")) { - BOOL vram_only = !gSavedSettings.getBOOL("ProbeHardwareOnStartup"); - // per DEV-11631 - disable hardware probing for everything // but vram. - vram_only = TRUE; + BOOL vram_only = TRUE; LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware")); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 01eb384872..30e5f51687 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1069,10 +1069,19 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) } else { - if (get_recommended) - max_texmem = 128; - else + if (!get_recommended) + { + max_texmem = 512; + } + else if (gSavedSettings.getBOOL("NoHardwareProbe")) //did not do hardware detection at startup + { max_texmem = 512; + } + else + { + max_texmem = 128; + } + llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl; } -- cgit v1.2.3