From a546aa20b7a5256cb0cfcddff2f09c225c15c794 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 14 Feb 2023 22:49:50 +0200 Subject: SL-4126 Second Life messing up NVIDIA drivers Disable NvAPI by default --- indra/newview/app_settings/settings.xml | 11 ++++++++ indra/newview/llappviewerwin32.cpp | 48 +++++++++++++++++++-------------- 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 @@ Value 1 + NvAPISessionOverride + + Comment + Override NvAPI driver setting for maxim performance (HACK!!!) + Persist + 1 + Type + Boolean + Value + 0 + PurgeCacheOnNextStartup Comment 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 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) -- cgit v1.2.3