summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-06-14 10:30:00 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-16 22:39:25 +0000
commit81cd07baf605ee8b972f64fd2712dcae9a7cdb56 (patch)
tree85a577afd0717258802492cf0de9d6ab9795d168 /tests
parentaaa806bac51a3835039553fb68829361b892122b (diff)
Work around lavapipe bug in tst_qvulkan
Work around https://gitlab.freedesktop.org/mesa/mesa/-/issues/5875 by treating the driver as broken when both the driver and device UUIDs are all zeroes. Fixes: QTBUG-104231 Change-Id: Ibf7973361d472ebb1cb433bc61b50b2828f75c6b Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit e4961afed2fc019c2a95ca582f86da2de56e351f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/qvulkan/tst_qvulkan.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/gui/qvulkan/tst_qvulkan.cpp b/tests/auto/gui/qvulkan/tst_qvulkan.cpp
index f01777a1e9..88171a80c6 100644
--- a/tests/auto/gui/qvulkan/tst_qvulkan.cpp
+++ b/tests/auto/gui/qvulkan/tst_qvulkan.cpp
@@ -137,15 +137,17 @@ void tst_QVulkan::vulkan11()
QByteArray deviceUuid = QByteArray::fromRawData((const char *) deviceIdProps.deviceUUID, VK_UUID_SIZE).toHex();
QByteArray driverUuid = QByteArray::fromRawData((const char *) deviceIdProps.driverUUID, VK_UUID_SIZE).toHex();
qDebug() << "deviceUUID" << deviceUuid << "driverUUID" << driverUuid;
+ const bool deviceUuidZero = std::find_if(deviceUuid.cbegin(), deviceUuid.cend(), [](char c) -> bool { return c; }) == deviceUuid.cend();
+ const bool driverUuidZero = std::find_if(driverUuid.cbegin(), driverUuid.cend(), [](char c) -> bool { return c; }) == driverUuid.cend();
// deviceUUID cannot be all zero as per spec
- bool seenNonZero = false;
- for (int i = 0; i < VK_UUID_SIZE; ++i) {
- if (deviceIdProps.deviceUUID[i]) {
- seenNonZero = true;
- break;
- }
+ if (!driverUuidZero) {
+ // ...but then there are implementations such as some
+ // versions of Mesa lavapipe, that returns all zeroes
+ // for both uuids. skip the check if the driver uuid
+ // was zero too.
+ // https://gitlab.freedesktop.org/mesa/mesa/-/issues/5875
+ QVERIFY(!deviceUuidZero);
}
- QVERIFY(seenNonZero);
} else {
qDebug("Physical device is not Vulkan 1.1 capable");
}