From c4c46a089f0878df34219eae7aa94d6ecd1aa83b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 28 Apr 2021 23:20:49 +0300 Subject: [PATCH] platforms/drm: Properly detect if there are no DRM devices If no primary gpu can be found, we need to quit. --- src/plugins/platforms/drm/drm_backend.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/drm/drm_backend.cpp b/src/plugins/platforms/drm/drm_backend.cpp index d3fde7fa8e..eabcee66b0 100644 --- a/src/plugins/platforms/drm/drm_backend.cpp +++ b/src/plugins/platforms/drm/drm_backend.cpp @@ -192,16 +192,17 @@ bool DrmBackend::initialize() { connect(session(), &Session::activeChanged, this, &DrmBackend::activate); connect(session(), &Session::awoke, this, &DrmBackend::turnOutputsOn); - std::vector devices = m_udev->listGPUs(); - if (devices.size() == 0) { - qCWarning(KWIN_DRM) << "Did not find a GPU"; - return false; - } + std::vector devices = m_udev->listGPUs(); for (unsigned int gpu_index = 0; gpu_index < devices.size(); gpu_index++) { addGpu(std::move(devices.at(gpu_index))); } + if (m_gpus.isEmpty()) { + qCWarning(KWIN_DRM) << "No suitable DRM devices have been found"; + return false; + } + initCursor(); if (!updateOutputs()) return false;