platforms/drm: consider KWIN_DRM_DEVICES for hotplugged gpus
This commit is contained in:
parent
ff99100ec5
commit
2e0336681f
2 changed files with 7 additions and 3 deletions
|
@ -66,6 +66,7 @@ DrmBackend::DrmBackend(QObject *parent)
|
||||||
, m_udev(new Udev)
|
, m_udev(new Udev)
|
||||||
, m_udevMonitor(m_udev->monitor())
|
, m_udevMonitor(m_udev->monitor())
|
||||||
, m_session(Session::create(this))
|
, m_session(Session::create(this))
|
||||||
|
, m_explicitGpus(qEnvironmentVariable("KWIN_DRM_DEVICES").split(':', Qt::SkipEmptyParts))
|
||||||
, m_dpmsFilter()
|
, m_dpmsFilter()
|
||||||
{
|
{
|
||||||
setSupportsGammaControl(true);
|
setSupportsGammaControl(true);
|
||||||
|
@ -195,9 +196,8 @@ bool DrmBackend::initialize()
|
||||||
connect(session(), &Session::activeChanged, this, &DrmBackend::activate);
|
connect(session(), &Session::activeChanged, this, &DrmBackend::activate);
|
||||||
connect(session(), &Session::awoke, this, &DrmBackend::turnOutputsOn);
|
connect(session(), &Session::awoke, this, &DrmBackend::turnOutputsOn);
|
||||||
|
|
||||||
const QStringList explicitGpus = qEnvironmentVariable("KWIN_DRM_DEVICES").split(':', Qt::SkipEmptyParts);
|
if (!m_explicitGpus.isEmpty()) {
|
||||||
if (!explicitGpus.isEmpty()) {
|
for (const QString &fileName : m_explicitGpus) {
|
||||||
for (const QString &fileName : explicitGpus) {
|
|
||||||
addGpu(fileName);
|
addGpu(fileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -254,6 +254,9 @@ void DrmBackend::handleUdevEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->action() == QStringLiteral("add")) {
|
if (device->action() == QStringLiteral("add")) {
|
||||||
|
if (!m_explicitGpus.isEmpty() && !m_explicitGpus.contains(device->devNode())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
qCDebug(KWIN_DRM) << "New gpu found:" << device->devNode();
|
qCDebug(KWIN_DRM) << "New gpu found:" << device->devNode();
|
||||||
if (addGpu(device->devNode())) {
|
if (addGpu(device->devNode())) {
|
||||||
updateOutputs();
|
updateOutputs();
|
||||||
|
|
|
@ -105,6 +105,7 @@ private:
|
||||||
DrmVirtualOutput *m_placeHolderOutput = nullptr;
|
DrmVirtualOutput *m_placeHolderOutput = nullptr;
|
||||||
|
|
||||||
bool m_active = false;
|
bool m_active = false;
|
||||||
|
const QStringList m_explicitGpus;
|
||||||
QVector<DrmGpu*> m_gpus;
|
QVector<DrmGpu*> m_gpus;
|
||||||
QScopedPointer<DpmsInputEventFilter> m_dpmsFilter;
|
QScopedPointer<DpmsInputEventFilter> m_dpmsFilter;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue