diff options
Diffstat (limited to 'indra/llwindow/lldxhardware.cpp')
-rw-r--r-- | indra/llwindow/lldxhardware.cpp | 128 |
1 files changed, 82 insertions, 46 deletions
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index ab43e6d7d9..3579b5d42f 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -2,30 +2,25 @@ * @file lldxhardware.cpp * @brief LLDXHardware implementation * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -46,6 +41,7 @@ #include "llstring.h" #include "llstl.h" +#include "lltimer.h" void (*gWriteDebug)(const char* msg) = NULL; LLDXHardware gDXHardware; @@ -150,7 +146,7 @@ S32 LLVersion::getField(const S32 field_num) } } -LLString LLDXDriverFile::dump() +std::string LLDXDriverFile::dump() { if (gWriteDebug) { @@ -233,10 +229,11 @@ LLDXHardware::LLDXHardware() void LLDXHardware::cleanup() { - for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer()); + // for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer()); } -LLString LLDXHardware::dumpDevices() +/* +std::string LLDXHardware::dumpDevices() { if (gWriteDebug) { @@ -284,6 +281,7 @@ LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::strin return NULL; } +*/ BOOL LLDXHardware::getInfo(BOOL vram_only) { @@ -296,13 +294,13 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) IDxDiagProvider *dx_diag_providerp = NULL; IDxDiagContainer *dx_diag_rootp = NULL; IDxDiagContainer *devices_containerp = NULL; - IDxDiagContainer *system_device_containerp= NULL; + // IDxDiagContainer *system_device_containerp= NULL; IDxDiagContainer *device_containerp = NULL; IDxDiagContainer *file_containerp = NULL; IDxDiagContainer *driver_containerp = NULL; // CoCreate a IDxDiagProvider* - llinfos << "CoCreateInstance IID_IDxDiagProvider" << llendl; + LL_DEBUGS("AppInit") << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL; hr = CoCreateInstance(CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER, @@ -311,7 +309,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) if (FAILED(hr)) { - llwarns << "No DXDiag provider found! DirectX 9 not installed!" << llendl; + LL_WARNS("AppInit") << "No DXDiag provider found! DirectX 9 not installed!" << LL_ENDL; gWriteDebug("No DXDiag provider found! DirectX 9 not installed!\n"); goto LCleanup; } @@ -329,14 +327,14 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) dx_diag_init_params.bAllowWHQLChecks = TRUE; dx_diag_init_params.pReserved = NULL; - llinfos << "dx_diag_providerp->Initialize" << llendl; + LL_DEBUGS("AppInit") << "dx_diag_providerp->Initialize" << LL_ENDL; hr = dx_diag_providerp->Initialize(&dx_diag_init_params); if(FAILED(hr)) { goto LCleanup; } - llinfos << "dx_diag_providerp->GetRootContainer" << llendl; + LL_DEBUGS("AppInit") << "dx_diag_providerp->GetRootContainer" << LL_ENDL; hr = dx_diag_providerp->GetRootContainer( &dx_diag_rootp ); if(FAILED(hr) || !dx_diag_rootp) { @@ -346,7 +344,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) HRESULT hr; // Get display driver information - llinfos << "dx_diag_rootp->GetChildContainer" << llendl; + LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer" << LL_ENDL; hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp); if(FAILED(hr) || !devices_containerp) { @@ -354,7 +352,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) } // Get device 0 - llinfos << "devices_containerp->GetChildContainer" << llendl; + LL_DEBUGS("AppInit") << "devices_containerp->GetChildContainer" << LL_ENDL; hr = devices_containerp->GetChildContainer(L"0", &device_containerp); if(FAILED(hr) || !device_containerp) { @@ -362,28 +360,35 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) } // Get the English VRAM string - std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish"); + { + std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish"); - // We don't need the device any more - SAFE_RELEASE(device_containerp); + // We don't need the device any more + SAFE_RELEASE(device_containerp); + + // Dump the string as an int into the structure + char *stopstring; + mVRAM = strtol(ram_str.c_str(), &stopstring, 10); + LL_INFOS("AppInit") << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << LL_ENDL; + } - // Dump the string as an int into the structure - char *stopstring; - mVRAM = strtol(ram_str.c_str(), &stopstring, 10); - llinfos << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << llendl; - if (vram_only) { ok = TRUE; goto LCleanup; } + + /* for now, we ONLY do vram_only the rest of this + is commented out, to ensure no-one is tempted + to use it + // Now let's get device and driver information // Get the IDxDiagContainer object called "DxDiag_SystemDevices". // This call may take some time while dxdiag gathers the info. DWORD num_devices = 0; WCHAR wszContainer[256]; - llinfos << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << llendl; + LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << LL_ENDL; hr = dx_diag_rootp->GetChildContainer(L"DxDiag_SystemDevices", &system_device_containerp); if (FAILED(hr)) { @@ -396,7 +401,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) goto LCleanup; } - llinfos << "DX9 iterating over devices" << llendl; + LL_DEBUGS("AppInit") << "DX9 iterating over devices" << LL_ENDL; S32 device_num = 0; for (device_num = 0; device_num < (S32)num_devices; device_num++) { @@ -504,15 +509,16 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) } SAFE_RELEASE(device_containerp); } + */ } - dumpDevices(); - ok = TRUE; - + // dumpDevices(); + ok = TRUE; + LCleanup: if (!ok) { - llwarns << "DX9 probe failed" << llendl; + LL_WARNS("AppInit") << "DX9 probe failed" << LL_ENDL; gWriteDebug("DX9 probe failed\n"); } @@ -526,7 +532,7 @@ LCleanup: CoUninitialize(); return ok; -} + } LLSD LLDXHardware::getDisplayInfo() { @@ -613,7 +619,37 @@ LLSD LLDXHardware::getDisplayInfo() ret["DeviceName"] = device_name; std::string device_driver= get_string(device_containerp, L"szDriverVersion"); ret["DriverVersion"] = device_driver; - } + + // ATI has a slightly different version string + if(device_name.length() >= 4 && device_name.substr(0,4) == "ATI ") + { + // get the key + HKEY hKey; + const DWORD RV_SIZE = 100; + WCHAR release_version[RV_SIZE]; + + // Hard coded registry entry. Using this since it's simpler for now. + // And using EnumDisplayDevices to get a registry key also requires + // a hard coded Query value. + if(ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\ATI Technologies\\CBT"), &hKey)) + { + // get the value + DWORD dwType = REG_SZ; + DWORD dwSize = sizeof(WCHAR) * RV_SIZE; + if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("ReleaseVersion"), + NULL, &dwType, (LPBYTE)release_version, &dwSize)) + { + // print the value + // windows doesn't guarantee to be null terminated + release_version[RV_SIZE - 1] = NULL; + ret["DriverVersion"] = utf16str_to_utf8str(release_version); + + } + RegCloseKey(hKey); + } + } + } + LCleanup: SAFE_RELEASE(file_containerp); SAFE_RELEASE(driver_containerp); |