Merge branch 'DRTVWR-577-maint-S' of https://github.com/secondlife/viewer

# Conflicts:
#	autobuild.xml
#	indra/newview/app_settings/settings.xml
#	indra/newview/llappviewerwin32.cpp
master
Ansariel 2023-03-28 18:07:46 +02:00
commit aac7c60449
3 changed files with 15 additions and 37 deletions

View File

@ -239,6 +239,7 @@ Ansariel Hiller
SL-15227
SL-15398
SL-18432
SL-4126
Aralara Rajal
Arare Chantilly
CHUIBUG-191

View File

@ -11187,16 +11187,16 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>NvAPISessionOverride</key>
<key>NvAPICreateApplicationProfile</key>
<map>
<key>Comment</key>
<string>Override NvAPI driver setting for maxim performance (HACK!!!)</string>
<string>Create NVIDIA application profile for optimized settings</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>PurgeCacheOnNextStartup</key>
<map>

View File

@ -308,25 +308,8 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
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());
// <FS:Ansariel> FIRE-16667 / BUG-9906: Viewer messing up the global NVIDIA driver profile
//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;
//}
NvDRSProfileHandle hProfile = 0;
// Check if we already have a Firestorm profile
// (3) Check if we already have an application profile for the viewer
status = NvAPI_DRS_FindProfileByName(hSession, profile_name, &hProfile);
if (status != NVAPI_OK && status != NVAPI_PROFILE_NOT_FOUND)
{
@ -335,8 +318,8 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
}
else if (status == NVAPI_PROFILE_NOT_FOUND)
{
// Don't have a Firestorm profile yet - create one
LL_INFOS() << "Creating Firestorm profile for NVIDIA driver" << LL_ENDL;
// Don't have an application profile yet - create one
LL_INFOS() << "Creating NVIDIA application profile" << LL_ENDL;
NVDRS_PROFILE profileInfo;
profileInfo.version = NVDRS_PROFILE_VER;
@ -351,7 +334,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
}
}
// Check if current exe is part of the profile
// (4) Check if current exe is part of the profile
std::string exe_name = gDirUtilp->getExecutableFilename();
NVDRS_APPLICATION profile_application;
profile_application.version = NVDRS_APPLICATION_VER;
@ -368,7 +351,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
}
else if (status == NVAPI_EXECUTABLE_NOT_FOUND)
{
LL_INFOS() << "Creating application for " << exe_name << " for NVIDIA driver" << LL_ENDL;
LL_INFOS() << "Creating application for " << exe_name << " for NVIDIA application profile" << LL_ENDL;
// Add this exe to the profile
NVDRS_APPLICATION application;
@ -388,13 +371,12 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
// Save application in case we added one
status = NvAPI_DRS_SaveSettings(hSession);
if (status != NVAPI_OK)
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
}
// </FS:Ansariel>
// load settings for querying
status = NvAPI_DRS_LoadSettings(hSession);
@ -410,7 +392,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
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
// (5) Specify that we want to enable maximum performance setting
// first we fill the NVDRS_SETTING struct, then we call the function
drsSetting.version = NVDRS_SETTING_VER;
drsSetting.settingId = PREFERRED_PSTATE_ID;
@ -423,7 +405,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
return;
}
// (5) Now we apply (or save) our changes to the system
// (6) Now we apply (or save) our changes to the system
status = NvAPI_DRS_SaveSettings(hSession);
if (status != NVAPI_OK)
{
@ -508,15 +490,10 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LL_WARNS() << "Application init failed." << LL_ENDL;
return -1;
}
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
// <FS:Ansariel> We fixed this the proper way and create an application profile instead of messing with the global settings
//static LLCachedControl<bool> use_nv_api(gSavedSettings, "NvAPISessionOverride", false);
//if (use_nv_api)
static LLCachedControl<bool> use_nv_api(gSavedSettings, "NvAPICreateApplicationProfile", true);
if (use_nv_api)
{
NvAPI_Status status;