summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-02-14 22:49:50 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-03-03 00:27:04 +0200
commita546aa20b7a5256cb0cfcddff2f09c225c15c794 (patch)
tree04e3475d5f8854821cdf620492a4b945146f83a2 /indra/newview
parent204072d51cb6c0f742873ccd98da2c761573b587 (diff)
SL-4126 Second Life messing up NVIDIA drivers
Disable NvAPI by default
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llappviewerwin32.cpp48
2 files changed, 39 insertions, 20 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 3f6adfe13d..8e70dea36e 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8341,6 +8341,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>NvAPISessionOverride</key>
+ <map>
+ <key>Comment</key>
+ <string>Override NvAPI driver setting for maxim performance (HACK!!!)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>PurgeCacheOnNextStartup</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 0c764fe48a..b36c5a61a3 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -386,27 +386,35 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LL_WARNS() << "Application init failed." << LL_ENDL;
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);
- }
- }
+ NvDRSSessionHandle hSession = 0;
+ // Viewer shouldn't need NvAPI and this implementation alters global
+ // settings instead of viewer-only ones (SL-4126)
+ // TODO: ideally this should be removed, but temporary disabling
+ // it with a way to turn it back on in case of issues
+ static LLCachedControl<bool> use_nv_api(gSavedSettings, "NvAPISessionOverride", false);
+ if (use_nv_api)
+ {
+ NvAPI_Status status;
+
+ // Initialize NVAPI
+ status = NvAPI_Initialize();
+
+ 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)