From c0fffdea8812e5eed8da9f341d3bfc9590301ada Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Jan 2012 16:11:06 -0500 Subject: SH-2789 WIP --- indra/newview/llappviewerwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 647ace7ee3..8087453ee5 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -117,7 +117,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 - _CrtSetDbgFlag(0); // default, just making explicit + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // default, just making explicit ULONG ulEnableLFH = 2; HANDLE* hHeaps = new HANDLE[MAX_HEAPS]; -- cgit v1.2.3 From d1987a3002efc7252b98e2e570746c66c43e6dd1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 6 Jun 2012 14:28:21 -0400 Subject: SH-2789 FIX - windows debug heap off by default --- indra/newview/llappviewerwin32.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/llappviewerwin32.cpp (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp old mode 100644 new mode 100755 index 418df8a5b0..53c77fa22e --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -130,7 +130,9 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // default, just making explicit + // Enable to get mem debugging within visual studio. + //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + _CrtSetDbgFlag(0); // default, just making explicit ULONG ulEnableLFH = 2; HANDLE* hHeaps = new HANDLE[MAX_HEAPS]; -- cgit v1.2.3 From 4a5ad357930f0bede4d84b9810978e9d0c5d268b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 20 Jul 2012 11:42:15 -0500 Subject: MAINT-570 Remove unused memory tracking system LLMemType --- indra/newview/llappviewerwin32.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index bad60a9757..2be090af0a 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -32,7 +32,6 @@ #include "llappviewerwin32.h" -#include "llmemtype.h" #include "llwindowwin32.h" // *FIX: for setting gIconResource. #include "llgl.h" @@ -117,8 +116,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, #endif // _DEBUG #endif // INCLUDE_VLD - LLMemType mt1(LLMemType::MTYPE_STARTUP); - const S32 MAX_HEAPS = 255; DWORD heap_enable_lfh_error[MAX_HEAPS]; S32 num_heaps = 0; -- cgit v1.2.3 From a766e26db46c7c054bae1021470dbe365f2a3cb3 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Mon, 10 Sep 2012 10:37:02 -0700 Subject: Backing out the changes contributing to DRTVWR-167 and DRTVWR-179 from the repository. --- indra/newview/llappviewerwin32.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 53c77fa22e..bad60a9757 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -130,8 +130,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 - // Enable to get mem debugging within visual studio. - //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(0); // default, just making explicit ULONG ulEnableLFH = 2; -- cgit v1.2.3 From 97d969a338c1e4f973eb817ba7701aff51a02ccb Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 12 Sep 2012 14:36:37 -0400 Subject: initial attempt to restore changes that make removing tcmalloc possible; not tested --- indra/newview/llappviewerwin32.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index bad60a9757..53c77fa22e 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -130,6 +130,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 + // Enable to get mem debugging within visual studio. + //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(0); // default, just making explicit ULONG ulEnableLFH = 2; -- cgit v1.2.3 From c69855f2333f9fb094e235b84d275d43fdeda3c3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 1 Oct 2012 16:26:12 -0500 Subject: Only enable breakpad error handing if crash reporting is enabled --- indra/newview/llappviewerwin32.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 53c77fa22e..e0ca1232b0 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -131,7 +131,9 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 // Enable to get mem debugging within visual studio. - //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#if LL_DEBUG + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#else _CrtSetDbgFlag(0); // default, just making explicit ULONG ulEnableLFH = 2; @@ -145,6 +147,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, else heap_enable_lfh_error[i] = GetLastError(); } +#endif #endif // *FIX: global -- cgit v1.2.3 From a36b66bd145e99a8f597f1c7c3b48ca30bdd7029 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 7 Nov 2012 16:03:54 -0600 Subject: MAINT-1815 Fix for excessive memory usage in Mayfair. Disable tcmalloc. Disable private memory pools. Make viewer large address aware on windows. Reviewed by Kelly --- indra/newview/llappviewerwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index e0ca1232b0..11790d562f 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -125,7 +125,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit -#elif 1 +#elif 0 // Experimental - enable the low fragmentation heap // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 -- cgit v1.2.3 From 7491fbd677148e38898bb1a39d00ffd15e803ed4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Nov 2012 17:40:43 -0600 Subject: MAINT-1841 Use NVAPI to force NVIDIA GPU power management mode to prefer max performance Reviewed by Simon. --- indra/newview/llappviewerwin32.cpp | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 510ec47a31..23eb558755 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -46,6 +46,11 @@ #include "llviewercontrol.h" #include "lldxhardware.h" +#include "nvapi/nvapi.h" +#include "nvapi/NvApiDriverSettings.h" + +#include + #include "llweb.h" #include "llsecondlifeurls.h" @@ -60,6 +65,7 @@ #include "llwindebug.h" #endif + // *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib // The lib was compiled under VS2005 - in VS2003 we need to remap assert #ifdef LL_DEBUG @@ -75,6 +81,20 @@ extern "C" { const std::string LLAppViewerWin32::sWindowClass = "Second Life"; +/* + This function is used to print to the command line a text message + describing the nvapi error and quits +*/ +void nvapi_error(NvAPI_Status status) +{ + NvAPI_ShortString szDesc = {0}; + NvAPI_GetErrorMessage(status, szDesc); + llwarns << szDesc << llendl; + + //should always trigger when asserts are enabled + llassert(status == NVAPI_OK); +} + // Create app mutex creates a unique global windows object. // If the object can be created it returns true, otherwise // it returns false. The false result can be used to determine @@ -96,6 +116,79 @@ bool create_app_mutex() return result; } +void ll_nvapi_init(NvDRSSessionHandle hSession) +{ + // (2) load all the system settings into the session + NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession); + if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } + + NvAPI_UnicodeString profile_name; + std::string app_name = LLTrans::getString("APP_NAME"); + llutf16string w_app_name = utf8str_to_utf16str(app_name); + wsprintf(profile_name, L"%s", w_app_name.c_str()); + status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name); + if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } + + // (3) Obtain the current profile. + NvDRSProfileHandle hProfile = 0; + status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile); + if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } + + // load settings for querying + status = NvAPI_DRS_LoadSettings(hSession); + if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } + + //get the preferred power management mode for Second Life + NVDRS_SETTING drsSetting = {0}; + drsSetting.version = NVDRS_SETTING_VER; + status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting); + if (status == NVAPI_SETTING_NOT_FOUND) + { //only override if the user hasn't specifically set this setting + // (4) Specify that we want the VSYNC disabled setting + // first we fill the NVDRS_SETTING struct, then we call the function + drsSetting.version = NVDRS_SETTING_VER; + drsSetting.settingId = PREFERRED_PSTATE_ID; + drsSetting.settingType = NVDRS_DWORD_TYPE; + drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX; + status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting); + if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } + } + else if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } + + + + // (5) Now we apply (or save) our changes to the system + status = NvAPI_DRS_SaveSettings(hSession); + if (status != NVAPI_OK) + { + nvapi_error(status); + } +} + //#define DEBUGGING_SEH_FILTER 1 #if DEBUGGING_SEH_FILTER # define WINMAIN DebuggingWinMain @@ -165,6 +258,27 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, return -1; } + NvAPI_Status status; + + // Initialize NVAPI + status = NvAPI_Initialize(); + NvDRSSessionHandle hSession = 0; + + if (status == NVAPI_OK) + { + // Create the session handle to access driver settings + status = NvAPI_DRS_CreateSession(&hSession); + if (status != NVAPI_OK) + { + nvapi_error(status); + } + else + { + //override driver setting as needed + ll_nvapi_init(hSession); + } + } + // Have to wait until after logging is initialized to display LFH info if (num_heaps > 0) { @@ -232,6 +346,15 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, LLAppViewer::sUpdaterInfo = NULL ; } + + + // (NVAPI) (6) We clean up. This is analogous to doing a free() + if (hSession) + { + NvAPI_DRS_DestroySession(hSession); + hSession = 0; + } + return 0; } -- cgit v1.2.3 From f3e407ae3f05e897de0b0d7daea4d31f09e73048 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 13:50:26 -0500 Subject: SH-3852 WIP - removed avatar metrics from ViewerAssetMetrics --- indra/newview/llappviewerwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 8326be433e..82b93b52a2 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -92,7 +92,7 @@ void nvapi_error(NvAPI_Status status) llwarns << szDesc << llendl; //should always trigger when asserts are enabled - llassert(status == NVAPI_OK); + //llassert(status == NVAPI_OK); } // Create app mutex creates a unique global windows object. -- cgit v1.2.3 From bf6182daa8b4d7cea79310547f71d7a3155e17b0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 29 Mar 2013 07:50:08 -0700 Subject: Update Mac and Windows breakpad builds to latest --- indra/newview/llappviewerwin32.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/newview/llappviewerwin32.cpp (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From e20099155378fd10f7997e36ae8ef150c8c5ad91 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 2 Apr 2013 15:01:25 -0400 Subject: change initLogging virtual functions to void (returns were ignored anyway) --- indra/newview/llappviewerwin32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 8326be433e..786ceb453c 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -509,9 +509,9 @@ bool LLAppViewerWin32::cleanup() return result; } -bool LLAppViewerWin32::initLogging() +void LLAppViewerWin32::initLogging() { - return LLAppViewer::initLogging(); + LLAppViewer::initLogging(); } void LLAppViewerWin32::initConsole() -- cgit v1.2.3 From c19200eb000c958bd03645ed616bbd3a1db76735 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 30 May 2013 17:01:28 -0700 Subject: BUG-2707 add some logging to help narrow down what part of login instance handling is going awry --- indra/newview/llappviewerwin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 0ba3669487..2a7656ae0a 100755 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -490,7 +490,7 @@ bool LLAppViewerWin32::init() // (Don't send our data to Microsoft--at least until we are Logo approved and have a way // of getting the data back from them.) // - llinfos << "Turning off Windows error reporting." << llendl; + // llinfos << "Turning off Windows error reporting." << llendl; disableWinErrorReporting(); #ifndef LL_RELEASE_FOR_DOWNLOAD -- cgit v1.2.3 From edf0a0c7f5dcfee2010447bc877515b70d1b1059 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 4 Jun 2013 16:26:11 -0400 Subject: fix modified virtual function names in platform-specific modules --- indra/newview/llappviewerwin32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 2a7656ae0a..3cf3c739d9 100755 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -509,9 +509,9 @@ bool LLAppViewerWin32::cleanup() return result; } -void LLAppViewerWin32::initLogging() +void LLAppViewerWin32::initLoggingAndGetLastDuration() { - LLAppViewer::initLogging(); + LLAppViewer::initLoggingAndGetLastDuration(); } void LLAppViewerWin32::initConsole() -- cgit v1.2.3 From 91c9cc4c33f68f4f39e23763317a76ccb573c38b Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 12 Aug 2013 11:09:05 -0700 Subject: Save SL NVAPI profile only when changes have been made. --- indra/newview/llappviewerwin32.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 3cf3c739d9..80a80f4298 100755 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -172,21 +172,20 @@ void ll_nvapi_init(NvDRSSessionHandle hSession) nvapi_error(status); return; } + + // (5) Now we apply (or save) our changes to the system + status = NvAPI_DRS_SaveSettings(hSession); + if (status != NVAPI_OK) + { + nvapi_error(status); + return; + } } else if (status != NVAPI_OK) { nvapi_error(status); return; } - - - - // (5) Now we apply (or save) our changes to the system - status = NvAPI_DRS_SaveSettings(hSession); - if (status != NVAPI_OK) - { - nvapi_error(status); - } } //#define DEBUGGING_SEH_FILTER 1 -- cgit v1.2.3