platforms/drm: Enable atomic modesetting in hot plugged gpus

At the moment, if a gpu is hot plugged, it won't have atomic modesetting
enabled.
This commit is contained in:
Vlad Zahorodnii 2021-04-28 23:18:28 +03:00
parent 03c38e02e9
commit 9f030ecd40
3 changed files with 7 additions and 8 deletions

View file

@ -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;

View file

@ -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()

View file

@ -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;