LibreOffice Module vcl (master)  1
WinDeviceInfo.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX
11 #define INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX
12 
13 #include <vcl/dllapi.h>
14 
15 #include <opengl/DeviceInfo.hxx>
16 
17 #include <rtl/ustring.hxx>
18 #include <vector>
19 #include <cstdint>
20 
21 namespace wgl {
22 
36 };
37 
39  DRIVER_LESS_THAN, // driver < version
40  DRIVER_LESS_THAN_OR_EQUAL, // driver <= version
41  DRIVER_GREATER_THAN, // driver > version
42  DRIVER_GREATER_THAN_OR_EQUAL, // driver >= version
43  DRIVER_EQUAL, // driver == version
44  DRIVER_NOT_EQUAL, // driver != version
45  DRIVER_BETWEEN_EXCLUSIVE, // driver > version && driver < versionMax
46  DRIVER_BETWEEN_INCLUSIVE, // driver >= version && driver <= versionMax
47  DRIVER_BETWEEN_INCLUSIVE_START, // driver >= version && driver < versionMax
49 };
50 
59 };
60 
61 bool ParseDriverVersion(const OUString& rString, uint64_t& rVersion);
62 
64 {
65 
66  DriverInfo(OperatingSystem os, const OUString& vendor, VersionComparisonOp op,
67  uint64_t driverVersion, bool bWhiteListed = false, const char *suggestedVersion = nullptr);
68 
69  DriverInfo();
70  virtual ~DriverInfo();
71 
74 
75  OUString maAdapterVendor;
76 
77  std::vector<OUString> maDevices;
78 
79  // Whether the mDevices array should be deleted when this structure is
80  // deallocated. False by default.
82 
84 
86 
87  /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
88  uint64_t mnDriverVersion;
90  static uint64_t allDriverVersions;
91 
93  OUString maMsg;
94 };
95 
96 #define GFX_DRIVER_VERSION(a,b,c,d) \
97  ((uint64_t(a)<<48) | (uint64_t(b)<<32) | (uint64_t(c)<<16) | uint64_t(d))
98 
99 inline VCL_DLLPUBLIC uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
100 {
101  // We make sure every driver number is padded by 0s, this will allow us the
102  // easiest 'compare as if decimals' approach. See ParseDriverVersion for a
103  // more extensive explanation of this approach.
104  while (b > 0 && b < 1000) {
105  b *= 10;
106  }
107  while (c > 0 && c < 1000) {
108  c *= 10;
109  }
110  while (d > 0 && d < 1000) {
111  d *= 10;
112  }
113  return GFX_DRIVER_VERSION(a, b, c, d);
114 }
115 
116 }
117 
119 {
120 private:
121  OUString maDriverVersion;
123 
124  OUString maDriverDate;
125  OUString maDriverDate2;
126 
127  OUString maDeviceID;
128  OUString maDeviceID2;
129 
133 
137 
138  OUString maDeviceKey;
139  OUString maDeviceKey2;
140 
141  OUString maDeviceString;
142  OUString maDeviceString2;
144 
146  bool mbRDP;
147 
148  void GetData();
149  static void FillBlacklist();
150  bool FindBlocklistedDeviceInList();
151 
152  static OUString* mpDeviceVendors[wgl::DeviceVendorMax];
153  static std::vector<wgl::DriverInfo> maDriverInfo;
154 
155 public:
157 
158  static OUString GetDeviceVendor(wgl::DeviceVendor eVendor);
159  virtual ~WinOpenGLDeviceInfo() override;
160 
161  virtual bool isDeviceBlocked() override;
162 
163  const OUString& GetDriverVersion() const
164  {
165  return maDriverVersion;
166  }
167 
168  const OUString& GetDriverDate() const
169  {
170  return maDriverDate;
171  }
172 
173  const OUString& GetDeviceID() const
174  {
175  return maDeviceID;
176  }
177 
178  const OUString& GetAdapterVendorID() const
179  {
180  return maAdapterVendorID;
181  }
182 
183  const OUString& GetAdapterDeviceID() const
184  {
185  return maAdapterDeviceID;
186  }
187 
188  const OUString& GetAdapterSubsysID() const
189  {
190  return maAdapterSubsysID;
191  }
192  const OUString& GetDeviceKey() const
193  {
194  return maDeviceKey;
195  }
196 
197  const OUString& GetDeviceString() const
198  {
199  return maDeviceString;
200  }
201 
202  sal_uInt32 GetWindowsVersion() const
203  {
204  return mnWindowsVersion;
205  }
206 
207  static bool FindBlocklistedDeviceInList(std::vector<wgl::DriverInfo>& aDeviceInfos,
208  OUString const & sDriverVersion, OUString const & sAdapterVendorID,
209  OUString const & sAdapterDeviceID, uint32_t nWindowsVersion);
210 };
211 
212 #endif
213 
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
VersionComparisonOp meComparisonOp
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
const OUString & GetAdapterDeviceID() const
const OUString & GetDeviceID() const
OUString maAdapterVendor
OUString maSuggestedVersion
std::vector< OUString > maDevices
VersionComparisonOp
const OUString & GetDriverVersion() const
#define GFX_DRIVER_VERSION(a, b, c, d)
OperatingSystem
uint64_t mnDriverVersionMax
const OUString & GetDeviceKey() const
sal_uInt32 GetWindowsVersion() const
OperatingSystem meOperatingSystem
static std::vector< wgl::DriverInfo > maDriverInfo
virtual bool isDeviceBlocked()=0
const OUString & GetDriverDate() const
bool ParseDriverVersion(const OUString &rString, uint64_t &rVersion)
const OUString & GetAdapterSubsysID() const
uint32_t mnOperatingSystemVersion
uint64_t mnDriverVersion
VCL_DLLPUBLIC uint64_t V(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
const OUString & GetAdapterVendorID() const
const OUString & GetDeviceString() const
static uint64_t allDriverVersions