[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/opengl

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Nov 30 12:02:26 PST 2014


 vcl/inc/opengl/win/WinDeviceInfo.hxx |    6 +++---
 vcl/opengl/win/WinDeviceInfo.cxx     |   32 +++++++++++++++++++++++++++++---
 2 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit 82d767a50629aa8e1c6fa005439c92153b22e7f6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 30 21:01:35 2014 +0100

    whitelist some drivers
    
    Especially the ones from our developer machines as they are better tested than anything else.
    
    Change-Id: Id6ff6bcae314c03453d82ee4e64aaef1bd5ed84a

diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx
index 2a887c4..6fb7834 100644
--- a/vcl/inc/opengl/win/WinDeviceInfo.hxx
+++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx
@@ -12,8 +12,6 @@
 
 #include "opengl/DeviceInfo.hxx"
 #include <rtl/ustring.hxx>
-#include <vector>
-#include <stdint.h>
 
 namespace wgl {
 
@@ -82,7 +80,7 @@ struct DriverInfo
 
     DriverInfo(OperatingSystem os, const OUString& vendor, DeviceFamilyVector* devices,
             VersionComparisonOp op,
-            uint64_t driverVersion, const char *suggestedVersion = nullptr,
+            uint64_t driverVersion, bool bWhiteListed = false, const char *suggestedVersion = nullptr,
             bool ownDevices = false);
 
     DriverInfo();
@@ -101,6 +99,8 @@ struct DriverInfo
     // deallocated. False by default.
     bool mbDeleteDevices;
 
+    bool mbWhitelisted;
+
     VersionComparisonOp meComparisonOp;
 
     /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index c9bf1ff..824d0fc 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -12,22 +12,25 @@
 #include <windows.h>
 #include <setupapi.h>
 #include <cstdint>
-#include <rtl/ustrbuf.hxx>
 
 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, 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, suggestedVersion); \
+        wgl::DriverInfo info(os, vendor, devices, driverComparator, driverVersion, false, suggestedVersion); \
         info.mnDriverVersionMax = driverVersionMax; \
         maDriverInfo.push_back(info); \
     } while (false)
@@ -373,6 +376,7 @@ DriverInfo::DriverInfo()
     maAdapterVendor(WinOpenGLDeviceInfo::GetDeviceVendor(VendorAll)),
     mpDevices(allDevices),
     mbDeleteDevices(false),
+    mbWhitelisted(false),
     meComparisonOp(DRIVER_COMPARISON_IGNORED),
     mnDriverVersion(0),
     mnDriverVersionMax(0)
@@ -382,6 +386,7 @@ DriverInfo::DriverInfo(OperatingSystem os, const OUString& vendor,
         DeviceFamilyVector* devices,
         VersionComparisonOp op,
         uint64_t driverVersion,
+        bool bWhitelisted,
         const char *suggestedVersion /* = nullptr */,
         bool ownDevices /* = false */)
     : meOperatingSystem(os),
@@ -389,6 +394,7 @@ DriverInfo::DriverInfo(OperatingSystem os, const OUString& vendor,
     maAdapterVendor(vendor),
     mpDevices(devices),
     mbDeleteDevices(ownDevices),
+    mbWhitelisted(bWhitelisted),
     meComparisonOp(op),
     mnDriverVersion(driverVersion),
     mnDriverVersionMax(0)
@@ -401,6 +407,7 @@ DriverInfo::DriverInfo(const DriverInfo& aOrig)
     : meOperatingSystem(aOrig.meOperatingSystem),
     mnOperatingSystemVersion(aOrig.mnOperatingSystemVersion),
     maAdapterVendor(aOrig.maAdapterVendor),
+    mbWhitelisted(aOrig.mbWhitelisted),
     meComparisonOp(aOrig.meComparisonOp),
     mnDriverVersion(aOrig.mnDriverVersion),
     mnDriverVersionMax(aOrig.mnDriverVersionMax)
@@ -657,6 +664,13 @@ bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList()
         }
 
         if (match || maDriverInfo[i].mnDriverVersion == wgl::DriverInfo::allDriverVersions) {
+            // white listed drivers
+            if (maDriverInfo[i].mbWhitelisted)
+            {
+                SAL_WARN("vcl.opengl", "whitelisted driver");
+                return false;
+            }
+
             match = true;
             SAL_WARN("vcl.opengl", "use : " << maDriverInfo[i].maSuggestedVersion);
             break;
@@ -980,6 +994,12 @@ 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
commit 773d2bde7176130ad9ac4a28991a1441ad022faf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 30 21:00:31 2014 +0100

    block all RDP sessions from using OpenGL
    
    Normally you only get the Microsoft OpenGL 1.1 driver for RDP so it is save to just block it.
    
    Change-Id: Id9b3af23d56926b09316fbf8b873e271060d2c6a

diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 41f1a2b..c9bf1ff 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -682,6 +682,12 @@ bool WinOpenGLDeviceInfo::isDeviceBlocked()
     // 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");
+        return true;
+    }
+
     return FindBlocklistedDeviceInList();
 }
 


More information about the Libreoffice-commits mailing list