From 1af2067f40005feab391c881e43f453efe81f9ab Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 2 Sep 2021 15:21:57 +0200 Subject: [PATCH] platforms/drm: reload m_conn in DrmConnector::updateProperties --- src/plugins/platforms/drm/drm_gpu.cpp | 1 + src/plugins/platforms/drm/drm_object_connector.cpp | 12 ++++++++++-- src/plugins/platforms/drm/drm_object_connector.h | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/drm/drm_gpu.cpp b/src/plugins/platforms/drm/drm_gpu.cpp index 65fb3b7544..d17790c322 100644 --- a/src/plugins/platforms/drm/drm_gpu.cpp +++ b/src/plugins/platforms/drm/drm_gpu.cpp @@ -179,6 +179,7 @@ bool DrmGpu::updateOutputs() } m_connectors << c; } else { + (*it)->updateProperties(); oldConnectors.removeOne(*it); } } diff --git a/src/plugins/platforms/drm/drm_object_connector.cpp b/src/plugins/platforms/drm/drm_object_connector.cpp index 7c1ee92f64..61c966989e 100644 --- a/src/plugins/platforms/drm/drm_object_connector.cpp +++ b/src/plugins/platforms/drm/drm_object_connector.cpp @@ -138,9 +138,8 @@ bool DrmConnector::init() return true; } -bool DrmConnector::isConnected() +bool DrmConnector::isConnected() const { - m_conn.reset(drmModeGetConnector(gpu()->fd(), id())); if (!m_conn) { return false; } @@ -335,4 +334,13 @@ AbstractWaylandOutput::RgbRange DrmConnector::rgbRange() const return rgb->enumForValue(rgb->pending()); } +bool DrmConnector::updateProperties() +{ + if (!DrmObject::updateProperties()) { + return false; + } + m_conn.reset(drmModeGetConnector(gpu()->fd(), id())); + return m_conn != nullptr; +} + } diff --git a/src/plugins/platforms/drm/drm_object_connector.h b/src/plugins/platforms/drm/drm_object_connector.h index ba06742199..6a44752e0b 100644 --- a/src/plugins/platforms/drm/drm_object_connector.h +++ b/src/plugins/platforms/drm/drm_object_connector.h @@ -54,7 +54,7 @@ public: return m_encoders; } - bool isConnected(); + bool isConnected() const; bool isNonDesktop() const { auto prop = m_props.at(static_cast(PropertyIndex::NonDesktop)); @@ -103,6 +103,7 @@ public: AbstractWaylandOutput::RgbRange rgbRange() const; bool needsModeset() const override; + bool updateProperties() override; private: DrmScopedPointer m_conn;