diff --git a/src/plugins/platforms/drm/drm_backend.cpp b/src/plugins/platforms/drm/drm_backend.cpp index 321171365e..d3fde7fa8e 100644 --- a/src/plugins/platforms/drm/drm_backend.cpp +++ b/src/plugins/platforms/drm/drm_backend.cpp @@ -202,12 +202,6 @@ bool DrmBackend::initialize() addGpu(std::move(devices.at(gpu_index))); } - // trying to activate Atomic Mode Setting (this means also Universal Planes) - if (!qEnvironmentVariableIsSet("KWIN_DRM_NO_AMS")) { - for (auto gpu : m_gpus) - gpu->tryAMS(); - } - initCursor(); if (!updateOutputs()) return false; diff --git a/src/plugins/platforms/drm/drm_gpu.cpp b/src/plugins/platforms/drm/drm_gpu.cpp index a180ff194a..2f491d014d 100644 --- a/src/plugins/platforms/drm/drm_gpu.cpp +++ b/src/plugins/platforms/drm/drm_gpu.cpp @@ -76,6 +76,12 @@ DrmGpu::DrmGpu(DrmBackend *backend, QByteArray devNode, int fd, dev_t deviceId) m_socketNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(m_socketNotifier, &QSocketNotifier::activated, this, &DrmGpu::dispatchEvents); + + // trying to activate Atomic Mode Setting (this means also Universal Planes) + static const bool atomicModesetting = !qEnvironmentVariableIsSet("KWIN_DRM_NO_AMS"); + if (atomicModesetting) { + tryAMS(); + } } DrmGpu::~DrmGpu() diff --git a/src/plugins/platforms/drm/drm_gpu.h b/src/plugins/platforms/drm/drm_gpu.h index 5c9efa5e9e..0dfabdbff5 100644 --- a/src/plugins/platforms/drm/drm_gpu.h +++ b/src/plugins/platforms/drm/drm_gpu.h @@ -105,9 +105,7 @@ Q_SIGNALS: void outputDisabled(DrmOutput *output); protected: - friend class DrmBackend; - void tryAMS(); bool updateOutputs(); private: @@ -115,6 +113,7 @@ private: DrmPlane *getCompatiblePlane(DrmPlane::TypeIndex typeIndex, DrmCrtc *crtc); DrmOutput *findOutput(quint32 connector); void removeOutput(DrmOutput *output); + void tryAMS(); DrmBackend* const m_backend; AbstractEglBackend *m_eglBackend;