[plasma/kwin/Plasma/6.7] src/backends/drm: backends/drm: don't remove GPUs without outputs
Xaver Hugl <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit f47bc9b29cad6d6e6df66b196883ea4b22f2edec by Xaver Hugl.
Committed on 28/07/2026 at 14:30.
Pushed by zamundaaa into branch 'Plasma/6.7'.
backends/drm: don't remove GPUs without outputs
Non-primary GPUs without outputs were removed previously because:
- it was required for allowing GPUs to fully power down
- being able to unload the driver for VFIO requires file descriptors of the
device to be closed
However, this was 5 years ago, and GPU power management has gotten less terrible
since then. Vulkan drivers also open file descriptors of all GPUs, so drivers
must handle this situation properly either way.
For VFIO, udev "remove" events can be used to make KWin remove the GPU, which is
a better solution, since it works even while displays are connected to it.
This also fixes KWin waking up GPUs when it receives udev events for a GPU
that's in powersave mode, which could (besides the power management impact)
also block KWin's main thread for some time.
BUG: 519461
(cherry picked from commit f8f5bec7b0adcf37bf069b61cd8d992ac830b2bd)
M +1 -4 src/backends/drm/drm_backend.cpp
https://invent.kde.org/plasma/kwin/-/commit/f47bc9b29cad6d6e6df66b196883ea4b22f2edec
diff --git a/src/backends/drm/drm_backend.cpp b/src/backends/drm/drm_backend.cpp
index ff8f2d8b271..770f7f0eefa 100644
--- a/src/backends/drm/drm_backend.cpp
+++ b/src/backends/drm/drm_backend.cpp
@@ -204,9 +204,6 @@ void DrmBackend::handleUdevEvent()
}
} else if (device->action() == QLatin1StringView("change")) {
DrmGpu *gpu = findGpu(device->devNum());
- if (!gpu) {
- gpu = addGpu(device->devNode());
- }
if (gpu && gpu->isActive()) {
qCDebug(KWIN_DRM) << "Received change event for monitored drm device" << gpu->drmDevice()->path();
updateOutputs(gpu);
@@ -282,7 +279,7 @@ void DrmBackend::updateOutputs(DrmGpu *onlyUpdate)
for (auto it = m_gpus.begin(); it != m_gpus.end();) {
DrmGpu *gpu = it->get();
- if (gpu->isRemoved() || (gpu != primaryGpu() && gpu->drmOutputs().isEmpty())) {
+ if (gpu->isRemoved()) {
qCDebug(KWIN_DRM) << "Removing GPU" << it->get();
const std::unique_ptr<DrmGpu> keepAlive = std::move(*it);
it = m_gpus.erase(it);