From 7582d72eac8d3bb47309d3333650a226a5b2d547 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Mon, 21 Aug 2023 13:41:57 +0200 Subject: [PATCH] backends/drm: cache the canonical file path of the device --- src/backends/drm/drm_backend.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backends/drm/drm_backend.cpp b/src/backends/drm/drm_backend.cpp index 476d10b91f..bfd3521eb2 100644 --- a/src/backends/drm/drm_backend.cpp +++ b/src/backends/drm/drm_backend.cpp @@ -175,8 +175,9 @@ void DrmBackend::handleUdevEvent() while (auto device = m_udevMonitor->getDevice()) { // Ignore the device seat if the KWIN_DRM_DEVICES envvar is set. if (!m_explicitGpus.isEmpty()) { - const bool foundMatch = std::any_of(m_explicitGpus.begin(), m_explicitGpus.end(), [&device](const QString &explicitPath) { - return QFileInfo(explicitPath).canonicalPath() == QFileInfo(device->devNode()).canonicalPath(); + const auto canonicalPath = QFileInfo(device->devNode()).canonicalPath(); + const bool foundMatch = std::any_of(m_explicitGpus.begin(), m_explicitGpus.end(), [&canonicalPath](const QString &explicitPath) { + return QFileInfo(explicitPath).canonicalPath() == canonicalPath; }); if (!foundMatch) { continue;