diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-11-27 15:46:27 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-11-27 21:18:38 +0100 |
commit | d8abf4ee547aa9e509ccc2abcc78f1fe6af01c1d (patch) | |
tree | 71ed5c581b782e106a840df9c9ff4f562a42e934 /vcl/inc/opengl/win/WinDeviceInfo.hxx | |
parent | 40ad9eea885db925fc7ad8872d529a7c5cb43a5a (diff) |
port blacklist from mozilla code to LibreOffice, part2
Change-Id: Ia5810aa5f9e1e169b5f0217f6f176a253dc1439d
Diffstat (limited to 'vcl/inc/opengl/win/WinDeviceInfo.hxx')
-rw-r--r-- | vcl/inc/opengl/win/WinDeviceInfo.hxx | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx index 140662e9f840..524198bd5bca 100644 --- a/vcl/inc/opengl/win/WinDeviceInfo.hxx +++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx @@ -71,6 +71,67 @@ enum DeviceVendor { DeviceVendorMax }; +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, const char *suggestedVersion = nullptr, + bool ownDevices = false); + + DriverInfo(); + DriverInfo(const DriverInfo&); + ~DriverInfo(); + + OperatingSystem meOperatingSystem; + uint32_t mnOperatingSystemVersion; + + OUString maAdapterVendor; + + static DeviceFamilyVector* const allDevices; + DeviceFamilyVector* mpDevices; + + // Whether the mDevices array should be deleted when this structure is + // deallocated. False by default. + bool mbDeleteDevices; + + VersionComparisonOp meComparisonOp; + + /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */ + uint64_t mnDriverVersion; + uint64_t mnDriverVersionMax; + static uint64_t allDriverVersions; + + static const DeviceFamilyVector* GetDeviceFamily(DeviceFamily id); + static DeviceFamilyVector* mpDeviceFamilies[DeviceFamilyMax]; + + OUString maModel, maHardware, maProduct, maManufacturer; +}; + +#define GFX_DRIVER_VERSION(a,b,c,d) \ + ((uint64_t(a)<<48) | (uint64_t(b)<<32) | (uint64_t(c)<<16) | uint64_t(d)) + +inline uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d) +{ + // We make sure every driver number is padded by 0s, this will allow us the + // easiest 'compare as if decimals' approach. See ParseDriverVersion for a + // more extensive explanation of this approach. + while (b > 0 && b < 1000) { + b *= 10; + } + while (c > 0 && c < 1000) { + c *= 10; + } + while (d > 0 && d < 1000) { + d *= 10; + } + return GFX_DRIVER_VERSION(a, b, c, d); +} + } class WinOpenGLDeviceInfo : public OpenGLDeviceInfo @@ -105,12 +166,15 @@ private: bool mbRDP; void GetData(); - OUString GetDeviceVendor(wgl::DeviceVendor eVendor); + void FillBlacklist(); static OUString* mpDeviceVendors[wgl::DeviceVendorMax]; + static std::vector<wgl::DriverInfo> maDriverInfo; public: WinOpenGLDeviceInfo(); + + static OUString GetDeviceVendor(wgl::DeviceVendor eVendor); virtual ~WinOpenGLDeviceInfo(); virtual bool isDeviceBlocked(); |