Rebased ref, commits from common ancestor: commit 551fd0ec64c774fa46b177f2a77c59f668645954 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Jun 5 03:47:30 2015 +0200
add license header to blacklist file Change-Id: I19edaf928ab4d99b5d3c399b59e26d515c2265b0 diff --git a/vcl/opengl/opengl_blacklist_windows.xml b/vcl/opengl/opengl_blacklist_windows.xml index 6ff92d0..310bae0 100644 --- a/vcl/opengl/opengl_blacklist_windows.xml +++ b/vcl/opengl/opengl_blacklist_windows.xml @@ -1,3 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +--> <root> <whitelist> <entry os="7" vendor="intel" compare="equal" version="10.18.10.3412"> commit a42ff0b771ccdf21ace297f91b372523a97b01da Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Jun 5 02:32:01 2015 +0200 install blacklist into user profile Change-Id: I2571fcdde1689f1a168a5c5d6bd20785ce018927 diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 8cb05ba..c278517 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -23,6 +23,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ CustomTarget_afm_hash \ Library_vcl \ Package_opengl \ + Package_opengl_blacklist \ $(if $(filter DESKTOP,$(BUILD_TYPE)), \ StaticLibrary_vclmain \ $(if $(ENABLE_HEADLESS),, \ diff --git a/vcl/Package_opengl_blacklist.mk b/vcl/Package_opengl_blacklist.mk new file mode 100644 index 0000000..b858a56 --- /dev/null +++ b/vcl/Package_opengl_blacklist.mk @@ -0,0 +1,16 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Package_Package,vcl_opengl_blacklist,$(SRCDIR)/vcl/opengl)) + +$(eval $(call gb_Package_add_files,vcl_opengl_blacklist,$(LIBO_SHARE_PRESETS_FOLDER)/config,\ + opengl_blacklist_windows.xml \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/opengl/win/blacklist.xml b/vcl/opengl/opengl_blacklist_windows.xml similarity index 100% rename from vcl/opengl/win/blacklist.xml rename to vcl/opengl/opengl_blacklist_windows.xml commit 101e7b12c9a0c725175a5ce79e1e2b30d547a272 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Jun 4 17:39:48 2015 +0200 remove all traces of old device code Change-Id: I792749951f11e99504c708bf27bec56c2d98019e diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx index 37779a5..0c60b35 100644 --- a/vcl/inc/opengl/win/WinDeviceInfo.hxx +++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx @@ -47,22 +47,6 @@ enum VersionComparisonOp { DRIVER_COMPARISON_IGNORED }; -enum DeviceFamily { - IntelGMA500, - IntelGMA900, - IntelGMA950, - IntelGMA3150, - IntelGMAX3000, - IntelGMAX4500HD, - IntelHD3000, - IntelMobileHDGraphics, - NvidiaBlockD3D9Layers, - RadeonX1000, - Geforce7300GT, - Nvidia310M, - DeviceFamilyMax -}; - enum DeviceVendor { VendorAll, VendorIntel, @@ -77,15 +61,8 @@ bool ParseDriverVersion(const OUString& rString, uint64_t& rVersion); struct DriverInfo { - typedef std::vector<OUString> DeviceFamilyVector; - - // If |ownDevices| is true, you are transferring ownership of the devices - // array, and it will be deleted when this GfxDriverInfo is destroyed. - - DriverInfo(OperatingSystem os, const OUString& vendor, DeviceFamilyVector* devices, - VersionComparisonOp op, - uint64_t driverVersion, bool bWhiteListed = false, const char *suggestedVersion = nullptr, - bool ownDevices = false); + DriverInfo(OperatingSystem os, const OUString& vendor, VersionComparisonOp op, + uint64_t driverVersion, bool bWhiteListed = false, const char *suggestedVersion = nullptr); DriverInfo(); DriverInfo(const DriverInfo&); @@ -96,8 +73,6 @@ struct DriverInfo OUString maAdapterVendor; - static DeviceFamilyVector* const allDevices; - DeviceFamilyVector* mpDevices; std::vector<OUString> maDevices; // Whether the mDevices array should be deleted when this structure is @@ -113,9 +88,6 @@ struct DriverInfo uint64_t mnDriverVersionMax; static uint64_t allDriverVersions; - static const DeviceFamilyVector* GetDeviceFamily(DeviceFamily id); - static DeviceFamilyVector* mpDeviceFamilies[DeviceFamilyMax]; - OUString maSuggestedVersion; OUString maMsg; }; diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx index d69ee1a..0479358 100644 --- a/vcl/opengl/win/WinDeviceInfo.cxx +++ b/vcl/opengl/win/WinDeviceInfo.cxx @@ -18,26 +18,6 @@ OUString* WinOpenGLDeviceInfo::mpDeviceVendors[wgl::DeviceVendorMax]; std::vector<wgl::DriverInfo> WinOpenGLDeviceInfo::maDriverInfo; -#define APPEND_TO_DRIVER_BLOCKLIST(os, vendor, devices, driverComparator, driverVersion, suggestedVersion) \ - maDriverInfo.push_back(wgl::DriverInfo(os, vendor, devices, driverComparator, driverVersion, false, suggestedVersion)) - -#define APPEND_TO_DRIVER_BLOCKLIST2(os, vendor, devices, driverComparator, driverVersion) \ - maDriverInfo.push_back(wgl::DriverInfo(os, vendor, devices, driverComparator, driverVersion)) - -#define APPEND_TO_DRIVER_WHITELIST(os, vendor, devices, driverComparator, driverVersion) \ - 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 \ - { \ - assert(driverComparator == wgl::DRIVER_BETWEEN_EXCLUSIVE || \ - driverComparator == wgl::DRIVER_BETWEEN_INCLUSIVE || \ - driverComparator == wgl::DRIVER_BETWEEN_INCLUSIVE_START); \ - wgl::DriverInfo info(os, vendor, devices, driverComparator, driverVersion, false, suggestedVersion); \ - info.mnDriverVersionMax = driverVersionMax; \ - maDriverInfo.push_back(info); \ - } while (false) - namespace { @@ -399,16 +379,11 @@ bool ParseDriverVersion(const OUString& aVersion, uint64_t& rNumericVersion) } uint64_t DriverInfo::allDriverVersions = ~(uint64_t(0)); -DriverInfo::DeviceFamilyVector* const DriverInfo::allDevices = nullptr; - -DriverInfo::DeviceFamilyVector* DriverInfo::mpDeviceFamilies[DeviceFamilyMax]; DriverInfo::DriverInfo() : meOperatingSystem(wgl::DRIVER_OS_UNKNOWN), mnOperatingSystemVersion(0), maAdapterVendor(WinOpenGLDeviceInfo::GetDeviceVendor(VendorAll)), - mpDevices(allDevices), - mbDeleteDevices(false), mbWhitelisted(false), meComparisonOp(DRIVER_COMPARISON_IGNORED), mnDriverVersion(0), @@ -416,17 +391,13 @@ DriverInfo::DriverInfo() {} DriverInfo::DriverInfo(OperatingSystem os, const OUString& vendor, - DeviceFamilyVector* devices, VersionComparisonOp op, uint64_t driverVersion, bool bWhitelisted, - const char *suggestedVersion /* = nullptr */, - bool ownDevices /* = false */) + const char *suggestedVersion /* = nullptr */) : meOperatingSystem(os), mnOperatingSystemVersion(0), maAdapterVendor(vendor), - mpDevices(devices), - mbDeleteDevices(ownDevices), mbWhitelisted(bWhitelisted), meComparisonOp(op), mnDriverVersion(driverVersion), @@ -445,169 +416,10 @@ DriverInfo::DriverInfo(const DriverInfo& aOrig) mnDriverVersion(aOrig.mnDriverVersion), mnDriverVersionMax(aOrig.mnDriverVersionMax) { - //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) - { - mpDevices = new DeviceFamilyVector; - *mpDevices = *aOrig.mpDevices; - } - else - { - mpDevices = aOrig.mpDevices; - } - - mbDeleteDevices = aOrig.mbDeleteDevices; } DriverInfo::~DriverInfo() { - if (mbDeleteDevices) - delete mpDevices; -} - -// Macros for appending a device to the DeviceFamily. -#define APPEND_DEVICE(device) APPEND_DEVICE2(#device) -#define APPEND_DEVICE2(device) deviceFamily->push_back(OUString("#device")) - -const DriverInfo::DeviceFamilyVector* DriverInfo::GetDeviceFamily(DeviceFamily id) -{ - // The code here is too sensitive to fall through to the default case if the - // code is invalid. - assert(id >= 0 && id < DeviceFamilyMax); - - // If it already exists, we must have processed it once, so return it now. - if (mpDeviceFamilies[id]) - return mpDeviceFamilies[id]; - - mpDeviceFamilies[id] = new wgl::DriverInfo::DeviceFamilyVector; - wgl::DriverInfo::DeviceFamilyVector* deviceFamily = mpDeviceFamilies[id]; - - switch (id) - { - case IntelGMA500: - APPEND_DEVICE(0x8108); /* IntelGMA500_1 */ - APPEND_DEVICE(0x8109); /* IntelGMA500_2 */ - break; - case IntelGMA900: - APPEND_DEVICE(0x2582); /* IntelGMA900_1 */ - APPEND_DEVICE(0x2782); /* IntelGMA900_2 */ - APPEND_DEVICE(0x2592); /* IntelGMA900_3 */ - APPEND_DEVICE(0x2792); /* IntelGMA900_4 */ - break; - case IntelGMA950: - APPEND_DEVICE(0x2772); /* Intel945G_1 */ - APPEND_DEVICE(0x2776); /* Intel945G_2 */ - APPEND_DEVICE(0x27a2); /* Intel945_1 */ - APPEND_DEVICE(0x27a6); /* Intel945_2 */ - APPEND_DEVICE(0x27ae); /* Intel945_3 */ - break; - case IntelGMA3150: - APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */ - APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */ - APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */ - APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */ - break; - case IntelGMAX3000: - APPEND_DEVICE(0x2972); /* Intel946GZ_1 */ - APPEND_DEVICE(0x2973); /* Intel946GZ_2 */ - APPEND_DEVICE(0x2982); /* IntelG35_1 */ - APPEND_DEVICE(0x2983); /* IntelG35_2 */ - APPEND_DEVICE(0x2992); /* IntelQ965_1 */ - APPEND_DEVICE(0x2993); /* IntelQ965_2 */ - APPEND_DEVICE(0x29a2); /* IntelG965_1 */ - APPEND_DEVICE(0x29a3); /* IntelG965_2 */ - APPEND_DEVICE(0x29b2); /* IntelQ35_1 */ - APPEND_DEVICE(0x29b3); /* IntelQ35_2 */ - APPEND_DEVICE(0x29c2); /* IntelG33_1 */ - APPEND_DEVICE(0x29c3); /* IntelG33_2 */ - APPEND_DEVICE(0x29d2); /* IntelQ33_1 */ - APPEND_DEVICE(0x29d3); /* IntelQ33_2 */ - APPEND_DEVICE(0x2a02); /* IntelGL960_1 */ - APPEND_DEVICE(0x2a03); /* IntelGL960_2 */ - APPEND_DEVICE(0x2a12); /* IntelGM965_1 */ - APPEND_DEVICE(0x2a13); /* IntelGM965_2 */ - break; - case IntelGMAX4500HD: - APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */ - APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */ - APPEND_DEVICE(0x2e42); /* IntelB43_1 */ - APPEND_DEVICE(0x2e43); /* IntelB43_2 */ - APPEND_DEVICE(0x2e92); /* IntelB43_3 */ - APPEND_DEVICE(0x2e93); /* IntelB43_4 */ - APPEND_DEVICE(0x2e32); /* IntelG41_1 */ - APPEND_DEVICE(0x2e33); /* IntelG41_2 */ - APPEND_DEVICE(0x2e22); /* IntelG45_1 */ - APPEND_DEVICE(0x2e23); /* IntelG45_2 */ - APPEND_DEVICE(0x2e12); /* IntelQ45_1 */ - APPEND_DEVICE(0x2e13); /* IntelQ45_2 */ - APPEND_DEVICE(0x0042); /* IntelHDGraphics */ - APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */ - APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */ - APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */ - APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */ - APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */ - APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */ - APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */ - APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */ - APPEND_DEVICE(0x0080); /* IntelIvyBridge */ - break; - case IntelHD3000: - APPEND_DEVICE(0x0126); - break; - case IntelMobileHDGraphics: - APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */ - break; - case NvidiaBlockD3D9Layers: - // Glitches whilst scrolling (see bugs 612007, 644787, 645872) - APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */ - APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */ - APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */ - APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */ - APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */ - APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */ - APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */ - APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */ - APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */ - APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */ - APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */ - APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */ - APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */ - APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */ - APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */ - APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */ - APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */ - APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */ - APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */ - APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */ - break; - case RadeonX1000: - // This list is from the ATIRadeonX1000.kext Info.plist - APPEND_DEVICE(0x7187); - APPEND_DEVICE(0x7210); - APPEND_DEVICE(0x71de); - APPEND_DEVICE(0x7146); - APPEND_DEVICE(0x7142); - APPEND_DEVICE(0x7109); - APPEND_DEVICE(0x71c5); - APPEND_DEVICE(0x71c0); - APPEND_DEVICE(0x7240); - APPEND_DEVICE(0x7249); - APPEND_DEVICE(0x7291); - break; - case Geforce7300GT: - APPEND_DEVICE(0x0393); - break; - case Nvidia310M: - APPEND_DEVICE(0x0A70); - break; - // This should never happen, but we get a warning if we don't handle this. - case DeviceFamilyMax: - SAL_WARN("vcl.opengl", "Invalid DeviceFamily id"); - break; - } - - return deviceFamily; } } @@ -625,6 +437,26 @@ WinOpenGLDeviceInfo::~WinOpenGLDeviceInfo() { } +namespace { + +struct compareIgnoreAsciiCase +{ + compareIgnoreAsciiCase(const OUString& rString): + maString(rString) + { + } + + bool operator()(const OUString& rCompare) + { + return maString.equalsIgnoreAsciiCase(rCompare); + } + +private: + OUString maString; +}; + +} + bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList() { uint64_t driverVersion; @@ -652,19 +484,9 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList() continue; } - if (maDriverInfo[i].mpDevices != wgl::DriverInfo::allDevices && maDriverInfo[i].mpDevices->size()) + if (std::none_of(maDriverInfo[i].maDevices.begin(), maDriverInfo[i].maDevices.end(), [](const OUString& rString){ return rString == "all"; } )) { - bool deviceMatches = false; - for (uint32_t j = 0; j < maDriverInfo[i].mpDevices->size(); j++) - { - if ((*maDriverInfo[i].mpDevices)[j].equalsIgnoreAsciiCase(maAdapterDeviceID)) - { - deviceMatches = true; - break; - } - } - - if (!deviceMatches) + if (std::none_of(maDriverInfo[i].maDevices.begin(), maDriverInfo[i].maDevices.end(), compareIgnoreAsciiCase(maAdapterDeviceID))) { continue; } @@ -1064,132 +886,6 @@ OUString WinOpenGLDeviceInfo::GetDeviceVendor(wgl::DeviceVendor id) void WinOpenGLDeviceInfo::FillBlacklist() { - /* - * Implement whitelist entries first as they will be used first to stop early; - */ - - APPEND_TO_DRIVER_WHITELIST( wgl::DRIVER_OS_WINDOWS_7, GetDeviceVendor(wgl::VendorIntel), - wgl::DriverInfo::allDevices, wgl::DRIVER_EQUAL, wgl::V(10,18,10,3412)); - /* - * It should be noted here that more specialized rules on certain features - * should be inserted -before- more generalized restriction. As the first - * match for feature/OS/device found in the list will be used for the final - * blacklisting call. - */ - - /* - * NVIDIA entries - */ - APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_WINDOWS_XP, - GetDeviceVendor(wgl::VendorNVIDIA), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::V(6,14,11,8265), "182.65" ); - APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_WINDOWS_VISTA, - GetDeviceVendor(wgl::VendorNVIDIA), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::V(8,17,11,8265), "182.65" ); - APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_WINDOWS_7, - GetDeviceVendor(wgl::VendorNVIDIA), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::V(8,17,11,8265), "182.65" ); - - /* - * AMD/ATI entries - */ - APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorATI), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::V(8,62,0,0), "9.6" ); - APPEND_TO_DRIVER_BLOCKLIST( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorAMD), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::V(8,62,0,0), "9.6" ); - - /* - * 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, - wgl::DRIVER_BETWEEN_INCLUSIVE_START, wgl::V(8,982,0,0), wgl::V(8,983,0,0), "!= 8.982.*.*" ); - APPEND_TO_DRIVER_BLOCKLIST_RANGE( wgl::DRIVER_OS_WINDOWS_8, - GetDeviceVendor(wgl::VendorAMD), wgl::DriverInfo::allDevices, - wgl::DRIVER_BETWEEN_INCLUSIVE_START, wgl::V(8,982,0,0), wgl::V(8,983,0,0), "!= 8.982.*.*" ); - - /* OpenGL on any ATI/AMD hardware is discouraged - * See: - * 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, - GetDeviceVendor(wgl::VendorATI), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::DriverInfo::allDriverVersions ); - APPEND_TO_DRIVER_BLOCKLIST2( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorATI), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::DriverInfo::allDriverVersions ); - APPEND_TO_DRIVER_BLOCKLIST2( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorAMD), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::DriverInfo::allDriverVersions ); - APPEND_TO_DRIVER_BLOCKLIST2( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorAMD), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::DriverInfo::allDriverVersions ); - - /* - * Intel entries - */ - - /* The driver versions used here come from moz#594877. They might not - * be particularly relevant anymore. - */ -#define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \ - APPEND_TO_DRIVER_BLOCKLIST2( winVer, \ - GetDeviceVendor(wgl::VendorIntel), (wgl::DriverInfo::DeviceFamilyVector*) wgl::DriverInfo::GetDeviceFamily(devFamily), \ - wgl::DRIVER_LESS_THAN, driverVer ) - - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_XP, wgl::IntelGMA500, wgl::V(3,0,20,3200)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_XP, wgl::IntelGMA900, wgl::V(6,14,10,4764)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_XP, wgl::IntelGMA950, wgl::V(6,14,10,4926)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_XP, wgl::IntelGMA3150, wgl::V(6,14,10,5134)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_XP, wgl::IntelGMAX3000, wgl::V(6,14,10,5218)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_XP, wgl::IntelGMAX4500HD, wgl::V(6,14,10,4969)); - - // 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 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)), - wgl::DRIVER_BETWEEN_EXCLUSIVE, wgl::V(6,14,10,5076), wgl::V(6,14,10,5218), "6.14.10.5218"); - - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_VISTA, wgl::IntelGMA500, wgl::V(3,0,20,3200)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_VISTA, wgl::IntelGMA900, wgl::DriverInfo::allDriverVersions); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_VISTA, wgl::IntelGMA950, wgl::V(7,14,10,1504)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_VISTA, wgl::IntelGMA3150, wgl::V(7,14,10,1910)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_VISTA, wgl::IntelGMAX3000, wgl::V(7,15,10,1666)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_VISTA, wgl::IntelGMAX4500HD, wgl::V(7,15,10,1666)); - - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_7, wgl::IntelGMA500, wgl::V(5,0,0,2026)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_7, wgl::IntelGMA900, wgl::DriverInfo::allDriverVersions); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_7, wgl::IntelGMA950, wgl::V(8,15,10,1930)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_7, wgl::IntelGMA3150, wgl::V(8,14,10,1972)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_7, wgl::IntelGMAX3000, wgl::V(7,15,10,1666)); - IMPLEMENT_INTEL_DRIVER_BLOCKLIST(wgl::DRIVER_OS_WINDOWS_7, wgl::IntelGMAX4500HD, wgl::V(7,15,10,1666)); - - /* OpenGL on any Intel hardware is discouraged */ - APPEND_TO_DRIVER_BLOCKLIST2( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorIntel), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::DriverInfo::allDriverVersions ); - APPEND_TO_DRIVER_BLOCKLIST2( wgl::DRIVER_OS_ALL, - GetDeviceVendor(wgl::VendorIntel), wgl::DriverInfo::allDevices, - wgl::DRIVER_LESS_THAN, wgl::DriverInfo::allDriverVersions ); - - /** - * Disable acceleration on Intel HD 3000 for graphics drivers <= 8.15.10.2321. - * 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), - wgl::DRIVER_LESS_THAN_OR_EQUAL, wgl::V(8,15,10,2321), "8.15.10.2342" ); - - /* Microsoft RemoteFX; blocked less than 6.2.0.0 */ - 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 423315e8cb5360255b463f58fb889c38ea40ae17 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Jun 4 14:41:28 2015 +0200 fix typo in file name Change-Id: Ifa0ffd9d3f40d6a47efe56cfe960aa33f06fa547 diff --git a/vcl/opengl/win/backlist.xml b/vcl/opengl/win/blacklist.xml similarity index 100% rename from vcl/opengl/win/backlist.xml rename to vcl/opengl/win/blacklist.xml commit 3e729c00d8281b6c67877e0faf3894eac55065fa Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Jun 4 14:40:35 2015 +0200 support multiple devices in the blacklist Change-Id: Ief0118d0845009bd8fd9cb1c7d51b76c09cc23b5 diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx index 801329a..37779a5 100644 --- a/vcl/inc/opengl/win/WinDeviceInfo.hxx +++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx @@ -98,6 +98,7 @@ struct DriverInfo static DeviceFamilyVector* const allDevices; DeviceFamilyVector* mpDevices; + std::vector<OUString> maDevices; // Whether the mDevices array should be deleted when this structure is // deallocated. False by default. diff --git a/vcl/opengl/win/backlist.xml b/vcl/opengl/win/backlist.xml index 31ca327..6ff92d0 100644 --- a/vcl/opengl/win/backlist.xml +++ b/vcl/opengl/win/backlist.xml @@ -1,6 +1,7 @@ <root> <whitelist> <entry os="7" vendor="intel" compare="equal" version="10.18.10.3412"> + <device id="all"/> <msg>Moggi's Windows OpenGL driver</msg> </entry> </whitelist> diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx index 4c0700a..83bf490 100644 --- a/vcl/opengl/win/blocklist_parser.cxx +++ b/vcl/opengl/win/blocklist_parser.cxx @@ -147,11 +147,6 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe OUString aVendor = OStringToOUString(sVendor, RTL_TEXTENCODING_UTF8); rDriver.maAdapterVendor = aVendor; } - else if (name.equals("device")) - { - name = rReader.getAttributeValue(false); - OString sDevice(name.begin, name.length); - } else if (name.equals("compare")) { name = rReader.getAttributeValue(false); @@ -176,6 +171,10 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe OString sMaxVersion(name.begin, name.length); rDriver.mnDriverVersionMax = getVersion(sMaxVersion); } + else + { + SAL_WARN("vcl.opengl.win", "unsupported attribute"); + } } int nLevel = 1; @@ -198,6 +197,15 @@ void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlRe { bInMsg = true; } + else if (name.equals("device")) + { + bool bSuccess = rReader.nextAttribute(&nsId, &name); + if (!bSuccess || !name.equals("id")) + throw InvalidFileException(); + + OString aDeviceId(name.begin, name.length); + rDriver.maDevices.push_back(OStringToOUString(aDeviceId, RTL_TEXTENCODING_UTF8)); + } else throw InvalidFileException(); } commit d0ab1c18579b34fcc1c5156f0d4ad4562e0f4ba7 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Jun 4 09:48:02 2015 +0200 rename xml elements as I need to reorganize everything a bit Change-Id: I69ec748819b1012790bb47eaf161623507ff2efe diff --git a/vcl/opengl/win/backlist.xml b/vcl/opengl/win/backlist.xml index b4cac2b..31ca327 100644 --- a/vcl/opengl/win/backlist.xml +++ b/vcl/opengl/win/backlist.xml @@ -1,8 +1,8 @@ <root> <whitelist> - <device os="7" vendor="intel" compare="equal" version="10.18.10.3412"> + <entry os="7" vendor="intel" compare="equal" version="10.18.10.3412"> <msg>Moggi's Windows OpenGL driver</msg> - </device> + </entry> </whitelist> <blacklist> diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx index 3530173..4c0700a 100644 --- a/vcl/opengl/win/blocklist_parser.cxx +++ b/vcl/opengl/win/blocklist_parser.cxx @@ -231,13 +231,13 @@ void WinBlocklistParser::handleList(xmlreader::XmlReader& rReader) if (res == xmlreader::XmlReader::RESULT_BEGIN) { - if (name.equals("device")) + if (name.equals("entry")) { wgl::DriverInfo aDriver; handleDevice(aDriver, rReader); mrDriverList.push_back(aDriver); } - else if (name.equals("deviceRange")) + else if (name.equals("entryRange")) { wgl::DriverInfo aDriver; handleDevice(aDriver, rReader); commit 1e8eadc0503df3bc0af28bb925ebbb7d0808fb6c Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Jun 4 00:26:41 2015 +0200 first part for server based blacklist We are now switching from ahrd coding the blacklist in the source code to using a xml file. In a second step that xml file will be fetched from a TDF server. Change-Id: I1c67d366c77b2f4185bedaa552fa655cc8ddb047 diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 7c99bed..db3ced0 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -664,6 +664,7 @@ ifeq ($(OS),WNT) $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/opengl/win/gdiimpl \ vcl/opengl/win/WinDeviceInfo \ + vcl/opengl/win/blocklist_parser \ vcl/win/source/app/saldata \ vcl/win/source/app/salinfo \ vcl/win/source/app/salinst \ diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx index 21f14d9..801329a 100644 --- a/vcl/inc/opengl/win/WinDeviceInfo.hxx +++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx @@ -73,6 +73,8 @@ enum DeviceVendor { DeviceVendorMax }; +bool ParseDriverVersion(const OUString& rString, uint64_t& rVersion); + struct DriverInfo { typedef std::vector<OUString> DeviceFamilyVector; @@ -114,6 +116,7 @@ struct DriverInfo static DeviceFamilyVector* mpDeviceFamilies[DeviceFamilyMax]; OUString maSuggestedVersion; + OUString maMsg; }; #define GFX_DRIVER_VERSION(a,b,c,d) \ diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx index 151476d..d69ee1a 100644 --- a/vcl/opengl/win/WinDeviceInfo.cxx +++ b/vcl/opengl/win/WinDeviceInfo.cxx @@ -339,9 +339,35 @@ bool SplitDriverVersion(const char *aSource, char *aAStr, char *aBStr, char *aCS return true; } -bool ParseDriverVersion(const OUString& aVersion, uint64_t *aNumericVersion) +/* Other interesting places for info: + * IDXGIAdapter::GetDesc() + * IDirectDraw7::GetAvailableVidMem() + * e->GetAvailableTextureMem() + * */ + +template<typename T> void appendIntegerWithPadding(OUString& rString, T value, sal_uInt32 nChars) +{ + rString += "0x"; + OUString aValue = OUString::number(value, 16); + sal_Int32 nLength = aValue.getLength(); + sal_uInt32 nPadLength = nChars - nLength; + assert(nPadLength >= 0); + OUStringBuffer aBuffer; + for (sal_uInt32 i = 0; i < nPadLength; ++i) + { + aBuffer.append("0"); + } + rString += aBuffer.makeStringAndClear() + aValue; +} + +#define DEVICE_KEY_PREFIX L"\\Registry\\Machine\\" +} + +namespace wgl { + +bool ParseDriverVersion(const OUString& aVersion, uint64_t& rNumericVersion) { - *aNumericVersion = 0; + rNumericVersion = 0; #if defined(WIN32) int a, b, c, d; @@ -365,37 +391,12 @@ bool ParseDriverVersion(const OUString& aVersion, uint64_t *aNumericVersion) if (c < 0 || c > 0xffff) return false; if (d < 0 || d > 0xffff) return false; - *aNumericVersion = GFX_DRIVER_VERSION(a, b, c, d); + rNumericVersion = GFX_DRIVER_VERSION(a, b, c, d); return true; #else return false; #endif } -/* Other interesting places for info: - * IDXGIAdapter::GetDesc() - * IDirectDraw7::GetAvailableVidMem() - * e->GetAvailableTextureMem() - * */ - -template<typename T> void appendIntegerWithPadding(OUString& rString, T value, sal_uInt32 nChars) -{ - rString += "0x"; - OUString aValue = OUString::number(value, 16); - sal_Int32 nLength = aValue.getLength(); - sal_uInt32 nPadLength = nChars - nLength; - assert(nPadLength >= 0); - OUStringBuffer aBuffer; - for (sal_uInt32 i = 0; i < nPadLength; ++i) - { - aBuffer.append("0"); - } - rString += aBuffer.makeStringAndClear() + aValue; -} - -#define DEVICE_KEY_PREFIX L"\\Registry\\Machine\\" -} - -namespace wgl { uint64_t DriverInfo::allDriverVersions = ~(uint64_t(0)); DriverInfo::DeviceFamilyVector* const DriverInfo::allDevices = nullptr; @@ -627,7 +628,7 @@ WinOpenGLDeviceInfo::~WinOpenGLDeviceInfo() bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList() { uint64_t driverVersion; - ParseDriverVersion(maDriverVersion, &driverVersion); + wgl::ParseDriverVersion(maDriverVersion, driverVersion); wgl::OperatingSystem eOS = WindowsVersionToOperatingSystem(mnWindowsVersion); bool match = false; @@ -1012,10 +1013,10 @@ void WinOpenGLDeviceInfo::GetData() uint64_t dllNumericVersion = 0, dllNumericVersion2 = 0, driverNumericVersion = 0, knownSafeMismatchVersion = 0; - ParseDriverVersion(aDLLVersion, &dllNumericVersion); - ParseDriverVersion(aDLLVersion2, &dllNumericVersion2); - ParseDriverVersion(maDriverVersion, &driverNumericVersion); - ParseDriverVersion("9.17.10.0", &knownSafeMismatchVersion); + wgl::ParseDriverVersion(aDLLVersion, dllNumericVersion); + wgl::ParseDriverVersion(aDLLVersion2, dllNumericVersion2); + wgl::ParseDriverVersion(maDriverVersion, driverNumericVersion); + wgl::ParseDriverVersion("9.17.10.0", knownSafeMismatchVersion); // If there's a driver version mismatch, consider this harmful only when // the driver version is less than knownSafeMismatchVersion. See the diff --git a/vcl/opengl/win/backlist.xml b/vcl/opengl/win/backlist.xml new file mode 100644 index 0000000..b4cac2b --- /dev/null +++ b/vcl/opengl/win/backlist.xml @@ -0,0 +1,10 @@ +<root> + <whitelist> + <device os="7" vendor="intel" compare="equal" version="10.18.10.3412"> + <msg>Moggi's Windows OpenGL driver</msg> + </device> + </whitelist> + <blacklist> + + </blacklist> +</root> diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx new file mode 100644 index 0000000..3530173 --- /dev/null +++ b/vcl/opengl/win/blocklist_parser.cxx @@ -0,0 +1,304 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "blocklist_parser.hxx" + +WinBlocklistParser::WinBlocklistParser(const OUString& rURL, + std::vector<wgl::DriverInfo>& rDriverList): + maURL(rURL), + mrDriverList(rDriverList) +{ +} + +void WinBlocklistParser::parse() +{ + xmlreader::XmlReader aReader(maURL); + handleContent(aReader); +} + +namespace { + +wgl::OperatingSystem getOperatingSystem(const OString& rString) +{ + if (rString == "all") + { + return wgl::DRIVER_OS_ALL; + } + else if (rString == "xp") + { + return wgl::DRIVER_OS_WINDOWS_XP; + } + else if (rString == "server2003") + { + return wgl::DRIVER_OS_WINDOWS_SERVER_2003; + } + else if (rString == "vista") + { + return wgl::DRIVER_OS_WINDOWS_VISTA; + } + else if (rString == "7") + { + return wgl::DRIVER_OS_WINDOWS_7; + } + else if (rString == "8") + { + return wgl::DRIVER_OS_WINDOWS_8; + } + else if (rString == "8_1") + { + return wgl::DRIVER_OS_WINDOWS_8_1; + } + + return wgl::DRIVER_OS_UNKNOWN; +} + +wgl::VersionComparisonOp getComparison(const OString& rString) +{ + if (rString == "less") + { + return wgl::DRIVER_LESS_THAN; + } + else if (rString == "less_equal") + { + return wgl::DRIVER_LESS_THAN_OR_EQUAL; + } + else if (rString == "greater") + { + return wgl::DRIVER_GREATER_THAN; + } + else if (rString == "greater_equal") + { + return wgl::DRIVER_GREATER_THAN_OR_EQUAL; + } + else if (rString == "equal") + { + return wgl::DRIVER_EQUAL; + } + else if (rString == "not_equal") + { + return wgl::DRIVER_NOT_EQUAL; + } + else if (rString == "between_exclusive") + { + return wgl::DRIVER_BETWEEN_EXCLUSIVE; + } + else if (rString == "between_inclusive") + { + return wgl::DRIVER_BETWEEN_INCLUSIVE; + } + else if (rString == "between_inclusive_start") + { + return wgl::DRIVER_BETWEEN_INCLUSIVE_START; + } + + throw InvalidFileException(); +} + +uint64_t getVersion(const OString& rString) +{ + OUString aString = OStringToOUString(rString, RTL_TEXTENCODING_UTF8); + uint64_t nVersion; + bool bResult = wgl::ParseDriverVersion(aString, nVersion); + + if (!bResult) + { + throw InvalidFileException(); + } + + return nVersion; +} + +} + +void WinBlocklistParser::handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader) +{ + if (meBlockType == BlockType::WHITELIST) + { + rDriver.mbWhitelisted = true; + } + else if (meBlockType == BlockType::UNKNOWN) + { + throw InvalidFileException(); + } + + xmlreader::Span name; + int nsId; + + while (rReader.nextAttribute(&nsId, &name)) + { + if (name.equals("os")) + { + xmlreader::Span name = rReader.getAttributeValue(false); + OString sOS(name.begin, name.length); + rDriver.meOperatingSystem = getOperatingSystem(sOS); + } + else if (name.equals("vendor")) + { + name = rReader.getAttributeValue(false); + OString sVendor(name.begin, name.length); + + // TODO: moggi: check that only valid vendors are imported + OUString aVendor = OStringToOUString(sVendor, RTL_TEXTENCODING_UTF8); + rDriver.maAdapterVendor = aVendor; + } + else if (name.equals("device")) + { + name = rReader.getAttributeValue(false); + OString sDevice(name.begin, name.length); + } + else if (name.equals("compare")) + { + name = rReader.getAttributeValue(false); + OString sCompare(name.begin, name.length); + rDriver.meComparisonOp = getComparison(sCompare); + } + else if (name.equals("version")) + { + name = rReader.getAttributeValue(false); + OString sVersion(name.begin, name.length); + rDriver.mnDriverVersion = getVersion(sVersion); + } + else if (name.equals("minVersion")) + { + name = rReader.getAttributeValue(false); + OString sMinVersion(name.begin, name.length); + rDriver.mnDriverVersion = getVersion(sMinVersion); + } + else if (name.equals("maxVersion")) + { + name = rReader.getAttributeValue(false); + OString sMaxVersion(name.begin, name.length); + rDriver.mnDriverVersionMax = getVersion(sMaxVersion); + } + } + + int nLevel = 1; + bool bInMsg = false; + while(true) + { + xmlreader::Span name; + int nsId; + + xmlreader::XmlReader::Result res = rReader.nextItem( + xmlreader::XmlReader::TEXT_NONE, &name, &nsId); + + if (res == xmlreader::XmlReader::RESULT_BEGIN) + { + ++nLevel; + if (nLevel > 2) + throw InvalidFileException(); + + if (name.equals("msg")) + { + bInMsg = true; + } + else + throw InvalidFileException(); + } + else if (res == xmlreader::XmlReader::RESULT_END) + { + --nLevel; + bInMsg = false; + if (!nLevel) + break; + } + else if (res == xmlreader::XmlReader::RESULT_TEXT) + { + if (bInMsg) + { + OString sMsg(name.begin, name.length); + rDriver.maMsg = OStringToOUString(sMsg, RTL_TEXTENCODING_UTF8); + } + } + } +} + +void WinBlocklistParser::handleList(xmlreader::XmlReader& rReader) +{ + xmlreader::Span name; + int nsId; + + while (true) + { + xmlreader::XmlReader::Result res = rReader.nextItem( + xmlreader::XmlReader::TEXT_NONE, &name, &nsId); + + if (res == xmlreader::XmlReader::RESULT_BEGIN) + { + if (name.equals("device")) + { + wgl::DriverInfo aDriver; + handleDevice(aDriver, rReader); + mrDriverList.push_back(aDriver); + } + else if (name.equals("deviceRange")) + { + wgl::DriverInfo aDriver; + handleDevice(aDriver, rReader); + mrDriverList.push_back(aDriver); + } + else + { + throw InvalidFileException(); + } + } + else if (res == xmlreader::XmlReader::RESULT_END) + { + break; + } + } +} + +void WinBlocklistParser::handleContent(xmlreader::XmlReader& rReader) +{ + while (true) + { + xmlreader::Span name; + int nsId; + + xmlreader::XmlReader::Result res = rReader.nextItem( + xmlreader::XmlReader::TEXT_NONE, &name, &nsId); + + if (res == xmlreader::XmlReader::RESULT_BEGIN) + { + if (name.equals("whitelist")) + { + meBlockType = BlockType::WHITELIST; + handleList(rReader); + } + else if (name.equals("blacklist")) + { + meBlockType = BlockType::BLACKLIST; + handleList(rReader); + } + else if (name.equals("root")) + { + } + else + { + throw InvalidFileException(); + } + } + else if (res == xmlreader::XmlReader::RESULT_END) + { + if (name.equals("whitelist") + || + name.equals("blacklist")) + { + meBlockType = BlockType::UNKNOWN; + } + } + else if (res == xmlreader::XmlReader::RESULT_DONE) + { + break; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/opengl/win/blocklist_parser.hxx b/vcl/opengl/win/blocklist_parser.hxx new file mode 100644 index 0000000..c34af0a --- /dev/null +++ b/vcl/opengl/win/blocklist_parser.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "opengl/win/WinDeviceInfo.hxx" + +#include <xmlreader/xmlreader.hxx> + +#include <vector> + +class InvalidFileException +{ +}; + +class WinBlocklistParser +{ + WinBlocklistParser(const OUString& rURL, std::vector<wgl::DriverInfo>& rDriverList); + void parse(); + +private: + void handleDevice(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader); + + void handleList(xmlreader::XmlReader& rReader); + void handleContent(xmlreader::XmlReader& rReader); + + + enum class BlockType + { + WHITELIST, + BLACKLIST, + UNKNOWN + }; + + BlockType meBlockType; + std::vector<wgl::DriverInfo>& mrDriverList; + OUString maURL; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 8ae25bbc092254f680e2976873f15bdbc26615ef Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jun 3 16:51:41 2015 +0100 Resolves: tdf#90435 secondary pool set to that of temp docs drawing layers overwriting the original one, and when the temp doc goes away then its drawing layer goes away autoamtically settings the secondary pools of the other pools it is a secondary of back to 0 (see also tdf#87245) Change-Id: Ie6dd8d615f81cf4d4776eaeac1cc2507b2abaa37 diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index bc8d76d..18d483c 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -138,11 +138,11 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell ) // in SfxItemSets using the Calc SfxItemPool. This is e.g. needed when // the PageStyle using SvxBrushItem is visualized and will be potentially // used more intense in the future - if(xPoolHelper.is()) + if (xPoolHelper.is() && !IsClipOrUndo()) //Using IsClipOrUndo as a proxy for SharePooledResources called { ScDocumentPool* pLocalPool = xPoolHelper->GetDocPool(); - if(pLocalPool) + if (pLocalPool) { OSL_ENSURE(!pLocalPool->GetSecondaryPool(), "OOps, already a secondary pool set where the DrawingLayer ItemPool is to be placed (!)"); pLocalPool->SetSecondaryPool(&pDrawLayer->GetItemPool()); commit 816941f1396b79eba2dc3b46c6cffb53835ee923 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jun 3 19:44:21 2015 +0200 OS X: Default to the 'breeze' icon theme. As agreed in the Design team meeting today. Change-Id: I660462fb7b56eb3c8f883f8540cf88801e48165c diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index 235ba1f..bed75fa 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -63,7 +63,7 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const OUString& desktopEnvi r = "breeze"; } else if ( desktopEnvironment.equalsIgnoreAsciiCase("MacOSX") ) { - r = "sifr"; + r = "breeze"; } else { r = FALLBACK_ICON_THEME_ID; commit d611b2e0b2b713ffaf8b2ec75e6a74180316f50b Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jun 3 19:11:57 2015 +0200 sw: add SwDBManager::RevokeDataSource() And call it from the SwDoc dtor, so that embedded data source definitions registered on opening are deregistered on close. Change-Id: I40309389d44dcbc225f6f2ef98bb20579e12d650 diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index e397e57..657e957 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -376,6 +376,9 @@ public: /// Load the embedded data source of the document and also register it. void LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const SwDocShell& rDocShell); + /// Unregister a data source. + static void RevokeDataSource(const OUString& rName); + /** try to get the data source from the given connection through the XChild interface. If this is not possible, the data source will be created through its name. @param _xConnection diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ec44cb5..302ebef 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -540,6 +540,11 @@ SwDoc::~SwDoc() mpCharFormatTable->erase( mpCharFormatTable->begin() ); #if HAVE_FEATURE_DBCONNECTIVITY + // On load, SwDBManager::setEmbeddedName() may register a data source. + // If we have an embedded one, then sDataSoure points to the registered name, so revoke it here. + if (!mpDBManager->getEmbeddedName().isEmpty() && !maDBData.sDataSource.isEmpty()) + SwDBManager::RevokeDataSource(maDBData.sDataSource); + DELETEZ( mpDBManager ); #endif diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index b138730..d59d78b 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2663,6 +2663,13 @@ OUString SwDBManager::LoadAndRegisterDataSource(const OUString &rURI, const OUSt return LoadAndRegisterDataSource( type, aURLAny, pSettings, rURI, pPrefix, pDestDir ); } +void SwDBManager::RevokeDataSource(const OUString& rName) +{ + uno::Reference<sdb::XDatabaseContext> xDatabaseContext = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); + if (xDatabaseContext->hasByName(rName)) + xDatabaseContext->revokeObject(rName); +} + void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const SwDocShell& rDocShell) { uno::Reference<sdb::XDatabaseContext> xDatabaseContext = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); @@ -2673,8 +2680,7 @@ void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const if (sDataSource.isEmpty()) sDataSource = "EmbeddedDatabase"; - if (xDatabaseContext->hasByName(rData.sDataSource)) - xDatabaseContext->revokeObject(rData.sDataSource); + SwDBManager::RevokeDataSource(rData.sDataSource); // Encode the stream name and the real path into a single URL. const INetURLObject& rURLObject = rDocShell.GetMedium()->GetURLObject(); commit b79017f49a487a3981b1cd9f488ed5062eeb880b Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jun 3 18:54:08 2015 +0200 sw: move name of the embedded data source def from SwDBData to SwDBManager The problem is that SwDBData just describes the current data source, and when changing that, the embedded name doesn't change, so they should be separate. Change-Id: I2dd7e0a97b9f7d6a3a74a5752467515a0a09171a diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index 27c86a7..e397e57 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -199,6 +199,8 @@ friend class SwConnectionDisposedListener_Impl; SwDSParamArr aDataSourceParams; SwDBManager_Impl* pImpl; const SwXMailMerge* pMergeEvtSrc; ///< != 0 if mail merge events are to be send + /// Name of the embedded database that's included in the current document. + OUString m_sEmbeddedName; SAL_DLLPRIVATE SwDSParam* FindDSData(const SwDBData& rData, bool bCreate); SAL_DLLPRIVATE SwDSParam* FindDSConnection(const OUString& rSource, bool bCreate); @@ -372,7 +374,7 @@ public: const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > *pSettings = 0); /// Load the embedded data source of the document and also register it. - static void LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const SwDocShell& rDocShell); + void LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const SwDocShell& rDocShell); /** try to get the data source from the given connection through the XChild interface. If this is not possible, the data source will be created through its name. @@ -405,6 +407,9 @@ public: sal_Int32 _nCommandType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection ); + + void setEmbeddedName(const OUString& rEmbeddedName, SwDocShell& rDocShell); + OUString getEmbeddedName() const; }; #endif diff --git a/sw/inc/swdbdata.hxx b/sw/inc/swdbdata.hxx index 02ccf68..6d91e2b 100644 --- a/sw/inc/swdbdata.hxx +++ b/sw/inc/swdbdata.hxx @@ -28,16 +28,14 @@ struct SwDBData OUString sDataSource; OUString sCommand; //table, query or statement sal_Int32 nCommandType; //com::sun::star::sdb::CommandType - /// Name of the embedded database that's included in the current document. - OUString sEmbeddedName; SwDBData() : nCommandType(0){} void dumpAsXml(struct _xmlTextWriter* pWriter) const; bool operator !=(const SwDBData& rCmp) const - {return rCmp.sDataSource != sDataSource || rCmp.sCommand != sCommand || rCmp.nCommandType != nCommandType || rCmp.sEmbeddedName != sEmbeddedName;} + {return rCmp.sDataSource != sDataSource || rCmp.sCommand != sCommand || rCmp.nCommandType != nCommandType;} bool operator ==(const SwDBData& rCmp) const - {return rCmp.sDataSource == sDataSource && rCmp.sCommand == sCommand && rCmp.nCommandType == nCommandType && rCmp.sEmbeddedName == sEmbeddedName;} + {return rCmp.sDataSource == sDataSource && rCmp.sCommand == sCommand && rCmp.nCommandType == nCommandType;} }; #endif diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index b427c93..fb43e0c 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -494,15 +494,6 @@ void SwDoc::ChgDBData(const SwDBData& rNewData) { if( rNewData != maDBData ) { - if (maDBData.sEmbeddedName != rNewData.sEmbeddedName && GetDocShell()) - { - uno::Reference<embed::XStorage> xStorage = GetDocShell()->GetStorage(); - // It's OK that we don't have the named sub-storage yet, in case - // we're in the process of creating it. - if (xStorage->hasByName(rNewData.sEmbeddedName)) - SwDBManager::LoadAndRegisterEmbeddedDataSource(rNewData, *GetDocShell()); - } - maDBData = rNewData; getIDocumentState().SetModified(); } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index bb1ea87..4acd8e8 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1958,7 +1958,6 @@ void SwDBData::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sEmbeddedName"), BAD_CAST(sEmbeddedName.toUtf8().getStr())); xmlTextWriterEndElement(pWriter); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index fd57164..b138730 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2667,6 +2667,12 @@ void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const { uno::Reference<sdb::XDatabaseContext> xDatabaseContext = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); + OUString sDataSource = rData.sDataSource; + + // Fallback, just in case the document would contain an embedded data source, but no DB fields. + if (sDataSource.isEmpty()) + sDataSource = "EmbeddedDatabase"; + if (xDatabaseContext->hasByName(rData.sDataSource)) xDatabaseContext->revokeObject(rData.sDataSource); @@ -2674,7 +2680,7 @@ void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const const INetURLObject& rURLObject = rDocShell.GetMedium()->GetURLObject(); OUString aURL = "vnd.sun.star.pkg://"; aURL += INetURLObject::encode(rURLObject.GetMainURL(INetURLObject::DECODE_WITH_CHARSET), INetURLObject::PART_AUTHORITY, INetURLObject::ENCODE_ALL); - aURL += "/" + INetURLObject::encode(rData.sEmbeddedName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL); + aURL += "/" + INetURLObject::encode(m_sEmbeddedName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL); uno::Reference<uno::XInterface> xDataSource(xDatabaseContext->getByName(aURL), uno::UNO_QUERY); xDatabaseContext->registerObject(rData.sDataSource, xDataSource); @@ -2966,6 +2972,27 @@ uno::Reference<XResultSet> SwDBManager::createCursor(const OUString& _sDataSourc return xResultSet; } +void SwDBManager::setEmbeddedName(const OUString& rEmbeddedName, SwDocShell& rDocShell) +{ + bool bLoad = m_sEmbeddedName != rEmbeddedName && !rEmbeddedName.isEmpty(); + + m_sEmbeddedName = rEmbeddedName; + + if (bLoad) + { + uno::Reference<embed::XStorage> xStorage = rDocShell.GetStorage(); + // It's OK that we don't have the named sub-storage yet, in case + // we're in the process of creating it. + if (xStorage->hasByName(rEmbeddedName)) + LoadAndRegisterEmbeddedDataSource(rDocShell.GetDoc()->GetDBData(), rDocShell); + } +} + +OUString SwDBManager::getEmbeddedName() const +{ + return m_sEmbeddedName; +} + SwConnectionDisposedListener_Impl::SwConnectionDisposedListener_Impl(SwDBManager& rManager) : m_pDBManager(&rManager) { diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 7d513d4..78ad21e 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -46,6 +46,7 @@ #include "swmodule.hxx" #include "cfgitems.hxx" #include "prtopt.hxx" +#include "dbmgr.hxx" using namespace comphelper; using namespace ::com::sun::star; @@ -508,9 +509,9 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf break; case HANDLE_EMBEDDED_DATABASE_NAME: { - SwDBData aData = mpDoc->GetDBData(); - if (rValue >>= aData.sEmbeddedName) - mpDoc->ChgDBData(aData); + OUString sEmbeddedName; + if (rValue >>= sEmbeddedName) + mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh); } break; case HANDLE_SAVE_VERSION_ON_CLOSE: @@ -988,8 +989,7 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf break; case HANDLE_EMBEDDED_DATABASE_NAME: { - const SwDBData& rData = mpDoc->GetDBDesc(); - rValue <<= rData.sEmbeddedName; + rValue <<= mpDoc->GetDBManager()->getEmbeddedName(); } break; case HANDLE_SAVE_VERSION_ON_CLOSE:
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits