diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-05 15:45:53 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-14 16:23:47 +0000 |
commit | 4dd7aeee10fc4d3883fd26fd70662405b533b6b4 (patch) | |
tree | 4e3d848561bb3571db83f94b74d5dd09bca0de55 /src/plugins | |
parent | af495c2042b6c460580041fd0c39697c144e45f7 (diff) |
Add support for GPU bug list reading.
- Add support for reading out feature lists from GPU bug lists
in Chromium format (supporting OS + version, exceptions lists,
device ids and vendor ids).
Add a overloads allowing for passing file name,
data or JSON documents.
- Test reading in tst_qopenglconfig
- Prototypically have the Windows plugin read the file
from the environment variable "QT_OPENGL_BUGLIST" and
turn off renderers depending on the standard keyword
"disable_d3d11" and newly introduced keywords
"disable_d3d9", "disable_desktopgl".
- QT_OPENGL_BUGLIST can point to an absolute or relative
path, in which case it is resolved via QLibraryInfo::SettingsPath
and QStandardPaths::ConfigLocation.
[ChangeLog][QtGui][Windows]
Introduce experimental feature allowing the user to specify
a GPU driver buglist with some additional keywords to chooose
the GL renderer backend depending on GPU.
Task-number: QTBUG-43263
Change-Id: I8c20b0e8ee3cf575b91d0672bf405c42d3e9fb64
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsopengltester.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 12d45f432b..ba4c95544e 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -38,6 +38,12 @@ #include <QtCore/QDebug> #include <QtCore/QTextStream> #include <QtCore/QCoreApplication> +#include <QtCore/QFile> +#include <QtCore/QFileInfo> +#include <QtCore/QStandardPaths> +#include <QtCore/QLibraryInfo> + +#include <private/qopengl_p.h> #ifndef Q_OS_WINCE # include <QtCore/qt_windows.h> @@ -183,6 +189,57 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() return QWindowsOpenGLTester::InvalidRenderer; } +#ifndef Q_OS_WINCE + +static inline QString resolveBugListFile(const QString &fileName) +{ + if (QFileInfo(fileName).isAbsolute()) + return fileName; + // Try QLibraryInfo::SettingsPath which is typically empty unless specified in qt.conf, + // then resolve via QStandardPaths::ConfigLocation. + const QString settingsPath = QLibraryInfo::location(QLibraryInfo::SettingsPath); + if (!settingsPath.isEmpty()) { // SettingsPath is empty unless specified in qt.conf. + const QFileInfo fi(settingsPath + QLatin1Char('/') + fileName); + if (fi.isFile()) + return fi.absoluteFilePath(); + } + return QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName); +} + +static void readDriverBugList(const GpuDescription &gpu, + QWindowsOpenGLTester::Renderers *result) +{ + const char bugListFileVar[] = "QT_OPENGL_BUGLIST"; + if (!qEnvironmentVariableIsSet(bugListFileVar)) + return; + const QString fileName = resolveBugListFile(QFile::decodeName(qgetenv(bugListFileVar))); + if (fileName.isEmpty()) + return; + QOpenGLConfig::Gpu qgpu; + qgpu.deviceId = gpu.deviceId; + qgpu.vendorId = gpu.vendorId; + qgpu.driverVersion = gpu.driverVersion; + const QSet<QString> features = QOpenGLConfig::gpuFeatures(qgpu, fileName); + if (features.contains(QStringLiteral("disable_desktopgl"))) { // Qt-specific + qCWarning(lcQpaGl) << "Disabling Desktop GL: " << gpu; + *result &= ~QWindowsOpenGLTester::DesktopGl; + } + if (features.contains(QStringLiteral("disable_angle"))) { // Qt-specific keyword + qCWarning(lcQpaGl) << "Disabling ANGLE: " << gpu; + *result &= ~QWindowsOpenGLTester::GlesMask; + } else { + if (features.contains(QStringLiteral("disable_d3d11"))) { // standard keyword + qCWarning(lcQpaGl) << "Disabling D3D11: " << gpu; + *result &= ~QWindowsOpenGLTester::AngleRendererD3d11; + } + if (features.contains(QStringLiteral("disable_d3d9"))) { // Qt-specific + qCWarning(lcQpaGl) << "Disabling D3D9: " << gpu; + *result &= ~QWindowsOpenGLTester::AngleRendererD3d9; + } + } +} +#endif // !Q_OS_WINCE + static inline QWindowsOpenGLTester::Renderers detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly) { @@ -196,6 +253,9 @@ static inline QWindowsOpenGLTester::Renderers if (!glesOnly && QWindowsOpenGLTester::testDesktopGL()) result |= QWindowsOpenGLTester::DesktopGl; + + readDriverBugList(gpu, &result); + return result; #else // !Q_OS_WINCE return QWindowsOpenGLTester::Gles; |