diff --git a/src/backends/drm/drm_gpu.cpp b/src/backends/drm/drm_gpu.cpp index ea5a414912..145252ac1a 100644 --- a/src/backends/drm/drm_gpu.cpp +++ b/src/backends/drm/drm_gpu.cpp @@ -263,9 +263,7 @@ bool DrmGpu::updateOutputs() conn->updateProperties(); } if (conn->isConnected()) { - if (auto output = findOutput(conn->id())) { - output->updateModes(); - } else if (!findLeaseOutput(conn->id())) { + if (conn->isNonDesktop() ? !findLeaseOutput(conn->id()) : !findOutput(conn->id())) { qCDebug(KWIN_DRM, "New %soutput on GPU %s: %s", conn->isNonDesktop() ? "non-desktop " : "", qPrintable(m_devNode), qPrintable(conn->modelName())); m_pipelines << conn->pipeline(); if (conn->isNonDesktop()) { diff --git a/src/backends/drm/drm_object_connector.cpp b/src/backends/drm/drm_object_connector.cpp index d7359c4f14..4840724bc6 100644 --- a/src/backends/drm/drm_object_connector.cpp +++ b/src/backends/drm/drm_object_connector.cpp @@ -13,6 +13,7 @@ #include "logging.h" #include "drm_pipeline.h" #include "drm_object_crtc.h" +#include "drm_output.h" #include // frameworks @@ -286,11 +287,19 @@ bool DrmConnector::needsModeset() const void DrmConnector::updateModes() { - m_modes.clear(); - - // reload modes - for (int i = 0; i < m_conn->count_modes; i++) { - m_modes.append(QSharedPointer::create(this, m_conn->modes[i])); + bool equal = m_conn->count_modes == m_modes.count(); + for (int i = 0; equal && i < m_conn->count_modes; i++) { + equal &= checkIfEqual(m_modes[i]->nativeMode(), &m_conn->modes[i]); + } + if (!equal) { + // reload modes + m_modes.clear(); + for (int i = 0; i < m_conn->count_modes; i++) { + m_modes.append(QSharedPointer::create(this, m_conn->modes[i])); + } + if (const auto output = dynamic_cast(m_pipeline->displayDevice())) { + output->updateModes(); + } } }