diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 7cf4bc0706836e08c901b4ce176dc03ac5e836f8..ea84e4c1ea1baf971233db28fed511180828ca80 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle<F64Megabytes> sVirtualMem("virtual_mem", "virtu U32Kilobytes LLMemory::sAllocatedMemInKB(0); U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0); U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); -BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE; void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { @@ -75,10 +74,9 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) } //static -void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) +void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size) { sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); - sEnableMemoryFailurePrevention = prevent_heap_failure ; } //static @@ -158,56 +156,6 @@ void LLMemory::logMemoryInfo(BOOL update) LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ; } -//return 0: everything is normal; -//return 1: the memory pool is low, but not in danger; -//return -1: the memory pool is in danger, is about to crash. -//static -bool LLMemory::isMemoryPoolLow() -{ - static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); - const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); - static void* last_reserved_address = NULL ; - - if(!sEnableMemoryFailurePrevention) - { - return false ; //no memory failure prevention. - } - - if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory - { - return true ; - } - - if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. - { - return true ; - } - - bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD - || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; - - //check the virtual address space fragmentation - if(!is_low) - { - if(!last_reserved_address) - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - else - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - if(!last_reserved_address) //failed, try once more - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - } - - is_low = !last_reserved_address ; //allocation failed - } - - return is_low ; -} - //static U32Kilobytes LLMemory::getAvailableMemKB() { diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index f04ae5f5cbe8b7419a789e090b7cdaed49cc5e5b..24f86cc11ee3a7b5c9d0b567e2907539b8fee015 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -344,10 +344,9 @@ class LL_COMMON_API LLMemory // Return value is zero if not known. static U64 getCurrentRSS(); static void* tryToAlloc(void* address, U32 size); - static void initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure); + static void initMaxHeapSizeGB(F32Gigabytes max_heap_size); static void updateMemoryInfo() ; static void logMemoryInfo(BOOL update = FALSE); - static bool isMemoryPoolLow(); static U32Kilobytes getAvailableMemKB() ; static U32Kilobytes getMaxMemKB() ; @@ -359,7 +358,6 @@ class LL_COMMON_API LLMemory static U32Kilobytes sAllocatedPageSizeInKB ; static U32Kilobytes sMaxHeapSizeInKB; - static BOOL sEnableMemoryFailurePrevention; }; // LLRefCount moved to llrefcount.h diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 36177e00e8a4e35e33e52c44efb9316f671badef..fa4d0977b290c730acbb1c854905680c9d2e9e93 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -852,10 +852,6 @@ bool LLGLManager::initGL() stop_glerror(); - setToDebugGPU(); - - stop_glerror(); - initGLStates(); stop_glerror(); @@ -863,8 +859,6 @@ bool LLGLManager::initGL() return true; } -//void LLGLManager::setToDebugGPU() - void LLGLManager::getGLInfo(LLSD& info) { if (gHeadlessClient) diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 95cc1899eed1c9554dd3f47e04dba9105c04d5e3..3d597a23fea1af9c27b62d7ce2a26fdfed904e57 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -173,7 +173,6 @@ class LLGLManager void initExtensions(); void initGLStates(); void initGLImages(); - void setToDebugGPU(); }; extern LLGLManager gGLManager; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 52dc4744f2bd56d739c699ea70987bee7a70886c..0b9cc781328c2e23e414483975b2431bc18deb36 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6564,7 +6564,7 @@ <key>Value</key> <integer>1</integer> </map> - <key>MemoryFailurePreventionEnabled</key> + <key>MemoryFailurePreventionEnabled</key> <!-- deprecated, only used for obsolete-in-2020 Intel 965 Express GPU --> <map> <key>Comment</key> <string>If set, the viewer will quit to avoid crash when memory failure happens</string> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9452028174376b5c6ed8b60b6ca858a1fd6ca92a..4c4848390fbe750434b7fc9fc41470c4ddb9edff 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1280,36 +1280,8 @@ void LLAppViewer::initMaxHeapSize() //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ; F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ; - BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; - LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; -} - -void LLAppViewer::checkMemory() -{ - const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second - //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds - //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; - - return ; - - if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) - { - return ; - } - mMemCheckTimer.reset() ; - - //update the availability of memory - LLMemory::updateMemoryInfo() ; - - bool is_low = LLMemory::isMemoryPoolLow() ; - - LLPipeline::throttleNewMemoryAllocation(is_low) ; - - if(is_low) - { - LLMemory::logMemoryInfo() ; - } + LLMemory::initMaxHeapSizeGB(max_heap_size_gb); } static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages"); @@ -1388,9 +1360,6 @@ bool LLAppViewer::doFrame() //clear call stack records LL_CLEAR_CALLSTACKS(); - //check memory availability information - checkMemory() ; - { pingMainloopTimeout("Main:MiscNativeWindowEvents"); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 8f0f54de3becf1cbb6ff023652f64e90357dab75..f3c5f5b500ff0d108acdb6e628ab8451b629b951 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -230,7 +230,6 @@ class LLAppViewer : public LLApp bool initConfiguration(); // Initialize settings from the command line/config file. void initStrings(); // Initialize LLTrans machinery bool initCache(); // Initialize local client cache. - void checkMemory() ; // We have switched locations of both Mac and Windows cache, make sure // files migrate and old cache is cleared out. @@ -306,8 +305,6 @@ class LLAppViewer : public LLApp LLAllocator mAlloc; - LLFrameTimer mMemCheckTimer; - // llcorehttp library init/shutdown helper LLAppCoreHttp mAppCoreHttp; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 1edf8fd47cbb5ca001ee7ad72cc96046025367a6..8b8273d18304d4b259cfa477228d0680dc341389 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -204,7 +204,7 @@ void LLViewerDynamicTexture::postRender(BOOL success) BOOL LLViewerDynamicTexture::updateAllInstances() { sNumRenders = 0; - if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled) + if (gGLManager.mIsDisabled) { return TRUE; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index caf79edfe4ac12c73b93617344806c2358d4c300..0c112047de51978b57ece9fff239c17c5b063960 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -745,10 +745,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glViewport(0,0,512,512); LLVOAvatar::updateFreezeCounter() ; - if(!LLPipeline::sMemAllocationThrottled) - { - LLVOAvatar::updateImpostors(); - } + LLVOAvatar::updateImpostors(); set_current_projection(proj); set_current_modelview(mod); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a2cec9a6133f676376cc3623b747b12541df5164..6a3cdafecb3d9690dca89a200b26fce1d9254b10 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3289,13 +3289,6 @@ void LLViewerLODTexture::processTextureStats() { mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); } - else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. - { - if(scaleDown()) - { - mDesiredDiscardLevel = mCachedRawDiscardLevel; - } - } } bool LLViewerLODTexture::scaleDown() diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index da0f98851d64d132d4f8b6b5d62d493681b2e754..053e18d627ec263157c75d1643b3fa62fdc011ad 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4789,10 +4789,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei return FALSE; } //check if there is enough memory for the snapshot image - if(LLPipeline::sMemAllocationThrottled) - { - return FALSE ; //snapshot taking is disabled due to memory restriction. - } if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K { if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 604c5f770de6783993d8c20d25a84d2c47f1d683..a898c2668b8a39accbe1f9f4dc4bdc870a6d4674 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -347,7 +347,6 @@ bool LLPipeline::sRenderFrameTest = false; bool LLPipeline::sRenderAttachedLights = true; bool LLPipeline::sRenderAttachedParticles = true; bool LLPipeline::sRenderDeferred = false; -bool LLPipeline::sMemAllocationThrottled = false; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; bool LLPipeline::sRenderingHUDs; @@ -717,24 +716,6 @@ void LLPipeline::destroyGL() static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); -//static -void LLPipeline::throttleNewMemoryAllocation(bool disable) -{ - if(sMemAllocationThrottled != disable) - { - sMemAllocationThrottled = disable ; - - if(sMemAllocationThrottled) - { - //send out notification - LLNotification::Params params("LowMemory"); - LLNotifications::instance().add(params); - - //release some memory. - } - } -} - void LLPipeline::requestResizeScreenTexture() { gResizeScreenTexture = TRUE; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 600bdd9d06dc1aba6baba86a462f9fca789267ea..d93d6cb50c8667eb9317f209202c1d9c2afb85c0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -413,10 +413,6 @@ class LLPipeline static void updateRenderDeferred(); static void refreshCachedSettings(); - static void throttleNewMemoryAllocation(bool disable); - - - void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector<U32>& restoreList ); @@ -598,7 +594,6 @@ class LLPipeline static bool sRenderAttachedLights; static bool sRenderAttachedParticles; static bool sRenderDeferred; - static bool sMemAllocationThrottled; static S32 sVisibleLightCount; static F32 sMinRenderSize; static bool sRenderingHUDs;