From 3b00e96f90cb0040de6d88ad99bf5f4d443f0c59 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Wed, 13 Nov 2024 12:10:16 +0100 Subject: [PATCH] drm: scan only cards and not outputs, safeguard against null renderer (#106) * drm: dont scan card outputs no need to scan for card[0-9]* and probe card0-eDP etc if they are kms, bootvga and rendernodes etc. skip the wildcard and remove a unused size_t variable. * drm: dont commit state if renderer is missing setting certain env vars to force egl implentations makes the render creation fail on the second gpu. instead of causing a coredump, safeguard commitState and let the monitor turn blank instead. --- src/backend/drm/DRM.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index f69a444..f0f37af 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -50,7 +50,7 @@ static udev_enumerate* enumDRMCards(udev* udev) { return nullptr; udev_enumerate_add_match_subsystem(enumerate, "drm"); - udev_enumerate_add_match_sysname(enumerate, DRM_PRIMARY_MINOR_NAME "[0-9]*"); + udev_enumerate_add_match_sysname(enumerate, DRM_PRIMARY_MINOR_NAME "[0-9]"); if (udev_enumerate_scan_devices(enumerate)) { udev_enumerate_unref(enumerate); @@ -75,8 +75,6 @@ static std::vector> scanGPUs(SP backend) { } udev_list_entry* entry = nullptr; - size_t i = 0; - std::deque> devices; udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(enumerate)) { @@ -125,8 +123,6 @@ static std::vector> scanGPUs(SP backend) { devices.push_front(sessionDevice); else devices.push_back(sessionDevice); - - ++i; } udev_enumerate_unref(enumerate); @@ -1404,6 +1400,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { return false; } + if (!backend->rendererState.renderer) { + backend->backend->log(AQ_LOG_ERROR, "drm: No renderer attached to backend"); + return false; + } + const auto& STATE = state->state(); const uint32_t COMMITTED = STATE.committed;