windows: Disable D3D9/11 with ANGLE in VMs

By adding support for the driver description, we can detect if
we are in VMware. In this case D3D9 and 11 get disabled, so only
the software-based options are in use.

This allows running autotests like tst_qopengl, tst_qopenglwidget,
tst_qgl, etc. in the Qt CI system. There OpenGL 2.x is not available,
so ANGLE is the only option. D3D11 is not an option, so it picks D3D9
by default. However, this results in mystic failures. The stable solution
seems to be to use WARP. This can be achieved by setting disable_d3d9 in
the built-in GPU blacklist.

Change-Id: I937c4b3fa82fc1a2d524b4eb712732722df2070c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
Laszlo Agocs 2015-06-18 16:59:54 +02:00 committed by Simon Hausmann
parent 2de01c8388
commit a6000e2b66
6 changed files with 45 additions and 5 deletions

View File

@ -141,6 +141,7 @@ static inline QString vendorIdKey() { return QStringLiteral("vendor_id"); }
static inline QString glVendorKey() { return QStringLiteral("gl_vendor"); }
static inline QString deviceIdKey() { return QStringLiteral("device_id"); }
static inline QString driverVersionKey() { return QStringLiteral("driver_version"); }
static inline QString driverDescriptionKey() { return QStringLiteral("driver_description"); }
static inline QString featuresKey() { return QStringLiteral("features"); }
static inline QString idKey() { return QStringLiteral("id"); }
static inline QString descriptionKey() { return QStringLiteral("description"); }
@ -336,6 +337,15 @@ static bool matches(const QJsonObject &object,
QLatin1String("Driver version must be of type object."));
}
}
if (!gpu.driverDescription.isEmpty()) {
const QJsonValue driverDescriptionV = object.value(driverDescriptionKey());
if (driverDescriptionV.isString()) {
if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8()))
return false;
}
}
return true;
}

View File

@ -79,19 +79,21 @@ public:
bool isValid() const { return deviceId || !glVendor.isEmpty(); }
bool equals(const Gpu &other) const {
return vendorId == other.vendorId && deviceId == other.deviceId && driverVersion == other.driverVersion
&& glVendor == other.glVendor;
&& driverDescription == other.driverDescription && glVendor == other.glVendor;
}
uint vendorId;
uint deviceId;
QVersionNumber driverVersion;
QByteArray driverDescription;
QByteArray glVendor;
static Gpu fromDevice(uint vendorId, uint deviceId, QVersionNumber driverVersion) {
static Gpu fromDevice(uint vendorId, uint deviceId, QVersionNumber driverVersion, const QByteArray &driverDescription) {
Gpu gpu;
gpu.vendorId = vendorId;
gpu.deviceId = deviceId;
gpu.driverVersion = driverVersion;
gpu.driverDescription = driverDescription;
return gpu;
}

View File

@ -1,6 +1,6 @@
{
"name": "Qt built-in GPU driver blacklist",
"version": "5.5",
"version": "5.6",
"entries": [
{
"id": 1,
@ -17,6 +17,16 @@
"features": [
"disable_desktopgl"
]
},
{
"id": 2,
"description": "Disable D3D9 and 11, and rely on software-only D3D in VMs",
"driver_description": "VMware SVGA 3D",
"features": [
"disable_d3d9",
"disable_d3d11"
]
}
]
}

View File

@ -224,7 +224,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
#elif defined(Q_OS_WINCE)
return QWindowsOpenGLTester::Gles;
#else
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.deviceId, gpu.vendorId, gpu.driverVersion);
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.deviceId, gpu.vendorId, gpu.driverVersion, gpu.description);
SupportedRenderersCache *srCache = supportedRenderersCache();
SupportedRenderersCache::const_iterator it = srCache->find(qgpu);
if (it != srCache->cend())

View File

@ -102,6 +102,17 @@
"feature1"
]
},
{
"id": 7,
"description": "driver description test",
"driver_description": "Test",
"os": {
"type": "win"
},
"features": [
"feature2"
]
},
{
"id": 128,
"description": "check for matching GL_VENDOR",

View File

@ -244,13 +244,20 @@ void tst_QOpenGlConfig::testBugList()
expectedFeatures << "feature1";
QVersionNumber driverVersion(QVector<int>() << 9 << 18 << 13 << 4460);
QOpenGLConfig::Gpu gpu = QOpenGLConfig::Gpu::fromDevice(0x10DE, 0x0DE9, driverVersion);
QOpenGLConfig::Gpu gpu = QOpenGLConfig::Gpu::fromDevice(0x10DE, 0x0DE9, driverVersion, QByteArrayLiteral("Unknown"));
QSet<QString> actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("win"),
QVersionNumber(6, 3), fileName);
QVERIFY2(expectedFeatures == actualFeatures,
msgSetMismatch(expectedFeatures, actualFeatures));
gpu = QOpenGLConfig::Gpu::fromDevice(0xDEAD, 0xBEEF, driverVersion, QByteArrayLiteral("Test"));
actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("win"),
QVersionNumber(6, 3), fileName);
expectedFeatures = QSet<QString>() << "feature2";
QVERIFY2(expectedFeatures == actualFeatures,
msgSetMismatch(expectedFeatures, actualFeatures));
gpu = QOpenGLConfig::Gpu::fromGLVendor(QByteArrayLiteral("Somebody Else"));
expectedFeatures.clear();
actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("linux"),