summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-06-29 21:00:07 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-06-29 21:23:23 +0300
commit069304ca394d4d6069f00bb976f2d75e82bf675c (patch)
treef882ecf526effeda207d418049391a315b17cc2f /indra/llwindow
parentf6515257a0cc405d6549c5d56302fb0d90176807 (diff)
parent1e4f2ec07e32a142f35817d3186a124df3f8cd25 (diff)
Merge branch 'master' (DRTVWR-543) into DRTVWR-559
# Conflicts: # autobuild.xml # indra/llrender/llgl.cpp # indra/newview/CMakeLists.txt # indra/newview/llvovolume.cpp
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/lldxhardware.cpp78
-rw-r--r--indra/llwindow/lldxhardware.h10
-rw-r--r--indra/llwindow/llwindowwin32.cpp16
3 files changed, 93 insertions, 11 deletions
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index 12a6baa3e6..81e938edbe 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -229,7 +229,7 @@ S32 LLDXHardware::getMBVideoMemoryViaWMI()
}
//Getting the version of graphics controller driver via WMI
-std::string LLDXHardware::getDriverVersionWMI()
+std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor)
{
std::string mDriverVersion;
HRESULT hrCoInitialize = S_OK;
@@ -325,15 +325,68 @@ std::string LLDXHardware::getDriverVersionWMI()
{
break; // If quantity less then 1.
}
+
+ if (vendor != GPU_ANY)
+ {
+ VARIANT vtCaptionProp;
+ // Might be preferable to check "AdapterCompatibility" here instead of caption.
+ hr = pclsObj->Get(L"Caption", 0, &vtCaptionProp, 0, 0);
+
+ if (FAILED(hr))
+ {
+ LL_WARNS("AppInit") << "Query for Caption property failed." << " Error code = 0x" << hr << LL_ENDL;
+ pSvc->Release();
+ pLoc->Release();
+ CoUninitialize();
+ return std::string(); // Program has failed.
+ }
+
+ // use characters in the returned driver version
+ BSTR caption(vtCaptionProp.bstrVal);
+
+ //convert BSTR to std::string
+ std::wstring ws(caption, SysStringLen(caption));
+ std::string caption_str(ws.begin(), ws.end());
+ LLStringUtil::toLower(caption_str);
+
+ bool found = false;
+ switch (vendor)
+ {
+ case GPU_INTEL:
+ found = caption_str.find("intel") != std::string::npos;
+ break;
+ case GPU_NVIDIA:
+ found = caption_str.find("nvidia") != std::string::npos;
+ break;
+ case GPU_AMD:
+ found = caption_str.find("amd") != std::string::npos
+ || caption_str.find("ati ") != std::string::npos
+ || caption_str.find("radeon") != std::string::npos;
+ break;
+ default:
+ break;
+ }
- VARIANT vtProp;
+ if (found)
+ {
+ VariantClear(&vtCaptionProp);
+ }
+ else
+ {
+ VariantClear(&vtCaptionProp);
+ pclsObj->Release();
+ continue;
+ }
+ }
- // Get the value of the Name property
- hr = pclsObj->Get(L"DriverVersion", 0, &vtProp, 0, 0);
+ VARIANT vtVersionProp;
+
+ // Get the value of the DriverVersion property
+ hr = pclsObj->Get(L"DriverVersion", 0, &vtVersionProp, 0, 0);
if (FAILED(hr))
{
- LL_WARNS("AppInit") << "Query for name property failed." << " Error code = 0x" << hr << LL_ENDL;
+ LL_WARNS("AppInit") << "Query for DriverVersion property failed." << " Error code = 0x" << hr << LL_ENDL;
pSvc->Release();
pLoc->Release();
CoUninitialize();
@@ -341,7 +394,7 @@ std::string LLDXHardware::getDriverVersionWMI()
}
// use characters in the returned driver version
- BSTR driverVersion(vtProp.bstrVal);
+ BSTR driverVersion(vtVersionProp.bstrVal);
//convert BSTR to std::string
std::wstring ws(driverVersion, SysStringLen(driverVersion));
@@ -354,10 +407,19 @@ std::string LLDXHardware::getDriverVersionWMI()
}
else if (mDriverVersion != str)
{
- LL_WARNS("DriverVersion") << "Different versions of drivers. Version of second driver : " << str << LL_ENDL;
+ if (vendor == GPU_ANY)
+ {
+ // Expected from systems with gpus from different vendors
+ LL_INFOS("DriverVersion") << "Multiple video drivers detected. Version of second driver: " << str << LL_ENDL;
+ }
+ else
+ {
+ // Not Expected!
+ LL_WARNS("DriverVersion") << "Multiple video drivers detected from same vendor. Version of second driver : " << str << LL_ENDL;
+ }
}
- VariantClear(&vtProp);
+ VariantClear(&vtVersionProp);
pclsObj->Release();
}
diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h
index 1cb687e3b6..9cec3e2f1b 100644
--- a/indra/llwindow/lldxhardware.h
+++ b/indra/llwindow/lldxhardware.h
@@ -88,7 +88,15 @@ public:
// vram_only TRUE does a "light" probe.
BOOL getInfo(BOOL vram_only);
- std::string getDriverVersionWMI();
+ // WMI can return multiple GPU drivers
+ // specify which one to output
+ typedef enum {
+ GPU_INTEL,
+ GPU_NVIDIA,
+ GPU_AMD,
+ GPU_ANY
+ } EGPUVendor;
+ std::string getDriverVersionWMI(EGPUVendor vendor);
S32 getVRAM() const { return mVRAM; }
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 67c50294e1..1f23040260 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -3058,8 +3058,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
if (raw->header.dwType == RIM_TYPEMOUSE)
{
LLMutexLock lock(&window_imp->mRawMouseMutex);
- window_imp->mRawMouseDelta.mX += raw->data.mouse.lLastX;
- window_imp->mRawMouseDelta.mY -= raw->data.mouse.lLastY;
+
+ S32 speed;
+ const S32 DEFAULT_SPEED(10);
+ SystemParametersInfo(SPI_GETMOUSESPEED, 0, &speed, 0);
+ if (speed == DEFAULT_SPEED)
+ {
+ window_imp->mRawMouseDelta.mX += raw->data.mouse.lLastX;
+ window_imp->mRawMouseDelta.mY -= raw->data.mouse.lLastY;
+ }
+ else
+ {
+ window_imp->mRawMouseDelta.mX += round((F32)raw->data.mouse.lLastX * (F32)speed / DEFAULT_SPEED);
+ window_imp->mRawMouseDelta.mY -= round((F32)raw->data.mouse.lLastY * (F32)speed / DEFAULT_SPEED);
+ }
}
}
}