diff options
author | Luboš Luňák <l.lunak@centrum.cz> | 2020-09-21 14:44:32 +0000 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-09-22 14:58:41 +0200 |
commit | bf62a89030aeb61cfdc032b167bc62ce6a3240dc (patch) | |
tree | c11f4ea3093d688beb36102dbfecafe30612e70f /vcl/inc/driverblocklist.hxx | |
parent | e146d6f6abf8b70080ec6ea28c298e71d06a9e1d (diff) |
fix parsing of Vulkan version numbers
The Windows+OpenGL handling pads the numbers so that .98 > 0.978,
but Vulkan uses "normal" numeric ordering for versions.
Change-Id: I766baf50e3505a96aa85163962400bb69c0acea6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103118
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc/driverblocklist.hxx')
-rw-r--r-- | vcl/inc/driverblocklist.hxx | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/vcl/inc/driverblocklist.hxx b/vcl/inc/driverblocklist.hxx index a417d19ff543..2e1367e5db31 100644 --- a/vcl/inc/driverblocklist.hxx +++ b/vcl/inc/driverblocklist.hxx @@ -18,8 +18,16 @@ namespace DriverBlocklist { -VCL_DLLPUBLIC bool IsDeviceBlocked(const OUString& blocklistURL, const OUString& driverVersion, - const OUString& vendorId, const OUString& deviceId); +// Details of how to treat a version number. +enum class VersionType +{ + OpenGL, // a.b.c.d, 1.98 > 1.978 + Vulkan // a.b.c , 1.98 < 1.978 +}; + +VCL_DLLPUBLIC bool IsDeviceBlocked(const OUString& blocklistURL, VersionType versionType, + const OUString& driverVersion, const OUString& vendorId, + const OUString& deviceId); #ifdef _WIN32 VCL_DLLPUBLIC int32_t GetWindowsVersion(); @@ -103,7 +111,7 @@ struct DriverInfo class VCL_DLLPUBLIC Parser { public: - Parser(const OUString& rURL, std::vector<DriverInfo>& rDriverList); + Parser(const OUString& rURL, std::vector<DriverInfo>& rDriverList, VersionType versionType); bool parse(); private: @@ -111,6 +119,7 @@ private: void handleList(xmlreader::XmlReader& rReader); void handleContent(xmlreader::XmlReader& rReader); static void handleDevices(DriverInfo& rDriver, xmlreader::XmlReader& rReader); + uint64_t getVersion(const OString& rString); enum class BlockType { @@ -122,21 +131,20 @@ private: BlockType meBlockType; std::vector<DriverInfo>& mrDriverList; OUString maURL; + const VersionType mVersionType; }; OUString VCL_DLLPUBLIC GetVendorId(DeviceVendor id); -bool VCL_DLLPUBLIC FindBlocklistedDeviceInList(std::vector<DriverInfo>& aDeviceInfos, - OUString const& sDriverVersion, - OUString const& sAdapterVendorID, - OUString const& sAdapterDeviceID, - OperatingSystem system, - const OUString& blocklistURL = OUString()); +bool VCL_DLLPUBLIC FindBlocklistedDeviceInList( + std::vector<DriverInfo>& aDeviceInfos, VersionType versionType, OUString const& sDriverVersion, + OUString const& sAdapterVendorID, OUString const& sAdapterDeviceID, OperatingSystem system, + const OUString& blocklistURL = OUString()); #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) +inline uint64_t OpenGLVersion(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 |