backend/drm: support semicolon delimiter for PCI paths in AQ_DRM_DEVICES

This commit is contained in:
sigma 2026-03-23 22:18:45 +01:00
parent f62a4dbfa4
commit 699fc73aa7

View file

@ -177,7 +177,18 @@ static std::vector<SP<CSessionDevice>> scanGPUs(SP<CBackend> backend) {
auto explicitGpus = getenv("AQ_DRM_DEVICES");
if (explicitGpus) {
backend->log(AQ_LOG_DEBUG, std::format("drm: Explicit device list {}", explicitGpus));
Hyprutils::String::CVarList explicitDevices(explicitGpus, 0, ':', true);
std::string explicitGpusStr = explicitGpus;
char delimiter = ':';
std::error_code ec;
if (std::filesystem::exists(explicitGpusStr, ec)) {
delimiter = ';';
}
if (explicitGpusStr.find(';') != std::string::npos)
delimiter = ';';
Hyprutils::String::CVarList explicitDevices(explicitGpus, 0, delimiter, true);
// Iterate over GPUs and canonicalize the paths
for (auto& d : explicitDevices) {
@ -189,6 +200,10 @@ static std::vector<SP<CSessionDevice>> scanGPUs(SP<CBackend> backend) {
// TODO: Verify that the path is a valid DRM device. (https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/backend/session/session.c?ref_type=heads#L369-387)
if (ec) {
backend->log(AQ_LOG_ERROR, std::format("drm: Failed to canonicalize path {}", d));
if (delimiter == ':') {
backend->log(AQ_LOG_ERROR, "drm: If you are using PCI paths with colons, use ';' as a separator instead of ':'.");
}
continue;
}