Skip to content

Commit

Permalink
drm: scan only cards and not outputs, safeguard against null renderer (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
gulafaran authored Nov 13, 2024
1 parent 545f506 commit 3b00e96
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -75,8 +75,6 @@ static std::vector<SP<CSessionDevice>> scanGPUs(SP<CBackend> backend) {
}

udev_list_entry* entry = nullptr;
size_t i = 0;

std::deque<SP<CSessionDevice>> devices;

udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(enumerate)) {
Expand Down Expand Up @@ -125,8 +123,6 @@ static std::vector<SP<CSessionDevice>> scanGPUs(SP<CBackend> backend) {
devices.push_front(sessionDevice);
else
devices.push_back(sessionDevice);

++i;
}

udev_enumerate_unref(enumerate);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3b00e96

Please sign in to comment.