[Libreoffice-commits] core.git: 7 commits - vcl/opengl
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jun 3 08:46:17 PDT 2015
vcl/opengl/win/WinDeviceInfo.cxx | 229 +++++++++++++++++++++++++--------------
vcl/opengl/x11/X11DeviceInfo.cxx | 114 ++++++++++++-------
2 files changed, 222 insertions(+), 121 deletions(-)
New commits:
commit 1096ca46a23fc4df30865c243e10881157fe4840
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 17:44:24 2015 +0200
more style fixes
Change-Id: Iadf157f3d2673047e2d81c74847b16d12478ca65
diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx
index e896f05..f60f9c1 100644
--- a/vcl/opengl/x11/X11DeviceInfo.cxx
+++ b/vcl/opengl/x11/X11DeviceInfo.cxx
@@ -66,14 +66,17 @@ char* strtok_wrapper(const char* aDelims, char** aStr)
char* ret = const_cast<char*>(strspnp_wrapper(aDelims, *aStr));
- if (!*ret) {
+ if (!*ret)
+ {
*aStr = ret;
return nullptr;
}
char* i = ret;
- do {
- for (const char* d = aDelims; *d != '\0'; ++d) {
+ do
+ {
+ for (const char* d = aDelims; *d != '\0'; ++d)
+ {
if (*i == *d) {
*i = '\0';
*aStr = ++i;
commit 5ebc2673cc3337d4e6656abdfb5e18ac169d3cbd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 17:39:10 2015 +0200
that is not a TODO anymore, we actually block OpenGL in RDP connections
Change-Id: I782e93e6106b3940e7e83c615072beebca1c0965
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 86672fe..151476d 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -793,7 +793,7 @@ void WinOpenGLDeviceInfo::GetData()
if (maDeviceID.isEmpty() &&
maDeviceString == "RDPUDD Chained DD")
{
- // TODO: moggi: we need to block RDP as it does not provide OpenGL 2.1+
+ // we need to block RDP as it does not provide OpenGL 2.1+
mbRDP = true;
SAL_WARN("vcl.opengl", "RDP => blocked");
return;
commit 4d1faeec4513ee602dc1daafaebc1c4212819a7a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 17:36:40 2015 +0200
fix comment
Change-Id: I1d6fc43447c3c98e21d1d0752aa621c9ab2a92a7
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index ac7911c..86672fe 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -86,11 +86,11 @@ void GetDLLVersion(const sal_Unicode* aDLLPath, OUString& aVersion)
}
/*
-* * Compute the length of an array with constant length. (Use of this method
-* * with a non-array pointer will not compile.)
-* *
-* * Beware of the implicit trailing '\0' when using this with string constants.
-* */
+ * Compute the length of an array with constant length. (Use of this method
+ * with a non-array pointer will not compile.)
+ *
+ * Beware of the implicit trailing '\0' when using this with string constants.
+*/
template<typename T, size_t N>
size_t ArrayLength(T (&aArr)[N])
{
commit 2d06511010ea800e62c076c2583d72eccc795691
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 17:35:44 2015 +0200
document that these are references to mozilla bugs
Change-Id: Ie84924ee77805ce4b4f6d5a7e77213ce2d51877f
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 7e80390..ac7911c 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -1001,7 +1001,7 @@ void WinOpenGLDeviceInfo::GetData()
mbHasDriverVersionMismatch = false;
if (maAdapterVendorID == GetDeviceVendor(wgl::VendorIntel))
{
- // we've had big crashers (bugs 590373 and 595364) apparently correlated
+ // we've had big crashers (moz#590373 and moz#595364) apparently correlated
// with bad Intel driver installations where the DriverVersion reported
// by the registry was not the version of the DLL.
OUString aDLLFileName("igd10umd32.dll");
@@ -1031,8 +1031,6 @@ void WinOpenGLDeviceInfo::GetData()
}
}
-
-
// Macro for assigning a device vendor id to a string.
#define DECLARE_VENDOR_ID(name, deviceId) \
case name: \
@@ -1102,7 +1100,7 @@ void WinOpenGLDeviceInfo::FillBlacklist()
wgl::DRIVER_LESS_THAN, wgl::V(8,62,0,0), "9.6" );
/*
- * Bug 783517 - crashes in AMD driver on Windows 8
+ * moz#783517 - crashes in AMD driver on Windows 8
*/
APPEND_TO_DRIVER_BLOCKLIST_RANGE( wgl::DRIVER_OS_WINDOWS_8,
GetDeviceVendor(wgl::VendorATI), wgl::DriverInfo::allDevices,
@@ -1113,8 +1111,8 @@ void WinOpenGLDeviceInfo::FillBlacklist()
/* OpenGL on any ATI/AMD hardware is discouraged
* See:
- * bug 619773 - WebGL: Crash with blue screen : "NMI: Parity Check / Memory Parity Error"
- * bugs 584403, 584404, 620924 - crashes in atioglxx
+ * bug moz#619773 - WebGL: Crash with blue screen : "NMI: Parity Check / Memory Parity Error"
+ * bugs moz#584403, moz#584404, moz#620924 - crashes in atioglxx
* + many complaints about incorrect rendering
*/
APPEND_TO_DRIVER_BLOCKLIST2( wgl::DRIVER_OS_ALL,
@@ -1134,7 +1132,7 @@ void WinOpenGLDeviceInfo::FillBlacklist()
* Intel entries
*/
- /* The driver versions used here come from bug 594877. They might not
+ /* The driver versions used here come from moz#594877. They might not
* be particularly relevant anymore.
*/
#define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \
@@ -1151,7 +1149,7 @@ void WinOpenGLDeviceInfo::FillBlacklist()
// StretchRect seems to suffer from precision issues which leads to artifacting
// during content drawing starting with at least version 6.14.10.5082
- // and going until 6.14.10.5218. See bug 919454 and bug 949275 for more info.
+ // and going until 6.14.10.5218. See moz#919454 and mox#949275 for more info.
APPEND_TO_DRIVER_BLOCKLIST_RANGE(wgl::DRIVER_OS_WINDOWS_XP,
GetDeviceVendor(wgl::VendorIntel),
const_cast<wgl::DriverInfo::DeviceFamilyVector*>(wgl::DriverInfo::GetDeviceFamily(wgl::IntelGMAX4500HD)),
@@ -1181,7 +1179,7 @@ void WinOpenGLDeviceInfo::FillBlacklist()
/**
* Disable acceleration on Intel HD 3000 for graphics drivers <= 8.15.10.2321.
- * See bug 1018278 and bug 1060736.
+ * See bug moz#1018278 and bug moz#1060736.
*/
APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_ALL,
GetDeviceVendor(wgl::VendorIntel), (wgl::DriverInfo::DeviceFamilyVector*) wgl::DriverInfo::GetDeviceFamily(wgl::IntelHD3000),
commit b19ec43a426b4b69ccbb0778c9e6a81109aa65a0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 17:32:06 2015 +0200
more style clean-up
Change-Id: I46727514629103d8a97140483eca26135929a688
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 852cfba..7e80390 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -28,7 +28,8 @@ std::vector<wgl::DriverInfo> WinOpenGLDeviceInfo::maDriverInfo;
maDriverInfo.push_back(wgl::DriverInfo(os, vendor, devices, driverComparator, driverVersion, true))
#define APPEND_TO_DRIVER_BLOCKLIST_RANGE(os, vendor, devices, driverComparator, driverVersion, driverVersionMax, suggestedVersion) \
- do { \
+ do \
+ { \
assert(driverComparator == wgl::DRIVER_BETWEEN_EXCLUSIVE || \
driverComparator == wgl::DRIVER_BETWEEN_INCLUSIVE || \
driverComparator == wgl::DRIVER_BETWEEN_INCLUSIVE_START); \
@@ -110,21 +111,26 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
bool retval = true;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyLocation, 0, KEY_QUERY_VALUE, &key);
- if (result != ERROR_SUCCESS) {
+ if (result != ERROR_SUCCESS)
+ {
return false;
}
- switch (type) {
+ switch (type)
+ {
case REG_DWORD:
{
// We only use this for vram size
dwcbData = sizeof(dValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)&dValue, &dwcbData);
- if (result == ERROR_SUCCESS && resultType == REG_DWORD) {
+ if (result == ERROR_SUCCESS && resultType == REG_DWORD)
+ {
dValue = dValue / 1024 / 1024;
destString += OUString::number(int32_t(dValue));
- } else {
+ }
+ else
+ {
retval = false;
}
break;
@@ -137,17 +143,23 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)wCharValue, &dwcbData);
- if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ) {
+ if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ)
+ {
// This bit here could probably be cleaner.
bool isValid = false;
DWORD strLen = dwcbData/sizeof(wCharValue[0]);
- for (DWORD i = 0; i < strLen; i++) {
- if (wCharValue[i] == '\0') {
- if (i < strLen - 1 && wCharValue[i + 1] == '\0') {
+ for (DWORD i = 0; i < strLen; i++)
+ {
+ if (wCharValue[i] == '\0')
+ {
+ if (i < strLen - 1 && wCharValue[i + 1] == '\0')
+ {
isValid = true;
break;
- } else {
+ }
+ else
+ {
wCharValue[i] = ' ';
}
}
@@ -159,7 +171,9 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
if (isValid)
destString = OUString(wCharValue);
- } else {
+ }
+ else
+ {
retval = false;
}
@@ -174,10 +188,12 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
// The driver ID is a string like PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD, possibly
// followed by &REV_XXXX. We uppercase the string, and strip the &REV_ part
// from it, if found.
-void normalizeDriverId(OUString& driverid) {
+void normalizeDriverId(OUString& driverid)
+{
driverid = driverid.toAsciiUpperCase();
int32_t rev = driverid.indexOf("&REV_");
- if (rev != -1) {
+ if (rev != -1)
+ {
driverid = driverid.copy(0, rev - 1);
}
}
@@ -189,7 +205,8 @@ uint32_t ParseIDFromDeviceID(const OUString &key, const char *prefix, int length
OUString id = key.toAsciiUpperCase();
OUString aPrefix = OUString::fromUtf8(prefix);
int32_t start = id.indexOf(aPrefix);
- if (start != -1) {
+ if (start != -1)
+ {
id = id.copy(start + aPrefix.getLength(), length);
}
return id.toUInt32(16);
@@ -211,7 +228,8 @@ enum {
wgl::OperatingSystem WindowsVersionToOperatingSystem(int32_t aWindowsVersion)
{
- switch(aWindowsVersion) {
+ switch(aWindowsVersion)
+ {
case kWindowsXP:
return wgl::DRIVER_OS_WINDOWS_XP;
case kWindowsServer2003:
@@ -237,14 +255,18 @@ int32_t WindowsOSVersion()
OSVERSIONINFO vinfo;
- if (winVersion == kWindowsUnknown) {
+ if (winVersion == kWindowsUnknown)
+ {
vinfo.dwOSVersionInfoSize = sizeof (vinfo);
#pragma warning(push)
#pragma warning(disable:4996)
- if (!GetVersionEx(&vinfo)) {
+ if (!GetVersionEx(&vinfo))
+ {
#pragma warning(pop)
winVersion = kWindowsUnknown;
- } else {
+ }
+ else
+ {
winVersion = int32_t(vinfo.dwMajorVersion << 16) + vinfo.dwMinorVersion;
}
}
@@ -259,9 +281,12 @@ int32_t WindowsOSVersion()
// larger than .978 which would become 9780.
void PadDriverDecimal(char *aString)
{
- for (int i = 0; i < 4; i++) {
- if (!aString[i]) {
- for (int c = i; c < 4; c++) {
+ for (int i = 0; i < 4; i++)
+ {
+ if (!aString[i])
+ {
+ for (int c = i; c < 4; c++)
+ {
aString[c] = '0';
}
break;
@@ -279,19 +304,23 @@ bool SplitDriverVersion(const char *aSource, char *aAStr, char *aBStr, char *aCS
unsigned destIdx = 0;
unsigned destPos = 0;
- for (int i = 0; i < len; i++) {
- if (destIdx > ArrayLength(dest)) {
+ for (int i = 0; i < len; i++)
+ {
+ if (destIdx > ArrayLength(dest))
+ {
// Invalid format found. Ensure we don't access dest beyond bounds.
return false;
}
- if (aSource[i] == '.') {
+ if (aSource[i] == '.')
+ {
dest[destIdx++][destPos] = 0;
destPos = 0;
continue;
}
- if (destPos > 3) {
+ if (destPos > 3)
+ {
// Ignore more than 4 chars. Ensure we never access dest[destIdx]
// beyond its bounds.
continue;
@@ -303,7 +332,8 @@ bool SplitDriverVersion(const char *aSource, char *aAStr, char *aBStr, char *aCS
// Add last terminator.
dest[destIdx][destPos] = 0;
- if (destIdx != ArrayLength(dest) - 1) {
+ if (destIdx != ArrayLength(dest) - 1)
+ {
return false;
}
return true;
@@ -416,10 +446,13 @@ DriverInfo::DriverInfo(const DriverInfo& aOrig)
{
//If we're managing the lifetime of the device family, we have to make a
// copy of the original's device family.
- if (aOrig.mbDeleteDevices && aOrig.mpDevices) {
+ if (aOrig.mbDeleteDevices && aOrig.mpDevices)
+ {
mpDevices = new DeviceFamilyVector;
*mpDevices = *aOrig.mpDevices;
- } else {
+ }
+ else
+ {
mpDevices = aOrig.mpDevices;
}
@@ -449,7 +482,8 @@ const DriverInfo::DeviceFamilyVector* DriverInfo::GetDeviceFamily(DeviceFamily i
mpDeviceFamilies[id] = new wgl::DriverInfo::DeviceFamilyVector;
wgl::DriverInfo::DeviceFamilyVector* deviceFamily = mpDeviceFamilies[id];
- switch (id) {
+ switch (id)
+ {
case IntelGMA500:
APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
@@ -598,37 +632,45 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList()
wgl::OperatingSystem eOS = WindowsVersionToOperatingSystem(mnWindowsVersion);
bool match = false;
uint32_t i = 0;
- for (; i < maDriverInfo.size(); i++) {
+ for (; i < maDriverInfo.size(); i++)
+ {
if (maDriverInfo[i].meOperatingSystem != wgl::DRIVER_OS_ALL &&
maDriverInfo[i].meOperatingSystem != eOS)
{
continue;
}
- if (maDriverInfo[i].mnOperatingSystemVersion && maDriverInfo[i].mnOperatingSystemVersion != mnWindowsVersion) {
+ if (maDriverInfo[i].mnOperatingSystemVersion && maDriverInfo[i].mnOperatingSystemVersion != mnWindowsVersion)
+ {
continue;
}
if (!maDriverInfo[i].maAdapterVendor.equalsIgnoreAsciiCase(GetDeviceVendor(wgl::VendorAll)) &&
- !maDriverInfo[i].maAdapterVendor.equalsIgnoreAsciiCase(maAdapterVendorID)) {
+ !maDriverInfo[i].maAdapterVendor.equalsIgnoreAsciiCase(maAdapterVendorID))
+ {
continue;
}
- if (maDriverInfo[i].mpDevices != wgl::DriverInfo::allDevices && maDriverInfo[i].mpDevices->size()) {
+ if (maDriverInfo[i].mpDevices != wgl::DriverInfo::allDevices && maDriverInfo[i].mpDevices->size())
+ {
bool deviceMatches = false;
- for (uint32_t j = 0; j < maDriverInfo[i].mpDevices->size(); j++) {
- if ((*maDriverInfo[i].mpDevices)[j].equalsIgnoreAsciiCase(maAdapterDeviceID)) {
+ for (uint32_t j = 0; j < maDriverInfo[i].mpDevices->size(); j++)
+ {
+ if ((*maDriverInfo[i].mpDevices)[j].equalsIgnoreAsciiCase(maAdapterDeviceID))
+ {
deviceMatches = true;
break;
}
}
- if (!deviceMatches) {
+ if (!deviceMatches)
+ {
continue;
}
}
- switch (maDriverInfo[i].meComparisonOp) {
+ switch (maDriverInfo[i].meComparisonOp)
+ {
case wgl::DRIVER_LESS_THAN:
match = driverVersion < maDriverInfo[i].mnDriverVersion;
break;
@@ -665,7 +707,8 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList()
break;
}
- if (match || maDriverInfo[i].mnDriverVersion == wgl::DriverInfo::allDriverVersions) {
+ if (match || maDriverInfo[i].mnDriverVersion == wgl::DriverInfo::allDriverVersions)
+ {
// white listed drivers
if (maDriverInfo[i].mbWhitelisted)
{
@@ -697,7 +740,6 @@ bool WinOpenGLDeviceInfo::isDeviceBlocked()
// the static list after that. This order is used so that we can later escape
// out of static blocks (i.e. if we were wrong or something was patched, we
// can back out our static block without doing a release).
-
if (mbRDP)
{
SAL_WARN("vcl.opengl", "all OpenGL blocked for RDP sessions");
@@ -715,8 +757,10 @@ void WinOpenGLDeviceInfo::GetData()
mnWindowsVersion = WindowsOSVersion();
int deviceIndex = 0;
- while (EnumDisplayDevicesW(nullptr, deviceIndex, &displayDevice, 0)) {
- if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
+ while (EnumDisplayDevicesW(nullptr, deviceIndex, &displayDevice, 0))
+ {
+ if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
+ {
break;
}
deviceIndex++;
@@ -724,7 +768,8 @@ void WinOpenGLDeviceInfo::GetData()
// make sure the string is nullptr terminated
if (wcsnlen(displayDevice.DeviceKey, ArrayLength(displayDevice.DeviceKey))
- == ArrayLength(displayDevice.DeviceKey)) {
+ == ArrayLength(displayDevice.DeviceKey))
+ {
// we did not find a nullptr
SAL_WARN("vcl.opengl", "no null pointer");
return;
@@ -758,7 +803,8 @@ void WinOpenGLDeviceInfo::GetData()
HDEVINFO devinfo = SetupDiGetClassDevsW(nullptr, maDeviceID.getStr(), nullptr,
DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
- if (devinfo != INVALID_HANDLE_VALUE) {
+ if (devinfo != INVALID_HANDLE_VALUE)
+ {
HKEY key;
LONG result;
WCHAR value[255];
@@ -769,7 +815,8 @@ void WinOpenGLDeviceInfo::GetData()
devinfoData.cbSize = sizeof(devinfoData);
OUString aDriverKeyPre("System\\CurrentControlSet\\Control\\Class\\");
/* enumerate device information elements in the device information set */
- while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
+ while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData))
+ {
/* get a string that identifies the device's driver key */
if (SetupDiGetDeviceRegistryPropertyW(devinfo,
&devinfoData,
@@ -777,27 +824,35 @@ void WinOpenGLDeviceInfo::GetData()
nullptr,
(PBYTE)value,
sizeof(value),
- nullptr)) {
+ nullptr))
+ {
OUString driverKey(aDriverKeyPre);
driverKey += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.getStr(), 0, KEY_QUERY_VALUE, &key);
- if (result == ERROR_SUCCESS) {
+ if (result == ERROR_SUCCESS)
+ {
/* we've found the driver we're looking for */
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
- if (result == ERROR_SUCCESS) {
+ if (result == ERROR_SUCCESS)
+ {
maDriverVersion = OUString(value);
- } else {
+ }
+ else
+ {
// If the entry wasn't found, assume the worst (0.0.0.0).
maDriverVersion = OUString("0.0.0.0");
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
- if (result == ERROR_SUCCESS) {
+ if (result == ERROR_SUCCESS)
+ {
maDriverDate = value;
- } else {
+ }
+ else
+ {
// Again, assume the worst
maDriverDate = OUString("01-01-1970");
}
@@ -824,12 +879,14 @@ void WinOpenGLDeviceInfo::GetData()
CLSID GUID_DISPLAY_DEVICE_ARRIVAL;
HRESULT hresult = CLSIDFromString(L"{1CA05180-A699-450A-9A0C-DE4FBE3DDD89}",
&GUID_DISPLAY_DEVICE_ARRIVAL);
- if (hresult == NOERROR) {
+ if (hresult == NOERROR)
+ {
devinfo = SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL,
nullptr, nullptr,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
- if (devinfo != INVALID_HANDLE_VALUE) {
+ if (devinfo != INVALID_HANDLE_VALUE)
+ {
HKEY key;
LONG result;
WCHAR value[255];
@@ -847,7 +904,8 @@ void WinOpenGLDeviceInfo::GetData()
OUString aDriverKeyPre("System\\CurrentControlSet\\Control\\Class\\");
/* enumerate device information elements in the device information set */
- while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
+ while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData))
+ {
/* get a string that identifies the device's driver key */
if (SetupDiGetDeviceRegistryPropertyW(devinfo,
&devinfoData,
@@ -855,15 +913,18 @@ void WinOpenGLDeviceInfo::GetData()
nullptr,
(PBYTE)value,
sizeof(value),
- nullptr)) {
+ nullptr))
+ {
OUString driverKey2(aDriverKeyPre);
driverKey2 += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey2.getStr(), 0, KEY_QUERY_VALUE, &key);
- if (result == ERROR_SUCCESS) {
+ if (result == ERROR_SUCCESS)
+ {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", nullptr,
nullptr, (LPBYTE)value, &dwcbData);
- if (result != ERROR_SUCCESS) {
+ if (result != ERROR_SUCCESS)
+ {
continue;
}
aDeviceID2 = value;
@@ -874,7 +935,8 @@ void WinOpenGLDeviceInfo::GetData()
adapterDeviceID2 = ParseIDFromDeviceID(aDeviceID2, "&DEV_", 4);
appendIntegerWithPadding(aAdapterDeviceID2String, adapterDeviceID2, 4);
if (maAdapterVendorID == aAdapterVendorID2String &&
- maAdapterDeviceID == aAdapterDeviceID2String) {
+ maAdapterDeviceID == aAdapterDeviceID2String)
+ {
RegCloseKey(key);
continue;
}
@@ -882,14 +944,16 @@ void WinOpenGLDeviceInfo::GetData()
// If this device is missing driver information, it is unlikely to
// be a real display adapter.
if (!GetKeyValue(driverKey2.getStr(), L"InstalledDisplayDrivers",
- aAdapterDriver2, REG_MULTI_SZ)) {
+ aAdapterDriver2, REG_MULTI_SZ))
+ {
RegCloseKey(key);
continue;
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
- if (result != ERROR_SUCCESS) {
+ if (result != ERROR_SUCCESS)
+ {
RegCloseKey(key);
continue;
}
@@ -897,7 +961,8 @@ void WinOpenGLDeviceInfo::GetData()
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
- if (result != ERROR_SUCCESS) {
+ if (result != ERROR_SUCCESS)
+ {
RegCloseKey(key);
continue;
}
@@ -905,13 +970,15 @@ void WinOpenGLDeviceInfo::GetData()
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", nullptr,
nullptr, (LPBYTE)value, &dwcbData);
- if (result != ERROR_SUCCESS) {
+ if (result != ERROR_SUCCESS)
+ {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDesc", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
}
RegCloseKey(key);
- if (result == ERROR_SUCCESS) {
+ if (result == ERROR_SUCCESS)
+ {
mbHasDualGPU = true;
maDeviceString2 = value;
maDeviceID2 = aDeviceID2;
@@ -932,7 +999,8 @@ void WinOpenGLDeviceInfo::GetData()
}
mbHasDriverVersionMismatch = false;
- if (maAdapterVendorID == GetDeviceVendor(wgl::VendorIntel)) {
+ if (maAdapterVendorID == GetDeviceVendor(wgl::VendorIntel))
+ {
// we've had big crashers (bugs 590373 and 595364) apparently correlated
// with bad Intel driver installations where the DriverVersion reported
// by the registry was not the version of the DLL.
@@ -956,7 +1024,8 @@ void WinOpenGLDeviceInfo::GetData()
if (dllNumericVersion != driverNumericVersion &&
dllNumericVersion2 != driverNumericVersion &&
(driverNumericVersion < knownSafeMismatchVersion ||
- std::max(dllNumericVersion, dllNumericVersion2) < knownSafeMismatchVersion)) {
+ std::max(dllNumericVersion, dllNumericVersion2) < knownSafeMismatchVersion))
+ {
mbHasDriverVersionMismatch = true;
}
}
@@ -979,7 +1048,8 @@ OUString WinOpenGLDeviceInfo::GetDeviceVendor(wgl::DeviceVendor id)
mpDeviceVendors[id] = new OUString();
- switch (id) {
+ switch (id)
+ {
DECLARE_VENDOR_ID(wgl::VendorAll, "");
DECLARE_VENDOR_ID(wgl::VendorIntel, "0x8086");
DECLARE_VENDOR_ID(wgl::VendorNVIDIA, "0x10de");
@@ -1121,7 +1191,6 @@ void WinOpenGLDeviceInfo::FillBlacklist()
APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_ALL,
GetDeviceVendor(wgl::VendorMicrosoft), wgl::DriverInfo::allDevices,
wgl::DRIVER_LESS_THAN, wgl::V(6,2,0,0), "< 6.2.0.0" );
-
}
commit 20b867347cddc186b6f5a834613580fe96cb58a1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 17:05:29 2015 +0200
adapt coding style
We will not update with a new version from mozilla.
Change-Id: Icf9571e1efecee18a19760b2eb3041e3d9e6f108
diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx
index 9c1e901..e896f05 100644
--- a/vcl/opengl/x11/X11DeviceInfo.cxx
+++ b/vcl/opengl/x11/X11DeviceInfo.cxx
@@ -42,13 +42,16 @@ const char*
strspnp_wrapper(const char* aDelims, const char* aStr)
{
const char* d;
- do {
- for (d = aDelims; *d != '\0'; ++d) {
- if (*aStr == *d) {
- ++aStr;
- break;
+ do
+ {
+ for (d = aDelims; *d != '\0'; ++d)
+ {
+ if (*aStr == *d)
+ {
+ ++aStr;
+ break;
+ }
}
- }
} while (*d);
return aStr;
@@ -56,7 +59,8 @@ strspnp_wrapper(const char* aDelims, const char* aStr)
char* strtok_wrapper(const char* aDelims, char** aStr)
{
- if (!*aStr) {
+ if (!*aStr)
+ {
return nullptr;
}
@@ -141,13 +145,18 @@ void X11OpenGLDeviceInfo::GetData()
bool wait_for_glxtest_process = true;
bool waiting_for_glxtest_process_failed = false;
int waitpid_errno = 0;
- while(wait_for_glxtest_process) {
+ while(wait_for_glxtest_process)
+ {
wait_for_glxtest_process = false;
- if (waitpid(glx::glxtest_pid, &glxtest_status, 0) == -1) {
+ if (waitpid(glx::glxtest_pid, &glxtest_status, 0) == -1)
+ {
waitpid_errno = errno;
- if (waitpid_errno == EINTR) {
+ if (waitpid_errno == EINTR)
+ {
wait_for_glxtest_process = true;
- } else {
+ }
+ else
+ {
// Bug moz#718629
// ECHILD happens when the glxtest process got reaped got reaped after a PR_CreateProcess
// as per bug moz#227246. This shouldn't matter, as we still seem to get the data
@@ -168,8 +177,10 @@ void X11OpenGLDeviceInfo::GetData()
OString textureFromPixmap;
OString *stringToFill = nullptr;
char *bufptr = buf;
- if (!error) {
- while(true) {
+ if (!error)
+ {
+ while(true)
+ {
char *line = strtok_wrapper("\n", &bufptr);
if (!line)
break;
@@ -207,7 +218,8 @@ void X11OpenGLDeviceInfo::GetData()
// the actual driver version numbers should be expected to be found (whereToReadVersionNumbers)
const char *whereToReadVersionNumbers = nullptr;
const char *Mesa_in_version_string = strstr(maVersion.getStr(), "Mesa");
- if (Mesa_in_version_string) {
+ if (Mesa_in_version_string)
+ {
mbIsMesa = true;
// with Mesa, the version string contains "Mesa major.minor" and that's all the version information we get:
// there is no actual driver version info.
@@ -220,7 +232,9 @@ void X11OpenGLDeviceInfo::GetData()
mbIsLlvmpipe = true;
if (strcasestr(maRenderer.getStr(), "software rasterizer"))
mbIsOldSwrast = true;
- } else if (strstr(maVendor.getStr(), "NVIDIA Corporation")) {
+ }
+ else if (strstr(maVendor.getStr(), "NVIDIA Corporation"))
+ {
mbIsNVIDIA = true;
// with the NVIDIA driver, the version string contains "NVIDIA major.minor"
// note that here the vendor and version strings behave differently, that's why we don't put this above
@@ -228,7 +242,9 @@ void X11OpenGLDeviceInfo::GetData()
const char *NVIDIA_in_version_string = strstr(maVersion.getStr(), "NVIDIA");
if (NVIDIA_in_version_string)
whereToReadVersionNumbers = NVIDIA_in_version_string + strlen("NVIDIA");
- } else if (strstr(maVendor.getStr(), "ATI Technologies Inc")) {
+ }
+ else if (strstr(maVendor.getStr(), "ATI Technologies Inc"))
+ {
mbIsFGLRX = true;
// with the FGLRX driver, the version string only gives a OpenGL version :/ so let's return that.
// that can at least give a rough idea of how old the driver is.
@@ -236,7 +252,8 @@ void X11OpenGLDeviceInfo::GetData()
}
// read major.minor version numbers of the driver (not to be confused with the OpenGL version)
- if (whereToReadVersionNumbers) {
+ if (whereToReadVersionNumbers)
+ {
// copy into writable buffer, for tokenization
strncpy(buf, whereToReadVersionNumbers, buf_size-1);
buf[buf_size-1] = 0;
@@ -245,10 +262,12 @@ void X11OpenGLDeviceInfo::GetData()
// now try to read major.minor version numbers. In case of failure, gracefully exit: these numbers have
// been initialized as 0 anyways
char *token = strtok_wrapper(".", &bufptr);
- if (token) {
+ if (token)
+ {
mnMajorVersion = strtol(token, 0, 10);
token = strtok_wrapper(".", &bufptr);
- if (token) {
+ if (token)
+ {
mnMinorVersion = strtol(token, 0, 10);
token = strtok_wrapper(".", &bufptr);
if (token)
@@ -270,12 +289,15 @@ bool X11OpenGLDeviceInfo::isDeviceBlocked()
SAL_INFO("vcl.opengl", "OS: " << maOS);
SAL_INFO("vcl.opengl", "OSRelease: " << maOSRelease);
- if (mbIsMesa) {
- if (mbIsNouveau && version(mnMajorVersion, mnMinorVersion) < version(8,0)) {
+ if (mbIsMesa)
+ {
+ if (mbIsNouveau && version(mnMajorVersion, mnMinorVersion) < version(8,0))
+ {
SAL_WARN("vcl.opengl", "blocked driver version: old nouveau driver (requires mesa 8.0+)");
return true;
}
- else if (version(mnMajorVersion, mnMinorVersion, mnRevisionVersion) < version(7,10,3)) {
+ else if (version(mnMajorVersion, mnMinorVersion, mnRevisionVersion) < version(7,10,3))
+ {
SAL_WARN("vcl.opengl", "blocked driver version: requires at least mesa 7.10.3");
return true;
}
@@ -284,26 +306,33 @@ bool X11OpenGLDeviceInfo::isDeviceBlocked()
SAL_WARN("vcl.opengl", "blocked driver version: my broken intel driver Mesa 9.0.2");
return true;
}
- else if (mbIsOldSwrast) {
+ else if (mbIsOldSwrast)
+ {
SAL_WARN("vcl.opengl", "blocked driver version: software rasterizer");
return true;
}
- else if (mbIsLlvmpipe && version(mnMajorVersion, mnMinorVersion) < version(9, 1)) {
+ else if (mbIsLlvmpipe && version(mnMajorVersion, mnMinorVersion) < version(9, 1))
+ {
// bug moz#791905, Mesa bug 57733, fixed in Mesa 9.1 according to
// https://bugs.freedesktop.org/show_bug.cgi?id=57733#c3
SAL_WARN("vcl.opengl", "blocked driver version: fdo#57733");
return true;
}
-
- } else if (mbIsNVIDIA) {
- if (version(mnMajorVersion, mnMinorVersion, mnRevisionVersion) < version(257,21)) {
+ }
+ else if (mbIsNVIDIA)
+ {
+ if (version(mnMajorVersion, mnMinorVersion, mnRevisionVersion) < version(257,21))
+ {
SAL_WARN("vcl.opengl", "blocked driver version: nvidia requires at least 257.21");
return true;
}
- } else if (mbIsFGLRX) {
+ }
+ else if (mbIsFGLRX)
+ {
// FGLRX does not report a driver version number, so we have the OpenGL version instead.
// by requiring OpenGL 3, we effectively require recent drivers.
- if (version(mnMajorVersion, mnMinorVersion, mnRevisionVersion) < version(3, 0)) {
+ if (version(mnMajorVersion, mnMinorVersion, mnRevisionVersion) < version(3, 0))
+ {
SAL_WARN("vcl.opengl", "blocked driver version: require at least OpenGL 3 for fglrx");
return true;
}
@@ -311,11 +340,14 @@ bool X11OpenGLDeviceInfo::isDeviceBlocked()
bool unknownOS = maOS.isEmpty() || maOSRelease.isEmpty();
bool badOS = maOS.indexOf("Linux") != -1 &&
maOSRelease.indexOf("2.6.32") != -1;
- if (unknownOS || badOS) {
+ if (unknownOS || badOS)
+ {
SAL_WARN("vcl.opengl", "blocked OS version with fglrx");
return true;
}
- } else {
+ }
+ else
+ {
// like on windows, let's block unknown vendors. Think of virtual machines.
// Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
SAL_WARN("vcl.opengl", "unknown vendor => blocked");
commit 03aa4f88cf6a8993b2659f2060606577cb445c9e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jun 3 16:54:36 2015 +0200
document that it is a reference to a mozilla bug
Change-Id: Ic57a0785db05908ffd9faef30544646d2e70ee5a
diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx
index 74e84c6..9c1e901 100644
--- a/vcl/opengl/x11/X11DeviceInfo.cxx
+++ b/vcl/opengl/x11/X11DeviceInfo.cxx
@@ -116,9 +116,8 @@ void X11OpenGLDeviceInfo::GetData()
if (!glx::glxtest_pipe)
return;
- // to understand this function, see bug 639842. We retrieve the OpenGL driver information in a
+ // to understand this function, see bug moz#639842. We retrieve the OpenGL driver information in a
// separate process to protect against bad drivers.
-
enum { buf_size = 1024 };
char buf[buf_size];
ssize_t bytesread = read(glx::glxtest_pipe,
@@ -149,9 +148,9 @@ void X11OpenGLDeviceInfo::GetData()
if (waitpid_errno == EINTR) {
wait_for_glxtest_process = true;
} else {
- // Bug 718629
+ // Bug moz#718629
// ECHILD happens when the glxtest process got reaped got reaped after a PR_CreateProcess
- // as per bug 227246. This shouldn't matter, as we still seem to get the data
+ // as per bug moz#227246. This shouldn't matter, as we still seem to get the data
// from the pipe, and if we didn't, the outcome would be to blacklist anyway.
waiting_for_glxtest_process_failed = (waitpid_errno != ECHILD);
}
@@ -290,7 +289,7 @@ bool X11OpenGLDeviceInfo::isDeviceBlocked()
return true;
}
else if (mbIsLlvmpipe && version(mnMajorVersion, mnMinorVersion) < version(9, 1)) {
- // bug 791905, Mesa bug 57733, fixed in Mesa 9.1 according to
+ // bug moz#791905, Mesa bug 57733, fixed in Mesa 9.1 according to
// https://bugs.freedesktop.org/show_bug.cgi?id=57733#c3
SAL_WARN("vcl.opengl", "blocked driver version: fdo#57733");
return true;
@@ -308,7 +307,7 @@ bool X11OpenGLDeviceInfo::isDeviceBlocked()
SAL_WARN("vcl.opengl", "blocked driver version: require at least OpenGL 3 for fglrx");
return true;
}
- // Bug 724640: FGLRX + Linux 2.6.32 is a crashy combo
+ // Bug moz#724640: FGLRX + Linux 2.6.32 is a crashy combo
bool unknownOS = maOS.isEmpty() || maOSRelease.isEmpty();
bool badOS = maOS.indexOf("Linux") != -1 &&
maOSRelease.indexOf("2.6.32") != -1;
More information about the Libreoffice-commits
mailing list